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

Add support for top-level statement descriptor for all sources #1089

Merged
merged 1 commit into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@ namespace Stripe.Tests.Xunit
public class creating_and_updating_bancontact_source
{
private StripeSource Source { get; set; }
private StripeSourceCreateOptions SourceCreateOptions { get; set; }

public creating_and_updating_bancontact_source()
{
var options = new StripeSourceCreateOptions
SourceCreateOptions = new StripeSourceCreateOptions
{
Type = StripeSourceType.Bancontact,
Amount = 500,
Currency = "eur",
Owner = new StripeSourceOwner { Name = "Joe Biden" },
RedirectReturnUrl = "http://no.where/webhooks",
BancontactStatementDescriptor = "test statement descriptor",
StatementDescriptor = "test statement descriptor",
BancontactPreferredLanguage = "FR"
};

Source = new StripeSourceService(Cache.ApiKey).Create(options);
Source = new StripeSourceService(Cache.ApiKey).Create(SourceCreateOptions);
}

[Fact]
public void source_has_correct_parameters()
{
Source.Should().NotBeNull();
Source.StatementDescriptor.Should().Be(SourceCreateOptions.StatementDescriptor);
Source.Bancontact.Should().NotBeNull();
Source.Bancontact.PreferredLanguage.Should().Be("FR");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ namespace Stripe.Tests.Xunit
public class creating_and_updating_ideal_source
{
private StripeSource Source { get; set; }
private StripeSourceCreateOptions SourceCreateOptions { get; set; }

public creating_and_updating_ideal_source()
{
var options = new StripeSourceCreateOptions
SourceCreateOptions = new StripeSourceCreateOptions
{
Type = StripeSourceType.Ideal,
IdealBank = "ing",
IdealStatementDescriptor = "finished",
StatementDescriptor = "finished",
Amount = 2001,
Currency = "eur",
RedirectReturnUrl = "http://no.where/webhooks"
};

Source = new StripeSourceService(Cache.ApiKey).Create(options);
Source = new StripeSourceService(Cache.ApiKey).Create(SourceCreateOptions);
}

[Fact]
public void source_has_correct_parameters()
{
Source.Should().NotBeNull();
Source.StatementDescriptor.ShouldBeEquivalentTo(SourceCreateOptions.StatementDescriptor);
Source.Ideal.Should().NotBeNull();
Source.Ideal.Bank.ShouldBeEquivalentTo("ing");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ namespace Stripe.Tests.Xunit
public class creating_and_updating_sofort_source
{
private StripeSource Source { get; set; }
private StripeSourceCreateOptions SourceCreateOptions { get; set; }

public creating_and_updating_sofort_source()
{
var options = new StripeSourceCreateOptions
SourceCreateOptions = new StripeSourceCreateOptions
{
Type = StripeSourceType.Sofort,
SofortCountry = "DE",
SofortStatementDescriptor = "soforty!",
StatementDescriptor = "soforty!",
Amount = 500,
Currency = "eur",
RedirectReturnUrl = "http://no.where/webhooks"
};

Source = new StripeSourceService(Cache.ApiKey).Create(options);
Source = new StripeSourceService(Cache.ApiKey).Create(SourceCreateOptions);
}

[Fact]
public void source_has_correct_parameters()
{
Source.Should().NotBeNull();
Source.StatementDescriptor.Should().Be(SourceCreateOptions.StatementDescriptor);
Source.Sofort.Should().NotBeNull();
Source.Sofort.Country.Should().Be("DE");
}
}
Expand Down
12 changes: 3 additions & 9 deletions src/Stripe.net/Services/Sources/StripeSourceCreateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,18 @@ public class StripeSourceCreateOptions : StripeBaseOptions
[JsonProperty("bancontact[preferred_language]")]
public string BancontactPreferredLanguage { get; set; }

[JsonProperty("bancontact[statement_descriptor]")]
public string BancontactStatementDescriptor { get; set; }

[JsonProperty("card")]
public StripeCreditCardOptions Card { get; set; }

[JsonProperty("ideal[bank]")]
public string IdealBank { get; set; }

[JsonProperty("ideal[statement_descriptor]")]
public string IdealStatementDescriptor { get; set; }

[JsonProperty("sepa_debit[iban]")]
public string SepaDebitIban { get; set; }

[JsonProperty("sofort[country]")]
public string SofortCountry { get; set; }

[JsonProperty("sofort[statement_descriptor]")]
public string SofortStatementDescriptor { get; set; }

[JsonProperty("[three_d_secure][customer]")]
public string ThreeDSecureCustomer { get; set; }

Expand All @@ -81,6 +72,9 @@ public class StripeSourceCreateOptions : StripeBaseOptions
[JsonProperty("[redirect][return_url]")]
public string RedirectReturnUrl { get; set; }

[JsonProperty("statement_descriptor")]
public string StatementDescriptor { get; set; }

/// <summary>
/// An optional token used to create the source. When passed, token properties will override source parameters.
/// </summary>
Expand Down