From b9614c4bb4e43080ca12b8f768ac91649c776387 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:37:31 +0000 Subject: [PATCH 1/7] Update generated code for v266 --- OPENAPI_VERSION | 2 +- .../Entities/SetupIntents/SetupIntent.cs | 6 ++++++ .../SetupIntentAutomaticPaymentMethods.cs | 14 ++++++++++++++ .../SetupIntentAutomaticPaymentMethodsOptions.cs | 14 ++++++++++++++ .../SetupIntents/SetupIntentCreateOptions.cs | 7 +++++++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/Stripe.net/Entities/SetupIntents/SetupIntentAutomaticPaymentMethods.cs create mode 100644 src/Stripe.net/Services/SetupIntents/SetupIntentAutomaticPaymentMethodsOptions.cs diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 811b18420b..8290818518 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v263 \ No newline at end of file +v266 \ No newline at end of file diff --git a/src/Stripe.net/Entities/SetupIntents/SetupIntent.cs b/src/Stripe.net/Entities/SetupIntents/SetupIntent.cs index 1c5532b4cf..804b421c9d 100644 --- a/src/Stripe.net/Entities/SetupIntents/SetupIntent.cs +++ b/src/Stripe.net/Entities/SetupIntents/SetupIntent.cs @@ -97,6 +97,12 @@ public Application Application [JsonProperty("attach_to_self")] public bool AttachToSelf { get; set; } + /// + /// Settings for automatic payment methods compatible with this Setup Intent. + /// + [JsonProperty("automatic_payment_methods")] + public SetupIntentAutomaticPaymentMethods AutomaticPaymentMethods { get; set; } + /// /// Reason for cancellation of this SetupIntent, one of abandoned, /// requested_by_customer, or duplicate. diff --git a/src/Stripe.net/Entities/SetupIntents/SetupIntentAutomaticPaymentMethods.cs b/src/Stripe.net/Entities/SetupIntents/SetupIntentAutomaticPaymentMethods.cs new file mode 100644 index 0000000000..7f1fef141c --- /dev/null +++ b/src/Stripe.net/Entities/SetupIntents/SetupIntentAutomaticPaymentMethods.cs @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec +namespace Stripe +{ + using Newtonsoft.Json; + + public class SetupIntentAutomaticPaymentMethods : StripeEntity + { + /// + /// Automatically calculates compatible payment methods. + /// + [JsonProperty("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/src/Stripe.net/Services/SetupIntents/SetupIntentAutomaticPaymentMethodsOptions.cs b/src/Stripe.net/Services/SetupIntents/SetupIntentAutomaticPaymentMethodsOptions.cs new file mode 100644 index 0000000000..2b10a6335e --- /dev/null +++ b/src/Stripe.net/Services/SetupIntents/SetupIntentAutomaticPaymentMethodsOptions.cs @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec +namespace Stripe +{ + using Newtonsoft.Json; + + public class SetupIntentAutomaticPaymentMethodsOptions : INestedOptions + { + /// + /// Whether this feature is enabled. + /// + [JsonProperty("enabled")] + public bool? Enabled { get; set; } + } +} diff --git a/src/Stripe.net/Services/SetupIntents/SetupIntentCreateOptions.cs b/src/Stripe.net/Services/SetupIntents/SetupIntentCreateOptions.cs index 37b1a04668..395d06c770 100644 --- a/src/Stripe.net/Services/SetupIntents/SetupIntentCreateOptions.cs +++ b/src/Stripe.net/Services/SetupIntents/SetupIntentCreateOptions.cs @@ -18,6 +18,13 @@ public class SetupIntentCreateOptions : BaseOptions, IHasMetadata [JsonProperty("attach_to_self")] public bool? AttachToSelf { get; set; } + /// + /// When enabled, this SetupIntent will accept payment methods that you have enabled in the + /// Dashboard and are compatible with this SetupIntent's other parameters. + /// + [JsonProperty("automatic_payment_methods")] + public SetupIntentAutomaticPaymentMethodsOptions AutomaticPaymentMethods { get; set; } + /// /// Set to true to attempt to confirm this SetupIntent immediately. This parameter /// defaults to false. If the payment method attached is a card, a return_url may be From 3efa24baf546884af493fe8c3f278a9a131b60f2 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 22 Mar 2023 19:07:52 +0000 Subject: [PATCH 2/7] Update generated code for v274 --- OPENAPI_VERSION | 2 +- .../Entities/Checkout/Sessions/Session.cs | 6 ++++ .../Sessions/SessionCurrencyConversion.cs | 32 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/Stripe.net/Entities/Checkout/Sessions/SessionCurrencyConversion.cs diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 8290818518..cbc1589594 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v266 \ No newline at end of file +v274 \ No newline at end of file diff --git a/src/Stripe.net/Entities/Checkout/Sessions/Session.cs b/src/Stripe.net/Entities/Checkout/Sessions/Session.cs index 8041ea630a..e09faa4c40 100644 --- a/src/Stripe.net/Entities/Checkout/Sessions/Session.cs +++ b/src/Stripe.net/Entities/Checkout/Sessions/Session.cs @@ -114,6 +114,12 @@ public class Session : StripeEntity, IHasId, IHasMetadata, IHasObject [JsonProperty("currency")] public string Currency { get; set; } + /// + /// Currency conversion details for automatic currency conversion sessions. + /// + [JsonProperty("currency_conversion")] + public SessionCurrencyConversion CurrencyConversion { get; set; } + /// /// Collect additional information from your customer using custom fields. Up to 2 fields /// are supported. diff --git a/src/Stripe.net/Entities/Checkout/Sessions/SessionCurrencyConversion.cs b/src/Stripe.net/Entities/Checkout/Sessions/SessionCurrencyConversion.cs new file mode 100644 index 0000000000..ef717a8af9 --- /dev/null +++ b/src/Stripe.net/Entities/Checkout/Sessions/SessionCurrencyConversion.cs @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec +namespace Stripe.Checkout +{ + using Newtonsoft.Json; + + public class SessionCurrencyConversion : StripeEntity + { + /// + /// Total of all items in source currency before discounts or taxes are applied. + /// + [JsonProperty("amount_subtotal")] + public long AmountSubtotal { get; set; } + + /// + /// Total of all items in source currency after discounts and taxes are applied. + /// + [JsonProperty("amount_total")] + public long AmountTotal { get; set; } + + /// + /// Exchange rate used to convert source currency amounts to customer currency amounts. + /// + [JsonProperty("fx_rate")] + public decimal FxRate { get; set; } + + /// + /// Creation currency of the CheckoutSession before localization. + /// + [JsonProperty("source_currency")] + public string SourceCurrency { get; set; } + } +} From aacfcd20564bcde8e64e64346da2bfa47aed1e40 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 14:26:16 +0000 Subject: [PATCH 3/7] Update generated code for v275 --- OPENAPI_VERSION | 2 +- .../Entities/Tax/Calculations/Calculation.cs | 103 +++++++++++++++++ .../CalculationCustomerDetails.cs | 41 +++++++ .../CalculationCustomerDetailsAddress.cs | 46 ++++++++ .../CalculationCustomerDetailsTaxId.cs | 41 +++++++ .../Calculations/CalculationShippingCost.cs | 43 +++++++ .../Calculations/CalculationTaxBreakdown.cs | 29 +++++ .../CalculationTaxBreakdownTaxRateDetails.cs | 35 ++++++ .../Entities/Tax/Transactions/Transaction.cs | 105 ++++++++++++++++++ .../TransactionCustomerDetails.cs | 41 +++++++ .../TransactionCustomerDetailsAddress.cs | 46 ++++++++ .../TransactionCustomerDetailsTaxId.cs | 41 +++++++ .../Tax/Transactions/TransactionReversal.cs | 14 +++ .../Transactions/TransactionShippingCost.cs | 43 +++++++ .../Public/StripeTypeRegistry.cs | 2 + .../Calculations/CalculationCreateOptions.cs | 49 ++++++++ .../CalculationCustomerDetailsOptions.cs | 43 +++++++ .../CalculationCustomerDetailsTaxIdOptions.cs | 40 +++++++ .../CalculationLineItemOptions.cs | 54 +++++++++ .../CalculationListLineItemsOptions.cs | 7 ++ .../Tax/Calculations/CalculationService.cs | 54 +++++++++ .../CalculationShippingCostOptions.cs | 39 +++++++ ...TransactionCreateFromCalculationOptions.cs | 31 ++++++ .../Transactions/TransactionCreateOptions.cs | 31 ++++++ .../TransactionCreateReversalOptions.cs | 51 +++++++++ .../Tax/Transactions/TransactionGetOptions.cs | 7 ++ .../TransactionLineItemOptions.cs | 47 ++++++++ .../TransactionListLineItemsOptions.cs | 7 ++ .../Tax/Transactions/TransactionService.cs | 85 ++++++++++++++ .../TransactionShippingCostOptions.cs | 20 ++++ 30 files changed, 1196 insertions(+), 1 deletion(-) create mode 100644 src/Stripe.net/Entities/Tax/Calculations/Calculation.cs create mode 100644 src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs create mode 100644 src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsAddress.cs create mode 100644 src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsTaxId.cs create mode 100644 src/Stripe.net/Entities/Tax/Calculations/CalculationShippingCost.cs create mode 100644 src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdown.cs create mode 100644 src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdownTaxRateDetails.cs create mode 100644 src/Stripe.net/Entities/Tax/Transactions/Transaction.cs create mode 100644 src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs create mode 100644 src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsAddress.cs create mode 100644 src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsTaxId.cs create mode 100644 src/Stripe.net/Entities/Tax/Transactions/TransactionReversal.cs create mode 100644 src/Stripe.net/Entities/Tax/Transactions/TransactionShippingCost.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsTaxIdOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationListLineItemsOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationService.cs create mode 100644 src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionCreateOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionGetOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionListLineItemsOptions.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionService.cs create mode 100644 src/Stripe.net/Services/Tax/Transactions/TransactionShippingCostOptions.cs diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index cbc1589594..a03ad49b62 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v274 \ No newline at end of file +v275 \ No newline at end of file diff --git a/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs b/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs new file mode 100644 index 0000000000..e2296429a1 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System; + using System.Collections.Generic; + using Newtonsoft.Json; + using Stripe.Infrastructure; + + /// + /// A Tax Calculation allows you to calculate the tax to collect from your customer. + /// + public class Calculation : StripeEntity, IHasId, IHasObject + { + /// + /// Unique identifier for the calculation. + /// + [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; } + + /// + /// Total after taxes. + /// + [JsonProperty("amount_total")] + public long AmountTotal { get; set; } + + /// + /// Three-letter ISO currency + /// code, in lowercase. Must be a supported + /// currency. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// The ID of an existing Customer used for the resource. + /// + [JsonProperty("customer")] + public string Customer { get; set; } + + [JsonProperty("customer_details")] + public CalculationCustomerDetails CustomerDetails { get; set; } + + /// + /// Timestamp of date at which the tax calculation will expire. Empty if the calculation is + /// an unsaved preview. + /// + [JsonProperty("expires_at")] + [JsonConverter(typeof(UnixDateTimeConverter))] + public DateTime? ExpiresAt { get; set; } + + /// + /// The list of items the customer is purchasing. + /// + [JsonProperty("line_items")] + public StripeList LineItems { 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; } + + /// + /// The shipping cost details for the calculation. + /// + [JsonProperty("shipping_cost")] + public CalculationShippingCost ShippingCost { get; set; } + + /// + /// The amount of tax to be collected on top of the line item prices. + /// + [JsonProperty("tax_amount_exclusive")] + public long TaxAmountExclusive { get; set; } + + /// + /// The amount of tax already included in the line item prices. + /// + [JsonProperty("tax_amount_inclusive")] + public long TaxAmountInclusive { get; set; } + + /// + /// Breakdown of individual tax amounts that add up to the total. + /// + [JsonProperty("tax_breakdown")] + public List TaxBreakdown { get; set; } + + /// + /// Timestamp of date at which the tax rules and rates in effect applies for the + /// calculation. + /// + [JsonProperty("tax_date")] + [JsonConverter(typeof(UnixDateTimeConverter))] + public DateTime TaxDate { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch; + } +} diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs new file mode 100644 index 0000000000..1e6454b883 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class CalculationCustomerDetails : StripeEntity + { + /// + /// The customer's postal address (e.g., home or business location). + /// + [JsonProperty("address")] + public CalculationCustomerDetailsAddress Address { get; set; } + + /// + /// The type of customer address provided. + /// One of: billing, or shipping. + /// + [JsonProperty("address_source")] + public string AddressSource { get; set; } + + /// + /// The customer's IP address (IPv4 or IPv6). + /// + [JsonProperty("ip_address")] + public string IpAddress { get; set; } + + /// + /// The customer's tax IDs (e.g., EU VAT numbers). + /// + [JsonProperty("tax_ids")] + public List TaxIds { get; set; } + + /// + /// The taxability override used for taxation. + /// One of: customer_exempt, none, or reverse_charge. + /// + [JsonProperty("taxability_override")] + public string TaxabilityOverride { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsAddress.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsAddress.cs new file mode 100644 index 0000000000..bbc45886c0 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsAddress.cs @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationCustomerDetailsAddress : StripeEntity + { + /// + /// City, district, suburb, town, or village. + /// + [JsonProperty("city")] + public string City { get; set; } + + /// + /// Two-letter country code (ISO + /// 3166-1 alpha-2). + /// + [JsonProperty("country")] + public string Country { get; set; } + + /// + /// Address line 1 (e.g., street, PO Box, or company name). + /// + [JsonProperty("line1")] + public string Line1 { get; set; } + + /// + /// Address line 2 (e.g., apartment, suite, unit, or building). + /// + [JsonProperty("line2")] + public string Line2 { get; set; } + + /// + /// ZIP or postal code. + /// + [JsonProperty("postal_code")] + public string PostalCode { get; set; } + + /// + /// State/province as an ISO 3166-2 + /// subdivision code, without country prefix. Example: "NY" or "TX". + /// + [JsonProperty("state")] + public string State { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsTaxId.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsTaxId.cs new file mode 100644 index 0000000000..f6ee1156a4 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetailsTaxId.cs @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationCustomerDetailsTaxId : StripeEntity + { + /// + /// The type of the tax ID, one of eu_vat, br_cnpj, br_cpf, + /// eu_oss_vat, gb_vat, nz_gst, au_abn, au_arn, + /// in_gst, no_vat, za_vat, ch_vat, mx_rfc, + /// sg_uen, ru_inn, ru_kpp, ca_bn, hk_br, es_cif, + /// tw_vat, th_vat, jp_cn, jp_rn, jp_trn, li_uid, + /// my_itn, us_ein, kr_brn, ca_qst, ca_gst_hst, + /// ca_pst_bc, ca_pst_mb, ca_pst_sk, my_sst, sg_gst, + /// ae_trn, cl_tin, sa_vat, id_npwp, my_frp, + /// il_vat, ge_vat, ua_vat, is_vat, bg_uic, + /// hu_tin, si_tin, ke_pin, tr_tin, eg_tin, + /// ph_tin, or unknown. + /// One of: ae_trn, au_abn, au_arn, bg_uic, br_cnpj, + /// br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, + /// ca_pst_sk, ca_qst, ch_vat, cl_tin, eg_tin, + /// es_cif, eu_oss_vat, eu_vat, gb_vat, ge_vat, + /// hk_br, hu_tin, id_npwp, il_vat, in_gst, + /// is_vat, jp_cn, jp_rn, jp_trn, ke_pin, kr_brn, + /// li_uid, mx_rfc, my_frp, my_itn, my_sst, + /// no_vat, nz_gst, ph_tin, ru_inn, ru_kpp, + /// sa_vat, sg_gst, sg_uen, si_tin, th_vat, + /// tr_tin, tw_vat, ua_vat, unknown, us_ein, or + /// za_vat. + /// + [JsonProperty("type")] + public string Type { get; set; } + + /// + /// The value of the tax ID. + /// + [JsonProperty("value")] + public string Value { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationShippingCost.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationShippingCost.cs new file mode 100644 index 0000000000..5026060069 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationShippingCost.cs @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationShippingCost : StripeEntity + { + /// + /// The shipping amount in integer cents. If tax_behavior=inclusive, then this amount + /// includes taxes. Otherwise, taxes were calculated on top of this amount. + /// + [JsonProperty("amount")] + public long Amount { get; set; } + + /// + /// The amount of tax calculated for shipping, in integer cents. + /// + [JsonProperty("amount_tax")] + public long AmountTax { get; set; } + + /// + /// The ID of an existing ShippingRate. + /// + [JsonProperty("shipping_rate")] + public string ShippingRate { get; set; } + + /// + /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, + /// then the amount includes taxes. + /// One of: exclusive, or inclusive. + /// + [JsonProperty("tax_behavior")] + public string TaxBehavior { get; set; } + + /// + /// The tax code ID used for + /// shipping. + /// + [JsonProperty("tax_code")] + public string TaxCode { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdown.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdown.cs new file mode 100644 index 0000000000..675c01fd41 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdown.cs @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationTaxBreakdown : StripeEntity + { + /// + /// The amount of tax, in integer cents. + /// + [JsonProperty("amount")] + public long Amount { get; set; } + + /// + /// Specifies whether the tax amount is included in the line item amount. + /// + [JsonProperty("inclusive")] + public bool Inclusive { get; set; } + + [JsonProperty("tax_rate_details")] + public CalculationTaxBreakdownTaxRateDetails TaxRateDetails { get; set; } + + /// + /// The amount on which tax is calculated, in integer cents. + /// + [JsonProperty("taxable_amount")] + public long TaxableAmount { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdownTaxRateDetails.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdownTaxRateDetails.cs new file mode 100644 index 0000000000..db74eb5d00 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationTaxBreakdownTaxRateDetails.cs @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationTaxBreakdownTaxRateDetails : StripeEntity + { + /// + /// Two-letter country code (ISO + /// 3166-1 alpha-2). + /// + [JsonProperty("country")] + public string Country { get; set; } + + /// + /// The tax rate percentage as a string. For example, 8.5% is represented as "8.5". + /// + [JsonProperty("percentage_decimal")] + public string PercentageDecimal { get; set; } + + /// + /// State, county, province, or region. + /// + [JsonProperty("state")] + public string State { get; set; } + + /// + /// The tax type, such as vat or sales_tax. + /// One of: gst, hst, igst, jct, lease_tax, pst, + /// qst, rst, sales_tax, or vat. + /// + [JsonProperty("tax_type")] + public string TaxType { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs b/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs new file mode 100644 index 0000000000..2d910f69f8 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System; + using System.Collections.Generic; + using Newtonsoft.Json; + using Stripe.Infrastructure; + + /// + /// A Tax Transaction records the tax collected from or refunded to your customer. + /// + public class Transaction : StripeEntity, IHasId, IHasMetadata, IHasObject + { + /// + /// Unique identifier for the transaction. + /// + [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; } + + /// + /// Time at which the object was created. Measured in seconds since the Unix epoch. + /// + [JsonProperty("created")] + [JsonConverter(typeof(UnixDateTimeConverter))] + public DateTime Created { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch; + + /// + /// Three-letter ISO currency + /// code, in lowercase. Must be a supported + /// currency. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// The ID of an existing Customer used for the resource. + /// + [JsonProperty("customer")] + public string Customer { get; set; } + + [JsonProperty("customer_details")] + public TransactionCustomerDetails CustomerDetails { get; set; } + + /// + /// The tax collected or refunded, by line item. + /// + [JsonProperty("line_items")] + public StripeList LineItems { 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; } + + /// + /// 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")] + public Dictionary Metadata { get; set; } + + /// + /// A custom unique identifier, such as 'myOrder_123'. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// If type=reversal, contains information about what was reversed. + /// + [JsonProperty("reversal")] + public TransactionReversal Reversal { get; set; } + + /// + /// The shipping cost details for the transaction. + /// + [JsonProperty("shipping_cost")] + public TransactionShippingCost ShippingCost { get; set; } + + /// + /// Timestamp of date at which the tax rules and rates in effect applies for the + /// calculation. + /// + [JsonProperty("tax_date")] + [JsonConverter(typeof(UnixDateTimeConverter))] + public DateTime TaxDate { get; set; } = Stripe.Infrastructure.DateTimeUtils.UnixEpoch; + + /// + /// If reversal, this transaction reverses an earlier transaction. + /// One of: reversal, or transaction. + /// + [JsonProperty("type")] + public string Type { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs new file mode 100644 index 0000000000..9ef7eb3205 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class TransactionCustomerDetails : StripeEntity + { + /// + /// The customer's postal address (e.g., home or business location). + /// + [JsonProperty("address")] + public TransactionCustomerDetailsAddress Address { get; set; } + + /// + /// The type of customer address provided. + /// One of: billing, or shipping. + /// + [JsonProperty("address_source")] + public string AddressSource { get; set; } + + /// + /// The customer's IP address (IPv4 or IPv6). + /// + [JsonProperty("ip_address")] + public string IpAddress { get; set; } + + /// + /// The customer's tax IDs (e.g., EU VAT numbers). + /// + [JsonProperty("tax_ids")] + public List TaxIds { get; set; } + + /// + /// The taxability override used for taxation. + /// One of: customer_exempt, none, or reverse_charge. + /// + [JsonProperty("taxability_override")] + public string TaxabilityOverride { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsAddress.cs b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsAddress.cs new file mode 100644 index 0000000000..2b4e8fb6d8 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsAddress.cs @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class TransactionCustomerDetailsAddress : StripeEntity + { + /// + /// City, district, suburb, town, or village. + /// + [JsonProperty("city")] + public string City { get; set; } + + /// + /// Two-letter country code (ISO + /// 3166-1 alpha-2). + /// + [JsonProperty("country")] + public string Country { get; set; } + + /// + /// Address line 1 (e.g., street, PO Box, or company name). + /// + [JsonProperty("line1")] + public string Line1 { get; set; } + + /// + /// Address line 2 (e.g., apartment, suite, unit, or building). + /// + [JsonProperty("line2")] + public string Line2 { get; set; } + + /// + /// ZIP or postal code. + /// + [JsonProperty("postal_code")] + public string PostalCode { get; set; } + + /// + /// State/province as an ISO 3166-2 + /// subdivision code, without country prefix. Example: "NY" or "TX". + /// + [JsonProperty("state")] + public string State { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsTaxId.cs b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsTaxId.cs new file mode 100644 index 0000000000..e32989a26a --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetailsTaxId.cs @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class TransactionCustomerDetailsTaxId : StripeEntity + { + /// + /// The type of the tax ID, one of eu_vat, br_cnpj, br_cpf, + /// eu_oss_vat, gb_vat, nz_gst, au_abn, au_arn, + /// in_gst, no_vat, za_vat, ch_vat, mx_rfc, + /// sg_uen, ru_inn, ru_kpp, ca_bn, hk_br, es_cif, + /// tw_vat, th_vat, jp_cn, jp_rn, jp_trn, li_uid, + /// my_itn, us_ein, kr_brn, ca_qst, ca_gst_hst, + /// ca_pst_bc, ca_pst_mb, ca_pst_sk, my_sst, sg_gst, + /// ae_trn, cl_tin, sa_vat, id_npwp, my_frp, + /// il_vat, ge_vat, ua_vat, is_vat, bg_uic, + /// hu_tin, si_tin, ke_pin, tr_tin, eg_tin, + /// ph_tin, or unknown. + /// One of: ae_trn, au_abn, au_arn, bg_uic, br_cnpj, + /// br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, + /// ca_pst_sk, ca_qst, ch_vat, cl_tin, eg_tin, + /// es_cif, eu_oss_vat, eu_vat, gb_vat, ge_vat, + /// hk_br, hu_tin, id_npwp, il_vat, in_gst, + /// is_vat, jp_cn, jp_rn, jp_trn, ke_pin, kr_brn, + /// li_uid, mx_rfc, my_frp, my_itn, my_sst, + /// no_vat, nz_gst, ph_tin, ru_inn, ru_kpp, + /// sa_vat, sg_gst, sg_uen, si_tin, th_vat, + /// tr_tin, tw_vat, ua_vat, unknown, us_ein, or + /// za_vat. + /// + [JsonProperty("type")] + public string Type { get; set; } + + /// + /// The value of the tax ID. + /// + [JsonProperty("value")] + public string Value { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Transactions/TransactionReversal.cs b/src/Stripe.net/Entities/Tax/Transactions/TransactionReversal.cs new file mode 100644 index 0000000000..61001b2e1d --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Transactions/TransactionReversal.cs @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class TransactionReversal : StripeEntity + { + /// + /// The id of the reversed Transaction object. + /// + [JsonProperty("original_transaction")] + public string OriginalTransaction { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/Transactions/TransactionShippingCost.cs b/src/Stripe.net/Entities/Tax/Transactions/TransactionShippingCost.cs new file mode 100644 index 0000000000..14edc1d2e0 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/Transactions/TransactionShippingCost.cs @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class TransactionShippingCost : StripeEntity + { + /// + /// The shipping amount in integer cents. If tax_behavior=inclusive, then this amount + /// includes taxes. Otherwise, taxes were calculated on top of this amount. + /// + [JsonProperty("amount")] + public long Amount { get; set; } + + /// + /// The amount of tax calculated for shipping, in integer cents. + /// + [JsonProperty("amount_tax")] + public long AmountTax { get; set; } + + /// + /// The ID of an existing ShippingRate. + /// + [JsonProperty("shipping_rate")] + public string ShippingRate { get; set; } + + /// + /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, + /// then the amount includes taxes. + /// One of: exclusive, or inclusive. + /// + [JsonProperty("tax_behavior")] + public string TaxBehavior { get; set; } + + /// + /// The tax code ID used for + /// shipping. + /// + [JsonProperty("tax_code")] + public string TaxCode { get; set; } + } +} diff --git a/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs b/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs index 58e629ebee..35d9679f53 100644 --- a/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs +++ b/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs @@ -122,6 +122,8 @@ public static class StripeTypeRegistry { "subscription", typeof(Subscription) }, { "subscription_item", typeof(SubscriptionItem) }, { "subscription_schedule", typeof(SubscriptionSchedule) }, + { "tax.calculation", typeof(Tax.Calculation) }, + { "tax.transaction", typeof(Tax.Transaction) }, { "tax_code", typeof(TaxCode) }, { "tax_id", typeof(TaxId) }, { "tax_rate", typeof(TaxRate) }, diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs new file mode 100644 index 0000000000..f6022cd8f6 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class CalculationCreateOptions : BaseOptions + { + /// + /// Three-letter ISO currency + /// code, in lowercase. Must be a supported + /// currency. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// The ID of an existing customer to use for this calculation. If provided, the customer's + /// address and tax IDs are copied to customer_details. + /// + [JsonProperty("customer")] + public string Customer { get; set; } + + /// + /// Details about the customer, including address and tax IDs. + /// + [JsonProperty("customer_details")] + public CalculationCustomerDetailsOptions CustomerDetails { get; set; } + + /// + /// A list of items the customer is purchasing. + /// + [JsonProperty("line_items")] + public List LineItems { get; set; } + + /// + /// Shipping cost details to be used for the calculation. + /// + [JsonProperty("shipping_cost")] + public CalculationShippingCostOptions ShippingCost { get; set; } + + /// + /// Timestamp of date at which the tax rules and rates in effect applies for the + /// calculation. Measured in seconds since the Unix epoch. + /// + [JsonProperty("tax_date")] + public long? TaxDate { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs new file mode 100644 index 0000000000..4381043805 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class CalculationCustomerDetailsOptions : INestedOptions + { + /// + /// The customer's postal address (e.g., home or business location). + /// + [JsonProperty("address")] + public AddressOptions Address { get; set; } + + /// + /// The type of customer address provided. + /// One of: billing, or shipping. + /// + [JsonProperty("address_source")] + public string AddressSource { get; set; } + + /// + /// The customer's IP address (IPv4 or IPv6). + /// + [JsonProperty("ip_address")] + public string IpAddress { get; set; } + + /// + /// The customer's tax IDs. + /// + [JsonProperty("tax_ids")] + public List TaxIds { get; set; } + + /// + /// When reverse_charge is provided, the reverse charge rule is applied for taxation. + /// When customer_exempt is sent, it treats the customer as tax exempt. Defaults to + /// none. + /// One of: customer_exempt, none, or reverse_charge. + /// + [JsonProperty("taxability_override")] + public string TaxabilityOverride { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsTaxIdOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsTaxIdOptions.cs new file mode 100644 index 0000000000..9e50736bbf --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsTaxIdOptions.cs @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationCustomerDetailsTaxIdOptions : INestedOptions + { + /// + /// Type of the tax ID, one of ae_trn, au_abn, au_arn, bg_uic, + /// br_cnpj, br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, + /// ca_pst_mb, ca_pst_sk, ca_qst, ch_vat, cl_tin, + /// eg_tin, es_cif, eu_oss_vat, eu_vat, gb_vat, + /// ge_vat, hk_br, hu_tin, id_npwp, il_vat, + /// in_gst, is_vat, jp_cn, jp_rn, jp_trn, ke_pin, + /// kr_brn, li_uid, mx_rfc, my_frp, my_itn, + /// my_sst, no_vat, nz_gst, ph_tin, ru_inn, + /// ru_kpp, sa_vat, sg_gst, sg_uen, si_tin, + /// th_vat, tr_tin, tw_vat, ua_vat, us_ein, or + /// za_vat. + /// One of: ae_trn, au_abn, au_arn, bg_uic, br_cnpj, + /// br_cpf, ca_bn, ca_gst_hst, ca_pst_bc, ca_pst_mb, + /// ca_pst_sk, ca_qst, ch_vat, cl_tin, eg_tin, + /// es_cif, eu_oss_vat, eu_vat, gb_vat, ge_vat, + /// hk_br, hu_tin, id_npwp, il_vat, in_gst, + /// is_vat, jp_cn, jp_rn, jp_trn, ke_pin, kr_brn, + /// li_uid, mx_rfc, my_frp, my_itn, my_sst, + /// no_vat, nz_gst, ph_tin, ru_inn, ru_kpp, + /// sa_vat, sg_gst, sg_uen, si_tin, th_vat, + /// tr_tin, tw_vat, ua_vat, us_ein, or za_vat. + /// + [JsonProperty("type")] + public string Type { get; set; } + + /// + /// Value of the tax ID. + /// + [JsonProperty("value")] + public string Value { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs new file mode 100644 index 0000000000..4a5ce1cc9b --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationLineItemOptions : INestedOptions + { + /// + /// A positive integer in cents representing the line item's total price. If + /// tax_behavior=inclusive, then this amount includes taxes. Otherwise, taxes are + /// calculated on top of this amount. + /// + [JsonProperty("amount")] + public long? Amount { get; set; } + + /// + /// If provided, the product's tax_code will be used as the line item's + /// tax_code. + /// + [JsonProperty("product")] + public string Product { get; set; } + + /// + /// The number of units of the item being purchased. The amount is a total amount for + /// the whole line. Used to calculate the per-unit price, when required. + /// + [JsonProperty("quantity")] + public long? Quantity { get; set; } + + /// + /// A custom identifier for this line item. Must be unique across the line items in the + /// calculation. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, + /// then the amount includes taxes. + /// One of: exclusive, or inclusive. + /// + [JsonProperty("tax_behavior")] + public string TaxBehavior { get; set; } + + /// + /// A tax code ID to use for this + /// line item. If not provided, we will use the tax code from the provided product + /// param. If neither tax_code or product is provided, we will use the default + /// tax code from your Tax Settings. + /// + [JsonProperty("tax_code")] + public string TaxCode { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationListLineItemsOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationListLineItemsOptions.cs new file mode 100644 index 0000000000..5adf96ca8b --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationListLineItemsOptions.cs @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + public class CalculationListLineItemsOptions : ListOptions + { + } +} diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationService.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationService.cs new file mode 100644 index 0000000000..e3b4eb1a89 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationService.cs @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public class CalculationService : Service, + ICreatable + { + public CalculationService() + : base(null) + { + } + + public CalculationService(IStripeClient client) + : base(client) + { + } + + public override string BasePath => "/v1/tax/calculations"; + + public virtual Calculation Create(CalculationCreateOptions options, RequestOptions requestOptions = null) + { + return this.CreateEntity(options, requestOptions); + } + + public virtual Task CreateAsync(CalculationCreateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.CreateEntityAsync(options, requestOptions, cancellationToken); + } + + public virtual StripeList ListLineItems(string id, CalculationListLineItemsOptions options = null, RequestOptions requestOptions = null) + { + return this.Request>(HttpMethod.Get, $"{this.InstanceUrl(id)}/line_items", options, requestOptions); + } + + public virtual Task> ListLineItemsAsync(string id, CalculationListLineItemsOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.RequestAsync>(HttpMethod.Get, $"{this.InstanceUrl(id)}/line_items", options, requestOptions, cancellationToken); + } + + public virtual IEnumerable ListLineItemsAutoPaging(string id, CalculationListLineItemsOptions options = null, RequestOptions requestOptions = null) + { + return this.ListRequestAutoPaging($"{this.InstanceUrl(id)}/line_items", options, requestOptions); + } + + public virtual IAsyncEnumerable ListLineItemsAutoPagingAsync(string id, CalculationListLineItemsOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.ListRequestAutoPagingAsync($"{this.InstanceUrl(id)}/line_items", options, requestOptions, cancellationToken); + } + } +} diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs new file mode 100644 index 0000000000..c30961fd81 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationShippingCostOptions : INestedOptions + { + /// + /// A positive integer in cents representing the shipping charge. If + /// tax_behavior=inclusive, then this amount includes taxes. Otherwise, taxes are + /// calculated on top of this amount. + /// + [JsonProperty("amount")] + public long? Amount { get; set; } + + /// + /// If provided, the shipping rate's amount, tax_code and tax_behavior + /// are used. It cannot be used with amount, tax_code and tax_behavior. + /// + [JsonProperty("shipping_rate")] + public string ShippingRate { get; set; } + + /// + /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, + /// then the amount includes taxes. Defaults to exclusive. + /// One of: exclusive, or inclusive. + /// + [JsonProperty("tax_behavior")] + public string TaxBehavior { get; set; } + + /// + /// The tax code used to calculate + /// tax on shipping. If not provided, the default shipping tax code from your Tax Settings is used. + /// + [JsonProperty("tax_code")] + public string TaxCode { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs new file mode 100644 index 0000000000..6fef57cbb5 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class TransactionCreateFromCalculationOptions : BaseOptions, IHasMetadata + { + /// + /// Tax Calculation ID to be used as input when creating the transaction. + /// + [JsonProperty("calculation")] + public string Calculation { 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. Individual keys can be unset by posting an empty value to + /// them. All keys can be unset by posting an empty value to metadata. + /// + [JsonProperty("metadata")] + public Dictionary Metadata { get; set; } + + /// + /// A custom order or sale identifier, such as 'myOrder_123'. Must be unique across all + /// transactions including reversals. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateOptions.cs new file mode 100644 index 0000000000..24943fadea --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateOptions.cs @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class TransactionCreateOptions : BaseOptions, IHasMetadata + { + /// + /// Tax Calculation ID to be used as input when creating the transaction. + /// + [JsonProperty("from_calculation")] + public string FromCalculation { 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. Individual keys can be unset by posting an empty value to + /// them. All keys can be unset by posting an empty value to metadata. + /// + [JsonProperty("metadata")] + public Dictionary Metadata { get; set; } + + /// + /// A custom order or sale identifier, such as 'myOrder_123'. Must be unique across all + /// transactions including reversals. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs new file mode 100644 index 0000000000..8e4933b8a2 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class TransactionCreateReversalOptions : BaseOptions, IHasMetadata + { + /// + /// The line item amounts to reverse. + /// + [JsonProperty("line_items")] + public List LineItems { 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. Individual keys can be unset by posting an empty value to + /// them. All keys can be unset by posting an empty value to metadata. + /// + [JsonProperty("metadata")] + public Dictionary Metadata { get; set; } + + /// + /// If partial, the provided line item or shipping cost amounts are reversed. If + /// full, the original transaction is fully reversed. + /// One of: full, or partial. + /// + [JsonProperty("mode")] + public string Mode { get; set; } + + /// + /// The ID of the Transaction to partially or fully reverse. + /// + [JsonProperty("original_transaction")] + public string OriginalTransaction { get; set; } + + /// + /// A custom identifier for this reversal, such as 'myOrder_123-refund_1'. Must be unique + /// across all transactions. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// The shipping cost to reverse. + /// + [JsonProperty("shipping_cost")] + public TransactionShippingCostOptions ShippingCost { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionGetOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionGetOptions.cs new file mode 100644 index 0000000000..cc536040d3 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionGetOptions.cs @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + public class TransactionGetOptions : BaseOptions + { + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs new file mode 100644 index 0000000000..ebdce27ee6 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class TransactionLineItemOptions : INestedOptions, IHasMetadata + { + /// + /// The amount to reverse, in negative integer cents. + /// + [JsonProperty("amount")] + public long? Amount { get; set; } + + /// + /// The amount of tax to reverse, in negative integer cents. + /// + [JsonProperty("amount_tax")] + public long? AmountTax { 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")] + public Dictionary Metadata { get; set; } + + /// + /// The id of the line item to reverse in the original transaction. + /// + [JsonProperty("original_line_item")] + public string OriginalLineItem { get; set; } + + /// + /// The quantity reversed. + /// + [JsonProperty("quantity")] + public long? Quantity { get; set; } + + /// + /// A custom identifier for this line item in the reversal transaction, such as 'L1-refund'. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionListLineItemsOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionListLineItemsOptions.cs new file mode 100644 index 0000000000..ce2fe3a0fb --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionListLineItemsOptions.cs @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + public class TransactionListLineItemsOptions : ListOptions + { + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionService.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionService.cs new file mode 100644 index 0000000000..d87f137014 --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionService.cs @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public class TransactionService : Service, + ICreatable, + IRetrievable + { + public TransactionService() + : base(null) + { + } + + public TransactionService(IStripeClient client) + : base(client) + { + } + + public override string BasePath => "/v1/tax/transactions"; + + public virtual Transaction Create(TransactionCreateOptions options, RequestOptions requestOptions = null) + { + return this.CreateEntity(options, requestOptions); + } + + public virtual Task CreateAsync(TransactionCreateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.CreateEntityAsync(options, requestOptions, cancellationToken); + } + + public virtual Transaction CreateFromCalculation(TransactionCreateFromCalculationOptions options = null, RequestOptions requestOptions = null) + { + return this.Request(HttpMethod.Post, $"{this.InstanceUrl("create_from_calculation")}", options, requestOptions); + } + + public virtual Task CreateFromCalculationAsync(TransactionCreateFromCalculationOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.RequestAsync(HttpMethod.Post, $"{this.InstanceUrl("create_from_calculation")}", options, requestOptions, cancellationToken); + } + + public virtual Transaction CreateReversal(TransactionCreateReversalOptions options = null, RequestOptions requestOptions = null) + { + return this.Request(HttpMethod.Post, $"{this.InstanceUrl("create_reversal")}", options, requestOptions); + } + + public virtual Task CreateReversalAsync(TransactionCreateReversalOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.RequestAsync(HttpMethod.Post, $"{this.InstanceUrl("create_reversal")}", options, requestOptions, cancellationToken); + } + + public virtual Transaction Get(string id, TransactionGetOptions options = null, RequestOptions requestOptions = null) + { + return this.GetEntity(id, options, requestOptions); + } + + public virtual Task GetAsync(string id, TransactionGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.GetEntityAsync(id, options, requestOptions, cancellationToken); + } + + public virtual StripeList ListLineItems(string id, TransactionListLineItemsOptions options = null, RequestOptions requestOptions = null) + { + return this.Request>(HttpMethod.Get, $"{this.InstanceUrl(id)}/line_items", options, requestOptions); + } + + public virtual Task> ListLineItemsAsync(string id, TransactionListLineItemsOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.RequestAsync>(HttpMethod.Get, $"{this.InstanceUrl(id)}/line_items", options, requestOptions, cancellationToken); + } + + public virtual IEnumerable ListLineItemsAutoPaging(string id, TransactionListLineItemsOptions options = null, RequestOptions requestOptions = null) + { + return this.ListRequestAutoPaging($"{this.InstanceUrl(id)}/line_items", options, requestOptions); + } + + public virtual IAsyncEnumerable ListLineItemsAutoPagingAsync(string id, TransactionListLineItemsOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) + { + return this.ListRequestAutoPagingAsync($"{this.InstanceUrl(id)}/line_items", options, requestOptions, cancellationToken); + } + } +} diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionShippingCostOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionShippingCostOptions.cs new file mode 100644 index 0000000000..81e5e9c68b --- /dev/null +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionShippingCostOptions.cs @@ -0,0 +1,20 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class TransactionShippingCostOptions : INestedOptions + { + /// + /// The amount to reverse, in negative integer cents. + /// + [JsonProperty("amount")] + public long? Amount { get; set; } + + /// + /// The amount of tax to reverse, in negative integer cents. + /// + [JsonProperty("amount_tax")] + public long? AmountTax { get; set; } + } +} From 9730e90d24dfc6b0717fa22cb624fbd87000c12b Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 18:12:35 +0000 Subject: [PATCH 4/7] Update generated code for v276 --- OPENAPI_VERSION | 2 +- .../Entities/Tax/Calculations/Calculation.cs | 3 +-- .../Calculations/CalculationCustomerDetails.cs | 4 ++-- .../Entities/Tax/Transactions/Transaction.cs | 2 +- .../Transactions/TransactionCustomerDetails.cs | 4 ++-- .../Calculations/CalculationCreateOptions.cs | 3 ++- .../CalculationCustomerDetailsOptions.cs | 9 +++++---- .../Calculations/CalculationLineItemOptions.cs | 17 +++++++++-------- .../CalculationShippingCostOptions.cs | 6 ++++-- .../TransactionCreateFromCalculationOptions.cs | 2 +- .../TransactionCreateReversalOptions.cs | 5 +++-- .../Transactions/TransactionLineItemOptions.cs | 3 ++- 12 files changed, 33 insertions(+), 27 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index a03ad49b62..bf758c50ae 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v275 \ No newline at end of file +v276 \ No newline at end of file diff --git a/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs b/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs index e2296429a1..766d1c17dc 100644 --- a/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs +++ b/src/Stripe.net/Entities/Tax/Calculations/Calculation.cs @@ -48,8 +48,7 @@ public class Calculation : StripeEntity, IHasId, IHasObject public CalculationCustomerDetails CustomerDetails { get; set; } /// - /// Timestamp of date at which the tax calculation will expire. Empty if the calculation is - /// an unsaved preview. + /// Timestamp of date at which the tax calculation will expire. /// [JsonProperty("expires_at")] [JsonConverter(typeof(UnixDateTimeConverter))] diff --git a/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs index 1e6454b883..180f52cff0 100644 --- a/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs +++ b/src/Stripe.net/Entities/Tax/Calculations/CalculationCustomerDetails.cs @@ -7,7 +7,7 @@ namespace Stripe.Tax public class CalculationCustomerDetails : StripeEntity { /// - /// The customer's postal address (e.g., home or business location). + /// The customer's postal address (for example, home or business location). /// [JsonProperty("address")] public CalculationCustomerDetailsAddress Address { get; set; } @@ -26,7 +26,7 @@ public class CalculationCustomerDetails : StripeEntity - /// The customer's tax IDs (e.g., EU VAT numbers). + /// The customer's tax IDs (for example, EU VAT numbers). /// [JsonProperty("tax_ids")] public List TaxIds { get; set; } diff --git a/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs b/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs index 2d910f69f8..fe975aca4b 100644 --- a/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs +++ b/src/Stripe.net/Entities/Tax/Transactions/Transaction.cs @@ -7,7 +7,7 @@ namespace Stripe.Tax using Stripe.Infrastructure; /// - /// A Tax Transaction records the tax collected from or refunded to your customer. + /// A Tax transaction records the tax collected from or refunded to your customer. /// public class Transaction : StripeEntity, IHasId, IHasMetadata, IHasObject { diff --git a/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs index 9ef7eb3205..e54a95c031 100644 --- a/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs +++ b/src/Stripe.net/Entities/Tax/Transactions/TransactionCustomerDetails.cs @@ -7,7 +7,7 @@ namespace Stripe.Tax public class TransactionCustomerDetails : StripeEntity { /// - /// The customer's postal address (e.g., home or business location). + /// The customer's postal address (for example, home or business location). /// [JsonProperty("address")] public TransactionCustomerDetailsAddress Address { get; set; } @@ -26,7 +26,7 @@ public class TransactionCustomerDetails : StripeEntity - /// The customer's tax IDs (e.g., EU VAT numbers). + /// The customer's tax IDs (for example, EU VAT numbers). /// [JsonProperty("tax_ids")] public List TaxIds { get; set; } diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs index f6022cd8f6..3c14f6cc2c 100644 --- a/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationCreateOptions.cs @@ -41,7 +41,8 @@ public class CalculationCreateOptions : BaseOptions /// /// Timestamp of date at which the tax rules and rates in effect applies for the - /// calculation. Measured in seconds since the Unix epoch. + /// calculation. Measured in seconds since the Unix epoch. Can be up to 48 hours in the + /// past, and up to 48 hours in the future. /// [JsonProperty("tax_date")] public long? TaxDate { get; set; } diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs index 4381043805..d433c2b573 100644 --- a/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationCustomerDetailsOptions.cs @@ -7,7 +7,7 @@ namespace Stripe.Tax public class CalculationCustomerDetailsOptions : INestedOptions { /// - /// The customer's postal address (e.g., home or business location). + /// The customer's postal address (for example, home or business location). /// [JsonProperty("address")] public AddressOptions Address { get; set; } @@ -32,9 +32,10 @@ public class CalculationCustomerDetailsOptions : INestedOptions public List TaxIds { get; set; } /// - /// When reverse_charge is provided, the reverse charge rule is applied for taxation. - /// When customer_exempt is sent, it treats the customer as tax exempt. Defaults to - /// none. + /// Overrides the tax calculation result to allow you to not collect tax from your customer. + /// Use this if you've manually checked your customer's tax exemptions. Prefer providing the + /// customer's tax_ids where possible, which automatically determines whether + /// reverse_charge applies. /// One of: customer_exempt, none, or reverse_charge. /// [JsonProperty("taxability_override")] diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs index 4a5ce1cc9b..100ca21dd6 100644 --- a/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationLineItemOptions.cs @@ -21,22 +21,23 @@ public class CalculationLineItemOptions : INestedOptions public string Product { get; set; } /// - /// The number of units of the item being purchased. The amount is a total amount for - /// the whole line. Used to calculate the per-unit price, when required. + /// The number of units of the item being purchased. Used to calculate the per-unit price + /// from the total amount for the line. For example, if amount=100 and + /// quantity=4, the calculated unit price is 25. /// [JsonProperty("quantity")] public long? Quantity { get; set; } /// - /// A custom identifier for this line item. Must be unique across the line items in the - /// calculation. + /// A custom identifier for this line item, which must be unique across the line items in + /// the calculation. The reference helps identify each line item in exported tax reports. /// [JsonProperty("reference")] public string Reference { get; set; } /// - /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, - /// then the amount includes taxes. + /// Specifies whether the amount includes taxes. Defaults to exclusive. /// One of: exclusive, or inclusive. /// [JsonProperty("tax_behavior")] @@ -45,8 +46,8 @@ public class CalculationLineItemOptions : INestedOptions /// /// A tax code ID to use for this /// line item. If not provided, we will use the tax code from the provided product - /// param. If neither tax_code or product is provided, we will use the default - /// tax code from your Tax Settings. + /// param. If neither tax_code nor product is provided, we will use the + /// default tax code from your Tax Settings. /// [JsonProperty("tax_code")] public string TaxCode { get; set; } diff --git a/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs b/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs index c30961fd81..0d3f01488a 100644 --- a/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs +++ b/src/Stripe.net/Services/Tax/Calculations/CalculationShippingCostOptions.cs @@ -14,8 +14,10 @@ public class CalculationShippingCostOptions : INestedOptions public long? Amount { get; set; } /// - /// If provided, the shipping rate's amount, tax_code and tax_behavior - /// are used. It cannot be used with amount, tax_code and tax_behavior. + /// If provided, the shipping + /// rate's amount, tax_code and tax_behavior are used. If you + /// provide a shipping rate, then you cannot pass the amount, tax_code, or + /// tax_behavior parameters. /// [JsonProperty("shipping_rate")] public string ShippingRate { get; set; } diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs index 6fef57cbb5..0855acd92a 100644 --- a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateFromCalculationOptions.cs @@ -23,7 +23,7 @@ public class TransactionCreateFromCalculationOptions : BaseOptions, IHasMetadata /// /// A custom order or sale identifier, such as 'myOrder_123'. Must be unique across all - /// transactions including reversals. + /// transactions, including reversals. /// [JsonProperty("reference")] public string Reference { get; set; } diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs index 8e4933b8a2..fc5e9eabe0 100644 --- a/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionCreateReversalOptions.cs @@ -36,8 +36,9 @@ public class TransactionCreateReversalOptions : BaseOptions, IHasMetadata public string OriginalTransaction { get; set; } /// - /// A custom identifier for this reversal, such as 'myOrder_123-refund_1'. Must be unique - /// across all transactions. + /// A custom identifier for this reversal, such as 'myOrder_123-refund_1', which must be + /// unique across all transactions. The reference helps identify this reversal transaction + /// in exported tax reports. /// [JsonProperty("reference")] public string Reference { get; set; } diff --git a/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs b/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs index ebdce27ee6..9254b3344c 100644 --- a/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs +++ b/src/Stripe.net/Services/Tax/Transactions/TransactionLineItemOptions.cs @@ -33,7 +33,8 @@ public class TransactionLineItemOptions : INestedOptions, IHasMetadata public string OriginalLineItem { get; set; } /// - /// The quantity reversed. + /// The quantity reversed. Appears in tax + /// exports, but does not affect the amount of tax reversed. /// [JsonProperty("quantity")] public long? Quantity { get; set; } From 165a6942931bd0ebcda8263535995d9295291303 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 18:21:54 +0000 Subject: [PATCH 5/7] Update generated code for v276 --- .../CalculationLineItem.cs | 81 +++++++++++++++++ .../CalculationLineItemTaxBreakdown.cs | 50 +++++++++++ ...ulationLineItemTaxBreakdownJurisdiction.cs | 35 ++++++++ ...ationLineItemTaxBreakdownTaxRateDetails.cs | 29 ++++++ .../TransactionLineItem.cs | 90 +++++++++++++++++++ .../TransactionLineItemReversal.cs | 14 +++ .../Public/StripeTypeRegistry.cs | 6 ++ 7 files changed, 305 insertions(+) create mode 100644 src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItem.cs create mode 100644 src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdown.cs create mode 100644 src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownJurisdiction.cs create mode 100644 src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownTaxRateDetails.cs create mode 100644 src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItem.cs create mode 100644 src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItemReversal.cs diff --git a/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItem.cs b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItem.cs new file mode 100644 index 0000000000..f8202f72d2 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItem.cs @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class CalculationLineItem : StripeEntity, IHasId, 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; } + + /// + /// The line item amount in integer cents. If tax_behavior=inclusive, then this + /// amount includes taxes. Otherwise, taxes were calculated on top of this amount. + /// + [JsonProperty("amount")] + public long Amount { get; set; } + + /// + /// The amount of tax calculated for this line item, in integer cents. + /// + [JsonProperty("amount_tax")] + public long AmountTax { 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 Product ID. + /// + [JsonProperty("product")] + public string Product { get; set; } + + /// + /// The number of units of the item being purchased. For reversals, this is the quantity + /// reversed. + /// + [JsonProperty("quantity")] + public long Quantity { get; set; } + + /// + /// A custom identifier for this line item. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, + /// then the amount includes taxes. + /// One of: exclusive, or inclusive. + /// + [JsonProperty("tax_behavior")] + public string TaxBehavior { get; set; } + + /// + /// Detailed account of taxes relevant to this line item. + /// + [JsonProperty("tax_breakdown")] + public List TaxBreakdown { get; set; } + + /// + /// The tax code ID used for this + /// resource. + /// + [JsonProperty("tax_code")] + public string TaxCode { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdown.cs b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdown.cs new file mode 100644 index 0000000000..c29135eca7 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdown.cs @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationLineItemTaxBreakdown : StripeEntity + { + /// + /// The amount of tax, in integer cents. + /// + [JsonProperty("amount")] + public long Amount { get; set; } + + [JsonProperty("jurisdiction")] + public CalculationLineItemTaxBreakdownJurisdiction Jurisdiction { get; set; } + + /// + /// Indicates whether the jurisdiction was determined by the origin (merchant's address) or + /// destination (customer's address). + /// One of: destination, or origin. + /// + [JsonProperty("sourcing")] + public string Sourcing { get; set; } + + /// + /// Details regarding the rate for this tax. This field will be null when the tax is + /// not imposed, for example if the product is exempt from tax. + /// + [JsonProperty("tax_rate_details")] + public CalculationLineItemTaxBreakdownTaxRateDetails TaxRateDetails { get; set; } + + /// + /// The reasoning behind this tax, for example, if the product is tax exempt. The possible + /// values for this field may be extended as new tax rules are supported. + /// One of: customer_exempt, not_collecting, not_subject_to_tax, + /// not_supported, portion_product_exempt, portion_reduced_rated, + /// portion_standard_rated, product_exempt, product_exempt_holiday, + /// proportionally_rated, reduced_rated, reverse_charge, + /// standard_rated, taxable_basis_reduced, or zero_rated. + /// + [JsonProperty("taxability_reason")] + public string TaxabilityReason { get; set; } + + /// + /// The amount on which tax is calculated, in integer cents. + /// + [JsonProperty("taxable_amount")] + public long TaxableAmount { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownJurisdiction.cs b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownJurisdiction.cs new file mode 100644 index 0000000000..6f1acc4312 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownJurisdiction.cs @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationLineItemTaxBreakdownJurisdiction : StripeEntity + { + /// + /// Two-letter country code (ISO + /// 3166-1 alpha-2). + /// + [JsonProperty("country")] + public string Country { get; set; } + + /// + /// A human-readable name for the jurisdiction imposing the tax. + /// + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + /// + /// Indicates the level of the jurisdiction imposing the tax. + /// One of: city, country, county, district, or state. + /// + [JsonProperty("level")] + public string Level { get; set; } + + /// + /// ISO 3166-2 subdivision code, + /// without country prefix. For example, "NY" for New York, United States. + /// + [JsonProperty("state")] + public string State { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownTaxRateDetails.cs b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownTaxRateDetails.cs new file mode 100644 index 0000000000..58c7e333ef --- /dev/null +++ b/src/Stripe.net/Entities/Tax/CalculationLineItems/CalculationLineItemTaxBreakdownTaxRateDetails.cs @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class CalculationLineItemTaxBreakdownTaxRateDetails : StripeEntity + { + /// + /// A localized display name for tax type, intended to be human-readable. For example, + /// "Local Sales and Use Tax", "Value-added tax (VAT)", or "Umsatzsteuer (USt.)". + /// + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + /// + /// The tax rate percentage as a string. For example, 8.5% is represented as "8.5". + /// + [JsonProperty("percentage_decimal")] + public string PercentageDecimal { get; set; } + + /// + /// The tax type, such as vat or sales_tax. + /// One of: gst, hst, igst, jct, lease_tax, pst, + /// qst, rst, sales_tax, or vat. + /// + [JsonProperty("tax_type")] + public string TaxType { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItem.cs b/src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItem.cs new file mode 100644 index 0000000000..159d9e6888 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItem.cs @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using System.Collections.Generic; + using Newtonsoft.Json; + + public class TransactionLineItem : 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; } + + /// + /// The line item amount in integer cents. If tax_behavior=inclusive, then this + /// amount includes taxes. Otherwise, taxes were calculated on top of this amount. + /// + [JsonProperty("amount")] + public long Amount { get; set; } + + /// + /// The amount of tax calculated for this line item, in integer cents. + /// + [JsonProperty("amount_tax")] + public long AmountTax { 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; } + + /// + /// 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")] + public Dictionary Metadata { get; set; } + + /// + /// The number of units of the item being purchased. For reversals, this is the quantity + /// reversed. + /// + [JsonProperty("quantity")] + public long Quantity { get; set; } + + /// + /// A custom identifier for this line item in the transaction. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// If type=reversal, contains information about what was reversed. + /// + [JsonProperty("reversal")] + public TransactionLineItemReversal Reversal { get; set; } + + /// + /// Specifies whether the amount includes taxes. If tax_behavior=inclusive, + /// then the amount includes taxes. + /// One of: exclusive, or inclusive. + /// + [JsonProperty("tax_behavior")] + public string TaxBehavior { get; set; } + + /// + /// The tax code ID used for this + /// resource. + /// + [JsonProperty("tax_code")] + public string TaxCode { get; set; } + + /// + /// If reversal, this line item reverses an earlier transaction. + /// One of: reversal, or transaction. + /// + [JsonProperty("type")] + public string Type { get; set; } + } +} diff --git a/src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItemReversal.cs b/src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItemReversal.cs new file mode 100644 index 0000000000..4437326776 --- /dev/null +++ b/src/Stripe.net/Entities/Tax/TransactionLineItems/TransactionLineItemReversal.cs @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec +namespace Stripe.Tax +{ + using Newtonsoft.Json; + + public class TransactionLineItemReversal : StripeEntity + { + /// + /// The id of the line item to reverse in the original transaction. + /// + [JsonProperty("original_line_item")] + public string OriginalLineItem { get; set; } + } +} diff --git a/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs b/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs index 35d9679f53..7650d1a694 100644 --- a/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs +++ b/src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs @@ -123,7 +123,13 @@ public static class StripeTypeRegistry { "subscription_item", typeof(SubscriptionItem) }, { "subscription_schedule", typeof(SubscriptionSchedule) }, { "tax.calculation", typeof(Tax.Calculation) }, + { + "tax.calculation_line_item", typeof(Tax.CalculationLineItem) + }, { "tax.transaction", typeof(Tax.Transaction) }, + { + "tax.transaction_line_item", typeof(Tax.TransactionLineItem) + }, { "tax_code", typeof(TaxCode) }, { "tax_id", typeof(TaxId) }, { "tax_rate", typeof(TaxRate) }, From a9f95ed2414d7c8b983375f0c1402ed833edc020 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 20:10:47 +0000 Subject: [PATCH 6/7] Update generated code for v277 --- OPENAPI_VERSION | 2 +- src/Stripe.net/Entities/Disputes/DisputeEvidenceDetails.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index bf758c50ae..ccddf65421 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v276 \ No newline at end of file +v277 \ No newline at end of file diff --git a/src/Stripe.net/Entities/Disputes/DisputeEvidenceDetails.cs b/src/Stripe.net/Entities/Disputes/DisputeEvidenceDetails.cs index ca65ed0d74..207b8ccc85 100644 --- a/src/Stripe.net/Entities/Disputes/DisputeEvidenceDetails.cs +++ b/src/Stripe.net/Entities/Disputes/DisputeEvidenceDetails.cs @@ -9,7 +9,7 @@ public class DisputeEvidenceDetails : StripeEntity { /// /// Date by which evidence must be submitted in order to successfully challenge dispute. - /// Will be null if the customer's bank or credit card company doesn't allow a response for + /// Will be 0 if the customer's bank or credit card company doesn't allow a response for /// this particular dispute. /// [JsonProperty("due_by")] From 94f6ad2f22c928ae09e321f27b3e7c3a79cb5700 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 20:21:40 +0000 Subject: [PATCH 7/7] Update generated code for v277 --- .../Services/GeneratedExamplesTest.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/StripeTests/Services/GeneratedExamplesTest.cs b/src/StripeTests/Services/GeneratedExamplesTest.cs index 1ef383eef3..9b72386091 100644 --- a/src/StripeTests/Services/GeneratedExamplesTest.cs +++ b/src/StripeTests/Services/GeneratedExamplesTest.cs @@ -2887,6 +2887,13 @@ public void TestSubscriptionServiceUpdate() service.Update("sub_xxxxxxxxxxxxx", options); } + [Fact] + public void TestTaxCalculationServiceListLineItems() + { + var service = new Stripe.Tax.CalculationService(this.StripeClient); + service.ListLineItems("xxx"); + } + [Fact] public void TestTaxCodeServiceList() { @@ -2976,6 +2983,18 @@ public void TestTaxRateServiceUpdate() service.Update("txr_xxxxxxxxxxxxx", options); } + [Fact] + public void TestTaxTransactionServiceCreateFromCalculation() + { + var options = new Stripe.Tax.TransactionCreateFromCalculationOptions + { + Calculation = "xxx", + Reference = "yyy", + }; + var service = new Stripe.Tax.TransactionService(this.StripeClient); + service.CreateFromCalculation(options); + } + [Fact] public void TestTerminalConfigurationServiceCreate() {