From da68d32a3d6132ec06c2c242ab5477169b80ea45 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Tue, 27 Jul 2021 16:52:02 +0100 Subject: [PATCH 1/4] Generate latest changes from OpenApi spec --- src/resources/generated/account.rs | 159 ++++- src/resources/generated/bank_account.rs | 7 + .../generated/billing_portal_session.rs | 146 ++++- src/resources/generated/capability.rs | 24 +- src/resources/generated/charge.rs | 31 +- src/resources/generated/checkout_session.rs | 465 +++++++++++++- src/resources/generated/coupon.rs | 15 +- src/resources/generated/customer.rs | 128 ++++ src/resources/generated/file.rs | 4 + src/resources/generated/file_link.rs | 2 +- .../generated/identity_verification_report.rs | 602 ++++++++++++++++++ .../identity_verification_session.rs | 393 ++++++++++++ src/resources/generated/invoice.rs | 162 ++--- src/resources/generated/invoiceitem.rs | 34 + .../generated/issuing_authorization.rs | 2 +- src/resources/generated/issuing_card.rs | 4 + .../generated/issuing_transaction.rs | 37 ++ src/resources/generated/mandate.rs | 2 +- src/resources/generated/payment_intent.rs | 339 +++++++++- src/resources/generated/payment_method.rs | 43 +- src/resources/generated/person.rs | 10 +- src/resources/generated/price.rs | 57 ++ src/resources/generated/product.rs | 20 +- src/resources/generated/quote.rs | 482 ++++++++++++++ .../generated/radar_early_fraud_warning.rs | 4 + src/resources/generated/review.rs | 6 +- src/resources/generated/setup_intent.rs | 2 +- src/resources/generated/sku.rs | 6 +- src/resources/generated/subscription.rs | 518 ++++++++++++++- src/resources/generated/subscription_item.rs | 46 +- .../generated/subscription_schedule.rs | 144 +++++ src/resources/generated/tax_code.rs | 87 +++ src/resources/generated/tax_id.rs | 12 +- src/resources/generated/tax_rate.rs | 51 ++ .../generated/terminal_connection_token.rs | 3 + src/resources/generated/terminal_reader.rs | 5 +- src/resources/generated/token.rs | 33 + src/resources/generated/webhook_endpoint.rs | 42 ++ 38 files changed, 3955 insertions(+), 172 deletions(-) create mode 100644 src/resources/generated/identity_verification_report.rs create mode 100644 src/resources/generated/identity_verification_session.rs create mode 100644 src/resources/generated/quote.rs create mode 100644 src/resources/generated/tax_code.rs diff --git a/src/resources/generated/account.rs b/src/resources/generated/account.rs index 688a9df90..7b3713dec 100644 --- a/src/resources/generated/account.rs +++ b/src/resources/generated/account.rs @@ -38,6 +38,9 @@ pub struct Account { #[serde(skip_serializing_if = "Option::is_none")] pub company: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub controller: Option, + /// The account's country. #[serde(skip_serializing_if = "Option::is_none")] pub country: Option, @@ -124,21 +127,21 @@ impl Account { client.get_query(&format!("/accounts/{}", id), &Expand { expand }) } - /// Updates a connected [Express or Custom account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. + /// Updates a [connected account](https://stripe.com/docs/connect/accounts) by setting the values of the parameters passed. /// /// Any parameters not provided are left unchanged. /// Most parameters can be changed only for Custom accounts. - /// (These are marked **Custom Only** below.) Parameters marked **Custom and Express** are supported by both account types. To update your own account, use the [Dashboard](https://dashboard.stripe.com/account). + /// (These are marked **Custom Only** below.) Parameters marked **Custom and Express** are not supported for Standard accounts. To update your own account, use the [Dashboard](https://dashboard.stripe.com/account). /// Refer to our [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. pub fn update(client: &Client, id: &AccountId, params: UpdateAccount<'_>) -> Response { client.post_form(&format!("/accounts/{}", id), ¶ms) } - /// With [Connect](https://stripe.com/docs/connect), you can delete Custom or Express accounts you manage. + /// With [Connect](https://stripe.com/docs/connect), you can delete accounts you manage. /// /// Accounts created using test-mode keys can be deleted at any time. /// - /// Accounts created using live-mode keys can only be deleted once all balances are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/account) instead. + /// Custom or Express accounts created using live-mode keys can only be deleted once all balances are zero. If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/account) instead. pub fn delete(client: &Client, id: &AccountId) -> Response> { client.delete(&format!("/accounts/{}", id)) } @@ -215,6 +218,10 @@ pub struct AccountCapabilities { #[serde(skip_serializing_if = "Option::is_none")] pub bancontact_payments: Option, + /// The status of the boleto payments capability of the account, or whether the account can directly process boleto charges. + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto_payments: Option, + /// The status of the card issuing capability of the account, or whether you can use Issuing to distribute funds on cards. #[serde(skip_serializing_if = "Option::is_none")] pub card_issuing: Option, @@ -284,46 +291,62 @@ pub struct AccountCapabilities { pub transfers: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct AccountController { + /// `true` if the Connect application retrieving the resource controls the account and can therefore exercise [platform controls](https://stripe.com/docs/connect/platform-controls-for-standard-accounts). + /// + /// Otherwise, this field is null. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_controller: Option, + + /// The controller type. + /// + /// Can be `application`, if a Connect application controls the account, or `account`, if the account controls itself. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AccountRequirements { - /// The date the fields in `currently_due` must be collected by to keep payouts enabled for the account. + /// Date by which the fields in `currently_due` must be collected to keep the account enabled. /// - /// These fields might block payouts sooner if the next threshold is reached before these fields are collected. + /// These fields may disable the account sooner if the next threshold is reached before they are collected. #[serde(skip_serializing_if = "Option::is_none")] pub current_deadline: Option, - /// The fields that need to be collected to keep the account enabled. + /// Fields that need to be collected to keep the account enabled. /// - /// If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. + /// If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. #[serde(skip_serializing_if = "Option::is_none")] pub currently_due: Option>, - /// If the account is disabled, this string describes why the account can’t create charges or receive payouts. + /// If the account is disabled, this string describes why. /// - /// Can be `requirements.past_due`, `requirements.pending_verification`, `rejected.fraud`, `rejected.terms_of_service`, `rejected.listed`, `rejected.other`, `listed`, `under_review`, or `other`. + /// Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`. #[serde(skip_serializing_if = "Option::is_none")] pub disabled_reason: Option, - /// The fields that are `currently_due` and need to be collected again because validation or verification failed for some reason. + /// Fields that are `currently_due` and need to be collected again because validation or verification failed. #[serde(skip_serializing_if = "Option::is_none")] pub errors: Option>, - /// The fields that need to be collected assuming all volume thresholds are reached. + /// Fields that need to be collected assuming all volume thresholds are reached. /// - /// As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set. + /// As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. #[serde(skip_serializing_if = "Option::is_none")] pub eventually_due: Option>, - /// The fields that weren't collected by the `current_deadline`. + /// Fields that weren't collected by `current_deadline`. /// - /// These fields need to be collected to re-enable the account. + /// These fields need to be collected to enable the account. #[serde(skip_serializing_if = "Option::is_none")] pub past_due: Option>, /// Fields that may become required depending on the results of verification or review. /// - /// An empty array unless an asynchronous verification is pending. - /// If verification fails, the fields in this array become required and move to `currently_due` or `past_due`. + /// Will be an empty array unless an asynchronous verification is pending. + /// If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. #[serde(skip_serializing_if = "Option::is_none")] pub pending_verification: Option>, } @@ -697,7 +720,7 @@ pub struct CreateAccount<'a> { /// A card or bank account to attach to the account for receiving [payouts](https://stripe.com/docs/connect/bank-debit-card-payouts) (you won’t be able to use it for top-ups). /// - /// You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe.js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. + /// You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe-js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. /// By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. /// To add additional external accounts without replacing the existing default for the currency, use the bank account or card creation API. #[serde(skip_serializing_if = "Option::is_none")] @@ -851,7 +874,7 @@ pub struct UpdateAccount<'a> { /// A card or bank account to attach to the account for receiving [payouts](https://stripe.com/docs/connect/bank-debit-card-payouts) (you won’t be able to use it for top-ups). /// - /// You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe.js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. + /// You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/stripe-js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. /// By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. /// To add additional external accounts without replacing the existing default for the currency, use the bank account or card creation API. #[serde(skip_serializing_if = "Option::is_none")] @@ -1002,6 +1025,9 @@ pub struct CreateAccountCapabilities { #[serde(skip_serializing_if = "Option::is_none")] pub bancontact_payments: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto_payments: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card_issuing: Option, @@ -1155,6 +1181,9 @@ pub struct UpdateAccountCapabilities { #[serde(skip_serializing_if = "Option::is_none")] pub bancontact_payments: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto_payments: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card_issuing: Option, @@ -1297,6 +1326,12 @@ pub struct CreateAccountCapabilitiesBancontactPayments { pub requested: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateAccountCapabilitiesBoletoPayments { + #[serde(skip_serializing_if = "Option::is_none")] + pub requested: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateAccountCapabilitiesCardIssuing { #[serde(skip_serializing_if = "Option::is_none")] @@ -1489,6 +1524,12 @@ pub struct UpdateAccountCapabilitiesBancontactPayments { pub requested: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateAccountCapabilitiesBoletoPayments { + #[serde(skip_serializing_if = "Option::is_none")] + pub requested: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdateAccountCapabilitiesCardIssuing { #[serde(skip_serializing_if = "Option::is_none")] @@ -1794,6 +1835,37 @@ impl std::fmt::Display for AccountCapabilitiesBancontactPayments { } } +/// An enum representing the possible values of an `AccountCapabilities`'s `boleto_payments` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum AccountCapabilitiesBoletoPayments { + Active, + Inactive, + Pending, +} + +impl AccountCapabilitiesBoletoPayments { + pub fn as_str(self) -> &'static str { + match self { + AccountCapabilitiesBoletoPayments::Active => "active", + AccountCapabilitiesBoletoPayments::Inactive => "inactive", + AccountCapabilitiesBoletoPayments::Pending => "pending", + } + } +} + +impl AsRef for AccountCapabilitiesBoletoPayments { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for AccountCapabilitiesBoletoPayments { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `AccountCapabilities`'s `cartes_bancaires_payments` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -2104,6 +2176,35 @@ impl std::fmt::Display for AccountCapabilitiesSofortPayments { } } +/// An enum representing the possible values of an `AccountController`'s `type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum AccountControllerType { + Account, + Application, +} + +impl AccountControllerType { + pub fn as_str(self) -> &'static str { + match self { + AccountControllerType::Account => "account", + AccountControllerType::Application => "application", + } + } +} + +impl AsRef for AccountControllerType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for AccountControllerType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `AccountRequirementsError`'s `code` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -2285,10 +2386,13 @@ impl std::fmt::Display for CapabilityStatus { #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum CompanyParamsStructure { + FreeZoneEstablishment, + FreeZoneLlc, GovernmentInstrumentality, GovernmentalUnit, IncorporatedNonProfit, LimitedLiabilityPartnership, + Llc, MultiMemberLlc, PrivateCompany, PrivateCorporation, @@ -2296,6 +2400,8 @@ pub enum CompanyParamsStructure { PublicCompany, PublicCorporation, PublicPartnership, + SingleMemberLlc, + SoleEstablishment, SoleProprietorship, TaxExemptGovernmentInstrumentality, UnincorporatedAssociation, @@ -2305,10 +2411,13 @@ pub enum CompanyParamsStructure { impl CompanyParamsStructure { pub fn as_str(self) -> &'static str { match self { + CompanyParamsStructure::FreeZoneEstablishment => "free_zone_establishment", + CompanyParamsStructure::FreeZoneLlc => "free_zone_llc", CompanyParamsStructure::GovernmentInstrumentality => "government_instrumentality", CompanyParamsStructure::GovernmentalUnit => "governmental_unit", CompanyParamsStructure::IncorporatedNonProfit => "incorporated_non_profit", CompanyParamsStructure::LimitedLiabilityPartnership => "limited_liability_partnership", + CompanyParamsStructure::Llc => "llc", CompanyParamsStructure::MultiMemberLlc => "multi_member_llc", CompanyParamsStructure::PrivateCompany => "private_company", CompanyParamsStructure::PrivateCorporation => "private_corporation", @@ -2316,6 +2425,8 @@ impl CompanyParamsStructure { CompanyParamsStructure::PublicCompany => "public_company", CompanyParamsStructure::PublicCorporation => "public_corporation", CompanyParamsStructure::PublicPartnership => "public_partnership", + CompanyParamsStructure::SingleMemberLlc => "single_member_llc", + CompanyParamsStructure::SoleEstablishment => "sole_establishment", CompanyParamsStructure::SoleProprietorship => "sole_proprietorship", CompanyParamsStructure::TaxExemptGovernmentInstrumentality => { "tax_exempt_government_instrumentality" @@ -2342,10 +2453,13 @@ impl std::fmt::Display for CompanyParamsStructure { #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum CompanyStructure { + FreeZoneEstablishment, + FreeZoneLlc, GovernmentInstrumentality, GovernmentalUnit, IncorporatedNonProfit, LimitedLiabilityPartnership, + Llc, MultiMemberLlc, PrivateCompany, PrivateCorporation, @@ -2353,6 +2467,8 @@ pub enum CompanyStructure { PublicCompany, PublicCorporation, PublicPartnership, + SingleMemberLlc, + SoleEstablishment, SoleProprietorship, TaxExemptGovernmentInstrumentality, UnincorporatedAssociation, @@ -2362,10 +2478,13 @@ pub enum CompanyStructure { impl CompanyStructure { pub fn as_str(self) -> &'static str { match self { + CompanyStructure::FreeZoneEstablishment => "free_zone_establishment", + CompanyStructure::FreeZoneLlc => "free_zone_llc", CompanyStructure::GovernmentInstrumentality => "government_instrumentality", CompanyStructure::GovernmentalUnit => "governmental_unit", CompanyStructure::IncorporatedNonProfit => "incorporated_non_profit", CompanyStructure::LimitedLiabilityPartnership => "limited_liability_partnership", + CompanyStructure::Llc => "llc", CompanyStructure::MultiMemberLlc => "multi_member_llc", CompanyStructure::PrivateCompany => "private_company", CompanyStructure::PrivateCorporation => "private_corporation", @@ -2373,6 +2492,8 @@ impl CompanyStructure { CompanyStructure::PublicCompany => "public_company", CompanyStructure::PublicCorporation => "public_corporation", CompanyStructure::PublicPartnership => "public_partnership", + CompanyStructure::SingleMemberLlc => "single_member_llc", + CompanyStructure::SoleEstablishment => "sole_establishment", CompanyStructure::SoleProprietorship => "sole_proprietorship", CompanyStructure::TaxExemptGovernmentInstrumentality => { "tax_exempt_government_instrumentality" diff --git a/src/resources/generated/bank_account.rs b/src/resources/generated/bank_account.rs index 24afaa1d7..7cdf83e54 100644 --- a/src/resources/generated/bank_account.rs +++ b/src/resources/generated/bank_account.rs @@ -28,6 +28,13 @@ pub struct BankAccount { #[serde(skip_serializing_if = "Option::is_none")] pub account_holder_type: Option, + /// The bank account type. + /// + /// This can only be `checking` or `savings` in most countries. + /// In Japan, this can only be `futsu` or `toza`. + #[serde(skip_serializing_if = "Option::is_none")] + pub account_type: Option, + /// A set of available payout methods for this bank account. /// /// Only values from this set should be passed as the `method` when creating a payout. diff --git a/src/resources/generated/billing_portal_session.rs b/src/resources/generated/billing_portal_session.rs index ee55f36ba..25351e9d1 100644 --- a/src/resources/generated/billing_portal_session.rs +++ b/src/resources/generated/billing_portal_session.rs @@ -29,6 +29,12 @@ pub struct BillingPortalSession { /// 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, + /// The IETF language tag of the locale Customer Portal is displayed in. + /// + /// If blank or auto, the customer’s `preferred_locales` or browser’s locale is used. + #[serde(skip_serializing_if = "Option::is_none")] + pub locale: Option, + /// The account for which the session was created on behalf of. /// /// When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. @@ -67,7 +73,7 @@ impl Object for BillingPortalSession { /// The parameters for `BillingPortalSession::create`. #[derive(Clone, Debug, Serialize)] pub struct CreateBillingPortalSession<'a> { - /// The [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. + /// The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. /// /// If not specified, the session uses the default configuration. #[serde(skip_serializing_if = "Option::is_none")] @@ -80,6 +86,12 @@ pub struct CreateBillingPortalSession<'a> { #[serde(skip_serializing_if = "Expand::is_empty")] pub expand: &'a [&'a str], + /// The IETF language tag of the locale Customer Portal is displayed in. + /// + /// If blank or auto, the customer’s `preferred_locales` or browser’s locale is used. + #[serde(skip_serializing_if = "Option::is_none")] + pub locale: Option, + /// The `on_behalf_of` account to use for this session. /// /// When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. @@ -99,8 +111,140 @@ impl<'a> CreateBillingPortalSession<'a> { configuration: Default::default(), customer, expand: Default::default(), + locale: Default::default(), on_behalf_of: Default::default(), return_url: Default::default(), } } } + +/// An enum representing the possible values of an `BillingPortalSession`'s `locale` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum BillingPortalSessionLocale { + Auto, + Bg, + Cs, + Da, + De, + El, + En, + #[serde(rename = "en-AU")] + EnAu, + #[serde(rename = "en-CA")] + EnCa, + #[serde(rename = "en-GB")] + EnGb, + #[serde(rename = "en-IE")] + EnIe, + #[serde(rename = "en-IN")] + EnIn, + #[serde(rename = "en-NZ")] + EnNz, + #[serde(rename = "en-SG")] + EnSg, + Es, + #[serde(rename = "es-419")] + Es419, + Et, + Fi, + Fil, + Fr, + #[serde(rename = "fr-CA")] + FrCa, + Hr, + Hu, + Id, + It, + Ja, + Ko, + Lt, + Lv, + Ms, + Mt, + Nb, + Nl, + Pl, + Pt, + #[serde(rename = "pt-BR")] + PtBr, + Ro, + Ru, + Sk, + Sl, + Sv, + Th, + Tr, + Vi, + Zh, + #[serde(rename = "zh-HK")] + ZhHk, + #[serde(rename = "zh-TW")] + ZhTw, +} + +impl BillingPortalSessionLocale { + pub fn as_str(self) -> &'static str { + match self { + BillingPortalSessionLocale::Auto => "auto", + BillingPortalSessionLocale::Bg => "bg", + BillingPortalSessionLocale::Cs => "cs", + BillingPortalSessionLocale::Da => "da", + BillingPortalSessionLocale::De => "de", + BillingPortalSessionLocale::El => "el", + BillingPortalSessionLocale::En => "en", + BillingPortalSessionLocale::EnAu => "en-AU", + BillingPortalSessionLocale::EnCa => "en-CA", + BillingPortalSessionLocale::EnGb => "en-GB", + BillingPortalSessionLocale::EnIe => "en-IE", + BillingPortalSessionLocale::EnIn => "en-IN", + BillingPortalSessionLocale::EnNz => "en-NZ", + BillingPortalSessionLocale::EnSg => "en-SG", + BillingPortalSessionLocale::Es => "es", + BillingPortalSessionLocale::Es419 => "es-419", + BillingPortalSessionLocale::Et => "et", + BillingPortalSessionLocale::Fi => "fi", + BillingPortalSessionLocale::Fil => "fil", + BillingPortalSessionLocale::Fr => "fr", + BillingPortalSessionLocale::FrCa => "fr-CA", + BillingPortalSessionLocale::Hr => "hr", + BillingPortalSessionLocale::Hu => "hu", + BillingPortalSessionLocale::Id => "id", + BillingPortalSessionLocale::It => "it", + BillingPortalSessionLocale::Ja => "ja", + BillingPortalSessionLocale::Ko => "ko", + BillingPortalSessionLocale::Lt => "lt", + BillingPortalSessionLocale::Lv => "lv", + BillingPortalSessionLocale::Ms => "ms", + BillingPortalSessionLocale::Mt => "mt", + BillingPortalSessionLocale::Nb => "nb", + BillingPortalSessionLocale::Nl => "nl", + BillingPortalSessionLocale::Pl => "pl", + BillingPortalSessionLocale::Pt => "pt", + BillingPortalSessionLocale::PtBr => "pt-BR", + BillingPortalSessionLocale::Ro => "ro", + BillingPortalSessionLocale::Ru => "ru", + BillingPortalSessionLocale::Sk => "sk", + BillingPortalSessionLocale::Sl => "sl", + BillingPortalSessionLocale::Sv => "sv", + BillingPortalSessionLocale::Th => "th", + BillingPortalSessionLocale::Tr => "tr", + BillingPortalSessionLocale::Vi => "vi", + BillingPortalSessionLocale::Zh => "zh", + BillingPortalSessionLocale::ZhHk => "zh-HK", + BillingPortalSessionLocale::ZhTw => "zh-TW", + } + } +} + +impl AsRef for BillingPortalSessionLocale { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for BillingPortalSessionLocale { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/capability.rs b/src/resources/generated/capability.rs index bc24df600..3448702f0 100644 --- a/src/resources/generated/capability.rs +++ b/src/resources/generated/capability.rs @@ -47,39 +47,41 @@ impl Object for Capability { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AccountCapabilityRequirements { - /// The date the fields in `currently_due` must be collected by to keep the capability enabled for the account. + /// Date by which the fields in `currently_due` must be collected to keep the capability enabled for the account. + /// + /// These fields may disable the capability sooner if the next threshold is reached before they are collected. #[serde(skip_serializing_if = "Option::is_none")] pub current_deadline: Option, - /// The fields that need to be collected to keep the capability enabled. + /// Fields that need to be collected to keep the capability enabled. /// - /// If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled. + /// If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled. pub currently_due: Vec, /// If the capability is disabled, this string describes why. /// - /// Possible values are `requirement.fields_needed`, `pending.onboarding`, `pending.review`, `rejected_fraud`, `rejected.unsupported_business` or `rejected.other`. `rejected.unsupported_business` means that the account's business is not supported by the capability. + /// Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`. `rejected.unsupported_business` means that the account's business is not supported by the capability. /// For example, payment methods may restrict the businesses they support in their terms of service: - [Afterpay Clearpay's terms of service](/afterpay-clearpay/legal#restricted-businesses) If you believe that the rejection is in error, please contact support@stripe.com for assistance. #[serde(skip_serializing_if = "Option::is_none")] pub disabled_reason: Option, - /// The fields that are `currently_due` and need to be collected again because validation or verification failed for some reason. + /// Fields that are `currently_due` and need to be collected again because validation or verification failed. pub errors: Vec, - /// The fields that need to be collected assuming all volume thresholds are reached. + /// Fields that need to be collected assuming all volume thresholds are reached. /// - /// As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set. + /// As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. pub eventually_due: Vec, - /// The fields that weren't collected by the `current_deadline`. + /// Fields that weren't collected by `current_deadline`. /// - /// These fields need to be collected to enable the capability for the account. + /// These fields need to be collected to enable the capability on the account. pub past_due: Vec, /// Fields that may become required depending on the results of verification or review. /// - /// An empty array unless an asynchronous verification is pending. - /// If verification fails, the fields in this array become required and move to `currently_due` or `past_due`. + /// Will be an empty array unless an asynchronous verification is pending. + /// If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. pub pending_verification: Vec, } diff --git a/src/resources/generated/charge.rs b/src/resources/generated/charge.rs index b8f3b84a9..18099a333 100644 --- a/src/resources/generated/charge.rs +++ b/src/resources/generated/charge.rs @@ -362,6 +362,9 @@ pub struct PaymentMethodDetails { #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, @@ -415,6 +418,9 @@ pub struct PaymentMethodDetails { #[serde(skip_serializing_if = "Option::is_none")] pub wechat: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -510,7 +516,11 @@ pub struct PaymentMethodDetailsAcssDebit { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct PaymentMethodDetailsAfterpayClearpay {} +pub struct PaymentMethodDetailsAfterpayClearpay { + /// Order identifier shown to the merchant in Afterpay’s online portal. + #[serde(skip_serializing_if = "Option::is_none")] + pub reference: Option, +} #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentMethodDetailsAuBecsDebit { @@ -595,6 +605,12 @@ pub struct PaymentMethodDetailsBancontact { pub verified_name: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodDetailsBoleto { + /// Uniquely identifies this customer tax_id (CNPJ or CPF). + pub tax_id: String, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentMethodDetailsCard { /// Card brand. @@ -1112,6 +1128,19 @@ pub struct PaymentMethodDetailsStripeAccount {} #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentMethodDetailsWechat {} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodDetailsWechatPay { + /// Uniquely identifies this particular WeChat Pay account. + /// + /// You can use this attribute to check whether two WeChat accounts are the same. + #[serde(skip_serializing_if = "Option::is_none")] + pub fingerprint: Option, + + /// Transaction ID of this particular WeChat Pay transaction. + #[serde(skip_serializing_if = "Option::is_none")] + pub transaction_id: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Rule { /// The action taken on the payment. diff --git a/src/resources/generated/checkout_session.rs b/src/resources/generated/checkout_session.rs index dd483ef7b..2f1188a74 100644 --- a/src/resources/generated/checkout_session.rs +++ b/src/resources/generated/checkout_session.rs @@ -8,8 +8,8 @@ use crate::config::{Client, Response}; use crate::ids::{CheckoutSessionId, CustomerId, PaymentIntentId, SubscriptionId}; use crate::params::{Expand, Expandable, List, Metadata, Object, Timestamp}; use crate::resources::{ - CheckoutSessionItem, Currency, Customer, Discount, PaymentIntent, SetupIntent, Shipping, - Subscription, TaxRate, + CheckoutSessionItem, Currency, Customer, Discount, PaymentIntent, PaymentMethodOptionsBoleto, + PaymentMethodOptionsOxxo, SetupIntent, Shipping, Subscription, TaxRate, }; /// The resource representing a Stripe "Session". @@ -32,6 +32,8 @@ pub struct CheckoutSession { #[serde(skip_serializing_if = "Option::is_none")] pub amount_total: Option, + pub automatic_tax: PaymentPagesCheckoutSessionAutomaticTax, + /// Describes whether Checkout should collect the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] pub billing_address_collection: Option, @@ -60,6 +62,8 @@ pub struct CheckoutSession { pub customer: Option>, /// The customer details including the customer's tax exempt status and the customer's tax IDs. + /// + /// Only present on Sessions in `payment` or `subscription` mode. #[serde(skip_serializing_if = "Option::is_none")] pub customer_details: Option, @@ -100,7 +104,7 @@ pub struct CheckoutSession { /// Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option, + pub payment_method_options: Option, /// A list of the types of payment methods (e.g. /// @@ -138,9 +142,16 @@ pub struct CheckoutSession { /// subscription creation is successful. pub success_url: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_id_collection: Option, + /// Tax and discount details for the computed total amount. #[serde(skip_serializing_if = "Option::is_none")] pub total_details: Option, + + /// The URL to the Checkout Session. + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } impl CheckoutSession { @@ -169,7 +180,63 @@ impl Object for CheckoutSession { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct CheckoutSessionPaymentMethodOptionsForPayment {} +pub struct CheckoutSessionPaymentMethodOptions { + #[serde(skip_serializing_if = "Option::is_none")] + pub acss_debit: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub oxxo: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CheckoutAcssDebitPaymentMethodOptions { + /// Currency supported by the bank account. + /// + /// Returned when the Session is in `setup` mode. + #[serde(skip_serializing_if = "Option::is_none")] + pub currency: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub mandate_options: Option, + + /// Bank account verification method. + #[serde(skip_serializing_if = "Option::is_none")] + pub verification_method: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CheckoutAcssDebitMandateOptions { + /// A URL for custom mandate text. + #[serde(skip_serializing_if = "Option::is_none")] + pub custom_mandate_url: Option, + + /// Description of the interval. + /// + /// Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. + #[serde(skip_serializing_if = "Option::is_none")] + pub interval_description: Option, + + /// Payment schedule for the mandate. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_schedule: Option, + + /// Transaction type of the mandate. + #[serde(skip_serializing_if = "Option::is_none")] + pub transaction_type: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentPagesCheckoutSessionAutomaticTax { + /// Indicates whether automatic tax is enabled for the session. + pub enabled: bool, + + /// The status of the most recent automated tax calculation for this session. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentPagesCheckoutSessionCustomerDetails { @@ -188,7 +255,7 @@ pub struct PaymentPagesCheckoutSessionCustomerDetails { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentPagesCheckoutSessionTaxId { - /// The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `gb_vat`, `nz_gst`, `au_abn`, `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`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, or `unknown`. + /// The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `gb_vat`, `nz_gst`, `au_abn`, `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`, `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`, or `unknown`. #[serde(rename = "type")] pub type_: PaymentPagesCheckoutSessionTaxIdType, @@ -197,6 +264,12 @@ pub struct PaymentPagesCheckoutSessionTaxId { pub value: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentPagesCheckoutSessionTaxIdCollection { + /// Indicates whether tax ID collection is enabled for the session. + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentPagesCheckoutSessionTotalDetails { /// This is the sum of all the line item discounts. @@ -254,6 +327,10 @@ pub struct CreateCheckoutSession<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub allow_promotion_codes: Option, + /// Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions. + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Specify whether Checkout should collect the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] pub billing_address_collection: Option, @@ -284,6 +361,12 @@ pub struct CreateCheckoutSession<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub customer_email: Option<&'a str>, + /// Controls what fields on Customer can be updated by the Checkout Session. + /// + /// Can only be provided when `customer` is provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer_update: Option, + /// The coupon or promotion code to apply to this Session. /// /// Currently, only up to one may be specified. @@ -338,7 +421,8 @@ pub struct CreateCheckoutSession<'a> { /// If multiple payment methods are passed, Checkout will dynamically reorder them to /// prioritize the most relevant payment methods based on the customer's location and /// other characteristics. - pub payment_method_types: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_types: Option>, /// A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] @@ -370,21 +454,23 @@ pub struct CreateCheckoutSession<'a> { /// If you’d like access to the Checkout Session for the successful /// payment, read more about it in the guide on [fulfilling orders](https://stripe.com/docs/payments/checkout/fulfill-orders). pub success_url: &'a str, + + /// Controls tax ID collection settings for the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_id_collection: Option, } impl<'a> CreateCheckoutSession<'a> { - pub fn new( - cancel_url: &'a str, - payment_method_types: Vec, - success_url: &'a str, - ) -> Self { + pub fn new(cancel_url: &'a str, success_url: &'a str) -> Self { CreateCheckoutSession { allow_promotion_codes: Default::default(), + automatic_tax: Default::default(), billing_address_collection: Default::default(), cancel_url, client_reference_id: Default::default(), customer: Default::default(), customer_email: Default::default(), + customer_update: Default::default(), discounts: Default::default(), expand: Default::default(), line_items: Default::default(), @@ -393,13 +479,14 @@ impl<'a> CreateCheckoutSession<'a> { mode: Default::default(), payment_intent_data: Default::default(), payment_method_options: Default::default(), - payment_method_types, + payment_method_types: Default::default(), setup_intent_data: Default::default(), shipping_address_collection: Default::default(), shipping_rates: Default::default(), submit_type: Default::default(), subscription_data: Default::default(), success_url, + tax_id_collection: Default::default(), } } } @@ -453,6 +540,23 @@ impl<'a> ListCheckoutSessions<'a> { } } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCheckoutSessionAutomaticTax { + pub enabled: bool, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCheckoutSessionCustomerUpdate { + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateCheckoutSessionDiscounts { #[serde(skip_serializing_if = "Option::is_none")] @@ -541,6 +645,15 @@ pub struct CreateCheckoutSessionPaymentIntentData { pub struct CreateCheckoutSessionPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub oxxo: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -584,6 +697,11 @@ pub struct CreateCheckoutSessionSubscriptionData { pub trial_period_days: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCheckoutSessionTaxIdCollection { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateCheckoutSessionLineItemsAdjustableQuantity { pub enabled: bool, @@ -608,6 +726,9 @@ pub struct CreateCheckoutSessionLineItemsPriceData { #[serde(skip_serializing_if = "Option::is_none")] pub recurring: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -652,6 +773,26 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAcssDebit { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCheckoutSessionPaymentMethodOptionsBoleto { + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_after_days: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCheckoutSessionPaymentMethodOptionsOxxo { + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_after_days: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCheckoutSessionPaymentMethodOptionsWechatPay { + #[serde(skip_serializing_if = "Option::is_none")] + pub app_id: Option, + + pub client: CreateCheckoutSessionPaymentMethodOptionsWechatPayClient, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateCheckoutSessionSubscriptionDataItems { pub plan: String, @@ -683,6 +824,9 @@ pub struct CreateCheckoutSessionLineItemsPriceDataProductData { pub metadata: Metadata, pub name: String, + + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -730,6 +874,99 @@ pub struct CreateCheckoutSessionPaymentMethodOptionsAcssDebitMandateOptions { Option, } +/// An enum representing the possible values of an `CheckoutAcssDebitMandateOptions`'s `payment_schedule` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CheckoutAcssDebitMandateOptionsPaymentSchedule { + Combined, + Interval, + Sporadic, +} + +impl CheckoutAcssDebitMandateOptionsPaymentSchedule { + pub fn as_str(self) -> &'static str { + match self { + CheckoutAcssDebitMandateOptionsPaymentSchedule::Combined => "combined", + CheckoutAcssDebitMandateOptionsPaymentSchedule::Interval => "interval", + CheckoutAcssDebitMandateOptionsPaymentSchedule::Sporadic => "sporadic", + } + } +} + +impl AsRef for CheckoutAcssDebitMandateOptionsPaymentSchedule { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CheckoutAcssDebitMandateOptionsPaymentSchedule { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `CheckoutAcssDebitMandateOptions`'s `transaction_type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CheckoutAcssDebitMandateOptionsTransactionType { + Business, + Personal, +} + +impl CheckoutAcssDebitMandateOptionsTransactionType { + pub fn as_str(self) -> &'static str { + match self { + CheckoutAcssDebitMandateOptionsTransactionType::Business => "business", + CheckoutAcssDebitMandateOptionsTransactionType::Personal => "personal", + } + } +} + +impl AsRef for CheckoutAcssDebitMandateOptionsTransactionType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CheckoutAcssDebitMandateOptionsTransactionType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `CheckoutAcssDebitPaymentMethodOptions`'s `verification_method` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CheckoutAcssDebitPaymentMethodOptionsVerificationMethod { + Automatic, + Instant, + Microdeposits, +} + +impl CheckoutAcssDebitPaymentMethodOptionsVerificationMethod { + pub fn as_str(self) -> &'static str { + match self { + CheckoutAcssDebitPaymentMethodOptionsVerificationMethod::Automatic => "automatic", + CheckoutAcssDebitPaymentMethodOptionsVerificationMethod::Instant => "instant", + CheckoutAcssDebitPaymentMethodOptionsVerificationMethod::Microdeposits => { + "microdeposits" + } + } + } +} + +impl AsRef for CheckoutAcssDebitPaymentMethodOptionsVerificationMethod { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CheckoutAcssDebitPaymentMethodOptionsVerificationMethod { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `CheckoutSession`'s `billing_address_collection` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -780,10 +1017,12 @@ pub enum CheckoutSessionLocale { Fr, #[serde(rename = "fr-CA")] FrCa, + Hr, Hu, Id, It, Ja, + Ko, Lt, Lv, Ms, @@ -801,6 +1040,7 @@ pub enum CheckoutSessionLocale { Sv, Th, Tr, + Vi, Zh, #[serde(rename = "zh-HK")] ZhHk, @@ -825,10 +1065,12 @@ impl CheckoutSessionLocale { CheckoutSessionLocale::Fi => "fi", CheckoutSessionLocale::Fr => "fr", CheckoutSessionLocale::FrCa => "fr-CA", + CheckoutSessionLocale::Hr => "hr", CheckoutSessionLocale::Hu => "hu", CheckoutSessionLocale::Id => "id", CheckoutSessionLocale::It => "it", CheckoutSessionLocale::Ja => "ja", + CheckoutSessionLocale::Ko => "ko", CheckoutSessionLocale::Lt => "lt", CheckoutSessionLocale::Lv => "lv", CheckoutSessionLocale::Ms => "ms", @@ -845,6 +1087,7 @@ impl CheckoutSessionLocale { CheckoutSessionLocale::Sv => "sv", CheckoutSessionLocale::Th => "th", CheckoutSessionLocale::Tr => "tr", + CheckoutSessionLocale::Vi => "vi", CheckoutSessionLocale::Zh => "zh", CheckoutSessionLocale::ZhHk => "zh-HK", CheckoutSessionLocale::ZhTw => "zh-TW", @@ -959,6 +1202,93 @@ impl std::fmt::Display for CheckoutSessionSubmitType { } } +/// An enum representing the possible values of an `CreateCheckoutSessionCustomerUpdate`'s `address` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateCheckoutSessionCustomerUpdateAddress { + Auto, + Never, +} + +impl CreateCheckoutSessionCustomerUpdateAddress { + pub fn as_str(self) -> &'static str { + match self { + CreateCheckoutSessionCustomerUpdateAddress::Auto => "auto", + CreateCheckoutSessionCustomerUpdateAddress::Never => "never", + } + } +} + +impl AsRef for CreateCheckoutSessionCustomerUpdateAddress { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateCheckoutSessionCustomerUpdateAddress { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `CreateCheckoutSessionCustomerUpdate`'s `name` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateCheckoutSessionCustomerUpdateName { + Auto, + Never, +} + +impl CreateCheckoutSessionCustomerUpdateName { + pub fn as_str(self) -> &'static str { + match self { + CreateCheckoutSessionCustomerUpdateName::Auto => "auto", + CreateCheckoutSessionCustomerUpdateName::Never => "never", + } + } +} + +impl AsRef for CreateCheckoutSessionCustomerUpdateName { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateCheckoutSessionCustomerUpdateName { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `CreateCheckoutSessionCustomerUpdate`'s `shipping` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateCheckoutSessionCustomerUpdateShipping { + Auto, + Never, +} + +impl CreateCheckoutSessionCustomerUpdateShipping { + pub fn as_str(self) -> &'static str { + match self { + CreateCheckoutSessionCustomerUpdateShipping::Auto => "auto", + CreateCheckoutSessionCustomerUpdateShipping::Never => "never", + } + } +} + +impl AsRef for CreateCheckoutSessionCustomerUpdateShipping { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateCheckoutSessionCustomerUpdateShipping { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `CreateCheckoutSessionLineItemsPriceDataRecurring`'s `interval` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -992,6 +1322,37 @@ impl std::fmt::Display for CreateCheckoutSessionLineItemsPriceDataRecurringInter } } +/// An enum representing the possible values of an `CreateCheckoutSessionLineItemsPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateCheckoutSessionLineItemsPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl CreateCheckoutSessionLineItemsPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + CreateCheckoutSessionLineItemsPriceDataTaxBehavior::Exclusive => "exclusive", + CreateCheckoutSessionLineItemsPriceDataTaxBehavior::Inclusive => "inclusive", + CreateCheckoutSessionLineItemsPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `CreateCheckoutSessionPaymentIntentData`'s `capture_method` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1155,6 +1516,37 @@ impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsAcssDebitVer } } +/// An enum representing the possible values of an `CreateCheckoutSessionPaymentMethodOptionsWechatPay`'s `client` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { + Android, + Ios, + Web, +} + +impl CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { + pub fn as_str(self) -> &'static str { + match self { + CreateCheckoutSessionPaymentMethodOptionsWechatPayClient::Android => "android", + CreateCheckoutSessionPaymentMethodOptionsWechatPayClient::Ios => "ios", + CreateCheckoutSessionPaymentMethodOptionsWechatPayClient::Web => "web", + } + } +} + +impl AsRef for CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateCheckoutSessionPaymentMethodOptionsWechatPayClient { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `CreateCheckoutSession`'s `payment_method_types` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1164,15 +1556,18 @@ pub enum CreateCheckoutSessionPaymentMethodTypes { Alipay, BacsDebit, Bancontact, + Boleto, Card, Eps, Fpx, Giropay, Grabpay, Ideal, + Oxxo, P24, SepaDebit, Sofort, + WechatPay, } impl CreateCheckoutSessionPaymentMethodTypes { @@ -1183,15 +1578,18 @@ impl CreateCheckoutSessionPaymentMethodTypes { CreateCheckoutSessionPaymentMethodTypes::Alipay => "alipay", CreateCheckoutSessionPaymentMethodTypes::BacsDebit => "bacs_debit", CreateCheckoutSessionPaymentMethodTypes::Bancontact => "bancontact", + CreateCheckoutSessionPaymentMethodTypes::Boleto => "boleto", CreateCheckoutSessionPaymentMethodTypes::Card => "card", CreateCheckoutSessionPaymentMethodTypes::Eps => "eps", CreateCheckoutSessionPaymentMethodTypes::Fpx => "fpx", CreateCheckoutSessionPaymentMethodTypes::Giropay => "giropay", CreateCheckoutSessionPaymentMethodTypes::Grabpay => "grabpay", CreateCheckoutSessionPaymentMethodTypes::Ideal => "ideal", + CreateCheckoutSessionPaymentMethodTypes::Oxxo => "oxxo", CreateCheckoutSessionPaymentMethodTypes::P24 => "p24", CreateCheckoutSessionPaymentMethodTypes::SepaDebit => "sepa_debit", CreateCheckoutSessionPaymentMethodTypes::Sofort => "sofort", + CreateCheckoutSessionPaymentMethodTypes::WechatPay => "wechat_pay", } } } @@ -1944,6 +2342,39 @@ impl std::fmt::Display for CreateCheckoutSessionShippingAddressCollectionAllowed } } +/// An enum representing the possible values of an `PaymentPagesCheckoutSessionAutomaticTax`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum PaymentPagesCheckoutSessionAutomaticTaxStatus { + Complete, + Failed, + RequiresLocationInputs, +} + +impl PaymentPagesCheckoutSessionAutomaticTaxStatus { + pub fn as_str(self) -> &'static str { + match self { + PaymentPagesCheckoutSessionAutomaticTaxStatus::Complete => "complete", + PaymentPagesCheckoutSessionAutomaticTaxStatus::Failed => "failed", + PaymentPagesCheckoutSessionAutomaticTaxStatus::RequiresLocationInputs => { + "requires_location_inputs" + } + } + } +} + +impl AsRef for PaymentPagesCheckoutSessionAutomaticTaxStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for PaymentPagesCheckoutSessionAutomaticTaxStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `PaymentPagesCheckoutSessionCustomerDetails`'s `tax_exempt` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1984,6 +2415,10 @@ pub enum PaymentPagesCheckoutSessionTaxIdType { BrCnpj, BrCpf, CaBn, + CaGstHst, + CaPstBc, + CaPstMb, + CaPstSk, CaQst, ChVat, ClTin, @@ -1992,6 +2427,7 @@ pub enum PaymentPagesCheckoutSessionTaxIdType { GbVat, HkBr, IdNpwp, + IlVat, InGst, JpCn, JpRn, @@ -2023,6 +2459,10 @@ impl PaymentPagesCheckoutSessionTaxIdType { PaymentPagesCheckoutSessionTaxIdType::BrCnpj => "br_cnpj", PaymentPagesCheckoutSessionTaxIdType::BrCpf => "br_cpf", PaymentPagesCheckoutSessionTaxIdType::CaBn => "ca_bn", + PaymentPagesCheckoutSessionTaxIdType::CaGstHst => "ca_gst_hst", + PaymentPagesCheckoutSessionTaxIdType::CaPstBc => "ca_pst_bc", + PaymentPagesCheckoutSessionTaxIdType::CaPstMb => "ca_pst_mb", + PaymentPagesCheckoutSessionTaxIdType::CaPstSk => "ca_pst_sk", PaymentPagesCheckoutSessionTaxIdType::CaQst => "ca_qst", PaymentPagesCheckoutSessionTaxIdType::ChVat => "ch_vat", PaymentPagesCheckoutSessionTaxIdType::ClTin => "cl_tin", @@ -2031,6 +2471,7 @@ impl PaymentPagesCheckoutSessionTaxIdType { PaymentPagesCheckoutSessionTaxIdType::GbVat => "gb_vat", PaymentPagesCheckoutSessionTaxIdType::HkBr => "hk_br", PaymentPagesCheckoutSessionTaxIdType::IdNpwp => "id_npwp", + PaymentPagesCheckoutSessionTaxIdType::IlVat => "il_vat", PaymentPagesCheckoutSessionTaxIdType::InGst => "in_gst", PaymentPagesCheckoutSessionTaxIdType::JpCn => "jp_cn", PaymentPagesCheckoutSessionTaxIdType::JpRn => "jp_rn", diff --git a/src/resources/generated/coupon.rs b/src/resources/generated/coupon.rs index b8141eb97..f60712b7a 100644 --- a/src/resources/generated/coupon.rs +++ b/src/resources/generated/coupon.rs @@ -140,7 +140,7 @@ pub struct CouponAppliesTo { } /// The parameters for `Coupon::create`. -#[derive(Clone, Debug, Serialize)] +#[derive(Clone, Debug, Serialize, Default)] pub struct CreateCoupon<'a> { /// A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed). #[serde(skip_serializing_if = "Option::is_none")] @@ -154,10 +154,12 @@ pub struct CreateCoupon<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub currency: Option, - /// Specifies how long the discount will be in effect. + /// Specifies how long the discount will be in effect if used on a subscription. /// /// Can be `forever`, `once`, or `repeating`. - pub duration: CouponDuration, + /// Defaults to `once`. + #[serde(skip_serializing_if = "Option::is_none")] + pub duration: Option, /// Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect. #[serde(skip_serializing_if = "Option::is_none")] @@ -205,12 +207,12 @@ pub struct CreateCoupon<'a> { } impl<'a> CreateCoupon<'a> { - pub fn new(duration: CouponDuration) -> Self { + pub fn new() -> Self { CreateCoupon { amount_off: Default::default(), applies_to: Default::default(), currency: Default::default(), - duration, + duration: Default::default(), duration_in_months: Default::default(), expand: Default::default(), id: Default::default(), @@ -303,7 +305,8 @@ impl<'a> UpdateCoupon<'a> { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateCouponAppliesTo { - pub products: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub products: Option>, } /// An enum representing the possible values of an `Coupon`'s `duration` field. diff --git a/src/resources/generated/customer.rs b/src/resources/generated/customer.rs index a979f4a04..d0782805b 100644 --- a/src/resources/generated/customer.rs +++ b/src/resources/generated/customer.rs @@ -123,6 +123,9 @@ pub struct Customer { #[serde(default)] pub subscriptions: List, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax: Option, + /// Describes the customer's tax exemption status. /// /// One of `none`, `exempt`, or `reverse`. @@ -189,6 +192,33 @@ impl Object for Customer { } } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CustomerTax { + /// Surfaces if automatic tax computation is possible given the current customer location information. + pub automatic_tax: CustomerTaxAutomaticTax, + + /// A recent IP address of the customer used for tax reporting and tax location inference. + #[serde(skip_serializing_if = "Option::is_none")] + pub ip_address: Option, + + /// The customer's location as identified by Stripe Tax. + #[serde(skip_serializing_if = "Option::is_none")] + pub location: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CustomerTaxLocation { + /// The customer's country as identified by Stripe Tax. + pub country: String, + + /// The data source used to infer the customer's location. + pub source: CustomerTaxLocationSource, + + /// The customer's state, county, province, or region as identified by Stripe Tax. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoiceSettingCustomerSetting { /// Default custom fields to be displayed on invoices for this customer. @@ -301,6 +331,10 @@ pub struct CreateCustomer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub source: Option, + /// Tax details about the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax: Option, + /// The customer's tax exemption. /// /// One of `none`, `exempt`, or `reverse`. @@ -332,6 +366,7 @@ impl<'a> CreateCustomer<'a> { promotion_code: Default::default(), shipping: Default::default(), source: Default::default(), + tax: Default::default(), tax_exempt: Default::default(), tax_id_data: Default::default(), } @@ -493,6 +528,10 @@ pub struct UpdateCustomer<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub source: Option, + /// Tax details about the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax: Option, + /// The customer's tax exemption. /// /// One of `none`, `exempt`, or `reverse`. @@ -532,12 +571,19 @@ impl<'a> UpdateCustomer<'a> { promotion_code: Default::default(), shipping: Default::default(), source: Default::default(), + tax: Default::default(), tax_exempt: Default::default(), trial_end: Default::default(), } } } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateCustomerTax { + #[serde(skip_serializing_if = "Option::is_none")] + pub ip_address: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CustomerInvoiceSettings { #[serde(skip_serializing_if = "Option::is_none")] @@ -558,6 +604,45 @@ pub struct TaxIdData { pub value: String, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateCustomerTax { + #[serde(skip_serializing_if = "Option::is_none")] + pub ip_address: Option, +} + +/// An enum representing the possible values of an `CustomerTax`'s `automatic_tax` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CustomerTaxAutomaticTax { + Failed, + NotCollecting, + Supported, + UnrecognizedLocation, +} + +impl CustomerTaxAutomaticTax { + pub fn as_str(self) -> &'static str { + match self { + CustomerTaxAutomaticTax::Failed => "failed", + CustomerTaxAutomaticTax::NotCollecting => "not_collecting", + CustomerTaxAutomaticTax::Supported => "supported", + CustomerTaxAutomaticTax::UnrecognizedLocation => "unrecognized_location", + } + } +} + +impl AsRef for CustomerTaxAutomaticTax { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CustomerTaxAutomaticTax { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `Customer`'s `tax_exempt` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -620,6 +705,39 @@ impl std::fmt::Display for CustomerTaxExemptFilter { } } +/// An enum representing the possible values of an `CustomerTaxLocation`'s `source` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CustomerTaxLocationSource { + BillingAddress, + IpAddress, + PaymentMethod, + ShippingDestination, +} + +impl CustomerTaxLocationSource { + pub fn as_str(self) -> &'static str { + match self { + CustomerTaxLocationSource::BillingAddress => "billing_address", + CustomerTaxLocationSource::IpAddress => "ip_address", + CustomerTaxLocationSource::PaymentMethod => "payment_method", + CustomerTaxLocationSource::ShippingDestination => "shipping_destination", + } + } +} + +impl AsRef for CustomerTaxLocationSource { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CustomerTaxLocationSource { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `TaxIdData`'s `type` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -629,6 +747,10 @@ pub enum TaxIdType { BrCnpj, BrCpf, CaBn, + CaGstHst, + CaPstBc, + CaPstMb, + CaPstSk, CaQst, ChVat, ClTin, @@ -637,6 +759,7 @@ pub enum TaxIdType { GbVat, HkBr, IdNpwp, + IlVat, InGst, JpCn, JpRn, @@ -667,6 +790,10 @@ impl TaxIdType { TaxIdType::BrCnpj => "br_cnpj", TaxIdType::BrCpf => "br_cpf", TaxIdType::CaBn => "ca_bn", + TaxIdType::CaGstHst => "ca_gst_hst", + TaxIdType::CaPstBc => "ca_pst_bc", + TaxIdType::CaPstMb => "ca_pst_mb", + TaxIdType::CaPstSk => "ca_pst_sk", TaxIdType::CaQst => "ca_qst", TaxIdType::ChVat => "ch_vat", TaxIdType::ClTin => "cl_tin", @@ -675,6 +802,7 @@ impl TaxIdType { TaxIdType::GbVat => "gb_vat", TaxIdType::HkBr => "hk_br", TaxIdType::IdNpwp => "id_npwp", + TaxIdType::IlVat => "il_vat", TaxIdType::InGst => "in_gst", TaxIdType::JpCn => "jp_cn", TaxIdType::JpRn => "jp_rn", diff --git a/src/resources/generated/file.rs b/src/resources/generated/file.rs index d6f1792b8..fec7879b1 100644 --- a/src/resources/generated/file.rs +++ b/src/resources/generated/file.rs @@ -144,7 +144,9 @@ pub enum FilePurpose { DocumentProviderIdentityDocument, FinanceReportRun, IdentityDocument, + IdentityDocumentDownloadable, PciDocument, + Selfie, SigmaScheduledQuery, TaxDocumentUserUpload, } @@ -161,7 +163,9 @@ impl FilePurpose { FilePurpose::DocumentProviderIdentityDocument => "document_provider_identity_document", FilePurpose::FinanceReportRun => "finance_report_run", FilePurpose::IdentityDocument => "identity_document", + FilePurpose::IdentityDocumentDownloadable => "identity_document_downloadable", FilePurpose::PciDocument => "pci_document", + FilePurpose::Selfie => "selfie", FilePurpose::SigmaScheduledQuery => "sigma_scheduled_query", FilePurpose::TaxDocumentUserUpload => "tax_document_user_upload", } diff --git a/src/resources/generated/file_link.rs b/src/resources/generated/file_link.rs index ba34351f9..b2d0bbdc6 100644 --- a/src/resources/generated/file_link.rs +++ b/src/resources/generated/file_link.rs @@ -96,7 +96,7 @@ pub struct CreateFileLink<'a> { /// The ID of the file. /// - /// The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `pci_document`, `sigma_scheduled_query`, or `tax_document_user_upload`. + /// The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `identity_document_downloadable`, `pci_document`, `selfie`, `sigma_scheduled_query`, or `tax_document_user_upload`. pub file: FileId, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. diff --git a/src/resources/generated/identity_verification_report.rs b/src/resources/generated/identity_verification_report.rs new file mode 100644 index 000000000..77f98951f --- /dev/null +++ b/src/resources/generated/identity_verification_report.rs @@ -0,0 +1,602 @@ +// ====================================== +// This file was automatically generated. +// ====================================== + +use serde_derive::{Deserialize, Serialize}; + +use crate::ids::IdentityVerificationReportId; +use crate::params::{Object, Timestamp}; +use crate::resources::Address; + +/// The resource representing a Stripe "GelatoVerificationReport". +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct IdentityVerificationReport { + /// Unique identifier for the object. + pub id: IdentityVerificationReportId, + + /// Time at which the object was created. + /// + /// Measured in seconds since the Unix epoch. + pub created: Timestamp, + + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number: 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, + + pub options: GelatoVerificationReportOptions, + + #[serde(skip_serializing_if = "Option::is_none")] + pub selfie: Option, + + /// Type of report. + #[serde(rename = "type")] + pub type_: IdentityVerificationReportType, + + /// ID of the VerificationSession that created this report. + #[serde(skip_serializing_if = "Option::is_none")] + pub verification_session: Option, +} + +impl Object for IdentityVerificationReport { + type Id = IdentityVerificationReportId; + fn id(&self) -> Self::Id { + self.id.clone() + } + fn object(&self) -> &'static str { + "identity.verification_report" + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDocumentReport { + /// Address as it appears in the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option
, + + /// Date of birth as it appears in the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub dob: Option, + + /// Details on the verification error. + /// + /// Present when status is `unverified`. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + + /// Expiration date of the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub expiration_date: Option, + + /// Array of [File](https://stripe.com/docs/api/files) ids containing images for this document. + #[serde(skip_serializing_if = "Option::is_none")] + pub files: Option>, + + /// First name as it appears in the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub first_name: Option, + + /// Issued date of the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub issued_date: Option, + + /// Issuing country of the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub issuing_country: Option, + + /// Last name as it appears in the document. + #[serde(skip_serializing_if = "Option::is_none")] + pub last_name: Option, + + /// Document ID number. + #[serde(skip_serializing_if = "Option::is_none")] + pub number: Option, + + /// Status of this `document` check. + pub status: GelatoDocumentReportStatus, + + /// Type of the document. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDataDocumentReportDateOfBirth { + /// Numerical day between 1 and 31. + #[serde(skip_serializing_if = "Option::is_none")] + pub day: Option, + + /// Numerical month between 1 and 12. + #[serde(skip_serializing_if = "Option::is_none")] + pub month: Option, + + /// The four-digit year. + #[serde(skip_serializing_if = "Option::is_none")] + pub year: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDataDocumentReportExpirationDate { + /// Numerical day between 1 and 31. + #[serde(skip_serializing_if = "Option::is_none")] + pub day: Option, + + /// Numerical month between 1 and 12. + #[serde(skip_serializing_if = "Option::is_none")] + pub month: Option, + + /// The four-digit year. + #[serde(skip_serializing_if = "Option::is_none")] + pub year: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDataDocumentReportIssuedDate { + /// Numerical day between 1 and 31. + #[serde(skip_serializing_if = "Option::is_none")] + pub day: Option, + + /// Numerical month between 1 and 12. + #[serde(skip_serializing_if = "Option::is_none")] + pub month: Option, + + /// The four-digit year. + #[serde(skip_serializing_if = "Option::is_none")] + pub year: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDocumentReportError { + /// A short machine-readable string giving the reason for the verification failure. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + + /// A human-readable message giving the reason for the failure. + /// + /// These messages can be shown to your users. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoIdNumberReport { + /// Date of birth. + #[serde(skip_serializing_if = "Option::is_none")] + pub dob: Option, + + /// Details on the verification error. + /// + /// Present when status is `unverified`. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + + /// First name. + #[serde(skip_serializing_if = "Option::is_none")] + pub first_name: Option, + + /// ID number. + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number: Option, + + /// Type of ID number. + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number_type: Option, + + /// Last name. + #[serde(skip_serializing_if = "Option::is_none")] + pub last_name: Option, + + /// Status of this `id_number` check. + pub status: GelatoIdNumberReportStatus, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDataIdNumberReportDate { + /// Numerical day between 1 and 31. + #[serde(skip_serializing_if = "Option::is_none")] + pub day: Option, + + /// Numerical month between 1 and 12. + #[serde(skip_serializing_if = "Option::is_none")] + pub month: Option, + + /// The four-digit year. + #[serde(skip_serializing_if = "Option::is_none")] + pub year: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoIdNumberReportError { + /// A short machine-readable string giving the reason for the verification failure. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + + /// A human-readable message giving the reason for the failure. + /// + /// These messages can be shown to your users. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoSelfieReport { + /// ID of the [File](https://stripe.com/docs/api/files) holding the image of the identity document used in this check. + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option, + + /// Details on the verification error. + /// + /// Present when status is `unverified`. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + + /// ID of the [File](https://stripe.com/docs/api/files) holding the image of the selfie used in this check. + #[serde(skip_serializing_if = "Option::is_none")] + pub selfie: Option, + + /// Status of this `selfie` check. + pub status: GelatoSelfieReportStatus, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoSelfieReportError { + /// A short machine-readable string giving the reason for the verification failure. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + + /// A human-readable message giving the reason for the failure. + /// + /// These messages can be shown to your users. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoVerificationReportOptions { + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoReportDocumentOptions { + /// Array of strings of allowed identity document types. + /// + /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code. + #[serde(skip_serializing_if = "Option::is_none")] + pub allowed_types: Option>, + + /// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document’s extracted name and date of birth. + #[serde(skip_serializing_if = "Option::is_none")] + pub require_id_number: Option, + + /// Disable image uploads, identity document images have to be captured using the device’s camera. + #[serde(skip_serializing_if = "Option::is_none")] + pub require_live_capture: Option, + + /// Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user’s face. + /// + /// [Learn more](https://stripe.com/docs/identity/selfie). + #[serde(skip_serializing_if = "Option::is_none")] + pub require_matching_selfie: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoReportIdNumberOptions {} + +/// An enum representing the possible values of an `GelatoDocumentReportError`'s `code` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoDocumentReportErrorCode { + DocumentExpired, + DocumentTypeNotSupported, + DocumentUnverifiedOther, +} + +impl GelatoDocumentReportErrorCode { + pub fn as_str(self) -> &'static str { + match self { + GelatoDocumentReportErrorCode::DocumentExpired => "document_expired", + GelatoDocumentReportErrorCode::DocumentTypeNotSupported => { + "document_type_not_supported" + } + GelatoDocumentReportErrorCode::DocumentUnverifiedOther => "document_unverified_other", + } + } +} + +impl AsRef for GelatoDocumentReportErrorCode { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoDocumentReportErrorCode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoDocumentReport`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoDocumentReportStatus { + Unverified, + Verified, +} + +impl GelatoDocumentReportStatus { + pub fn as_str(self) -> &'static str { + match self { + GelatoDocumentReportStatus::Unverified => "unverified", + GelatoDocumentReportStatus::Verified => "verified", + } + } +} + +impl AsRef for GelatoDocumentReportStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoDocumentReportStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoDocumentReport`'s `type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoDocumentReportType { + DrivingLicense, + IdCard, + Passport, +} + +impl GelatoDocumentReportType { + pub fn as_str(self) -> &'static str { + match self { + GelatoDocumentReportType::DrivingLicense => "driving_license", + GelatoDocumentReportType::IdCard => "id_card", + GelatoDocumentReportType::Passport => "passport", + } + } +} + +impl AsRef for GelatoDocumentReportType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoDocumentReportType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoIdNumberReportError`'s `code` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoIdNumberReportErrorCode { + IdNumberInsufficientDocumentData, + IdNumberMismatch, + IdNumberUnverifiedOther, +} + +impl GelatoIdNumberReportErrorCode { + pub fn as_str(self) -> &'static str { + match self { + GelatoIdNumberReportErrorCode::IdNumberInsufficientDocumentData => { + "id_number_insufficient_document_data" + } + GelatoIdNumberReportErrorCode::IdNumberMismatch => "id_number_mismatch", + GelatoIdNumberReportErrorCode::IdNumberUnverifiedOther => "id_number_unverified_other", + } + } +} + +impl AsRef for GelatoIdNumberReportErrorCode { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoIdNumberReportErrorCode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoIdNumberReport`'s `id_number_type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoIdNumberReportIdNumberType { + BrCpf, + SgNric, + UsSsn, +} + +impl GelatoIdNumberReportIdNumberType { + pub fn as_str(self) -> &'static str { + match self { + GelatoIdNumberReportIdNumberType::BrCpf => "br_cpf", + GelatoIdNumberReportIdNumberType::SgNric => "sg_nric", + GelatoIdNumberReportIdNumberType::UsSsn => "us_ssn", + } + } +} + +impl AsRef for GelatoIdNumberReportIdNumberType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoIdNumberReportIdNumberType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoIdNumberReport`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoIdNumberReportStatus { + Unverified, + Verified, +} + +impl GelatoIdNumberReportStatus { + pub fn as_str(self) -> &'static str { + match self { + GelatoIdNumberReportStatus::Unverified => "unverified", + GelatoIdNumberReportStatus::Verified => "verified", + } + } +} + +impl AsRef for GelatoIdNumberReportStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoIdNumberReportStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoReportDocumentOptions`'s `allowed_types` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoReportDocumentOptionsAllowedTypes { + DrivingLicense, + IdCard, + Passport, +} + +impl GelatoReportDocumentOptionsAllowedTypes { + pub fn as_str(self) -> &'static str { + match self { + GelatoReportDocumentOptionsAllowedTypes::DrivingLicense => "driving_license", + GelatoReportDocumentOptionsAllowedTypes::IdCard => "id_card", + GelatoReportDocumentOptionsAllowedTypes::Passport => "passport", + } + } +} + +impl AsRef for GelatoReportDocumentOptionsAllowedTypes { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoReportDocumentOptionsAllowedTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoSelfieReportError`'s `code` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoSelfieReportErrorCode { + SelfieDocumentMissingPhoto, + SelfieFaceMismatch, + SelfieManipulated, + SelfieUnverifiedOther, +} + +impl GelatoSelfieReportErrorCode { + pub fn as_str(self) -> &'static str { + match self { + GelatoSelfieReportErrorCode::SelfieDocumentMissingPhoto => { + "selfie_document_missing_photo" + } + GelatoSelfieReportErrorCode::SelfieFaceMismatch => "selfie_face_mismatch", + GelatoSelfieReportErrorCode::SelfieManipulated => "selfie_manipulated", + GelatoSelfieReportErrorCode::SelfieUnverifiedOther => "selfie_unverified_other", + } + } +} + +impl AsRef for GelatoSelfieReportErrorCode { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoSelfieReportErrorCode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoSelfieReport`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoSelfieReportStatus { + Unverified, + Verified, +} + +impl GelatoSelfieReportStatus { + pub fn as_str(self) -> &'static str { + match self { + GelatoSelfieReportStatus::Unverified => "unverified", + GelatoSelfieReportStatus::Verified => "verified", + } + } +} + +impl AsRef for GelatoSelfieReportStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoSelfieReportStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `IdentityVerificationReport`'s `type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum IdentityVerificationReportType { + Document, + IdNumber, +} + +impl IdentityVerificationReportType { + pub fn as_str(self) -> &'static str { + match self { + IdentityVerificationReportType::Document => "document", + IdentityVerificationReportType::IdNumber => "id_number", + } + } +} + +impl AsRef for IdentityVerificationReportType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for IdentityVerificationReportType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/identity_verification_session.rs b/src/resources/generated/identity_verification_session.rs new file mode 100644 index 000000000..4cbaf4bab --- /dev/null +++ b/src/resources/generated/identity_verification_session.rs @@ -0,0 +1,393 @@ +// ====================================== +// This file was automatically generated. +// ====================================== + +use serde_derive::{Deserialize, Serialize}; + +use crate::ids::IdentityVerificationSessionId; +use crate::params::{Expandable, Metadata, Object, Timestamp}; +use crate::resources::{Address, IdentityVerificationReport}; + +/// The resource representing a Stripe "GelatoVerificationSession". +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct IdentityVerificationSession { + /// Unique identifier for the object. + pub id: IdentityVerificationSessionId, + + /// The short-lived client secret used by Stripe.js to [show a verification modal](https://stripe.com/docs/js/identity/modal) inside your app. + /// + /// This client secret expires after 24 hours and can only be used once. + /// Don’t store it, log it, embed it in a URL, or expose it to anyone other than the user. + /// Make sure that you have TLS enabled on any page that includes the client secret. + /// Refer to our docs on [passing the client secret to the frontend](https://stripe.com/docs/identity/verification-sessions#client-secret) to learn more. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_secret: Option, + + /// Time at which the object was created. + /// + /// Measured in seconds since the Unix epoch. + pub created: Timestamp, + + /// If present, this property tells you the last error encountered when processing the verification. + #[serde(skip_serializing_if = "Option::is_none")] + pub last_error: Option, + + /// ID of the most recent VerificationReport. + /// + /// [Learn more about accessing detailed verification results.](https://stripe.com/docs/identity/verification-sessions#results). + #[serde(skip_serializing_if = "Option::is_none")] + pub last_verification_report: 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, + + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// + /// This can be useful for storing additional information about the object in a structured format. + pub metadata: Metadata, + + pub options: GelatoVerificationSessionOptions, + + /// Redaction status of this VerificationSession. + /// + /// If the VerificationSession is not redacted, this field will be null. + #[serde(skip_serializing_if = "Option::is_none")] + pub redaction: Option, + + /// Status of this VerificationSession. + /// + /// [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). + pub status: IdentityVerificationSessionStatus, + + /// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. + #[serde(rename = "type")] + pub type_: IdentityVerificationSessionType, + + /// The short-lived URL that you use to redirect a user to Stripe to submit their identity information. + /// + /// This URL expires after 48 hours and can only be used once. + /// Don’t store it, log it, send it in emails or expose it to anyone other than the user. + /// Refer to our docs on [verifying identity documents](https://stripe.com/docs/identity/verify-identity-documents?platform=web&type=redirect) to learn how to redirect users to Stripe. + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, + + /// The user’s verified data. + #[serde(skip_serializing_if = "Option::is_none")] + pub verified_outputs: Option, +} + +impl Object for IdentityVerificationSession { + type Id = IdentityVerificationSessionId; + fn id(&self) -> Self::Id { + self.id.clone() + } + fn object(&self) -> &'static str { + "identity.verification_session" + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoSessionLastError { + /// A short machine-readable string giving the reason for the verification or user-session failure. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + + /// A message that explains the reason for verification or user-session failure. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoVerificationSessionOptions { + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoSessionDocumentOptions { + /// Array of strings of allowed identity document types. + /// + /// If the provided identity document isn’t one of the allowed types, the verification check will fail with a document_type_not_allowed error code. + #[serde(skip_serializing_if = "Option::is_none")] + pub allowed_types: Option>, + + /// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document’s extracted name and date of birth. + #[serde(skip_serializing_if = "Option::is_none")] + pub require_id_number: Option, + + /// Disable image uploads, identity document images have to be captured using the device’s camera. + #[serde(skip_serializing_if = "Option::is_none")] + pub require_live_capture: Option, + + /// Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user’s face. + /// + /// [Learn more](https://stripe.com/docs/identity/selfie). + #[serde(skip_serializing_if = "Option::is_none")] + pub require_matching_selfie: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoSessionIdNumberOptions {} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoVerifiedOutputs { + /// The user's verified address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option
, + + /// The user’s verified date of birth. + #[serde(skip_serializing_if = "Option::is_none")] + pub dob: Option, + + /// The user's verified first name. + #[serde(skip_serializing_if = "Option::is_none")] + pub first_name: Option, + + /// The user's verified id number. + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number: Option, + + /// The user's verified id number type. + #[serde(skip_serializing_if = "Option::is_none")] + pub id_number_type: Option, + + /// The user's verified last name. + #[serde(skip_serializing_if = "Option::is_none")] + pub last_name: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct GelatoDataVerifiedOutputsDate { + /// Numerical day between 1 and 31. + #[serde(skip_serializing_if = "Option::is_none")] + pub day: Option, + + /// Numerical month between 1 and 12. + #[serde(skip_serializing_if = "Option::is_none")] + pub month: Option, + + /// The four-digit year. + #[serde(skip_serializing_if = "Option::is_none")] + pub year: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct VerificationSessionRedaction { + /// Indicates whether this object and its related objects have been redacted or not. + pub status: VerificationSessionRedactionStatus, +} + +/// An enum representing the possible values of an `GelatoSessionDocumentOptions`'s `allowed_types` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoSessionDocumentOptionsAllowedTypes { + DrivingLicense, + IdCard, + Passport, +} + +impl GelatoSessionDocumentOptionsAllowedTypes { + pub fn as_str(self) -> &'static str { + match self { + GelatoSessionDocumentOptionsAllowedTypes::DrivingLicense => "driving_license", + GelatoSessionDocumentOptionsAllowedTypes::IdCard => "id_card", + GelatoSessionDocumentOptionsAllowedTypes::Passport => "passport", + } + } +} + +impl AsRef for GelatoSessionDocumentOptionsAllowedTypes { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoSessionDocumentOptionsAllowedTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoSessionLastError`'s `code` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoSessionLastErrorCode { + Abandoned, + ConsentDeclined, + CountryNotSupported, + DeviceNotSupported, + DocumentExpired, + DocumentTypeNotSupported, + DocumentUnverifiedOther, + IdNumberInsufficientDocumentData, + IdNumberMismatch, + IdNumberUnverifiedOther, + SelfieDocumentMissingPhoto, + SelfieFaceMismatch, + SelfieManipulated, + SelfieUnverifiedOther, + UnderSupportedAge, +} + +impl GelatoSessionLastErrorCode { + pub fn as_str(self) -> &'static str { + match self { + GelatoSessionLastErrorCode::Abandoned => "abandoned", + GelatoSessionLastErrorCode::ConsentDeclined => "consent_declined", + GelatoSessionLastErrorCode::CountryNotSupported => "country_not_supported", + GelatoSessionLastErrorCode::DeviceNotSupported => "device_not_supported", + GelatoSessionLastErrorCode::DocumentExpired => "document_expired", + GelatoSessionLastErrorCode::DocumentTypeNotSupported => "document_type_not_supported", + GelatoSessionLastErrorCode::DocumentUnverifiedOther => "document_unverified_other", + GelatoSessionLastErrorCode::IdNumberInsufficientDocumentData => { + "id_number_insufficient_document_data" + } + GelatoSessionLastErrorCode::IdNumberMismatch => "id_number_mismatch", + GelatoSessionLastErrorCode::IdNumberUnverifiedOther => "id_number_unverified_other", + GelatoSessionLastErrorCode::SelfieDocumentMissingPhoto => { + "selfie_document_missing_photo" + } + GelatoSessionLastErrorCode::SelfieFaceMismatch => "selfie_face_mismatch", + GelatoSessionLastErrorCode::SelfieManipulated => "selfie_manipulated", + GelatoSessionLastErrorCode::SelfieUnverifiedOther => "selfie_unverified_other", + GelatoSessionLastErrorCode::UnderSupportedAge => "under_supported_age", + } + } +} + +impl AsRef for GelatoSessionLastErrorCode { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoSessionLastErrorCode { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `GelatoVerifiedOutputs`'s `id_number_type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum GelatoVerifiedOutputsIdNumberType { + BrCpf, + SgNric, + UsSsn, +} + +impl GelatoVerifiedOutputsIdNumberType { + pub fn as_str(self) -> &'static str { + match self { + GelatoVerifiedOutputsIdNumberType::BrCpf => "br_cpf", + GelatoVerifiedOutputsIdNumberType::SgNric => "sg_nric", + GelatoVerifiedOutputsIdNumberType::UsSsn => "us_ssn", + } + } +} + +impl AsRef for GelatoVerifiedOutputsIdNumberType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for GelatoVerifiedOutputsIdNumberType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `IdentityVerificationSession`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum IdentityVerificationSessionStatus { + Canceled, + Processing, + RequiresInput, + Verified, +} + +impl IdentityVerificationSessionStatus { + pub fn as_str(self) -> &'static str { + match self { + IdentityVerificationSessionStatus::Canceled => "canceled", + IdentityVerificationSessionStatus::Processing => "processing", + IdentityVerificationSessionStatus::RequiresInput => "requires_input", + IdentityVerificationSessionStatus::Verified => "verified", + } + } +} + +impl AsRef for IdentityVerificationSessionStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for IdentityVerificationSessionStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `IdentityVerificationSession`'s `type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum IdentityVerificationSessionType { + Document, + IdNumber, +} + +impl IdentityVerificationSessionType { + pub fn as_str(self) -> &'static str { + match self { + IdentityVerificationSessionType::Document => "document", + IdentityVerificationSessionType::IdNumber => "id_number", + } + } +} + +impl AsRef for IdentityVerificationSessionType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for IdentityVerificationSessionType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `VerificationSessionRedaction`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum VerificationSessionRedactionStatus { + Processing, + Redacted, +} + +impl VerificationSessionRedactionStatus { + pub fn as_str(self) -> &'static str { + match self { + VerificationSessionRedactionStatus::Processing => "processing", + VerificationSessionRedactionStatus::Redacted => "redacted", + } + } +} + +impl AsRef for VerificationSessionRedactionStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for VerificationSessionRedactionStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/invoice.rs b/src/resources/generated/invoice.rs index eafef6502..a3ede1217 100644 --- a/src/resources/generated/invoice.rs +++ b/src/resources/generated/invoice.rs @@ -9,8 +9,8 @@ use crate::ids::{CustomerId, InvoiceId, SubscriptionId}; use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ Account, Address, ApiErrors, Charge, Currency, CustomField, Customer, Discount, - InvoiceLineItem, PaymentIntent, PaymentMethod, PaymentSource, Shipping, Subscription, TaxId, - TaxRate, + InvoiceLineItem, InvoicePaymentMethodOptionsBancontact, InvoicePaymentMethodOptionsCard, + PaymentIntent, PaymentMethod, PaymentSource, Quote, Shipping, Subscription, TaxId, TaxRate, }; /// The resource representing a Stripe "Invoice". @@ -75,6 +75,9 @@ pub struct Invoice { #[serde(skip_serializing_if = "Option::is_none")] pub auto_advance: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Indicates the reason why the invoice was created. /// /// `subscription_cycle` indicates an invoice created by a subscription advancing into a new period. @@ -311,6 +314,10 @@ pub struct Invoice { #[serde(skip_serializing_if = "Option::is_none")] pub pre_payment_credit_notes_amount: Option, + /// The quote this invoice was generated from. + #[serde(skip_serializing_if = "Option::is_none")] + pub quote: Option>, + /// This is the transaction number that appears on email receipts sent for this invoice. #[serde(skip_serializing_if = "Option::is_none")] pub receipt_number: Option, @@ -423,6 +430,16 @@ impl Object for Invoice { } } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct AutomaticTax { + /// Whether Stripe automatically computes tax on this invoice. + pub enabled: bool, + + /// The status of the most recent automated tax calculation for this invoice. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DiscountsResourceDiscountAmount { /// The amount, in %s, of the discount. @@ -509,25 +526,9 @@ pub struct InvoicesPaymentMethodOptions { pub card: Option, } -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct InvoicePaymentMethodOptionsBancontact { - /// Preferred language of the Bancontact authorization page that the customer is redirected to. - pub preferred_language: InvoicePaymentMethodOptionsBancontactPreferredLanguage, -} - -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct InvoicePaymentMethodOptionsCard { - /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). - /// - /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. - /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_three_d_secure: Option, -} - #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoicesResourceInvoiceTaxId { - /// The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `gb_vat`, `nz_gst`, `au_abn`, `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`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, or `unknown`. + /// The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `gb_vat`, `nz_gst`, `au_abn`, `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`, `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`, or `unknown`. #[serde(rename = "type")] pub type_: TaxIdType, @@ -577,6 +578,10 @@ pub struct CreateInvoice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub auto_advance: Option, + /// Settings for automatic tax lookup for this invoice. + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Either `charge_automatically`, or `send_invoice`. /// /// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. @@ -689,6 +694,7 @@ impl<'a> CreateInvoice<'a> { account_tax_ids: Default::default(), application_fee_amount: Default::default(), auto_advance: Default::default(), + automatic_tax: Default::default(), collection_method: Default::default(), custom_fields: Default::default(), customer, @@ -782,6 +788,11 @@ impl<'a> ListInvoices<'a> { } } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateInvoiceAutomaticTax { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateInvoiceDiscounts { #[serde(skip_serializing_if = "Option::is_none")] @@ -831,6 +842,37 @@ pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCard { Option, } +/// An enum representing the possible values of an `AutomaticTax`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum AutomaticTaxStatus { + Complete, + Failed, + RequiresLocationInputs, +} + +impl AutomaticTaxStatus { + pub fn as_str(self) -> &'static str { + match self { + AutomaticTaxStatus::Complete => "complete", + AutomaticTaxStatus::Failed => "failed", + AutomaticTaxStatus::RequiresLocationInputs => "requires_location_inputs", + } + } +} + +impl AsRef for AutomaticTaxStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for AutomaticTaxStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `Invoice`'s `collection_method` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -935,12 +977,14 @@ pub enum CreateInvoicePaymentSettingsPaymentMethodTypes { AuBecsDebit, BacsDebit, Bancontact, + Boleto, Card, Fpx, Giropay, Ideal, SepaDebit, Sofort, + WechatPay, } impl CreateInvoicePaymentSettingsPaymentMethodTypes { @@ -953,12 +997,14 @@ impl CreateInvoicePaymentSettingsPaymentMethodTypes { CreateInvoicePaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit", CreateInvoicePaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit", CreateInvoicePaymentSettingsPaymentMethodTypes::Bancontact => "bancontact", + CreateInvoicePaymentSettingsPaymentMethodTypes::Boleto => "boleto", CreateInvoicePaymentSettingsPaymentMethodTypes::Card => "card", CreateInvoicePaymentSettingsPaymentMethodTypes::Fpx => "fpx", CreateInvoicePaymentSettingsPaymentMethodTypes::Giropay => "giropay", CreateInvoicePaymentSettingsPaymentMethodTypes::Ideal => "ideal", CreateInvoicePaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit", CreateInvoicePaymentSettingsPaymentMethodTypes::Sofort => "sofort", + CreateInvoicePaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay", } } } @@ -981,6 +1027,7 @@ impl std::fmt::Display for CreateInvoicePaymentSettingsPaymentMethodTypes { pub enum InvoiceBillingReason { AutomaticPendingInvoiceItemInvoice, Manual, + QuoteAccept, Subscription, SubscriptionCreate, SubscriptionCycle, @@ -996,6 +1043,7 @@ impl InvoiceBillingReason { "automatic_pending_invoice_item_invoice" } InvoiceBillingReason::Manual => "manual", + InvoiceBillingReason::QuoteAccept => "quote_accept", InvoiceBillingReason::Subscription => "subscription", InvoiceBillingReason::SubscriptionCreate => "subscription_create", InvoiceBillingReason::SubscriptionCycle => "subscription_cycle", @@ -1049,68 +1097,6 @@ impl std::fmt::Display for InvoiceCustomerTaxExempt { } } -/// An enum representing the possible values of an `InvoicePaymentMethodOptionsBancontact`'s `preferred_language` field. -#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] -pub enum InvoicePaymentMethodOptionsBancontactPreferredLanguage { - De, - En, - Fr, - Nl, -} - -impl InvoicePaymentMethodOptionsBancontactPreferredLanguage { - pub fn as_str(self) -> &'static str { - match self { - InvoicePaymentMethodOptionsBancontactPreferredLanguage::De => "de", - InvoicePaymentMethodOptionsBancontactPreferredLanguage::En => "en", - InvoicePaymentMethodOptionsBancontactPreferredLanguage::Fr => "fr", - InvoicePaymentMethodOptionsBancontactPreferredLanguage::Nl => "nl", - } - } -} - -impl AsRef for InvoicePaymentMethodOptionsBancontactPreferredLanguage { - fn as_ref(&self) -> &str { - self.as_str() - } -} - -impl std::fmt::Display for InvoicePaymentMethodOptionsBancontactPreferredLanguage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - self.as_str().fmt(f) - } -} - -/// An enum representing the possible values of an `InvoicePaymentMethodOptionsCard`'s `request_three_d_secure` field. -#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] -#[serde(rename_all = "snake_case")] -pub enum InvoicePaymentMethodOptionsCardRequestThreeDSecure { - Any, - Automatic, -} - -impl InvoicePaymentMethodOptionsCardRequestThreeDSecure { - pub fn as_str(self) -> &'static str { - match self { - InvoicePaymentMethodOptionsCardRequestThreeDSecure::Any => "any", - InvoicePaymentMethodOptionsCardRequestThreeDSecure::Automatic => "automatic", - } - } -} - -impl AsRef for InvoicePaymentMethodOptionsCardRequestThreeDSecure { - fn as_ref(&self) -> &str { - self.as_str() - } -} - -impl std::fmt::Display for InvoicePaymentMethodOptionsCardRequestThreeDSecure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - self.as_str().fmt(f) - } -} - /// An enum representing the possible values of an `Invoice`'s `status` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1192,12 +1178,14 @@ pub enum InvoicesPaymentSettingsPaymentMethodTypes { AuBecsDebit, BacsDebit, Bancontact, + Boleto, Card, Fpx, Giropay, Ideal, SepaDebit, Sofort, + WechatPay, } impl InvoicesPaymentSettingsPaymentMethodTypes { @@ -1208,12 +1196,14 @@ impl InvoicesPaymentSettingsPaymentMethodTypes { InvoicesPaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit", InvoicesPaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit", InvoicesPaymentSettingsPaymentMethodTypes::Bancontact => "bancontact", + InvoicesPaymentSettingsPaymentMethodTypes::Boleto => "boleto", InvoicesPaymentSettingsPaymentMethodTypes::Card => "card", InvoicesPaymentSettingsPaymentMethodTypes::Fpx => "fpx", InvoicesPaymentSettingsPaymentMethodTypes::Giropay => "giropay", InvoicesPaymentSettingsPaymentMethodTypes::Ideal => "ideal", InvoicesPaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit", InvoicesPaymentSettingsPaymentMethodTypes::Sofort => "sofort", + InvoicesPaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay", } } } @@ -1239,6 +1229,10 @@ pub enum TaxIdType { BrCnpj, BrCpf, CaBn, + CaGstHst, + CaPstBc, + CaPstMb, + CaPstSk, CaQst, ChVat, ClTin, @@ -1247,6 +1241,7 @@ pub enum TaxIdType { GbVat, HkBr, IdNpwp, + IlVat, InGst, JpCn, JpRn, @@ -1278,6 +1273,10 @@ impl TaxIdType { TaxIdType::BrCnpj => "br_cnpj", TaxIdType::BrCpf => "br_cpf", TaxIdType::CaBn => "ca_bn", + TaxIdType::CaGstHst => "ca_gst_hst", + TaxIdType::CaPstBc => "ca_pst_bc", + TaxIdType::CaPstMb => "ca_pst_mb", + TaxIdType::CaPstSk => "ca_pst_sk", TaxIdType::CaQst => "ca_qst", TaxIdType::ChVat => "ch_vat", TaxIdType::ClTin => "cl_tin", @@ -1286,6 +1285,7 @@ impl TaxIdType { TaxIdType::GbVat => "gb_vat", TaxIdType::HkBr => "hk_br", TaxIdType::IdNpwp => "id_npwp", + TaxIdType::IlVat => "il_vat", TaxIdType::InGst => "in_gst", TaxIdType::JpCn => "jp_cn", TaxIdType::JpRn => "jp_rn", diff --git a/src/resources/generated/invoiceitem.rs b/src/resources/generated/invoiceitem.rs index 49c9fd1d3..7cc7e6fc4 100644 --- a/src/resources/generated/invoiceitem.rs +++ b/src/resources/generated/invoiceitem.rs @@ -472,6 +472,9 @@ pub struct InvoiceItemPriceData { pub product: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -487,3 +490,34 @@ pub struct UpdateInvoiceItemDiscounts { #[serde(skip_serializing_if = "Option::is_none")] pub discount: Option, } + +/// An enum representing the possible values of an `InvoiceItemPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum InvoiceItemPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl InvoiceItemPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + InvoiceItemPriceDataTaxBehavior::Exclusive => "exclusive", + InvoiceItemPriceDataTaxBehavior::Inclusive => "inclusive", + InvoiceItemPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for InvoiceItemPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for InvoiceItemPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/issuing_authorization.rs b/src/resources/generated/issuing_authorization.rs index 7a9ea26ea..6750e6909 100644 --- a/src/resources/generated/issuing_authorization.rs +++ b/src/resources/generated/issuing_authorization.rs @@ -95,7 +95,7 @@ pub struct IssuingAuthorization { pub verification_data: IssuingAuthorizationVerificationData, - /// What, if any, digital wallet was used for this authorization. + /// The digital wallet used for this authorization. /// /// One of `apple_pay`, `google_pay`, or `samsung_pay`. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/resources/generated/issuing_card.rs b/src/resources/generated/issuing_card.rs index 762e4c6f2..5c070d3b4 100644 --- a/src/resources/generated/issuing_card.rs +++ b/src/resources/generated/issuing_card.rs @@ -231,14 +231,18 @@ impl std::fmt::Display for IssuingCardReplacementReason { #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum IssuingCardShippingCarrier { + Dhl, Fedex, + RoyalMail, Usps, } impl IssuingCardShippingCarrier { pub fn as_str(self) -> &'static str { match self { + IssuingCardShippingCarrier::Dhl => "dhl", IssuingCardShippingCarrier::Fedex => "fedex", + IssuingCardShippingCarrier::RoyalMail => "royal_mail", IssuingCardShippingCarrier::Usps => "usps", } } diff --git a/src/resources/generated/issuing_transaction.rs b/src/resources/generated/issuing_transaction.rs index f544f17b3..8d39b61b5 100644 --- a/src/resources/generated/issuing_transaction.rs +++ b/src/resources/generated/issuing_transaction.rs @@ -82,6 +82,12 @@ pub struct IssuingTransaction { /// The nature of the transaction. #[serde(rename = "type")] pub type_: IssuingTransactionType, + + /// The digital wallet used for this transaction. + /// + /// One of `apple_pay`, `google_pay`, or `samsung_pay`. + #[serde(skip_serializing_if = "Option::is_none")] + pub wallet: Option, } impl Object for IssuingTransaction { @@ -226,3 +232,34 @@ pub struct IssuingTransactionReceiptData { #[serde(skip_serializing_if = "Option::is_none")] pub unit_cost: Option, } + +/// An enum representing the possible values of an `IssuingTransaction`'s `wallet` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum IssuingTransactionWallet { + ApplePay, + GooglePay, + SamsungPay, +} + +impl IssuingTransactionWallet { + pub fn as_str(self) -> &'static str { + match self { + IssuingTransactionWallet::ApplePay => "apple_pay", + IssuingTransactionWallet::GooglePay => "google_pay", + IssuingTransactionWallet::SamsungPay => "samsung_pay", + } + } +} + +impl AsRef for IssuingTransactionWallet { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for IssuingTransactionWallet { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/mandate.rs b/src/resources/generated/mandate.rs index 802696dec..261c74031 100644 --- a/src/resources/generated/mandate.rs +++ b/src/resources/generated/mandate.rs @@ -112,7 +112,7 @@ pub struct CardMandatePaymentMethodDetails {} pub struct MandateAcssDebit { /// Description of the interval. /// - /// Only required if 'payment_schedule' parmeter is 'interval' or 'combined'. + /// Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] pub interval_description: Option, diff --git a/src/resources/generated/payment_intent.rs b/src/resources/generated/payment_intent.rs index c5cdfafe7..e9630d6ef 100644 --- a/src/resources/generated/payment_intent.rs +++ b/src/resources/generated/payment_intent.rs @@ -9,7 +9,8 @@ use crate::ids::{CustomerId, MandateId, PaymentIntentId, PaymentMethodId}; use crate::params::{Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ Account, ApiErrors, Application, Charge, Currency, Customer, Invoice, PaymentIntentOffSession, - PaymentMethod, PaymentMethodDetailsCardInstallmentsPlan, Review, Shipping, ShippingParams, + PaymentMethod, PaymentMethodDetailsCardInstallmentsPlan, PaymentMethodOptionsBoleto, + PaymentMethodOptionsOxxo, Review, Shipping, ShippingParams, }; /// The resource representing a Stripe "PaymentIntent". @@ -255,6 +256,9 @@ pub struct PaymentIntentNextAction { #[serde(skip_serializing_if = "Option::is_none")] pub alipay_handle_redirect: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto_display_details: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub oxxo_display_details: Option, @@ -273,6 +277,16 @@ pub struct PaymentIntentNextAction { #[serde(skip_serializing_if = "Option::is_none")] pub verify_with_microdeposits: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay_display_qr_code: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay_redirect_to_android_app: + Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay_redirect_to_ios_app: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -294,6 +308,25 @@ pub struct PaymentIntentNextActionAlipayHandleRedirect { pub url: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentIntentNextActionBoleto { + /// The timestamp after which the boleto expires. + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_at: Option, + + /// The URL to the hosted boleto voucher page, which allows customers to view the boleto voucher. + #[serde(skip_serializing_if = "Option::is_none")] + pub hosted_voucher_url: Option, + + /// The boleto number. + #[serde(skip_serializing_if = "Option::is_none")] + pub number: Option, + + /// The URL to the downloadable boleto voucher PDF. + #[serde(skip_serializing_if = "Option::is_none")] + pub pdf: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentIntentNextActionDisplayOxxoDetails { /// The timestamp after which the OXXO voucher expires. @@ -329,20 +362,71 @@ pub struct PaymentIntentNextActionVerifyWithMicrodeposits { pub hosted_verification_url: String, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentIntentNextActionWechatPayDisplayQrCode { + /// The data being used to generate QR code. + pub data: String, + + /// The base64 image data for a pre-generated QR code. + pub image_data_url: String, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentIntentNextActionWechatPayRedirectToAndroidApp { + /// app_id is the APP ID registered on WeChat open platform. + pub app_id: String, + + /// nonce_str is a random string. + pub nonce_str: String, + + /// package is static value. + pub package: String, + + /// an unique merchant ID assigned by Wechat Pay. + pub partner_id: String, + + /// an unique trading ID assigned by Wechat Pay. + pub prepay_id: String, + + /// A signature. + pub sign: String, + + /// Specifies the current time in epoch format. + pub timestamp: String, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentIntentNextActionWechatPayRedirectToIosApp { + /// An universal link that redirect to Wechat Pay APP. + pub native_url: String, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub afterpay_clearpay: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub alipay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub card_present: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub ideal: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub oxxo: Option, @@ -354,6 +438,9 @@ pub struct PaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -374,9 +461,9 @@ pub struct PaymentIntentPaymentMethodOptionsCard { #[serde(skip_serializing_if = "Option::is_none")] pub installments: Option, - /// Selected network to process this PaymentIntent on. + /// Selected network to process this payment intent on. /// - /// Depends on the available networks of the card attached to the PaymentIntent. + /// Depends on the available networks of the card attached to the payment intent. /// Can be only set confirm-time. #[serde(skip_serializing_if = "Option::is_none")] pub network: Option, @@ -399,7 +486,7 @@ pub struct PaymentIntentPaymentMethodOptionsMandateOptionsAcssDebit { /// Description of the interval. /// - /// Only required if 'payment_schedule' parmeter is 'interval' or 'combined'. + /// Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] pub interval_description: Option, @@ -423,6 +510,16 @@ pub struct PaymentIntentPaymentMethodOptionsSepaDebit { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentIntentPaymentMethodOptionsMandateOptionsSepaDebit {} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodOptionsAfterpayClearpay { + /// Order identifier shown to the merchant in Afterpay’s online portal. + /// + /// We recommend using a value that helps you answer any questions a customer might have about the payment. + /// The identifier is limited to 128 characters and may contain only letters, digits, underscores, backslashes and dashes. + #[serde(skip_serializing_if = "Option::is_none")] + pub reference: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentMethodOptionsAlipay {} @@ -447,12 +544,10 @@ pub struct PaymentMethodOptionsCardInstallments { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct PaymentMethodOptionsOxxo { - /// The number of calendar days before an OXXO invoice expires. - /// - /// For example, if you create an OXXO invoice on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. - pub expires_after_days: u32, -} +pub struct PaymentMethodOptionsCardPresent {} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodOptionsIdeal {} #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentMethodOptionsP24 {} @@ -464,6 +559,19 @@ pub struct PaymentMethodOptionsSofort { pub preferred_language: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodOptionsWechatPay { + /// The app ID registered with WeChat Pay. + /// + /// Only required when client is ios or android. + #[serde(skip_serializing_if = "Option::is_none")] + pub app_id: Option, + + /// The client type that the end customer will pay from. + #[serde(skip_serializing_if = "Option::is_none")] + pub client: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TransferData { /// Amount intended to be collected by this PaymentIntent. @@ -907,6 +1015,9 @@ pub struct CreatePaymentIntentPaymentMethodData { #[serde(skip_serializing_if = "Option::is_none")] pub billing_details: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub eps: Option, @@ -942,6 +1053,9 @@ pub struct CreatePaymentIntentPaymentMethodData { #[serde(rename = "type")] pub type_: CreatePaymentIntentPaymentMethodDataType, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -949,15 +1063,27 @@ pub struct CreatePaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub afterpay_clearpay: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub alipay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub card_present: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub ideal: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub oxxo: Option, @@ -969,6 +1095,9 @@ pub struct CreatePaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1002,6 +1131,9 @@ pub struct UpdatePaymentIntentPaymentMethodData { #[serde(skip_serializing_if = "Option::is_none")] pub billing_details: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub eps: Option, @@ -1037,6 +1169,9 @@ pub struct UpdatePaymentIntentPaymentMethodData { #[serde(rename = "type")] pub type_: UpdatePaymentIntentPaymentMethodDataType, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1044,15 +1179,27 @@ pub struct UpdatePaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub afterpay_clearpay: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub alipay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub card_present: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub ideal: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub oxxo: Option, @@ -1064,6 +1211,9 @@ pub struct UpdatePaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub sofort: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -1136,6 +1286,11 @@ pub struct CreatePaymentIntentPaymentMethodDataBillingDetails { pub phone: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodDataBoleto { + pub tax_id: String, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentIntentPaymentMethodDataEps { #[serde(skip_serializing_if = "Option::is_none")] @@ -1181,6 +1336,9 @@ pub struct CreatePaymentIntentPaymentMethodDataSofort { pub country: CreatePaymentIntentPaymentMethodDataSofortCountry, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodDataWechatPay {} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit { #[serde(skip_serializing_if = "Option::is_none")] @@ -1191,6 +1349,12 @@ pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay { + #[serde(skip_serializing_if = "Option::is_none")] + pub reference: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentIntentPaymentMethodOptionsAlipay {} @@ -1201,6 +1365,12 @@ pub struct CreatePaymentIntentPaymentMethodOptionsBancontact { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodOptionsBoleto { + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_after_days: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentIntentPaymentMethodOptionsCard { #[serde(skip_serializing_if = "Option::is_none")] @@ -1217,6 +1387,12 @@ pub struct CreatePaymentIntentPaymentMethodOptionsCard { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodOptionsCardPresent {} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodOptionsIdeal {} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentIntentPaymentMethodOptionsOxxo { #[serde(skip_serializing_if = "Option::is_none")] @@ -1241,6 +1417,14 @@ pub struct CreatePaymentIntentPaymentMethodOptionsSofort { pub preferred_language: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentIntentPaymentMethodOptionsWechatPay { + #[serde(skip_serializing_if = "Option::is_none")] + pub app_id: Option, + + pub client: CreatePaymentIntentPaymentMethodOptionsWechatPayClient, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdatePaymentIntentPaymentMethodDataAcssDebit { pub account_number: String, @@ -1290,6 +1474,11 @@ pub struct UpdatePaymentIntentPaymentMethodDataBillingDetails { pub phone: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodDataBoleto { + pub tax_id: String, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdatePaymentIntentPaymentMethodDataEps { #[serde(skip_serializing_if = "Option::is_none")] @@ -1335,6 +1524,9 @@ pub struct UpdatePaymentIntentPaymentMethodDataSofort { pub country: UpdatePaymentIntentPaymentMethodDataSofortCountry, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodDataWechatPay {} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit { #[serde(skip_serializing_if = "Option::is_none")] @@ -1345,6 +1537,12 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay { + #[serde(skip_serializing_if = "Option::is_none")] + pub reference: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdatePaymentIntentPaymentMethodOptionsAlipay {} @@ -1355,6 +1553,12 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsBancontact { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodOptionsBoleto { + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_after_days: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdatePaymentIntentPaymentMethodOptionsCard { #[serde(skip_serializing_if = "Option::is_none")] @@ -1371,6 +1575,12 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsCard { Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodOptionsCardPresent {} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodOptionsIdeal {} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdatePaymentIntentPaymentMethodOptionsOxxo { #[serde(skip_serializing_if = "Option::is_none")] @@ -1395,6 +1605,14 @@ pub struct UpdatePaymentIntentPaymentMethodOptionsSofort { pub preferred_language: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdatePaymentIntentPaymentMethodOptionsWechatPay { + #[serde(skip_serializing_if = "Option::is_none")] + pub app_id: Option, + + pub client: UpdatePaymentIntentPaymentMethodOptionsWechatPayClient, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentIntentMandateDataCustomerAcceptanceOffline {} @@ -1911,6 +2129,7 @@ pub enum CreatePaymentIntentPaymentMethodDataType { AuBecsDebit, BacsDebit, Bancontact, + Boleto, Eps, Fpx, Giropay, @@ -1920,6 +2139,7 @@ pub enum CreatePaymentIntentPaymentMethodDataType { P24, SepaDebit, Sofort, + WechatPay, } impl CreatePaymentIntentPaymentMethodDataType { @@ -1931,6 +2151,7 @@ impl CreatePaymentIntentPaymentMethodDataType { CreatePaymentIntentPaymentMethodDataType::AuBecsDebit => "au_becs_debit", CreatePaymentIntentPaymentMethodDataType::BacsDebit => "bacs_debit", CreatePaymentIntentPaymentMethodDataType::Bancontact => "bancontact", + CreatePaymentIntentPaymentMethodDataType::Boleto => "boleto", CreatePaymentIntentPaymentMethodDataType::Eps => "eps", CreatePaymentIntentPaymentMethodDataType::Fpx => "fpx", CreatePaymentIntentPaymentMethodDataType::Giropay => "giropay", @@ -1940,6 +2161,7 @@ impl CreatePaymentIntentPaymentMethodDataType { CreatePaymentIntentPaymentMethodDataType::P24 => "p24", CreatePaymentIntentPaymentMethodDataType::SepaDebit => "sepa_debit", CreatePaymentIntentPaymentMethodDataType::Sofort => "sofort", + CreatePaymentIntentPaymentMethodDataType::WechatPay => "wechat_pay", } } } @@ -2263,6 +2485,37 @@ impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSofortPreferre } } +/// An enum representing the possible values of an `CreatePaymentIntentPaymentMethodOptionsWechatPay`'s `client` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreatePaymentIntentPaymentMethodOptionsWechatPayClient { + Android, + Ios, + Web, +} + +impl CreatePaymentIntentPaymentMethodOptionsWechatPayClient { + pub fn as_str(self) -> &'static str { + match self { + CreatePaymentIntentPaymentMethodOptionsWechatPayClient::Android => "android", + CreatePaymentIntentPaymentMethodOptionsWechatPayClient::Ios => "ios", + CreatePaymentIntentPaymentMethodOptionsWechatPayClient::Web => "web", + } + } +} + +impl AsRef for CreatePaymentIntentPaymentMethodOptionsWechatPayClient { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsWechatPayClient { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `PaymentIntent`'s `cancellation_reason` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -2710,6 +2963,37 @@ impl std::fmt::Display for PaymentMethodOptionsSofortPreferredLanguage { } } +/// An enum representing the possible values of an `PaymentMethodOptionsWechatPay`'s `client` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum PaymentMethodOptionsWechatPayClient { + Android, + Ios, + Web, +} + +impl PaymentMethodOptionsWechatPayClient { + pub fn as_str(self) -> &'static str { + match self { + PaymentMethodOptionsWechatPayClient::Android => "android", + PaymentMethodOptionsWechatPayClient::Ios => "ios", + PaymentMethodOptionsWechatPayClient::Web => "web", + } + } +} + +impl AsRef for PaymentMethodOptionsWechatPayClient { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for PaymentMethodOptionsWechatPayClient { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `UpdatePaymentIntentPaymentMethodDataEps`'s `bank` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -3067,6 +3351,7 @@ pub enum UpdatePaymentIntentPaymentMethodDataType { AuBecsDebit, BacsDebit, Bancontact, + Boleto, Eps, Fpx, Giropay, @@ -3076,6 +3361,7 @@ pub enum UpdatePaymentIntentPaymentMethodDataType { P24, SepaDebit, Sofort, + WechatPay, } impl UpdatePaymentIntentPaymentMethodDataType { @@ -3087,6 +3373,7 @@ impl UpdatePaymentIntentPaymentMethodDataType { UpdatePaymentIntentPaymentMethodDataType::AuBecsDebit => "au_becs_debit", UpdatePaymentIntentPaymentMethodDataType::BacsDebit => "bacs_debit", UpdatePaymentIntentPaymentMethodDataType::Bancontact => "bancontact", + UpdatePaymentIntentPaymentMethodDataType::Boleto => "boleto", UpdatePaymentIntentPaymentMethodDataType::Eps => "eps", UpdatePaymentIntentPaymentMethodDataType::Fpx => "fpx", UpdatePaymentIntentPaymentMethodDataType::Giropay => "giropay", @@ -3096,6 +3383,7 @@ impl UpdatePaymentIntentPaymentMethodDataType { UpdatePaymentIntentPaymentMethodDataType::P24 => "p24", UpdatePaymentIntentPaymentMethodDataType::SepaDebit => "sepa_debit", UpdatePaymentIntentPaymentMethodDataType::Sofort => "sofort", + UpdatePaymentIntentPaymentMethodDataType::WechatPay => "wechat_pay", } } } @@ -3418,3 +3706,34 @@ impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSofortPreferre self.as_str().fmt(f) } } + +/// An enum representing the possible values of an `UpdatePaymentIntentPaymentMethodOptionsWechatPay`'s `client` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { + Android, + Ios, + Web, +} + +impl UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { + pub fn as_str(self) -> &'static str { + match self { + UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::Android => "android", + UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::Ios => "ios", + UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::Web => "web", + } + } +} + +impl AsRef for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/payment_method.rs b/src/resources/generated/payment_method.rs index 354b03a0a..7d9f2468c 100644 --- a/src/resources/generated/payment_method.rs +++ b/src/resources/generated/payment_method.rs @@ -39,6 +39,9 @@ pub struct PaymentMethod { pub billing_details: BillingDetails, + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, @@ -101,6 +104,9 @@ pub struct PaymentMethod { /// It contains additional information specific to the PaymentMethod type. #[serde(rename = "type")] pub type_: PaymentMethodType, + + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } impl PaymentMethod { @@ -111,7 +117,7 @@ impl PaymentMethod { /// Creates a PaymentMethod object. /// - /// Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js. + /// Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js. Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents](https://stripe.com/docs/payments/accept-a-payment) API to accept a payment immediately or the [SetupIntent](https://stripe.com/docs/payments/save-and-reuse) API to collect payment method details ahead of a future payment. pub fn create(client: &Client, params: CreatePaymentMethod<'_>) -> Response { client.post_form("/payment_methods", ¶ms) } @@ -217,6 +223,12 @@ pub struct PaymentMethodBacsDebit { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PaymentMethodBancontact {} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodBoleto { + /// Uniquely identifies the customer tax id (CNPJ or CPF). + pub tax_id: String, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CardDetails { /// Card brand. @@ -518,6 +530,9 @@ pub struct PaymentMethodSofort { pub country: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct PaymentMethodWechatPay {} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SepaDebitGeneratedFrom { /// The ID of the Charge that generated this PaymentMethod, if any. @@ -566,6 +581,10 @@ pub struct CreatePaymentMethod<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub billing_details: Option, + /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto: Option, + /// The `Customer` to whom the original PaymentMethod is attached. #[serde(skip_serializing_if = "Option::is_none")] pub customer: Option, @@ -633,6 +652,10 @@ pub struct CreatePaymentMethod<'a> { #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] pub type_: Option, + + /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method. + #[serde(skip_serializing_if = "Option::is_none")] + pub wechat_pay: Option, } impl<'a> CreatePaymentMethod<'a> { @@ -645,6 +668,7 @@ impl<'a> CreatePaymentMethod<'a> { bacs_debit: Default::default(), bancontact: Default::default(), billing_details: Default::default(), + boleto: Default::default(), customer: Default::default(), eps: Default::default(), expand: Default::default(), @@ -660,6 +684,7 @@ impl<'a> CreatePaymentMethod<'a> { sepa_debit: Default::default(), sofort: Default::default(), type_: Default::default(), + wechat_pay: Default::default(), } } } @@ -776,6 +801,11 @@ pub struct CreatePaymentMethodBacsDebit { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentMethodBancontact {} +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentMethodBoleto { + pub tax_id: String, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreatePaymentMethodEps { #[serde(skip_serializing_if = "Option::is_none")] @@ -821,6 +851,9 @@ pub struct CreatePaymentMethodSofort { pub country: CreatePaymentMethodSofortCountry, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreatePaymentMethodWechatPay {} + /// An enum representing the possible values of an `CreatePaymentMethodEps`'s `bank` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1502,6 +1535,7 @@ pub enum PaymentMethodType { AuBecsDebit, BacsDebit, Bancontact, + Boleto, Card, CardPresent, Eps, @@ -1514,6 +1548,7 @@ pub enum PaymentMethodType { P24, SepaDebit, Sofort, + WechatPay, } impl PaymentMethodType { @@ -1525,6 +1560,7 @@ impl PaymentMethodType { PaymentMethodType::AuBecsDebit => "au_becs_debit", PaymentMethodType::BacsDebit => "bacs_debit", PaymentMethodType::Bancontact => "bancontact", + PaymentMethodType::Boleto => "boleto", PaymentMethodType::Card => "card", PaymentMethodType::CardPresent => "card_present", PaymentMethodType::Eps => "eps", @@ -1537,6 +1573,7 @@ impl PaymentMethodType { PaymentMethodType::P24 => "p24", PaymentMethodType::SepaDebit => "sepa_debit", PaymentMethodType::Sofort => "sofort", + PaymentMethodType::WechatPay => "wechat_pay", } } } @@ -1563,6 +1600,7 @@ pub enum PaymentMethodTypeFilter { AuBecsDebit, BacsDebit, Bancontact, + Boleto, Card, Eps, Fpx, @@ -1573,6 +1611,7 @@ pub enum PaymentMethodTypeFilter { P24, SepaDebit, Sofort, + WechatPay, } impl PaymentMethodTypeFilter { @@ -1584,6 +1623,7 @@ impl PaymentMethodTypeFilter { PaymentMethodTypeFilter::AuBecsDebit => "au_becs_debit", PaymentMethodTypeFilter::BacsDebit => "bacs_debit", PaymentMethodTypeFilter::Bancontact => "bancontact", + PaymentMethodTypeFilter::Boleto => "boleto", PaymentMethodTypeFilter::Card => "card", PaymentMethodTypeFilter::Eps => "eps", PaymentMethodTypeFilter::Fpx => "fpx", @@ -1594,6 +1634,7 @@ impl PaymentMethodTypeFilter { PaymentMethodTypeFilter::P24 => "p24", PaymentMethodTypeFilter::SepaDebit => "sepa_debit", PaymentMethodTypeFilter::Sofort => "sofort", + PaymentMethodTypeFilter::WechatPay => "wechat_pay", } } } diff --git a/src/resources/generated/person.rs b/src/resources/generated/person.rs index 8db28773a..0aa3d8efc 100644 --- a/src/resources/generated/person.rs +++ b/src/resources/generated/person.rs @@ -217,23 +217,23 @@ pub struct PersonRequirements { /// If not collected by the account's `current_deadline`, these fields appear in `past_due` as well, and the account is disabled. pub currently_due: Vec, - /// The fields that are `currently_due` and need to be collected again because validation or verification failed for some reason. + /// Fields that are `currently_due` and need to be collected again because validation or verification failed. pub errors: Vec, /// Fields that need to be collected assuming all volume thresholds are reached. /// - /// As fields are needed, they are moved to `currently_due` and the account's `current_deadline` is set. + /// As they become required, they appear in `currently_due` as well, and the account's `current_deadline` becomes set. pub eventually_due: Vec, /// Fields that weren't collected by the account's `current_deadline`. /// - /// These fields need to be collected to enable payouts for the person's account. + /// These fields need to be collected to enable the person's account. pub past_due: Vec, /// Fields that may become required depending on the results of verification or review. /// - /// An empty array unless an asynchronous verification is pending. - /// If verification fails, the fields in this array become required and move to `currently_due` or `past_due`. + /// Will be an empty array unless an asynchronous verification is pending. + /// If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. pub pending_verification: Vec, } diff --git a/src/resources/generated/price.rs b/src/resources/generated/price.rs index 8862ca37e..30013c785 100644 --- a/src/resources/generated/price.rs +++ b/src/resources/generated/price.rs @@ -73,6 +73,13 @@ pub struct Price { #[serde(skip_serializing_if = "Option::is_none")] pub recurring: Option, + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. + /// + /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + /// Each element represents a pricing tier. /// /// This parameter requires `billing_scheme` to be set to `tiered`. @@ -261,6 +268,13 @@ pub struct CreatePrice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub recurring: Option, + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. + /// + /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + /// Each element represents a pricing tier. /// /// This parameter requires `billing_scheme` to be set to `tiered`. @@ -308,6 +322,7 @@ impl<'a> CreatePrice<'a> { product: Default::default(), product_data: Default::default(), recurring: Default::default(), + tax_behavior: Default::default(), tiers: Default::default(), tiers_mode: Default::default(), transfer_lookup_key: Default::default(), @@ -424,6 +439,13 @@ pub struct UpdatePrice<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub nickname: Option<&'a str>, + /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. + /// + /// One of `inclusive`, `exclusive`, or `unspecified`. + /// Once specified as either `inclusive` or `exclusive`, it cannot be changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + /// If set to true, will atomically remove the lookup key from the existing price, and assign it to this price. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_lookup_key: Option, @@ -437,6 +459,7 @@ impl<'a> UpdatePrice<'a> { lookup_key: Default::default(), metadata: Default::default(), nickname: Default::default(), + tax_behavior: Default::default(), transfer_lookup_key: Default::default(), } } @@ -458,6 +481,9 @@ pub struct CreatePriceProductData { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_label: Option, } @@ -724,6 +750,37 @@ impl std::fmt::Display for PriceBillingScheme { } } +/// An enum representing the possible values of an `Price`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum PriceTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl PriceTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + PriceTaxBehavior::Exclusive => "exclusive", + PriceTaxBehavior::Inclusive => "inclusive", + PriceTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for PriceTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for PriceTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `Price`'s `tiers_mode` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] diff --git a/src/resources/generated/product.rs b/src/resources/generated/product.rs index 5eff0cb83..8443046aa 100644 --- a/src/resources/generated/product.rs +++ b/src/resources/generated/product.rs @@ -5,9 +5,9 @@ use serde_derive::{Deserialize, Serialize}; use crate::config::{Client, Response}; -use crate::ids::ProductId; -use crate::params::{Deleted, Expand, List, Metadata, Object, RangeQuery, Timestamp}; -use crate::resources::PackageDimensions; +use crate::ids::{ProductId, TaxCodeId}; +use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; +use crate::resources::{PackageDimensions, TaxCode}; /// The resource representing a Stripe "Product". /// @@ -71,6 +71,10 @@ pub struct Product { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option, + /// A [tax code](https://stripe.com/docs/tax/tax-codes) ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option>, + /// A label that represents units of this product in Stripe and on customers’ receipts and invoices. /// /// When set, this will be included in associated invoice line item descriptions. @@ -192,6 +196,10 @@ pub struct CreateProduct<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, + /// A [tax code](https://stripe.com/docs/tax/tax-codes) ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option, + /// A label that represents units of this product in Stripe and on customers’ receipts and invoices. /// /// When set, this will be included in associated invoice line item descriptions. @@ -216,6 +224,7 @@ impl<'a> CreateProduct<'a> { package_dimensions: Default::default(), shippable: Default::default(), statement_descriptor: Default::default(), + tax_code: Default::default(), unit_label: Default::default(), url: Default::default(), } @@ -338,6 +347,10 @@ pub struct UpdateProduct<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option<&'a str>, + /// A [tax code](https://stripe.com/docs/tax/tax-codes) ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_code: Option, + /// A label that represents units of this product in Stripe and on customers’ receipts and invoices. /// /// When set, this will be included in associated invoice line item descriptions. @@ -362,6 +375,7 @@ impl<'a> UpdateProduct<'a> { package_dimensions: Default::default(), shippable: Default::default(), statement_descriptor: Default::default(), + tax_code: Default::default(), unit_label: Default::default(), url: Default::default(), } diff --git a/src/resources/generated/quote.rs b/src/resources/generated/quote.rs new file mode 100644 index 000000000..8d78b9322 --- /dev/null +++ b/src/resources/generated/quote.rs @@ -0,0 +1,482 @@ +// ====================================== +// This file was automatically generated. +// ====================================== + +use serde_derive::{Deserialize, Serialize}; + +use crate::config::{Client, Response}; +use crate::ids::{CustomerId, QuoteId}; +use crate::params::{Expand, Expandable, List, Metadata, Object, Timestamp}; +use crate::resources::{ + Account, CheckoutSessionItem, Currency, Customer, Discount, Invoice, Quote, + QuotesResourceTotalDetails, Subscription, SubscriptionSchedule, TaxRate, +}; + +/// The resource representing a Stripe "Quote". +/// +/// For more details see +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Quote { + /// Unique identifier for the object. + pub id: QuoteId, + + /// Total before any discounts or taxes are applied. + pub amount_subtotal: i64, + + /// Total after discounts and taxes are applied. + pub amount_total: i64, + + /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. + /// + /// Only applicable if there are no line items with recurring prices on the quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub application_fee_amount: Option, + + /// A non-negative decimal between 0 and 100, with at most two decimal places. + /// + /// This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. + /// Only applicable if there are line items with recurring prices on the quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub application_fee_percent: Option, + + pub automatic_tax: QuotesResourceAutomaticTax, + + /// Either `charge_automatically`, or `send_invoice`. + /// + /// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. + /// When sending an invoice, Stripe will email your customer an invoice with payment instructions. + /// Defaults to `charge_automatically`. + pub collection_method: QuoteCollectionMethod, + + pub computed: QuotesResourceComputed, + + /// Time at which the object was created. + /// + /// Measured in seconds since the Unix epoch. + pub created: Timestamp, + + /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. + /// + /// Must be a [supported currency](https://stripe.com/docs/currencies). + #[serde(skip_serializing_if = "Option::is_none")] + pub currency: Option, + + /// The customer which this quote belongs to. + /// + /// A customer is required before finalizing the quote. + /// Once specified, it cannot be changed. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option>, + + /// The tax rates applied to this quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_tax_rates: Option>>, + + /// A description that will be displayed on the quote PDF. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + + /// The discounts applied to this quote. + pub discounts: Vec>, + + /// The date on which the quote will be canceled if in `open` or `draft` status. + /// + /// Measured in seconds since the Unix epoch. + pub expires_at: Timestamp, + + /// A footer that will be displayed on the quote PDF. + #[serde(skip_serializing_if = "Option::is_none")] + pub footer: Option, + + /// Details of the quote that was cloned. + /// + /// See the [cloning documentation](https://stripe.com/docs/quotes/clone) for more details. + #[serde(skip_serializing_if = "Option::is_none")] + pub from_quote: Option, + + /// A header that will be displayed on the quote PDF. + #[serde(skip_serializing_if = "Option::is_none")] + pub header: Option, + + /// The invoice that was created from this quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice: Option>, + + /// All invoices will be billed using the specified settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub invoice_settings: Option, + + /// A list of items the customer is being quoted for. + #[serde(default)] + pub line_items: List, + + /// 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, + + /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. + /// + /// This can be useful for storing additional information about the object in a structured format. + pub metadata: Metadata, + + /// A unique number that identifies this particular quote. + /// + /// This number is assigned once the quote is [finalized](https://stripe.com/docs/quotes/overview#finalize). + #[serde(skip_serializing_if = "Option::is_none")] + pub number: Option, + + /// The account on behalf of which to charge. + /// + /// See the [Connect documentation](https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details. + #[serde(skip_serializing_if = "Option::is_none")] + pub on_behalf_of: Option>, + + /// The status of the quote. + pub status: QuoteStatus, + + pub status_transitions: QuotesResourceStatusTransitions, + + /// The subscription that was created or updated from this quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription: Option>, + + pub subscription_data: QuotesResourceSubscriptionData, + + /// The subscription schedule that was created or updated from this quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub subscription_schedule: Option>, + + pub total_details: QuotesResourceTotalDetails, + + /// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. + #[serde(skip_serializing_if = "Option::is_none")] + pub transfer_data: Option, +} + +impl Quote { + /// Returns a list of your quotes. + pub fn list(client: &Client, params: ListQuotes<'_>) -> Response> { + client.get_query("/quotes", ¶ms) + } + + /// Retrieves the quote with the given ID. + pub fn retrieve(client: &Client, id: &QuoteId, expand: &[&str]) -> Response { + client.get_query(&format!("/quotes/{}", id), &Expand { expand }) + } +} + +impl Object for Quote { + type Id = QuoteId; + fn id(&self) -> Self::Id { + self.id.clone() + } + fn object(&self) -> &'static str { + "quote" + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct InvoiceSettingQuoteSetting { + /// Number of days within which a customer must pay invoices generated by this quote. + /// + /// This value will be `null` for quotes where `collection_method=charge_automatically`. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceAutomaticTax { + /// Automatically calculate taxes. + pub enabled: bool, + + /// The status of the most recent automated tax calculation for this quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceComputed { + /// The definitive totals and line items the customer will be charged on a recurring basis. + /// + /// Takes into account the line items with recurring prices and discounts with `duration=forever` coupons only. + /// Defaults to `null` if no inputted line items with recurring prices. + #[serde(skip_serializing_if = "Option::is_none")] + pub recurring: Option, + + pub upfront: QuotesResourceUpfront, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceFromQuote { + /// Whether this quote is a revision of a different quote. + pub is_revision: bool, + + /// The quote that was cloned. + pub quote: Expandable, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceRecurring { + /// Total before any discounts or taxes are applied. + pub amount_subtotal: i64, + + /// Total after discounts and taxes are applied. + pub amount_total: i64, + + /// The frequency at which a subscription is billed. + /// + /// One of `day`, `week`, `month` or `year`. + pub interval: QuotesResourceRecurringInterval, + + /// The number of intervals (specified in the `interval` attribute) between subscription billings. + /// + /// For example, `interval=month` and `interval_count=3` bills every 3 months. + pub interval_count: u64, + + pub total_details: QuotesResourceTotalDetails, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceStatusTransitions { + /// The time that the quote was accepted. + /// + /// Measured in seconds since Unix epoch. + #[serde(skip_serializing_if = "Option::is_none")] + pub accepted_at: Option, + + /// The time that the quote was canceled. + /// + /// Measured in seconds since Unix epoch. + #[serde(skip_serializing_if = "Option::is_none")] + pub canceled_at: Option, + + /// The time that the quote was finalized. + /// + /// Measured in seconds since Unix epoch. + #[serde(skip_serializing_if = "Option::is_none")] + pub finalized_at: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceSubscriptionData { + /// When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. + /// + /// This date is ignored if it is in the past when the quote is accepted. + /// Measured in seconds since the Unix epoch. + #[serde(skip_serializing_if = "Option::is_none")] + pub effective_date: Option, + + /// Integer representing the number of trial period days before the customer is charged for the first time. + #[serde(skip_serializing_if = "Option::is_none")] + pub trial_period_days: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceTransferData { + /// The amount in %s that will be transferred to the destination account when the invoice is paid. + /// + /// By default, the entire amount is transferred to the destination. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + + /// A non-negative decimal between 0 and 100, with at most two decimal places. + /// + /// This represents the percentage of the subscription invoice subtotal that will be transferred to the destination account. + /// By default, the entire amount will be transferred to the destination. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_percent: Option, + + /// The account where funds from the payment will be transferred to upon payment success. + pub destination: Expandable, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct QuotesResourceUpfront { + /// Total before any discounts or taxes are applied. + pub amount_subtotal: i64, + + /// Total after discounts and taxes are applied. + pub amount_total: i64, + + /// The line items that will appear on the next invoice after this quote is accepted. + /// + /// This does not include pending invoice items that exist on the customer but may still be included in the next invoice. + #[serde(default)] + pub line_items: List, + + pub total_details: QuotesResourceTotalDetails, +} + +/// The parameters for `Quote::list`. +#[derive(Clone, Debug, Serialize, Default)] +pub struct ListQuotes<'a> { + /// The ID of the customer whose quotes will be retrieved. + #[serde(skip_serializing_if = "Option::is_none")] + pub customer: Option, + + /// A cursor for use in pagination. + /// + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option, + + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Expand::is_empty")] + pub expand: &'a [&'a str], + + /// A limit on the number of objects to be returned. + /// + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + + /// A cursor for use in pagination. + /// + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option, + + /// The status of the quote. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, +} + +impl<'a> ListQuotes<'a> { + pub fn new() -> Self { + ListQuotes { + customer: Default::default(), + ending_before: Default::default(), + expand: Default::default(), + limit: Default::default(), + starting_after: Default::default(), + status: Default::default(), + } + } +} + +/// An enum representing the possible values of an `Quote`'s `collection_method` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum QuoteCollectionMethod { + ChargeAutomatically, + SendInvoice, +} + +impl QuoteCollectionMethod { + pub fn as_str(self) -> &'static str { + match self { + QuoteCollectionMethod::ChargeAutomatically => "charge_automatically", + QuoteCollectionMethod::SendInvoice => "send_invoice", + } + } +} + +impl AsRef for QuoteCollectionMethod { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for QuoteCollectionMethod { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `Quote`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum QuoteStatus { + Accepted, + Canceled, + Draft, + Open, +} + +impl QuoteStatus { + pub fn as_str(self) -> &'static str { + match self { + QuoteStatus::Accepted => "accepted", + QuoteStatus::Canceled => "canceled", + QuoteStatus::Draft => "draft", + QuoteStatus::Open => "open", + } + } +} + +impl AsRef for QuoteStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for QuoteStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `QuotesResourceAutomaticTax`'s `status` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum QuotesResourceAutomaticTaxStatus { + Complete, + Failed, + RequiresLocationInputs, +} + +impl QuotesResourceAutomaticTaxStatus { + pub fn as_str(self) -> &'static str { + match self { + QuotesResourceAutomaticTaxStatus::Complete => "complete", + QuotesResourceAutomaticTaxStatus::Failed => "failed", + QuotesResourceAutomaticTaxStatus::RequiresLocationInputs => "requires_location_inputs", + } + } +} + +impl AsRef for QuotesResourceAutomaticTaxStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for QuotesResourceAutomaticTaxStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `QuotesResourceRecurring`'s `interval` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum QuotesResourceRecurringInterval { + Day, + Month, + Week, + Year, +} + +impl QuotesResourceRecurringInterval { + pub fn as_str(self) -> &'static str { + match self { + QuotesResourceRecurringInterval::Day => "day", + QuotesResourceRecurringInterval::Month => "month", + QuotesResourceRecurringInterval::Week => "week", + QuotesResourceRecurringInterval::Year => "year", + } + } +} + +impl AsRef for QuotesResourceRecurringInterval { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for QuotesResourceRecurringInterval { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/radar_early_fraud_warning.rs b/src/resources/generated/radar_early_fraud_warning.rs index 362ae1518..cff46a52d 100644 --- a/src/resources/generated/radar_early_fraud_warning.rs +++ b/src/resources/generated/radar_early_fraud_warning.rs @@ -34,6 +34,10 @@ pub struct RadarEarlyFraudWarning { /// 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, + + /// ID of the Payment Intent this early fraud warning is for, optionally expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_intent: Option>, } impl Object for RadarEarlyFraudWarning { diff --git a/src/resources/generated/review.rs b/src/resources/generated/review.rs index a2cee5535..96161db91 100644 --- a/src/resources/generated/review.rs +++ b/src/resources/generated/review.rs @@ -27,7 +27,7 @@ pub struct Review { /// The reason the review was closed, or null if it has not yet been closed. /// - /// One of `approved`, `refunded`, `refunded_as_fraud`, or `disputed`. + /// One of `approved`, `refunded`, `refunded_as_fraud`, `disputed`, or `redacted`. #[serde(skip_serializing_if = "Option::is_none")] pub closed_reason: Option, @@ -63,7 +63,7 @@ pub struct Review { /// The reason the review is currently open or closed. /// - /// One of `rule`, `manual`, `approved`, `refunded`, `refunded_as_fraud`, or `disputed`. + /// One of `rule`, `manual`, `approved`, `refunded`, `refunded_as_fraud`, `disputed`, or `redacted`. pub reason: ReviewReason, /// Information related to the browsing session of the user who initiated the payment. @@ -186,6 +186,7 @@ impl<'a> ListReviews<'a> { pub enum ReviewClosedReason { Approved, Disputed, + Redacted, Refunded, RefundedAsFraud, } @@ -195,6 +196,7 @@ impl ReviewClosedReason { match self { ReviewClosedReason::Approved => "approved", ReviewClosedReason::Disputed => "disputed", + ReviewClosedReason::Redacted => "redacted", ReviewClosedReason::Refunded => "refunded", ReviewClosedReason::RefundedAsFraud => "refunded_as_fraud", } diff --git a/src/resources/generated/setup_intent.rs b/src/resources/generated/setup_intent.rs index c91732de9..7f2362dff 100644 --- a/src/resources/generated/setup_intent.rs +++ b/src/resources/generated/setup_intent.rs @@ -240,7 +240,7 @@ pub struct SetupIntentPaymentMethodOptionsMandateOptionsAcssDebit { /// Description of the interval. /// - /// Only required if 'payment_schedule' parmeter is 'interval' or 'combined'. + /// Only required if the 'payment_schedule' parameter is 'interval' or 'combined'. #[serde(skip_serializing_if = "Option::is_none")] pub interval_description: Option, diff --git a/src/resources/generated/sku.rs b/src/resources/generated/sku.rs index 2c6891ba6..df7518026 100644 --- a/src/resources/generated/sku.rs +++ b/src/resources/generated/sku.rs @@ -7,7 +7,7 @@ use serde_derive::{Deserialize, Serialize}; use crate::config::{Client, Response}; use crate::ids::SkuId; use crate::params::{Deleted, Expand, Expandable, IdOrCreate, List, Metadata, Object, Timestamp}; -use crate::resources::{CreateProduct, Currency, PackageDimensions, Product}; +use crate::resources::{CreateProduct, Currency, Inventory, PackageDimensions, Product}; /// The resource representing a Stripe "Sku". /// @@ -48,7 +48,7 @@ pub struct Sku { pub image: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub inventory: Option, + pub inventory: Option, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. #[serde(skip_serializing_if = "Option::is_none")] @@ -128,7 +128,7 @@ impl Object for Sku { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct Inventory { +pub struct SkuInventory { /// The count of inventory available. /// /// Will be present if and only if `type` is `finite`. diff --git a/src/resources/generated/subscription.rs b/src/resources/generated/subscription.rs index 2b6ee05c8..16dbdb2c4 100644 --- a/src/resources/generated/subscription.rs +++ b/src/resources/generated/subscription.rs @@ -8,9 +8,10 @@ use crate::config::{Client, Response}; use crate::ids::{CouponId, CustomerId, PriceId, PromotionCodeId, SubscriptionId}; use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ - CollectionMethod, Currency, Customer, Discount, Invoice, PaymentMethod, PaymentSource, - Scheduled, SetupIntent, SubscriptionBillingThresholds, SubscriptionItem, - SubscriptionItemBillingThresholds, SubscriptionSchedule, SubscriptionTransferData, TaxRate, + CollectionMethod, Currency, Customer, Discount, Invoice, InvoicePaymentMethodOptionsBancontact, + InvoicePaymentMethodOptionsCard, PaymentMethod, PaymentSource, Scheduled, SetupIntent, + SubscriptionBillingThresholds, SubscriptionItem, SubscriptionItemBillingThresholds, + SubscriptionSchedule, SubscriptionTransferData, TaxRate, }; /// The resource representing a Stripe "Subscription". @@ -27,6 +28,8 @@ pub struct Subscription { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + pub automatic_tax: SubscriptionAutomaticTax, + /// Determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. pub billing_cycle_anchor: Timestamp, @@ -53,7 +56,6 @@ pub struct Subscription { /// /// When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions. - #[serde(skip_serializing_if = "Option::is_none")] pub collection_method: Option, /// Time at which the object was created. @@ -133,6 +135,10 @@ pub struct Subscription { #[serde(skip_serializing_if = "Option::is_none")] pub pause_collection: Option, + /// Payment settings passed on to invoices created by the subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_settings: Option, + /// Specifies an interval for how often to bill for any pending invoice items. /// /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. @@ -244,6 +250,12 @@ impl Object for Subscription { } } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SubscriptionAutomaticTax { + /// Whether Stripe automatically computes tax on this subscription. + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubscriptionPendingInvoiceItemInterval { /// Specifies invoicing frequency. @@ -270,6 +282,30 @@ pub struct SubscriptionsResourcePauseCollection { pub resumes_at: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SubscriptionsResourcePaymentSettings { + /// Payment-method-specific configuration to provide to invoices created by the subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_options: Option, + + /// The list of payment method types to provide to every invoice created by the subscription. + /// + /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_types: Option>, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SubscriptionsResourcePaymentMethodOptions { + /// This sub-hash contains details about the Bancontact payment method options to pass to invoices created by the subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub bancontact: Option, + + /// This sub-hash contains details about the Card payment method options to pass to invoices created by the subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub card: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubscriptionsResourcePendingUpdate { /// If the update is applied, determines the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. @@ -312,6 +348,10 @@ pub struct CreateSubscription<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + /// Automatic tax settings for this subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// For new subscriptions, a past timestamp to backdate the subscription's start date to. /// /// If set, the first invoice will contain a proration for the timespan between the start date and the current time. @@ -350,7 +390,7 @@ pub struct CreateSubscription<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub collection_method: Option, - /// The code of the coupon to apply to this subscription. + /// 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. #[serde(skip_serializing_if = "Option::is_none")] @@ -412,13 +452,21 @@ pub struct CreateSubscription<'a> { /// Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. /// For example, SCA regulation may require 3DS authentication to complete payment. /// See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. - /// This is the default behavior. Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice cannot be paid. + /// This is the default behavior. Use `default_incomplete` to create Subscriptions with `status=incomplete` when the first invoice requires payment, otherwise start as active. + /// Subscriptions transition to `status=active` when successfully confirming the payment intent on the first invoice. + /// This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. + /// Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. + /// If the payment intent is not confirmed within 23 hours subscriptions transition to `status=incomplete_expired`, which is a terminal state. Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice cannot be paid. /// For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not create a subscription and returns an error instead. /// This was the default behavior for API versions prior to 2019-03-14. /// See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. `pending_if_incomplete` is only used with updates and cannot be passed when creating a subscription. #[serde(skip_serializing_if = "Option::is_none")] pub payment_behavior: Option, + /// Payment settings to pass to invoices created by the subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_settings: Option, + /// Specifies an interval for how often to bill for any pending invoice items. /// /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. @@ -471,6 +519,7 @@ impl<'a> CreateSubscription<'a> { CreateSubscription { add_invoice_items: Default::default(), application_fee_percent: Default::default(), + automatic_tax: Default::default(), backdate_start_date: Default::default(), billing_cycle_anchor: Default::default(), billing_thresholds: Default::default(), @@ -488,6 +537,7 @@ impl<'a> CreateSubscription<'a> { metadata: Default::default(), off_session: Default::default(), payment_behavior: Default::default(), + payment_settings: Default::default(), pending_invoice_item_interval: Default::default(), promotion_code: Default::default(), proration_behavior: Default::default(), @@ -554,6 +604,7 @@ pub struct ListSubscriptions<'a> { /// Passing in a value of `canceled` will return all canceled subscriptions, including those belonging to deleted customers. /// Pass `ended` to find subscriptions that are canceled and subscriptions that are expired due to [incomplete payment](https://stripe.com/docs/billing/subscriptions/overview#subscription-statuses). /// Passing in a value of `all` will return subscriptions of all statuses. + /// If no value is supplied, all subscriptions that have not been canceled are returned. #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } @@ -593,6 +644,10 @@ pub struct UpdateSubscription<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + /// Automatic tax settings for this subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Either `now` or `unchanged`. /// /// Setting the value to `now` resets the subscription's billing cycle anchor to the current time. @@ -625,7 +680,7 @@ pub struct UpdateSubscription<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub collection_method: Option, - /// The code of the coupon to apply to this subscription. + /// 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. #[serde(skip_serializing_if = "Option::is_none")] @@ -689,7 +744,9 @@ pub struct UpdateSubscription<'a> { /// This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. /// For example, SCA regulation may require 3DS authentication to complete payment. /// See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. - /// This is the default behavior. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). + /// This is the default behavior. Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. + /// This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. + /// Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). /// When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. /// For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. /// This was the default behavior for API versions prior to 2019-03-14. @@ -697,6 +754,10 @@ pub struct UpdateSubscription<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub payment_behavior: Option, + /// Payment settings to pass to invoices created by the subscription. + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_settings: Option, + /// Specifies an interval for how often to bill for any pending invoice items. /// /// It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. @@ -752,6 +813,7 @@ impl<'a> UpdateSubscription<'a> { UpdateSubscription { add_invoice_items: Default::default(), application_fee_percent: Default::default(), + automatic_tax: Default::default(), billing_cycle_anchor: Default::default(), billing_thresholds: Default::default(), cancel_at: Default::default(), @@ -768,6 +830,7 @@ impl<'a> UpdateSubscription<'a> { off_session: Default::default(), pause_collection: Default::default(), payment_behavior: Default::default(), + payment_settings: Default::default(), pending_invoice_item_interval: Default::default(), promotion_code: Default::default(), proration_behavior: Default::default(), @@ -794,6 +857,11 @@ pub struct AddInvoiceItems { pub tax_rates: Option>, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateSubscriptionAutomaticTax { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateSubscriptionItems { #[serde(skip_serializing_if = "Option::is_none")] @@ -815,6 +883,15 @@ pub struct CreateSubscriptionItems { pub tax_rates: Option>, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateSubscriptionPaymentSettings { + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_options: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_types: Option>, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateSubscriptionPendingInvoiceItemInterval { pub interval: PlanInterval, @@ -831,6 +908,11 @@ pub struct CreateSubscriptionTransferData { pub destination: String, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateSubscriptionAutomaticTax { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdateSubscriptionItems { #[serde(skip_serializing_if = "Option::is_none")] @@ -869,6 +951,15 @@ pub struct UpdateSubscriptionPauseCollection { pub resumes_at: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateSubscriptionPaymentSettings { + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_options: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub payment_method_types: Option>, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdateSubscriptionPendingInvoiceItemInterval { pub interval: PlanInterval, @@ -890,12 +981,24 @@ pub struct CreateSubscriptionItemsBillingThresholds { pub usage_gte: i64, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptions { + #[serde(skip_serializing_if = "Option::is_none")] + pub bancontact: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub card: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoiceItemPriceData { pub currency: Currency, pub product: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -911,6 +1014,9 @@ pub struct SubscriptionItemPriceData { pub recurring: SubscriptionItemPriceDataRecurring, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -918,6 +1024,29 @@ pub struct SubscriptionItemPriceData { pub unit_amount_decimal: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptions { + #[serde(skip_serializing_if = "Option::is_none")] + pub bancontact: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub card: Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact { + #[serde(skip_serializing_if = "Option::is_none")] + pub preferred_language: + Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCard { + #[serde(skip_serializing_if = "Option::is_none")] + pub request_three_d_secure: + Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubscriptionItemPriceDataRecurring { pub interval: PlanInterval, @@ -926,6 +1055,172 @@ pub struct SubscriptionItemPriceDataRecurring { pub interval_count: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact { + #[serde(skip_serializing_if = "Option::is_none")] + pub preferred_language: + Option, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCard { + #[serde(skip_serializing_if = "Option::is_none")] + pub request_three_d_secure: + Option, +} + +/// An enum representing the possible values of an `CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact`'s `preferred_language` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { + De, + En, + Fr, + Nl, +} + +impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { + pub fn as_str(self) -> &'static str { + match self { + CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::De => "de", + CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::En => "en", + CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::Fr => "fr", + CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::Nl => "nl", + } + } +} + +impl AsRef + for CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display + for CreateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `CreateSubscriptionPaymentSettingsPaymentMethodOptionsCard`'s `request_three_d_secure` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + Any, + Automatic, +} + +impl CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + pub fn as_str(self) -> &'static str { + match self { + CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Any => "any", + CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Automatic => "automatic", + } + } +} + +impl AsRef for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display + for CreateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `CreateSubscriptionPaymentSettings`'s `payment_method_types` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateSubscriptionPaymentSettingsPaymentMethodTypes { + AchCreditTransfer, + AchDebit, + AuBecsDebit, + BacsDebit, + Bancontact, + Boleto, + Card, + Fpx, + Giropay, + Ideal, + SepaDebit, + Sofort, + WechatPay, +} + +impl CreateSubscriptionPaymentSettingsPaymentMethodTypes { + pub fn as_str(self) -> &'static str { + match self { + CreateSubscriptionPaymentSettingsPaymentMethodTypes::AchCreditTransfer => { + "ach_credit_transfer" + } + CreateSubscriptionPaymentSettingsPaymentMethodTypes::AchDebit => "ach_debit", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Bancontact => "bancontact", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Boleto => "boleto", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Card => "card", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Fpx => "fpx", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Giropay => "giropay", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Ideal => "ideal", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::Sofort => "sofort", + CreateSubscriptionPaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay", + } + } +} + +impl AsRef for CreateSubscriptionPaymentSettingsPaymentMethodTypes { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateSubscriptionPaymentSettingsPaymentMethodTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `InvoiceItemPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum InvoiceItemPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl InvoiceItemPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + InvoiceItemPriceDataTaxBehavior::Exclusive => "exclusive", + InvoiceItemPriceDataTaxBehavior::Inclusive => "inclusive", + InvoiceItemPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for InvoiceItemPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for InvoiceItemPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `SubscriptionPendingInvoiceItemInterval`'s `interval` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -988,11 +1283,43 @@ impl std::fmt::Display for SubscriptionBillingCycleAnchor { } } +/// An enum representing the possible values of an `SubscriptionItemPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum SubscriptionItemPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl SubscriptionItemPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + SubscriptionItemPriceDataTaxBehavior::Exclusive => "exclusive", + SubscriptionItemPriceDataTaxBehavior::Inclusive => "inclusive", + SubscriptionItemPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for SubscriptionItemPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for SubscriptionItemPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `CreateSubscription`'s `payment_behavior` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum SubscriptionPaymentBehavior { AllowIncomplete, + DefaultIncomplete, ErrorIfIncomplete, PendingIfIncomplete, } @@ -1001,6 +1328,7 @@ impl SubscriptionPaymentBehavior { pub fn as_str(self) -> &'static str { match self { SubscriptionPaymentBehavior::AllowIncomplete => "allow_incomplete", + SubscriptionPaymentBehavior::DefaultIncomplete => "default_incomplete", SubscriptionPaymentBehavior::ErrorIfIncomplete => "error_if_incomplete", SubscriptionPaymentBehavior::PendingIfIncomplete => "pending_if_incomplete", } @@ -1163,6 +1491,59 @@ impl std::fmt::Display for SubscriptionsResourcePauseCollectionBehavior { } } +/// An enum representing the possible values of an `SubscriptionsResourcePaymentSettings`'s `payment_method_types` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum SubscriptionsResourcePaymentSettingsPaymentMethodTypes { + AchCreditTransfer, + AchDebit, + AuBecsDebit, + BacsDebit, + Bancontact, + Boleto, + Card, + Fpx, + Giropay, + Ideal, + SepaDebit, + Sofort, + WechatPay, +} + +impl SubscriptionsResourcePaymentSettingsPaymentMethodTypes { + pub fn as_str(self) -> &'static str { + match self { + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::AchCreditTransfer => { + "ach_credit_transfer" + } + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::AchDebit => "ach_debit", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Bancontact => "bancontact", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Boleto => "boleto", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Card => "card", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Fpx => "fpx", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Giropay => "giropay", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Ideal => "ideal", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::Sofort => "sofort", + SubscriptionsResourcePaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay", + } + } +} + +impl AsRef for SubscriptionsResourcePaymentSettingsPaymentMethodTypes { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for SubscriptionsResourcePaymentSettingsPaymentMethodTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `UpdateSubscriptionPauseCollection`'s `behavior` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1193,3 +1574,124 @@ impl std::fmt::Display for UpdateSubscriptionPauseCollectionBehavior { self.as_str().fmt(f) } } + +/// An enum representing the possible values of an `UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontact`'s `preferred_language` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { + De, + En, + Fr, + Nl, +} + +impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage { + pub fn as_str(self) -> &'static str { + match self { + UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::De => "de", + UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::En => "en", + UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::Fr => "fr", + UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::Nl => "nl", + } + } +} + +impl AsRef + for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display + for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCard`'s `request_three_d_secure` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + Any, + Automatic, +} + +impl UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + pub fn as_str(self) -> &'static str { + match self { + UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Any => "any", + UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Automatic => "automatic", + } + } +} + +impl AsRef for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display + for UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure +{ + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `UpdateSubscriptionPaymentSettings`'s `payment_method_types` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum UpdateSubscriptionPaymentSettingsPaymentMethodTypes { + AchCreditTransfer, + AchDebit, + AuBecsDebit, + BacsDebit, + Bancontact, + Boleto, + Card, + Fpx, + Giropay, + Ideal, + SepaDebit, + Sofort, + WechatPay, +} + +impl UpdateSubscriptionPaymentSettingsPaymentMethodTypes { + pub fn as_str(self) -> &'static str { + match self { + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::AchCreditTransfer => { + "ach_credit_transfer" + } + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::AchDebit => "ach_debit", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Bancontact => "bancontact", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Boleto => "boleto", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Card => "card", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Fpx => "fpx", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Giropay => "giropay", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Ideal => "ideal", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::Sofort => "sofort", + UpdateSubscriptionPaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay", + } + } +} + +impl AsRef for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for UpdateSubscriptionPaymentSettingsPaymentMethodTypes { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/subscription_item.rs b/src/resources/generated/subscription_item.rs index 49658dfcd..8c216f030 100644 --- a/src/resources/generated/subscription_item.rs +++ b/src/resources/generated/subscription_item.rs @@ -139,7 +139,9 @@ pub struct CreateSubscriptionItem<'a> { /// This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. /// For example, SCA regulation may require 3DS authentication to complete payment. /// See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. - /// This is the default behavior. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). + /// This is the default behavior. Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. + /// This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. + /// Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). /// When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. /// For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. /// This was the default behavior for API versions prior to 2019-03-14. @@ -275,7 +277,9 @@ pub struct UpdateSubscriptionItem<'a> { /// This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. /// For example, SCA regulation may require 3DS authentication to complete payment. /// See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. - /// This is the default behavior. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). + /// This is the default behavior. Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. + /// This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice. + /// Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). /// When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. /// For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. /// This was the default behavior for API versions prior to 2019-03-14. @@ -284,6 +288,8 @@ pub struct UpdateSubscriptionItem<'a> { pub payment_behavior: Option, /// The ID of the price object. + /// + /// When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option, @@ -343,6 +349,9 @@ pub struct SubscriptionItemPriceData { pub recurring: SubscriptionItemPriceDataRecurring, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -391,11 +400,43 @@ impl std::fmt::Display for PlanInterval { } } +/// An enum representing the possible values of an `SubscriptionItemPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum SubscriptionItemPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl SubscriptionItemPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + SubscriptionItemPriceDataTaxBehavior::Exclusive => "exclusive", + SubscriptionItemPriceDataTaxBehavior::Inclusive => "inclusive", + SubscriptionItemPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for SubscriptionItemPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for SubscriptionItemPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `CreateSubscriptionItem`'s `payment_behavior` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] pub enum SubscriptionPaymentBehavior { AllowIncomplete, + DefaultIncomplete, ErrorIfIncomplete, PendingIfIncomplete, } @@ -404,6 +445,7 @@ impl SubscriptionPaymentBehavior { pub fn as_str(self) -> &'static str { match self { SubscriptionPaymentBehavior::AllowIncomplete => "allow_incomplete", + SubscriptionPaymentBehavior::DefaultIncomplete => "default_incomplete", SubscriptionPaymentBehavior::ErrorIfIncomplete => "error_if_incomplete", SubscriptionPaymentBehavior::PendingIfIncomplete => "pending_if_incomplete", } diff --git a/src/resources/generated/subscription_schedule.rs b/src/resources/generated/subscription_schedule.rs index 1c46ae2c5..4f0635261 100644 --- a/src/resources/generated/subscription_schedule.rs +++ b/src/resources/generated/subscription_schedule.rs @@ -155,6 +155,9 @@ pub struct SubscriptionSchedulePhaseConfiguration { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Possible values are `phase_start` or `automatic`. /// /// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. @@ -216,6 +219,12 @@ pub struct SubscriptionSchedulePhaseConfiguration { pub trial_end: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SchedulesPhaseAutomaticTax { + /// Whether Stripe automatically computes tax on invoices created during this phase. + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubscriptionScheduleAddInvoiceItem { /// ID of the price used to generate the invoice item. @@ -260,6 +269,9 @@ pub struct SubscriptionScheduleDefaultSettings { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + /// Possible values are `phase_start` or `automatic`. /// /// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. @@ -293,6 +305,12 @@ pub struct SubscriptionScheduleDefaultSettings { pub transfer_data: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SubscriptionSchedulesResourceDefaultSettingsAutomaticTax { + /// Whether Stripe automatically computes tax on invoices created during this phase. + pub enabled: bool, +} + /// The parameters for `SubscriptionSchedule::create`. #[derive(Clone, Debug, Serialize, Default)] pub struct CreateSubscriptionSchedule<'a> { @@ -492,6 +510,9 @@ pub struct CreateSubscriptionSchedulePhases { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub billing_cycle_anchor: Option, @@ -539,6 +560,9 @@ pub struct SubscriptionScheduleDefaultSettingsParams { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub billing_cycle_anchor: Option, @@ -566,6 +590,9 @@ pub struct UpdateSubscriptionSchedulePhases { #[serde(skip_serializing_if = "Option::is_none")] pub application_fee_percent: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub automatic_tax: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub billing_cycle_anchor: Option, @@ -626,6 +653,11 @@ pub struct AddInvoiceItems { pub tax_rates: Option>, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateSubscriptionSchedulePhasesAutomaticTax { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateSubscriptionSchedulePhasesItems { #[serde(skip_serializing_if = "Option::is_none")] @@ -661,6 +693,11 @@ pub struct SubscriptionScheduleBillingThresholds { pub reset_billing_cycle_anchor: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SubscriptionScheduleDefaultSettingsParamsAutomaticTax { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubscriptionScheduleDefaultSettingsParamsTransferData { #[serde(skip_serializing_if = "Option::is_none")] @@ -675,6 +712,11 @@ pub struct SubscriptionScheduleInvoiceSettings { pub days_until_due: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UpdateSubscriptionSchedulePhasesAutomaticTax { + pub enabled: bool, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UpdateSubscriptionSchedulePhasesItems { #[serde(skip_serializing_if = "Option::is_none")] @@ -714,6 +756,9 @@ pub struct CreateSubscriptionSchedulePhasesItemsPriceData { pub recurring: CreateSubscriptionSchedulePhasesItemsPriceDataRecurring, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -727,6 +772,9 @@ pub struct InvoiceItemPriceData { pub product: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -747,6 +795,9 @@ pub struct UpdateSubscriptionSchedulePhasesItemsPriceData { pub recurring: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring, + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_behavior: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub unit_amount: Option, @@ -832,6 +883,68 @@ impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataRecurri } } +/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesItemsPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Exclusive => "exclusive", + CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Inclusive => "inclusive", + CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + +/// An enum representing the possible values of an `InvoiceItemPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum InvoiceItemPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl InvoiceItemPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + InvoiceItemPriceDataTaxBehavior::Exclusive => "exclusive", + InvoiceItemPriceDataTaxBehavior::Inclusive => "inclusive", + InvoiceItemPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for InvoiceItemPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for InvoiceItemPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} + /// An enum representing the possible values of an `SubscriptionSchedulePhaseConfiguration`'s `proration_behavior` field. #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "snake_case")] @@ -1112,3 +1225,34 @@ impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurri self.as_str().fmt(f) } } + +/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesItemsPriceData`'s `tax_behavior` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + Exclusive, + Inclusive, + Unspecified, +} + +impl UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + pub fn as_str(self) -> &'static str { + match self { + UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Exclusive => "exclusive", + UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Inclusive => "inclusive", + UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Unspecified => "unspecified", + } + } +} + +impl AsRef for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/tax_code.rs b/src/resources/generated/tax_code.rs new file mode 100644 index 000000000..5d668b6b4 --- /dev/null +++ b/src/resources/generated/tax_code.rs @@ -0,0 +1,87 @@ +// ====================================== +// This file was automatically generated. +// ====================================== + +use serde_derive::{Deserialize, Serialize}; + +use crate::config::{Client, Response}; +use crate::ids::TaxCodeId; +use crate::params::{Expand, List, Object}; + +/// The resource representing a Stripe "TaxProductResourceTaxCode". +/// +/// For more details see +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct TaxCode { + /// Unique identifier for the object. + pub id: TaxCodeId, + + /// A detailed description of which types of products the tax code represents. + pub description: String, + + /// A short name for the tax code. + pub name: String, +} + +impl TaxCode { + /// A list of [all tax codes available](https://stripe.com/docs/tax/tax-codes) to add to Products in order to allow specific tax calculations. + pub fn list(client: &Client, params: ListTaxCodes<'_>) -> Response> { + client.get_query("/tax_codes", ¶ms) + } + + /// Retrieves the details of an existing tax code. + /// + /// Supply the unique tax code ID and Stripe will return the corresponding tax code information. + pub fn retrieve(client: &Client, id: &TaxCodeId, expand: &[&str]) -> Response { + client.get_query(&format!("/tax_codes/{}", id), &Expand { expand }) + } +} + +impl Object for TaxCode { + type Id = TaxCodeId; + fn id(&self) -> Self::Id { + self.id.clone() + } + fn object(&self) -> &'static str { + "tax_code" + } +} + +/// The parameters for `TaxCode::list`. +#[derive(Clone, Debug, Serialize, Default)] +pub struct ListTaxCodes<'a> { + /// A cursor for use in pagination. + /// + /// `ending_before` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub ending_before: Option, + + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Expand::is_empty")] + pub expand: &'a [&'a str], + + /// A limit on the number of objects to be returned. + /// + /// Limit can range between 1 and 100, and the default is 10. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + + /// A cursor for use in pagination. + /// + /// `starting_after` is an object ID that defines your place in the list. + /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. + #[serde(skip_serializing_if = "Option::is_none")] + pub starting_after: Option, +} + +impl<'a> ListTaxCodes<'a> { + pub fn new() -> Self { + ListTaxCodes { + ending_before: Default::default(), + expand: Default::default(), + limit: Default::default(), + starting_after: Default::default(), + } + } +} diff --git a/src/resources/generated/tax_id.rs b/src/resources/generated/tax_id.rs index 736623796..1198cb7bb 100644 --- a/src/resources/generated/tax_id.rs +++ b/src/resources/generated/tax_id.rs @@ -36,7 +36,7 @@ pub struct TaxId { #[serde(skip_serializing_if = "Option::is_none")] pub livemode: Option, - /// Type of the tax ID, one of `ae_trn`, `au_abn`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_vat`, `gb_vat`, `hk_br`, `id_npwp`, `in_gst`, `jp_cn`, `jp_rn`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `th_vat`, `tw_vat`, `us_ein`, or `za_vat`. + /// Type of the tax ID, one of `ae_trn`, `au_abn`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_vat`, `gb_vat`, `hk_br`, `id_npwp`, `il_vat`, `in_gst`, `jp_cn`, `jp_rn`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `th_vat`, `tw_vat`, `us_ein`, or `za_vat`. /// /// Note that some legacy tax IDs have type `unknown`. #[serde(rename = "type")] @@ -85,6 +85,10 @@ pub enum TaxIdType { BrCnpj, BrCpf, CaBn, + CaGstHst, + CaPstBc, + CaPstMb, + CaPstSk, CaQst, ChVat, ClTin, @@ -93,6 +97,7 @@ pub enum TaxIdType { GbVat, HkBr, IdNpwp, + IlVat, InGst, JpCn, JpRn, @@ -124,6 +129,10 @@ impl TaxIdType { TaxIdType::BrCnpj => "br_cnpj", TaxIdType::BrCpf => "br_cpf", TaxIdType::CaBn => "ca_bn", + TaxIdType::CaGstHst => "ca_gst_hst", + TaxIdType::CaPstBc => "ca_pst_bc", + TaxIdType::CaPstMb => "ca_pst_mb", + TaxIdType::CaPstSk => "ca_pst_sk", TaxIdType::CaQst => "ca_qst", TaxIdType::ChVat => "ch_vat", TaxIdType::ClTin => "cl_tin", @@ -132,6 +141,7 @@ impl TaxIdType { TaxIdType::GbVat => "gb_vat", TaxIdType::HkBr => "hk_br", TaxIdType::IdNpwp => "id_npwp", + TaxIdType::IlVat => "il_vat", TaxIdType::InGst => "in_gst", TaxIdType::JpCn => "jp_cn", TaxIdType::JpRn => "jp_rn", diff --git a/src/resources/generated/tax_rate.rs b/src/resources/generated/tax_rate.rs index 1a200db37..f5afcb7c5 100644 --- a/src/resources/generated/tax_rate.rs +++ b/src/resources/generated/tax_rate.rs @@ -66,6 +66,10 @@ pub struct TaxRate { /// For example, "NY" for New York, United States. #[serde(skip_serializing_if = "Option::is_none")] pub state: Option, + + /// The high-level tax type, such as `vat` or `sales_tax`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_type: Option, } impl TaxRate { @@ -154,6 +158,10 @@ pub struct CreateTaxRate<'a> { /// For example, "NY" for New York, United States. #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, + + /// The high-level tax type, such as `vat` or `sales_tax`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_type: Option, } impl<'a> CreateTaxRate<'a> { @@ -169,6 +177,7 @@ impl<'a> CreateTaxRate<'a> { metadata: Default::default(), percentage, state: Default::default(), + tax_type: Default::default(), } } } @@ -274,6 +283,10 @@ pub struct UpdateTaxRate<'a> { /// For example, "NY" for New York, United States. #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, + + /// The high-level tax type, such as `vat` or `sales_tax`. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_type: Option, } impl<'a> UpdateTaxRate<'a> { @@ -287,6 +300,44 @@ impl<'a> UpdateTaxRate<'a> { jurisdiction: Default::default(), metadata: Default::default(), state: Default::default(), + tax_type: Default::default(), + } + } +} + +/// An enum representing the possible values of an `TaxRate`'s `tax_type` field. +#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)] +#[serde(rename_all = "snake_case")] +pub enum TaxRateTaxType { + Gst, + Hst, + Pst, + Qst, + SalesTax, + Vat, +} + +impl TaxRateTaxType { + pub fn as_str(self) -> &'static str { + match self { + TaxRateTaxType::Gst => "gst", + TaxRateTaxType::Hst => "hst", + TaxRateTaxType::Pst => "pst", + TaxRateTaxType::Qst => "qst", + TaxRateTaxType::SalesTax => "sales_tax", + TaxRateTaxType::Vat => "vat", } } } + +impl AsRef for TaxRateTaxType { + fn as_ref(&self) -> &str { + self.as_str() + } +} + +impl std::fmt::Display for TaxRateTaxType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + self.as_str().fmt(f) + } +} diff --git a/src/resources/generated/terminal_connection_token.rs b/src/resources/generated/terminal_connection_token.rs index f8d852465..e5c3fc5d4 100644 --- a/src/resources/generated/terminal_connection_token.rs +++ b/src/resources/generated/terminal_connection_token.rs @@ -10,6 +10,9 @@ use crate::params::Object; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TerminalConnectionToken { /// The id of the location that this connection token is scoped to. + /// + /// Note that location scoping only applies to internet-connected readers. + /// For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/readers/fleet-management#connection-tokens). #[serde(skip_serializing_if = "Option::is_none")] pub location: Option, diff --git a/src/resources/generated/terminal_reader.rs b/src/resources/generated/terminal_reader.rs index ea4839ec6..f54b7d52c 100644 --- a/src/resources/generated/terminal_reader.rs +++ b/src/resources/generated/terminal_reader.rs @@ -5,7 +5,8 @@ use serde_derive::{Deserialize, Serialize}; use crate::ids::TerminalReaderId; -use crate::params::{Metadata, Object}; +use crate::params::{Expandable, Metadata, Object}; +use crate::resources::TerminalLocation; /// The resource representing a Stripe "TerminalReaderReader". #[derive(Clone, Debug, Deserialize, Serialize)] @@ -39,7 +40,7 @@ pub struct TerminalReader { /// The location identifier of the reader. #[serde(skip_serializing_if = "Option::is_none")] - pub location: Option, + pub location: Option>, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// diff --git a/src/resources/generated/token.rs b/src/resources/generated/token.rs index 80a600077..24f12af02 100644 --- a/src/resources/generated/token.rs +++ b/src/resources/generated/token.rs @@ -148,6 +148,9 @@ pub struct CreateTokenPerson { #[serde(skip_serializing_if = "Option::is_none")] pub dob: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub documents: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub email: Option, @@ -206,6 +209,18 @@ pub struct CreateTokenPii { pub id_number: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateTokenPersonDocuments { + #[serde(skip_serializing_if = "Option::is_none")] + pub company_authorization: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub passport: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub visa: Option, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateTokenPersonRelationship { #[serde(skip_serializing_if = "Option::is_none")] @@ -236,6 +251,24 @@ pub struct PersonVerificationParams { pub document: Option, } +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateTokenPersonDocumentsCompanyAuthorization { + #[serde(skip_serializing_if = "Option::is_none")] + pub files: Option>, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateTokenPersonDocumentsPassport { + #[serde(skip_serializing_if = "Option::is_none")] + pub files: Option>, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CreateTokenPersonDocumentsVisa { + #[serde(skip_serializing_if = "Option::is_none")] + pub files: Option>, +} + #[derive(Clone, Debug, Deserialize, Serialize)] pub struct VerificationDocumentParams { #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/resources/generated/webhook_endpoint.rs b/src/resources/generated/webhook_endpoint.rs index 9508ff64d..97977c71d 100644 --- a/src/resources/generated/webhook_endpoint.rs +++ b/src/resources/generated/webhook_endpoint.rs @@ -380,6 +380,18 @@ pub enum EventFilter { CustomerUpdated, #[serde(rename = "file.created")] FileCreated, + #[serde(rename = "identity.verification_session.canceled")] + IdentityVerificationSessionCanceled, + #[serde(rename = "identity.verification_session.created")] + IdentityVerificationSessionCreated, + #[serde(rename = "identity.verification_session.processing")] + IdentityVerificationSessionProcessing, + #[serde(rename = "identity.verification_session.redacted")] + IdentityVerificationSessionRedacted, + #[serde(rename = "identity.verification_session.requires_input")] + IdentityVerificationSessionRequiresInput, + #[serde(rename = "identity.verification_session.verified")] + IdentityVerificationSessionVerified, #[serde(rename = "invoice.created")] InvoiceCreated, #[serde(rename = "invoice.deleted")] @@ -512,6 +524,14 @@ pub enum EventFilter { PromotionCodeCreated, #[serde(rename = "promotion_code.updated")] PromotionCodeUpdated, + #[serde(rename = "quote.accepted")] + QuoteAccepted, + #[serde(rename = "quote.canceled")] + QuoteCanceled, + #[serde(rename = "quote.created")] + QuoteCreated, + #[serde(rename = "quote.finalized")] + QuoteFinalized, #[serde(rename = "radar.early_fraud_warning.created")] RadarEarlyFraudWarningCreated, #[serde(rename = "radar.early_fraud_warning.updated")] @@ -675,6 +695,24 @@ impl EventFilter { EventFilter::CustomerTaxIdUpdated => "customer.tax_id.updated", EventFilter::CustomerUpdated => "customer.updated", EventFilter::FileCreated => "file.created", + EventFilter::IdentityVerificationSessionCanceled => { + "identity.verification_session.canceled" + } + EventFilter::IdentityVerificationSessionCreated => { + "identity.verification_session.created" + } + EventFilter::IdentityVerificationSessionProcessing => { + "identity.verification_session.processing" + } + EventFilter::IdentityVerificationSessionRedacted => { + "identity.verification_session.redacted" + } + EventFilter::IdentityVerificationSessionRequiresInput => { + "identity.verification_session.requires_input" + } + EventFilter::IdentityVerificationSessionVerified => { + "identity.verification_session.verified" + } EventFilter::InvoiceCreated => "invoice.created", EventFilter::InvoiceDeleted => "invoice.deleted", EventFilter::InvoiceFinalizationFailed => "invoice.finalization_failed", @@ -745,6 +783,10 @@ impl EventFilter { EventFilter::ProductUpdated => "product.updated", EventFilter::PromotionCodeCreated => "promotion_code.created", EventFilter::PromotionCodeUpdated => "promotion_code.updated", + EventFilter::QuoteAccepted => "quote.accepted", + EventFilter::QuoteCanceled => "quote.canceled", + EventFilter::QuoteCreated => "quote.created", + EventFilter::QuoteFinalized => "quote.finalized", EventFilter::RadarEarlyFraudWarningCreated => "radar.early_fraud_warning.created", EventFilter::RadarEarlyFraudWarningUpdated => "radar.early_fraud_warning.updated", EventFilter::RecipientCreated => "recipient.created", From 94bfa1eb84049cfb1670f23b29d278de47e44222 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Tue, 27 Jul 2021 17:23:36 +0100 Subject: [PATCH 2/4] Add / wire up now-missing apis --- src/ids.rs | 2 ++ src/resources/generated.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/ids.rs b/src/ids.rs index 429258fdb..8a62c0fa2 100644 --- a/src/ids.rs +++ b/src/ids.rs @@ -519,6 +519,7 @@ def_id!(PlanId: String); // N.B. A plan id can be user-provided so can be any ar def_id!(PriceId: String); // TODO: Figure out what prefix this id has def_id!(ProductId: String); // N.B. A product id can be user-provided so can be any arbitrary string def_id!(PromotionCodeId, "promo_"); // N.B. A product id can be user-provided so can be any arbitrary string +def_id!(QuoteId, "qt_"); def_id!(RecipientId: String); // FIXME: This doesn't seem to be documented yet def_id!(RefundId, "re_"); def_id!(ReviewId, "prv_"); @@ -532,6 +533,7 @@ def_id!(SubscriptionItemId, "si_"); def_id!(SubscriptionLineId, "sli_"); def_id!(SubscriptionScheduleId, "sub_sched_"); def_id!(TaxIdId, "txi_"); +def_id!(TaxCodeId, "txcd_"); def_id!(TaxRateId, "txr_"); def_id!( enum TokenId { diff --git a/src/resources/generated.rs b/src/resources/generated.rs index 11d231218..d3261fe46 100644 --- a/src/resources/generated.rs +++ b/src/resources/generated.rs @@ -27,6 +27,7 @@ pub mod core { pub mod reserve_transaction; pub mod setup_attempt; pub mod setup_intent; + pub mod tax_code; pub mod tax_deducted_at_source; pub mod token; } @@ -58,6 +59,7 @@ pub mod billing { pub mod plan; pub mod price; pub mod promotion_code; + pub mod quote; pub mod subscription; pub mod subscription_item; pub mod subscription_schedule; From 8ce946aeb47a387318f8c09a6cd0acf0810c3710 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Tue, 27 Jul 2021 17:38:59 +0100 Subject: [PATCH 3/4] Correctly rename SkuInventory --- openapi/src/mappings.rs | 4 ++-- src/resources/generated/sku.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openapi/src/mappings.rs b/openapi/src/mappings.rs index d0399d1e6..3bad58441 100644 --- a/openapi/src/mappings.rs +++ b/openapi/src/mappings.rs @@ -436,8 +436,8 @@ pub fn field_mappings() -> FieldMap { (("list_skus", "attributes"), ("Metadata", "Option")), (("create_sku", "attributes"), ("Metadata", "Option")), (("update_sku", "attributes"), ("Metadata", "Option")), - (("create_sku", "inventory"), ("Inventory", "Option")), - (("update_sku", "inventory"), ("Inventory", "Option")), + (("create_sku", "inventory"), ("SkuInventory", "Option")), + (("update_sku", "inventory"), ("SkuInventory", "Option")), (("create_sku", "package_dimensions"), ("PackageDimensions", "Option")), (("update_sku", "package_dimensions"), ("PackageDimensions", "Option")), diff --git a/src/resources/generated/sku.rs b/src/resources/generated/sku.rs index df7518026..118523119 100644 --- a/src/resources/generated/sku.rs +++ b/src/resources/generated/sku.rs @@ -7,7 +7,7 @@ use serde_derive::{Deserialize, Serialize}; use crate::config::{Client, Response}; use crate::ids::SkuId; use crate::params::{Deleted, Expand, Expandable, IdOrCreate, List, Metadata, Object, Timestamp}; -use crate::resources::{CreateProduct, Currency, Inventory, PackageDimensions, Product}; +use crate::resources::{CreateProduct, Currency, PackageDimensions, Product}; /// The resource representing a Stripe "Sku". /// @@ -186,7 +186,7 @@ pub struct CreateSku<'a> { /// Description of the SKU's inventory. #[serde(skip_serializing_if = "Option::is_none")] - pub inventory: Option, + pub inventory: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// @@ -212,7 +212,7 @@ pub struct CreateSku<'a> { impl<'a> CreateSku<'a> { pub fn new( currency: Currency, - inventory: Option, + inventory: Option, price: i64, product: IdOrCreate<'a, CreateProduct<'a>>, ) -> Self { @@ -332,7 +332,7 @@ pub struct UpdateSku<'a> { /// Description of the SKU's inventory. #[serde(skip_serializing_if = "Option::is_none")] - pub inventory: Option, + pub inventory: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. /// From df85d6b9a89bb8429411eefaecf1ce701d818f00 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Thu, 19 Aug 2021 10:16:29 +0100 Subject: [PATCH 4/4] Manually remove offending compilation issues --- src/resources/generated/checkout_session.rs | 10 ++-------- src/resources/generated/invoice.rs | 18 +++--------------- src/resources/generated/payment_intent.rs | 9 +-------- src/resources/generated/product.rs | 6 +----- src/resources/generated/quote.rs | 10 ++-------- src/resources/generated/subscription.rs | 17 ++++------------- 6 files changed, 13 insertions(+), 57 deletions(-) diff --git a/src/resources/generated/checkout_session.rs b/src/resources/generated/checkout_session.rs index 2f1188a74..0c0e01379 100644 --- a/src/resources/generated/checkout_session.rs +++ b/src/resources/generated/checkout_session.rs @@ -8,8 +8,8 @@ use crate::config::{Client, Response}; use crate::ids::{CheckoutSessionId, CustomerId, PaymentIntentId, SubscriptionId}; use crate::params::{Expand, Expandable, List, Metadata, Object, Timestamp}; use crate::resources::{ - CheckoutSessionItem, Currency, Customer, Discount, PaymentIntent, PaymentMethodOptionsBoleto, - PaymentMethodOptionsOxxo, SetupIntent, Shipping, Subscription, TaxRate, + CheckoutSessionItem, Currency, Customer, Discount, PaymentIntent, SetupIntent, Shipping, + Subscription, TaxRate, }; /// The resource representing a Stripe "Session". @@ -183,12 +183,6 @@ impl Object for CheckoutSession { pub struct CheckoutSessionPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub acss_debit: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] diff --git a/src/resources/generated/invoice.rs b/src/resources/generated/invoice.rs index a3ede1217..40ca41c26 100644 --- a/src/resources/generated/invoice.rs +++ b/src/resources/generated/invoice.rs @@ -9,8 +9,8 @@ use crate::ids::{CustomerId, InvoiceId, SubscriptionId}; use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ Account, Address, ApiErrors, Charge, Currency, CustomField, Customer, Discount, - InvoiceLineItem, InvoicePaymentMethodOptionsBancontact, InvoicePaymentMethodOptionsCard, - PaymentIntent, PaymentMethod, PaymentSource, Quote, Shipping, Subscription, TaxId, TaxRate, + InvoiceLineItem, PaymentIntent, PaymentMethod, PaymentSource, Shipping, Subscription, TaxId, + TaxRate, }; /// The resource representing a Stripe "Invoice". @@ -314,10 +314,6 @@ pub struct Invoice { #[serde(skip_serializing_if = "Option::is_none")] pub pre_payment_credit_notes_amount: Option, - /// The quote this invoice was generated from. - #[serde(skip_serializing_if = "Option::is_none")] - pub quote: Option>, - /// This is the transaction number that appears on email receipts sent for this invoice. #[serde(skip_serializing_if = "Option::is_none")] pub receipt_number: Option, @@ -516,15 +512,7 @@ pub struct InvoicesPaymentSettings { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct InvoicesPaymentMethodOptions { - /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent. - #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, - - /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent. - #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, -} +pub struct InvoicesPaymentMethodOptions {} #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoicesResourceInvoiceTaxId { diff --git a/src/resources/generated/payment_intent.rs b/src/resources/generated/payment_intent.rs index e9630d6ef..3b3fd5311 100644 --- a/src/resources/generated/payment_intent.rs +++ b/src/resources/generated/payment_intent.rs @@ -9,8 +9,7 @@ use crate::ids::{CustomerId, MandateId, PaymentIntentId, PaymentMethodId}; use crate::params::{Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ Account, ApiErrors, Application, Charge, Currency, Customer, Invoice, PaymentIntentOffSession, - PaymentMethod, PaymentMethodDetailsCardInstallmentsPlan, PaymentMethodOptionsBoleto, - PaymentMethodOptionsOxxo, Review, Shipping, ShippingParams, + PaymentMethod, PaymentMethodDetailsCardInstallmentsPlan, Review, Shipping, ShippingParams, }; /// The resource representing a Stripe "PaymentIntent". @@ -415,9 +414,6 @@ pub struct PaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub bancontact: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub boleto: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, @@ -427,9 +423,6 @@ pub struct PaymentIntentPaymentMethodOptions { #[serde(skip_serializing_if = "Option::is_none")] pub ideal: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo: Option, - #[serde(skip_serializing_if = "Option::is_none")] pub p24: Option, diff --git a/src/resources/generated/product.rs b/src/resources/generated/product.rs index 8443046aa..133265a57 100644 --- a/src/resources/generated/product.rs +++ b/src/resources/generated/product.rs @@ -7,7 +7,7 @@ use serde_derive::{Deserialize, Serialize}; use crate::config::{Client, Response}; use crate::ids::{ProductId, TaxCodeId}; use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; -use crate::resources::{PackageDimensions, TaxCode}; +use crate::resources::PackageDimensions; /// The resource representing a Stripe "Product". /// @@ -71,10 +71,6 @@ pub struct Product { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor: Option, - /// A [tax code](https://stripe.com/docs/tax/tax-codes) ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_code: Option>, - /// A label that represents units of this product in Stripe and on customers’ receipts and invoices. /// /// When set, this will be included in associated invoice line item descriptions. diff --git a/src/resources/generated/quote.rs b/src/resources/generated/quote.rs index 8d78b9322..8002217cd 100644 --- a/src/resources/generated/quote.rs +++ b/src/resources/generated/quote.rs @@ -8,8 +8,8 @@ use crate::config::{Client, Response}; use crate::ids::{CustomerId, QuoteId}; use crate::params::{Expand, Expandable, List, Metadata, Object, Timestamp}; use crate::resources::{ - Account, CheckoutSessionItem, Currency, Customer, Discount, Invoice, Quote, - QuotesResourceTotalDetails, Subscription, SubscriptionSchedule, TaxRate, + Account, CheckoutSessionItem, Currency, Customer, Discount, Invoice, Subscription, + SubscriptionSchedule, TaxRate, }; /// The resource representing a Stripe "Quote". @@ -145,8 +145,6 @@ pub struct Quote { #[serde(skip_serializing_if = "Option::is_none")] pub subscription_schedule: Option>, - pub total_details: QuotesResourceTotalDetails, - /// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. #[serde(skip_serializing_if = "Option::is_none")] pub transfer_data: Option, @@ -231,8 +229,6 @@ pub struct QuotesResourceRecurring { /// /// For example, `interval=month` and `interval_count=3` bills every 3 months. pub interval_count: u64, - - pub total_details: QuotesResourceTotalDetails, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -302,8 +298,6 @@ pub struct QuotesResourceUpfront { /// This does not include pending invoice items that exist on the customer but may still be included in the next invoice. #[serde(default)] pub line_items: List, - - pub total_details: QuotesResourceTotalDetails, } /// The parameters for `Quote::list`. diff --git a/src/resources/generated/subscription.rs b/src/resources/generated/subscription.rs index 16dbdb2c4..23acecea1 100644 --- a/src/resources/generated/subscription.rs +++ b/src/resources/generated/subscription.rs @@ -8,10 +8,9 @@ use crate::config::{Client, Response}; use crate::ids::{CouponId, CustomerId, PriceId, PromotionCodeId, SubscriptionId}; use crate::params::{Deleted, Expand, Expandable, List, Metadata, Object, RangeQuery, Timestamp}; use crate::resources::{ - CollectionMethod, Currency, Customer, Discount, Invoice, InvoicePaymentMethodOptionsBancontact, - InvoicePaymentMethodOptionsCard, PaymentMethod, PaymentSource, Scheduled, SetupIntent, - SubscriptionBillingThresholds, SubscriptionItem, SubscriptionItemBillingThresholds, - SubscriptionSchedule, SubscriptionTransferData, TaxRate, + CollectionMethod, Currency, Customer, Discount, Invoice, PaymentMethod, PaymentSource, + Scheduled, SetupIntent, SubscriptionBillingThresholds, SubscriptionItem, + SubscriptionItemBillingThresholds, SubscriptionSchedule, SubscriptionTransferData, TaxRate, }; /// The resource representing a Stripe "Subscription". @@ -296,15 +295,7 @@ pub struct SubscriptionsResourcePaymentSettings { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct SubscriptionsResourcePaymentMethodOptions { - /// This sub-hash contains details about the Bancontact payment method options to pass to invoices created by the subscription. - #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact: Option, - - /// This sub-hash contains details about the Card payment method options to pass to invoices created by the subscription. - #[serde(skip_serializing_if = "Option::is_none")] - pub card: Option, -} +pub struct SubscriptionsResourcePaymentMethodOptions {} #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubscriptionsResourcePendingUpdate {