From e9942e1f13298faa0865ab25f711807967dfd056 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 3 Jun 2020 11:45:31 -0700 Subject: [PATCH] Add support for Bancontact, EPS, Giropay and P24 on `PaymentMethod` --- .../PaymentIntentPaymentMethodOptions.cs | 6 ++ ...entIntentPaymentMethodOptionsBancontact.cs | 16 ++++ .../Entities/PaymentMethods/PaymentMethod.cs | 75 ++++++++++++++++++- .../PaymentMethods/PaymentMethodBancontact.cs | 8 ++ .../PaymentMethods/PaymentMethodEps.cs | 8 ++ .../PaymentMethods/PaymentMethodGiropay.cs | 8 ++ .../PaymentMethods/PaymentMethodP24.cs | 8 ++ ...ntPaymentMethodOptionsBancontactOptions.cs | 15 ++++ ...aymentIntentPaymentMethodOptionsOptions.cs | 6 ++ .../PaymentMethodBancontactCreateOptions.cs | 8 ++ .../PaymentMethodCreateOptions.cs | 44 +++++++---- .../PaymentMethodEpsCreateOptions.cs | 8 ++ .../PaymentMethodGiropayCreateOptions.cs | 8 ++ .../PaymentMethodP24CreateOptions.cs | 8 ++ 14 files changed, 212 insertions(+), 14 deletions(-) create mode 100644 src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontact.cs create mode 100644 src/Stripe.net/Entities/PaymentMethods/PaymentMethodBancontact.cs create mode 100644 src/Stripe.net/Entities/PaymentMethods/PaymentMethodEps.cs create mode 100644 src/Stripe.net/Entities/PaymentMethods/PaymentMethodGiropay.cs create mode 100644 src/Stripe.net/Entities/PaymentMethods/PaymentMethodP24.cs create mode 100644 src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontactOptions.cs create mode 100644 src/Stripe.net/Services/PaymentMethods/PaymentMethodBancontactCreateOptions.cs create mode 100644 src/Stripe.net/Services/PaymentMethods/PaymentMethodEpsCreateOptions.cs create mode 100644 src/Stripe.net/Services/PaymentMethods/PaymentMethodGiropayCreateOptions.cs create mode 100644 src/Stripe.net/Services/PaymentMethods/PaymentMethodP24CreateOptions.cs diff --git a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptions.cs b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptions.cs index 839d9675a0..80e30fe4e8 100644 --- a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptions.cs +++ b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptions.cs @@ -6,6 +6,12 @@ namespace Stripe public class PaymentIntentPaymentMethodOptions : StripeEntity { + /// + /// Configuration specific to Bancontact for this PaymentIntent. + /// + [JsonProperty("bancontact")] + public PaymentIntentPaymentMethodOptionsBancontact Bancontact { get; set; } + /// /// If the PaymentIntent’s supported payment method types include card, this hash /// contains the configurations that will be applied to each payment attempt of that type. diff --git a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontact.cs b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontact.cs new file mode 100644 index 0000000000..8b4e2a4a38 --- /dev/null +++ b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontact.cs @@ -0,0 +1,16 @@ +namespace Stripe +{ + using System; + using Newtonsoft.Json; + using Stripe.Infrastructure; + + public class PaymentIntentPaymentMethodOptionsBancontact : StripeEntity + { + /// + /// Preferred language of the Bancontact authorization page that the customer is redirected + /// to. + /// + [JsonProperty("preferred_language")] + public string PreferredLanguage { get; set; } + } +} diff --git a/src/Stripe.net/Entities/PaymentMethods/PaymentMethod.cs b/src/Stripe.net/Entities/PaymentMethods/PaymentMethod.cs index ba803c8362..7c46a111bc 100644 --- a/src/Stripe.net/Entities/PaymentMethods/PaymentMethod.cs +++ b/src/Stripe.net/Entities/PaymentMethods/PaymentMethod.cs @@ -7,27 +7,57 @@ namespace Stripe public class PaymentMethod : StripeEntity, IHasId, IHasMetadata, IHasObject { + /// + /// Unique identifier for the object. + /// [JsonProperty("id")] public string Id { get; set; } + /// + /// String representing the object’s type. Objects of the same type share the same value. + /// [JsonProperty("object")] public string Object { get; set; } + /// + /// Properties specific to AU BECS Debit PaymentMethod. + /// [JsonProperty("au_becs_debit")] public PaymentMethodAuBecsDebit AuBecsDebit { get; set; } + /// + /// Properties specific to BACS Debit PaymentMethod. + /// [JsonProperty("bacs_debit")] public PaymentMethodBacsDebit BacsDebit { get; set; } + /// + /// Properties specific to Bancontact PaymentMethod. + /// + [JsonProperty("bancontact")] + public PaymentMethodBancontact Bancontact { get; set; } + + /// + /// Billing details associated with this PaymentMethod. + /// [JsonProperty("billing_details")] public BillingDetails BillingDetails { get; set; } + /// + /// Properties specific to Card PaymentMethod. + /// [JsonProperty("card")] public PaymentMethodCard Card { get; set; } + /// + /// Properties specific to Card Present PaymentMethod. + /// [JsonProperty("card_present")] public PaymentMethodCardPresent CardPresent { get; set; } + /// + /// Time at which the object was created. Measured in seconds since the Unix epoch. + /// [JsonProperty("created")] [JsonConverter(typeof(DateTimeConverter))] public DateTime Created { get; set; } @@ -35,7 +65,7 @@ public class PaymentMethod : StripeEntity, IHasId, IHasMetadata, #region Expandable Customer /// - /// ID of the customer this charge is for if one exists. + /// ID of the customer this PaymentMethod is for if any. /// [JsonIgnore] public string CustomerId @@ -44,6 +74,9 @@ public string CustomerId set => this.InternalCustomer = SetExpandableFieldId(value, this.InternalCustomer); } + /// + /// Customer this PaymentMethod is for (if it was expanded). + /// [JsonIgnore] public Customer Customer { @@ -56,24 +89,64 @@ public Customer Customer internal ExpandableField InternalCustomer { get; set; } #endregion + /// + /// Properties specific to Eps PaymentMethod. + /// + [JsonProperty("eps")] + public PaymentMethodEps Eps { get; set; } + + /// + /// Properties specific to FPX PaymentMethod. + /// [JsonProperty("fpx")] public PaymentMethodFpx Fpx { get; set; } + /// + /// Properties specific to Giropay PaymentMethod. + /// + [JsonProperty("giropay")] + public PaymentMethodGiropay Giropay { get; set; } + + /// + /// Properties specific to iDEAL PaymentMethod. + /// [JsonProperty("ideal")] public PaymentMethodIdeal Ideal { get; set; } + /// + /// Properties specific to Interac present PaymentMethod. + /// [JsonProperty("interac_present")] public PaymentMethodInteracPresent InteracPresent { get; set; } + /// + /// Has the value true if the object exists in live mode or the value + /// false if the object exists in test mode. + /// [JsonProperty("livemode")] public bool Livemode { get; set; } + /// + /// A set of key/value pairs that you can attach to a subscription object. + /// [JsonProperty("metadata")] public Dictionary Metadata { get; set; } + /// + /// Properties specific to P24 PaymentMethod. + /// + [JsonProperty("p24")] + public PaymentMethodP24 P24 { get; set; } + + /// + /// Properties specific to SEPA Debit PaymentMethod. + /// [JsonProperty("sepa_debit")] public PaymentMethodSepaDebit SepaDebit { get; set; } + /// + /// The type of PaymentMethod. + /// [JsonProperty("type")] public string Type { get; set; } } diff --git a/src/Stripe.net/Entities/PaymentMethods/PaymentMethodBancontact.cs b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodBancontact.cs new file mode 100644 index 0000000000..6119dfbcc8 --- /dev/null +++ b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodBancontact.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodBancontact : StripeEntity + { + } +} diff --git a/src/Stripe.net/Entities/PaymentMethods/PaymentMethodEps.cs b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodEps.cs new file mode 100644 index 0000000000..03a0621341 --- /dev/null +++ b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodEps.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodEps : StripeEntity + { + } +} diff --git a/src/Stripe.net/Entities/PaymentMethods/PaymentMethodGiropay.cs b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodGiropay.cs new file mode 100644 index 0000000000..8f41db412c --- /dev/null +++ b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodGiropay.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodGiropay : StripeEntity + { + } +} diff --git a/src/Stripe.net/Entities/PaymentMethods/PaymentMethodP24.cs b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodP24.cs new file mode 100644 index 0000000000..32d2a11d34 --- /dev/null +++ b/src/Stripe.net/Entities/PaymentMethods/PaymentMethodP24.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodP24 : StripeEntity + { + } +} diff --git a/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontactOptions.cs b/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontactOptions.cs new file mode 100644 index 0000000000..106e684e4e --- /dev/null +++ b/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsBancontactOptions.cs @@ -0,0 +1,15 @@ +namespace Stripe +{ + using System; + using Newtonsoft.Json; + + public class PaymentIntentPaymentMethodOptionsBancontactOptions : INestedOptions + { + /// + /// Preferred language of the Bancontact authorization page that the customer is redirected + /// to. + /// + [JsonProperty("preferred_language")] + public string PreferredLanguage { get; set; } + } +} diff --git a/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsOptions.cs b/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsOptions.cs index ca94202d6f..01ed20819c 100644 --- a/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsOptions.cs +++ b/src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsOptions.cs @@ -5,6 +5,12 @@ namespace Stripe public class PaymentIntentPaymentMethodOptionsOptions : INestedOptions { + /// + /// Configuration for any Bancontact payments attempted on this PaymentIntent. + /// + [JsonProperty("bancontact")] + public PaymentIntentPaymentMethodOptionsBancontactOptions Bancontact { get; set; } + /// /// Configuration for any card payments attempted on this PaymentIntent. /// diff --git a/src/Stripe.net/Services/PaymentMethods/PaymentMethodBancontactCreateOptions.cs b/src/Stripe.net/Services/PaymentMethods/PaymentMethodBancontactCreateOptions.cs new file mode 100644 index 0000000000..2dfc098ec8 --- /dev/null +++ b/src/Stripe.net/Services/PaymentMethods/PaymentMethodBancontactCreateOptions.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodBancontactCreateOptions : INestedOptions + { + } +} diff --git a/src/Stripe.net/Services/PaymentMethods/PaymentMethodCreateOptions.cs b/src/Stripe.net/Services/PaymentMethods/PaymentMethodCreateOptions.cs index d51a396bac..9442270d66 100644 --- a/src/Stripe.net/Services/PaymentMethods/PaymentMethodCreateOptions.cs +++ b/src/Stripe.net/Services/PaymentMethods/PaymentMethodCreateOptions.cs @@ -8,19 +8,23 @@ namespace Stripe public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata { /// - /// This is a au_becs_debit PaymentMethod available in Australia. - /// Teh create option contains details about the bank account. + /// Parameters specific to AU BECS Debit PaymentMethod. /// [JsonProperty("au_becs_debit")] public PaymentMethodAuBecsDebitCreateOptions AuBecsDebit { get; set; } /// - /// This is a au_becs_debit PaymentMethod available in Australia. - /// Teh create option contains details about the bank account. + /// Parameters specific to BACS Debit PaymentMethod. /// [JsonProperty("bacs_debit")] public PaymentMethodBacsDebitCreateOptions BacsDebit { get; set; } + /// + /// Parameters specific to Bancontact PaymentMethod. + /// + [JsonProperty("bancontact")] + public PaymentMethodBancontactCreateOptions Bancontact { get; set; } + /// /// Billing information associated with the PaymentMethod that may be used or required by /// particular types of payment methods. @@ -29,9 +33,7 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata public BillingDetailsOptions BillingDetails { get; set; } /// - /// If this is a card 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. /// [JsonProperty("card")] public PaymentMethodCardCreateOptions Card { get; set; } @@ -44,20 +46,31 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata public string Customer { get; set; } /// - /// This is a FPX PaymentMethod available in Malaysia. + /// Parameters specific to Eps PaymentMethod. + /// + [JsonProperty("eps")] + public PaymentMethodEpsCreateOptions Eps { get; set; } + + /// + /// Parameters specific to FPX PaymentMethod. /// [JsonProperty("fpx")] public PaymentMethodFpxCreateOptions Fpx { get; set; } /// - /// If this is an ideal PaymentMethod, this contains details about the iDEAL payment - /// method. + /// Parameters specific to Giropay PaymentMethod. + /// + [JsonProperty("giropay")] + public PaymentMethodGiropayCreateOptions Giropay { get; set; } + + /// + /// Parameters specific to iDEAL PaymentMethod. /// [JsonProperty("ideal")] public PaymentMethodIdealCreateOptions Ideal { get; set; } /// - /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method. + /// Parameters specific to Interac Present PaymentMethod. /// [JsonProperty("interac_present")] public PaymentMethodInteracPresentCreateOptions InteracPresent { get; set; } @@ -70,6 +83,12 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata [JsonProperty("metadata")] public Dictionary Metadata { get; set; } + /// + /// Parameters specific to P24 PaymentMethod. + /// + [JsonProperty("p24")] + public PaymentMethodP24CreateOptions P24 { get; set; } + /// /// The id of the PaymentMethod that you are trying to share with a Connected account. /// This only works with Stripe Connect. @@ -78,8 +97,7 @@ public class PaymentMethodCreateOptions : BaseOptions, IHasMetadata public string PaymentMethod { get; set; } /// - /// If this is a sepa_debit PaymentMethod, this contains details about the SEPA debit - /// bank account. + /// Parameters specific to SEPA Debit PaymentMethod. /// [JsonProperty("sepa_debit")] public PaymentMethodSepaDebitCreateOptions SepaDebit { get; set; } diff --git a/src/Stripe.net/Services/PaymentMethods/PaymentMethodEpsCreateOptions.cs b/src/Stripe.net/Services/PaymentMethods/PaymentMethodEpsCreateOptions.cs new file mode 100644 index 0000000000..04597d27b2 --- /dev/null +++ b/src/Stripe.net/Services/PaymentMethods/PaymentMethodEpsCreateOptions.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodEpsCreateOptions : INestedOptions + { + } +} diff --git a/src/Stripe.net/Services/PaymentMethods/PaymentMethodGiropayCreateOptions.cs b/src/Stripe.net/Services/PaymentMethods/PaymentMethodGiropayCreateOptions.cs new file mode 100644 index 0000000000..447ed3021e --- /dev/null +++ b/src/Stripe.net/Services/PaymentMethods/PaymentMethodGiropayCreateOptions.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodGiropayCreateOptions : INestedOptions + { + } +} diff --git a/src/Stripe.net/Services/PaymentMethods/PaymentMethodP24CreateOptions.cs b/src/Stripe.net/Services/PaymentMethods/PaymentMethodP24CreateOptions.cs new file mode 100644 index 0000000000..0d0db81114 --- /dev/null +++ b/src/Stripe.net/Services/PaymentMethods/PaymentMethodP24CreateOptions.cs @@ -0,0 +1,8 @@ +namespace Stripe +{ + using Newtonsoft.Json; + + public class PaymentMethodP24CreateOptions : INestedOptions + { + } +}