Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stripe-dotnet v35.0 #1934

Merged
merged 10 commits into from
Mar 4, 2020
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Build Status](https://ci.appveyor.com/api/projects/status/rg0pg5tlr1a6f8tf/branch/master?svg=true)](https://ci.appveyor.com/project/stripe/stripe-dotnet)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-dotnet/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-dotnet?branch=master)

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

## Installation

Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ environment:
COVERALLS_REPO_TOKEN:
secure: T0PmP8uyzCseacBCDRBlti2y9Tz5DL6fknea0MKWvbPYrzADmLY2/5kOTfYIsPUk
# If you bump this, don't forget to bump `MinimumMockVersion` in `StripeMockFixture.cs` as well.
STRIPE_MOCK_VERSION: 0.82.0
STRIPE_MOCK_VERSION: 0.83.0

deploy:
- provider: NuGet
Expand Down Expand Up @@ -55,12 +55,12 @@ test_script:

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

artifacts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ public class ChargePaymentMethodDetailsCardPresent : StripeEntity<ChargePaymentM
[JsonProperty("generated_card")]
public string GeneratedCard { get; set; }

[Obsolete("Use GeneratedCard instead.")]
[JsonIgnore]
public string GeneratedCardId
{
get => this.GeneratedCard;
set => this.GeneratedCardId = value;
}

/// <summary>
/// The last four digits of the card.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions src/Stripe.net/Entities/Customers/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ public IPaymentSource DefaultSource
[JsonProperty("name")]
public string Name { get; set; }

/// <summary>
/// The suffix of the customer’s next invoice number.
/// </summary>
[JsonProperty("next_invoice_sequence")]
public long NextInvoiceSequence { get; set; }

/// <summary>
/// The customer’s phone number.
/// </summary>
Expand Down
8 changes: 0 additions & 8 deletions src/Stripe.net/Entities/WebhookEndpoints/WebhookEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ public class WebhookEndpoint : StripeEntity<WebhookEndpoint>, IHasId, IHasObject
[JsonProperty("application")]
public string Application { get; set; }

[Obsolete("Use Application instead")]
[JsonIgnore]
public string ApplicationId
{
get => this.Application;
set => this.Application = value;
}

[Obsolete("This property was never returned. Use Application instead")]
[JsonProperty("connect")]
public bool Connect { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ private static StreamContent CreateStreamContent(Stream value, string name)
var fileName = "blob";
var extension = string.Empty;

#if NET45 || NETSTANDARD2_0
FileStream fileStream = value as FileStream;
if ((fileStream != null) && (!string.IsNullOrEmpty(fileStream.Name)))
{
fileName = fileStream.Name;
extension = Path.GetExtension(fileName);
}
#endif

var content = new StreamContent(value);
content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
Expand Down
20 changes: 4 additions & 16 deletions src/Stripe.net/Infrastructure/Public/StripeConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ namespace Stripe
{
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Reflection;
using Newtonsoft.Json;
using Stripe.Infrastructure;
#if NET45 || NETSTANDARD2_0
using System.Configuration;
#endif

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

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

#if NET45 || NETSTANDARD2_0
/// <summary>Gets or sets the API key.</summary>
/// <remarks>
/// You can also set the API key using the <c>StripeApiKey</c> key in
/// <see cref="System.Configuration.ConfigurationManager.AppSettings"/>.
/// </remarks>
#else
/// <summary>Gets or sets the API key.</summary>
#endif
public static string ApiKey
{
get
{
#if NET45 || NETSTANDARD2_0
if (string.IsNullOrEmpty(apiKey) &&
!string.IsNullOrEmpty(ConfigurationManager.AppSettings["StripeApiKey"]))
{
apiKey = ConfigurationManager.AppSettings["StripeApiKey"];
}
#endif

return apiKey;
}

Expand All @@ -68,26 +61,21 @@ public static string ApiKey
}
}

#if NET45 || NETSTANDARD2_0
/// <summary>Gets or sets the client ID.</summary>
/// <remarks>
/// You can also set the client ID using the <c>StripeClientId</c> key in
/// <see cref="System.Configuration.ConfigurationManager.AppSettings"/>.
/// </remarks>
#else
/// <summary>Gets or sets the client ID.</summary>
#endif
public static string ClientId
{
get
{
#if NET45 || NETSTANDARD2_0
if (string.IsNullOrEmpty(apiKey) &&
!string.IsNullOrEmpty(ConfigurationManager.AppSettings["StripeClientId"]))
{
clientId = ConfigurationManager.AppSettings["StripeClientId"];
}
#endif

return clientId;
}

Expand Down
34 changes: 12 additions & 22 deletions src/Stripe.net/Infrastructure/Public/SystemNetHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ namespace Stripe
/// </summary>
public class SystemNetHttpClient : IHttpClient
{
private const string StripeNetTargetFramework =
#if NETSTANDARD2_0
"netstandard2.0"
#elif NET45
"net45"
#else
"unknown"
#endif
;

private static readonly Lazy<System.Net.Http.HttpClient> LazyDefaultHttpClient
= new Lazy<System.Net.Http.HttpClient>(BuildDefaultSystemNetHttpClient);

Expand Down Expand Up @@ -204,31 +214,11 @@ private string BuildStripeClientUserAgentString()
{ "bindings_version", StripeConfiguration.StripeNetVersion },
{ "lang", ".net" },
{ "publisher", "stripe" },
{ "lang_version", RuntimeInformation.GetLanguageVersion() },
{ "lang_version", RuntimeInformation.GetRuntimeVersion() },
{ "os_version", RuntimeInformation.GetOSVersion() },
{ "stripe_net_target_framework", StripeNetTargetFramework },
};

#if NET45
string monoVersion = RuntimeInformation.GetMonoVersion();
if (!string.IsNullOrEmpty(monoVersion))
{
values.Add("mono_version", monoVersion);
}
#endif

var stripeNetTargetFramework =
#if NET45
"net45"
#elif NETSTANDARD1_2
"netstandard1.2"
#elif NETSTANDARD2_0
"netstandard2.0"
#else
"unknown"
#endif
;
values.Add("stripe_net_target_framework", stripeNetTargetFramework);

if (this.appInfo != null)
{
values.Add("application", this.appInfo);
Expand Down
Loading