Skip to content

Commit 26a6b76

Browse files
stripe-dotnet v35.0 (#1934)
* Drop support for .NET Standard 1.2 (#1933) * Add support for passing parameters for all Delete methods * Make options optional * Remove conditional compilation macros (#1935) * Move to latest API version and remove deprecated properties * Get accurate runtime version (#1936) * Add support for `NextInvoiceSequence` on `Customer` Co-authored-by: remi-stripe <remi@stripe.com>
1 parent 9952a96 commit 26a6b76

File tree

76 files changed

+566
-262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+566
-262
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Build Status](https://ci.appveyor.com/api/projects/status/rg0pg5tlr1a6f8tf/branch/master?svg=true)](https://ci.appveyor.com/project/stripe/stripe-dotnet)
55
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-dotnet/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-dotnet?branch=master)
66

7-
The official [Stripe][stripe] .NET library, supporting .NET Standard 1.2+, .NET Core 1.0+, and .NET Framework 4.5+.
7+
The official [Stripe][stripe] .NET library, supporting .NET Standard 2.0+, .NET Core 2.0+, and .NET Framework 4.5+.
88

99
## Installation
1010

appveyor.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ environment:
55
COVERALLS_REPO_TOKEN:
66
secure: T0PmP8uyzCseacBCDRBlti2y9Tz5DL6fknea0MKWvbPYrzADmLY2/5kOTfYIsPUk
77
# If you bump this, don't forget to bump `MinimumMockVersion` in `StripeMockFixture.cs` as well.
8-
STRIPE_MOCK_VERSION: 0.82.0
8+
STRIPE_MOCK_VERSION: 0.83.0
99

1010
deploy:
1111
- provider: NuGet
@@ -55,12 +55,12 @@ test_script:
5555

5656
after_test:
5757
- ps: Write-Host $("`n RUNNING COVERAGE `n") -BackgroundColor DarkCyan
58-
- dotnet test -c Debug -f netcoreapp3.0 src/StripeTests/StripeTests.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=CompilerGenerated
58+
- dotnet test -c Debug -f netcoreapp3.1 src/StripeTests/StripeTests.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=CompilerGenerated
5959
- ps: |
6060
# Secure env vars are not available on all branches, so make sure the
6161
# token is available before invoking Coveralls.
6262
if (Test-Path env:COVERALLS_REPO_TOKEN) {
63-
.\tools\csmacnz.Coveralls --opencover -i src/StripeTests/coverage.netcoreapp3.0.opencover.xml --useRelativePaths
63+
.\tools\csmacnz.Coveralls --opencover -i src/StripeTests/coverage.netcoreapp3.1.opencover.xml --useRelativePaths
6464
}
6565
6666
artifacts:

src/Stripe.net/Entities/Charges/ChargePaymentMethodDetails/ChargePaymentMethodDetailsCardPresent.cs

-8
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ public class ChargePaymentMethodDetailsCardPresent : StripeEntity<ChargePaymentM
6161
[JsonProperty("generated_card")]
6262
public string GeneratedCard { get; set; }
6363

64-
[Obsolete("Use GeneratedCard instead.")]
65-
[JsonIgnore]
66-
public string GeneratedCardId
67-
{
68-
get => this.GeneratedCard;
69-
set => this.GeneratedCardId = value;
70-
}
71-
7264
/// <summary>
7365
/// The last four digits of the card.
7466
/// </summary>

src/Stripe.net/Entities/Customers/Customer.cs

+6
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ public IPaymentSource DefaultSource
134134
[JsonProperty("name")]
135135
public string Name { get; set; }
136136

137+
/// <summary>
138+
/// The suffix of the customer’s next invoice number.
139+
/// </summary>
140+
[JsonProperty("next_invoice_sequence")]
141+
public long NextInvoiceSequence { get; set; }
142+
137143
/// <summary>
138144
/// The customer’s phone number.
139145
/// </summary>

src/Stripe.net/Entities/WebhookEndpoints/WebhookEndpoint.cs

-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ public class WebhookEndpoint : StripeEntity<WebhookEndpoint>, IHasId, IHasObject
3131
[JsonProperty("application")]
3232
public string Application { get; set; }
3333

34-
[Obsolete("Use Application instead")]
35-
[JsonIgnore]
36-
public string ApplicationId
37-
{
38-
get => this.Application;
39-
set => this.Application = value;
40-
}
41-
4234
[Obsolete("This property was never returned. Use Application instead")]
4335
[JsonProperty("connect")]
4436
public bool Connect { get; set; }

src/Stripe.net/Infrastructure/FormEncoding/MultipartFormDataContent.cs

-2
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ private static StreamContent CreateStreamContent(Stream value, string name)
4646
var fileName = "blob";
4747
var extension = string.Empty;
4848

49-
#if NET45 || NETSTANDARD2_0
5049
FileStream fileStream = value as FileStream;
5150
if ((fileStream != null) && (!string.IsNullOrEmpty(fileStream.Name)))
5251
{
5352
fileName = fileStream.Name;
5453
extension = Path.GetExtension(fileName);
5554
}
56-
#endif
5755

5856
var content = new StreamContent(value);
5957
content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")

src/Stripe.net/Infrastructure/Public/StripeConfiguration.cs

+4-16
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ namespace Stripe
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.Configuration;
56
using System.Reflection;
67
using Newtonsoft.Json;
78
using Stripe.Infrastructure;
8-
#if NET45 || NETSTANDARD2_0
9-
using System.Configuration;
10-
#endif
119

1210
/// <summary>
1311
/// Global configuration class for Stripe.net settings.
@@ -32,28 +30,23 @@ static StripeConfiguration()
3230
}
3331

