diff --git a/CODEGEN_VERSION b/CODEGEN_VERSION index 92d73382fd..47a9a28f9f 100644 --- a/CODEGEN_VERSION +++ b/CODEGEN_VERSION @@ -1 +1 @@ -b51a9d09327603fa3a61d076f4bf7f07b43e1659 \ No newline at end of file +25e6bd225852aa44d783e9fb3b9895af39479331 \ No newline at end of file diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4ec501ea29..19b4cc8851 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v2205 \ No newline at end of file +v2206 \ No newline at end of file diff --git a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalance.cs b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalance.cs index 3c9edc453e..e85359cee1 100644 --- a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalance.cs +++ b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalance.cs @@ -8,10 +8,6 @@ namespace Stripe [STJS.JsonConverter(typeof(STJStripeEntityConverter))] public class PaymentIntentPaymentMethodOptionsStripeBalance : StripeEntity { - [JsonProperty("mandate_options")] - [STJS.JsonPropertyName("mandate_options")] - public PaymentIntentPaymentMethodOptionsStripeBalanceMandateOptions MandateOptions { get; set; } - /// /// Indicates that you intend to make future payments with this PaymentIntent's payment /// method. diff --git a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalanceMandateOptions.cs b/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalanceMandateOptions.cs deleted file mode 100644 index 88f6ce29d0..0000000000 --- a/src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsStripeBalanceMandateOptions.cs +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -namespace Stripe -{ - using Newtonsoft.Json; - using Stripe.Infrastructure; - using STJS = System.Text.Json.Serialization; - - [STJS.JsonConverter(typeof(STJStripeEntityConverter))] - public class PaymentIntentPaymentMethodOptionsStripeBalanceMandateOptions : StripeEntity - { - /// - /// The ID of the Stripe Balance Debit Agreement used for this mandate. - /// - [JsonProperty("stripe_balance_debit_agreement")] - [STJS.JsonPropertyName("stripe_balance_debit_agreement")] - public string StripeBalanceDebitAgreement { get; set; } - } -} diff --git a/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptions.cs b/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptions.cs index ff34523dfe..3185a7e0bc 100644 --- a/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptions.cs +++ b/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptions.cs @@ -52,10 +52,6 @@ public class SetupIntentPaymentMethodOptions : StripeEntity - { - [JsonProperty("mandate_options")] - [STJS.JsonPropertyName("mandate_options")] - public SetupIntentPaymentMethodOptionsStripeBalanceMandateOptions MandateOptions { get; set; } - } -} diff --git a/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptionsStripeBalanceMandateOptions.cs b/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptionsStripeBalanceMandateOptions.cs deleted file mode 100644 index 33947a1976..0000000000 --- a/src/Stripe.net/Entities/SetupIntents/SetupIntentPaymentMethodOptionsStripeBalanceMandateOptions.cs +++ /dev/null @@ -1,18 +0,0 @@ -// File generated from our OpenAPI spec -namespace Stripe -{ - using Newtonsoft.Json; - using Stripe.Infrastructure; - using STJS = System.Text.Json.Serialization; - - [STJS.JsonConverter(typeof(STJStripeEntityConverter))] - public class SetupIntentPaymentMethodOptionsStripeBalanceMandateOptions : StripeEntity - { - /// - /// The ID of the Stripe Balance Debit Agreement used for this mandate. - /// - [JsonProperty("stripe_balance_debit_agreement")] - [STJS.JsonPropertyName("stripe_balance_debit_agreement")] - public string StripeBalanceDebitAgreement { get; set; } - } -} diff --git a/src/Stripe.net/Services/Accounts/AccountService.cs b/src/Stripe.net/Services/Accounts/AccountService.cs index ddd34e4f5f..79fea208f0 100644 --- a/src/Stripe.net/Services/Accounts/AccountService.cs +++ b/src/Stripe.net/Services/Accounts/AccountService.cs @@ -5,6 +5,7 @@ namespace Stripe using System.Collections.Generic; using System.Net; using System.Net.Http; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -204,6 +205,30 @@ public virtual Task RejectAsync(string id, AccountRejectOptions options return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v1/accounts/{WebUtility.UrlEncode(id)}/reject", options, requestOptions, cancellationToken); } + /// + /// Serializes an Account update request into a batch job JSONL line. + /// + public virtual string SerializeBatchUpdate(string account, AccountUpdateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "account", account } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + /// ///

Updates a connected account by /// setting the values of the parameters passed. Any parameters not provided are left diff --git a/src/Stripe.net/Services/Accounts/AccountSettingsPayoutsScheduleDelayDays.cs b/src/Stripe.net/Services/Accounts/AccountSettingsPayoutsScheduleDelayDays.cs index 3c2b4bba70..1533883aab 100644 --- a/src/Stripe.net/Services/Accounts/AccountSettingsPayoutsScheduleDelayDays.cs +++ b/src/Stripe.net/Services/Accounts/AccountSettingsPayoutsScheduleDelayDays.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class AccountSettingsPayoutsScheduleDelayDays : StringEnum { public static readonly AccountSettingsPayoutsScheduleDelayDays Minimum = new AccountSettingsPayoutsScheduleDelayDays("minimum"); diff --git a/src/Stripe.net/Services/Customers/CustomerService.cs b/src/Stripe.net/Services/Customers/CustomerService.cs index de24186e6a..3f5e2a4390 100644 --- a/src/Stripe.net/Services/Customers/CustomerService.cs +++ b/src/Stripe.net/Services/Customers/CustomerService.cs @@ -5,6 +5,7 @@ namespace Stripe using System.Collections.Generic; using System.Net; using System.Net.Http; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -213,6 +214,30 @@ public virtual IAsyncEnumerable SearchAutoPagingAsync(CustomerSearchOp return this.SearchRequestAutoPagingAsync($"/v1/customers/search", options, requestOptions, cancellationToken); } + ///

+ /// Serializes a Customer update request into a batch job JSONL line. + /// + public virtual string SerializeBatchUpdate(string customer, CustomerUpdateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "customer", customer } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + /// ///

Updates the specified customer by setting the values of the parameters passed. Any /// parameters not provided are left unchanged. For example, if you pass the diff --git a/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseEndDate.cs b/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseEndDate.cs index 5bab041555..6c25f628d6 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseEndDate.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseEndDate.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class InvoiceScheduleDetailsPhaseEndDate : StringEnum { public static readonly InvoiceScheduleDetailsPhaseEndDate Now = new InvoiceScheduleDetailsPhaseEndDate("now"); diff --git a/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseStartDate.cs b/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseStartDate.cs index fe57efc538..edce31a7d8 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseStartDate.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseStartDate.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class InvoiceScheduleDetailsPhaseStartDate : StringEnum { public static readonly InvoiceScheduleDetailsPhaseStartDate Now = new InvoiceScheduleDetailsPhaseStartDate("now"); diff --git a/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseTrialEnd.cs b/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseTrialEnd.cs index fa591957ac..e8b01f26d8 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseTrialEnd.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceScheduleDetailsPhaseTrialEnd.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class InvoiceScheduleDetailsPhaseTrialEnd : StringEnum { public static readonly InvoiceScheduleDetailsPhaseTrialEnd Now = new InvoiceScheduleDetailsPhaseTrialEnd("now"); diff --git a/src/Stripe.net/Services/Invoices/InvoiceService.cs b/src/Stripe.net/Services/Invoices/InvoiceService.cs index 2fe96e37a5..c78ff4ed05 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceService.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceService.cs @@ -5,6 +5,7 @@ namespace Stripe using System.Collections.Generic; using System.Net; using System.Net.Http; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -431,6 +432,54 @@ public virtual Task SendInvoiceAsync(string id, InvoiceSendOptions opti return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v1/invoices/{WebUtility.UrlEncode(id)}/send", options, requestOptions, cancellationToken); } + ///

+ /// Serializes an Invoice pay request into a batch job JSONL line. + /// + public virtual string SerializeBatchPay(string invoice, InvoicePayOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "invoice", invoice } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + + /// + /// Serializes an Invoice update request into a batch job JSONL line. + /// + public virtual string SerializeBatchUpdate(string invoice, InvoiceUpdateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "invoice", invoice } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + /// ///

Draft invoices are fully editable. Once an invoice is finalized, diff --git a/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsBillingCycleAnchor.cs b/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsBillingCycleAnchor.cs index eb601c2538..45ab5d0108 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsBillingCycleAnchor.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsBillingCycleAnchor.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class InvoiceSubscriptionDetailsBillingCycleAnchor : StringEnum { public static readonly InvoiceSubscriptionDetailsBillingCycleAnchor Now = new InvoiceSubscriptionDetailsBillingCycleAnchor("now"); diff --git a/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsCancelAt.cs b/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsCancelAt.cs index 1a839ec195..073f89f5ec 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsCancelAt.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsCancelAt.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class InvoiceSubscriptionDetailsCancelAt : StringEnum { public static readonly InvoiceSubscriptionDetailsCancelAt MaxPeriodEnd = new InvoiceSubscriptionDetailsCancelAt("max_period_end"); diff --git a/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsTrialEnd.cs b/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsTrialEnd.cs index 2a06b03ea9..e99031e905 100644 --- a/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsTrialEnd.cs +++ b/src/Stripe.net/Services/Invoices/InvoiceSubscriptionDetailsTrialEnd.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class InvoiceSubscriptionDetailsTrialEnd : StringEnum { public static readonly InvoiceSubscriptionDetailsTrialEnd Now = new InvoiceSubscriptionDetailsTrialEnd("now"); diff --git a/src/Stripe.net/Services/Plans/PlanTierUpTo.cs b/src/Stripe.net/Services/Plans/PlanTierUpTo.cs index 4c331450b7..e394551535 100644 --- a/src/Stripe.net/Services/Plans/PlanTierUpTo.cs +++ b/src/Stripe.net/Services/Plans/PlanTierUpTo.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class PlanTierUpTo : StringEnum { public static readonly PlanTierUpTo Inf = new PlanTierUpTo("inf"); diff --git a/src/Stripe.net/Services/Prices/PriceTierUpTo.cs b/src/Stripe.net/Services/Prices/PriceTierUpTo.cs index 91af2f834b..6e6666b027 100644 --- a/src/Stripe.net/Services/Prices/PriceTierUpTo.cs +++ b/src/Stripe.net/Services/Prices/PriceTierUpTo.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class PriceTierUpTo : StringEnum { public static readonly PriceTierUpTo Inf = new PriceTierUpTo("inf"); diff --git a/src/Stripe.net/Services/Privacy/RedactionJobs/RedactionJobListOptions.cs b/src/Stripe.net/Services/Privacy/RedactionJobs/RedactionJobListOptions.cs index e269284e2b..5e77a2f066 100644 --- a/src/Stripe.net/Services/Privacy/RedactionJobs/RedactionJobListOptions.cs +++ b/src/Stripe.net/Services/Privacy/RedactionJobs/RedactionJobListOptions.cs @@ -9,6 +9,7 @@ namespace Stripe.Privacy public class RedactionJobListOptions : ListOptions { ///

+ /// If provided, only RedactionJob objects with the given status will be returned. /// One of: canceled, canceling, created, failed, ready, /// redacting, succeeded, or validating. /// diff --git a/src/Stripe.net/Services/PromotionCodes/PromotionCodeService.cs b/src/Stripe.net/Services/PromotionCodes/PromotionCodeService.cs index d01e11c4a3..aab4146806 100644 --- a/src/Stripe.net/Services/PromotionCodes/PromotionCodeService.cs +++ b/src/Stripe.net/Services/PromotionCodes/PromotionCodeService.cs @@ -5,6 +5,7 @@ namespace Stripe using System.Collections.Generic; using System.Net; using System.Net.Http; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -100,6 +101,54 @@ public virtual IAsyncEnumerable ListAutoPagingAsync(PromotionCode return this.ListRequestAutoPagingAsync($"/v1/promotion_codes", options, requestOptions, cancellationToken); } + /// + /// Serializes a PromotionCode create request into a batch job JSONL line. + /// + public virtual string SerializeBatchCreate(PromotionCodeCreateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", null }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + + /// + /// Serializes a PromotionCode update request into a batch job JSONL line. + /// + public virtual string SerializeBatchUpdate(string promotionCode, PromotionCodeUpdateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "promotion_code", promotionCode } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + /// ///

Updates the specified promotion code by setting the values of the parameters passed. /// Most fields are, by design, not editable.

. diff --git a/src/Stripe.net/Services/Quotes/QuoteSubscriptionDataEffectiveDate.cs b/src/Stripe.net/Services/Quotes/QuoteSubscriptionDataEffectiveDate.cs index 1ba6c9b3a8..1b9e6020c8 100644 --- a/src/Stripe.net/Services/Quotes/QuoteSubscriptionDataEffectiveDate.cs +++ b/src/Stripe.net/Services/Quotes/QuoteSubscriptionDataEffectiveDate.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class QuoteSubscriptionDataEffectiveDate : StringEnum { public static readonly QuoteSubscriptionDataEffectiveDate CurrentPeriodEnd = new QuoteSubscriptionDataEffectiveDate("current_period_end"); diff --git a/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsOptions.cs b/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsOptions.cs index f01906b42c..fe7aa2c080 100644 --- a/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsOptions.cs +++ b/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsOptions.cs @@ -95,14 +95,6 @@ public class SetupIntentPaymentMethodOptionsOptions : INestedOptions [STJS.JsonPropertyName("sepa_debit")] public SetupIntentPaymentMethodOptionsSepaDebitOptions SepaDebit { get; set; } - /// - /// If this is a stripe_balance PaymentMethod, this sub-hash contains details about - /// the Stripe Balance payment method options. - /// - [JsonProperty("stripe_balance")] - [STJS.JsonPropertyName("stripe_balance")] - public SetupIntentPaymentMethodOptionsStripeBalanceOptions StripeBalance { get; set; } - /// /// If this is a upi SetupIntent, this sub-hash contains details about the UPI /// payment method options. diff --git a/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsStripeBalanceOptions.cs b/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsStripeBalanceOptions.cs deleted file mode 100644 index a1c5845348..0000000000 --- a/src/Stripe.net/Services/SetupIntents/SetupIntentPaymentMethodOptionsStripeBalanceOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ -// File generated from our OpenAPI spec -namespace Stripe -{ - using Newtonsoft.Json; - using Stripe.Infrastructure; - using STJS = System.Text.Json.Serialization; - - [STJS.JsonConverter(typeof(STJStripeOptionsConverter))] - public class SetupIntentPaymentMethodOptionsStripeBalanceOptions : INestedOptions - { - } -} diff --git a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseEndDate.cs b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseEndDate.cs index 4ed240dfa4..80d5ddc139 100644 --- a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseEndDate.cs +++ b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseEndDate.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class SubscriptionSchedulePhaseEndDate : StringEnum { public static readonly SubscriptionSchedulePhaseEndDate Now = new SubscriptionSchedulePhaseEndDate("now"); diff --git a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseStartDate.cs b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseStartDate.cs index e7bbb99900..5080c7b0a7 100644 --- a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseStartDate.cs +++ b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseStartDate.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class SubscriptionSchedulePhaseStartDate : StringEnum { public static readonly SubscriptionSchedulePhaseStartDate Now = new SubscriptionSchedulePhaseStartDate("now"); diff --git a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseTrialEnd.cs b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseTrialEnd.cs index c798acbe85..b8965af400 100644 --- a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseTrialEnd.cs +++ b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionSchedulePhaseTrialEnd.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class SubscriptionSchedulePhaseTrialEnd : StringEnum { public static readonly SubscriptionSchedulePhaseTrialEnd Now = new SubscriptionSchedulePhaseTrialEnd("now"); diff --git a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleService.cs b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleService.cs index 3e97c8a5da..cd9b3b5e66 100644 --- a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleService.cs +++ b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleService.cs @@ -5,6 +5,7 @@ namespace Stripe using System.Collections.Generic; using System.Net; using System.Net.Http; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -160,6 +161,78 @@ public virtual Task ReleaseAsync(string id, SubscriptionSc return this.RequestAsync(BaseAddress.Api, HttpMethod.Post, $"/v1/subscription_schedules/{WebUtility.UrlEncode(id)}/release", options, requestOptions, cancellationToken); } + /// + /// Serializes a SubscriptionSchedule cancel request into a batch job JSONL line. + /// + public virtual string SerializeBatchCancel(string schedule, SubscriptionScheduleCancelOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "schedule", schedule } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + + /// + /// Serializes a SubscriptionSchedule create request into a batch job JSONL line. + /// + public virtual string SerializeBatchCreate(SubscriptionScheduleCreateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", null }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + + /// + /// Serializes a SubscriptionSchedule update request into a batch job JSONL line. + /// + public virtual string SerializeBatchUpdate(string schedule, SubscriptionScheduleUpdateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "schedule", schedule } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + /// ///

Updates an existing subscription schedule.

. ///
diff --git a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleStartDate.cs b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleStartDate.cs index 5e24281077..91b5c518c4 100644 --- a/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleStartDate.cs +++ b/src/Stripe.net/Services/SubscriptionSchedules/SubscriptionScheduleStartDate.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class SubscriptionScheduleStartDate : StringEnum { public static readonly SubscriptionScheduleStartDate Now = new SubscriptionScheduleStartDate("now"); diff --git a/src/Stripe.net/Services/Subscriptions/SubscriptionCancelAt.cs b/src/Stripe.net/Services/Subscriptions/SubscriptionCancelAt.cs index 059afeb172..4f20b2c22b 100644 --- a/src/Stripe.net/Services/Subscriptions/SubscriptionCancelAt.cs +++ b/src/Stripe.net/Services/Subscriptions/SubscriptionCancelAt.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class SubscriptionCancelAt : StringEnum { public static readonly SubscriptionCancelAt MaxPeriodEnd = new SubscriptionCancelAt("max_period_end"); diff --git a/src/Stripe.net/Services/Subscriptions/SubscriptionService.cs b/src/Stripe.net/Services/Subscriptions/SubscriptionService.cs index 0bd0630f4c..834d4bb399 100644 --- a/src/Stripe.net/Services/Subscriptions/SubscriptionService.cs +++ b/src/Stripe.net/Services/Subscriptions/SubscriptionService.cs @@ -5,6 +5,7 @@ namespace Stripe using System.Collections.Generic; using System.Net; using System.Net.Http; + using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -279,6 +280,54 @@ public virtual IAsyncEnumerable SearchAutoPagingAsync(Subscription return this.SearchRequestAutoPagingAsync($"/v1/subscriptions/search", options, requestOptions, cancellationToken); } + /// + /// Serializes a Subscription migrate request into a batch job JSONL line. + /// + public virtual string SerializeBatchMigrate(string subscription, SubscriptionMigrateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "subscription", subscription } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + + /// + /// Serializes a Subscription update request into a batch job JSONL line. + /// + public virtual string SerializeBatchUpdate(string subscriptionExposedId, SubscriptionUpdateOptions options = null, RequestOptions requestOptions = null) + { + var itemId = Guid.NewGuid().ToString(); + var stripeVersion = StripeConfiguration.ApiVersion; + var stripeContext = requestOptions?.StripeContext; + + var item = new Dictionary + { + { "id", itemId }, + { "path_params", new Dictionary { { "subscription_exposed_id", subscriptionExposedId } } }, + { "params", options }, + { "stripe_version", stripeVersion }, + }; + if (stripeContext != null) + { + item["context"] = stripeContext; + } + + return JsonSerializer.Serialize(item, new JsonSerializerOptions(StripeConfiguration.SerializerOptions) { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }); + } + /// ///

Updates an existing subscription to match the specified parameters. When changing /// prices or quantities, we optionally prorate the price we charge next month to make up diff --git a/src/Stripe.net/Services/Subscriptions/SubscriptionTrialEnd.cs b/src/Stripe.net/Services/Subscriptions/SubscriptionTrialEnd.cs index bcc9a1fd64..fe2b28e382 100644 --- a/src/Stripe.net/Services/Subscriptions/SubscriptionTrialEnd.cs +++ b/src/Stripe.net/Services/Subscriptions/SubscriptionTrialEnd.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class SubscriptionTrialEnd : StringEnum { public static readonly SubscriptionTrialEnd Now = new SubscriptionTrialEnd("now"); diff --git a/src/Stripe.net/Services/Tax/Registrations/RegistrationActiveFrom.cs b/src/Stripe.net/Services/Tax/Registrations/RegistrationActiveFrom.cs index d6d0215a64..335167116b 100644 --- a/src/Stripe.net/Services/Tax/Registrations/RegistrationActiveFrom.cs +++ b/src/Stripe.net/Services/Tax/Registrations/RegistrationActiveFrom.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe.Tax { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class RegistrationActiveFrom : StringEnum { public static readonly RegistrationActiveFrom Now = new RegistrationActiveFrom("now"); diff --git a/src/Stripe.net/Services/Tax/Registrations/RegistrationExpiresAt.cs b/src/Stripe.net/Services/Tax/Registrations/RegistrationExpiresAt.cs index bcb0e3f224..abf3188e4b 100644 --- a/src/Stripe.net/Services/Tax/Registrations/RegistrationExpiresAt.cs +++ b/src/Stripe.net/Services/Tax/Registrations/RegistrationExpiresAt.cs @@ -1,6 +1,9 @@ // File generated from our OpenAPI spec namespace Stripe.Tax { + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] public class RegistrationExpiresAt : StringEnum { public static readonly RegistrationExpiresAt Now = new RegistrationExpiresAt("now"); diff --git a/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobCreateEndpointOptions.cs b/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobCreateEndpointOptions.cs index 554f65b9fc..5c956ecfd9 100644 --- a/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobCreateEndpointOptions.cs +++ b/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobCreateEndpointOptions.cs @@ -19,9 +19,17 @@ public class BatchJobCreateEndpointOptions : INestedOptions /// The path of the endpoint to run this batch job against. In the form used in the /// documentation. For instance, for subscription migration this would be /// /v1/subscriptions/:id/migrate. + /// One of: /v1/accounts/:account, /v1/credit_notes, + /// /v1/customers/:customer, /v1/invoices/:invoice, + /// /v1/invoices/:invoice/pay, /v1/promotion_codes, + /// /v1/promotion_codes/:promotion_code, + /// /v1/subscriptions/:subscription_exposed_id, + /// /v1/subscriptions/:subscription/migrate, /v1/subscription_schedules, + /// /v1/subscription_schedules/:schedule, or + /// /v1/subscription_schedules/:schedule/cancel. ///

[JsonProperty("path")] [STJS.JsonPropertyName("path")] - public string Path { get; set; } + public BatchJobEndpointPath Path { get; set; } } } diff --git a/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobEndpointPath.cs b/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobEndpointPath.cs new file mode 100644 index 0000000000..c7a4f51635 --- /dev/null +++ b/src/Stripe.net/Services/V2/Core/BatchJobs/BatchJobEndpointPath.cs @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec +namespace Stripe +{ + using STJS = System.Text.Json.Serialization; + + [STJS.JsonConverter(typeof(Infrastructure.STJStringEnumConverterFactory))] + public class BatchJobEndpointPath : StringEnum + { + public static readonly BatchJobEndpointPath V1AccountUpdate = new BatchJobEndpointPath("/v1/accounts/:account"); + public static readonly BatchJobEndpointPath V1CreditNoteCreate = new BatchJobEndpointPath("/v1/credit_notes"); + public static readonly BatchJobEndpointPath V1CustomerUpdate = new BatchJobEndpointPath("/v1/customers/:customer"); + public static readonly BatchJobEndpointPath V1InvoiceUpdate = new BatchJobEndpointPath("/v1/invoices/:invoice"); + public static readonly BatchJobEndpointPath V1InvoicePay = new BatchJobEndpointPath("/v1/invoices/:invoice/pay"); + public static readonly BatchJobEndpointPath V1PromotionCodeCreate = new BatchJobEndpointPath("/v1/promotion_codes"); + public static readonly BatchJobEndpointPath V1PromotionCodeUpdate = new BatchJobEndpointPath("/v1/promotion_codes/:promotion_code"); + public static readonly BatchJobEndpointPath V1SubscriptionUpdate = new BatchJobEndpointPath("/v1/subscriptions/:subscription_exposed_id"); + public static readonly BatchJobEndpointPath V1SubscriptionMigrate = new BatchJobEndpointPath("/v1/subscriptions/:subscription/migrate"); + public static readonly BatchJobEndpointPath V1SubscriptionScheduleCreate = new BatchJobEndpointPath("/v1/subscription_schedules"); + public static readonly BatchJobEndpointPath V1SubscriptionScheduleUpdate = new BatchJobEndpointPath("/v1/subscription_schedules/:schedule"); + public static readonly BatchJobEndpointPath V1SubscriptionScheduleCancel = new BatchJobEndpointPath("/v1/subscription_schedules/:schedule/cancel"); + + private BatchJobEndpointPath(string value) + : base(value) + { + } + } +} diff --git a/src/StripeTests/Services/GeneratedExamplesTest.cs b/src/StripeTests/Services/GeneratedExamplesTest.cs index 93feab6815..0bf23eecf9 100644 --- a/src/StripeTests/Services/GeneratedExamplesTest.cs +++ b/src/StripeTests/Services/GeneratedExamplesTest.cs @@ -6971,7 +6971,7 @@ public void TestV2CoreBatchJobPost() Endpoint = new Stripe.V2.Core.BatchJobCreateEndpointOptions { HttpMethod = "post", - Path = "path", + Path = BatchJobEndpointPath.V1SubscriptionScheduleCreate, }, Metadata = new Dictionary {