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 Bancontact, EPS, Giropay and P24 on PaymentMethod #2062

Merged
merged 1 commit into from
Jun 3, 2020
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,6 +6,12 @@ namespace Stripe

public class PaymentIntentPaymentMethodOptions : StripeEntity<PaymentIntentPaymentMethodOptions>
{
/// <summary>
/// Configuration specific to Bancontact for this PaymentIntent.
/// </summary>
[JsonProperty("bancontact")]
public PaymentIntentPaymentMethodOptionsBancontact Bancontact { get; set; }

/// <summary>
/// If the PaymentIntent’s supported payment method types include <c>card</c>, this hash
/// contains the configurations that will be applied to each payment attempt of that type.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Stripe
{
using System;
using Newtonsoft.Json;
using Stripe.Infrastructure;

public class PaymentIntentPaymentMethodOptionsBancontact : StripeEntity<PaymentIntentPaymentMethodOptionsBancontact>
{
/// <summary>
/// Preferred language of the Bancontact authorization page that the customer is redirected
/// to.
/// </summary>
[JsonProperty("preferred_language")]
public string PreferredLanguage { get; set; }
}
}
75 changes: 74 additions & 1 deletion src/Stripe.net/Entities/PaymentMethods/PaymentMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,65 @@ namespace Stripe

public class PaymentMethod : StripeEntity<PaymentMethod>, IHasId, IHasMetadata, IHasObject
{
/// <summary>
/// Unique identifier for the object.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// String representing the object’s type. Objects of the same type share the same value.
/// </summary>
[JsonProperty("object")]
public string Object { get; set; }

/// <summary>
/// Properties specific to AU BECS Debit PaymentMethod.
/// </summary>
[JsonProperty("au_becs_debit")]
public PaymentMethodAuBecsDebit AuBecsDebit { get; set; }

/// <summary>
/// Properties specific to BACS Debit PaymentMethod.
/// </summary>
[JsonProperty("bacs_debit")]
public PaymentMethodBacsDebit BacsDebit { get; set; }

/// <summary>
/// Properties specific to Bancontact PaymentMethod.
/// </summary>
[JsonProperty("bancontact")]
public PaymentMethodBancontact Bancontact { get; set; }

/// <summary>
/// Billing details associated with this PaymentMethod.
/// </summary>
[JsonProperty("billing_details")]
public BillingDetails BillingDetails { get; set; }

/// <summary>
/// Properties specific to Card PaymentMethod.
/// </summary>
[JsonProperty("card")]
public PaymentMethodCard Card { get; set; }

/// <summary>
/// Properties specific to Card Present PaymentMethod.
/// </summary>
[JsonProperty("card_present")]
public PaymentMethodCardPresent CardPresent { get; set; }

/// <summary>
/// Time at which the object was created. Measured in seconds since the Unix epoch.
/// </summary>
[JsonProperty("created")]
[JsonConverter(typeof(DateTimeConverter))]
public DateTime Created { get; set; }

#region Expandable Customer

/// <summary>
/// ID of the customer this charge is for if one exists.
/// ID of the customer this PaymentMethod is for if any.
/// </summary>
[JsonIgnore]
public string CustomerId
Expand All @@ -44,6 +74,9 @@ public string CustomerId
set => this.InternalCustomer = SetExpandableFieldId(value, this.InternalCustomer);
}

/// <summary>
/// Customer this PaymentMethod is for (if it was expanded).
/// </summary>
[JsonIgnore]
public Customer Customer
{
Expand All @@ -56,24 +89,64 @@ public Customer Customer
internal ExpandableField<Customer> InternalCustomer { get; set; }
#endregion

/// <summary>
/// Properties specific to Eps PaymentMethod.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non blocking nit, but it looks like we call this EPS in the docs rather than Eps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll fix all of these with autogen anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think it doesn't really matter though I tried to use the right writing everywhere but I typed that string a lot by hand :p

/// </summary>
[JsonProperty("eps")]
public PaymentMethodEps Eps { get; set; }

/// <summary>
/// Properties specific to FPX PaymentMethod.
/// </summary>
[JsonProperty("fpx")]
public PaymentMethodFpx Fpx { get; set; }

/// <summary>
/// Properties specific to Giropay PaymentMethod.
/// </summary>
[JsonProperty("giropay")]
public PaymentMethodGiropay Giropay { get; set; }

/// <summary>
/// Properties specific to iDEAL PaymentMethod.
/// </summary>
[JsonProperty("ideal")]
public PaymentMethodIdeal Ideal { get; set; }

/// <summary>
/// Properties specific to Interac present PaymentMethod.
/// </summary>
[JsonProperty("interac_present")]
public PaymentMethodInteracPresent InteracPresent { get; set; }

/// <summary>
/// Has the value <c>true</c> if the object exists in live mode or the value
/// <c>false</c> if the object exists in test mode.
/// </summary>
[JsonProperty("livemode")]
public bool Livemode { get; set; }

/// <summary>
/// A set of key/value pairs that you can attach to a subscription object.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

/// <summary>
/// Properties specific to P24 PaymentMethod.
/// </summary>
[JsonProperty("p24")]
public PaymentMethodP24 P24 { get; set; }

/// <summary>
/// Properties specific to SEPA Debit PaymentMethod.
/// </summary>
[JsonProperty("sepa_debit")]
public PaymentMethodSepaDebit SepaDebit { get; set; }

/// <summary>
/// The type of PaymentMethod.
/// </summary>
[JsonProperty("type")]
public string Type { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodBancontact : StripeEntity<PaymentMethodBancontact>
{
}
}
8 changes: 8 additions & 0 deletions src/Stripe.net/Entities/PaymentMethods/PaymentMethodEps.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodEps : StripeEntity<PaymentMethodEps>
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodGiropay : StripeEntity<PaymentMethodGiropay>
{
}
}
8 changes: 8 additions & 0 deletions src/Stripe.net/Entities/PaymentMethods/PaymentMethodP24.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodP24 : StripeEntity<PaymentMethodP24>
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Stripe
{
using System;
using Newtonsoft.Json;

public class PaymentIntentPaymentMethodOptionsBancontactOptions : INestedOptions
{
/// <summary>
/// Preferred language of the Bancontact authorization page that the customer is redirected
/// to.
/// </summary>
[JsonProperty("preferred_language")]
public string PreferredLanguage { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ namespace Stripe

public class PaymentIntentPaymentMethodOptionsOptions : INestedOptions
{
/// <summary>
/// Configuration for any Bancontact payments attempted on this PaymentIntent.
/// </summary>
[JsonProperty("bancontact")]
public PaymentIntentPaymentMethodOptionsBancontactOptions Bancontact { get; set; }

/// <summary>
/// Configuration for any card payments attempted on this PaymentIntent.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodBancontactCreateOptions : INestedOptions
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ namespace Stripe
public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata
{
/// <summary>
/// This is a <c>au_becs_debit</c> PaymentMethod available in Australia.
/// Teh create option contains details about the bank account.
/// Parameters specific to AU BECS Debit PaymentMethod.
/// </summary>
[JsonProperty("au_becs_debit")]
public PaymentMethodAuBecsDebitCreateOptions AuBecsDebit { get; set; }

/// <summary>
/// This is a <c>au_becs_debit</c> PaymentMethod available in Australia.
/// Teh create option contains details about the bank account.
/// Parameters specific to BACS Debit PaymentMethod.
/// </summary>
[JsonProperty("bacs_debit")]
public PaymentMethodBacsDebitCreateOptions BacsDebit { get; set; }

/// <summary>
/// Parameters specific to Bancontact PaymentMethod.
/// </summary>
[JsonProperty("bancontact")]
public PaymentMethodBancontactCreateOptions Bancontact { get; set; }

/// <summary>
/// Billing information associated with the PaymentMethod that may be used or required by
/// particular types of payment methods.
Expand All @@ -29,9 +33,7 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata
public BillingDetailsOptions BillingDetails { get; set; }

/// <summary>
/// If this is a <c>card</c> PaymentMethod, raw card details. You must meet the requirements
/// for PCI compliance. We strongly recommend using Stripe.js instead of interacting with
/// this API directly.
/// Parameters specific to Card PaymentMethod.
/// </summary>
[JsonProperty("card")]
public PaymentMethodCardCreateOptions Card { get; set; }
Expand All @@ -44,20 +46,31 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata
public string Customer { get; set; }

/// <summary>
/// This is a <c>FPX</c> PaymentMethod available in Malaysia.
/// Parameters specific to Eps PaymentMethod.
/// </summary>
[JsonProperty("eps")]
public PaymentMethodEpsCreateOptions Eps { get; set; }

/// <summary>
/// Parameters specific to FPX PaymentMethod.
/// </summary>
[JsonProperty("fpx")]
public PaymentMethodFpxCreateOptions Fpx { get; set; }

/// <summary>
/// If this is an <c>ideal</c> PaymentMethod, this contains details about the iDEAL payment
/// method.
/// Parameters specific to Giropay PaymentMethod.
/// </summary>
[JsonProperty("giropay")]
public PaymentMethodGiropayCreateOptions Giropay { get; set; }

/// <summary>
/// Parameters specific to iDEAL PaymentMethod.
/// </summary>
[JsonProperty("ideal")]
public PaymentMethodIdealCreateOptions Ideal { get; set; }

/// <summary>
/// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
/// Parameters specific to Interac Present PaymentMethod.
/// </summary>
[JsonProperty("interac_present")]
public PaymentMethodInteracPresentCreateOptions InteracPresent { get; set; }
Expand All @@ -70,6 +83,12 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

/// <summary>
/// Parameters specific to P24 PaymentMethod.
/// </summary>
[JsonProperty("p24")]
public PaymentMethodP24CreateOptions P24 { get; set; }

/// <summary>
/// The id of the PaymentMethod that you are trying to share with a Connected account.
/// This only works with Stripe Connect.
Expand All @@ -78,8 +97,7 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata
public string PaymentMethod { get; set; }

/// <summary>
/// If this is a <c>sepa_debit</c> PaymentMethod, this contains details about the SEPA debit
/// bank account.
/// Parameters specific to SEPA Debit PaymentMethod.
/// </summary>
[JsonProperty("sepa_debit")]
public PaymentMethodSepaDebitCreateOptions SepaDebit { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodEpsCreateOptions : INestedOptions
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodGiropayCreateOptions : INestedOptions
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Stripe
{
using Newtonsoft.Json;

public class PaymentMethodP24CreateOptions : INestedOptions
{
}
}