From e18164f59c7935407c43ce9d83e2edebcd87c9d6 Mon Sep 17 00:00:00 2001 From: Michael Broshi Date: Mon, 7 Apr 2025 14:03:48 -0400 Subject: [PATCH] Handle external_account field --- .../ExternalAccountCardOptions.cs | 101 ++++++++++++++++++ .../ExternalAccountCardTokenOptions.cs | 29 +++++ .../ExternalAccountCreateOptions.cs | 5 +- 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardOptions.cs create mode 100644 src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardTokenOptions.cs diff --git a/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardOptions.cs b/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardOptions.cs new file mode 100644 index 0000000000..b82c6fd9b7 --- /dev/null +++ b/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardOptions.cs @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec +namespace Stripe +{ + using System.Collections.Generic; + using Newtonsoft.Json; +#if NET6_0_OR_GREATER + using STJS = System.Text.Json.Serialization; +#endif + + public class ExternalAccountCardOptions : INestedOptions, IHasMetadata, IHasObject + { + [JsonProperty("object")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("object")] +#endif + public string Object { get; set; } = "card"; + + [JsonProperty("address_city")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("address_city")] +#endif + public string AddressCity { get; set; } + + [JsonProperty("address_country")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("address_country")] +#endif + public string AddressCountry { get; set; } + + [JsonProperty("address_line1")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("address_line1")] +#endif + public string AddressLine1 { get; set; } + + [JsonProperty("address_line2")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("address_line2")] +#endif + public string AddressLine2 { get; set; } + + [JsonProperty("address_state")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("address_state")] +#endif + public string AddressState { get; set; } + + [JsonProperty("address_zip")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("address_zip")] +#endif + public string AddressZip { get; set; } + + [JsonProperty("currency")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("currency")] +#endif + public string Currency { get; set; } + + [JsonProperty("cvc")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("cvc")] +#endif + public string Cvc { get; set; } + + [JsonProperty("exp_month")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("exp_month")] +#endif + public long? ExpMonth { get; set; } + + [JsonProperty("exp_year")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("exp_year")] +#endif + public long? ExpYear { get; set; } + + [JsonProperty("name")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("name")] +#endif + public string Name { get; set; } + + [JsonProperty("number")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("number")] +#endif + public string Number { get; set; } + + /// + /// Set of key-value pairs that you can + /// attach to an object. This can be useful for storing additional information about the + /// object in a structured format. + /// + [JsonProperty("metadata")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("metadata")] +#endif + public Dictionary Metadata { get; set; } + } +} diff --git a/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardTokenOptions.cs b/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardTokenOptions.cs new file mode 100644 index 0000000000..dd13f17a14 --- /dev/null +++ b/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCardTokenOptions.cs @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +namespace Stripe +{ + using Newtonsoft.Json; +#if NET6_0_OR_GREATER + using STJS = System.Text.Json.Serialization; +#endif + + public class ExternalAccountCardTokenOptions : INestedOptions, IHasObject + { + [JsonProperty("object")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("object")] +#endif + public string Object { get; set; } = "card"; + + [JsonProperty("currency")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("currency")] +#endif + public string Currency { get; set; } + + [JsonProperty("token")] +#if NET6_0_OR_GREATER + [STJS.JsonPropertyName("token")] +#endif + public string Token { get; set; } + } +} diff --git a/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCreateOptions.cs b/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCreateOptions.cs index e3a14a0f1e..81c34a6691 100644 --- a/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCreateOptions.cs +++ b/src/Stripe.net/Services/ExternalAccounts/ExternalAccountCreateOptions.cs @@ -3,6 +3,7 @@ namespace Stripe { using System.Collections.Generic; using Newtonsoft.Json; + using Stripe.Infrastructure; #if NET6_0_OR_GREATER using STJS = System.Text.Json.Serialization; #endif @@ -25,10 +26,12 @@ public class ExternalAccountCreateOptions : BaseOptions, IHasMetadata /// external account details (with the options shown below). /// [JsonProperty("external_account")] + [JsonConverter(typeof(AnyOfConverter))] #if NET6_0_OR_GREATER [STJS.JsonPropertyName("external_account")] + [STJS.JsonConverter(typeof(STJAnyOfConverter))] #endif - public string ExternalAccount { get; set; } + public AnyOf ExternalAccount { get; set; } /// /// Set of key-value pairs that you can