From 857f035a5cb187ee3ad2404453d852ecfe07d360 Mon Sep 17 00:00:00 2001 From: arlyon Date: Fri, 28 Apr 2023 00:25:19 +0000 Subject: [PATCH 1/2] Generate latest changes from OpenApi spec --- openapi/version.json | 2 +- src/resources/generated/charge.rs | 16 +- src/resources/generated/checkout_session.rs | 46 +++ .../issuing_authorization_merchant_data.rs | 3 + src/resources/generated/line_item.rs | 10 +- .../payment_method_details_card_checks.rs | 19 ++ src/resources/generated/setup_attempt.rs | 7 +- src/resources/generated/tax_calculation.rs | 311 ++++++++++++++++- .../tax_product_resource_shipping_cost.rs | 65 ---- src/resources/generated/tax_rate.rs | 4 +- src/resources/generated/tax_transaction.rs | 315 +++++++++++++++++- 11 files changed, 707 insertions(+), 91 deletions(-) create mode 100644 src/resources/generated/payment_method_details_card_checks.rs delete mode 100644 src/resources/generated/tax_product_resource_shipping_cost.rs diff --git a/openapi/version.json b/openapi/version.json index 69e796f85..af8db4260 100644 --- a/openapi/version.json +++ b/openapi/version.json @@ -1,3 +1,3 @@ { - "version": "v301" + "version": "v318" } \ No newline at end of file diff --git a/src/resources/generated/charge.rs b/src/resources/generated/charge.rs index 5d2c6314c..db92d8f90 100644 --- a/src/resources/generated/charge.rs +++ b/src/resources/generated/charge.rs @@ -10,8 +10,8 @@ use crate::params::{Expand, Expandable, List, Metadata, Object, Paginable, Range use crate::resources::{ Account, Address, Application, ApplicationFee, BalanceTransaction, BillingDetails, ChargeSourceParams, Currency, Customer, Dispute, Invoice, Mandate, PaymentIntent, - PaymentMethod, PaymentMethodDetailsCardInstallmentsPlan, PaymentSource, RadarRadarOptions, - Refund, Review, Shipping, ThreeDSecureDetails, Transfer, + PaymentMethod, PaymentMethodDetailsCardChecks, PaymentMethodDetailsCardInstallmentsPlan, + PaymentSource, RadarRadarOptions, Refund, Review, Shipping, ThreeDSecureDetails, Transfer, }; /// The resource representing a Stripe "Charge". @@ -740,18 +740,6 @@ pub struct PaymentMethodDetailsCard { pub wallet: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] -pub struct PaymentMethodDetailsCardChecks { - /// If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. - pub address_line1_check: Option, - - /// If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. - pub address_postal_code_check: Option, - - /// If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. - pub cvc_check: Option, -} - #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct PaymentMethodDetailsCardInstallments { /// Installment plan selected for the payment. diff --git a/src/resources/generated/checkout_session.rs b/src/resources/generated/checkout_session.rs index 9e5978f84..0d61d8a4b 100644 --- a/src/resources/generated/checkout_session.rs +++ b/src/resources/generated/checkout_session.rs @@ -1730,6 +1730,10 @@ pub struct CreateCheckoutSessionSubscriptionData { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + /// A future timestamp to anchor the subscription's billing cycle for new subscriptions. + #[serde(skip_serializing_if = "Option::is_none")] + pub billing_cycle_anchor: Option, + /// The ID of the coupon to apply to this subscription. /// /// A coupon applied to a subscription will only affect invoices created for that particular subscription. @@ -1761,6 +1765,12 @@ pub struct CreateCheckoutSessionSubscriptionData { #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option, + /// Determines how to handle prorations resulting from the `billing_cycle_anchor`. + /// + /// If no value is passed, the default is `create_prorations`. + #[serde(skip_serializing_if = "Option::is_none")] + pub proration_behavior: Option, + /// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option, @@ -6897,6 +6907,42 @@ impl std::default::Default for CreateCheckoutSessionShippingOptionsShippingRateD } } +/// An enum representing the possible values of an `CreateCheckoutSessionSubscriptionData`'s `proration_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateCheckoutSessionSubscriptionDataProrationBehavior { + CreateProrations, + None, +} + +impl CreateCheckoutSessionSubscriptionDataProrationBehavior { + pub fn as_str(self) -> &'static str { + match self { + CreateCheckoutSessionSubscriptionDataProrationBehavior::CreateProrations => { + "create_prorations" + } + CreateCheckoutSessionSubscriptionDataProrationBehavior::None => "none", + } + } +} + +impl AsRef for CreateCheckoutSessionSubscriptionDataProrationBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateCheckoutSessionSubscriptionDataProrationBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for CreateCheckoutSessionSubscriptionDataProrationBehavior { + fn default() -> Self { + Self::CreateProrations + } +} + /// An enum representing the possible values of an `CreateCheckoutSessionSubscriptionDataTrialSettingsEndBehavior`'s `missing_payment_method` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] diff --git a/src/resources/generated/issuing_authorization_merchant_data.rs b/src/resources/generated/issuing_authorization_merchant_data.rs index f90453992..6067fe8d5 100644 --- a/src/resources/generated/issuing_authorization_merchant_data.rs +++ b/src/resources/generated/issuing_authorization_merchant_data.rs @@ -35,4 +35,7 @@ pub struct MerchantData { /// State where the seller is located. pub state: Option, + + /// An ID assigned by the seller to the location of the sale. + pub terminal_id: Option, } diff --git a/src/resources/generated/line_item.rs b/src/resources/generated/line_item.rs index 1c22ccca0..0df653f7e 100644 --- a/src/resources/generated/line_item.rs +++ b/src/resources/generated/line_item.rs @@ -6,7 +6,9 @@ use serde::{Deserialize, Serialize}; use crate::ids::InvoiceLineItemId; use crate::params::{Expandable, Metadata, Object}; -use crate::resources::{Currency, Discount, Period, Plan, Price, TaxRate}; +use crate::resources::{ + Currency, Discount, InvoiceItem, Period, Plan, Price, Subscription, SubscriptionItem, TaxRate, +}; /// The resource representing a Stripe "InvoiceLineItem". #[derive(Clone, Debug, Default, Deserialize, Serialize)] @@ -46,7 +48,7 @@ pub struct InvoiceLineItem { /// The ID of the [invoice item](https://stripe.com/docs/api/invoiceitems) associated with this line item if any. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_item: Option, + pub invoice_item: Option>, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. pub livemode: bool, @@ -75,13 +77,13 @@ pub struct InvoiceLineItem { pub quantity: Option, /// The subscription that the invoice item pertains to, if any. - pub subscription: Option, + pub subscription: Option>, /// The subscription item that generated this line item. /// /// Left empty if the line item is not an explicit result of a subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_item: Option, + pub subscription_item: Option>, /// The amount of tax calculated per tax rate for this line item. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/resources/generated/payment_method_details_card_checks.rs b/src/resources/generated/payment_method_details_card_checks.rs new file mode 100644 index 000000000..0e07be6ee --- /dev/null +++ b/src/resources/generated/payment_method_details_card_checks.rs @@ -0,0 +1,19 @@ +// ====================================== +// This file was automatically generated. +// ====================================== + +use serde::{Deserialize, Serialize}; + +/// The resource representing a Stripe "payment_method_details_card_checks". +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct PaymentMethodDetailsCardChecks { + + /// If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + pub address_line1_check: Option, + + /// If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + pub address_postal_code_check: Option, + + /// If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. + pub cvc_check: Option, +} diff --git a/src/resources/generated/setup_attempt.rs b/src/resources/generated/setup_attempt.rs index 3889c9b92..4e4558b4d 100644 --- a/src/resources/generated/setup_attempt.rs +++ b/src/resources/generated/setup_attempt.rs @@ -8,8 +8,8 @@ use crate::client::{Client, Response}; use crate::ids::{SetupAttemptId, SetupIntentId}; use crate::params::{Expand, Expandable, List, Object, Paginable, RangeQuery, Timestamp}; use crate::resources::{ - Account, ApiErrors, Application, Customer, Mandate, PaymentMethod, SetupIntent, - ThreeDSecureDetails, + Account, ApiErrors, Application, Customer, Mandate, PaymentMethod, + PaymentMethodDetailsCardChecks, SetupIntent, ThreeDSecureDetails, }; /// The resource representing a Stripe "PaymentFlowsSetupIntentSetupAttempt". @@ -191,6 +191,9 @@ pub struct SetupAttemptPaymentMethodDetailsBoleto {} #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct SetupAttemptPaymentMethodDetailsCard { + /// Check results by Card networks on Card address and CVC at time of payment. + pub checks: Option, + /// Populated if this authorization used 3D Secure authentication. pub three_d_secure: Option, } diff --git a/src/resources/generated/tax_calculation.rs b/src/resources/generated/tax_calculation.rs index b649f4386..65aef7524 100644 --- a/src/resources/generated/tax_calculation.rs +++ b/src/resources/generated/tax_calculation.rs @@ -4,7 +4,7 @@ use crate::ids::{TaxCalculationId}; use crate::params::{List, Object, Timestamp}; -use crate::resources::{Currency, TaxCalculationLineItem, TaxProductResourceCustomerDetails, TaxProductResourceShippingCost}; +use crate::resources::{Currency, TaxCalculationLineItem, TaxProductResourceCustomerDetails}; use serde::{Deserialize, Serialize}; /// The resource representing a Stripe "TaxProductResourceTaxCalculation". @@ -38,7 +38,7 @@ pub struct TaxCalculation { pub livemode: bool, /// The shipping cost details for the calculation. - pub shipping_cost: Option, + pub shipping_cost: Option, /// The amount of tax to be collected on top of the line item prices. pub tax_amount_exclusive: i64, @@ -78,6 +78,95 @@ pub struct TaxProductResourceTaxBreakdown { pub taxable_amount: i64, } +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceTaxCalculationShippingCost { + + /// The shipping amount in integer cents. + /// + /// If `tax_behavior=inclusive`, then this amount includes taxes. + /// Otherwise, taxes were calculated on top of this amount. + pub amount: i64, + + /// The amount of tax calculated for shipping, in integer cents. + pub amount_tax: i64, + + /// The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping_rate: Option, + + /// Specifies whether the `amount` includes taxes. + /// + /// If `tax_behavior=inclusive`, then the amount includes taxes. + pub tax_behavior: TaxProductResourceTaxCalculationShippingCostTaxBehavior, + + /// Detailed account of taxes relevant to shipping cost. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_breakdown: Option>, + + /// The [tax code](https://stripe.com/docs/tax/tax-categories) ID used for shipping. + pub tax_code: String, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceLineItemTaxBreakdown { + + /// The amount of tax, in integer cents. + pub amount: i64, + + pub jurisdiction: TaxProductResourceJurisdiction, + + /// Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). + pub sourcing: TaxProductResourceLineItemTaxBreakdownSourcing, + + /// 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. + pub tax_rate_details: Option, + + /// 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. + pub taxability_reason: TaxProductResourceLineItemTaxBreakdownTaxabilityReason, + + /// The amount on which tax is calculated, in integer cents. + pub taxable_amount: i64, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceJurisdiction { + + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + pub country: String, + + /// A human-readable name for the jurisdiction imposing the tax. + pub display_name: String, + + /// Indicates the level of the jurisdiction imposing the tax. + pub level: TaxProductResourceJurisdictionLevel, + + /// [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. + /// + /// For example, "NY" for New York, United States. + pub state: Option, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceLineItemTaxRateDetails { + + /// 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.)". + pub display_name: String, + + /// The tax rate percentage as a string. + /// + /// For example, 8.5% is represented as "8.5". + pub percentage_decimal: String, + + /// The tax type, such as `vat` or `sales_tax`. + pub tax_type: TaxProductResourceLineItemTaxRateDetailsTaxType, +} + #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct TaxProductResourceTaxRateDetails { @@ -96,6 +185,224 @@ pub struct TaxProductResourceTaxRateDetails { pub tax_type: Option, } +/// An enum representing the possible values of an `TaxProductResourceJurisdiction`'s `level` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceJurisdictionLevel { + City, + Country, + County, + District, + State, +} + +impl TaxProductResourceJurisdictionLevel { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceJurisdictionLevel::City => "city", + TaxProductResourceJurisdictionLevel::Country => "country", + TaxProductResourceJurisdictionLevel::County => "county", + TaxProductResourceJurisdictionLevel::District => "district", + TaxProductResourceJurisdictionLevel::State => "state", + } + } +} + +impl AsRef for TaxProductResourceJurisdictionLevel { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceJurisdictionLevel { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceJurisdictionLevel { + fn default() -> Self { + Self::City + } +} + +/// An enum representing the possible values of an `TaxProductResourceLineItemTaxBreakdown`'s `sourcing` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceLineItemTaxBreakdownSourcing { + Destination, + Origin, +} + +impl TaxProductResourceLineItemTaxBreakdownSourcing { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceLineItemTaxBreakdownSourcing::Destination => "destination", + TaxProductResourceLineItemTaxBreakdownSourcing::Origin => "origin", + } + } +} + +impl AsRef for TaxProductResourceLineItemTaxBreakdownSourcing { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceLineItemTaxBreakdownSourcing { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceLineItemTaxBreakdownSourcing { + fn default() -> Self { + Self::Destination + } +} + +/// An enum representing the possible values of an `TaxProductResourceLineItemTaxBreakdown`'s `taxability_reason` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + CustomerExempt, + NotCollecting, + NotSubjectToTax, + NotSupported, + PortionProductExempt, + PortionReducedRated, + PortionStandardRated, + ProductExempt, + ProductExemptHoliday, + ProportionallyRated, + ReducedRated, + ReverseCharge, + StandardRated, + TaxableBasisReduced, + ZeroRated, +} + +impl TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::CustomerExempt => "customer_exempt", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::NotCollecting => "not_collecting", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::NotSubjectToTax => "not_subject_to_tax", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::NotSupported => "not_supported", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::PortionProductExempt => "portion_product_exempt", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::PortionReducedRated => "portion_reduced_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::PortionStandardRated => "portion_standard_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ProductExempt => "product_exempt", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ProductExemptHoliday => "product_exempt_holiday", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ProportionallyRated => "proportionally_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ReducedRated => "reduced_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ReverseCharge => "reverse_charge", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::StandardRated => "standard_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::TaxableBasisReduced => "taxable_basis_reduced", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ZeroRated => "zero_rated", + } + } +} + +impl AsRef for TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + fn default() -> Self { + Self::CustomerExempt + } +} + +/// An enum representing the possible values of an `TaxProductResourceLineItemTaxRateDetails`'s `tax_type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceLineItemTaxRateDetailsTaxType { + Gst, + Hst, + Igst, + Jct, + LeaseTax, + Pst, + Qst, + Rst, + SalesTax, + Vat, +} + +impl TaxProductResourceLineItemTaxRateDetailsTaxType { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceLineItemTaxRateDetailsTaxType::Gst => "gst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Hst => "hst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Igst => "igst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Jct => "jct", + TaxProductResourceLineItemTaxRateDetailsTaxType::LeaseTax => "lease_tax", + TaxProductResourceLineItemTaxRateDetailsTaxType::Pst => "pst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Qst => "qst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Rst => "rst", + TaxProductResourceLineItemTaxRateDetailsTaxType::SalesTax => "sales_tax", + TaxProductResourceLineItemTaxRateDetailsTaxType::Vat => "vat", + } + } +} + +impl AsRef for TaxProductResourceLineItemTaxRateDetailsTaxType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceLineItemTaxRateDetailsTaxType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceLineItemTaxRateDetailsTaxType { + fn default() -> Self { + Self::Gst + } +} + +/// An enum representing the possible values of an `TaxProductResourceTaxCalculationShippingCost`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceTaxCalculationShippingCostTaxBehavior { + Exclusive, + Inclusive, +} + +impl TaxProductResourceTaxCalculationShippingCostTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceTaxCalculationShippingCostTaxBehavior::Exclusive => "exclusive", + TaxProductResourceTaxCalculationShippingCostTaxBehavior::Inclusive => "inclusive", + } + } +} + +impl AsRef for TaxProductResourceTaxCalculationShippingCostTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceTaxCalculationShippingCostTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceTaxCalculationShippingCostTaxBehavior { + fn default() -> Self { + Self::Exclusive + } +} + /// An enum representing the possible values of an `TaxProductResourceTaxRateDetails`'s `tax_type` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] diff --git a/src/resources/generated/tax_product_resource_shipping_cost.rs b/src/resources/generated/tax_product_resource_shipping_cost.rs deleted file mode 100644 index 6d6702914..000000000 --- a/src/resources/generated/tax_product_resource_shipping_cost.rs +++ /dev/null @@ -1,65 +0,0 @@ -// ====================================== -// This file was automatically generated. -// ====================================== - -use serde::{Deserialize, Serialize}; - -/// The resource representing a Stripe "TaxProductResourceShippingCost". -#[derive(Clone, Debug, Default, Deserialize, Serialize)] -pub struct TaxProductResourceShippingCost { - - /// The shipping amount in integer cents. - /// - /// If `tax_behavior=inclusive`, then this amount includes taxes. - /// Otherwise, taxes were calculated on top of this amount. - pub amount: i64, - - /// The amount of tax calculated for shipping, in integer cents. - pub amount_tax: i64, - - /// The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate: Option, - - /// Specifies whether the `amount` includes taxes. - /// - /// If `tax_behavior=inclusive`, then the amount includes taxes. - pub tax_behavior: TaxProductResourceShippingCostTaxBehavior, - - /// The [tax code](https://stripe.com/docs/tax/tax-categories) ID used for shipping. - pub tax_code: String, -} - -/// An enum representing the possible values of an `TaxProductResourceShippingCost`'s `tax_behavior` field. -#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] -pub enum TaxProductResourceShippingCostTaxBehavior { - Exclusive, - Inclusive, -} - -impl TaxProductResourceShippingCostTaxBehavior { - pub fn as_str(self) -> &'static str { - match self { - TaxProductResourceShippingCostTaxBehavior::Exclusive => "exclusive", - TaxProductResourceShippingCostTaxBehavior::Inclusive => "inclusive", - } - } -} - -impl AsRef for TaxProductResourceShippingCostTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} - -impl std::fmt::Display for TaxProductResourceShippingCostTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - self.as_str().fmt(f) - } -} -impl std::default::Default for TaxProductResourceShippingCostTaxBehavior { - fn default() -> Self { - Self::Exclusive - } -} diff --git a/src/resources/generated/tax_rate.rs b/src/resources/generated/tax_rate.rs index 5a362c35f..165391242 100644 --- a/src/resources/generated/tax_rate.rs +++ b/src/resources/generated/tax_rate.rs @@ -54,7 +54,9 @@ pub struct TaxRate { /// This can be useful for storing additional information about the object in a structured format. pub metadata: Metadata, - /// This represents the tax rate percent out of 100. + /// Tax rate percentage out of 100. + /// + /// For tax calculations with automatic_tax[enabled]=true, this percentage includes the statutory tax rate of non-taxable jurisdictions. pub percentage: f64, /// [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. diff --git a/src/resources/generated/tax_transaction.rs b/src/resources/generated/tax_transaction.rs index d5cdf4d6c..e72ace371 100644 --- a/src/resources/generated/tax_transaction.rs +++ b/src/resources/generated/tax_transaction.rs @@ -4,7 +4,7 @@ use crate::ids::{TaxTransactionId}; use crate::params::{List, Metadata, Object, Timestamp}; -use crate::resources::{Currency, TaxProductResourceCustomerDetails, TaxProductResourceShippingCost, TaxTransactionLineItem}; +use crate::resources::{Currency, TaxProductResourceCustomerDetails, TaxTransactionLineItem}; use serde::{Deserialize, Serialize}; /// The resource representing a Stripe "TaxProductResourceTaxTransaction". @@ -48,7 +48,7 @@ pub struct TaxTransaction { pub reversal: Option, /// The shipping cost details for the transaction. - pub shipping_cost: Option, + pub shipping_cost: Option, /// Timestamp of date at which the tax rules and rates in effect applies for the calculation. pub tax_date: Timestamp, @@ -75,6 +75,317 @@ pub struct TaxProductResourceTaxTransactionResourceReversal { pub original_transaction: Option, } +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceTaxTransactionShippingCost { + + /// The shipping amount in integer cents. + /// + /// If `tax_behavior=inclusive`, then this amount includes taxes. + /// Otherwise, taxes were calculated on top of this amount. + pub amount: i64, + + /// The amount of tax calculated for shipping, in integer cents. + pub amount_tax: i64, + + /// The ID of an existing [ShippingRate](https://stripe.com/docs/api/shipping_rates/object). + /// + /// (It is not populated for the transaction resource object and will be removed in the next API version.). + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping_rate: Option, + + /// Specifies whether the `amount` includes taxes. + /// + /// If `tax_behavior=inclusive`, then the amount includes taxes. + pub tax_behavior: TaxProductResourceTaxTransactionShippingCostTaxBehavior, + + /// Detailed account of taxes relevant to shipping cost. + /// + /// (It is not populated for the transaction resource object and will be removed in the next API version.). + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_breakdown: Option>, + + /// The [tax code](https://stripe.com/docs/tax/tax-categories) ID used for shipping. + pub tax_code: String, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceLineItemTaxBreakdown { + + /// The amount of tax, in integer cents. + pub amount: i64, + + pub jurisdiction: TaxProductResourceJurisdiction, + + /// Indicates whether the jurisdiction was determined by the origin (merchant's address) or destination (customer's address). + pub sourcing: TaxProductResourceLineItemTaxBreakdownSourcing, + + /// 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. + pub tax_rate_details: Option, + + /// 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. + pub taxability_reason: TaxProductResourceLineItemTaxBreakdownTaxabilityReason, + + /// The amount on which tax is calculated, in integer cents. + pub taxable_amount: i64, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceJurisdiction { + + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + pub country: String, + + /// A human-readable name for the jurisdiction imposing the tax. + pub display_name: String, + + /// Indicates the level of the jurisdiction imposing the tax. + pub level: TaxProductResourceJurisdictionLevel, + + /// [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. + /// + /// For example, "NY" for New York, United States. + pub state: Option, +} + +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +pub struct TaxProductResourceLineItemTaxRateDetails { + + /// 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.)". + pub display_name: String, + + /// The tax rate percentage as a string. + /// + /// For example, 8.5% is represented as "8.5". + pub percentage_decimal: String, + + /// The tax type, such as `vat` or `sales_tax`. + pub tax_type: TaxProductResourceLineItemTaxRateDetailsTaxType, +} + +/// An enum representing the possible values of an `TaxProductResourceJurisdiction`'s `level` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceJurisdictionLevel { + City, + Country, + County, + District, + State, +} + +impl TaxProductResourceJurisdictionLevel { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceJurisdictionLevel::City => "city", + TaxProductResourceJurisdictionLevel::Country => "country", + TaxProductResourceJurisdictionLevel::County => "county", + TaxProductResourceJurisdictionLevel::District => "district", + TaxProductResourceJurisdictionLevel::State => "state", + } + } +} + +impl AsRef for TaxProductResourceJurisdictionLevel { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceJurisdictionLevel { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceJurisdictionLevel { + fn default() -> Self { + Self::City + } +} + +/// An enum representing the possible values of an `TaxProductResourceLineItemTaxBreakdown`'s `sourcing` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceLineItemTaxBreakdownSourcing { + Destination, + Origin, +} + +impl TaxProductResourceLineItemTaxBreakdownSourcing { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceLineItemTaxBreakdownSourcing::Destination => "destination", + TaxProductResourceLineItemTaxBreakdownSourcing::Origin => "origin", + } + } +} + +impl AsRef for TaxProductResourceLineItemTaxBreakdownSourcing { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceLineItemTaxBreakdownSourcing { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceLineItemTaxBreakdownSourcing { + fn default() -> Self { + Self::Destination + } +} + +/// An enum representing the possible values of an `TaxProductResourceLineItemTaxBreakdown`'s `taxability_reason` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + CustomerExempt, + NotCollecting, + NotSubjectToTax, + NotSupported, + PortionProductExempt, + PortionReducedRated, + PortionStandardRated, + ProductExempt, + ProductExemptHoliday, + ProportionallyRated, + ReducedRated, + ReverseCharge, + StandardRated, + TaxableBasisReduced, + ZeroRated, +} + +impl TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::CustomerExempt => "customer_exempt", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::NotCollecting => "not_collecting", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::NotSubjectToTax => "not_subject_to_tax", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::NotSupported => "not_supported", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::PortionProductExempt => "portion_product_exempt", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::PortionReducedRated => "portion_reduced_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::PortionStandardRated => "portion_standard_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ProductExempt => "product_exempt", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ProductExemptHoliday => "product_exempt_holiday", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ProportionallyRated => "proportionally_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ReducedRated => "reduced_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ReverseCharge => "reverse_charge", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::StandardRated => "standard_rated", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::TaxableBasisReduced => "taxable_basis_reduced", + TaxProductResourceLineItemTaxBreakdownTaxabilityReason::ZeroRated => "zero_rated", + } + } +} + +impl AsRef for TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceLineItemTaxBreakdownTaxabilityReason { + fn default() -> Self { + Self::CustomerExempt + } +} + +/// An enum representing the possible values of an `TaxProductResourceLineItemTaxRateDetails`'s `tax_type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceLineItemTaxRateDetailsTaxType { + Gst, + Hst, + Igst, + Jct, + LeaseTax, + Pst, + Qst, + Rst, + SalesTax, + Vat, +} + +impl TaxProductResourceLineItemTaxRateDetailsTaxType { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceLineItemTaxRateDetailsTaxType::Gst => "gst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Hst => "hst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Igst => "igst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Jct => "jct", + TaxProductResourceLineItemTaxRateDetailsTaxType::LeaseTax => "lease_tax", + TaxProductResourceLineItemTaxRateDetailsTaxType::Pst => "pst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Qst => "qst", + TaxProductResourceLineItemTaxRateDetailsTaxType::Rst => "rst", + TaxProductResourceLineItemTaxRateDetailsTaxType::SalesTax => "sales_tax", + TaxProductResourceLineItemTaxRateDetailsTaxType::Vat => "vat", + } + } +} + +impl AsRef for TaxProductResourceLineItemTaxRateDetailsTaxType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceLineItemTaxRateDetailsTaxType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceLineItemTaxRateDetailsTaxType { + fn default() -> Self { + Self::Gst + } +} + +/// An enum representing the possible values of an `TaxProductResourceTaxTransactionShippingCost`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxProductResourceTaxTransactionShippingCostTaxBehavior { + Exclusive, + Inclusive, +} + +impl TaxProductResourceTaxTransactionShippingCostTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + TaxProductResourceTaxTransactionShippingCostTaxBehavior::Exclusive => "exclusive", + TaxProductResourceTaxTransactionShippingCostTaxBehavior::Inclusive => "inclusive", + } + } +} + +impl AsRef for TaxProductResourceTaxTransactionShippingCostTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxProductResourceTaxTransactionShippingCostTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} +impl std::default::Default for TaxProductResourceTaxTransactionShippingCostTaxBehavior { + fn default() -> Self { + Self::Exclusive + } +} + /// An enum representing the possible values of an `TaxTransaction`'s `type` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] From b57774f4241743be6ba23bcb7b7c77199a3c3c8b Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Tue, 2 May 2023 11:39:35 +0100 Subject: [PATCH 2/2] export payment_method_details_card_checks --- src/resources.rs | 1 + src/resources/generated.rs | 1 + src/resources/generated/payment_method_details_card_checks.rs | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/resources.rs b/src/resources.rs index 8ee55357d..b844eda60 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -124,6 +124,7 @@ pub use { payment_intent::*, payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code::*, linked_account_options_us_bank_account::*, + payment_method_details_card_checks::*, payment_method_options_customer_balance_eu_bank_account::*, payout::*, platform_tax_fee::*, diff --git a/src/resources/generated.rs b/src/resources/generated.rs index b605344ab..fce3b3232 100644 --- a/src/resources/generated.rs +++ b/src/resources/generated.rs @@ -30,6 +30,7 @@ pub mod core { pub mod mandate_options_off_session_details_blik; pub mod payment_intent; pub mod payment_intent_next_action_cashapp_handle_redirect_or_display_qr_code; + pub mod payment_method_details_card_checks; pub mod payment_method_options_customer_balance_eu_bank_account; pub mod payout; pub mod platform_tax_fee; diff --git a/src/resources/generated/payment_method_details_card_checks.rs b/src/resources/generated/payment_method_details_card_checks.rs index 0e07be6ee..d01d16696 100644 --- a/src/resources/generated/payment_method_details_card_checks.rs +++ b/src/resources/generated/payment_method_details_card_checks.rs @@ -7,7 +7,6 @@ use serde::{Deserialize, Serialize}; /// The resource representing a Stripe "payment_method_details_card_checks". #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct PaymentMethodDetailsCardChecks { - /// If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`. pub address_line1_check: Option,