3432
/// <summary>API version used by Stripe.net.</summary>
35-
public static string ApiVersion => "2019-12-03";
33+
public static string ApiVersion => "2020-03-02";
3634

37-
#if NET45 || NETSTANDARD2_0
3835
/// <summary>Gets or sets the API key.</summary>
3936
/// <remarks>
4037
/// You can also set the API key using the <c>StripeApiKey</c> key in
4138
/// <see cref="System.Configuration.ConfigurationManager.AppSettings"/>.
4239
/// </remarks>
43-
#else
44-
/// <summary>Gets or sets the API key.</summary>
45-
#endif
4640
public static string ApiKey
4741
{
4842
get
4943
{
50-
#if NET45 || NETSTANDARD2_0
5144
if (string.IsNullOrEmpty(apiKey) &&
5245
!string.IsNullOrEmpty(ConfigurationManager.AppSettings["StripeApiKey"]))
5346
{
5447
apiKey = ConfigurationManager.AppSettings["StripeApiKey"];
5548
}
56-
#endif
49+
5750
return apiKey;
5851
}
5952

@@ -68,26 +61,21 @@ public static string ApiKey
6861
}
6962
}
7063

71-
#if NET45 || NETSTANDARD2_0
7264
/// <summary>Gets or sets the client ID.</summary>
7365
/// <remarks>
7466
/// You can also set the client ID using the <c>StripeClientId</c> key in
7567
/// <see cref="System.Configuration.ConfigurationManager.AppSettings"/>.
7668
/// </remarks>
77-
#else
78-
/// <summary>Gets or sets the client ID.</summary>
79-
#endif
8069
public static string ClientId
8170
{
8271
get
8372
{
84-
#if NET45 || NETSTANDARD2_0
8573
if (string.IsNullOrEmpty(apiKey) &&
8674
!string.IsNullOrEmpty(ConfigurationManager.AppSettings["StripeClientId"]))
8775
{
8876
clientId = ConfigurationManager.AppSettings["StripeClientId"];
8977
}
90-
#endif
78+
9179
return clientId;
9280
}
9381

src/Stripe.net/Infrastructure/Public/SystemNetHttpClient.cs

+12-22
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ namespace Stripe
2121
/// </summary>
2222
public class SystemNetHttpClient : IHttpClient
2323
{
24+
private const string StripeNetTargetFramework =
25+
#if NETSTANDARD2_0
26+
"netstandard2.0"
27+
#elif NET45
28+
"net45"
29+
#else
30+
"unknown"
31+
#endif
32+
;
33+
2434
private static readonly Lazy<System.Net.Http.HttpClient> LazyDefaultHttpClient
2535
= new Lazy<System.Net.Http.HttpClient>(BuildDefaultSystemNetHttpClient);
2636

@@ -204,31 +214,11 @@ private string BuildStripeClientUserAgentString()
204214
{ "bindings_version", StripeConfiguration.StripeNetVersion },
205215
{ "lang", ".net" },
206216
{ "publisher", "stripe" },
207-
{ "lang_version", RuntimeInformation.GetLanguageVersion() },
217+
{ "lang_version", RuntimeInformation.GetRuntimeVersion() },
208218
{ "os_version", RuntimeInformation.GetOSVersion() },
219+
{ "stripe_net_target_framework", StripeNetTargetFramework },
209220
};
210221

211-
#if NET45
212-
string monoVersion = RuntimeInformation.GetMonoVersion();
213-
if (!string.IsNullOrEmpty(monoVersion))
214-
{
215-
values.Add("mono_version", monoVersion);
216-
}
217-
#endif
218-
219-
var stripeNetTargetFramework =
220-
#if NET45
221-
"net45"
222-
#elif NETSTANDARD1_2
223-
"netstandard1.2"
224-
#elif NETSTANDARD2_0
225-
"netstandard2.0"
226-
#else
227-
"unknown"
228-
#endif
229-
;
230-
values.Add("stripe_net_target_framework", stripeNetTargetFramework);
231-
232222
if (this.appInfo != null)
233223
{
234224
values.Add("application", this.appInfo);

0 commit comments

Comments
 (0)