diff --git a/examples/endpoints/src/checkout.rs b/examples/endpoints/src/checkout.rs index ab9d7c97a..8bec77d5d 100644 --- a/examples/endpoints/src/checkout.rs +++ b/examples/endpoints/src/checkout.rs @@ -10,9 +10,8 @@ //! If you'd rather avoid this, you can use a [stripe_types::PaymentLink]. use stripe::StripeError; -use stripe_checkout::checkout_session::{ - CreateCheckoutSession, CreateCheckoutSessionLineItems, CreateCheckoutSessionMode, -}; +use stripe_checkout::checkout_session::{CreateCheckoutSession, CreateCheckoutSessionLineItems}; +use stripe_checkout::CheckoutSessionMode; use stripe_core::customer::CreateCustomer; use stripe_product::price::CreatePrice; use stripe_product::product::CreateProduct; @@ -69,7 +68,7 @@ pub async fn run_checkout_session_example(client: &stripe::Client) -> Result<(), let mut params = CreateCheckoutSession::new(); params.cancel_url = Some("http://test.com/cancel"); params.customer = Some(customer.id.as_str()); - params.mode = Some(CreateCheckoutSessionMode::Payment); + params.mode = Some(CheckoutSessionMode::Payment); params.line_items = Some(&line_items); params.expand = Some(&["line_items", "line_items.data.price.product"]); params.send(client).await? diff --git a/examples/endpoints/src/connect.rs b/examples/endpoints/src/connect.rs index 9263a71eb..f97e1730c 100644 --- a/examples/endpoints/src/connect.rs +++ b/examples/endpoints/src/connect.rs @@ -12,18 +12,16 @@ //! brand color. See more: use stripe::StripeError; -use stripe_connect::account::{ - CreateAccount, CreateAccountCapabilities, CreateAccountCapabilitiesCardPayments, - CreateAccountCapabilitiesTransfers, CreateAccountType, -}; +use stripe_connect::account::{CapabilitiesParam, CapabilityParam, CreateAccount}; use stripe_connect::account_link::{CreateAccountLink, CreateAccountLinkType}; +use stripe_connect::AccountType; pub async fn run_connect_example(client: &stripe::Client) -> Result<(), StripeError> { let account = CreateAccount { - type_: Some(CreateAccountType::Express), - capabilities: Some(CreateAccountCapabilities { - card_payments: Some(CreateAccountCapabilitiesCardPayments { requested: Some(true) }), - transfers: Some(CreateAccountCapabilitiesTransfers { requested: Some(true) }), + type_: Some(AccountType::Express), + capabilities: Some(CapabilitiesParam { + card_payments: Some(CapabilityParam { requested: Some(true) }), + transfers: Some(CapabilityParam { requested: Some(true) }), ..Default::default() }), ..Default::default() diff --git a/generated/stripe_billing/src/billing_portal_configuration/requests.rs b/generated/stripe_billing/src/billing_portal_configuration/requests.rs index e2236ffde..d20825446 100644 --- a/generated/stripe_billing/src/billing_portal_configuration/requests.rs +++ b/generated/stripe_billing/src/billing_portal_configuration/requests.rs @@ -117,7 +117,7 @@ pub struct CreateBillingPortalConfigurationFeatures<'a> { pub subscription_cancel: Option>, /// Information about pausing subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_pause: Option, + pub subscription_pause: Option, /// Information about updating subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_update: Option>, @@ -462,18 +462,6 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Information about pausing subscriptions in the portal. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesSubscriptionPause { - /// Whether the feature is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub enabled: Option, -} -impl CreateBillingPortalConfigurationFeaturesSubscriptionPause { - pub fn new() -> Self { - Self::default() - } -} /// Information about updating subscriptions in the portal. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { @@ -483,7 +471,7 @@ pub struct CreateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { /// Whether the feature is enabled. pub enabled: bool, /// The list of up to 10 products that support subscription updates. - pub products: &'a [CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a>], + pub products: &'a [SubscriptionUpdateProductParam<'a>], /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. #[serde(skip_serializing_if = "Option::is_none")] @@ -494,7 +482,7 @@ impl<'a> CreateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { pub fn new( default_allowed_updates: &'a [CreateBillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdates], enabled: bool, - products: &'a [CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a>], + products: &'a [SubscriptionUpdateProductParam<'a>], ) -> Self { Self { default_allowed_updates, enabled, products, proration_behavior: None } } @@ -563,19 +551,6 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// The list of up to 10 products that support subscription updates. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a> { - /// The list of price IDs for the product that a subscription can be updated to. - pub prices: &'a [&'a str], - /// The product id. - pub product: &'a str, -} -impl<'a> CreateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a> { - pub fn new(prices: &'a [&'a str], product: &'a str) -> Self { - Self { prices, product } - } -} /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -729,7 +704,7 @@ pub struct UpdateBillingPortalConfigurationFeatures<'a> { pub subscription_cancel: Option>, /// Information about pausing subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] - pub subscription_pause: Option, + pub subscription_pause: Option, /// Information about updating subscriptions in the portal. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_update: Option>, @@ -1075,18 +1050,6 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// Information about pausing subscriptions in the portal. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionPause { - /// Whether the feature is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub enabled: Option, -} -impl UpdateBillingPortalConfigurationFeaturesSubscriptionPause { - pub fn new() -> Self { - Self::default() - } -} /// Information about updating subscriptions in the portal. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { @@ -1100,8 +1063,7 @@ pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionUpdate<'a> { pub enabled: Option, /// The list of up to 10 products that support subscription updates. #[serde(skip_serializing_if = "Option::is_none")] - pub products: - Option<&'a [UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a>]>, + pub products: Option<&'a [SubscriptionUpdateProductParam<'a>]>, /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. #[serde(skip_serializing_if = "Option::is_none")] @@ -1177,19 +1139,6 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// The list of up to 10 products that support subscription updates. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a> { - /// The list of price IDs for the product that a subscription can be updated to. - pub prices: &'a [&'a str], - /// The product id. - pub product: &'a str, -} -impl<'a> UpdateBillingPortalConfigurationFeaturesSubscriptionUpdateProducts<'a> { - pub fn new(prices: &'a [&'a str], product: &'a str) -> Self { - Self { prices, product } - } -} /// Determines how to handle prorations resulting from subscription updates. /// Valid values are `none`, `create_prorations`, and `always_invoice`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -1302,3 +1251,26 @@ impl<'a> RetrieveBillingPortalConfiguration<'a> { client.get_query(&format!("/billing_portal/configurations/{configuration}"), self) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SubscriptionPauseParam { + /// Whether the feature is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, +} +impl SubscriptionPauseParam { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct SubscriptionUpdateProductParam<'a> { + /// The list of price IDs for the product that a subscription can be updated to. + pub prices: &'a [&'a str], + /// The product id. + pub product: &'a str, +} +impl<'a> SubscriptionUpdateProductParam<'a> { + pub fn new(prices: &'a [&'a str], product: &'a str) -> Self { + Self { prices, product } + } +} diff --git a/generated/stripe_billing/src/billing_portal_session/requests.rs b/generated/stripe_billing/src/billing_portal_session/requests.rs index bce10709b..4fabcd9ad 100644 --- a/generated/stripe_billing/src/billing_portal_session/requests.rs +++ b/generated/stripe_billing/src/billing_portal_session/requests.rs @@ -16,7 +16,7 @@ pub struct CreateBillingPortalSession<'a> { /// 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, + 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. /// For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#on-behalf-of). @@ -383,197 +383,6 @@ impl serde::Serialize for CreateBillingPortalSessionFlowDataType { serializer.serialize_str(self.as_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. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateBillingPortalSessionLocale { - Auto, - Bg, - Cs, - Da, - De, - El, - En, - EnMinusAu, - EnMinusCa, - EnMinusGb, - EnMinusIe, - EnMinusIn, - EnMinusNz, - EnMinusSg, - Es, - EsMinus419, - Et, - Fi, - Fil, - Fr, - FrMinusCa, - Hr, - Hu, - Id, - It, - Ja, - Ko, - Lt, - Lv, - Ms, - Mt, - Nb, - Nl, - Pl, - Pt, - PtMinusBr, - Ro, - Ru, - Sk, - Sl, - Sv, - Th, - Tr, - Vi, - Zh, - ZhMinusHk, - ZhMinusTw, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl CreateBillingPortalSessionLocale { - pub fn as_str(self) -> &'static str { - use CreateBillingPortalSessionLocale::*; - match self { - Auto => "auto", - Bg => "bg", - Cs => "cs", - Da => "da", - De => "de", - El => "el", - En => "en", - EnMinusAu => "en-AU", - EnMinusCa => "en-CA", - EnMinusGb => "en-GB", - EnMinusIe => "en-IE", - EnMinusIn => "en-IN", - EnMinusNz => "en-NZ", - EnMinusSg => "en-SG", - Es => "es", - EsMinus419 => "es-419", - Et => "et", - Fi => "fi", - Fil => "fil", - Fr => "fr", - FrMinusCa => "fr-CA", - Hr => "hr", - Hu => "hu", - Id => "id", - It => "it", - Ja => "ja", - Ko => "ko", - Lt => "lt", - Lv => "lv", - Ms => "ms", - Mt => "mt", - Nb => "nb", - Nl => "nl", - Pl => "pl", - Pt => "pt", - PtMinusBr => "pt-BR", - Ro => "ro", - Ru => "ru", - Sk => "sk", - Sl => "sl", - Sv => "sv", - Th => "th", - Tr => "tr", - Vi => "vi", - Zh => "zh", - ZhMinusHk => "zh-HK", - ZhMinusTw => "zh-TW", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for CreateBillingPortalSessionLocale { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateBillingPortalSessionLocale::*; - match s { - "auto" => Ok(Auto), - "bg" => Ok(Bg), - "cs" => Ok(Cs), - "da" => Ok(Da), - "de" => Ok(De), - "el" => Ok(El), - "en" => Ok(En), - "en-AU" => Ok(EnMinusAu), - "en-CA" => Ok(EnMinusCa), - "en-GB" => Ok(EnMinusGb), - "en-IE" => Ok(EnMinusIe), - "en-IN" => Ok(EnMinusIn), - "en-NZ" => Ok(EnMinusNz), - "en-SG" => Ok(EnMinusSg), - "es" => Ok(Es), - "es-419" => Ok(EsMinus419), - "et" => Ok(Et), - "fi" => Ok(Fi), - "fil" => Ok(Fil), - "fr" => Ok(Fr), - "fr-CA" => Ok(FrMinusCa), - "hr" => Ok(Hr), - "hu" => Ok(Hu), - "id" => Ok(Id), - "it" => Ok(It), - "ja" => Ok(Ja), - "ko" => Ok(Ko), - "lt" => Ok(Lt), - "lv" => Ok(Lv), - "ms" => Ok(Ms), - "mt" => Ok(Mt), - "nb" => Ok(Nb), - "nl" => Ok(Nl), - "pl" => Ok(Pl), - "pt" => Ok(Pt), - "pt-BR" => Ok(PtMinusBr), - "ro" => Ok(Ro), - "ru" => Ok(Ru), - "sk" => Ok(Sk), - "sl" => Ok(Sl), - "sv" => Ok(Sv), - "th" => Ok(Th), - "tr" => Ok(Tr), - "vi" => Ok(Vi), - "zh" => Ok(Zh), - "zh-HK" => Ok(ZhMinusHk), - "zh-TW" => Ok(ZhMinusTw), - _ => Err(()), - } - } -} -impl AsRef for CreateBillingPortalSessionLocale { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateBillingPortalSessionLocale { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateBillingPortalSessionLocale { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateBillingPortalSessionLocale { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateBillingPortalSession<'a> { /// Creates a session of the customer portal. pub fn send( diff --git a/generated/stripe_billing/src/billing_portal_session/types.rs b/generated/stripe_billing/src/billing_portal_session/types.rs index 49f6869bd..8686ed0c9 100644 --- a/generated/stripe_billing/src/billing_portal_session/types.rs +++ b/generated/stripe_billing/src/billing_portal_session/types.rs @@ -29,7 +29,7 @@ pub struct BillingPortalSession { 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. - pub locale: Option, + 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. /// For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#on-behalf-of). @@ -40,8 +40,13 @@ pub struct BillingPortalSession { /// The short-lived URL of the session that gives customers access to the customer portal. pub url: String, } -/// 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. +impl stripe_types::Object for BillingPortalSession { + type Id = stripe_billing::BillingPortalSessionId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(BillingPortalSessionId, "bps_"); #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum BillingPortalSessionLocale { @@ -238,10 +243,3 @@ impl<'de> serde::Deserialize<'de> for BillingPortalSessionLocale { Ok(Self::from_str(&s).unwrap_or(BillingPortalSessionLocale::Unknown)) } } -impl stripe_types::Object for BillingPortalSession { - type Id = stripe_billing::BillingPortalSessionId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(BillingPortalSessionId, "bps_"); diff --git a/generated/stripe_billing/src/credit_note/requests.rs b/generated/stripe_billing/src/credit_note/requests.rs index 67d70dde0..d7a9675dd 100644 --- a/generated/stripe_billing/src/credit_note/requests.rs +++ b/generated/stripe_billing/src/credit_note/requests.rs @@ -33,7 +33,7 @@ pub struct CreateCreditNote<'a> { pub out_of_band_amount: Option, /// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option, /// ID of an existing refund to link this credit note to. #[serde(skip_serializing_if = "Option::is_none")] pub refund: Option<&'a str>, @@ -43,7 +43,7 @@ pub struct CreateCreditNote<'a> { pub refund_amount: Option, /// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option>, + pub shipping_cost: Option>, } impl<'a> CreateCreditNote<'a> { pub fn new(invoice: &'a str) -> Self { @@ -81,7 +81,7 @@ pub struct CreateCreditNoteLines<'a> { pub quantity: Option, /// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_amounts: Option<&'a [CreateCreditNoteLinesTaxAmounts<'a>]>, + pub tax_amounts: Option<&'a [TaxAmountWithTaxRateParam<'a>]>, /// The tax rates which apply to the credit note line item. /// Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`. #[serde(skip_serializing_if = "Option::is_none")] @@ -114,22 +114,6 @@ impl<'a> CreateCreditNoteLines<'a> { } } } -/// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCreditNoteLinesTaxAmounts<'a> { - /// The amount, in cents (or local equivalent), of the tax. - pub amount: i64, - /// The id of the tax rate for this tax amount. - /// The tax rate must have been automatically created by Stripe. - pub tax_rate: &'a str, - /// The amount on which tax is calculated, in cents (or local equivalent). - pub taxable_amount: i64, -} -impl<'a> CreateCreditNoteLinesTaxAmounts<'a> { - pub fn new(amount: i64, tax_rate: &'a str, taxable_amount: i64) -> Self { - Self { amount, tax_rate, taxable_amount } - } -} /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[derive(Copy, Clone, Eq, PartialEq)] pub enum CreateCreditNoteLinesType { @@ -181,75 +165,6 @@ impl serde::Serialize for CreateCreditNoteLinesType { serializer.serialize_str(self.as_str()) } } -/// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCreditNoteReason { - Duplicate, - Fraudulent, - OrderChange, - ProductUnsatisfactory, -} -impl CreateCreditNoteReason { - pub fn as_str(self) -> &'static str { - use CreateCreditNoteReason::*; - match self { - Duplicate => "duplicate", - Fraudulent => "fraudulent", - OrderChange => "order_change", - ProductUnsatisfactory => "product_unsatisfactory", - } - } -} - -impl std::str::FromStr for CreateCreditNoteReason { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCreditNoteReason::*; - match s { - "duplicate" => Ok(Duplicate), - "fraudulent" => Ok(Fraudulent), - "order_change" => Ok(OrderChange), - "product_unsatisfactory" => Ok(ProductUnsatisfactory), - _ => Err(()), - } - } -} -impl AsRef for CreateCreditNoteReason { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCreditNoteReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCreditNoteShippingCost<'a> { - /// The ID of the shipping rate to use for this order. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate: Option<&'a str>, -} -impl<'a> CreateCreditNoteShippingCost<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> CreateCreditNote<'a> { /// Issue a credit note to adjust the amount of a finalized invoice. /// For a `status=open` invoice, a credit note reduces. @@ -308,7 +223,7 @@ pub struct PreviewCreditNote<'a> { pub out_of_band_amount: Option, /// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option, /// ID of an existing refund to link this credit note to. #[serde(skip_serializing_if = "Option::is_none")] pub refund: Option<&'a str>, @@ -318,7 +233,7 @@ pub struct PreviewCreditNote<'a> { pub refund_amount: Option, /// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option>, + pub shipping_cost: Option>, } impl<'a> PreviewCreditNote<'a> { pub fn new(invoice: &'a str) -> Self { @@ -356,7 +271,7 @@ pub struct PreviewCreditNoteLines<'a> { pub quantity: Option, /// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_amounts: Option<&'a [PreviewCreditNoteLinesTaxAmounts<'a>]>, + pub tax_amounts: Option<&'a [TaxAmountWithTaxRateParam<'a>]>, /// The tax rates which apply to the credit note line item. /// Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`. #[serde(skip_serializing_if = "Option::is_none")] @@ -389,22 +304,6 @@ impl<'a> PreviewCreditNoteLines<'a> { } } } -/// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PreviewCreditNoteLinesTaxAmounts<'a> { - /// The amount, in cents (or local equivalent), of the tax. - pub amount: i64, - /// The id of the tax rate for this tax amount. - /// The tax rate must have been automatically created by Stripe. - pub tax_rate: &'a str, - /// The amount on which tax is calculated, in cents (or local equivalent). - pub taxable_amount: i64, -} -impl<'a> PreviewCreditNoteLinesTaxAmounts<'a> { - pub fn new(amount: i64, tax_rate: &'a str, taxable_amount: i64) -> Self { - Self { amount, tax_rate, taxable_amount } - } -} /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[derive(Copy, Clone, Eq, PartialEq)] pub enum PreviewCreditNoteLinesType { @@ -456,75 +355,6 @@ impl serde::Serialize for PreviewCreditNoteLinesType { serializer.serialize_str(self.as_str()) } } -/// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PreviewCreditNoteReason { - Duplicate, - Fraudulent, - OrderChange, - ProductUnsatisfactory, -} -impl PreviewCreditNoteReason { - pub fn as_str(self) -> &'static str { - use PreviewCreditNoteReason::*; - match self { - Duplicate => "duplicate", - Fraudulent => "fraudulent", - OrderChange => "order_change", - ProductUnsatisfactory => "product_unsatisfactory", - } - } -} - -impl std::str::FromStr for PreviewCreditNoteReason { - type Err = (); - fn from_str(s: &str) -> Result { - use PreviewCreditNoteReason::*; - match s { - "duplicate" => Ok(Duplicate), - "fraudulent" => Ok(Fraudulent), - "order_change" => Ok(OrderChange), - "product_unsatisfactory" => Ok(ProductUnsatisfactory), - _ => Err(()), - } - } -} -impl AsRef for PreviewCreditNoteReason { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for PreviewCreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PreviewCreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PreviewCreditNoteReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PreviewCreditNoteShippingCost<'a> { - /// The ID of the shipping rate to use for this order. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate: Option<&'a str>, -} -impl<'a> PreviewCreditNoteShippingCost<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> PreviewCreditNote<'a> { /// Get a preview of a credit note without creating it. pub fn send(&self, client: &stripe::Client) -> stripe::Response { @@ -691,7 +521,7 @@ pub struct PreviewLinesCreditNote<'a> { pub out_of_band_amount: Option, /// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option, /// ID of an existing refund to link this credit note to. #[serde(skip_serializing_if = "Option::is_none")] pub refund: Option<&'a str>, @@ -701,7 +531,7 @@ pub struct PreviewLinesCreditNote<'a> { pub refund_amount: Option, /// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_cost: Option>, + pub shipping_cost: 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. @@ -747,7 +577,7 @@ pub struct PreviewLinesCreditNoteLines<'a> { pub quantity: Option, /// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_amounts: Option<&'a [PreviewLinesCreditNoteLinesTaxAmounts<'a>]>, + pub tax_amounts: Option<&'a [TaxAmountWithTaxRateParam<'a>]>, /// The tax rates which apply to the credit note line item. /// Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`. #[serde(skip_serializing_if = "Option::is_none")] @@ -780,22 +610,6 @@ impl<'a> PreviewLinesCreditNoteLines<'a> { } } } -/// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct PreviewLinesCreditNoteLinesTaxAmounts<'a> { - /// The amount, in cents (or local equivalent), of the tax. - pub amount: i64, - /// The id of the tax rate for this tax amount. - /// The tax rate must have been automatically created by Stripe. - pub tax_rate: &'a str, - /// The amount on which tax is calculated, in cents (or local equivalent). - pub taxable_amount: i64, -} -impl<'a> PreviewLinesCreditNoteLinesTaxAmounts<'a> { - pub fn new(amount: i64, tax_rate: &'a str, taxable_amount: i64) -> Self { - Self { amount, tax_rate, taxable_amount } - } -} /// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` #[derive(Copy, Clone, Eq, PartialEq)] pub enum PreviewLinesCreditNoteLinesType { @@ -847,75 +661,6 @@ impl serde::Serialize for PreviewLinesCreditNoteLinesType { serializer.serialize_str(self.as_str()) } } -/// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PreviewLinesCreditNoteReason { - Duplicate, - Fraudulent, - OrderChange, - ProductUnsatisfactory, -} -impl PreviewLinesCreditNoteReason { - pub fn as_str(self) -> &'static str { - use PreviewLinesCreditNoteReason::*; - match self { - Duplicate => "duplicate", - Fraudulent => "fraudulent", - OrderChange => "order_change", - ProductUnsatisfactory => "product_unsatisfactory", - } - } -} - -impl std::str::FromStr for PreviewLinesCreditNoteReason { - type Err = (); - fn from_str(s: &str) -> Result { - use PreviewLinesCreditNoteReason::*; - match s { - "duplicate" => Ok(Duplicate), - "fraudulent" => Ok(Fraudulent), - "order_change" => Ok(OrderChange), - "product_unsatisfactory" => Ok(ProductUnsatisfactory), - _ => Err(()), - } - } -} -impl AsRef for PreviewLinesCreditNoteReason { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for PreviewLinesCreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PreviewLinesCreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PreviewLinesCreditNoteReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PreviewLinesCreditNoteShippingCost<'a> { - /// The ID of the shipping rate to use for this order. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_rate: Option<&'a str>, -} -impl<'a> PreviewLinesCreditNoteShippingCost<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> PreviewLinesCreditNote<'a> { /// When retrieving a credit note preview, you’ll get a **lines** property containing the first handful of those items. /// This URL you can retrieve the full (paginated) list of line items. @@ -931,3 +676,29 @@ impl<'a> PreviewLinesCreditNote<'a> { stripe::ListPaginator::from_list_params("/credit_notes/preview/lines", self) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct TaxAmountWithTaxRateParam<'a> { + /// The amount, in cents (or local equivalent), of the tax. + pub amount: i64, + /// The id of the tax rate for this tax amount. + /// The tax rate must have been automatically created by Stripe. + pub tax_rate: &'a str, + /// The amount on which tax is calculated, in cents (or local equivalent). + pub taxable_amount: i64, +} +impl<'a> TaxAmountWithTaxRateParam<'a> { + pub fn new(amount: i64, tax_rate: &'a str, taxable_amount: i64) -> Self { + Self { amount, tax_rate, taxable_amount } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreditNoteShippingCost<'a> { + /// The ID of the shipping rate to use for this order. + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping_rate: Option<&'a str>, +} +impl<'a> CreditNoteShippingCost<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_billing/src/invoice/requests.rs b/generated/stripe_billing/src/invoice/requests.rs index 5f9b1e9e8..3f4b73b6d 100644 --- a/generated/stripe_billing/src/invoice/requests.rs +++ b/generated/stripe_billing/src/invoice/requests.rs @@ -44,7 +44,7 @@ impl<'a> SearchInvoice<'a> { pub struct UpcomingInvoice<'a> { /// Settings for automatic tax lookup for this invoice preview. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// The code of the coupon to apply. /// If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. /// Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. @@ -69,7 +69,7 @@ pub struct UpcomingInvoice<'a> { /// Pass an empty string to avoid inheriting any discounts. /// To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpcomingInvoiceDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -139,31 +139,19 @@ impl<'a> UpcomingInvoice<'a> { Self::default() } } -/// Settings for automatic tax lookup for this invoice preview. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceAutomaticTax { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, -} -impl UpcomingInvoiceAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} /// Details about the customer you want to invoice or overrides for an existing customer. /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpcomingInvoiceCustomerDetails<'a> { /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The customer's shipping information. Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// Tax details about the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, + pub tax: Option>, /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] pub tax_exempt: Option, @@ -176,90 +164,6 @@ impl<'a> UpcomingInvoiceCustomerDetails<'a> { Self::default() } } -/// The customer's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceCustomerDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpcomingInvoiceCustomerDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The customer's shipping information. Appears on invoices emailed to this customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceCustomerDetailsShipping<'a> { - /// Customer shipping address. - pub address: UpcomingInvoiceCustomerDetailsShippingAddress<'a>, - /// Customer name. - pub name: &'a str, - /// Customer phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpcomingInvoiceCustomerDetailsShipping<'a> { - pub fn new(address: UpcomingInvoiceCustomerDetailsShippingAddress<'a>, name: &'a str) -> Self { - Self { address, name, phone: None } - } -} -/// Customer shipping address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceCustomerDetailsShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpcomingInvoiceCustomerDetailsShippingAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tax details about the customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceCustomerDetailsTax<'a> { - /// A recent IP address of the customer used for tax reporting and tax location inference. - /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. - /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip_address: Option<&'a str>, -} -impl<'a> UpcomingInvoiceCustomerDetailsTax<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum UpcomingInvoiceCustomerDetailsTaxExempt { @@ -575,26 +479,6 @@ impl serde::Serialize for UpcomingInvoiceCustomerDetailsTaxIdsType { serializer.serialize_str(self.as_str()) } } -/// The coupons to redeem into discounts for the invoice preview. -/// If not specified, inherits the discount from the customer or subscription. -/// This only works for coupons directly applied to the invoice. -/// To apply a coupon to a subscription, you must use the `coupon` parameter instead. -/// Pass an empty string to avoid inheriting any discounts. -/// To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpcomingInvoiceDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} /// List of invoice items to add or update in the upcoming invoice preview. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpcomingInvoiceInvoiceItems<'a> { @@ -616,7 +500,7 @@ pub struct UpcomingInvoiceInvoiceItems<'a> { pub discountable: Option, /// The coupons to redeem into discounts for the invoice item in the preview. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpcomingInvoiceInvoiceItemsDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// The ID of the invoice item to update in preview. /// If not specified, a new invoice item will be added to the preview of the upcoming invoice. #[serde(skip_serializing_if = "Option::is_none")] @@ -632,7 +516,7 @@ pub struct UpcomingInvoiceInvoiceItems<'a> { /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub period: Option, + pub period: Option, /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, @@ -669,37 +553,6 @@ impl<'a> UpcomingInvoiceInvoiceItems<'a> { Self::default() } } -/// The coupons to redeem into discounts for the invoice item in the preview. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingInvoiceInvoiceItemsDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpcomingInvoiceInvoiceItemsDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The period associated with this invoice item. -/// When set to different values, the period will be rendered on the invoice. -/// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. -/// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceInvoiceItemsPeriod { - /// The end of the period, which must be greater than or equal to the start. This value is inclusive. - pub end: stripe_types::Timestamp, - /// The start of the period. This value is inclusive. - pub start: stripe_types::Timestamp, -} -impl UpcomingInvoiceInvoiceItemsPeriod { - pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { - Self { end, start } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpcomingInvoiceInvoiceItemsPriceData<'a> { @@ -857,7 +710,7 @@ pub struct UpcomingInvoiceSubscriptionItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Delete all usage for a given subscription item. /// Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -898,18 +751,6 @@ impl<'a> UpcomingInvoiceSubscriptionItems<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingInvoiceSubscriptionItemsBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl UpcomingInvoiceSubscriptionItemsBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpcomingInvoiceSubscriptionItemsPriceData<'a> { @@ -1223,16 +1064,16 @@ pub struct UpdateInvoice<'a> { pub auto_advance: Option, /// Settings for automatic tax lookup for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Either `charge_automatically` or `send_invoice`. /// This field can be updated only on `draft` invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// A list of up to 4 custom fields to be displayed on the invoice. /// If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. /// Pass an empty string to remove previously-defined fields. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [UpdateInvoiceCustomFields<'a>]>, + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, /// The number of days from which the invoice is created until it is due. /// Only valid for invoices where `collection_method=send_invoice`. /// This field can only be updated on `draft` invoices. @@ -1260,7 +1101,7 @@ pub struct UpdateInvoice<'a> { /// The discounts that will apply to the invoice. /// Pass an empty string to remove previously-defined discounts. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpdateInvoiceDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// The date on which payment for this invoice is due. /// Only valid for invoices where `collection_method=send_invoice`. /// This field can only be updated on `draft` invoices. @@ -1305,7 +1146,7 @@ pub struct UpdateInvoice<'a> { /// Shipping details for the invoice. /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_details: Option>, + pub shipping_details: Option>, /// Extra information about a charge for the customer's credit card statement. /// It must contain at least one letter. /// If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. @@ -1314,108 +1155,13 @@ pub struct UpdateInvoice<'a> { /// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. /// This will be unset if you POST an empty value. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } impl<'a> UpdateInvoice<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this invoice. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceAutomaticTax { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, -} -impl UpdateInvoiceAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Either `charge_automatically` or `send_invoice`. -/// This field can be updated only on `draft` invoices. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateInvoiceCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl UpdateInvoiceCollectionMethod { - pub fn as_str(self) -> &'static str { - use UpdateInvoiceCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for UpdateInvoiceCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateInvoiceCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for UpdateInvoiceCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateInvoiceCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateInvoiceCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateInvoiceCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// A list of up to 4 custom fields to be displayed on the invoice. -/// If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. -/// Pass an empty string to remove previously-defined fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceCustomFields<'a> { - /// The name of the custom field. This may be up to 30 characters. - pub name: &'a str, - /// The value of the custom field. This may be up to 30 characters. - pub value: &'a str, -} -impl<'a> UpdateInvoiceCustomFields<'a> { - pub fn new(name: &'a str, value: &'a str) -> Self { - Self { name, value } - } -} -/// The discounts that will apply to the invoice. -/// Pass an empty string to remove previously-defined discounts. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpdateInvoiceDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Configuration settings for the PaymentIntent that is generated when the invoice is finalized. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateInvoicePaymentSettings<'a> { @@ -1451,8 +1197,7 @@ pub struct UpdateInvoicePaymentSettingsPaymentMethodOptions<'a> { pub card: Option, /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: - Option>, + pub customer_balance: Option>, /// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -1918,60 +1663,6 @@ impl serde::Serialize for UpdateInvoicePaymentSettingsPaymentMethodOptionsCardRe serializer.serialize_str(self.as_str()) } } -/// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer: - Option>, - /// The funding method type to be used when there are not enough funds in the customer balance. - /// Permitted values include: `bank_transfer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option<&'a str>, -} -impl<'a> UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - /// Configuration for eu_bank_transfer funding type. - #[serde(skip_serializing_if = "Option::is_none")] - pub eu_bank_transfer: Option< - UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, - >, - >, - /// The bank transfer type that can be used for funding. - /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option<&'a str>, -} -impl<'a> UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, -> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> - UpdateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> -{ - pub fn new(country: &'a str) -> Self { - Self { country } - } -} /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { @@ -2970,85 +2661,25 @@ impl serde::Serialize for UpdateInvoiceShippingCostShippingRateDataType { serializer.serialize_str(self.as_str()) } } -/// Shipping details for the invoice. -/// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceShippingDetails<'a> { - /// Shipping address - pub address: UpdateInvoiceShippingDetailsAddress<'a>, - /// Recipient name. - pub name: &'a str, - /// Recipient phone (including extension) - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpdateInvoiceShippingDetails<'a> { - pub fn new(address: UpdateInvoiceShippingDetailsAddress<'a>, name: &'a str) -> Self { - Self { address, name, phone: None } +impl<'a> UpdateInvoice<'a> { + /// Draft invoices are fully editable. + /// Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),. + /// monetary values, as well as `collection_method`, become uneditable. + /// + /// If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,. + /// sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass. + /// `auto_advance=false`. + pub fn send( + &self, + client: &stripe::Client, + invoice: &stripe_shared::InvoiceId, + ) -> stripe::Response { + client.send_form(&format!("/invoices/{invoice}"), self, http_types::Method::Post) } } -/// Shipping address #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceShippingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateInvoiceShippingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. -/// This will be unset if you POST an empty value. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceTransferData<'a> { - /// The amount that will be transferred automatically when the invoice is paid. - /// If no amount is set, the full amount is transferred. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> UpdateInvoiceTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount: None, destination } - } -} -impl<'a> UpdateInvoice<'a> { - /// Draft invoices are fully editable. - /// Once an invoice is [finalized](https://stripe.com/docs/billing/invoices/workflow#finalized),. - /// monetary values, as well as `collection_method`, become uneditable. - /// - /// If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,. - /// sending reminders for, or [automatically reconciling](https://stripe.com/docs/billing/invoices/reconciliation) invoices, pass. - /// `auto_advance=false`. - pub fn send( - &self, - client: &stripe::Client, - invoice: &stripe_shared::InvoiceId, - ) -> stripe::Response { - client.send_form(&format!("/invoices/{invoice}"), self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PayInvoice<'a> { - /// Specifies which fields in the response should be expanded. +pub struct PayInvoice<'a> { + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, /// In cases where the source used to pay the invoice has insufficient funds, passing `forgive=true` controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. @@ -3102,7 +2733,7 @@ impl<'a> PayInvoice<'a> { pub struct UpcomingLinesInvoice<'a> { /// Settings for automatic tax lookup for this invoice preview. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// The code of the coupon to apply. /// If `subscription` or `subscription_items` is provided, the invoice returned will preview updating or creating a subscription with that coupon. /// Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. @@ -3127,7 +2758,7 @@ pub struct UpcomingLinesInvoice<'a> { /// Pass an empty string to avoid inheriting any discounts. /// To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpcomingLinesInvoiceDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'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. @@ -3212,31 +2843,19 @@ impl<'a> UpcomingLinesInvoice<'a> { Self::default() } } -/// Settings for automatic tax lookup for this invoice preview. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceAutomaticTax { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, -} -impl UpcomingLinesInvoiceAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} /// Details about the customer you want to invoice or overrides for an existing customer. /// If `automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpcomingLinesInvoiceCustomerDetails<'a> { /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The customer's shipping information. Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// Tax details about the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, + pub tax: Option>, /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] pub tax_exempt: Option, @@ -3249,93 +2868,6 @@ impl<'a> UpcomingLinesInvoiceCustomerDetails<'a> { Self::default() } } -/// The customer's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceCustomerDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpcomingLinesInvoiceCustomerDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The customer's shipping information. Appears on invoices emailed to this customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceCustomerDetailsShipping<'a> { - /// Customer shipping address. - pub address: UpcomingLinesInvoiceCustomerDetailsShippingAddress<'a>, - /// Customer name. - pub name: &'a str, - /// Customer phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpcomingLinesInvoiceCustomerDetailsShipping<'a> { - pub fn new( - address: UpcomingLinesInvoiceCustomerDetailsShippingAddress<'a>, - name: &'a str, - ) -> Self { - Self { address, name, phone: None } - } -} -/// Customer shipping address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceCustomerDetailsShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpcomingLinesInvoiceCustomerDetailsShippingAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tax details about the customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceCustomerDetailsTax<'a> { - /// A recent IP address of the customer used for tax reporting and tax location inference. - /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. - /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip_address: Option<&'a str>, -} -impl<'a> UpcomingLinesInvoiceCustomerDetailsTax<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum UpcomingLinesInvoiceCustomerDetailsTaxExempt { @@ -3651,26 +3183,6 @@ impl serde::Serialize for UpcomingLinesInvoiceCustomerDetailsTaxIdsType { serializer.serialize_str(self.as_str()) } } -/// The coupons to redeem into discounts for the invoice preview. -/// If not specified, inherits the discount from the customer or subscription. -/// This only works for coupons directly applied to the invoice. -/// To apply a coupon to a subscription, you must use the `coupon` parameter instead. -/// Pass an empty string to avoid inheriting any discounts. -/// To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpcomingLinesInvoiceDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} /// List of invoice items to add or update in the upcoming invoice preview. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpcomingLinesInvoiceInvoiceItems<'a> { @@ -3692,7 +3204,7 @@ pub struct UpcomingLinesInvoiceInvoiceItems<'a> { pub discountable: Option, /// The coupons to redeem into discounts for the invoice item in the preview. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpcomingLinesInvoiceInvoiceItemsDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// The ID of the invoice item to update in preview. /// If not specified, a new invoice item will be added to the preview of the upcoming invoice. #[serde(skip_serializing_if = "Option::is_none")] @@ -3708,7 +3220,7 @@ pub struct UpcomingLinesInvoiceInvoiceItems<'a> { /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub period: Option, + pub period: Option, /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, @@ -3745,37 +3257,6 @@ impl<'a> UpcomingLinesInvoiceInvoiceItems<'a> { Self::default() } } -/// The coupons to redeem into discounts for the invoice item in the preview. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpcomingLinesInvoiceInvoiceItemsDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpcomingLinesInvoiceInvoiceItemsDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The period associated with this invoice item. -/// When set to different values, the period will be rendered on the invoice. -/// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. -/// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceInvoiceItemsPeriod { - /// The end of the period, which must be greater than or equal to the start. This value is inclusive. - pub end: stripe_types::Timestamp, - /// The start of the period. This value is inclusive. - pub start: stripe_types::Timestamp, -} -impl UpcomingLinesInvoiceInvoiceItemsPeriod { - pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { - Self { end, start } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpcomingLinesInvoiceInvoiceItemsPriceData<'a> { @@ -3933,7 +3414,7 @@ pub struct UpcomingLinesInvoiceSubscriptionItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Delete all usage for a given subscription item. /// Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -3974,18 +3455,6 @@ impl<'a> UpcomingLinesInvoiceSubscriptionItems<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpcomingLinesInvoiceSubscriptionItemsBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl UpcomingLinesInvoiceSubscriptionItemsBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpcomingLinesInvoiceSubscriptionItemsPriceData<'a> { @@ -4298,19 +3767,19 @@ pub struct CreateInvoice<'a> { pub auto_advance: Option, /// Settings for automatic tax lookup for this invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + 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. /// When sending an invoice, Stripe will email this invoice to the customer with payment instructions. /// Defaults to `charge_automatically`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The currency to create this invoice in. Defaults to that of `customer` if not specified. #[serde(skip_serializing_if = "Option::is_none")] pub currency: Option, /// A list of up to 4 custom fields to be displayed on the invoice. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CreateInvoiceCustomFields<'a>]>, + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, /// The ID of the customer who will be billed. #[serde(skip_serializing_if = "Option::is_none")] pub customer: Option<&'a str>, @@ -4340,7 +3809,7 @@ pub struct CreateInvoice<'a> { /// If not specified, inherits the discount from the invoice's customer. /// Pass an empty string to avoid inheriting any discounts. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [CreateInvoiceDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// The date on which payment for this invoice is due. /// Valid only for invoices where `collection_method=send_invoice`. #[serde(skip_serializing_if = "Option::is_none")] @@ -4396,7 +3865,7 @@ pub struct CreateInvoice<'a> { /// Shipping details for the invoice. /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_details: Option>, + pub shipping_details: Option>, /// Extra information about a charge for the customer's credit card statement. /// It must contain at least one letter. /// If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. @@ -4409,109 +3878,13 @@ pub struct CreateInvoice<'a> { pub subscription: Option<&'a str>, /// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } impl<'a> CreateInvoice<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this invoice. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceAutomaticTax { - /// Whether Stripe automatically computes tax on this invoice. - /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. - pub enabled: bool, -} -impl CreateInvoiceAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Either `charge_automatically`, or `send_invoice`. -/// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. -/// When sending an invoice, Stripe will email this invoice to the customer with payment instructions. -/// Defaults to `charge_automatically`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateInvoiceCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl CreateInvoiceCollectionMethod { - pub fn as_str(self) -> &'static str { - use CreateInvoiceCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for CreateInvoiceCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateInvoiceCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for CreateInvoiceCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateInvoiceCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateInvoiceCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateInvoiceCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// A list of up to 4 custom fields to be displayed on the invoice. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceCustomFields<'a> { - /// The name of the custom field. This may be up to 30 characters. - pub name: &'a str, - /// The value of the custom field. This may be up to 30 characters. - pub value: &'a str, -} -impl<'a> CreateInvoiceCustomFields<'a> { - pub fn new(name: &'a str, value: &'a str) -> Self { - Self { name, value } - } -} -/// The coupons to redeem into discounts for the invoice. -/// If not specified, inherits the discount from the invoice's customer. -/// Pass an empty string to avoid inheriting any discounts. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> CreateInvoiceDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Revise an existing invoice. /// The new invoice will be created in `status=draft`. /// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. @@ -4612,8 +3985,7 @@ pub struct CreateInvoicePaymentSettingsPaymentMethodOptions<'a> { pub card: Option, /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: - Option>, + pub customer_balance: Option>, /// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -5079,79 +4451,25 @@ impl serde::Serialize for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRe serializer.serialize_str(self.as_str()) } } -/// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. +/// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. +pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { + /// Additional fields for Financial Connections Session creation #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer: - Option>, - /// The funding method type to be used when there are not enough funds in the customer balance. - /// Permitted values include: `bank_transfer`. + pub financial_connections: Option< + CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, + >, + /// Verification method for the intent #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option<&'a str>, + pub verification_method: + Option, } -impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { +impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { pub fn new() -> Self { Self::default() } } -/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - /// Configuration for eu_bank_transfer funding type. - #[serde(skip_serializing_if = "Option::is_none")] - pub eu_bank_transfer: Option< - CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, - >, - >, - /// The bank transfer type that can be used for funding. - /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option<&'a str>, -} -impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, -> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> - CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> -{ - pub fn new(country: &'a str) -> Self { - Self { country } - } -} -/// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { - /// Additional fields for Financial Connections Session creation - #[serde(skip_serializing_if = "Option::is_none")] - pub financial_connections: Option< - CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a>, - >, - /// Verification method for the intent - #[serde(skip_serializing_if = "Option::is_none")] - pub verification_method: - Option, -} -impl<'a> CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Additional fields for Financial Connections Session creation +/// Additional fields for Financial Connections Session creation #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections<'a> { /// The list of permissions to request. @@ -6189,65 +5507,6 @@ impl serde::Serialize for CreateInvoiceShippingCostShippingRateDataType { serializer.serialize_str(self.as_str()) } } -/// Shipping details for the invoice. -/// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceShippingDetails<'a> { - /// Shipping address - pub address: CreateInvoiceShippingDetailsAddress<'a>, - /// Recipient name. - pub name: &'a str, - /// Recipient phone (including extension) - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> CreateInvoiceShippingDetails<'a> { - pub fn new(address: CreateInvoiceShippingDetailsAddress<'a>, name: &'a str) -> Self { - Self { address, name, phone: None } - } -} -/// Shipping address -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceShippingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateInvoiceShippingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceTransferData<'a> { - /// The amount that will be transferred automatically when the invoice is paid. - /// If no amount is set, the full amount is transferred. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> CreateInvoiceTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount: None, destination } - } -} impl<'a> CreateInvoice<'a> { /// This endpoint creates a draft invoice for a given customer. /// The invoice remains a draft until you [finalize](https://stripe.com/docs/api#finalize_invoice) the invoice, which allows you to [pay](https://stripe.com/docs/api#pay_invoice) or [send](https://stripe.com/docs/api#send_invoice) the invoice to your customers. @@ -6259,7 +5518,7 @@ impl<'a> CreateInvoice<'a> { pub struct ListInvoice<'a> { /// The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, /// Only return invoices for the customer specified by this customer ID. @@ -6287,7 +5546,7 @@ pub struct ListInvoice<'a> { /// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. /// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview). #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Only return invoices for the subscription specified by this subscription ID. #[serde(skip_serializing_if = "Option::is_none")] pub subscription: Option<&'a str>, @@ -6297,118 +5556,6 @@ impl<'a> ListInvoice<'a> { Self::default() } } -/// The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListInvoiceCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl ListInvoiceCollectionMethod { - pub fn as_str(self) -> &'static str { - use ListInvoiceCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for ListInvoiceCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use ListInvoiceCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for ListInvoiceCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListInvoiceCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListInvoiceCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListInvoiceCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. -/// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListInvoiceStatus { - Draft, - Open, - Paid, - Uncollectible, - Void, -} -impl ListInvoiceStatus { - pub fn as_str(self) -> &'static str { - use ListInvoiceStatus::*; - match self { - Draft => "draft", - Open => "open", - Paid => "paid", - Uncollectible => "uncollectible", - Void => "void", - } - } -} - -impl std::str::FromStr for ListInvoiceStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListInvoiceStatus::*; - match s { - "draft" => Ok(Draft), - "open" => Ok(Open), - "paid" => Ok(Paid), - "uncollectible" => Ok(Uncollectible), - "void" => Ok(Void), - _ => Err(()), - } - } -} -impl AsRef for ListInvoiceStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListInvoiceStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListInvoiceStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListInvoiceStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListInvoice<'a> { /// You can list all invoices, or list the invoices for a specific customer. /// The invoices are returned sorted by creation date, with the most recently created invoices appearing first. @@ -6561,3 +5708,187 @@ impl<'a> VoidInvoiceInvoice<'a> { client.send_form(&format!("/invoices/{invoice}/void"), self, http_types::Method::Post) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxParam { + /// Whether Stripe automatically computes tax on this invoice. + /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. + pub enabled: bool, +} +impl AutomaticTaxParam { + pub fn new(enabled: bool) -> Self { + Self { enabled } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct OptionalFieldsAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> OptionalFieldsAddress<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct TaxParam<'a> { + /// A recent IP address of the customer used for tax reporting and tax location inference. + /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. + /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. + #[serde(skip_serializing_if = "Option::is_none")] + pub ip_address: Option<&'a str>, +} +impl<'a> TaxParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct DiscountsDataParam<'a> { + /// ID of the coupon to create a new discount for. + #[serde(skip_serializing_if = "Option::is_none")] + pub coupon: Option<&'a str>, + /// ID of an existing discount on the object (or one of its ancestors) to reuse. + #[serde(skip_serializing_if = "Option::is_none")] + pub discount: Option<&'a str>, +} +impl<'a> DiscountsDataParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct Period { + /// The end of the period, which must be greater than or equal to the start. This value is inclusive. + pub end: stripe_types::Timestamp, + /// The start of the period. This value is inclusive. + pub start: stripe_types::Timestamp, +} +impl Period { + pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { + Self { end, start } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ItemBillingThresholdsParam { + /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). + pub usage_gte: i64, +} +impl ItemBillingThresholdsParam { + pub fn new(usage_gte: i64) -> Self { + Self { usage_gte } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomFieldParams<'a> { + /// The name of the custom field. This may be up to 30 characters. + pub name: &'a str, + /// The value of the custom field. This may be up to 30 characters. + pub value: &'a str, +} +impl<'a> CustomFieldParams<'a> { + pub fn new(name: &'a str, value: &'a str) -> Self { + Self { name, value } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct EuBankTransferParam<'a> { + /// The desired country code of the bank account information. + /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + pub country: &'a str, +} +impl<'a> EuBankTransferParam<'a> { + pub fn new(country: &'a str) -> Self { + Self { country } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct TransferDataSpecs<'a> { + /// The amount that will be transferred automatically when the invoice is paid. + /// If no amount is set, the full amount is transferred. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, + /// ID of an existing, connected Stripe account. + pub destination: &'a str, +} +impl<'a> TransferDataSpecs<'a> { + pub fn new(destination: &'a str) -> Self { + Self { amount: None, destination } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomerShipping<'a> { + /// Customer shipping address. + pub address: OptionalFieldsAddress<'a>, + /// Customer name. + pub name: &'a str, + /// Customer phone (including extension). + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, +} +impl<'a> CustomerShipping<'a> { + pub fn new(address: OptionalFieldsAddress<'a>, name: &'a str) -> Self { + Self { address, name, phone: None } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BankTransferParam<'a> { + /// Configuration for eu_bank_transfer funding type. + #[serde(skip_serializing_if = "Option::is_none")] + pub eu_bank_transfer: Option>, + /// The bank transfer type that can be used for funding. + /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option<&'a str>, +} +impl<'a> BankTransferParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct RecipientShippingWithOptionalFieldsAddress<'a> { + /// Shipping address + pub address: OptionalFieldsAddress<'a>, + /// Recipient name. + pub name: &'a str, + /// Recipient phone (including extension) + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, +} +impl<'a> RecipientShippingWithOptionalFieldsAddress<'a> { + pub fn new(address: OptionalFieldsAddress<'a>, name: &'a str) -> Self { + Self { address, name, phone: None } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct InvoicePaymentMethodOptionsParam<'a> { + /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. + #[serde(skip_serializing_if = "Option::is_none")] + pub bank_transfer: Option>, + /// The funding method type to be used when there are not enough funds in the customer balance. + /// Permitted values include: `bank_transfer`. + #[serde(skip_serializing_if = "Option::is_none")] + pub funding_type: Option<&'a str>, +} +impl<'a> InvoicePaymentMethodOptionsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_billing/src/invoice_item/requests.rs b/generated/stripe_billing/src/invoice_item/requests.rs index ee1cd6216..b8c9551f5 100644 --- a/generated/stripe_billing/src/invoice_item/requests.rs +++ b/generated/stripe_billing/src/invoice_item/requests.rs @@ -74,7 +74,7 @@ pub struct CreateInvoiceItem<'a> { pub discountable: Option, /// The coupons to redeem into discounts for the invoice item or invoice line item. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [CreateInvoiceItemDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -95,7 +95,7 @@ pub struct CreateInvoiceItem<'a> { /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub period: Option, + pub period: Option, /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, @@ -159,37 +159,6 @@ impl<'a> CreateInvoiceItem<'a> { } } } -/// The coupons to redeem into discounts for the invoice item or invoice line item. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateInvoiceItemDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> CreateInvoiceItemDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The period associated with this invoice item. -/// When set to different values, the period will be rendered on the invoice. -/// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. -/// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateInvoiceItemPeriod { - /// The end of the period, which must be greater than or equal to the start. This value is inclusive. - pub end: stripe_types::Timestamp, - /// The start of the period. This value is inclusive. - pub start: stripe_types::Timestamp, -} -impl CreateInvoiceItemPeriod { - pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { - Self { end, start } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateInvoiceItemPriceData<'a> { @@ -378,7 +347,7 @@ pub struct UpdateInvoiceItem<'a> { /// Item discounts are applied before invoice discounts. /// Pass an empty string to remove previously-defined discounts. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpdateInvoiceItemDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -393,7 +362,7 @@ pub struct UpdateInvoiceItem<'a> { /// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. /// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. #[serde(skip_serializing_if = "Option::is_none")] - pub period: Option, + pub period: Option, /// The ID of the price object. #[serde(skip_serializing_if = "Option::is_none")] pub price: Option<&'a str>, @@ -432,39 +401,6 @@ impl<'a> UpdateInvoiceItem<'a> { Self::default() } } -/// The coupons & existing discounts which apply to the invoice item or invoice line item. -/// Item discounts are applied before invoice discounts. -/// Pass an empty string to remove previously-defined discounts. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateInvoiceItemDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpdateInvoiceItemDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The period associated with this invoice item. -/// When set to different values, the period will be rendered on the invoice. -/// If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. -/// See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateInvoiceItemPeriod { - /// The end of the period, which must be greater than or equal to the start. This value is inclusive. - pub end: stripe_types::Timestamp, - /// The start of the period. This value is inclusive. - pub start: stripe_types::Timestamp, -} -impl UpdateInvoiceItemPeriod { - pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { - Self { end, start } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateInvoiceItemPriceData<'a> { @@ -635,3 +571,29 @@ impl DeleteInvoiceItem { client.send_form(&format!("/invoiceitems/{invoiceitem}"), self, http_types::Method::Delete) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct DiscountsDataParam<'a> { + /// ID of the coupon to create a new discount for. + #[serde(skip_serializing_if = "Option::is_none")] + pub coupon: Option<&'a str>, + /// ID of an existing discount on the object (or one of its ancestors) to reuse. + #[serde(skip_serializing_if = "Option::is_none")] + pub discount: Option<&'a str>, +} +impl<'a> DiscountsDataParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct Period { + /// The end of the period, which must be greater than or equal to the start. This value is inclusive. + pub end: stripe_types::Timestamp, + /// The start of the period. This value is inclusive. + pub start: stripe_types::Timestamp, +} +impl Period { + pub fn new(end: stripe_types::Timestamp, start: stripe_types::Timestamp) -> Self { + Self { end, start } + } +} diff --git a/generated/stripe_billing/src/plan/requests.rs b/generated/stripe_billing/src/plan/requests.rs index de8b93409..574061742 100644 --- a/generated/stripe_billing/src/plan/requests.rs +++ b/generated/stripe_billing/src/plan/requests.rs @@ -54,7 +54,7 @@ pub struct CreatePlan<'a> { /// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. /// Defaults to `sum`. #[serde(skip_serializing_if = "Option::is_none")] - pub aggregate_usage: Option, + pub aggregate_usage: Option, /// A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis. #[serde(skip_serializing_if = "Option::is_none")] pub amount: Option, @@ -67,7 +67,7 @@ pub struct CreatePlan<'a> { /// `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). /// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_scheme: Option, + pub billing_scheme: Option, /// 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). pub currency: stripe_types::Currency, @@ -81,7 +81,7 @@ pub struct CreatePlan<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub id: Option<&'a str>, /// Specifies billing frequency. Either `day`, `week`, `month` or `year`. - pub interval: CreatePlanInterval, + pub interval: stripe_shared::PlanInterval, /// The number of intervals between subscription billings. /// For example, `interval=month` and `interval_count=3` bills every 3 months. /// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). @@ -106,7 +106,7 @@ pub struct CreatePlan<'a> { /// Defines if the tiering price should be `graduated` or `volume` based. /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers_mode: Option, + pub tiers_mode: Option, /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[serde(skip_serializing_if = "Option::is_none")] @@ -120,10 +120,10 @@ pub struct CreatePlan<'a> { /// `metered` aggregates the total usage based on usage records. /// Defaults to `licensed`. #[serde(skip_serializing_if = "Option::is_none")] - pub usage_type: Option, + pub usage_type: Option, } impl<'a> CreatePlan<'a> { - pub fn new(currency: stripe_types::Currency, interval: CreatePlanInterval) -> Self { + pub fn new(currency: stripe_types::Currency, interval: stripe_shared::PlanInterval) -> Self { Self { active: None, aggregate_usage: None, @@ -146,176 +146,6 @@ impl<'a> CreatePlan<'a> { } } } -/// Specifies a usage aggregation strategy for plans of `usage_type=metered`. -/// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. -/// Defaults to `sum`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePlanAggregateUsage { - LastDuringPeriod, - LastEver, - Max, - Sum, -} -impl CreatePlanAggregateUsage { - pub fn as_str(self) -> &'static str { - use CreatePlanAggregateUsage::*; - match self { - LastDuringPeriod => "last_during_period", - LastEver => "last_ever", - Max => "max", - Sum => "sum", - } - } -} - -impl std::str::FromStr for CreatePlanAggregateUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePlanAggregateUsage::*; - match s { - "last_during_period" => Ok(LastDuringPeriod), - "last_ever" => Ok(LastEver), - "max" => Ok(Max), - "sum" => Ok(Sum), - _ => Err(()), - } - } -} -impl AsRef for CreatePlanAggregateUsage { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePlanAggregateUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePlanAggregateUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePlanAggregateUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Describes how to compute the price per period. -/// Either `per_unit` or `tiered`. -/// `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). -/// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePlanBillingScheme { - PerUnit, - Tiered, -} -impl CreatePlanBillingScheme { - pub fn as_str(self) -> &'static str { - use CreatePlanBillingScheme::*; - match self { - PerUnit => "per_unit", - Tiered => "tiered", - } - } -} - -impl std::str::FromStr for CreatePlanBillingScheme { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePlanBillingScheme::*; - match s { - "per_unit" => Ok(PerUnit), - "tiered" => Ok(Tiered), - _ => Err(()), - } - } -} -impl AsRef for CreatePlanBillingScheme { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePlanBillingScheme { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePlanBillingScheme { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePlanBillingScheme { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies billing frequency. Either `day`, `week`, `month` or `year`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePlanInterval { - Day, - Month, - Week, - Year, -} -impl CreatePlanInterval { - pub fn as_str(self) -> &'static str { - use CreatePlanInterval::*; - match self { - Day => "day", - Month => "month", - Week => "week", - Year => "year", - } - } -} - -impl std::str::FromStr for CreatePlanInterval { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePlanInterval::*; - match s { - "day" => Ok(Day), - "month" => Ok(Month), - "week" => Ok(Week), - "year" => Ok(Year), - _ => Err(()), - } - } -} -impl AsRef for CreatePlanInterval { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePlanInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePlanInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePlanInterval { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} #[derive(Copy, Clone, Debug, serde::Serialize)] #[serde(untagged)] pub enum CreatePlanProduct<'a> { @@ -413,58 +243,6 @@ pub enum CreatePlanTiersUpTo { Inf, I64(i64), } -/// Defines if the tiering price should be `graduated` or `volume` based. -/// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePlanTiersMode { - Graduated, - Volume, -} -impl CreatePlanTiersMode { - pub fn as_str(self) -> &'static str { - use CreatePlanTiersMode::*; - match self { - Graduated => "graduated", - Volume => "volume", - } - } -} - -impl std::str::FromStr for CreatePlanTiersMode { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePlanTiersMode::*; - match s { - "graduated" => Ok(Graduated), - "volume" => Ok(Volume), - _ => Err(()), - } - } -} -impl AsRef for CreatePlanTiersMode { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePlanTiersMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePlanTiersMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePlanTiersMode { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -530,61 +308,6 @@ impl serde::Serialize for CreatePlanTransformUsageRound { serializer.serialize_str(self.as_str()) } } -/// Configures how the quantity per period should be determined. -/// Can be either `metered` or `licensed`. -/// `licensed` automatically bills the `quantity` set when adding it to a subscription. -/// `metered` aggregates the total usage based on usage records. -/// Defaults to `licensed`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePlanUsageType { - Licensed, - Metered, -} -impl CreatePlanUsageType { - pub fn as_str(self) -> &'static str { - use CreatePlanUsageType::*; - match self { - Licensed => "licensed", - Metered => "metered", - } - } -} - -impl std::str::FromStr for CreatePlanUsageType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePlanUsageType::*; - match s { - "licensed" => Ok(Licensed), - "metered" => Ok(Metered), - _ => Err(()), - } - } -} -impl AsRef for CreatePlanUsageType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePlanUsageType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePlanUsageType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePlanUsageType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreatePlan<'a> { /// You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). /// It replaces the Plans API and is backwards compatible to simplify your migration. diff --git a/generated/stripe_billing/src/quote/requests.rs b/generated/stripe_billing/src/quote/requests.rs index 4e4407c1f..3e966ff62 100644 --- a/generated/stripe_billing/src/quote/requests.rs +++ b/generated/stripe_billing/src/quote/requests.rs @@ -32,13 +32,13 @@ pub struct CreateQuote<'a> { pub application_fee_percent: Option, /// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice 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 and mark the subscription as `active`. /// Defaults to `charge_automatically`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The customer for which this quote belongs to. /// A customer is required before finalizing the quote. /// Once specified, it cannot be changed. @@ -53,7 +53,7 @@ pub struct CreateQuote<'a> { pub description: Option<&'a str>, /// The discounts applied to the quote. You can only set up to one discount. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [CreateQuoteDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -77,7 +77,7 @@ pub struct CreateQuote<'a> { pub header: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option, + pub invoice_settings: Option, /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[serde(skip_serializing_if = "Option::is_none")] @@ -101,93 +101,13 @@ pub struct CreateQuote<'a> { pub test_clock: Option<&'a str>, /// The data with which to automatically create a Transfer for each of the invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } impl<'a> CreateQuote<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteAutomaticTax { - /// Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. - pub enabled: bool, -} -impl CreateQuoteAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Either `charge_automatically`, or `send_invoice`. -/// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice 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 and mark the subscription as `active`. -/// Defaults to `charge_automatically`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateQuoteCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl CreateQuoteCollectionMethod { - pub fn as_str(self) -> &'static str { - use CreateQuoteCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for CreateQuoteCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateQuoteCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for CreateQuoteCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateQuoteCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateQuoteCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateQuoteCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The discounts applied to the quote. You can only set up to one discount. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateQuoteDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> CreateQuoteDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Clone an existing quote. /// The new quote will be created in `status=draft`. /// When using this parameter, you cannot specify any other parameters except for `expires_at`. @@ -204,19 +124,6 @@ impl<'a> CreateQuoteFromQuote<'a> { Self { is_revision: None, quote } } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateQuoteInvoiceSettings { - /// Number of days within which a customer must pay the invoice 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, -} -impl CreateQuoteInvoiceSettings { - pub fn new() -> Self { - Self::default() - } -} /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -450,28 +357,6 @@ pub enum CreateQuoteSubscriptionDataEffectiveDate { CurrentPeriodEnd, Timestamp(stripe_types::Timestamp), } -/// The data with which to automatically create a Transfer for each of the invoices. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateQuoteTransferData<'a> { - /// The amount that will be transferred automatically when the invoice is paid. - /// If no amount is set, the full amount is transferred. - /// There cannot be any line items with recurring prices when using this field. - #[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 total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - /// There must be at least 1 line item with a recurring price to use this field. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> CreateQuoteTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount: None, amount_percent: None, destination } - } -} impl<'a> CreateQuote<'a> { /// A quote models prices and services for a customer. /// Default options for `header`, `description`, `footer`, and `expires_at` can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote). @@ -492,13 +377,13 @@ pub struct UpdateQuote<'a> { pub application_fee_percent: Option, /// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice 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 and mark the subscription as `active`. /// Defaults to `charge_automatically`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The customer for which this quote belongs to. /// A customer is required before finalizing the quote. /// Once specified, it cannot be changed. @@ -512,7 +397,7 @@ pub struct UpdateQuote<'a> { pub description: Option<&'a str>, /// The discounts applied to the quote. You can only set up to one discount. #[serde(skip_serializing_if = "Option::is_none")] - pub discounts: Option<&'a [UpdateQuoteDiscounts<'a>]>, + pub discounts: Option<&'a [DiscountsDataParam<'a>]>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -528,7 +413,7 @@ pub struct UpdateQuote<'a> { pub header: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option, + pub invoice_settings: Option, /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[serde(skip_serializing_if = "Option::is_none")] @@ -549,106 +434,13 @@ pub struct UpdateQuote<'a> { pub subscription_data: Option>, /// The data with which to automatically create a Transfer for each of the invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } impl<'a> UpdateQuote<'a> { pub fn new() -> Self { Self::default() } } -/// Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteAutomaticTax { - /// Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. - pub enabled: bool, -} -impl UpdateQuoteAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Either `charge_automatically`, or `send_invoice`. -/// When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice 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 and mark the subscription as `active`. -/// Defaults to `charge_automatically`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateQuoteCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl UpdateQuoteCollectionMethod { - pub fn as_str(self) -> &'static str { - use UpdateQuoteCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for UpdateQuoteCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateQuoteCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for UpdateQuoteCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateQuoteCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateQuoteCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateQuoteCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The discounts applied to the quote. You can only set up to one discount. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateQuoteDiscounts<'a> { - /// ID of the coupon to create a new discount for. - #[serde(skip_serializing_if = "Option::is_none")] - pub coupon: Option<&'a str>, - /// ID of an existing discount on the object (or one of its ancestors) to reuse. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount: Option<&'a str>, -} -impl<'a> UpdateQuoteDiscounts<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateQuoteInvoiceSettings { - /// Number of days within which a customer must pay the invoice 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, -} -impl UpdateQuoteInvoiceSettings { - pub fn new() -> Self { - Self::default() - } -} /// A list of line items the customer is being quoted for. /// Each line item includes information about the product, the quantity, and the resulting cost. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -885,28 +677,6 @@ pub enum UpdateQuoteSubscriptionDataEffectiveDate { CurrentPeriodEnd, Timestamp(stripe_types::Timestamp), } -/// The data with which to automatically create a Transfer for each of the invoices. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateQuoteTransferData<'a> { - /// The amount that will be transferred automatically when the invoice is paid. - /// If no amount is set, the full amount is transferred. - /// There cannot be any line items with recurring prices when using this field. - #[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 total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - /// There must be at least 1 line item with a recurring price to use this field. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> UpdateQuoteTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount: None, amount_percent: None, destination } - } -} impl<'a> UpdateQuote<'a> { /// A quote models prices and services for a customer. pub fn send( @@ -1008,7 +778,7 @@ pub struct ListQuote<'a> { pub starting_after: Option<&'a str>, /// The status of the quote. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Provides a list of quotes that are associated with the specified test clock. /// The response will not include quotes with test clocks if this and the customer parameter is not set. #[serde(skip_serializing_if = "Option::is_none")] @@ -1019,63 +789,6 @@ impl<'a> ListQuote<'a> { Self::default() } } -/// The status of the quote. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListQuoteStatus { - Accepted, - Canceled, - Draft, - Open, -} -impl ListQuoteStatus { - pub fn as_str(self) -> &'static str { - use ListQuoteStatus::*; - match self { - Accepted => "accepted", - Canceled => "canceled", - Draft => "draft", - Open => "open", - } - } -} - -impl std::str::FromStr for ListQuoteStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListQuoteStatus::*; - match s { - "accepted" => Ok(Accepted), - "canceled" => Ok(Canceled), - "draft" => Ok(Draft), - "open" => Ok(Open), - _ => Err(()), - } - } -} -impl AsRef for ListQuoteStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListQuoteStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListQuoteStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListQuoteStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListQuote<'a> { /// Returns a list of your quotes. pub fn send( @@ -1175,3 +888,60 @@ impl<'a> ListComputedUpfrontLineItemsQuote<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxParam { + /// Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. + pub enabled: bool, +} +impl AutomaticTaxParam { + pub fn new(enabled: bool) -> Self { + Self { enabled } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct DiscountsDataParam<'a> { + /// ID of the coupon to create a new discount for. + #[serde(skip_serializing_if = "Option::is_none")] + pub coupon: Option<&'a str>, + /// ID of an existing discount on the object (or one of its ancestors) to reuse. + #[serde(skip_serializing_if = "Option::is_none")] + pub discount: Option<&'a str>, +} +impl<'a> DiscountsDataParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct QuoteParam { + /// Number of days within which a customer must pay the invoice 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, +} +impl QuoteParam { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct TransferDataSpecs<'a> { + /// The amount that will be transferred automatically when the invoice is paid. + /// If no amount is set, the full amount is transferred. + /// There cannot be any line items with recurring prices when using this field. + #[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 total that will be transferred to the destination account. + /// By default, the entire amount is transferred to the destination. + /// There must be at least 1 line item with a recurring price to use this field. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_percent: Option, + /// ID of an existing, connected Stripe account. + pub destination: &'a str, +} +impl<'a> TransferDataSpecs<'a> { + pub fn new(destination: &'a str) -> Self { + Self { amount: None, amount_percent: None, destination } + } +} diff --git a/generated/stripe_billing/src/subscription/requests.rs b/generated/stripe_billing/src/subscription/requests.rs index 3208c4cb1..43d2c2504 100644 --- a/generated/stripe_billing/src/subscription/requests.rs +++ b/generated/stripe_billing/src/subscription/requests.rs @@ -48,7 +48,7 @@ pub struct ListSubscription<'a> { /// The collection method of the subscriptions to retrieve. /// Either `charge_automatically` or `send_invoice`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, #[serde(skip_serializing_if = "Option::is_none")] pub created: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -109,58 +109,6 @@ impl ListSubscriptionAutomaticTax { Self { enabled } } } -/// The collection method of the subscriptions to retrieve. -/// Either `charge_automatically` or `send_invoice`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListSubscriptionCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl ListSubscriptionCollectionMethod { - pub fn as_str(self) -> &'static str { - use ListSubscriptionCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for ListSubscriptionCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use ListSubscriptionCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for ListSubscriptionCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListSubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListSubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListSubscriptionCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// The status of the subscriptions to retrieve. /// 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). @@ -284,7 +232,7 @@ pub struct CreateSubscription<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// A timestamp at which the subscription should cancel. /// If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. /// If set during a future period, this will always cause a proration for that period. @@ -298,7 +246,7 @@ pub struct CreateSubscription<'a> { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The ID of the coupon to apply to this subscription. /// A coupon applied to a subscription will only affect invoices created for that particular subscription. #[serde(skip_serializing_if = "Option::is_none")] @@ -392,7 +340,7 @@ pub struct CreateSubscription<'a> { pub proration_behavior: Option, /// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. /// If set, trial_end will override the default trial period of the plan the customer is being subscribed to. /// The special value `now` can be provided to end the customer's trial immediately. @@ -571,84 +519,13 @@ impl CreateSubscriptionAutomaticTax { Self { enabled } } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// Pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionBillingThresholds { - /// Monetary threshold that triggers the subscription to advance to a new billing period - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_gte: Option, - /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. - /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub reset_billing_cycle_anchor: Option, -} -impl CreateSubscriptionBillingThresholds { - pub fn new() -> Self { - Self::default() - } -} -/// Either `charge_automatically`, or `send_invoice`. -/// 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 and mark the subscription as `active`. -/// Defaults to `charge_automatically`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl CreateSubscriptionCollectionMethod { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for CreateSubscriptionCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for CreateSubscriptionCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateSubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A list of up to 20 subscription items, each with an attached price. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateSubscriptionItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// 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. /// Individual keys can be unset by posting an empty value to them. @@ -678,18 +555,6 @@ impl<'a> CreateSubscriptionItems<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemsBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl CreateSubscriptionItemsBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateSubscriptionItemsPriceData<'a> { @@ -974,8 +839,7 @@ pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { pub card: Option>, /// This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: - Option>, + pub customer_balance: Option>, /// This sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -1475,60 +1339,6 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer: Option< - CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a>, - >, - /// The funding method type to be used when there are not enough funds in the customer balance. - /// Permitted values include: `bank_transfer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option<&'a str>, -} -impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - /// Configuration for eu_bank_transfer funding type. -#[serde(skip_serializing_if = "Option::is_none")] -pub eu_bank_transfer: Option>, - /// The bank transfer type that can be used for funding. - /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. -#[serde(rename = "type")] -#[serde(skip_serializing_if = "Option::is_none")] -pub type_: Option<&'a str>, - -} -impl<'a> CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, -> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> - CreateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, - > -{ - pub fn new(country: &'a str) -> Self { - Self { country } - } -} /// This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { @@ -2044,22 +1854,6 @@ impl serde::Serialize for CreateSubscriptionProrationBehavior { serializer.serialize_str(self.as_str()) } } -/// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionTransferData<'a> { - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> CreateSubscriptionTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount_percent: None, destination } - } -} /// Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. /// If set, trial_end will override the default trial period of the plan the customer is being subscribed to. /// The special value `now` can be provided to end the customer's trial immediately. @@ -2186,7 +1980,7 @@ pub struct UpdateSubscription<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// A timestamp at which the subscription should cancel. /// If set to a date before the current period ends, this will cause a proration if prorations have been enabled using `proration_behavior`. /// If set during a future period, this will always cause a proration for that period. @@ -2203,7 +1997,7 @@ pub struct UpdateSubscription<'a> { /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. /// Defaults to `charge_automatically`. #[serde(skip_serializing_if = "Option::is_none")] - pub collection_method: Option, + pub collection_method: Option, /// The ID of the coupon to apply to this subscription. /// A coupon applied to a subscription will only affect invoices created for that particular subscription. #[serde(skip_serializing_if = "Option::is_none")] @@ -2296,7 +2090,7 @@ pub struct UpdateSubscription<'a> { /// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. /// This will be unset if you POST an empty value. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. /// This will always overwrite any trials that might apply via a subscribed plan. /// If set, trial_end will override the default trial period of the plan the customer is being subscribed to. @@ -2490,23 +2284,6 @@ impl serde::Serialize for UpdateSubscriptionBillingCycleAnchor { serializer.serialize_str(self.as_str()) } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// Pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionBillingThresholds { - /// Monetary threshold that triggers the subscription to advance to a new billing period - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_gte: Option, - /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. - /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub reset_billing_cycle_anchor: Option, -} -impl UpdateSubscriptionBillingThresholds { - pub fn new() -> Self { - Self::default() - } -} /// Details about why this subscription was cancelled #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateSubscriptionCancellationDetails<'a> { @@ -2591,67 +2368,13 @@ impl serde::Serialize for UpdateSubscriptionCancellationDetailsFeedback { serializer.serialize_str(self.as_str()) } } -/// Either `charge_automatically`, or `send_invoice`. -/// 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 and mark the subscription as `active`. -/// Defaults to `charge_automatically`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl UpdateSubscriptionCollectionMethod { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for UpdateSubscriptionCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateSubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A list of up to 20 subscription items, each with an attached price. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateSubscriptionItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Delete all usage for a given subscription item. /// Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. #[serde(skip_serializing_if = "Option::is_none")] @@ -2692,18 +2415,6 @@ impl<'a> UpdateSubscriptionItems<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionItemsBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl UpdateSubscriptionItemsBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateSubscriptionItemsPriceData<'a> { @@ -3053,8 +2764,7 @@ pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptions<'a> { pub card: Option>, /// This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub customer_balance: - Option>, + pub customer_balance: Option>, /// This sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub konbini: Option<&'a serde_json::Value>, @@ -3554,60 +3264,6 @@ impl serde::Serialize serializer.serialize_str(self.as_str()) } } -/// This sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer: Option< - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a>, - >, - /// The funding method type to be used when there are not enough funds in the customer balance. - /// Permitted values include: `bank_transfer`. - #[serde(skip_serializing_if = "Option::is_none")] - pub funding_type: Option<&'a str>, -} -impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - /// Configuration for eu_bank_transfer funding type. -#[serde(skip_serializing_if = "Option::is_none")] -pub eu_bank_transfer: Option>, - /// The bank transfer type that can be used for funding. - /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. -#[serde(rename = "type")] -#[serde(skip_serializing_if = "Option::is_none")] -pub type_: Option<&'a str>, - -} -impl<'a> UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration for eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, -> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> - UpdateSubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer< - 'a, - > -{ - pub fn new(country: &'a str) -> Self { - Self { country } - } -} /// This sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateSubscriptionPaymentSettingsPaymentMethodOptionsUsBankAccount<'a> { @@ -4123,23 +3779,6 @@ impl serde::Serialize for UpdateSubscriptionProrationBehavior { serializer.serialize_str(self.as_str()) } } -/// If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. -/// This will be unset if you POST an empty value. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionTransferData<'a> { - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> UpdateSubscriptionTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount_percent: None, destination } - } -} /// Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. /// This will always overwrite any trials that might apply via a subscribed plan. /// If set, trial_end will override the default trial period of the plan the customer is being subscribed to. @@ -4594,3 +4233,85 @@ impl DeleteDiscountSubscription { ) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BillingThresholdsParam { + /// Monetary threshold that triggers the subscription to advance to a new billing period + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_gte: Option, + /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. + /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + #[serde(skip_serializing_if = "Option::is_none")] + pub reset_billing_cycle_anchor: Option, +} +impl BillingThresholdsParam { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ItemBillingThresholdsParam { + /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). + pub usage_gte: i64, +} +impl ItemBillingThresholdsParam { + pub fn new(usage_gte: i64) -> Self { + Self { usage_gte } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct EuBankTransferParam<'a> { + /// The desired country code of the bank account information. + /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + pub country: &'a str, +} +impl<'a> EuBankTransferParam<'a> { + pub fn new(country: &'a str) -> Self { + Self { country } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct TransferDataSpecs<'a> { + /// A non-negative decimal between 0 and 100, with at most two decimal places. + /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. + /// By default, the entire amount is transferred to the destination. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_percent: Option, + /// ID of an existing, connected Stripe account. + pub destination: &'a str, +} +impl<'a> TransferDataSpecs<'a> { + pub fn new(destination: &'a str) -> Self { + Self { amount_percent: None, destination } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BankTransferParam<'a> { + /// Configuration for eu_bank_transfer funding type. + #[serde(skip_serializing_if = "Option::is_none")] + pub eu_bank_transfer: Option>, + /// The bank transfer type that can be used for funding. + /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`. + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub type_: Option<&'a str>, +} +impl<'a> BankTransferParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct InvoicePaymentMethodOptionsParam<'a> { + /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`. + #[serde(skip_serializing_if = "Option::is_none")] + pub bank_transfer: Option>, + /// The funding method type to be used when there are not enough funds in the customer balance. + /// Permitted values include: `bank_transfer`. + #[serde(skip_serializing_if = "Option::is_none")] + pub funding_type: Option<&'a str>, +} +impl<'a> InvoicePaymentMethodOptionsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_billing/src/subscription_item/requests.rs b/generated/stripe_billing/src/subscription_item/requests.rs index b3f9dfac3..0e58809f0 100644 --- a/generated/stripe_billing/src/subscription_item/requests.rs +++ b/generated/stripe_billing/src/subscription_item/requests.rs @@ -65,7 +65,7 @@ pub struct CreateSubscriptionItem<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -140,18 +140,6 @@ impl<'a> CreateSubscriptionItem<'a> { } } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionItemBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl CreateSubscriptionItemBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. /// 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. @@ -464,7 +452,7 @@ pub struct UpdateSubscriptionItem<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -528,18 +516,6 @@ impl<'a> UpdateSubscriptionItem<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionItemBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl UpdateSubscriptionItemBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. /// 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. @@ -986,3 +962,13 @@ impl<'a> UsageRecordSummariesSubscriptionItem<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ItemBillingThresholdsParam { + /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). + pub usage_gte: i64, +} +impl ItemBillingThresholdsParam { + pub fn new(usage_gte: i64) -> Self { + Self { usage_gte } + } +} diff --git a/generated/stripe_billing/src/subscription_schedule/requests.rs b/generated/stripe_billing/src/subscription_schedule/requests.rs index d0dd5d101..d2fe75313 100644 --- a/generated/stripe_billing/src/subscription_schedule/requests.rs +++ b/generated/stripe_billing/src/subscription_schedule/requests.rs @@ -67,7 +67,7 @@ pub struct CreateSubscriptionSchedule<'a> { /// Possible values are `release` or `cancel` with the default being `release`. /// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub end_behavior: Option, + pub end_behavior: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -110,7 +110,7 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { pub application_fee_percent: Option, /// Default settings for automatic tax computation. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -119,7 +119,7 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -137,30 +137,19 @@ pub struct CreateSubscriptionScheduleDefaultSettings<'a> { pub description: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option, + pub invoice_settings: Option, /// The account on behalf of which to charge, for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option<&'a str>, /// The data with which to automatically create a Transfer for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } impl<'a> CreateSubscriptionScheduleDefaultSettings<'a> { pub fn new() -> Self { Self::default() } } -/// Default settings for automatic tax computation. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsAutomaticTax { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, -} -impl CreateSubscriptionScheduleDefaultSettingsAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -214,23 +203,6 @@ impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsBillingCycleA serializer.serialize_str(self.as_str()) } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// Pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsBillingThresholds { - /// Monetary threshold that triggers the subscription to advance to a new billing period - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_gte: Option, - /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. - /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub reset_billing_cycle_anchor: Option, -} -impl CreateSubscriptionScheduleDefaultSettingsBillingThresholds { - pub fn new() -> Self { - Self::default() - } -} /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -285,94 +257,6 @@ impl serde::Serialize for CreateSubscriptionScheduleDefaultSettingsCollectionMet serializer.serialize_str(self.as_str()) } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsInvoiceSettings { - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `collection_method=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, -} -impl CreateSubscriptionScheduleDefaultSettingsInvoiceSettings { - pub fn new() -> Self { - Self::default() - } -} -/// The data with which to automatically create a Transfer for each of the associated subscription's invoices. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionScheduleDefaultSettingsTransferData<'a> { - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> CreateSubscriptionScheduleDefaultSettingsTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount_percent: None, destination } - } -} -/// Behavior of the subscription schedule and underlying subscription when it ends. -/// Possible values are `release` or `cancel` with the default being `release`. -/// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSubscriptionScheduleEndBehavior { - Cancel, - None, - Release, - Renew, -} -impl CreateSubscriptionScheduleEndBehavior { - pub fn as_str(self) -> &'static str { - use CreateSubscriptionScheduleEndBehavior::*; - match self { - Cancel => "cancel", - None => "none", - Release => "release", - Renew => "renew", - } - } -} - -impl std::str::FromStr for CreateSubscriptionScheduleEndBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSubscriptionScheduleEndBehavior::*; - match s { - "cancel" => Ok(Cancel), - "none" => Ok(None), - "release" => Ok(Release), - "renew" => Ok(Renew), - _ => Err(()), - } - } -} -impl AsRef for CreateSubscriptionScheduleEndBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateSubscriptionScheduleEndBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSubscriptionScheduleEndBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSubscriptionScheduleEndBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// List representing phases of the subscription schedule. /// Each phase can be customized to have different durations, plans, and coupons. /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. @@ -390,7 +274,7 @@ pub struct CreateSubscriptionSchedulePhases<'a> { pub application_fee_percent: Option, /// Automatic tax settings for this phase. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -399,7 +283,7 @@ pub struct CreateSubscriptionSchedulePhases<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -432,7 +316,7 @@ pub struct CreateSubscriptionSchedulePhases<'a> { pub end_date: Option, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option, + pub invoice_settings: Option, /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. pub items: &'a [CreateSubscriptionSchedulePhasesItems<'a>], /// Integer representing the multiplier applied to the price interval. @@ -457,7 +341,7 @@ pub struct CreateSubscriptionSchedulePhases<'a> { pub proration_behavior: Option, /// The data with which to automatically create a Transfer for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. #[serde(skip_serializing_if = "Option::is_none")] pub trial: Option, @@ -599,17 +483,6 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesAddInvoiceItemsPriceDa serializer.serialize_str(self.as_str()) } } -/// Automatic tax settings for this phase. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesAutomaticTax { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, -} -impl CreateSubscriptionSchedulePhasesAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -663,23 +536,6 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesBillingCycleAnchor { serializer.serialize_str(self.as_str()) } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// Pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesBillingThresholds { - /// Monetary threshold that triggers the subscription to advance to a new billing period - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_gte: Option, - /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. - /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub reset_billing_cycle_anchor: Option, -} -impl CreateSubscriptionSchedulePhasesBillingThresholds { - pub fn new() -> Self { - Self::default() - } -} /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -734,26 +590,13 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesCollectionMethod { serializer.serialize_str(self.as_str()) } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesInvoiceSettings { - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `billing=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, -} -impl CreateSubscriptionSchedulePhasesInvoiceSettings { - pub fn new() -> Self { - Self::default() - } -} /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateSubscriptionSchedulePhasesItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. /// Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. /// Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. @@ -784,18 +627,6 @@ impl<'a> CreateSubscriptionSchedulePhasesItems<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesItemsBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl CreateSubscriptionSchedulePhasesItemsBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateSubscriptionSchedulePhasesItemsPriceData<'a> { @@ -1023,22 +854,6 @@ impl serde::Serialize for CreateSubscriptionSchedulePhasesProrationBehavior { serializer.serialize_str(self.as_str()) } } -/// The data with which to automatically create a Transfer for each of the associated subscription's invoices. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSubscriptionSchedulePhasesTransferData<'a> { - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> CreateSubscriptionSchedulePhasesTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount_percent: None, destination } - } -} /// When the subscription schedule starts. /// We recommend using `now` so that it starts the subscription immediately. /// You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. @@ -1089,7 +904,7 @@ pub struct UpdateSubscriptionSchedule<'a> { /// Possible values are `release` or `cancel` with the default being `release`. /// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. #[serde(skip_serializing_if = "Option::is_none")] - pub end_behavior: Option, + pub end_behavior: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -1126,7 +941,7 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { pub application_fee_percent: Option, /// Default settings for automatic tax computation. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -1135,7 +950,7 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -1153,30 +968,19 @@ pub struct UpdateSubscriptionScheduleDefaultSettings<'a> { pub description: Option<&'a str>, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option, + pub invoice_settings: Option, /// The account on behalf of which to charge, for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] pub on_behalf_of: Option<&'a str>, /// The data with which to automatically create a Transfer for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, } impl<'a> UpdateSubscriptionScheduleDefaultSettings<'a> { pub fn new() -> Self { Self::default() } } -/// Default settings for automatic tax computation. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsAutomaticTax { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, -} -impl UpdateSubscriptionScheduleDefaultSettingsAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -1230,23 +1034,6 @@ impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsBillingCycleA serializer.serialize_str(self.as_str()) } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// Pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsBillingThresholds { - /// Monetary threshold that triggers the subscription to advance to a new billing period - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_gte: Option, - /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. - /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub reset_billing_cycle_anchor: Option, -} -impl UpdateSubscriptionScheduleDefaultSettingsBillingThresholds { - pub fn new() -> Self { - Self::default() - } -} /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -1301,94 +1088,6 @@ impl serde::Serialize for UpdateSubscriptionScheduleDefaultSettingsCollectionMet serializer.serialize_str(self.as_str()) } } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsInvoiceSettings { - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `collection_method=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, -} -impl UpdateSubscriptionScheduleDefaultSettingsInvoiceSettings { - pub fn new() -> Self { - Self::default() - } -} -/// The data with which to automatically create a Transfer for each of the associated subscription's invoices. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionScheduleDefaultSettingsTransferData<'a> { - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> UpdateSubscriptionScheduleDefaultSettingsTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount_percent: None, destination } - } -} -/// Behavior of the subscription schedule and underlying subscription when it ends. -/// Possible values are `release` or `cancel` with the default being `release`. -/// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSubscriptionScheduleEndBehavior { - Cancel, - None, - Release, - Renew, -} -impl UpdateSubscriptionScheduleEndBehavior { - pub fn as_str(self) -> &'static str { - use UpdateSubscriptionScheduleEndBehavior::*; - match self { - Cancel => "cancel", - None => "none", - Release => "release", - Renew => "renew", - } - } -} - -impl std::str::FromStr for UpdateSubscriptionScheduleEndBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSubscriptionScheduleEndBehavior::*; - match s { - "cancel" => Ok(Cancel), - "none" => Ok(None), - "release" => Ok(Release), - "renew" => Ok(Renew), - _ => Err(()), - } - } -} -impl AsRef for UpdateSubscriptionScheduleEndBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateSubscriptionScheduleEndBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSubscriptionScheduleEndBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSubscriptionScheduleEndBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// List representing phases of the subscription schedule. /// Each phase can be customized to have different durations, plans, and coupons. /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. @@ -1407,7 +1106,7 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { pub application_fee_percent: Option, /// Automatic tax settings for this phase. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -1416,7 +1115,7 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// Pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -1449,7 +1148,7 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { pub end_date: Option, /// All invoices will be billed using the specified settings. #[serde(skip_serializing_if = "Option::is_none")] - pub invoice_settings: Option, + pub invoice_settings: Option, /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. pub items: &'a [UpdateSubscriptionSchedulePhasesItems<'a>], /// Integer representing the multiplier applied to the price interval. @@ -1478,7 +1177,7 @@ pub struct UpdateSubscriptionSchedulePhases<'a> { pub start_date: Option, /// The data with which to automatically create a Transfer for each of the associated subscription's invoices. #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option>, + pub transfer_data: Option>, /// If set to true the entire phase is counted as a trial and the customer will not be charged for any fees. #[serde(skip_serializing_if = "Option::is_none")] pub trial: Option, @@ -1621,17 +1320,6 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesAddInvoiceItemsPriceDa serializer.serialize_str(self.as_str()) } } -/// Automatic tax settings for this phase. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesAutomaticTax { - /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. - pub enabled: bool, -} -impl UpdateSubscriptionSchedulePhasesAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. /// Cannot be set to `phase_start` if this phase specifies a trial. /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -1685,23 +1373,6 @@ impl serde::Serialize for UpdateSubscriptionSchedulePhasesBillingCycleAnchor { serializer.serialize_str(self.as_str()) } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// Pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesBillingThresholds { - /// Monetary threshold that triggers the subscription to advance to a new billing period - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_gte: Option, - /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. - /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub reset_billing_cycle_anchor: Option, -} -impl UpdateSubscriptionSchedulePhasesBillingThresholds { - pub fn new() -> Self { - Self::default() - } -} /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. @@ -1764,26 +1435,13 @@ pub enum UpdateSubscriptionSchedulePhasesEndDate { Timestamp(stripe_types::Timestamp), Now, } -/// All invoices will be billed using the specified settings. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesInvoiceSettings { - /// Number of days within which a customer must pay invoices generated by this subscription schedule. - /// This value will be `null` for subscription schedules where `billing=charge_automatically`. - #[serde(skip_serializing_if = "Option::is_none")] - pub days_until_due: Option, -} -impl UpdateSubscriptionSchedulePhasesInvoiceSettings { - pub fn new() -> Self { - Self::default() - } -} /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateSubscriptionSchedulePhasesItems<'a> { /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. /// When updating, pass an empty string to remove previously-defined thresholds. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_thresholds: Option, + pub billing_thresholds: Option, /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. /// Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. /// Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. @@ -1814,18 +1472,6 @@ impl<'a> UpdateSubscriptionSchedulePhasesItems<'a> { Self::default() } } -/// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. -/// When updating, pass an empty string to remove previously-defined thresholds. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesItemsBillingThresholds { - /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). - pub usage_gte: i64, -} -impl UpdateSubscriptionSchedulePhasesItemsBillingThresholds { - pub fn new(usage_gte: i64) -> Self { - Self { usage_gte } - } -} /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateSubscriptionSchedulePhasesItemsPriceData<'a> { @@ -2061,22 +1707,6 @@ pub enum UpdateSubscriptionSchedulePhasesStartDate { Timestamp(stripe_types::Timestamp), Now, } -/// The data with which to automatically create a Transfer for each of the associated subscription's invoices. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSubscriptionSchedulePhasesTransferData<'a> { - /// A non-negative decimal between 0 and 100, with at most two decimal places. - /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. - /// By default, the entire amount is transferred to the destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount_percent: Option, - /// ID of an existing, connected Stripe account. - pub destination: &'a str, -} -impl<'a> UpdateSubscriptionSchedulePhasesTransferData<'a> { - pub fn new(destination: &'a str) -> Self { - Self { amount_percent: None, destination } - } -} /// Sets the phase to trialing from the start date to this date. /// Must be before the phase end date, can not be combined with `trial`. #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -2218,3 +1848,77 @@ impl<'a> ReleaseSubscriptionSchedule<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxConfig { + /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. + pub enabled: bool, +} +impl AutomaticTaxConfig { + pub fn new(enabled: bool) -> Self { + Self { enabled } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BillingThresholdsParam { + /// Monetary threshold that triggers the subscription to advance to a new billing period + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_gte: Option, + /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. + /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. + #[serde(skip_serializing_if = "Option::is_none")] + pub reset_billing_cycle_anchor: Option, +} +impl BillingThresholdsParam { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SubscriptionScheduleDefaultSettingsParam { + /// Number of days within which a customer must pay invoices generated by this subscription schedule. + /// This value will be `null` for subscription schedules where `collection_method=charge_automatically`. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, +} +impl SubscriptionScheduleDefaultSettingsParam { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct TransferDataSpecs<'a> { + /// A non-negative decimal between 0 and 100, with at most two decimal places. + /// This represents the percentage of the subscription invoice total that will be transferred to the destination account. + /// By default, the entire amount is transferred to the destination. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount_percent: Option, + /// ID of an existing, connected Stripe account. + pub destination: &'a str, +} +impl<'a> TransferDataSpecs<'a> { + pub fn new(destination: &'a str) -> Self { + Self { amount_percent: None, destination } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct InvoiceSettings { + /// Number of days within which a customer must pay invoices generated by this subscription schedule. + /// This value will be `null` for subscription schedules where `billing=charge_automatically`. + #[serde(skip_serializing_if = "Option::is_none")] + pub days_until_due: Option, +} +impl InvoiceSettings { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct ItemBillingThresholdsParam { + /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)). + pub usage_gte: i64, +} +impl ItemBillingThresholdsParam { + pub fn new(usage_gte: i64) -> Self { + Self { usage_gte } + } +} diff --git a/generated/stripe_checkout/src/checkout_session/requests.rs b/generated/stripe_checkout/src/checkout_session/requests.rs index da0e45d48..8745ed77a 100644 --- a/generated/stripe_checkout/src/checkout_session/requests.rs +++ b/generated/stripe_checkout/src/checkout_session/requests.rs @@ -31,7 +31,7 @@ pub struct ListCheckoutSession<'a> { pub starting_after: Option<&'a str>, /// Only return the Checkout Sessions matching the given status. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Only return the Checkout Session for the subscription specified. #[serde(skip_serializing_if = "Option::is_none")] pub subscription: Option<&'a str>, @@ -52,60 +52,6 @@ impl<'a> ListCheckoutSessionCustomerDetails<'a> { Self { email } } } -/// Only return the Checkout Sessions matching the given status. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListCheckoutSessionStatus { - Complete, - Expired, - Open, -} -impl ListCheckoutSessionStatus { - pub fn as_str(self) -> &'static str { - use ListCheckoutSessionStatus::*; - match self { - Complete => "complete", - Expired => "expired", - Open => "open", - } - } -} - -impl std::str::FromStr for ListCheckoutSessionStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListCheckoutSessionStatus::*; - match s { - "complete" => Ok(Complete), - "expired" => Ok(Expired), - "open" => Ok(Open), - _ => Err(()), - } - } -} -impl AsRef for ListCheckoutSessionStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListCheckoutSessionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListCheckoutSessionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListCheckoutSessionStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListCheckoutSession<'a> { /// Returns a list of Checkout Sessions. pub fn send( @@ -154,7 +100,8 @@ pub struct CreateCheckoutSession<'a> { 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, + pub billing_address_collection: + Option, /// If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website. #[serde(skip_serializing_if = "Option::is_none")] pub cancel_url: Option<&'a str>, @@ -243,7 +190,7 @@ pub struct CreateCheckoutSession<'a> { /// The IETF language tag of the locale Checkout is displayed in. /// If blank or `auto`, the browser's locale is used. #[serde(skip_serializing_if = "Option::is_none")] - pub locale: Option, + pub locale: Option, /// 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. /// Individual keys can be unset by posting an empty value to them. @@ -253,7 +200,7 @@ pub struct CreateCheckoutSession<'a> { /// The mode of the Checkout Session. /// Pass `subscription` if the Checkout Session includes at least one recurring item. #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub mode: Option, /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[serde(skip_serializing_if = "Option::is_none")] pub payment_intent_data: Option>, @@ -296,7 +243,7 @@ pub struct CreateCheckoutSession<'a> { /// By default, Stripe will always redirect to your return_url after a successful confirmation. /// If you set `redirect_on_completion: 'if_required'`, then we will only redirect if your user chooses a redirect-based payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub redirect_on_completion: Option, + pub redirect_on_completion: Option, /// The URL to redirect your customer back to after they authenticate or cancel their payment on the /// payment method's app or site. This parameter is required if ui_mode is `embedded` /// and redirect-based payment methods are enabled on the session. @@ -316,7 +263,7 @@ pub struct CreateCheckoutSession<'a> { /// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions /// in `subscription` or `setup` mode. #[serde(skip_serializing_if = "Option::is_none")] - pub submit_type: Option, + pub submit_type: Option, /// A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode. #[serde(skip_serializing_if = "Option::is_none")] pub subscription_data: Option>, @@ -332,7 +279,7 @@ pub struct CreateCheckoutSession<'a> { pub tax_id_collection: Option, /// `ui_mode` can be `hosted` or `embedded`. The default is `hosted`. #[serde(skip_serializing_if = "Option::is_none")] - pub ui_mode: Option, + pub ui_mode: Option, } impl<'a> CreateCheckoutSession<'a> { pub fn new() -> Self { @@ -378,57 +325,6 @@ impl CreateCheckoutSessionAutomaticTax { Self { enabled } } } -/// Specify whether Checkout should collect the customer's billing address. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionBillingAddressCollection { - Auto, - Required, -} -impl CreateCheckoutSessionBillingAddressCollection { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionBillingAddressCollection::*; - match self { - Auto => "auto", - Required => "required", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionBillingAddressCollection { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionBillingAddressCollection::*; - match s { - "auto" => Ok(Auto), - "required" => Ok(Required), - _ => Err(()), - } - } -} -impl AsRef for CreateCheckoutSessionBillingAddressCollection { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCheckoutSessionBillingAddressCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionBillingAddressCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionBillingAddressCollection { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Configure fields for the Checkout Session to gather active consent from customers. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateCheckoutSessionConsentCollection { @@ -765,53 +661,19 @@ impl serde::Serialize for CreateCheckoutSessionCustomFieldsType { pub struct CreateCheckoutSessionCustomText<'a> { /// Custom text that should be displayed alongside shipping address collection. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_address: Option>, + pub shipping_address: Option>, /// Custom text that should be displayed alongside the payment confirmation button. #[serde(skip_serializing_if = "Option::is_none")] - pub submit: Option>, + pub submit: Option>, /// Custom text that should be displayed in place of the default terms of service agreement text. #[serde(skip_serializing_if = "Option::is_none")] - pub terms_of_service_acceptance: - Option>, + pub terms_of_service_acceptance: Option>, } impl<'a> CreateCheckoutSessionCustomText<'a> { pub fn new() -> Self { Self::default() } } -/// Custom text that should be displayed alongside shipping address collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomTextShippingAddress<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> CreateCheckoutSessionCustomTextShippingAddress<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} -/// Custom text that should be displayed alongside the payment confirmation button. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomTextSubmit<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> CreateCheckoutSessionCustomTextSubmit<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} -/// Custom text that should be displayed in place of the default terms of service agreement text. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCheckoutSessionCustomTextTermsOfServiceAcceptance<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> CreateCheckoutSessionCustomTextTermsOfServiceAcceptance<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} /// Configure whether a Checkout Session creates a [Customer](https://stripe.com/docs/api/customers) during Session confirmation. /// /// When a Customer is not created, you can still retrieve email, address, and other customer data entered in Checkout. @@ -1461,234 +1323,6 @@ impl serde::Serialize for CreateCheckoutSessionLineItemsPriceDataTaxBehavior { serializer.serialize_str(self.as_str()) } } -/// The IETF language tag of the locale Checkout is displayed in. -/// If blank or `auto`, the browser's locale is used. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateCheckoutSessionLocale { - Auto, - Bg, - Cs, - Da, - De, - El, - En, - EnMinusGb, - Es, - EsMinus419, - Et, - Fi, - Fil, - Fr, - FrMinusCa, - Hr, - Hu, - Id, - It, - Ja, - Ko, - Lt, - Lv, - Ms, - Mt, - Nb, - Nl, - Pl, - Pt, - PtMinusBr, - Ro, - Ru, - Sk, - Sl, - Sv, - Th, - Tr, - Vi, - Zh, - ZhMinusHk, - ZhMinusTw, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl CreateCheckoutSessionLocale { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionLocale::*; - match self { - Auto => "auto", - Bg => "bg", - Cs => "cs", - Da => "da", - De => "de", - El => "el", - En => "en", - EnMinusGb => "en-GB", - Es => "es", - EsMinus419 => "es-419", - Et => "et", - Fi => "fi", - Fil => "fil", - Fr => "fr", - FrMinusCa => "fr-CA", - Hr => "hr", - Hu => "hu", - Id => "id", - It => "it", - Ja => "ja", - Ko => "ko", - Lt => "lt", - Lv => "lv", - Ms => "ms", - Mt => "mt", - Nb => "nb", - Nl => "nl", - Pl => "pl", - Pt => "pt", - PtMinusBr => "pt-BR", - Ro => "ro", - Ru => "ru", - Sk => "sk", - Sl => "sl", - Sv => "sv", - Th => "th", - Tr => "tr", - Vi => "vi", - Zh => "zh", - ZhMinusHk => "zh-HK", - ZhMinusTw => "zh-TW", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionLocale { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionLocale::*; - match s { - "auto" => Ok(Auto), - "bg" => Ok(Bg), - "cs" => Ok(Cs), - "da" => Ok(Da), - "de" => Ok(De), - "el" => Ok(El), - "en" => Ok(En), - "en-GB" => Ok(EnMinusGb), - "es" => Ok(Es), - "es-419" => Ok(EsMinus419), - "et" => Ok(Et), - "fi" => Ok(Fi), - "fil" => Ok(Fil), - "fr" => Ok(Fr), - "fr-CA" => Ok(FrMinusCa), - "hr" => Ok(Hr), - "hu" => Ok(Hu), - "id" => Ok(Id), - "it" => Ok(It), - "ja" => Ok(Ja), - "ko" => Ok(Ko), - "lt" => Ok(Lt), - "lv" => Ok(Lv), - "ms" => Ok(Ms), - "mt" => Ok(Mt), - "nb" => Ok(Nb), - "nl" => Ok(Nl), - "pl" => Ok(Pl), - "pt" => Ok(Pt), - "pt-BR" => Ok(PtMinusBr), - "ro" => Ok(Ro), - "ru" => Ok(Ru), - "sk" => Ok(Sk), - "sl" => Ok(Sl), - "sv" => Ok(Sv), - "th" => Ok(Th), - "tr" => Ok(Tr), - "vi" => Ok(Vi), - "zh" => Ok(Zh), - "zh-HK" => Ok(ZhMinusHk), - "zh-TW" => Ok(ZhMinusTw), - _ => Err(()), - } - } -} -impl AsRef for CreateCheckoutSessionLocale { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCheckoutSessionLocale { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionLocale { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionLocale { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The mode of the Checkout Session. -/// Pass `subscription` if the Checkout Session includes at least one recurring item. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionMode { - Payment, - Setup, - Subscription, -} -impl CreateCheckoutSessionMode { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionMode::*; - match self { - Payment => "payment", - Setup => "setup", - Subscription => "subscription", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionMode { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionMode::*; - match s { - "payment" => Ok(Payment), - "setup" => Ok(Setup), - "subscription" => Ok(Subscription), - _ => Err(()), - } - } -} -impl AsRef for CreateCheckoutSessionMode { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCheckoutSessionMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionMode { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateCheckoutSessionPaymentIntentData<'a> { @@ -5388,62 +5022,6 @@ impl CreateCheckoutSessionPhoneNumberCollection { Self { enabled } } } -/// This parameter applies to `ui_mode: embedded`. -/// By default, Stripe will always redirect to your return_url after a successful confirmation. -/// If you set `redirect_on_completion: 'if_required'`, then we will only redirect if your user chooses a redirect-based payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionRedirectOnCompletion { - Always, - IfRequired, - Never, -} -impl CreateCheckoutSessionRedirectOnCompletion { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionRedirectOnCompletion::*; - match self { - Always => "always", - IfRequired => "if_required", - Never => "never", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionRedirectOnCompletion { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionRedirectOnCompletion::*; - match s { - "always" => Ok(Always), - "if_required" => Ok(IfRequired), - "never" => Ok(Never), - _ => Err(()), - } - } -} -impl AsRef for CreateCheckoutSessionRedirectOnCompletion { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCheckoutSessionRedirectOnCompletion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionRedirectOnCompletion { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionRedirectOnCompletion { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in `setup` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateCheckoutSessionSetupIntentData<'a> { @@ -6702,66 +6280,6 @@ impl serde::Serialize for CreateCheckoutSessionShippingOptionsShippingRateDataTy serializer.serialize_str(self.as_str()) } } -/// Describes the type of transaction being performed by Checkout in order to customize -/// relevant text on the page, such as the submit button. `submit_type` can only be -/// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions -/// in `subscription` or `setup` mode. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionSubmitType { - Auto, - Book, - Donate, - Pay, -} -impl CreateCheckoutSessionSubmitType { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionSubmitType::*; - match self { - Auto => "auto", - Book => "book", - Donate => "donate", - Pay => "pay", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionSubmitType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionSubmitType::*; - match s { - "auto" => Ok(Auto), - "book" => Ok(Book), - "donate" => Ok(Donate), - "pay" => Ok(Pay), - _ => Err(()), - } - } -} -impl AsRef for CreateCheckoutSessionSubmitType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCheckoutSessionSubmitType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionSubmitType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionSubmitType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateCheckoutSessionSubscriptionData<'a> { @@ -6988,57 +6506,6 @@ impl CreateCheckoutSessionTaxIdCollection { Self { enabled } } } -/// `ui_mode` can be `hosted` or `embedded`. The default is `hosted`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCheckoutSessionUiMode { - Embedded, - Hosted, -} -impl CreateCheckoutSessionUiMode { - pub fn as_str(self) -> &'static str { - use CreateCheckoutSessionUiMode::*; - match self { - Embedded => "embedded", - Hosted => "hosted", - } - } -} - -impl std::str::FromStr for CreateCheckoutSessionUiMode { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCheckoutSessionUiMode::*; - match s { - "embedded" => Ok(Embedded), - "hosted" => Ok(Hosted), - _ => Err(()), - } - } -} -impl AsRef for CreateCheckoutSessionUiMode { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCheckoutSessionUiMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCheckoutSessionUiMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCheckoutSessionUiMode { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateCheckoutSession<'a> { /// Creates a Session object. pub fn send( @@ -7120,3 +6587,13 @@ impl<'a> ExpireCheckoutSession<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomTextPositionParam<'a> { + /// Text may be up to 1200 characters in length. + pub message: &'a str, +} +impl<'a> CustomTextPositionParam<'a> { + pub fn new(message: &'a str) -> Self { + Self { message } + } +} diff --git a/generated/stripe_checkout/src/checkout_session/types.rs b/generated/stripe_checkout/src/checkout_session/types.rs index f11064287..beaa2136d 100644 --- a/generated/stripe_checkout/src/checkout_session/types.rs +++ b/generated/stripe_checkout/src/checkout_session/types.rs @@ -26,7 +26,8 @@ pub struct CheckoutSession { pub amount_total: Option, pub automatic_tax: stripe_checkout::PaymentPagesCheckoutSessionAutomaticTax, /// Describes whether Checkout should collect the customer's billing address. - pub billing_address_collection: Option, + pub billing_address_collection: + Option, /// If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website. pub cancel_url: Option, /// A unique string to reference the Checkout Session. This can be a @@ -82,12 +83,12 @@ pub struct CheckoutSession { pub livemode: bool, /// The IETF language tag of the locale Checkout is displayed in. /// If blank or `auto`, the browser's locale is used. - pub locale: Option, + pub locale: Option, /// 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: Option>, /// The mode of the Checkout Session. - pub mode: CheckoutSessionMode, + pub mode: stripe_checkout::CheckoutSessionMode, /// The ID of the PaymentIntent for Checkout Sessions in `payment` mode. pub payment_intent: Option>, /// The ID of the Payment Link that created this Session. @@ -114,7 +115,7 @@ pub struct CheckoutSession { /// By default, Stripe will always redirect to your return_url after a successful confirmation. /// If you set `redirect_on_completion: 'if_required'`, then we will only redirect if your user chooses a redirect-based payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub redirect_on_completion: Option, + pub redirect_on_completion: Option, /// Applies to Checkout Sessions with `ui_mode: embedded`. /// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. #[serde(skip_serializing_if = "Option::is_none")] @@ -131,12 +132,12 @@ pub struct CheckoutSession { /// The shipping rate options applied to this Session. pub shipping_options: Vec, /// The status of the Checkout Session, one of `open`, `complete`, or `expired`. - pub status: Option, + pub status: Option, /// Describes the type of transaction being performed by Checkout in order to customize /// relevant text on the page, such as the submit button. `submit_type` can only be /// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions /// in `subscription` or `setup` mode. - pub submit_type: Option, + pub submit_type: Option, /// The ID of the subscription for Checkout Sessions in `subscription` mode. pub subscription: Option>, /// The URL the customer will be directed to after the payment or @@ -147,7 +148,7 @@ pub struct CheckoutSession { /// Tax and discount details for the computed total amount. pub total_details: Option, /// The UI mode of the Session. Can be `hosted` (default) or `embedded`. - pub ui_mode: Option, + pub ui_mode: Option, /// The URL to the Checkout Session. /// Redirect customers to this URL to take them to Checkout. /// If you’re using [Custom Domains](https://stripe.com/docs/payments/checkout/custom-domains), the URL will use your subdomain. @@ -155,50 +156,50 @@ pub struct CheckoutSession { /// This value is only present when the session is active. pub url: Option, } -/// Describes whether Checkout should collect the customer's billing address. +/// Configure whether a Checkout Session creates a Customer when the Checkout Session completes. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CheckoutSessionBillingAddressCollection { - Auto, - Required, +pub enum CheckoutSessionCustomerCreation { + Always, + IfRequired, } -impl CheckoutSessionBillingAddressCollection { +impl CheckoutSessionCustomerCreation { pub fn as_str(self) -> &'static str { - use CheckoutSessionBillingAddressCollection::*; + use CheckoutSessionCustomerCreation::*; match self { - Auto => "auto", - Required => "required", + Always => "always", + IfRequired => "if_required", } } } -impl std::str::FromStr for CheckoutSessionBillingAddressCollection { +impl std::str::FromStr for CheckoutSessionCustomerCreation { type Err = (); fn from_str(s: &str) -> Result { - use CheckoutSessionBillingAddressCollection::*; + use CheckoutSessionCustomerCreation::*; match s { - "auto" => Ok(Auto), - "required" => Ok(Required), + "always" => Ok(Always), + "if_required" => Ok(IfRequired), _ => Err(()), } } } -impl AsRef for CheckoutSessionBillingAddressCollection { +impl AsRef for CheckoutSessionCustomerCreation { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for CheckoutSessionBillingAddressCollection { +impl std::fmt::Display for CheckoutSessionCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CheckoutSessionBillingAddressCollection { +impl std::fmt::Debug for CheckoutSessionCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CheckoutSessionBillingAddressCollection { +impl serde::Serialize for CheckoutSessionCustomerCreation { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -206,24 +207,24 @@ impl serde::Serialize for CheckoutSessionBillingAddressCollection { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for CheckoutSessionBillingAddressCollection { +impl<'de> serde::Deserialize<'de> for CheckoutSessionCustomerCreation { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for CheckoutSessionBillingAddressCollection") + serde::de::Error::custom("Unknown value for CheckoutSessionCustomerCreation") }) } } -/// Configure whether a Checkout Session creates a Customer when the Checkout Session completes. +/// Configure whether a Checkout Session should collect a payment method. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum CheckoutSessionCustomerCreation { +pub enum CheckoutSessionPaymentMethodCollection { Always, IfRequired, } -impl CheckoutSessionCustomerCreation { +impl CheckoutSessionPaymentMethodCollection { pub fn as_str(self) -> &'static str { - use CheckoutSessionCustomerCreation::*; + use CheckoutSessionPaymentMethodCollection::*; match self { Always => "always", IfRequired => "if_required", @@ -231,10 +232,10 @@ impl CheckoutSessionCustomerCreation { } } -impl std::str::FromStr for CheckoutSessionCustomerCreation { +impl std::str::FromStr for CheckoutSessionPaymentMethodCollection { type Err = (); fn from_str(s: &str) -> Result { - use CheckoutSessionCustomerCreation::*; + use CheckoutSessionPaymentMethodCollection::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -242,23 +243,23 @@ impl std::str::FromStr for CheckoutSessionCustomerCreation { } } } -impl AsRef for CheckoutSessionCustomerCreation { +impl AsRef for CheckoutSessionPaymentMethodCollection { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for CheckoutSessionCustomerCreation { +impl std::fmt::Display for CheckoutSessionPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CheckoutSessionCustomerCreation { +impl std::fmt::Debug for CheckoutSessionPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CheckoutSessionCustomerCreation { +impl serde::Serialize for CheckoutSessionPaymentMethodCollection { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -266,17 +267,144 @@ impl serde::Serialize for CheckoutSessionCustomerCreation { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for CheckoutSessionCustomerCreation { +impl<'de> serde::Deserialize<'de> for CheckoutSessionPaymentMethodCollection { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for CheckoutSessionCustomerCreation") + serde::de::Error::custom("Unknown value for CheckoutSessionPaymentMethodCollection") + }) + } +} +/// The payment status of the Checkout Session, one of `paid`, `unpaid`, or `no_payment_required`. +/// You can use this value to decide when to fulfill your customer's order. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CheckoutSessionPaymentStatus { + NoPaymentRequired, + Paid, + Unpaid, +} +impl CheckoutSessionPaymentStatus { + pub fn as_str(self) -> &'static str { + use CheckoutSessionPaymentStatus::*; + match self { + NoPaymentRequired => "no_payment_required", + Paid => "paid", + Unpaid => "unpaid", + } + } +} + +impl std::str::FromStr for CheckoutSessionPaymentStatus { + type Err = (); + fn from_str(s: &str) -> Result { + use CheckoutSessionPaymentStatus::*; + match s { + "no_payment_required" => Ok(NoPaymentRequired), + "paid" => Ok(Paid), + "unpaid" => Ok(Unpaid), + _ => Err(()), + } + } +} +impl AsRef for CheckoutSessionPaymentStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for CheckoutSessionPaymentStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CheckoutSessionPaymentStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CheckoutSessionPaymentStatus { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +impl<'de> serde::Deserialize<'de> for CheckoutSessionPaymentStatus { + fn deserialize>(deserializer: D) -> Result { + use std::str::FromStr; + let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for CheckoutSessionPaymentStatus")) + } +} +impl stripe_types::Object for CheckoutSession { + type Id = stripe_checkout::CheckoutSessionId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(CheckoutSessionId, "cs_"); +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CheckoutSessionBillingAddressCollection { + Auto, + Required, +} +impl CheckoutSessionBillingAddressCollection { + pub fn as_str(self) -> &'static str { + use CheckoutSessionBillingAddressCollection::*; + match self { + Auto => "auto", + Required => "required", + } + } +} + +impl std::str::FromStr for CheckoutSessionBillingAddressCollection { + type Err = (); + fn from_str(s: &str) -> Result { + use CheckoutSessionBillingAddressCollection::*; + match s { + "auto" => Ok(Auto), + "required" => Ok(Required), + _ => Err(()), + } + } +} +impl AsRef for CheckoutSessionBillingAddressCollection { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for CheckoutSessionBillingAddressCollection { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CheckoutSessionBillingAddressCollection { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CheckoutSessionBillingAddressCollection { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +impl<'de> serde::Deserialize<'de> for CheckoutSessionBillingAddressCollection { + fn deserialize>(deserializer: D) -> Result { + use std::str::FromStr; + let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; + Self::from_str(&s).map_err(|_| { + serde::de::Error::custom("Unknown value for CheckoutSessionBillingAddressCollection") }) } } -/// The IETF language tag of the locale Checkout is displayed in. -/// If blank or `auto`, the browser's locale is used. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum CheckoutSessionLocale { @@ -455,7 +583,6 @@ impl<'de> serde::Deserialize<'de> for CheckoutSessionLocale { Ok(Self::from_str(&s).unwrap_or(CheckoutSessionLocale::Unknown)) } } -/// The mode of the Checkout Session. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CheckoutSessionMode { Payment, @@ -517,132 +644,6 @@ impl<'de> serde::Deserialize<'de> for CheckoutSessionMode { .map_err(|_| serde::de::Error::custom("Unknown value for CheckoutSessionMode")) } } -/// Configure whether a Checkout Session should collect a payment method. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CheckoutSessionPaymentMethodCollection { - Always, - IfRequired, -} -impl CheckoutSessionPaymentMethodCollection { - pub fn as_str(self) -> &'static str { - use CheckoutSessionPaymentMethodCollection::*; - match self { - Always => "always", - IfRequired => "if_required", - } - } -} - -impl std::str::FromStr for CheckoutSessionPaymentMethodCollection { - type Err = (); - fn from_str(s: &str) -> Result { - use CheckoutSessionPaymentMethodCollection::*; - match s { - "always" => Ok(Always), - "if_required" => Ok(IfRequired), - _ => Err(()), - } - } -} -impl AsRef for CheckoutSessionPaymentMethodCollection { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CheckoutSessionPaymentMethodCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CheckoutSessionPaymentMethodCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CheckoutSessionPaymentMethodCollection { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for CheckoutSessionPaymentMethodCollection { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for CheckoutSessionPaymentMethodCollection") - }) - } -} -/// The payment status of the Checkout Session, one of `paid`, `unpaid`, or `no_payment_required`. -/// You can use this value to decide when to fulfill your customer's order. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CheckoutSessionPaymentStatus { - NoPaymentRequired, - Paid, - Unpaid, -} -impl CheckoutSessionPaymentStatus { - pub fn as_str(self) -> &'static str { - use CheckoutSessionPaymentStatus::*; - match self { - NoPaymentRequired => "no_payment_required", - Paid => "paid", - Unpaid => "unpaid", - } - } -} - -impl std::str::FromStr for CheckoutSessionPaymentStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use CheckoutSessionPaymentStatus::*; - match s { - "no_payment_required" => Ok(NoPaymentRequired), - "paid" => Ok(Paid), - "unpaid" => Ok(Unpaid), - _ => Err(()), - } - } -} -impl AsRef for CheckoutSessionPaymentStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CheckoutSessionPaymentStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CheckoutSessionPaymentStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CheckoutSessionPaymentStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for CheckoutSessionPaymentStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for CheckoutSessionPaymentStatus")) - } -} -/// Applies to Checkout Sessions with `ui_mode: embedded`. -/// By default, Stripe will always redirect to your return_url after a successful confirmation. -/// If you set `redirect_on_completion: 'if_required'`, then we will only redirect if your user chooses a redirect-based payment method. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CheckoutSessionRedirectOnCompletion { Always, @@ -705,7 +706,6 @@ impl<'de> serde::Deserialize<'de> for CheckoutSessionRedirectOnCompletion { }) } } -/// The status of the Checkout Session, one of `open`, `complete`, or `expired`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CheckoutSessionStatus { Complete, @@ -767,10 +767,6 @@ impl<'de> serde::Deserialize<'de> for CheckoutSessionStatus { .map_err(|_| serde::de::Error::custom("Unknown value for CheckoutSessionStatus")) } } -/// Describes the type of transaction being performed by Checkout in order to customize -/// relevant text on the page, such as the submit button. `submit_type` can only be -/// specified on Checkout Sessions in `payment` mode, but not Checkout Sessions -/// in `subscription` or `setup` mode. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CheckoutSessionSubmitType { Auto, @@ -835,7 +831,6 @@ impl<'de> serde::Deserialize<'de> for CheckoutSessionSubmitType { .map_err(|_| serde::de::Error::custom("Unknown value for CheckoutSessionSubmitType")) } } -/// The UI mode of the Session. Can be `hosted` (default) or `embedded`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CheckoutSessionUiMode { Embedded, @@ -894,10 +889,3 @@ impl<'de> serde::Deserialize<'de> for CheckoutSessionUiMode { .map_err(|_| serde::de::Error::custom("Unknown value for CheckoutSessionUiMode")) } } -impl stripe_types::Object for CheckoutSession { - type Id = stripe_checkout::CheckoutSessionId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(CheckoutSessionId, "cs_"); diff --git a/generated/stripe_connect/src/account/requests.rs b/generated/stripe_connect/src/account/requests.rs index ecb003e20..7c6e39ce8 100644 --- a/generated/stripe_connect/src/account/requests.rs +++ b/generated/stripe_connect/src/account/requests.rs @@ -43,16 +43,16 @@ pub struct UpdateAccount<'a> { pub account_token: Option<&'a str>, /// Business information about the account. #[serde(skip_serializing_if = "Option::is_none")] - pub business_profile: Option>, + pub business_profile: Option>, /// The business type. #[serde(skip_serializing_if = "Option::is_none")] - pub business_type: Option, + pub business_type: Option, /// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. /// whether it has been requested or not). /// Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. /// An account may have some of its requested capabilities be active and some be inactive. #[serde(skip_serializing_if = "Option::is_none")] - pub capabilities: Option, + pub capabilities: Option, /// Information about the company or business. This field is available for any `business_type`. #[serde(skip_serializing_if = "Option::is_none")] pub company: Option>, @@ -62,7 +62,7 @@ pub struct UpdateAccount<'a> { pub default_currency: Option, /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, + pub documents: Option>, /// The email address of the account holder. /// This is only to make the account easier to identify to you. /// Stripe only emails Custom accounts with your consent. @@ -94,142 +94,255 @@ pub struct UpdateAccount<'a> { pub settings: Option>, /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). #[serde(skip_serializing_if = "Option::is_none")] - pub tos_acceptance: Option>, + pub tos_acceptance: Option>, } impl<'a> UpdateAccount<'a> { pub fn new() -> Self { Self::default() } } -/// Business information about the account. +/// Information about the company or business. This field is available for any `business_type`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountBusinessProfile<'a> { - /// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). - /// MCCs are used to classify businesses based on the goods or services they provide. +pub struct UpdateAccountCompany<'a> { + /// The company's primary address. #[serde(skip_serializing_if = "Option::is_none")] - pub mcc: Option<&'a str>, - /// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India. + pub address: Option>, + /// The Kana variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub monthly_estimated_revenue: Option, - /// The customer-facing business name. + pub address_kana: Option>, + /// The Kanji variation of the company's primary address (Japan only). + #[serde(skip_serializing_if = "Option::is_none")] + pub address_kanji: Option>, + /// Whether the company's directors have been provided. + /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. + /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub directors_provided: Option, + /// Whether the company's executives have been provided. + /// Set this Boolean to `true` after creating all the company's executives with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.executive` requirement. + #[serde(skip_serializing_if = "Option::is_none")] + pub executives_provided: Option, + /// The export license ID number of the company, also referred as Import Export Code (India only). + #[serde(skip_serializing_if = "Option::is_none")] + pub export_license_id: Option<&'a str>, + /// The purpose code to use for export transactions (India only). + #[serde(skip_serializing_if = "Option::is_none")] + pub export_purpose_code: Option<&'a str>, + /// The company's legal name. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option<&'a str>, - /// Internal-only description of the product sold by, or service provided by, the business. - /// Used by Stripe for risk and underwriting purposes. + /// The Kana variation of the company's legal name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub product_description: Option<&'a str>, - /// A publicly available mailing address for sending support issues to. + pub name_kana: Option<&'a str>, + /// The Kanji variation of the company's legal name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub support_address: Option>, - /// A publicly available email address for sending support issues to. + pub name_kanji: Option<&'a str>, + /// Whether the company's owners have been provided. + /// Set this Boolean to `true` after creating all the company's owners with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.owner` requirement. #[serde(skip_serializing_if = "Option::is_none")] - pub support_email: Option<&'a str>, - /// A publicly available phone number to call with support issues. + pub owners_provided: Option, + /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. #[serde(skip_serializing_if = "Option::is_none")] - pub support_phone: Option<&'a str>, - /// A publicly available website for handling support issues. + pub ownership_declaration: Option>, + /// The company's phone number (used for verification). #[serde(skip_serializing_if = "Option::is_none")] - pub support_url: Option<&'a str>, - /// The business's publicly available website. + pub phone: Option<&'a str>, + /// The identification number given to a company when it is registered or incorporated, if distinct from the identification number used for filing taxes. + /// (Examples are the CIN for companies and LLP IN for partnerships in India, and the Company Registration Number in Hong Kong). #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option<&'a str>, + pub registration_number: Option<&'a str>, + /// The category identifying the legal structure of the company or legal entity. + /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. + #[serde(skip_serializing_if = "Option::is_none")] + pub structure: Option, + /// The business ID number of the company, as appropriate for the company’s country. + /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.). + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_id: Option<&'a str>, + /// The jurisdiction in which the `tax_id` is registered (Germany-based companies only). + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_id_registrar: Option<&'a str>, + /// The VAT number of the company. + #[serde(skip_serializing_if = "Option::is_none")] + pub vat_id: Option<&'a str>, + /// Information on the verification state of the company. + #[serde(skip_serializing_if = "Option::is_none")] + pub verification: Option>, } -impl<'a> UpdateAccountBusinessProfile<'a> { +impl<'a> UpdateAccountCompany<'a> { pub fn new() -> Self { Self::default() } } -/// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateAccountBusinessProfileMonthlyEstimatedRevenue { - /// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - pub amount: i64, - /// 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). - pub currency: stripe_types::Currency, +/// The Kana variation of the company's primary address (Japan only). +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateAccountCompanyAddressKana<'a> { + /// City or ward. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Block or building number. + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Building details. + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// Postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// Prefecture. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, + /// Town or cho-me. + #[serde(skip_serializing_if = "Option::is_none")] + pub town: Option<&'a str>, } -impl UpdateAccountBusinessProfileMonthlyEstimatedRevenue { - pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { - Self { amount, currency } +impl<'a> UpdateAccountCompanyAddressKana<'a> { + pub fn new() -> Self { + Self::default() } } -/// A publicly available mailing address for sending support issues to. +/// The Kanji variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountBusinessProfileSupportAddress<'a> { - /// City, district, suburb, town, or village. +pub struct UpdateAccountCompanyAddressKanji<'a> { + /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). #[serde(skip_serializing_if = "Option::is_none")] pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). + /// Block or building number. #[serde(skip_serializing_if = "Option::is_none")] pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). + /// Building details. #[serde(skip_serializing_if = "Option::is_none")] pub line2: Option<&'a str>, - /// ZIP or postal code. + /// Postal code. #[serde(skip_serializing_if = "Option::is_none")] pub postal_code: Option<&'a str>, - /// State, county, province, or region. + /// Prefecture. #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, + /// Town or cho-me. + #[serde(skip_serializing_if = "Option::is_none")] + pub town: Option<&'a str>, } -impl<'a> UpdateAccountBusinessProfileSupportAddress<'a> { +impl<'a> UpdateAccountCompanyAddressKanji<'a> { pub fn new() -> Self { Self::default() } } -/// The business type. +/// The category identifying the legal structure of the company or legal entity. +/// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountBusinessType { - Company, - GovernmentEntity, - Individual, - NonProfit, +#[non_exhaustive] +pub enum UpdateAccountCompanyStructure { + FreeZoneEstablishment, + FreeZoneLlc, + GovernmentInstrumentality, + GovernmentalUnit, + IncorporatedNonProfit, + IncorporatedPartnership, + LimitedLiabilityPartnership, + Llc, + MultiMemberLlc, + PrivateCompany, + PrivateCorporation, + PrivatePartnership, + PublicCompany, + PublicCorporation, + PublicPartnership, + SingleMemberLlc, + SoleEstablishment, + SoleProprietorship, + TaxExemptGovernmentInstrumentality, + UnincorporatedAssociation, + UnincorporatedNonProfit, + UnincorporatedPartnership, + /// An unrecognized value from Stripe. Should not be used as a request parameter. + Unknown, } -impl UpdateAccountBusinessType { +impl UpdateAccountCompanyStructure { pub fn as_str(self) -> &'static str { - use UpdateAccountBusinessType::*; + use UpdateAccountCompanyStructure::*; match self { - Company => "company", - GovernmentEntity => "government_entity", - Individual => "individual", - NonProfit => "non_profit", + FreeZoneEstablishment => "free_zone_establishment", + FreeZoneLlc => "free_zone_llc", + GovernmentInstrumentality => "government_instrumentality", + GovernmentalUnit => "governmental_unit", + IncorporatedNonProfit => "incorporated_non_profit", + IncorporatedPartnership => "incorporated_partnership", + LimitedLiabilityPartnership => "limited_liability_partnership", + Llc => "llc", + MultiMemberLlc => "multi_member_llc", + PrivateCompany => "private_company", + PrivateCorporation => "private_corporation", + PrivatePartnership => "private_partnership", + PublicCompany => "public_company", + PublicCorporation => "public_corporation", + PublicPartnership => "public_partnership", + SingleMemberLlc => "single_member_llc", + SoleEstablishment => "sole_establishment", + SoleProprietorship => "sole_proprietorship", + TaxExemptGovernmentInstrumentality => "tax_exempt_government_instrumentality", + UnincorporatedAssociation => "unincorporated_association", + UnincorporatedNonProfit => "unincorporated_non_profit", + UnincorporatedPartnership => "unincorporated_partnership", + Unknown => "unknown", } } } -impl std::str::FromStr for UpdateAccountBusinessType { +impl std::str::FromStr for UpdateAccountCompanyStructure { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountBusinessType::*; + use UpdateAccountCompanyStructure::*; match s { - "company" => Ok(Company), - "government_entity" => Ok(GovernmentEntity), - "individual" => Ok(Individual), - "non_profit" => Ok(NonProfit), + "free_zone_establishment" => Ok(FreeZoneEstablishment), + "free_zone_llc" => Ok(FreeZoneLlc), + "government_instrumentality" => Ok(GovernmentInstrumentality), + "governmental_unit" => Ok(GovernmentalUnit), + "incorporated_non_profit" => Ok(IncorporatedNonProfit), + "incorporated_partnership" => Ok(IncorporatedPartnership), + "limited_liability_partnership" => Ok(LimitedLiabilityPartnership), + "llc" => Ok(Llc), + "multi_member_llc" => Ok(MultiMemberLlc), + "private_company" => Ok(PrivateCompany), + "private_corporation" => Ok(PrivateCorporation), + "private_partnership" => Ok(PrivatePartnership), + "public_company" => Ok(PublicCompany), + "public_corporation" => Ok(PublicCorporation), + "public_partnership" => Ok(PublicPartnership), + "single_member_llc" => Ok(SingleMemberLlc), + "sole_establishment" => Ok(SoleEstablishment), + "sole_proprietorship" => Ok(SoleProprietorship), + "tax_exempt_government_instrumentality" => Ok(TaxExemptGovernmentInstrumentality), + "unincorporated_association" => Ok(UnincorporatedAssociation), + "unincorporated_non_profit" => Ok(UnincorporatedNonProfit), + "unincorporated_partnership" => Ok(UnincorporatedPartnership), _ => Err(()), } } } -impl AsRef for UpdateAccountBusinessType { +impl AsRef for UpdateAccountCompanyStructure { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for UpdateAccountBusinessType { +impl std::fmt::Display for UpdateAccountCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for UpdateAccountBusinessType { +impl std::fmt::Debug for UpdateAccountCompanyStructure { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for UpdateAccountBusinessType { +impl serde::Serialize for UpdateAccountCompanyStructure { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -237,659 +350,570 @@ impl serde::Serialize for UpdateAccountBusinessType { serializer.serialize_str(self.as_str()) } } -/// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. -/// whether it has been requested or not). -/// Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. -/// An account may have some of its requested capabilities be active and some be inactive. +/// Information about the person represented by the account. +/// This field is null unless `business_type` is set to `individual`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilities { - /// The acss_debit_payments capability. +pub struct UpdateAccountIndividual<'a> { + /// The individual's primary address. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit_payments: Option, - /// The affirm_payments capability. + pub address: Option>, + /// The Kana variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub affirm_payments: Option, - /// The afterpay_clearpay_payments capability. + pub address_kana: Option>, + /// The Kanji variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay_payments: Option, - /// The au_becs_debit_payments capability. + pub address_kanji: Option>, + /// The individual's date of birth. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit_payments: Option, - /// The bacs_debit_payments capability. + pub dob: Option, + /// The individual's email address. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit_payments: Option, - /// The bancontact_payments capability. + pub email: Option<&'a str>, + /// The individual's first name. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact_payments: Option, - /// The bank_transfer_payments capability. + pub first_name: Option<&'a str>, + /// The Kana variation of the the individual's first name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer_payments: Option, - /// The blik_payments capability. + pub first_name_kana: Option<&'a str>, + /// The Kanji variation of the individual's first name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub blik_payments: Option, - /// The boleto_payments capability. + pub first_name_kanji: Option<&'a str>, + /// A list of alternate names or aliases that the individual is known by. #[serde(skip_serializing_if = "Option::is_none")] - pub boleto_payments: Option, - /// The card_issuing capability. + pub full_name_aliases: Option<&'a [&'a str]>, + /// The individual's gender (International regulations require either "male" or "female"). #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option, - /// The card_payments capability. + pub gender: Option<&'a str>, + /// The government-issued ID number of the individual, as appropriate for the representative's country. + /// (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). + /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). #[serde(skip_serializing_if = "Option::is_none")] - pub card_payments: Option, - /// The cartes_bancaires_payments capability. + pub id_number: Option<&'a str>, + /// The government-issued secondary ID number of the individual, as appropriate for the representative's country, will be used for enhanced verification checks. + /// In Thailand, this would be the laser code found on the back of an ID card. + /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires_payments: Option, - /// The cashapp_payments capability. + pub id_number_secondary: Option<&'a str>, + /// The individual's last name. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp_payments: Option, - /// The eps_payments capability. + pub last_name: Option<&'a str>, + /// The Kana variation of the individual's last name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub eps_payments: Option, - /// The fpx_payments capability. + pub last_name_kana: Option<&'a str>, + /// The Kanji variation of the individual's last name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub fpx_payments: Option, - /// The giropay_payments capability. + pub last_name_kanji: Option<&'a str>, + /// The individual's maiden name. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay_payments: Option, - /// The grabpay_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay_payments: Option, - /// The ideal_payments capability. + pub maiden_name: Option<&'a str>, + /// 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. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal_payments: Option, - /// The india_international_payments capability. + pub metadata: Option<&'a std::collections::HashMap>, + /// The individual's phone number. #[serde(skip_serializing_if = "Option::is_none")] - pub india_international_payments: Option, - /// The jcb_payments capability. + pub phone: Option<&'a str>, + /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[serde(skip_serializing_if = "Option::is_none")] - pub jcb_payments: Option, - /// The klarna_payments capability. + pub political_exposure: Option, + /// The individual's registered address. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna_payments: Option, - /// The konbini_payments capability. + pub registered_address: Option>, + /// The last four digits of the individual's Social Security Number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] - pub konbini_payments: Option, - /// The legacy_payments capability. + pub ssn_last_4: Option<&'a str>, + /// The individual's verification document information. #[serde(skip_serializing_if = "Option::is_none")] - pub legacy_payments: Option, - /// The link_payments capability. + pub verification: Option>, +} +impl<'a> UpdateAccountIndividual<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// The Kana variation of the the individual's primary address (Japan only). +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateAccountIndividualAddressKana<'a> { + /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] - pub link_payments: Option, - /// The oxxo_payments capability. + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo_payments: Option, - /// The p24_payments capability. + pub country: Option<&'a str>, + /// Block or building number. #[serde(skip_serializing_if = "Option::is_none")] - pub p24_payments: Option, - /// The paynow_payments capability. + pub line1: Option<&'a str>, + /// Building details. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow_payments: Option, - /// The promptpay_payments capability. + pub line2: Option<&'a str>, + /// Postal code. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay_payments: Option, - /// The revolut_pay_payments capability. + pub postal_code: Option<&'a str>, + /// Prefecture. #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay_payments: Option, - /// The sepa_debit_payments capability. + pub state: Option<&'a str>, + /// Town or cho-me. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit_payments: Option, - /// The sofort_payments capability. + pub town: Option<&'a str>, +} +impl<'a> UpdateAccountIndividualAddressKana<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// The Kanji variation of the the individual's primary address (Japan only). +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct UpdateAccountIndividualAddressKanji<'a> { + /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort_payments: Option, - /// The tax_reporting_us_1099_k capability. + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). #[serde(skip_serializing_if = "Option::is_none")] - pub tax_reporting_us_1099_k: Option, - /// The tax_reporting_us_1099_misc capability. + pub country: Option<&'a str>, + /// Block or building number. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_reporting_us_1099_misc: Option, - /// The transfers capability. + pub line1: Option<&'a str>, + /// Building details. #[serde(skip_serializing_if = "Option::is_none")] - pub transfers: Option, - /// The treasury capability. + pub line2: Option<&'a str>, + /// Postal code. #[serde(skip_serializing_if = "Option::is_none")] - pub treasury: Option, - /// The us_bank_account_ach_payments capability. + pub postal_code: Option<&'a str>, + /// Prefecture. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account_ach_payments: Option, - /// The zip_payments capability. + pub state: Option<&'a str>, + /// Town or cho-me. #[serde(skip_serializing_if = "Option::is_none")] - pub zip_payments: Option, + pub town: Option<&'a str>, } -impl UpdateAccountCapabilities { +impl<'a> UpdateAccountIndividualAddressKanji<'a> { pub fn new() -> Self { Self::default() } } -/// The acss_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesAcssDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, +/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateAccountIndividualPoliticalExposure { + Existing, + None, } -impl UpdateAccountCapabilitiesAcssDebitPayments { - pub fn new() -> Self { - Self::default() +impl UpdateAccountIndividualPoliticalExposure { + pub fn as_str(self) -> &'static str { + use UpdateAccountIndividualPoliticalExposure::*; + match self { + Existing => "existing", + None => "none", + } } } -/// The affirm_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesAffirmPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesAffirmPayments { - pub fn new() -> Self { - Self::default() + +impl std::str::FromStr for UpdateAccountIndividualPoliticalExposure { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdateAccountIndividualPoliticalExposure::*; + match s { + "existing" => Ok(Existing), + "none" => Ok(None), + _ => Err(()), + } } } -/// The afterpay_clearpay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesAfterpayClearpayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesAfterpayClearpayPayments { - pub fn new() -> Self { - Self::default() +impl AsRef for UpdateAccountIndividualPoliticalExposure { + fn as_ref(&self) -> &str { + self.as_str() } } -/// The au_becs_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesAuBecsDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesAuBecsDebitPayments { - pub fn new() -> Self { - Self::default() +impl std::fmt::Display for UpdateAccountIndividualPoliticalExposure { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The bacs_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesBacsDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesBacsDebitPayments { - pub fn new() -> Self { - Self::default() + +impl std::fmt::Debug for UpdateAccountIndividualPoliticalExposure { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The bancontact_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesBancontactPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesBancontactPayments { - pub fn new() -> Self { - Self::default() +impl serde::Serialize for UpdateAccountIndividualPoliticalExposure { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) } } -/// The bank_transfer_payments capability. +/// Options for customizing how the account functions within Stripe. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesBankTransferPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. +pub struct UpdateAccountSettings<'a> { + /// Settings specific to Bacs Direct Debit payments. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesBankTransferPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The blik_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesBlikPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub bacs_debit_payments: Option>, + /// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + pub branding: Option>, + /// Settings specific to the account's use of the Card Issuing product. + #[serde(skip_serializing_if = "Option::is_none")] + pub card_issuing: Option>, + /// Settings specific to card charging on the account. + #[serde(skip_serializing_if = "Option::is_none")] + pub card_payments: Option>, + /// Settings that apply across payment methods for charging on the account. + #[serde(skip_serializing_if = "Option::is_none")] + pub payments: Option>, + /// Settings specific to the account's payouts. + #[serde(skip_serializing_if = "Option::is_none")] + pub payouts: Option>, + /// Settings specific to the account's Treasury FinancialAccounts. + #[serde(skip_serializing_if = "Option::is_none")] + pub treasury: Option>, } -impl UpdateAccountCapabilitiesBlikPayments { +impl<'a> UpdateAccountSettings<'a> { pub fn new() -> Self { Self::default() } } -/// The boleto_payments capability. +/// Settings specific to the account's payouts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesBoletoPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. +pub struct UpdateAccountSettingsPayouts<'a> { + /// A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. + /// For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + pub debit_negative_balances: Option, + /// Details on when funds from charges are available, and when they are paid out to an external account. + /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. + #[serde(skip_serializing_if = "Option::is_none")] + pub schedule: Option, + /// The text that appears on the bank account statement for payouts. + /// If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + #[serde(skip_serializing_if = "Option::is_none")] + pub statement_descriptor: Option<&'a str>, } -impl UpdateAccountCapabilitiesBoletoPayments { +impl<'a> UpdateAccountSettingsPayouts<'a> { pub fn new() -> Self { Self::default() } } -/// The card_issuing capability. +/// Details on when funds from charges are available, and when they are paid out to an external account. +/// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesCardIssuing { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. +pub struct UpdateAccountSettingsPayoutsSchedule { + /// The number of days charge funds are held before being paid out. + /// May also be set to `minimum`, representing the lowest available value for the account country. + /// Default is `minimum`. + /// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. + /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + pub delay_days: Option, + /// How frequently available funds are paid out. + /// One of: `daily`, `manual`, `weekly`, or `monthly`. + /// Default is `daily`. + #[serde(skip_serializing_if = "Option::is_none")] + pub interval: Option, + /// The day of the month when available funds are paid out, specified as a number between 1--31. + /// Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. + /// Required and applicable only if `interval` is `monthly`. + #[serde(skip_serializing_if = "Option::is_none")] + pub monthly_anchor: Option, + /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. + /// (required and applicable only if `interval` is `weekly`.). + #[serde(skip_serializing_if = "Option::is_none")] + pub weekly_anchor: Option, } -impl UpdateAccountCapabilitiesCardIssuing { +impl UpdateAccountSettingsPayoutsSchedule { pub fn new() -> Self { Self::default() } } -/// The card_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesCardPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesCardPayments { - pub fn new() -> Self { - Self::default() - } +/// The number of days charge funds are held before being paid out. +/// May also be set to `minimum`, representing the lowest available value for the account country. +/// Default is `minimum`. +/// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. +/// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). +#[derive(Copy, Clone, Debug, serde::Serialize)] +#[serde(untagged)] +pub enum UpdateAccountSettingsPayoutsScheduleDelayDays { + Minimum, + U32(u32), } -/// The cartes_bancaires_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesCartesBancairesPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, +/// How frequently available funds are paid out. +/// One of: `daily`, `manual`, `weekly`, or `monthly`. +/// Default is `daily`. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateAccountSettingsPayoutsScheduleInterval { + Daily, + Manual, + Monthly, + Weekly, } -impl UpdateAccountCapabilitiesCartesBancairesPayments { - pub fn new() -> Self { - Self::default() +impl UpdateAccountSettingsPayoutsScheduleInterval { + pub fn as_str(self) -> &'static str { + use UpdateAccountSettingsPayoutsScheduleInterval::*; + match self { + Daily => "daily", + Manual => "manual", + Monthly => "monthly", + Weekly => "weekly", + } } } -/// The cashapp_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesCashappPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesCashappPayments { - pub fn new() -> Self { - Self::default() + +impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleInterval { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdateAccountSettingsPayoutsScheduleInterval::*; + match s { + "daily" => Ok(Daily), + "manual" => Ok(Manual), + "monthly" => Ok(Monthly), + "weekly" => Ok(Weekly), + _ => Err(()), + } } } -/// The eps_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesEpsPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, +impl AsRef for UpdateAccountSettingsPayoutsScheduleInterval { + fn as_ref(&self) -> &str { + self.as_str() + } } -impl UpdateAccountCapabilitiesEpsPayments { - pub fn new() -> Self { - Self::default() +impl std::fmt::Display for UpdateAccountSettingsPayoutsScheduleInterval { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The fpx_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesFpxPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + +impl std::fmt::Debug for UpdateAccountSettingsPayoutsScheduleInterval { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } } -impl UpdateAccountCapabilitiesFpxPayments { - pub fn new() -> Self { - Self::default() +impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleInterval { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) } } -/// The giropay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesGiropayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, +/// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. +/// (required and applicable only if `interval` is `weekly`.). +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + Friday, + Monday, + Saturday, + Sunday, + Thursday, + Tuesday, + Wednesday, } -impl UpdateAccountCapabilitiesGiropayPayments { - pub fn new() -> Self { - Self::default() +impl UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + pub fn as_str(self) -> &'static str { + use UpdateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + match self { + Friday => "friday", + Monday => "monday", + Saturday => "saturday", + Sunday => "sunday", + Thursday => "thursday", + Tuesday => "tuesday", + Wednesday => "wednesday", + } } } -/// The grabpay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesGrabpayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + +impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + type Err = (); + fn from_str(s: &str) -> Result { + use UpdateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + match s { + "friday" => Ok(Friday), + "monday" => Ok(Monday), + "saturday" => Ok(Saturday), + "sunday" => Ok(Sunday), + "thursday" => Ok(Thursday), + "tuesday" => Ok(Tuesday), + "wednesday" => Ok(Wednesday), + _ => Err(()), + } + } } -impl UpdateAccountCapabilitiesGrabpayPayments { - pub fn new() -> Self { - Self::default() +impl AsRef for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + fn as_ref(&self) -> &str { + self.as_str() } } -/// The ideal_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesIdealPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, +impl std::fmt::Display for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } } -impl UpdateAccountCapabilitiesIdealPayments { - pub fn new() -> Self { - Self::default() + +impl std::fmt::Debug for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The india_international_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesIndiaInternationalPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, +impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } } -impl UpdateAccountCapabilitiesIndiaInternationalPayments { - pub fn new() -> Self { - Self::default() +impl<'a> UpdateAccount<'a> { + /// 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. + /// + /// For Custom accounts, you can update any information on the account. + /// For other accounts, you can update all information until that. + /// account has started to go through Connect Onboarding. + /// Once you create an [Account Link](https://stripe.com/docs/api/account_links). + /// for a Standard or Express account, some parameters can no longer be changed. + /// These are marked as **Custom Only** or **Custom and Express**. + /// below. + /// + /// To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). + /// Refer to our. + /// [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + ) -> stripe::Response { + client.send_form(&format!("/accounts/{account}"), self, http_types::Method::Post) } } -/// The jcb_payments capability. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesJcbPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. +pub struct ListAccount<'a> { #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + pub created: 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<&'a str>, + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'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<&'a str>, } -impl UpdateAccountCapabilitiesJcbPayments { +impl<'a> ListAccount<'a> { pub fn new() -> Self { Self::default() } } -/// The klarna_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesKlarnaPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesKlarnaPayments { - pub fn new() -> Self { - Self::default() +impl<'a> ListAccount<'a> { + /// Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). + /// If you’re not a platform, the list is empty. + pub fn send( + &self, + client: &stripe::Client, + ) -> stripe::Response> { + client.get_query("/accounts", self) + } + pub fn paginate(self) -> stripe::ListPaginator> { + stripe::ListPaginator::from_list_params("/accounts", self) } } -/// The konbini_payments capability. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesKonbiniPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. +pub struct CreateAccount<'a> { + /// An [account token](https://stripe.com/docs/api#create_account_token), used to securely provide details to the account. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesKonbiniPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The legacy_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesLegacyPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub account_token: Option<&'a str>, + /// Business information about the account. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesLegacyPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The link_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesLinkPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub business_profile: Option>, + /// The business type. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesLinkPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The oxxo_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesOxxoPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub business_type: Option, + /// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. + /// whether it has been requested or not). + /// Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. + /// An account may have some of its requested capabilities be active and some be inactive. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesOxxoPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The p24_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesP24Payments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub capabilities: Option, + /// Information about the company or business. This field is available for any `business_type`. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesP24Payments { - pub fn new() -> Self { - Self::default() - } -} -/// The paynow_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesPaynowPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub company: Option>, + /// The country in which the account holder resides, or in which the business is legally established. + /// This should be an ISO 3166-1 alpha-2 country code. + /// For example, if you are in the United States and the business for which you're creating an account is legally represented in Canada, you would use `CA` as the country for the account being created. + /// Available countries include [Stripe's global markets](https://stripe.com/global) as well as countries where [cross-border payouts](https://stripe.com/docs/connect/cross-border-payouts) are supported. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesPaynowPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The promptpay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesPromptpayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub country: Option<&'a str>, + /// Three-letter ISO currency code representing the default currency for the account. + /// This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesPromptpayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The revolut_pay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesRevolutPayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub default_currency: Option, + /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesRevolutPayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The sepa_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesSepaDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub documents: Option>, + /// The email address of the account holder. + /// This is only to make the account easier to identify to you. + /// Stripe only emails Custom accounts with your consent. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesSepaDebitPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The sofort_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesSofortPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub email: Option<&'a str>, + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesSofortPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The tax_reporting_us_1099_k capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesTaxReportingUs1099K { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub expand: Option<&'a [&'a str]>, + /// 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/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](https://stripe.com/docs/api#account_create_bank_account) or [card creation](https://stripe.com/docs/api#account_create_card) APIs. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesTaxReportingUs1099K { - pub fn new() -> Self { - Self::default() - } -} -/// The tax_reporting_us_1099_misc capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesTaxReportingUs1099Misc { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub external_account: Option<&'a str>, + /// Information about the person represented by the account. + /// This field is null unless `business_type` is set to `individual`. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesTaxReportingUs1099Misc { - pub fn new() -> Self { - Self::default() - } -} -/// The transfers capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesTransfers { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub individual: Option>, + /// 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. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesTransfers { - pub fn new() -> Self { - Self::default() - } -} -/// The treasury capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesTreasury { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub metadata: Option<&'a std::collections::HashMap>, + /// Options for customizing how the account functions within Stripe. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesTreasury { - pub fn new() -> Self { - Self::default() - } -} -/// The us_bank_account_ach_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesUsBankAccountAchPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub settings: Option>, + /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl UpdateAccountCapabilitiesUsBankAccountAchPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The zip_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCapabilitiesZipPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub tos_acceptance: Option>, + /// The type of Stripe account to create. May be one of `custom`, `express` or `standard`. + #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, + pub type_: Option, } -impl UpdateAccountCapabilitiesZipPayments { +impl<'a> CreateAccount<'a> { pub fn new() -> Self { Self::default() } } /// Information about the company or business. This field is available for any `business_type`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompany<'a> { +pub struct CreateAccountCompany<'a> { /// The company's primary address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The Kana variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, + pub address_kana: Option>, /// The Kanji variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, + pub address_kanji: Option>, /// Whether the company's directors have been provided. /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. @@ -920,7 +944,7 @@ pub struct UpdateAccountCompany<'a> { pub owners_provided: Option, /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. #[serde(skip_serializing_if = "Option::is_none")] - pub ownership_declaration: Option>, + pub ownership_declaration: Option>, /// The company's phone number (used for verification). #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, @@ -931,7 +955,7 @@ pub struct UpdateAccountCompany<'a> { /// The category identifying the legal structure of the company or legal entity. /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. #[serde(skip_serializing_if = "Option::is_none")] - pub structure: Option, + pub structure: Option, /// The business ID number of the company, as appropriate for the company’s country. /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.). #[serde(skip_serializing_if = "Option::is_none")] @@ -944,43 +968,16 @@ pub struct UpdateAccountCompany<'a> { pub vat_id: Option<&'a str>, /// Information on the verification state of the company. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, -} -impl<'a> UpdateAccountCompany<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The company's primary address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, + pub verification: Option>, } -impl<'a> UpdateAccountCompanyAddress<'a> { +impl<'a> CreateAccountCompany<'a> { pub fn new() -> Self { Self::default() } } /// The Kana variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyAddressKana<'a> { +pub struct CreateAccountCompanyAddressKana<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1003,14 +1000,14 @@ pub struct UpdateAccountCompanyAddressKana<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdateAccountCompanyAddressKana<'a> { +impl<'a> CreateAccountCompanyAddressKana<'a> { pub fn new() -> Self { Self::default() } } /// The Kanji variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyAddressKanji<'a> { +pub struct CreateAccountCompanyAddressKanji<'a> { /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -1033,25 +1030,7 @@ pub struct UpdateAccountCompanyAddressKanji<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub town: Option<&'a str>, } -impl<'a> UpdateAccountCompanyAddressKanji<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyOwnershipDeclaration<'a> { - /// The Unix timestamp marking when the beneficial owner attestation was made. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the beneficial owner attestation was made. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the beneficial owner attestation was made. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdateAccountCompanyOwnershipDeclaration<'a> { +impl<'a> CreateAccountCompanyAddressKanji<'a> { pub fn new() -> Self { Self::default() } @@ -1060,7 +1039,7 @@ impl<'a> UpdateAccountCompanyOwnershipDeclaration<'a> { /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] -pub enum UpdateAccountCompanyStructure { +pub enum CreateAccountCompanyStructure { FreeZoneEstablishment, FreeZoneLlc, GovernmentInstrumentality, @@ -1086,9 +1065,9 @@ pub enum UpdateAccountCompanyStructure { /// An unrecognized value from Stripe. Should not be used as a request parameter. Unknown, } -impl UpdateAccountCompanyStructure { +impl CreateAccountCompanyStructure { pub fn as_str(self) -> &'static str { - use UpdateAccountCompanyStructure::*; + use CreateAccountCompanyStructure::*; match self { FreeZoneEstablishment => "free_zone_establishment", FreeZoneLlc => "free_zone_llc", @@ -1117,10 +1096,10 @@ impl UpdateAccountCompanyStructure { } } -impl std::str::FromStr for UpdateAccountCompanyStructure { +impl std::str::FromStr for CreateAccountCompanyStructure { type Err = (); fn from_str(s: &str) -> Result { - use UpdateAccountCompanyStructure::*; + use CreateAccountCompanyStructure::*; match s { "free_zone_establishment" => Ok(FreeZoneEstablishment), "free_zone_llc" => Ok(FreeZoneLlc), @@ -1143,2101 +1122,441 @@ impl std::str::FromStr for UpdateAccountCompanyStructure { "tax_exempt_government_instrumentality" => Ok(TaxExemptGovernmentInstrumentality), "unincorporated_association" => Ok(UnincorporatedAssociation), "unincorporated_non_profit" => Ok(UnincorporatedNonProfit), - "unincorporated_partnership" => Ok(UnincorporatedPartnership), - _ => Err(()), - } - } -} -impl AsRef for UpdateAccountCompanyStructure { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateAccountCompanyStructure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateAccountCompanyStructure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateAccountCompanyStructure { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Information on the verification state of the company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyVerification<'a> { - /// A document verifying the business. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> UpdateAccountCompanyVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// A document verifying the business. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountCompanyVerificationDocument<'a> { - /// The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> UpdateAccountCompanyVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Documents that may be submitted to satisfy various informational requests. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocuments<'a> { - /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. - /// Must be a document associated with the account’s primary active bank account that displays the last 4 digits of the account number, either a statement or a voided check. - #[serde(skip_serializing_if = "Option::is_none")] - pub bank_account_ownership_verification: - Option>, - /// One or more documents that demonstrate proof of a company's license to operate. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_license: Option>, - /// One or more documents showing the company's Memorandum of Association. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_memorandum_of_association: - Option>, - /// (Certain countries only) One or more documents showing the ministerial decree legalizing the company's establishment. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_ministerial_decree: Option>, - /// One or more documents that demonstrate proof of a company's registration with the appropriate local authorities. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_registration_verification: - Option>, - /// One or more documents that demonstrate proof of a company's tax ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_tax_id_verification: Option>, - /// One or more documents showing the company’s proof of registration with the national business registry. - #[serde(skip_serializing_if = "Option::is_none")] - pub proof_of_registration: Option>, -} -impl<'a> UpdateAccountDocuments<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. -/// Must be a document associated with the account’s primary active bank account that displays the last 4 digits of the account number, either a statement or a voided check. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsBankAccountOwnershipVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsBankAccountOwnershipVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that demonstrate proof of a company's license to operate. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsCompanyLicense<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsCompanyLicense<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the company's Memorandum of Association. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsCompanyMemorandumOfAssociation<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsCompanyMemorandumOfAssociation<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// (Certain countries only) One or more documents showing the ministerial decree legalizing the company's establishment. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsCompanyMinisterialDecree<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsCompanyMinisterialDecree<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that demonstrate proof of a company's registration with the appropriate local authorities. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsCompanyRegistrationVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsCompanyRegistrationVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that demonstrate proof of a company's tax ID. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsCompanyTaxIdVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsCompanyTaxIdVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the company’s proof of registration with the national business registry. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountDocumentsProofOfRegistration<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdateAccountDocumentsProofOfRegistration<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Information about the person represented by the account. -/// This field is null unless `business_type` is set to `individual`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividual<'a> { - /// The individual's primary address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// The Kana variation of the the individual's primary address (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, - /// The Kanji variation of the the individual's primary address (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, - /// The individual's date of birth. - #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, - /// The individual's email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// The individual's first name. - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name: Option<&'a str>, - /// The Kana variation of the the individual's first name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name_kana: Option<&'a str>, - /// The Kanji variation of the individual's first name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name_kanji: Option<&'a str>, - /// A list of alternate names or aliases that the individual is known by. - #[serde(skip_serializing_if = "Option::is_none")] - pub full_name_aliases: Option<&'a [&'a str]>, - /// The individual's gender (International regulations require either "male" or "female"). - #[serde(skip_serializing_if = "Option::is_none")] - pub gender: Option<&'a str>, - /// The government-issued ID number of the individual, as appropriate for the representative's country. - /// (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). - /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). - #[serde(skip_serializing_if = "Option::is_none")] - pub id_number: Option<&'a str>, - /// The government-issued secondary ID number of the individual, as appropriate for the representative's country, will be used for enhanced verification checks. - /// In Thailand, this would be the laser code found on the back of an ID card. - /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). - #[serde(skip_serializing_if = "Option::is_none")] - pub id_number_secondary: Option<&'a str>, - /// The individual's last name. - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name: Option<&'a str>, - /// The Kana variation of the individual's last name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name_kana: Option<&'a str>, - /// The Kanji variation of the individual's last name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name_kanji: Option<&'a str>, - /// The individual's maiden name. - #[serde(skip_serializing_if = "Option::is_none")] - pub maiden_name: Option<&'a str>, - /// 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. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The individual's phone number. - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. - #[serde(skip_serializing_if = "Option::is_none")] - pub political_exposure: Option, - /// The individual's registered address. - #[serde(skip_serializing_if = "Option::is_none")] - pub registered_address: Option>, - /// The last four digits of the individual's Social Security Number (U.S. only). - #[serde(skip_serializing_if = "Option::is_none")] - pub ssn_last_4: Option<&'a str>, - /// The individual's verification document information. - #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, -} -impl<'a> UpdateAccountIndividual<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The individual's primary address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateAccountIndividualAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The Kana variation of the the individual's primary address (Japan only). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualAddressKana<'a> { - /// City or ward. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Block or building number. - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Building details. - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// Postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// Prefecture. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, - /// Town or cho-me. - #[serde(skip_serializing_if = "Option::is_none")] - pub town: Option<&'a str>, -} -impl<'a> UpdateAccountIndividualAddressKana<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The Kanji variation of the the individual's primary address (Japan only). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualAddressKanji<'a> { - /// City or ward. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Block or building number. - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Building details. - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// Postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// Prefecture. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, - /// Town or cho-me. - #[serde(skip_serializing_if = "Option::is_none")] - pub town: Option<&'a str>, -} -impl<'a> UpdateAccountIndividualAddressKanji<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The individual's date of birth. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateAccountIndividualDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl UpdateAccountIndividualDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} -/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountIndividualPoliticalExposure { - Existing, - None, -} -impl UpdateAccountIndividualPoliticalExposure { - pub fn as_str(self) -> &'static str { - use UpdateAccountIndividualPoliticalExposure::*; - match self { - Existing => "existing", - None => "none", - } - } -} - -impl std::str::FromStr for UpdateAccountIndividualPoliticalExposure { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateAccountIndividualPoliticalExposure::*; - match s { - "existing" => Ok(Existing), - "none" => Ok(None), - _ => Err(()), - } - } -} -impl AsRef for UpdateAccountIndividualPoliticalExposure { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateAccountIndividualPoliticalExposure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateAccountIndividualPoliticalExposure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateAccountIndividualPoliticalExposure { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The individual's registered address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualRegisteredAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateAccountIndividualRegisteredAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The individual's verification document information. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualVerification<'a> { - /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_document: Option>, - /// An identifying document, either a passport or local ID card. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> UpdateAccountIndividualVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualVerificationAdditionalDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> UpdateAccountIndividualVerificationAdditionalDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An identifying document, either a passport or local ID card. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountIndividualVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> UpdateAccountIndividualVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Options for customizing how the account functions within Stripe. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettings<'a> { - /// Settings specific to Bacs Direct Debit payments. - #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit_payments: Option>, - /// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. - #[serde(skip_serializing_if = "Option::is_none")] - pub branding: Option>, - /// Settings specific to the account's use of the Card Issuing product. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option>, - /// Settings specific to card charging on the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_payments: Option>, - /// Settings that apply across payment methods for charging on the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub payments: Option>, - /// Settings specific to the account's payouts. - #[serde(skip_serializing_if = "Option::is_none")] - pub payouts: Option>, - /// Settings specific to the account's Treasury FinancialAccounts. - #[serde(skip_serializing_if = "Option::is_none")] - pub treasury: Option>, -} -impl<'a> UpdateAccountSettings<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to Bacs Direct Debit payments. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsBacsDebitPayments<'a> { - /// The Bacs Direct Debit Display Name for this account. - /// For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. - /// Mobile banking apps display it as the name of the business. - /// To use custom branding, set the Bacs Direct Debit Display Name during or right after creation. - /// Custom branding incurs an additional monthly fee for the platform. - /// If you don't set the display name before requesting Bacs capability, it's automatically set as "Stripe" and the account is onboarded to Stripe branding, which is free. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsBacsDebitPayments<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsBranding<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. - /// Must be square and at least 128px x 128px. - #[serde(skip_serializing_if = "Option::is_none")] - pub icon: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) A logo for the account that will be used in Checkout instead of the icon and without the account's name next to it if provided. - /// Must be at least 128px x 128px. - #[serde(skip_serializing_if = "Option::is_none")] - pub logo: Option<&'a str>, - /// A CSS hex color value representing the primary branding color for this account. - #[serde(skip_serializing_if = "Option::is_none")] - pub primary_color: Option<&'a str>, - /// A CSS hex color value representing the secondary branding color for this account. - #[serde(skip_serializing_if = "Option::is_none")] - pub secondary_color: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsBranding<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to the account's use of the Card Issuing product. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsCardIssuing<'a> { - /// Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/docs/issuing/connect/tos_acceptance). - #[serde(skip_serializing_if = "Option::is_none")] - pub tos_acceptance: Option>, -} -impl<'a> UpdateAccountSettingsCardIssuing<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/docs/issuing/connect/tos_acceptance). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsCardIssuingTosAcceptance<'a> { - /// The Unix timestamp marking when the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsCardIssuingTosAcceptance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to card charging on the account. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsCardPayments<'a> { - /// Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub decline_on: Option, - /// The default text that appears on credit card statements when a charge is made. - /// This field prefixes any dynamic `statement_descriptor` specified on the charge. - /// `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_prefix: Option<&'a str>, - /// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). - /// This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. - /// `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_prefix_kana: Option<&'a str>, - /// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). - /// This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. - /// `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_prefix_kanji: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsCardPayments<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsCardPaymentsDeclineOn { - /// Whether Stripe automatically declines charges with an incorrect ZIP or postal code. - /// This setting only applies when a ZIP or postal code is provided and they fail bank verification. - #[serde(skip_serializing_if = "Option::is_none")] - pub avs_failure: Option, - /// Whether Stripe automatically declines charges with an incorrect CVC. - /// This setting only applies when a CVC is provided and it fails bank verification. - #[serde(skip_serializing_if = "Option::is_none")] - pub cvc_failure: Option, -} -impl UpdateAccountSettingsCardPaymentsDeclineOn { - pub fn new() -> Self { - Self::default() - } -} -/// Settings that apply across payment methods for charging on the account. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsPayments<'a> { - /// The default text that appears on credit card statements when a charge is made. - /// This field prefixes any dynamic `statement_descriptor` specified on the charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, - /// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_kana: Option<&'a str>, - /// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_kanji: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsPayments<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to the account's payouts. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsPayouts<'a> { - /// A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. - /// For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). - #[serde(skip_serializing_if = "Option::is_none")] - pub debit_negative_balances: Option, - /// Details on when funds from charges are available, and when they are paid out to an external account. - /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. - #[serde(skip_serializing_if = "Option::is_none")] - pub schedule: Option, - /// The text that appears on the bank account statement for payouts. - /// If not set, this defaults to the platform's bank descriptor as set in the Dashboard. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsPayouts<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Details on when funds from charges are available, and when they are paid out to an external account. -/// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsPayoutsSchedule { - /// The number of days charge funds are held before being paid out. - /// May also be set to `minimum`, representing the lowest available value for the account country. - /// Default is `minimum`. - /// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. - /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). - #[serde(skip_serializing_if = "Option::is_none")] - pub delay_days: Option, - /// How frequently available funds are paid out. - /// One of: `daily`, `manual`, `weekly`, or `monthly`. - /// Default is `daily`. - #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, - /// The day of the month when available funds are paid out, specified as a number between 1--31. - /// Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. - /// Required and applicable only if `interval` is `monthly`. - #[serde(skip_serializing_if = "Option::is_none")] - pub monthly_anchor: Option, - /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. - /// (required and applicable only if `interval` is `weekly`.). - #[serde(skip_serializing_if = "Option::is_none")] - pub weekly_anchor: Option, -} -impl UpdateAccountSettingsPayoutsSchedule { - pub fn new() -> Self { - Self::default() - } -} -/// The number of days charge funds are held before being paid out. -/// May also be set to `minimum`, representing the lowest available value for the account country. -/// Default is `minimum`. -/// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. -/// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). -#[derive(Copy, Clone, Debug, serde::Serialize)] -#[serde(untagged)] -pub enum UpdateAccountSettingsPayoutsScheduleDelayDays { - Minimum, - U32(u32), -} -/// How frequently available funds are paid out. -/// One of: `daily`, `manual`, `weekly`, or `monthly`. -/// Default is `daily`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountSettingsPayoutsScheduleInterval { - Daily, - Manual, - Monthly, - Weekly, -} -impl UpdateAccountSettingsPayoutsScheduleInterval { - pub fn as_str(self) -> &'static str { - use UpdateAccountSettingsPayoutsScheduleInterval::*; - match self { - Daily => "daily", - Manual => "manual", - Monthly => "monthly", - Weekly => "weekly", - } - } -} - -impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleInterval { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateAccountSettingsPayoutsScheduleInterval::*; - match s { - "daily" => Ok(Daily), - "manual" => Ok(Manual), - "monthly" => Ok(Monthly), - "weekly" => Ok(Weekly), - _ => Err(()), - } - } -} -impl AsRef for UpdateAccountSettingsPayoutsScheduleInterval { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateAccountSettingsPayoutsScheduleInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateAccountSettingsPayoutsScheduleInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleInterval { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. -/// (required and applicable only if `interval` is `weekly`.). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - Friday, - Monday, - Saturday, - Sunday, - Thursday, - Tuesday, - Wednesday, -} -impl UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - pub fn as_str(self) -> &'static str { - use UpdateAccountSettingsPayoutsScheduleWeeklyAnchor::*; - match self { - Friday => "friday", - Monday => "monday", - Saturday => "saturday", - Sunday => "sunday", - Thursday => "thursday", - Tuesday => "tuesday", - Wednesday => "wednesday", - } - } -} - -impl std::str::FromStr for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateAccountSettingsPayoutsScheduleWeeklyAnchor::*; - match s { - "friday" => Ok(Friday), - "monday" => Ok(Monday), - "saturday" => Ok(Saturday), - "sunday" => Ok(Sunday), - "thursday" => Ok(Thursday), - "tuesday" => Ok(Tuesday), - "wednesday" => Ok(Wednesday), - _ => Err(()), - } - } -} -impl AsRef for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Settings specific to the account's Treasury FinancialAccounts. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsTreasury<'a> { - /// Details on the account's acceptance of the Stripe Treasury Services Agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub tos_acceptance: Option>, -} -impl<'a> UpdateAccountSettingsTreasury<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Details on the account's acceptance of the Stripe Treasury Services Agreement. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountSettingsTreasuryTosAcceptance<'a> { - /// The Unix timestamp marking when the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdateAccountSettingsTreasuryTosAcceptance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateAccountTosAcceptance<'a> { - /// The Unix timestamp marking when the account representative accepted their service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted their service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user's service agreement type. - #[serde(skip_serializing_if = "Option::is_none")] - pub service_agreement: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted their service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdateAccountTosAcceptance<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> UpdateAccount<'a> { - /// 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. - /// - /// For Custom accounts, you can update any information on the account. - /// For other accounts, you can update all information until that. - /// account has started to go through Connect Onboarding. - /// Once you create an [Account Link](https://stripe.com/docs/api/account_links). - /// for a Standard or Express account, some parameters can no longer be changed. - /// These are marked as **Custom Only** or **Custom and Express**. - /// below. - /// - /// To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). - /// Refer to our. - /// [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}"), self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ListAccount<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub created: 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<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'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<&'a str>, -} -impl<'a> ListAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> ListAccount<'a> { - /// Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). - /// If you’re not a platform, the list is empty. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response> { - client.get_query("/accounts", self) - } - pub fn paginate(self) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params("/accounts", self) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccount<'a> { - /// An [account token](https://stripe.com/docs/api#create_account_token), used to securely provide details to the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub account_token: Option<&'a str>, - /// Business information about the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub business_profile: Option>, - /// The business type. - #[serde(skip_serializing_if = "Option::is_none")] - pub business_type: Option, - /// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. - /// whether it has been requested or not). - /// Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. - /// An account may have some of its requested capabilities be active and some be inactive. - #[serde(skip_serializing_if = "Option::is_none")] - pub capabilities: Option, - /// Information about the company or business. This field is available for any `business_type`. - #[serde(skip_serializing_if = "Option::is_none")] - pub company: Option>, - /// The country in which the account holder resides, or in which the business is legally established. - /// This should be an ISO 3166-1 alpha-2 country code. - /// For example, if you are in the United States and the business for which you're creating an account is legally represented in Canada, you would use `CA` as the country for the account being created. - /// Available countries include [Stripe's global markets](https://stripe.com/global) as well as countries where [cross-border payouts](https://stripe.com/docs/connect/cross-border-payouts) are supported. - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Three-letter ISO currency code representing the default currency for the account. - /// This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts). - #[serde(skip_serializing_if = "Option::is_none")] - pub default_currency: Option, - /// Documents that may be submitted to satisfy various informational requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, - /// The email address of the account holder. - /// This is only to make the account easier to identify to you. - /// Stripe only emails Custom accounts with your consent. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// 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/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](https://stripe.com/docs/api#account_create_bank_account) or [card creation](https://stripe.com/docs/api#account_create_card) APIs. - #[serde(skip_serializing_if = "Option::is_none")] - pub external_account: Option<&'a str>, - /// Information about the person represented by the account. - /// This field is null unless `business_type` is set to `individual`. - #[serde(skip_serializing_if = "Option::is_none")] - pub individual: Option>, - /// 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. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// Options for customizing how the account functions within Stripe. - #[serde(skip_serializing_if = "Option::is_none")] - pub settings: Option>, - /// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). - #[serde(skip_serializing_if = "Option::is_none")] - pub tos_acceptance: Option>, - /// The type of Stripe account to create. May be one of `custom`, `express` or `standard`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, -} -impl<'a> CreateAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Business information about the account. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountBusinessProfile<'a> { - /// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). - /// MCCs are used to classify businesses based on the goods or services they provide. - #[serde(skip_serializing_if = "Option::is_none")] - pub mcc: Option<&'a str>, - /// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India. - #[serde(skip_serializing_if = "Option::is_none")] - pub monthly_estimated_revenue: Option, - /// The customer-facing business name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Internal-only description of the product sold by, or service provided by, the business. - /// Used by Stripe for risk and underwriting purposes. - #[serde(skip_serializing_if = "Option::is_none")] - pub product_description: Option<&'a str>, - /// A publicly available mailing address for sending support issues to. - #[serde(skip_serializing_if = "Option::is_none")] - pub support_address: Option>, - /// A publicly available email address for sending support issues to. - #[serde(skip_serializing_if = "Option::is_none")] - pub support_email: Option<&'a str>, - /// A publicly available phone number to call with support issues. - #[serde(skip_serializing_if = "Option::is_none")] - pub support_phone: Option<&'a str>, - /// A publicly available website for handling support issues. - #[serde(skip_serializing_if = "Option::is_none")] - pub support_url: Option<&'a str>, - /// The business's publicly available website. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option<&'a str>, -} -impl<'a> CreateAccountBusinessProfile<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountBusinessProfileMonthlyEstimatedRevenue { - /// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). - pub amount: i64, - /// 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). - pub currency: stripe_types::Currency, -} -impl CreateAccountBusinessProfileMonthlyEstimatedRevenue { - pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { - Self { amount, currency } - } -} -/// A publicly available mailing address for sending support issues to. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountBusinessProfileSupportAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateAccountBusinessProfileSupportAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The business type. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountBusinessType { - Company, - GovernmentEntity, - Individual, - NonProfit, -} -impl CreateAccountBusinessType { - pub fn as_str(self) -> &'static str { - use CreateAccountBusinessType::*; - match self { - Company => "company", - GovernmentEntity => "government_entity", - Individual => "individual", - NonProfit => "non_profit", - } - } -} - -impl std::str::FromStr for CreateAccountBusinessType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountBusinessType::*; - match s { - "company" => Ok(Company), - "government_entity" => Ok(GovernmentEntity), - "individual" => Ok(Individual), - "non_profit" => Ok(NonProfit), - _ => Err(()), - } - } -} -impl AsRef for CreateAccountBusinessType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateAccountBusinessType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateAccountBusinessType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateAccountBusinessType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Each key of the dictionary represents a capability, and each capability maps to its settings (e.g. -/// whether it has been requested or not). -/// Each capability will be inactive until you have provided its specific requirements and Stripe has verified them. -/// An account may have some of its requested capabilities be active and some be inactive. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilities { - /// The acss_debit_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit_payments: Option, - /// The affirm_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub affirm_payments: Option, - /// The afterpay_clearpay_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay_payments: Option, - /// The au_becs_debit_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit_payments: Option, - /// The bacs_debit_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit_payments: Option, - /// The bancontact_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact_payments: Option, - /// The bank_transfer_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer_payments: Option, - /// The blik_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub blik_payments: Option, - /// The boleto_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub boleto_payments: Option, - /// The card_issuing capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option, - /// The card_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_payments: Option, - /// The cartes_bancaires_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires_payments: Option, - /// The cashapp_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp_payments: Option, - /// The eps_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub eps_payments: Option, - /// The fpx_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub fpx_payments: Option, - /// The giropay_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub giropay_payments: Option, - /// The grabpay_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay_payments: Option, - /// The ideal_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub ideal_payments: Option, - /// The india_international_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub india_international_payments: Option, - /// The jcb_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub jcb_payments: Option, - /// The klarna_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub klarna_payments: Option, - /// The konbini_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub konbini_payments: Option, - /// The legacy_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub legacy_payments: Option, - /// The link_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub link_payments: Option, - /// The oxxo_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo_payments: Option, - /// The p24_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub p24_payments: Option, - /// The paynow_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub paynow_payments: Option, - /// The promptpay_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay_payments: Option, - /// The revolut_pay_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay_payments: Option, - /// The sepa_debit_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit_payments: Option, - /// The sofort_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub sofort_payments: Option, - /// The tax_reporting_us_1099_k capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_reporting_us_1099_k: Option, - /// The tax_reporting_us_1099_misc capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_reporting_us_1099_misc: Option, - /// The transfers capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub transfers: Option, - /// The treasury capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub treasury: Option, - /// The us_bank_account_ach_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account_ach_payments: Option, - /// The zip_payments capability. - #[serde(skip_serializing_if = "Option::is_none")] - pub zip_payments: Option, -} -impl CreateAccountCapabilities { - pub fn new() -> Self { - Self::default() - } -} -/// The acss_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesAcssDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesAcssDebitPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The affirm_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesAffirmPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesAffirmPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The afterpay_clearpay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesAfterpayClearpayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesAfterpayClearpayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The au_becs_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesAuBecsDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesAuBecsDebitPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The bacs_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesBacsDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesBacsDebitPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The bancontact_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesBancontactPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesBancontactPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The bank_transfer_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesBankTransferPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesBankTransferPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The blik_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesBlikPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesBlikPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The boleto_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesBoletoPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesBoletoPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The card_issuing capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesCardIssuing { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesCardIssuing { - pub fn new() -> Self { - Self::default() - } -} -/// The card_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesCardPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesCardPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The cartes_bancaires_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesCartesBancairesPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesCartesBancairesPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The cashapp_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesCashappPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesCashappPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The eps_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesEpsPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesEpsPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The fpx_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesFpxPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesFpxPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The giropay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesGiropayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesGiropayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The grabpay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesGrabpayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesGrabpayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The ideal_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesIdealPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesIdealPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The india_international_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesIndiaInternationalPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesIndiaInternationalPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The jcb_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesJcbPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesJcbPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The klarna_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesKlarnaPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesKlarnaPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The konbini_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesKonbiniPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesKonbiniPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The legacy_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesLegacyPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesLegacyPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The link_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesLinkPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesLinkPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The oxxo_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesOxxoPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesOxxoPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The p24_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesP24Payments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesP24Payments { - pub fn new() -> Self { - Self::default() - } -} -/// The paynow_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesPaynowPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesPaynowPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The promptpay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesPromptpayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesPromptpayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The revolut_pay_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesRevolutPayPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesRevolutPayPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The sepa_debit_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesSepaDebitPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesSepaDebitPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The sofort_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesSofortPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesSofortPayments { - pub fn new() -> Self { - Self::default() + "unincorporated_partnership" => Ok(UnincorporatedPartnership), + _ => Err(()), + } } } -/// The tax_reporting_us_1099_k capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesTaxReportingUs1099K { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesTaxReportingUs1099K { - pub fn new() -> Self { - Self::default() +impl AsRef for CreateAccountCompanyStructure { + fn as_ref(&self) -> &str { + self.as_str() } } -/// The tax_reporting_us_1099_misc capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesTaxReportingUs1099Misc { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesTaxReportingUs1099Misc { - pub fn new() -> Self { - Self::default() +impl std::fmt::Display for CreateAccountCompanyStructure { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The transfers capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesTransfers { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesTransfers { - pub fn new() -> Self { - Self::default() + +impl std::fmt::Debug for CreateAccountCompanyStructure { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The treasury capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesTreasury { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesTreasury { - pub fn new() -> Self { - Self::default() +impl serde::Serialize for CreateAccountCompanyStructure { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) } } -/// The us_bank_account_ach_payments capability. +/// Information about the person represented by the account. +/// This field is null unless `business_type` is set to `individual`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesUsBankAccountAchPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. +pub struct CreateAccountIndividual<'a> { + /// The individual's primary address. #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesUsBankAccountAchPayments { - pub fn new() -> Self { - Self::default() - } -} -/// The zip_payments capability. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCapabilitiesZipPayments { - /// Passing true requests the capability for the account, if it is not already requested. - /// A requested capability may not immediately become active. - /// Any requirements to activate the capability are returned in the `requirements` arrays. + pub address: Option>, + /// The Kana variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub requested: Option, -} -impl CreateAccountCapabilitiesZipPayments { - pub fn new() -> Self { - Self::default() - } -} -/// Information about the company or business. This field is available for any `business_type`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompany<'a> { - /// The company's primary address. + pub address_kana: Option>, + /// The Kanji variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// The Kana variation of the company's primary address (Japan only). + pub address_kanji: Option>, + /// The individual's date of birth. #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, - /// The Kanji variation of the company's primary address (Japan only). + pub dob: Option, + /// The individual's email address. #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, - /// Whether the company's directors have been provided. - /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.director` requirement. - /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided. + pub email: Option<&'a str>, + /// The individual's first name. #[serde(skip_serializing_if = "Option::is_none")] - pub directors_provided: Option, - /// Whether the company's executives have been provided. - /// Set this Boolean to `true` after creating all the company's executives with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.executive` requirement. + pub first_name: Option<&'a str>, + /// The Kana variation of the the individual's first name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub executives_provided: Option, - /// The export license ID number of the company, also referred as Import Export Code (India only). + pub first_name_kana: Option<&'a str>, + /// The Kanji variation of the individual's first name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub export_license_id: Option<&'a str>, - /// The purpose code to use for export transactions (India only). + pub first_name_kanji: Option<&'a str>, + /// A list of alternate names or aliases that the individual is known by. #[serde(skip_serializing_if = "Option::is_none")] - pub export_purpose_code: Option<&'a str>, - /// The company's legal name. + pub full_name_aliases: Option<&'a [&'a str]>, + /// The individual's gender (International regulations require either "male" or "female"). #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// The Kana variation of the company's legal name (Japan only). + pub gender: Option<&'a str>, + /// The government-issued ID number of the individual, as appropriate for the representative's country. + /// (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). + /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). #[serde(skip_serializing_if = "Option::is_none")] - pub name_kana: Option<&'a str>, - /// The Kanji variation of the company's legal name (Japan only). + pub id_number: Option<&'a str>, + /// The government-issued secondary ID number of the individual, as appropriate for the representative's country, will be used for enhanced verification checks. + /// In Thailand, this would be the laser code found on the back of an ID card. + /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). #[serde(skip_serializing_if = "Option::is_none")] - pub name_kanji: Option<&'a str>, - /// Whether the company's owners have been provided. - /// Set this Boolean to `true` after creating all the company's owners with [the Persons API](https://stripe.com/docs/api/persons) for accounts with a `relationship.owner` requirement. + pub id_number_secondary: Option<&'a str>, + /// The individual's last name. #[serde(skip_serializing_if = "Option::is_none")] - pub owners_provided: Option, - /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. + pub last_name: Option<&'a str>, + /// The Kana variation of the individual's last name (Japan only). #[serde(skip_serializing_if = "Option::is_none")] - pub ownership_declaration: Option>, - /// The company's phone number (used for verification). + pub last_name_kana: Option<&'a str>, + /// The Kanji variation of the individual's last name (Japan only). + #[serde(skip_serializing_if = "Option::is_none")] + pub last_name_kanji: Option<&'a str>, + /// The individual's maiden name. + #[serde(skip_serializing_if = "Option::is_none")] + pub maiden_name: Option<&'a str>, + /// 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. + /// Individual keys can be unset by posting an empty value to them. + /// All keys can be unset by posting an empty value to `metadata`. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option<&'a std::collections::HashMap>, + /// The individual's phone number. #[serde(skip_serializing_if = "Option::is_none")] pub phone: Option<&'a str>, - /// The identification number given to a company when it is registered or incorporated, if distinct from the identification number used for filing taxes. - /// (Examples are the CIN for companies and LLP IN for partnerships in India, and the Company Registration Number in Hong Kong). + /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[serde(skip_serializing_if = "Option::is_none")] - pub registration_number: Option<&'a str>, - /// The category identifying the legal structure of the company or legal entity. - /// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. + pub political_exposure: Option, + /// The individual's registered address. #[serde(skip_serializing_if = "Option::is_none")] - pub structure: Option, - /// The business ID number of the company, as appropriate for the company’s country. - /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.). + pub registered_address: Option>, + /// The last four digits of the individual's Social Security Number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id: Option<&'a str>, - /// The jurisdiction in which the `tax_id` is registered (Germany-based companies only). + pub ssn_last_4: Option<&'a str>, + /// The individual's verification document information. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id_registrar: Option<&'a str>, - /// The VAT number of the company. + pub verification: Option>, +} +impl<'a> CreateAccountIndividual<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// The Kana variation of the the individual's primary address (Japan only). +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CreateAccountIndividualAddressKana<'a> { + /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] - pub vat_id: Option<&'a str>, - /// Information on the verification state of the company. + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Block or building number. + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Building details. + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// Postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// Prefecture. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, + /// Town or cho-me. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, + pub town: Option<&'a str>, } -impl<'a> CreateAccountCompany<'a> { +impl<'a> CreateAccountIndividualAddressKana<'a> { pub fn new() -> Self { Self::default() } } -/// The company's primary address. +/// The Kanji variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyAddress<'a> { - /// City, district, suburb, town, or village. +pub struct CreateAccountIndividualAddressKanji<'a> { + /// City or ward. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). #[serde(skip_serializing_if = "Option::is_none")] pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). + /// Block or building number. #[serde(skip_serializing_if = "Option::is_none")] pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). + /// Building details. #[serde(skip_serializing_if = "Option::is_none")] pub line2: Option<&'a str>, - /// ZIP or postal code. + /// Postal code. #[serde(skip_serializing_if = "Option::is_none")] pub postal_code: Option<&'a str>, - /// State, county, province, or region. + /// Prefecture. #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, + /// Town or cho-me. + #[serde(skip_serializing_if = "Option::is_none")] + pub town: Option<&'a str>, +} +impl<'a> CreateAccountIndividualAddressKanji<'a> { + pub fn new() -> Self { + Self::default() + } +} +/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateAccountIndividualPoliticalExposure { + Existing, + None, +} +impl CreateAccountIndividualPoliticalExposure { + pub fn as_str(self) -> &'static str { + use CreateAccountIndividualPoliticalExposure::*; + match self { + Existing => "existing", + None => "none", + } + } +} + +impl std::str::FromStr for CreateAccountIndividualPoliticalExposure { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateAccountIndividualPoliticalExposure::*; + match s { + "existing" => Ok(Existing), + "none" => Ok(None), + _ => Err(()), + } + } +} +impl AsRef for CreateAccountIndividualPoliticalExposure { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for CreateAccountIndividualPoliticalExposure { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } } -impl<'a> CreateAccountCompanyAddress<'a> { - pub fn new() -> Self { - Self::default() + +impl std::fmt::Debug for CreateAccountIndividualPoliticalExposure { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) } } -/// The Kana variation of the company's primary address (Japan only). +impl serde::Serialize for CreateAccountIndividualPoliticalExposure { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// Options for customizing how the account functions within Stripe. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyAddressKana<'a> { - /// City or ward. +pub struct CreateAccountSettings<'a> { + /// Settings specific to Bacs Direct Debit. #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + pub bacs_debit_payments: Option>, + /// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Block or building number. + pub branding: Option>, + /// Settings specific to the account's use of the Card Issuing product. #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Building details. + pub card_issuing: Option>, + /// Settings specific to card charging on the account. #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// Postal code. + pub card_payments: Option>, + /// Settings that apply across payment methods for charging on the account. #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// Prefecture. + pub payments: Option>, + /// Settings specific to the account's payouts. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, - /// Town or cho-me. + pub payouts: Option>, + /// Settings specific to the account's Treasury FinancialAccounts. #[serde(skip_serializing_if = "Option::is_none")] - pub town: Option<&'a str>, + pub treasury: Option>, } -impl<'a> CreateAccountCompanyAddressKana<'a> { +impl<'a> CreateAccountSettings<'a> { pub fn new() -> Self { Self::default() } } -/// The Kanji variation of the company's primary address (Japan only). +/// Settings specific to the account's payouts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyAddressKanji<'a> { - /// City or ward. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Block or building number. - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Building details. - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// Postal code. +pub struct CreateAccountSettingsPayouts<'a> { + /// A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. + /// For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// Prefecture. + pub debit_negative_balances: Option, + /// Details on when funds from charges are available, and when they are paid out to an external account. + /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, - /// Town or cho-me. + pub schedule: Option, + /// The text that appears on the bank account statement for payouts. + /// If not set, this defaults to the platform's bank descriptor as set in the Dashboard. #[serde(skip_serializing_if = "Option::is_none")] - pub town: Option<&'a str>, + pub statement_descriptor: Option<&'a str>, } -impl<'a> CreateAccountCompanyAddressKanji<'a> { +impl<'a> CreateAccountSettingsPayouts<'a> { pub fn new() -> Self { Self::default() } } -/// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct. +/// Details on when funds from charges are available, and when they are paid out to an external account. +/// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyOwnershipDeclaration<'a> { - /// The Unix timestamp marking when the beneficial owner attestation was made. +pub struct CreateAccountSettingsPayoutsSchedule { + /// The number of days charge funds are held before being paid out. + /// May also be set to `minimum`, representing the lowest available value for the account country. + /// Default is `minimum`. + /// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. + /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the beneficial owner attestation was made. + pub delay_days: Option, + /// How frequently available funds are paid out. + /// One of: `daily`, `manual`, `weekly`, or `monthly`. + /// Default is `daily`. #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the beneficial owner attestation was made. + pub interval: Option, + /// The day of the month when available funds are paid out, specified as a number between 1--31. + /// Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. + /// Required and applicable only if `interval` is `monthly`. #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, + pub monthly_anchor: Option, + /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. + /// (required and applicable only if `interval` is `weekly`.). + #[serde(skip_serializing_if = "Option::is_none")] + pub weekly_anchor: Option, } -impl<'a> CreateAccountCompanyOwnershipDeclaration<'a> { +impl CreateAccountSettingsPayoutsSchedule { pub fn new() -> Self { Self::default() } } -/// The category identifying the legal structure of the company or legal entity. -/// See [Business structure](https://stripe.com/docs/connect/identity-verification#business-structure) for more details. +/// The number of days charge funds are held before being paid out. +/// May also be set to `minimum`, representing the lowest available value for the account country. +/// Default is `minimum`. +/// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. +/// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). +#[derive(Copy, Clone, Debug, serde::Serialize)] +#[serde(untagged)] +pub enum CreateAccountSettingsPayoutsScheduleDelayDays { + Minimum, + U32(u32), +} +/// How frequently available funds are paid out. +/// One of: `daily`, `manual`, `weekly`, or `monthly`. +/// Default is `daily`. #[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateAccountCompanyStructure { - FreeZoneEstablishment, - FreeZoneLlc, - GovernmentInstrumentality, - GovernmentalUnit, - IncorporatedNonProfit, - IncorporatedPartnership, - LimitedLiabilityPartnership, - Llc, - MultiMemberLlc, - PrivateCompany, - PrivateCorporation, - PrivatePartnership, - PublicCompany, - PublicCorporation, - PublicPartnership, - SingleMemberLlc, - SoleEstablishment, - SoleProprietorship, - TaxExemptGovernmentInstrumentality, - UnincorporatedAssociation, - UnincorporatedNonProfit, - UnincorporatedPartnership, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, +pub enum CreateAccountSettingsPayoutsScheduleInterval { + Daily, + Manual, + Monthly, + Weekly, } -impl CreateAccountCompanyStructure { +impl CreateAccountSettingsPayoutsScheduleInterval { pub fn as_str(self) -> &'static str { - use CreateAccountCompanyStructure::*; + use CreateAccountSettingsPayoutsScheduleInterval::*; match self { - FreeZoneEstablishment => "free_zone_establishment", - FreeZoneLlc => "free_zone_llc", - GovernmentInstrumentality => "government_instrumentality", - GovernmentalUnit => "governmental_unit", - IncorporatedNonProfit => "incorporated_non_profit", - IncorporatedPartnership => "incorporated_partnership", - LimitedLiabilityPartnership => "limited_liability_partnership", - Llc => "llc", - MultiMemberLlc => "multi_member_llc", - PrivateCompany => "private_company", - PrivateCorporation => "private_corporation", - PrivatePartnership => "private_partnership", - PublicCompany => "public_company", - PublicCorporation => "public_corporation", - PublicPartnership => "public_partnership", - SingleMemberLlc => "single_member_llc", - SoleEstablishment => "sole_establishment", - SoleProprietorship => "sole_proprietorship", - TaxExemptGovernmentInstrumentality => "tax_exempt_government_instrumentality", - UnincorporatedAssociation => "unincorporated_association", - UnincorporatedNonProfit => "unincorporated_non_profit", - UnincorporatedPartnership => "unincorporated_partnership", - Unknown => "unknown", + Daily => "daily", + Manual => "manual", + Monthly => "monthly", + Weekly => "weekly", } } } -impl std::str::FromStr for CreateAccountCompanyStructure { +impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleInterval { type Err = (); fn from_str(s: &str) -> Result { - use CreateAccountCompanyStructure::*; + use CreateAccountSettingsPayoutsScheduleInterval::*; match s { - "free_zone_establishment" => Ok(FreeZoneEstablishment), - "free_zone_llc" => Ok(FreeZoneLlc), - "government_instrumentality" => Ok(GovernmentInstrumentality), - "governmental_unit" => Ok(GovernmentalUnit), - "incorporated_non_profit" => Ok(IncorporatedNonProfit), - "incorporated_partnership" => Ok(IncorporatedPartnership), - "limited_liability_partnership" => Ok(LimitedLiabilityPartnership), - "llc" => Ok(Llc), - "multi_member_llc" => Ok(MultiMemberLlc), - "private_company" => Ok(PrivateCompany), - "private_corporation" => Ok(PrivateCorporation), - "private_partnership" => Ok(PrivatePartnership), - "public_company" => Ok(PublicCompany), - "public_corporation" => Ok(PublicCorporation), - "public_partnership" => Ok(PublicPartnership), - "single_member_llc" => Ok(SingleMemberLlc), - "sole_establishment" => Ok(SoleEstablishment), - "sole_proprietorship" => Ok(SoleProprietorship), - "tax_exempt_government_instrumentality" => Ok(TaxExemptGovernmentInstrumentality), - "unincorporated_association" => Ok(UnincorporatedAssociation), - "unincorporated_non_profit" => Ok(UnincorporatedNonProfit), - "unincorporated_partnership" => Ok(UnincorporatedPartnership), + "daily" => Ok(Daily), + "manual" => Ok(Manual), + "monthly" => Ok(Monthly), + "weekly" => Ok(Weekly), + _ => Err(()), + } + } +} +impl AsRef for CreateAccountSettingsPayoutsScheduleInterval { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for CreateAccountSettingsPayoutsScheduleInterval { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreateAccountSettingsPayoutsScheduleInterval { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CreateAccountSettingsPayoutsScheduleInterval { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +/// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. +/// (required and applicable only if `interval` is `weekly`.). +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreateAccountSettingsPayoutsScheduleWeeklyAnchor { + Friday, + Monday, + Saturday, + Sunday, + Thursday, + Tuesday, + Wednesday, +} +impl CreateAccountSettingsPayoutsScheduleWeeklyAnchor { + pub fn as_str(self) -> &'static str { + use CreateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + match self { + Friday => "friday", + Monday => "monday", + Saturday => "saturday", + Sunday => "sunday", + Thursday => "thursday", + Tuesday => "tuesday", + Wednesday => "wednesday", + } + } +} + +impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { + type Err = (); + fn from_str(s: &str) -> Result { + use CreateAccountSettingsPayoutsScheduleWeeklyAnchor::*; + match s { + "friday" => Ok(Friday), + "monday" => Ok(Monday), + "saturday" => Ok(Saturday), + "sunday" => Ok(Sunday), + "thursday" => Ok(Thursday), + "tuesday" => Ok(Tuesday), + "wednesday" => Ok(Wednesday), _ => Err(()), } } } -impl AsRef for CreateAccountCompanyStructure { +impl AsRef for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for CreateAccountCompanyStructure { +impl std::fmt::Display for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for CreateAccountCompanyStructure { +impl std::fmt::Debug for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for CreateAccountCompanyStructure { +impl serde::Serialize for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -3245,393 +1564,179 @@ impl serde::Serialize for CreateAccountCompanyStructure { serializer.serialize_str(self.as_str()) } } -/// Information on the verification state of the company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyVerification<'a> { - /// A document verifying the business. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> CreateAccountCompanyVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// A document verifying the business. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountCompanyVerificationDocument<'a> { - /// The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> CreateAccountCompanyVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Documents that may be submitted to satisfy various informational requests. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocuments<'a> { - /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. - /// Must be a document associated with the account’s primary active bank account that displays the last 4 digits of the account number, either a statement or a voided check. - #[serde(skip_serializing_if = "Option::is_none")] - pub bank_account_ownership_verification: - Option>, - /// One or more documents that demonstrate proof of a company's license to operate. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_license: Option>, - /// One or more documents showing the company's Memorandum of Association. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_memorandum_of_association: - Option>, - /// (Certain countries only) One or more documents showing the ministerial decree legalizing the company's establishment. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_ministerial_decree: Option>, - /// One or more documents that demonstrate proof of a company's registration with the appropriate local authorities. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_registration_verification: - Option>, - /// One or more documents that demonstrate proof of a company's tax ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_tax_id_verification: Option>, - /// One or more documents showing the company’s proof of registration with the national business registry. - #[serde(skip_serializing_if = "Option::is_none")] - pub proof_of_registration: Option>, -} -impl<'a> CreateAccountDocuments<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. -/// Must be a document associated with the account’s primary active bank account that displays the last 4 digits of the account number, either a statement or a voided check. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsBankAccountOwnershipVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsBankAccountOwnershipVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that demonstrate proof of a company's license to operate. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsCompanyLicense<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsCompanyLicense<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the company's Memorandum of Association. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsCompanyMemorandumOfAssociation<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsCompanyMemorandumOfAssociation<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// (Certain countries only) One or more documents showing the ministerial decree legalizing the company's establishment. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsCompanyMinisterialDecree<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsCompanyMinisterialDecree<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that demonstrate proof of a company's registration with the appropriate local authorities. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsCompanyRegistrationVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsCompanyRegistrationVerification<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> CreateAccount<'a> { + /// With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users. + /// To do this, you’ll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings). + /// + /// If you’ve already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when. + /// creating the account. + /// Connect Onboarding won’t ask for the prefilled information during account onboarding. + /// You can prefill any information on the account. + pub fn send(&self, client: &stripe::Client) -> stripe::Response { + client.send_form("/accounts", self, http_types::Method::Post) } } -/// One or more documents that demonstrate proof of a company's tax ID. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsCompanyTaxIdVerification<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsCompanyTaxIdVerification<'a> { +pub struct DeleteAccount {} +impl DeleteAccount { pub fn new() -> Self { Self::default() } } -/// One or more documents showing the company’s proof of registration with the national business registry. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountDocumentsProofOfRegistration<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateAccountDocumentsProofOfRegistration<'a> { - pub fn new() -> Self { - Self::default() +impl DeleteAccount { + /// 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. + /// Standard accounts created using live-mode keys cannot be deleted. + /// 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/settings/account) instead. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + ) -> stripe::Response { + client.send_form(&format!("/accounts/{account}"), self, http_types::Method::Delete) } } -/// Information about the person represented by the account. -/// This field is null unless `business_type` is set to `individual`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividual<'a> { - /// The individual's primary address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// The Kana variation of the the individual's primary address (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub address_kana: Option>, - /// The Kanji variation of the the individual's primary address (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub address_kanji: Option>, - /// The individual's date of birth. - #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, - /// The individual's email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// The individual's first name. - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name: Option<&'a str>, - /// The Kana variation of the the individual's first name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name_kana: Option<&'a str>, - /// The Kanji variation of the individual's first name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name_kanji: Option<&'a str>, - /// A list of alternate names or aliases that the individual is known by. - #[serde(skip_serializing_if = "Option::is_none")] - pub full_name_aliases: Option<&'a [&'a str]>, - /// The individual's gender (International regulations require either "male" or "female"). - #[serde(skip_serializing_if = "Option::is_none")] - pub gender: Option<&'a str>, - /// The government-issued ID number of the individual, as appropriate for the representative's country. - /// (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). - /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). - #[serde(skip_serializing_if = "Option::is_none")] - pub id_number: Option<&'a str>, - /// The government-issued secondary ID number of the individual, as appropriate for the representative's country, will be used for enhanced verification checks. - /// In Thailand, this would be the laser code found on the back of an ID card. - /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](https://stripe.com/docs/js/tokens/create_token?type=pii). - #[serde(skip_serializing_if = "Option::is_none")] - pub id_number_secondary: Option<&'a str>, - /// The individual's last name. - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name: Option<&'a str>, - /// The Kana variation of the individual's last name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name_kana: Option<&'a str>, - /// The Kanji variation of the individual's last name (Japan only). - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name_kanji: Option<&'a str>, - /// The individual's maiden name. - #[serde(skip_serializing_if = "Option::is_none")] - pub maiden_name: Option<&'a str>, - /// 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. - /// Individual keys can be unset by posting an empty value to them. - /// All keys can be unset by posting an empty value to `metadata`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option<&'a std::collections::HashMap>, - /// The individual's phone number. - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. - #[serde(skip_serializing_if = "Option::is_none")] - pub political_exposure: Option, - /// The individual's registered address. - #[serde(skip_serializing_if = "Option::is_none")] - pub registered_address: Option>, - /// The last four digits of the individual's Social Security Number (U.S. only). - #[serde(skip_serializing_if = "Option::is_none")] - pub ssn_last_4: Option<&'a str>, - /// The individual's verification document information. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct RejectAccount<'a> { + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, -} -impl<'a> CreateAccountIndividual<'a> { - pub fn new() -> Self { - Self::default() - } + pub expand: Option<&'a [&'a str]>, + /// The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. + pub reason: &'a str, } -/// The individual's primary address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, +impl<'a> RejectAccount<'a> { + pub fn new(reason: &'a str) -> Self { + Self { expand: None, reason } + } } -impl<'a> CreateAccountIndividualAddress<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> RejectAccount<'a> { + /// With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. + /// + /// Test-mode Custom and Express accounts can be rejected at any time. + /// Accounts created using live-mode keys may only be rejected once all balances are zero. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + ) -> stripe::Response { + client.send_form(&format!("/accounts/{account}/reject"), self, http_types::Method::Post) } } -/// The Kana variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualAddressKana<'a> { - /// City or ward. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Block or building number. +pub struct PersonsAccount<'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 line1: Option<&'a str>, - /// Building details. + pub ending_before: Option<&'a str>, + /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// Postal code. + pub expand: Option<&'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 postal_code: Option<&'a str>, - /// Prefecture. + pub limit: Option, + /// Filters on the list of people returned based on the person's relationship to the account's company. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, - /// Town or cho-me. + pub relationship: 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 town: Option<&'a str>, + pub starting_after: Option<&'a str>, } -impl<'a> CreateAccountIndividualAddressKana<'a> { +impl<'a> PersonsAccount<'a> { pub fn new() -> Self { Self::default() } } -/// The Kanji variation of the the individual's primary address (Japan only). +/// Filters on the list of people returned based on the person's relationship to the account's company. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualAddressKanji<'a> { - /// City or ward. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Block or building number. +pub struct PersonsAccountRelationship { + /// A filter on the list of people returned based on whether these people are directors of the account's company. #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Building details. + pub director: Option, + /// A filter on the list of people returned based on whether these people are executives of the account's company. #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// Postal code. + pub executive: Option, + /// A filter on the list of people returned based on whether these people are legal guardians of the account's representative. #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// Prefecture. + pub legal_guardian: Option, + /// A filter on the list of people returned based on whether these people are owners of the account's company. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, - /// Town or cho-me. + pub owner: Option, + /// A filter on the list of people returned based on whether these people are the representative of the account's company. #[serde(skip_serializing_if = "Option::is_none")] - pub town: Option<&'a str>, + pub representative: Option, } -impl<'a> CreateAccountIndividualAddressKanji<'a> { +impl PersonsAccountRelationship { pub fn new() -> Self { Self::default() } } -/// The individual's date of birth. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateAccountIndividualDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreateAccountIndividualDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } +impl<'a> PersonsAccount<'a> { + /// Returns a list of people associated with the account’s legal entity. + /// The people are returned sorted by creation date, with the most recent people appearing first. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + ) -> stripe::Response> { + client.get_query(&format!("/accounts/{account}/persons"), self) } -} -/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountIndividualPoliticalExposure { - Existing, - None, -} -impl CreateAccountIndividualPoliticalExposure { - pub fn as_str(self) -> &'static str { - use CreateAccountIndividualPoliticalExposure::*; - match self { - Existing => "existing", - None => "none", - } + pub fn paginate( + self, + account: &stripe_shared::AccountId, + ) -> stripe::ListPaginator> { + stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/persons"), self) } } - -impl std::str::FromStr for CreateAccountIndividualPoliticalExposure { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountIndividualPoliticalExposure::*; - match s { - "existing" => Ok(Existing), - "none" => Ok(None), - _ => Err(()), - } - } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CapabilitiesAccount<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, } -impl AsRef for CreateAccountIndividualPoliticalExposure { - fn as_ref(&self) -> &str { - self.as_str() +impl<'a> CapabilitiesAccount<'a> { + pub fn new() -> Self { + Self::default() } } -impl std::fmt::Display for CreateAccountIndividualPoliticalExposure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) +impl<'a> CapabilitiesAccount<'a> { + /// Returns a list of capabilities associated with the account. + /// The capabilities are returned sorted by creation date, with the most recent capability appearing first. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + ) -> stripe::Response> { + client.get_query(&format!("/accounts/{account}/capabilities"), self) } -} - -impl std::fmt::Debug for CreateAccountIndividualPoliticalExposure { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) + pub fn paginate( + self, + account: &stripe_shared::AccountId, + ) -> stripe::ListPaginator> { + stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/capabilities"), self) } } -impl serde::Serialize for CreateAccountIndividualPoliticalExposure { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct MonthlyEstimatedRevenueSpecs { + /// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + pub amount: i64, + /// 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). + pub currency: stripe_types::Currency, +} +impl MonthlyEstimatedRevenueSpecs { + pub fn new(amount: i64, currency: stripe_types::Currency) -> Self { + Self { amount, currency } } } -/// The individual's registered address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualRegisteredAddress<'a> { +pub struct AddressSpecs<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -3651,93 +1756,100 @@ pub struct CreateAccountIndividualRegisteredAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> CreateAccountIndividualRegisteredAddress<'a> { +impl<'a> AddressSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// The individual's verification document information. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualVerification<'a> { - /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_document: Option>, - /// An identifying document, either a passport or local ID card. +pub struct CapabilityParam { + /// Passing true requests the capability for the account, if it is not already requested. + /// A requested capability may not immediately become active. + /// Any requirements to activate the capability are returned in the `requirements` arrays. #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, + pub requested: Option, } -impl<'a> CreateAccountIndividualVerification<'a> { +impl CapabilityParam { pub fn new() -> Self { Self::default() } } -/// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualVerificationAdditionalDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. +pub struct CompanyOwnershipDeclaration<'a> { + /// The Unix timestamp marking when the beneficial owner attestation was made. #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. + pub date: Option, + /// The IP address from which the beneficial owner attestation was made. #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, + pub ip: Option<&'a str>, + /// The user agent of the browser from which the beneficial owner attestation was made. + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option<&'a str>, } -impl<'a> CreateAccountIndividualVerificationAdditionalDocument<'a> { +impl<'a> CompanyOwnershipDeclaration<'a> { pub fn new() -> Self { Self::default() } } -/// An identifying document, either a passport or local ID card. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountIndividualVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. +pub struct VerificationDocumentSpecs<'a> { + /// The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + /// The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `additional_verification`. /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] pub front: Option<&'a str>, } -impl<'a> CreateAccountIndividualVerificationDocument<'a> { +impl<'a> VerificationDocumentSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Options for customizing how the account functions within Stripe. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettings<'a> { - /// Settings specific to Bacs Direct Debit. - #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit_payments: Option>, - /// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. - #[serde(skip_serializing_if = "Option::is_none")] - pub branding: Option>, - /// Settings specific to the account's use of the Card Issuing product. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option>, - /// Settings specific to card charging on the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_payments: Option>, - /// Settings that apply across payment methods for charging on the account. +pub struct DocumentsParam<'a> { + /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. #[serde(skip_serializing_if = "Option::is_none")] - pub payments: Option>, - /// Settings specific to the account's payouts. + pub files: Option<&'a [&'a str]>, +} +impl<'a> DocumentsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct DateOfBirthSpecs { + /// The day of birth, between 1 and 31. + pub day: i64, + /// The month of birth, between 1 and 12. + pub month: i64, + /// The four-digit year of birth. + pub year: i64, +} +impl DateOfBirthSpecs { + pub fn new(day: i64, month: i64, year: i64) -> Self { + Self { day, month, year } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonVerificationDocumentSpecs<'a> { + /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] - pub payouts: Option>, - /// Settings specific to the account's Treasury FinancialAccounts. + pub back: Option<&'a str>, + /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] - pub treasury: Option>, + pub front: Option<&'a str>, } -impl<'a> CreateAccountSettings<'a> { +impl<'a> PersonVerificationDocumentSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Settings specific to Bacs Direct Debit. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsBacsDebitPayments<'a> { +pub struct BacsDebitPaymentsSpecs<'a> { /// The Bacs Direct Debit Display Name for this account. /// For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. /// Mobile banking apps display it as the name of the business. @@ -3747,14 +1859,13 @@ pub struct CreateAccountSettingsBacsDebitPayments<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub display_name: Option<&'a str>, } -impl<'a> CreateAccountSettingsBacsDebitPayments<'a> { +impl<'a> BacsDebitPaymentsSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsBranding<'a> { +pub struct BrandingSettingsSpecs<'a> { /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. /// Must be square and at least 128px x 128px. #[serde(skip_serializing_if = "Option::is_none")] @@ -3768,28 +1879,15 @@ pub struct CreateAccountSettingsBranding<'a> { pub primary_color: Option<&'a str>, /// A CSS hex color value representing the secondary branding color for this account. #[serde(skip_serializing_if = "Option::is_none")] - pub secondary_color: Option<&'a str>, -} -impl<'a> CreateAccountSettingsBranding<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to the account's use of the Card Issuing product. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsCardIssuing<'a> { - /// Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/docs/issuing/connect/tos_acceptance). - #[serde(skip_serializing_if = "Option::is_none")] - pub tos_acceptance: Option>, + pub secondary_color: Option<&'a str>, } -impl<'a> CreateAccountSettingsCardIssuing<'a> { +impl<'a> BrandingSettingsSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/docs/issuing/connect/tos_acceptance). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsCardIssuingTosAcceptance<'a> { +pub struct SettingsTermsOfServiceSpecs<'a> { /// The Unix timestamp marking when the account representative accepted the service agreement. #[serde(skip_serializing_if = "Option::is_none")] pub date: Option, @@ -3800,41 +1898,13 @@ pub struct CreateAccountSettingsCardIssuingTosAcceptance<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub user_agent: Option<&'a str>, } -impl<'a> CreateAccountSettingsCardIssuingTosAcceptance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Settings specific to card charging on the account. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsCardPayments<'a> { - /// Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. - #[serde(skip_serializing_if = "Option::is_none")] - pub decline_on: Option, - /// The default text that appears on credit card statements when a charge is made. - /// This field prefixes any dynamic `statement_descriptor` specified on the charge. - /// `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_prefix: Option<&'a str>, - /// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). - /// This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. - /// `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_prefix_kana: Option<&'a str>, - /// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). - /// This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. - /// `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. - #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor_prefix_kanji: Option<&'a str>, -} -impl<'a> CreateAccountSettingsCardPayments<'a> { +impl<'a> SettingsTermsOfServiceSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsCardPaymentsDeclineOn { +pub struct DeclineChargeOnSpecs { /// Whether Stripe automatically declines charges with an incorrect ZIP or postal code. /// This setting only applies when a ZIP or postal code is provided and they fail bank verification. #[serde(skip_serializing_if = "Option::is_none")] @@ -3844,14 +1914,13 @@ pub struct CreateAccountSettingsCardPaymentsDeclineOn { #[serde(skip_serializing_if = "Option::is_none")] pub cvc_failure: Option, } -impl CreateAccountSettingsCardPaymentsDeclineOn { +impl DeclineChargeOnSpecs { pub fn new() -> Self { Self::default() } } -/// Settings that apply across payment methods for charging on the account. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsPayments<'a> { +pub struct PaymentsSettingsSpecs<'a> { /// The default text that appears on credit card statements when a charge is made. /// This field prefixes any dynamic `statement_descriptor` specified on the charge. #[serde(skip_serializing_if = "Option::is_none")] @@ -3863,460 +1932,287 @@ pub struct CreateAccountSettingsPayments<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub statement_descriptor_kanji: Option<&'a str>, } -impl<'a> CreateAccountSettingsPayments<'a> { +impl<'a> PaymentsSettingsSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Settings specific to the account's payouts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsPayouts<'a> { - /// A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. - /// For details, see [Understanding Connect Account Balances](https://stripe.com/docs/connect/account-balances). +pub struct TosAcceptanceSpecs<'a> { + /// The Unix timestamp marking when the account representative accepted their service agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub debit_negative_balances: Option, - /// Details on when funds from charges are available, and when they are paid out to an external account. - /// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. + pub date: Option, + /// The IP address from which the account representative accepted their service agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub schedule: Option, - /// The text that appears on the bank account statement for payouts. - /// If not set, this defaults to the platform's bank descriptor as set in the Dashboard. + pub ip: Option<&'a str>, + /// The user's service agreement type. #[serde(skip_serializing_if = "Option::is_none")] - pub statement_descriptor: Option<&'a str>, + pub service_agreement: Option<&'a str>, + /// The user agent of the browser from which the account representative accepted their service agreement. + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option<&'a str>, } -impl<'a> CreateAccountSettingsPayouts<'a> { +impl<'a> TosAcceptanceSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Details on when funds from charges are available, and when they are paid out to an external account. -/// For details, see our [Setting Bank and Debit Card Payouts](https://stripe.com/docs/connect/bank-transfers#payout-information) documentation. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsPayoutsSchedule { - /// The number of days charge funds are held before being paid out. - /// May also be set to `minimum`, representing the lowest available value for the account country. - /// Default is `minimum`. - /// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. - /// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). +pub struct BusinessProfileSpecs<'a> { + /// [The merchant category code for the account](https://stripe.com/docs/connect/setting-mcc). + /// MCCs are used to classify businesses based on the goods or services they provide. #[serde(skip_serializing_if = "Option::is_none")] - pub delay_days: Option, - /// How frequently available funds are paid out. - /// One of: `daily`, `manual`, `weekly`, or `monthly`. - /// Default is `daily`. + pub mcc: Option<&'a str>, + /// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India. #[serde(skip_serializing_if = "Option::is_none")] - pub interval: Option, - /// The day of the month when available funds are paid out, specified as a number between 1--31. - /// Payouts nominally scheduled between the 29th and 31st of the month are instead sent on the last day of a shorter month. - /// Required and applicable only if `interval` is `monthly`. + pub monthly_estimated_revenue: Option, + /// The customer-facing business name. #[serde(skip_serializing_if = "Option::is_none")] - pub monthly_anchor: Option, - /// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. - /// (required and applicable only if `interval` is `weekly`.). + pub name: Option<&'a str>, + /// Internal-only description of the product sold by, or service provided by, the business. + /// Used by Stripe for risk and underwriting purposes. #[serde(skip_serializing_if = "Option::is_none")] - pub weekly_anchor: Option, + pub product_description: Option<&'a str>, + /// A publicly available mailing address for sending support issues to. + #[serde(skip_serializing_if = "Option::is_none")] + pub support_address: Option>, + /// A publicly available email address for sending support issues to. + #[serde(skip_serializing_if = "Option::is_none")] + pub support_email: Option<&'a str>, + /// A publicly available phone number to call with support issues. + #[serde(skip_serializing_if = "Option::is_none")] + pub support_phone: Option<&'a str>, + /// A publicly available website for handling support issues. + #[serde(skip_serializing_if = "Option::is_none")] + pub support_url: Option<&'a str>, + /// The business's publicly available website. + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option<&'a str>, } -impl CreateAccountSettingsPayoutsSchedule { +impl<'a> BusinessProfileSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// The number of days charge funds are held before being paid out. -/// May also be set to `minimum`, representing the lowest available value for the account country. -/// Default is `minimum`. -/// The `delay_days` parameter remains at the last configured value if `interval` is `manual`. -/// [Learn more about controlling payout delay days](https://stripe.com/docs/connect/manage-payout-schedule). -#[derive(Copy, Clone, Debug, serde::Serialize)] -#[serde(untagged)] -pub enum CreateAccountSettingsPayoutsScheduleDelayDays { - Minimum, - U32(u32), -} -/// How frequently available funds are paid out. -/// One of: `daily`, `manual`, `weekly`, or `monthly`. -/// Default is `daily`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountSettingsPayoutsScheduleInterval { - Daily, - Manual, - Monthly, - Weekly, -} -impl CreateAccountSettingsPayoutsScheduleInterval { - pub fn as_str(self) -> &'static str { - use CreateAccountSettingsPayoutsScheduleInterval::*; - match self { - Daily => "daily", - Manual => "manual", - Monthly => "monthly", - Weekly => "weekly", - } - } -} - -impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleInterval { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountSettingsPayoutsScheduleInterval::*; - match s { - "daily" => Ok(Daily), - "manual" => Ok(Manual), - "monthly" => Ok(Monthly), - "weekly" => Ok(Weekly), - _ => Err(()), - } - } -} -impl AsRef for CreateAccountSettingsPayoutsScheduleInterval { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateAccountSettingsPayoutsScheduleInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateAccountSettingsPayoutsScheduleInterval { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateAccountSettingsPayoutsScheduleInterval { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The day of the week when available funds are paid out, specified as `monday`, `tuesday`, etc. -/// (required and applicable only if `interval` is `weekly`.). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - Friday, - Monday, - Saturday, - Sunday, - Thursday, - Tuesday, - Wednesday, -} -impl CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - pub fn as_str(self) -> &'static str { - use CreateAccountSettingsPayoutsScheduleWeeklyAnchor::*; - match self { - Friday => "friday", - Monday => "monday", - Saturday => "saturday", - Sunday => "sunday", - Thursday => "thursday", - Tuesday => "tuesday", - Wednesday => "wednesday", - } - } -} - -impl std::str::FromStr for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountSettingsPayoutsScheduleWeeklyAnchor::*; - match s { - "friday" => Ok(Friday), - "monday" => Ok(Monday), - "saturday" => Ok(Saturday), - "sunday" => Ok(Sunday), - "thursday" => Ok(Thursday), - "tuesday" => Ok(Tuesday), - "wednesday" => Ok(Wednesday), - _ => Err(()), - } - } -} -impl AsRef for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateAccountSettingsPayoutsScheduleWeeklyAnchor { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Settings specific to the account's Treasury FinancialAccounts. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsTreasury<'a> { - /// Details on the account's acceptance of the Stripe Treasury Services Agreement. +pub struct CapabilitiesParam { + /// The acss_debit_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub acss_debit_payments: Option, + /// The affirm_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub affirm_payments: Option, + /// The afterpay_clearpay_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub afterpay_clearpay_payments: Option, + /// The au_becs_debit_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub au_becs_debit_payments: Option, + /// The bacs_debit_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub bacs_debit_payments: Option, + /// The bancontact_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub bancontact_payments: Option, + /// The bank_transfer_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub bank_transfer_payments: Option, + /// The blik_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub blik_payments: Option, + /// The boleto_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub boleto_payments: Option, + /// The card_issuing capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub card_issuing: Option, + /// The card_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub card_payments: Option, + /// The cartes_bancaires_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub cartes_bancaires_payments: Option, + /// The cashapp_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub cashapp_payments: Option, + /// The eps_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub eps_payments: Option, + /// The fpx_payments capability. #[serde(skip_serializing_if = "Option::is_none")] - pub tos_acceptance: Option>, + pub fpx_payments: Option, + /// The giropay_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub giropay_payments: Option, + /// The grabpay_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub grabpay_payments: Option, + /// The ideal_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub ideal_payments: Option, + /// The india_international_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub india_international_payments: Option, + /// The jcb_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub jcb_payments: Option, + /// The klarna_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub klarna_payments: Option, + /// The konbini_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub konbini_payments: Option, + /// The legacy_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub legacy_payments: Option, + /// The link_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub link_payments: Option, + /// The oxxo_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub oxxo_payments: Option, + /// The p24_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub p24_payments: Option, + /// The paynow_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub paynow_payments: Option, + /// The promptpay_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub promptpay_payments: Option, + /// The revolut_pay_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub revolut_pay_payments: Option, + /// The sepa_debit_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub sepa_debit_payments: Option, + /// The sofort_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub sofort_payments: Option, + /// The tax_reporting_us_1099_k capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_reporting_us_1099_k: Option, + /// The tax_reporting_us_1099_misc capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_reporting_us_1099_misc: Option, + /// The transfers capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub transfers: Option, + /// The treasury capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub treasury: Option, + /// The us_bank_account_ach_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub us_bank_account_ach_payments: Option, + /// The zip_payments capability. + #[serde(skip_serializing_if = "Option::is_none")] + pub zip_payments: Option, } -impl<'a> CreateAccountSettingsTreasury<'a> { +impl CapabilitiesParam { pub fn new() -> Self { Self::default() } } -/// Details on the account's acceptance of the Stripe Treasury Services Agreement. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountSettingsTreasuryTosAcceptance<'a> { - /// The Unix timestamp marking when the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted the service agreement. +pub struct VerificationSpecs<'a> { + /// A document verifying the business. #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, + pub document: Option>, } -impl<'a> CreateAccountSettingsTreasuryTosAcceptance<'a> { +impl<'a> VerificationSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateAccountTosAcceptance<'a> { - /// The Unix timestamp marking when the account representative accepted their service agreement. +pub struct DocumentsSpecs<'a> { + /// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. + /// Must be a document associated with the account’s primary active bank account that displays the last 4 digits of the account number, either a statement or a voided check. #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted their service agreement. + pub bank_account_ownership_verification: Option>, + /// One or more documents that demonstrate proof of a company's license to operate. #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user's service agreement type. + pub company_license: Option>, + /// One or more documents showing the company's Memorandum of Association. #[serde(skip_serializing_if = "Option::is_none")] - pub service_agreement: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted their service agreement. + pub company_memorandum_of_association: Option>, + /// (Certain countries only) One or more documents showing the ministerial decree legalizing the company's establishment. #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, + pub company_ministerial_decree: Option>, + /// One or more documents that demonstrate proof of a company's registration with the appropriate local authorities. + #[serde(skip_serializing_if = "Option::is_none")] + pub company_registration_verification: Option>, + /// One or more documents that demonstrate proof of a company's tax ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub company_tax_id_verification: Option>, + /// One or more documents showing the company’s proof of registration with the national business registry. + #[serde(skip_serializing_if = "Option::is_none")] + pub proof_of_registration: Option>, } -impl<'a> CreateAccountTosAcceptance<'a> { +impl<'a> DocumentsSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// The type of Stripe account to create. May be one of `custom`, `express` or `standard`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateAccountType { - Custom, - Express, - Standard, -} -impl CreateAccountType { - pub fn as_str(self) -> &'static str { - use CreateAccountType::*; - match self { - Custom => "custom", - Express => "express", - Standard => "standard", - } - } -} - -impl std::str::FromStr for CreateAccountType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateAccountType::*; - match s { - "custom" => Ok(Custom), - "express" => Ok(Express), - "standard" => Ok(Standard), - _ => Err(()), - } - } -} -impl AsRef for CreateAccountType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateAccountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateAccountType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateAccountType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> CreateAccount<'a> { - /// With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users. - /// To do this, you’ll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings). - /// - /// If you’ve already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when. - /// creating the account. - /// Connect Onboarding won’t ask for the prefilled information during account onboarding. - /// You can prefill any information on the account. - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/accounts", self, http_types::Method::Post) - } -} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteAccount {} -impl DeleteAccount { - pub fn new() -> Self { - Self::default() - } -} -impl DeleteAccount { - /// 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. - /// Standard accounts created using live-mode keys cannot be deleted. - /// 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/settings/account) instead. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}"), self, http_types::Method::Delete) - } -} -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct RejectAccount<'a> { - /// Specifies which fields in the response should be expanded. +pub struct PersonVerificationSpecs<'a> { + /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, - /// The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. - pub reason: &'a str, -} -impl<'a> RejectAccount<'a> { - pub fn new(reason: &'a str) -> Self { - Self { expand: None, reason } - } + pub additional_document: Option>, + /// An identifying document, either a passport or local ID card. + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option>, } -impl<'a> RejectAccount<'a> { - /// With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. - /// - /// Test-mode Custom and Express accounts can be rejected at any time. - /// Accounts created using live-mode keys may only be rejected once all balances are zero. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response { - client.send_form(&format!("/accounts/{account}/reject"), self, http_types::Method::Post) +impl<'a> PersonVerificationSpecs<'a> { + pub fn new() -> Self { + Self::default() } } #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PersonsAccount<'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<&'a str>, - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'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, - /// Filters on the list of people returned based on the person's relationship to the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: 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. +pub struct CardIssuingSettingsSpecs<'a> { + /// Details on the account's acceptance of the [Stripe Issuing Terms and Disclosures](https://stripe.com/docs/issuing/connect/tos_acceptance). #[serde(skip_serializing_if = "Option::is_none")] - pub starting_after: Option<&'a str>, + pub tos_acceptance: Option>, } -impl<'a> PersonsAccount<'a> { +impl<'a> CardIssuingSettingsSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// Filters on the list of people returned based on the person's relationship to the account's company. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct PersonsAccountRelationship { - /// A filter on the list of people returned based on whether these people are directors of the account's company. - #[serde(skip_serializing_if = "Option::is_none")] - pub director: Option, - /// A filter on the list of people returned based on whether these people are executives of the account's company. +pub struct CardPaymentsSettingsSpecs<'a> { + /// Automatically declines certain charge types regardless of whether the card issuer accepted or declined the charge. #[serde(skip_serializing_if = "Option::is_none")] - pub executive: Option, - /// A filter on the list of people returned based on whether these people are legal guardians of the account's representative. + pub decline_on: Option, + /// The default text that appears on credit card statements when a charge is made. + /// This field prefixes any dynamic `statement_descriptor` specified on the charge. + /// `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. #[serde(skip_serializing_if = "Option::is_none")] - pub legal_guardian: Option, - /// A filter on the list of people returned based on whether these people are owners of the account's company. + pub statement_descriptor_prefix: Option<&'a str>, + /// The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). + /// This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. + /// `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - /// A filter on the list of people returned based on whether these people are the representative of the account's company. + pub statement_descriptor_prefix_kana: Option<&'a str>, + /// The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). + /// This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. + /// `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. #[serde(skip_serializing_if = "Option::is_none")] - pub representative: Option, + pub statement_descriptor_prefix_kanji: Option<&'a str>, } -impl PersonsAccountRelationship { +impl<'a> CardPaymentsSettingsSpecs<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> PersonsAccount<'a> { - /// Returns a list of people associated with the account’s legal entity. - /// The people are returned sorted by creation date, with the most recent people appearing first. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/persons"), self) - } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/persons"), self) - } -} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CapabilitiesAccount<'a> { - /// Specifies which fields in the response should be expanded. +pub struct TreasurySettingsSpecs<'a> { + /// Details on the account's acceptance of the Stripe Treasury Services Agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, + pub tos_acceptance: Option>, } -impl<'a> CapabilitiesAccount<'a> { +impl<'a> TreasurySettingsSpecs<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> CapabilitiesAccount<'a> { - /// Returns a list of capabilities associated with the account. - /// The capabilities are returned sorted by creation date, with the most recent capability appearing first. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - ) -> stripe::Response> { - client.get_query(&format!("/accounts/{account}/capabilities"), self) - } - pub fn paginate( - self, - account: &stripe_shared::AccountId, - ) -> stripe::ListPaginator> { - stripe::ListPaginator::from_list_params(&format!("/accounts/{account}/capabilities"), self) - } -} diff --git a/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs b/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs index de663eaa5..de67ac2fd 100644 --- a/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs +++ b/generated/stripe_connect/src/connect_embedded_account_session_create_components.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct ConnectEmbeddedAccountSessionCreateComponents { pub account_onboarding: stripe_connect::ConnectEmbeddedBaseConfigClaim, } diff --git a/generated/stripe_connect/src/person/requests.rs b/generated/stripe_connect/src/person/requests.rs index 3e9136849..16b111eb6 100644 --- a/generated/stripe_connect/src/person/requests.rs +++ b/generated/stripe_connect/src/person/requests.rs @@ -93,10 +93,10 @@ impl<'a> RetrievePerson<'a> { pub struct CreatePerson<'a> { /// Details on the legal guardian's acceptance of the required Stripe agreements. #[serde(skip_serializing_if = "Option::is_none")] - pub additional_tos_acceptances: Option>, + pub additional_tos_acceptances: Option>, /// The person's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The Kana variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] pub address_kana: Option>, @@ -105,10 +105,10 @@ pub struct CreatePerson<'a> { pub address_kanji: Option>, /// The person's date of birth. #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, + pub documents: Option>, /// The person's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -173,79 +173,22 @@ pub struct CreatePerson<'a> { pub political_exposure: Option<&'a str>, /// The person's registered address. #[serde(skip_serializing_if = "Option::is_none")] - pub registered_address: Option>, + pub registered_address: Option>, /// The relationship that this person has with the account's legal entity. #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option>, + pub relationship: Option>, /// The last four digits of the person's Social Security number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, /// The person's verification status. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, + pub verification: Option>, } impl<'a> CreatePerson<'a> { pub fn new() -> Self { Self::default() } } -/// Details on the legal guardian's acceptance of the required Stripe agreements. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonAdditionalTosAcceptances<'a> { - /// Details on the legal guardian's acceptance of the main Stripe service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option>, -} -impl<'a> CreatePersonAdditionalTosAcceptances<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Details on the legal guardian's acceptance of the main Stripe service agreement. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonAdditionalTosAcceptancesAccount<'a> { - /// The Unix timestamp marking when the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> CreatePersonAdditionalTosAcceptancesAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The person's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreatePersonAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The Kana variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePersonAddressKana<'a> { @@ -306,185 +249,6 @@ impl<'a> CreatePersonAddressKanji<'a> { Self::default() } } -/// The person's date of birth. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePersonDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreatePersonDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} -/// Documents that may be submitted to satisfy various informational requests. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonDocuments<'a> { - /// One or more documents that demonstrate proof that this person is authorized to represent the company. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_authorization: Option>, - /// One or more documents showing the person's passport page with photo and personal data. - #[serde(skip_serializing_if = "Option::is_none")] - pub passport: Option>, - /// One or more documents showing the person's visa required for living in the country where they are residing. - #[serde(skip_serializing_if = "Option::is_none")] - pub visa: Option>, -} -impl<'a> CreatePersonDocuments<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents that demonstrate proof that this person is authorized to represent the company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonDocumentsCompanyAuthorization<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreatePersonDocumentsCompanyAuthorization<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the person's passport page with photo and personal data. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonDocumentsPassport<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreatePersonDocumentsPassport<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the person's visa required for living in the country where they are residing. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonDocumentsVisa<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreatePersonDocumentsVisa<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The person's registered address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonRegisteredAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreatePersonRegisteredAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The relationship that this person has with the account's legal entity. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonRelationship<'a> { - /// Whether the person is a director of the account's legal entity. - /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. - #[serde(skip_serializing_if = "Option::is_none")] - pub director: Option, - /// Whether the person has significant responsibility to control, manage, or direct the organization. - #[serde(skip_serializing_if = "Option::is_none")] - pub executive: Option, - /// Whether the person is the legal guardian of the account's representative. - #[serde(skip_serializing_if = "Option::is_none")] - pub legal_guardian: Option, - /// Whether the person is an owner of the account’s legal entity. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - /// The percent owned by the person of the account's legal entity. - #[serde(skip_serializing_if = "Option::is_none")] - pub percent_ownership: Option, - /// Whether the person is authorized as the primary representative of the account. - /// This is the person nominated by the business to provide information about themselves, and general information about the account. - /// There can only be one representative at any given time. - /// At the time the account is created, this person should be set to the person responsible for opening the account. - #[serde(skip_serializing_if = "Option::is_none")] - pub representative: Option, - /// The person's title (e.g., CEO, Support Engineer). - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option<&'a str>, -} -impl<'a> CreatePersonRelationship<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The person's verification status. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonVerification<'a> { - /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_document: Option>, - /// An identifying document, either a passport or local ID card. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> CreatePersonVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonVerificationAdditionalDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> CreatePersonVerificationAdditionalDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An identifying document, either a passport or local ID card. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePersonVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> CreatePersonVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> CreatePerson<'a> { /// Creates a new person. pub fn send( @@ -499,10 +263,10 @@ impl<'a> CreatePerson<'a> { pub struct UpdatePerson<'a> { /// Details on the legal guardian's acceptance of the required Stripe agreements. #[serde(skip_serializing_if = "Option::is_none")] - pub additional_tos_acceptances: Option>, + pub additional_tos_acceptances: Option>, /// The person's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The Kana variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] pub address_kana: Option>, @@ -511,10 +275,10 @@ pub struct UpdatePerson<'a> { pub address_kanji: Option>, /// The person's date of birth. #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] - pub documents: Option>, + pub documents: Option>, /// The person's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -579,79 +343,22 @@ pub struct UpdatePerson<'a> { pub political_exposure: Option<&'a str>, /// The person's registered address. #[serde(skip_serializing_if = "Option::is_none")] - pub registered_address: Option>, + pub registered_address: Option>, /// The relationship that this person has with the account's legal entity. #[serde(skip_serializing_if = "Option::is_none")] - pub relationship: Option>, + pub relationship: Option>, /// The last four digits of the person's Social Security number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, /// The person's verification status. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, + pub verification: Option>, } impl<'a> UpdatePerson<'a> { pub fn new() -> Self { Self::default() } } -/// Details on the legal guardian's acceptance of the required Stripe agreements. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonAdditionalTosAcceptances<'a> { - /// Details on the legal guardian's acceptance of the main Stripe service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub account: Option>, -} -impl<'a> UpdatePersonAdditionalTosAcceptances<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Details on the legal guardian's acceptance of the main Stripe service agreement. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonAdditionalTosAcceptancesAccount<'a> { - /// The Unix timestamp marking when the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the account representative accepted the service agreement. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdatePersonAdditionalTosAcceptancesAccount<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The person's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdatePersonAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The Kana variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePersonAddressKana<'a> { @@ -712,78 +419,64 @@ impl<'a> UpdatePersonAddressKanji<'a> { Self::default() } } -/// The person's date of birth. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePersonDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl UpdatePersonDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } +impl<'a> UpdatePerson<'a> { + /// Updates an existing person. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + person: &str, + ) -> stripe::Response { + client.send_form( + &format!("/accounts/{account}/persons/{person}"), + self, + http_types::Method::Post, + ) } } -/// Documents that may be submitted to satisfy various informational requests. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonDocuments<'a> { - /// One or more documents that demonstrate proof that this person is authorized to represent the company. - #[serde(skip_serializing_if = "Option::is_none")] - pub company_authorization: Option>, - /// One or more documents showing the person's passport page with photo and personal data. - #[serde(skip_serializing_if = "Option::is_none")] - pub passport: Option>, - /// One or more documents showing the person's visa required for living in the country where they are residing. - #[serde(skip_serializing_if = "Option::is_none")] - pub visa: Option>, -} -impl<'a> UpdatePersonDocuments<'a> { +pub struct DeletePerson {} +impl DeletePerson { pub fn new() -> Self { Self::default() } } -/// One or more documents that demonstrate proof that this person is authorized to represent the company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonDocumentsCompanyAuthorization<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdatePersonDocumentsCompanyAuthorization<'a> { - pub fn new() -> Self { - Self::default() +impl DeletePerson { + /// Deletes an existing person’s relationship to the account’s legal entity. + /// Any person with a relationship for an account can be deleted through the API, except if the person is the `account_opener`. + /// If your integration is using the `executive` parameter, you cannot delete the only verified `executive` on file. + pub fn send( + &self, + client: &stripe::Client, + account: &stripe_shared::AccountId, + person: &str, + ) -> stripe::Response { + client.send_form( + &format!("/accounts/{account}/persons/{person}"), + self, + http_types::Method::Delete, + ) } } -/// One or more documents showing the person's passport page with photo and personal data. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonDocumentsPassport<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. +pub struct SettingsTermsOfServiceSpecs<'a> { + /// The Unix timestamp marking when the account representative accepted the service agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> UpdatePersonDocumentsPassport<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the person's visa required for living in the country where they are residing. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonDocumentsVisa<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. + pub date: Option, + /// The IP address from which the account representative accepted the service agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, + pub ip: Option<&'a str>, + /// The user agent of the browser from which the account representative accepted the service agreement. + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option<&'a str>, } -impl<'a> UpdatePersonDocumentsVisa<'a> { +impl<'a> SettingsTermsOfServiceSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// The person's registered address. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonRegisteredAddress<'a> { +pub struct AddressSpecs<'a> { /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] pub city: Option<&'a str>, @@ -803,14 +496,38 @@ pub struct UpdatePersonRegisteredAddress<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub state: Option<&'a str>, } -impl<'a> UpdatePersonRegisteredAddress<'a> { +impl<'a> AddressSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// The relationship that this person has with the account's legal entity. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct DateOfBirthSpecs { + /// The day of birth, between 1 and 31. + pub day: i64, + /// The month of birth, between 1 and 12. + pub month: i64, + /// The four-digit year of birth. + pub year: i64, +} +impl DateOfBirthSpecs { + pub fn new(day: i64, month: i64, year: i64) -> Self { + Self { day, month, year } + } +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonRelationship<'a> { +pub struct DocumentsParam<'a> { + /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. + #[serde(skip_serializing_if = "Option::is_none")] + pub files: Option<&'a [&'a str]>, +} +impl<'a> DocumentsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RelationshipSpecs<'a> { /// Whether the person is a director of the account's legal entity. /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. #[serde(skip_serializing_if = "Option::is_none")] @@ -837,29 +554,13 @@ pub struct UpdatePersonRelationship<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub title: Option<&'a str>, } -impl<'a> UpdatePersonRelationship<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The person's verification status. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonVerification<'a> { - /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_document: Option>, - /// An identifying document, either a passport or local ID card. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> UpdatePersonVerification<'a> { +impl<'a> RelationshipSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonVerificationAdditionalDocument<'a> { +pub struct PersonVerificationDocumentSpecs<'a> { /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] @@ -869,64 +570,50 @@ pub struct UpdatePersonVerificationAdditionalDocument<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub front: Option<&'a str>, } -impl<'a> UpdatePersonVerificationAdditionalDocument<'a> { +impl<'a> PersonVerificationDocumentSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// An identifying document, either a passport or local ID card. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePersonVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. +pub struct PersonAdditionalTosAcceptancesSpecs<'a> { + /// Details on the legal guardian's acceptance of the main Stripe service agreement. #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, + pub account: Option>, } -impl<'a> UpdatePersonVerificationDocument<'a> { +impl<'a> PersonAdditionalTosAcceptancesSpecs<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> UpdatePerson<'a> { - /// Updates an existing person. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - person: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/persons/{person}"), - self, - http_types::Method::Post, - ) - } -} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeletePerson {} -impl DeletePerson { +pub struct PersonDocumentsSpecs<'a> { + /// One or more documents that demonstrate proof that this person is authorized to represent the company. + #[serde(skip_serializing_if = "Option::is_none")] + pub company_authorization: Option>, + /// One or more documents showing the person's passport page with photo and personal data. + #[serde(skip_serializing_if = "Option::is_none")] + pub passport: Option>, + /// One or more documents showing the person's visa required for living in the country where they are residing. + #[serde(skip_serializing_if = "Option::is_none")] + pub visa: Option>, +} +impl<'a> PersonDocumentsSpecs<'a> { pub fn new() -> Self { Self::default() } } -impl DeletePerson { - /// Deletes an existing person’s relationship to the account’s legal entity. - /// Any person with a relationship for an account can be deleted through the API, except if the person is the `account_opener`. - /// If your integration is using the `executive` parameter, you cannot delete the only verified `executive` on file. - pub fn send( - &self, - client: &stripe::Client, - account: &stripe_shared::AccountId, - person: &str, - ) -> stripe::Response { - client.send_form( - &format!("/accounts/{account}/persons/{person}"), - self, - http_types::Method::Delete, - ) +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonVerificationSpecs<'a> { + /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_document: Option>, + /// An identifying document, either a passport or local ID card. + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option>, +} +impl<'a> PersonVerificationSpecs<'a> { + pub fn new() -> Self { + Self::default() } } diff --git a/generated/stripe_core/src/balance_amount.rs b/generated/stripe_core/src/balance_amount.rs index 18de4389b..4ced136aa 100644 --- a/generated/stripe_core/src/balance_amount.rs +++ b/generated/stripe_core/src/balance_amount.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct BalanceAmount { /// Balance amount. pub amount: i64, diff --git a/generated/stripe_core/src/balance_amount_net.rs b/generated/stripe_core/src/balance_amount_net.rs index 12b2d327b..a8fe12a30 100644 --- a/generated/stripe_core/src/balance_amount_net.rs +++ b/generated/stripe_core/src/balance_amount_net.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct BalanceAmountNet { /// Balance amount. pub amount: i64, diff --git a/generated/stripe_core/src/charge/requests.rs b/generated/stripe_core/src/charge/requests.rs index d15755ae0..2cff31dd1 100644 --- a/generated/stripe_core/src/charge/requests.rs +++ b/generated/stripe_core/src/charge/requests.rs @@ -151,7 +151,7 @@ pub struct CreateCharge<'a> { pub receipt_email: Option<&'a str>, /// Shipping information for the charge. Helps prevent fraud on charges for physical goods. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// A payment source to be charged. /// This can be the ID of a [card](https://stripe.com/docs/api#cards) (i.e., credit or debit card), a [bank account](https://stripe.com/docs/api#bank_accounts), a [source](https://stripe.com/docs/api#sources), a [token](https://stripe.com/docs/api#tokens), or a [connected account](https://stripe.com/docs/connect/account-debits#charging-a-connected-account). /// For certain sources---namely, [cards](https://stripe.com/docs/api#cards), [bank accounts](https://stripe.com/docs/api#bank_accounts), and attached [sources](https://stripe.com/docs/api#sources)---you must also pass the ID of the associated customer. @@ -209,56 +209,6 @@ impl<'a> CreateChargeRadarOptions<'a> { Self::default() } } -/// Shipping information for the charge. Helps prevent fraud on charges for physical goods. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateChargeShipping<'a> { - /// Shipping address. - pub address: CreateChargeShippingAddress<'a>, - /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. - #[serde(skip_serializing_if = "Option::is_none")] - pub carrier: Option<&'a str>, - /// Recipient name. - pub name: &'a str, - /// Recipient phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// The tracking number for a physical product, obtained from the delivery service. - /// If multiple tracking numbers were generated for this purchase, please separate them with commas. - #[serde(skip_serializing_if = "Option::is_none")] - pub tracking_number: Option<&'a str>, -} -impl<'a> CreateChargeShipping<'a> { - pub fn new(address: CreateChargeShippingAddress<'a>, name: &'a str) -> Self { - Self { address, carrier: None, name, phone: None, tracking_number: None } - } -} -/// Shipping address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateChargeShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateChargeShippingAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// An optional dictionary including the account to automatically transfer to as part of a destination charge. /// [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details. #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -338,7 +288,7 @@ pub struct UpdateCharge<'a> { pub receipt_email: Option<&'a str>, /// Shipping information for the charge. Helps prevent fraud on charges for physical goods. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, /// A string that identifies this transaction as part of a group. /// `transfer_group` may only be provided if it has not been set. /// See the [Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options) for details. @@ -415,56 +365,6 @@ impl serde::Serialize for UpdateChargeFraudDetailsUserReport { serializer.serialize_str(self.as_str()) } } -/// Shipping information for the charge. Helps prevent fraud on charges for physical goods. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateChargeShipping<'a> { - /// Shipping address. - pub address: UpdateChargeShippingAddress<'a>, - /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. - #[serde(skip_serializing_if = "Option::is_none")] - pub carrier: Option<&'a str>, - /// Recipient name. - pub name: &'a str, - /// Recipient phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// The tracking number for a physical product, obtained from the delivery service. - /// If multiple tracking numbers were generated for this purchase, please separate them with commas. - #[serde(skip_serializing_if = "Option::is_none")] - pub tracking_number: Option<&'a str>, -} -impl<'a> UpdateChargeShipping<'a> { - pub fn new(address: UpdateChargeShippingAddress<'a>, name: &'a str) -> Self { - Self { address, carrier: None, name, phone: None, tracking_number: None } - } -} -/// Shipping address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateChargeShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateChargeShippingAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> UpdateCharge<'a> { /// Updates the specified charge by setting the values of the parameters passed. /// Any parameters not provided will be left unchanged. @@ -550,3 +450,51 @@ impl<'a> CaptureCharge<'a> { client.send_form(&format!("/charges/{charge}/capture"), self, http_types::Method::Post) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct OptionalFieldsAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> OptionalFieldsAddress<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct OptionalFieldsShipping<'a> { + /// Shipping address. + pub address: OptionalFieldsAddress<'a>, + /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + #[serde(skip_serializing_if = "Option::is_none")] + pub carrier: Option<&'a str>, + /// Recipient name. + pub name: &'a str, + /// Recipient phone (including extension). + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, + /// The tracking number for a physical product, obtained from the delivery service. + /// If multiple tracking numbers were generated for this purchase, please separate them with commas. + #[serde(skip_serializing_if = "Option::is_none")] + pub tracking_number: Option<&'a str>, +} +impl<'a> OptionalFieldsShipping<'a> { + pub fn new(address: OptionalFieldsAddress<'a>, name: &'a str) -> Self { + Self { address, carrier: None, name, phone: None, tracking_number: None } + } +} diff --git a/generated/stripe_core/src/customer/requests.rs b/generated/stripe_core/src/customer/requests.rs index f881bc38d..b30bc5334 100644 --- a/generated/stripe_core/src/customer/requests.rs +++ b/generated/stripe_core/src/customer/requests.rs @@ -92,7 +92,7 @@ impl<'a> ListCustomer<'a> { pub struct CreateCustomer<'a> { /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. #[serde(skip_serializing_if = "Option::is_none")] @@ -148,15 +148,15 @@ pub struct CreateCustomer<'a> { pub promotion_code: Option<&'a str>, /// The customer's shipping information. Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub source: Option<&'a str>, /// Tax details about the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, + pub tax: Option>, /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_exempt: Option, + pub tax_exempt: Option, /// The customer's tax IDs. #[serde(skip_serializing_if = "Option::is_none")] pub tax_id_data: Option<&'a [CreateCustomerTaxIdData<'a>]>, @@ -171,33 +171,6 @@ impl<'a> CreateCustomer<'a> { Self::default() } } -/// The customer's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateCustomerAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Balance information and default balance settings for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateCustomerCashBalance { @@ -288,7 +261,7 @@ pub struct CreateCustomerInvoiceSettings<'a> { /// Default custom fields to be displayed on invoices for this customer. /// When updating, pass an empty string to remove previously-defined fields. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CreateCustomerInvoiceSettingsCustomFields<'a>]>, + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, /// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. #[serde(skip_serializing_if = "Option::is_none")] pub default_payment_method: Option<&'a str>, @@ -304,20 +277,6 @@ impl<'a> CreateCustomerInvoiceSettings<'a> { Self::default() } } -/// Default custom fields to be displayed on invoices for this customer. -/// When updating, pass an empty string to remove previously-defined fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerInvoiceSettingsCustomFields<'a> { - /// The name of the custom field. This may be up to 30 characters. - pub name: &'a str, - /// The value of the custom field. This may be up to 30 characters. - pub value: &'a str, -} -impl<'a> CreateCustomerInvoiceSettingsCustomFields<'a> { - pub fn new(name: &'a str, value: &'a str) -> Self { - Self { name, value } - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateCustomerInvoiceSettingsRenderingOptions { @@ -387,117 +346,6 @@ impl serde::Serialize for CreateCustomerInvoiceSettingsRenderingOptionsAmountTax serializer.serialize_str(self.as_str()) } } -/// The customer's shipping information. Appears on invoices emailed to this customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCustomerShipping<'a> { - /// Customer shipping address. - pub address: CreateCustomerShippingAddress<'a>, - /// Customer name. - pub name: &'a str, - /// Customer phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> CreateCustomerShipping<'a> { - pub fn new(address: CreateCustomerShippingAddress<'a>, name: &'a str) -> Self { - Self { address, name, phone: None } - } -} -/// Customer shipping address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateCustomerShippingAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tax details about the customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateCustomerTax<'a> { - /// A recent IP address of the customer used for tax reporting and tax location inference. - /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. - /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip_address: Option<&'a str>, -} -impl<'a> CreateCustomerTax<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCustomerTaxExempt { - Exempt, - None, - Reverse, -} -impl CreateCustomerTaxExempt { - pub fn as_str(self) -> &'static str { - use CreateCustomerTaxExempt::*; - match self { - Exempt => "exempt", - None => "none", - Reverse => "reverse", - } - } -} - -impl std::str::FromStr for CreateCustomerTaxExempt { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCustomerTaxExempt::*; - match s { - "exempt" => Ok(Exempt), - "none" => Ok(None), - "reverse" => Ok(Reverse), - _ => Err(()), - } - } -} -impl AsRef for CreateCustomerTaxExempt { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCustomerTaxExempt { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCustomerTaxExempt { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCustomerTaxExempt { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// The customer's tax IDs. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateCustomerTaxIdData<'a> { @@ -796,7 +644,7 @@ pub enum RetrieveReturned { pub struct UpdateCustomer<'a> { /// The customer's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. /// A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice. #[serde(skip_serializing_if = "Option::is_none")] @@ -857,15 +705,15 @@ pub struct UpdateCustomer<'a> { pub promotion_code: Option<&'a str>, /// The customer's shipping information. Appears on invoices emailed to this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub source: Option<&'a str>, /// Tax details about the customer. #[serde(skip_serializing_if = "Option::is_none")] - pub tax: Option>, + pub tax: Option>, /// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_exempt: Option, + pub tax_exempt: Option, #[serde(skip_serializing_if = "Option::is_none")] pub validate: Option, } @@ -874,33 +722,6 @@ impl<'a> UpdateCustomer<'a> { Self::default() } } -/// The customer's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateCustomerAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Balance information and default balance settings for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateCustomerCashBalance { @@ -991,7 +812,7 @@ pub struct UpdateCustomerInvoiceSettings<'a> { /// Default custom fields to be displayed on invoices for this customer. /// When updating, pass an empty string to remove previously-defined fields. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [UpdateCustomerInvoiceSettingsCustomFields<'a>]>, + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, /// ID of a payment method that's attached to the customer, to be used as the customer's default payment method for subscriptions and invoices. #[serde(skip_serializing_if = "Option::is_none")] pub default_payment_method: Option<&'a str>, @@ -1007,20 +828,6 @@ impl<'a> UpdateCustomerInvoiceSettings<'a> { Self::default() } } -/// Default custom fields to be displayed on invoices for this customer. -/// When updating, pass an empty string to remove previously-defined fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateCustomerInvoiceSettingsCustomFields<'a> { - /// The name of the custom field. This may be up to 30 characters. - pub name: &'a str, - /// The value of the custom field. This may be up to 30 characters. - pub value: &'a str, -} -impl<'a> UpdateCustomerInvoiceSettingsCustomFields<'a> { - pub fn new(name: &'a str, value: &'a str) -> Self { - Self { name, value } - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateCustomerInvoiceSettingsRenderingOptions { @@ -1090,117 +897,6 @@ impl serde::Serialize for UpdateCustomerInvoiceSettingsRenderingOptionsAmountTax serializer.serialize_str(self.as_str()) } } -/// The customer's shipping information. Appears on invoices emailed to this customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateCustomerShipping<'a> { - /// Customer shipping address. - pub address: UpdateCustomerShippingAddress<'a>, - /// Customer name. - pub name: &'a str, - /// Customer phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpdateCustomerShipping<'a> { - pub fn new(address: UpdateCustomerShippingAddress<'a>, name: &'a str) -> Self { - Self { address, name, phone: None } - } -} -/// Customer shipping address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateCustomerShippingAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tax details about the customer. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateCustomerTax<'a> { - /// A recent IP address of the customer used for tax reporting and tax location inference. - /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. - /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip_address: Option<&'a str>, -} -impl<'a> UpdateCustomerTax<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The customer's tax exemption. One of `none`, `exempt`, or `reverse`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateCustomerTaxExempt { - Exempt, - None, - Reverse, -} -impl UpdateCustomerTaxExempt { - pub fn as_str(self) -> &'static str { - use UpdateCustomerTaxExempt::*; - match self { - Exempt => "exempt", - None => "none", - Reverse => "reverse", - } - } -} - -impl std::str::FromStr for UpdateCustomerTaxExempt { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateCustomerTaxExempt::*; - match s { - "exempt" => Ok(Exempt), - "none" => Ok(None), - "reverse" => Ok(Reverse), - _ => Err(()), - } - } -} -impl AsRef for UpdateCustomerTaxExempt { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateCustomerTaxExempt { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateCustomerTaxExempt { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateCustomerTaxExempt { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> UpdateCustomer<'a> { /// Updates the specified customer by setting the values of the parameters passed. /// Any parameters not provided will be left unchanged. @@ -1800,3 +1496,69 @@ impl DeleteDiscountCustomer { ) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct OptionalFieldsAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> OptionalFieldsAddress<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomFieldParams<'a> { + /// The name of the custom field. This may be up to 30 characters. + pub name: &'a str, + /// The value of the custom field. This may be up to 30 characters. + pub value: &'a str, +} +impl<'a> CustomFieldParams<'a> { + pub fn new(name: &'a str, value: &'a str) -> Self { + Self { name, value } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct TaxParam<'a> { + /// A recent IP address of the customer used for tax reporting and tax location inference. + /// Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. + /// We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes. + #[serde(skip_serializing_if = "Option::is_none")] + pub ip_address: Option<&'a str>, +} +impl<'a> TaxParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomerShipping<'a> { + /// Customer shipping address. + pub address: OptionalFieldsAddress<'a>, + /// Customer name. + pub name: &'a str, + /// Customer phone (including extension). + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, +} +impl<'a> CustomerShipping<'a> { + pub fn new(address: OptionalFieldsAddress<'a>, name: &'a str) -> Self { + Self { address, name, phone: None } + } +} diff --git a/generated/stripe_core/src/file/requests.rs b/generated/stripe_core/src/file/requests.rs index 1462b9556..f456ef8e6 100644 --- a/generated/stripe_core/src/file/requests.rs +++ b/generated/stripe_core/src/file/requests.rs @@ -17,7 +17,7 @@ pub struct ListFile<'a> { /// Filter queries by the file purpose. /// If you don't provide a purpose, the queries return unfiltered files. #[serde(skip_serializing_if = "Option::is_none")] - pub purpose: Option, + pub purpose: 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. @@ -29,101 +29,6 @@ impl<'a> ListFile<'a> { Self::default() } } -/// Filter queries by the file purpose. -/// If you don't provide a purpose, the queries return unfiltered files. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum ListFilePurpose { - AccountRequirement, - AdditionalVerification, - BusinessIcon, - BusinessLogo, - CustomerSignature, - DisputeEvidence, - DocumentProviderIdentityDocument, - FinanceReportRun, - IdentityDocument, - IdentityDocumentDownloadable, - PciDocument, - Selfie, - SigmaScheduledQuery, - TaxDocumentUserUpload, - TerminalReaderSplashscreen, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl ListFilePurpose { - pub fn as_str(self) -> &'static str { - use ListFilePurpose::*; - match self { - AccountRequirement => "account_requirement", - AdditionalVerification => "additional_verification", - BusinessIcon => "business_icon", - BusinessLogo => "business_logo", - CustomerSignature => "customer_signature", - DisputeEvidence => "dispute_evidence", - DocumentProviderIdentityDocument => "document_provider_identity_document", - FinanceReportRun => "finance_report_run", - IdentityDocument => "identity_document", - IdentityDocumentDownloadable => "identity_document_downloadable", - PciDocument => "pci_document", - Selfie => "selfie", - SigmaScheduledQuery => "sigma_scheduled_query", - TaxDocumentUserUpload => "tax_document_user_upload", - TerminalReaderSplashscreen => "terminal_reader_splashscreen", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for ListFilePurpose { - type Err = (); - fn from_str(s: &str) -> Result { - use ListFilePurpose::*; - match s { - "account_requirement" => Ok(AccountRequirement), - "additional_verification" => Ok(AdditionalVerification), - "business_icon" => Ok(BusinessIcon), - "business_logo" => Ok(BusinessLogo), - "customer_signature" => Ok(CustomerSignature), - "dispute_evidence" => Ok(DisputeEvidence), - "document_provider_identity_document" => Ok(DocumentProviderIdentityDocument), - "finance_report_run" => Ok(FinanceReportRun), - "identity_document" => Ok(IdentityDocument), - "identity_document_downloadable" => Ok(IdentityDocumentDownloadable), - "pci_document" => Ok(PciDocument), - "selfie" => Ok(Selfie), - "sigma_scheduled_query" => Ok(SigmaScheduledQuery), - "tax_document_user_upload" => Ok(TaxDocumentUserUpload), - "terminal_reader_splashscreen" => Ok(TerminalReaderSplashscreen), - _ => Err(()), - } - } -} -impl AsRef for ListFilePurpose { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListFilePurpose { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListFilePurpose { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListFilePurpose { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListFile<'a> { /// Returns a list of the files that your account has access to. /// Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top. diff --git a/generated/stripe_core/src/payment_intent/requests.rs b/generated/stripe_core/src/payment_intent/requests.rs index b68ce85e2..f61a04989 100644 --- a/generated/stripe_core/src/payment_intent/requests.rs +++ b/generated/stripe_core/src/payment_intent/requests.rs @@ -57,14 +57,14 @@ pub struct CreatePaymentIntent<'a> { pub automatic_payment_methods: Option, /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Set to `true` to attempt to [confirm this PaymentIntent](https://stripe.com/docs/api/payment_intents/confirm) this PaymentIntent immediately. /// This parameter defaults to `false`. /// When creating and confirming a PaymentIntent at the same time, you can also provide the parameters available in the [Confirm API](https://stripe.com/docs/api/payment_intents/confirm). #[serde(skip_serializing_if = "Option::is_none")] pub confirm: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub confirmation_method: Option, + pub confirmation_method: Option, /// 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). pub currency: stripe_types::Currency, @@ -151,7 +151,7 @@ pub struct CreatePaymentIntent<'a> { /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: Option, /// Shipping information for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option>, @@ -284,110 +284,6 @@ impl serde::Serialize for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirec serializer.serialize_str(self.as_str()) } } -/// Controls when the funds will be captured from the customer's account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentCaptureMethod { - Automatic, - AutomaticAsync, - Manual, -} -impl CreatePaymentIntentCaptureMethod { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentCaptureMethod::*; - match self { - Automatic => "automatic", - AutomaticAsync => "automatic_async", - Manual => "manual", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentCaptureMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentCaptureMethod::*; - match s { - "automatic" => Ok(Automatic), - "automatic_async" => Ok(AutomaticAsync), - "manual" => Ok(Manual), - _ => Err(()), - } - } -} -impl AsRef for CreatePaymentIntentCaptureMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePaymentIntentCaptureMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentCaptureMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentCaptureMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentConfirmationMethod { - Automatic, - Manual, -} -impl CreatePaymentIntentConfirmationMethod { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentConfirmationMethod::*; - match self { - Automatic => "automatic", - Manual => "manual", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentConfirmationMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentConfirmationMethod::*; - match s { - "automatic" => Ok(Automatic), - "manual" => Ok(Manual), - _ => Err(()), - } - } -} -impl AsRef for CreatePaymentIntentConfirmationMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePaymentIntentConfirmationMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentConfirmationMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentConfirmationMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// This hash contains details about the Mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -411,7 +307,7 @@ pub struct CreatePaymentIntentMandateDataCustomerAcceptance<'a> { pub offline: Option<&'a serde_json::Value>, /// If this is a Mandate accepted online, this hash contains details about the online acceptance. #[serde(skip_serializing_if = "Option::is_none")] - pub online: Option>, + pub online: Option>, /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] @@ -422,19 +318,6 @@ impl<'a> CreatePaymentIntentMandateDataCustomerAcceptance<'a> { Self { accepted_at: None, offline: None, online: None, type_ } } } -/// If this is a Mandate accepted online, this hash contains details about the online acceptance. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentMandateDataCustomerAcceptanceOnline<'a> { - /// The IP address from which the Mandate was accepted by the customer. - pub ip_address: &'a str, - /// The user agent of the browser from which the Mandate was accepted by the customer. - pub user_agent: &'a str, -} -impl<'a> CreatePaymentIntentMandateDataCustomerAcceptanceOnline<'a> { - pub fn new(ip_address: &'a str, user_agent: &'a str) -> Self { - Self { ip_address, user_agent } - } -} /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -504,7 +387,7 @@ pub enum CreatePaymentIntentOffSession { pub struct CreatePaymentIntentPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -659,25 +542,6 @@ impl<'a> CreatePaymentIntentPaymentMethodData<'a> { } } } -/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataAcssDebit<'a> { - /// Customer's bank account number. - pub account_number: &'a str, - /// Institution number of the customer's bank. - pub institution_number: &'a str, - /// Transit number of the customer's bank. - pub transit_number: &'a str, -} -impl<'a> CreatePaymentIntentPaymentMethodDataAcssDebit<'a> { - pub fn new( - account_number: &'a str, - institution_number: &'a str, - transit_number: &'a str, - ) -> Self { - Self { account_number, institution_number, transit_number } - } -} /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreatePaymentIntentPaymentMethodDataAuBecsDebit<'a> { @@ -1201,28 +1065,13 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodDataIdealBank { pub struct CreatePaymentIntentPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } impl CreatePaymentIntentPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } -/// Customer's date of birth -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodDataKlarnaDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreatePaymentIntentPaymentMethodDataKlarnaDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePaymentIntentPaymentMethodDataP24 { @@ -1754,7 +1603,7 @@ pub struct CreatePaymentIntentPaymentMethodOptions<'a> { pub bancontact: Option, /// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option>, + pub blik: Option>, /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub boleto: Option, @@ -1763,7 +1612,7 @@ pub struct CreatePaymentIntentPaymentMethodOptions<'a> { pub card: Option>, /// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub card_present: Option, + pub card_present: Option, /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option, @@ -2782,19 +2631,6 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBancontactSetup serializer.serialize_str(self.as_str()) } } -/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsBlik<'a> { - /// The 6-digit BLIK code that a customer has generated using their banking application. - /// Can only be set on confirmation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsBlik<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePaymentIntentPaymentMethodOptionsBoleto { @@ -3778,22 +3614,6 @@ impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardSetupFuture serializer.serialize_str(self.as_str()) } } -/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCardPresent { - /// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity). - #[serde(skip_serializing_if = "Option::is_none")] - pub request_extended_authorization: Option, - /// Request ability to [increment](https://stripe.com/docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. - /// Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_incremental_authorization_support: Option, -} -impl CreatePaymentIntentPaymentMethodOptionsCardPresent { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePaymentIntentPaymentMethodOptionsCashapp { @@ -3966,7 +3786,7 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for the eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] -pub eu_bank_transfer: Option>, +pub eu_bank_transfer: Option>, /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// @@ -3985,18 +3805,6 @@ impl<'a> CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> Self { eu_bank_transfer: None, requested_address_types: None, type_ } } } -/// Configuration for the eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { - pub fn new(country: &'a str) -> Self { - Self { country } - } -} /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// @@ -6746,62 +6554,6 @@ impl<'a> CreatePaymentIntentRadarOptions<'a> { Self::default() } } -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentIntentSetupFutureUsage { - OffSession, - OnSession, -} -impl CreatePaymentIntentSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use CreatePaymentIntentSetupFutureUsage::*; - match self { - OffSession => "off_session", - OnSession => "on_session", - } - } -} - -impl std::str::FromStr for CreatePaymentIntentSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentIntentSetupFutureUsage::*; - match s { - "off_session" => Ok(OffSession), - "on_session" => Ok(OnSession), - _ => Err(()), - } - } -} -impl AsRef for CreatePaymentIntentSetupFutureUsage { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePaymentIntentSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentIntentSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentIntentSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Shipping information for this PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreatePaymentIntentShipping<'a> { @@ -6983,7 +6735,7 @@ pub struct UpdatePaymentIntent<'a> { pub application_fee_amount: Option, /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// 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")] @@ -7038,7 +6790,7 @@ pub struct UpdatePaymentIntent<'a> { /// /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, + pub setup_future_usage: Option, /// Shipping information for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option>, @@ -7054,7 +6806,7 @@ pub struct UpdatePaymentIntent<'a> { /// Use this parameter to automatically create a Transfer when the payment succeeds. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option, + pub transfer_data: Option, /// A string that identifies the resulting payment as part of a group. /// You can only provide `transfer_group` if it hasn't been set. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). @@ -7066,60 +6818,6 @@ impl<'a> UpdatePaymentIntent<'a> { Self::default() } } -/// Controls when the funds will be captured from the customer's account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentCaptureMethod { - Automatic, - AutomaticAsync, - Manual, -} -impl UpdatePaymentIntentCaptureMethod { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentCaptureMethod::*; - match self { - Automatic => "automatic", - AutomaticAsync => "automatic_async", - Manual => "manual", - } - } -} - -impl std::str::FromStr for UpdatePaymentIntentCaptureMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentCaptureMethod::*; - match s { - "automatic" => Ok(Automatic), - "automatic_async" => Ok(AutomaticAsync), - "manual" => Ok(Manual), - _ => Err(()), - } - } -} -impl AsRef for UpdatePaymentIntentCaptureMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdatePaymentIntentCaptureMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentCaptureMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentIntentCaptureMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear /// in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method). /// property on the PaymentIntent. @@ -7127,7 +6825,7 @@ impl serde::Serialize for UpdatePaymentIntentCaptureMethod { pub struct UpdatePaymentIntentPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -7282,25 +6980,6 @@ impl<'a> UpdatePaymentIntentPaymentMethodData<'a> { } } } -/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataAcssDebit<'a> { - /// Customer's bank account number. - pub account_number: &'a str, - /// Institution number of the customer's bank. - pub institution_number: &'a str, - /// Transit number of the customer's bank. - pub transit_number: &'a str, -} -impl<'a> UpdatePaymentIntentPaymentMethodDataAcssDebit<'a> { - pub fn new( - account_number: &'a str, - institution_number: &'a str, - transit_number: &'a str, - ) -> Self { - Self { account_number, institution_number, transit_number } - } -} /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdatePaymentIntentPaymentMethodDataAuBecsDebit<'a> { @@ -7824,28 +7503,13 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataIdealBank { pub struct UpdatePaymentIntentPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } impl UpdatePaymentIntentPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } -/// Customer's date of birth -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodDataKlarnaDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl UpdatePaymentIntentPaymentMethodDataKlarnaDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePaymentIntentPaymentMethodDataP24 { @@ -8377,7 +8041,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptions<'a> { pub bancontact: Option, /// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option>, + pub blik: Option>, /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub boleto: Option, @@ -8386,7 +8050,7 @@ pub struct UpdatePaymentIntentPaymentMethodOptions<'a> { pub card: Option>, /// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub card_present: Option, + pub card_present: Option, /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option, @@ -9405,19 +9069,6 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBancontactSetup serializer.serialize_str(self.as_str()) } } -/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsBlik<'a> { - /// The 6-digit BLIK code that a customer has generated using their banking application. - /// Can only be set on confirmation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsBlik<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePaymentIntentPaymentMethodOptionsBoleto { @@ -10401,22 +10052,6 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardSetupFuture serializer.serialize_str(self.as_str()) } } -/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCardPresent { - /// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity). - #[serde(skip_serializing_if = "Option::is_none")] - pub request_extended_authorization: Option, - /// Request ability to [increment](https://stripe.com/docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. - /// Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_incremental_authorization_support: Option, -} -impl UpdatePaymentIntentPaymentMethodOptionsCardPresent { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePaymentIntentPaymentMethodOptionsCashapp { @@ -10589,7 +10224,7 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsCustomerBalance<'a> { pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for the eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] -pub eu_bank_transfer: Option>, +pub eu_bank_transfer: Option>, /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// @@ -10608,18 +10243,6 @@ impl<'a> UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> Self { eu_bank_transfer: None, requested_address_types: None, type_ } } } -/// Configuration for the eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { - pub fn new(country: &'a str) -> Self { - Self { country } - } -} /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// @@ -13356,64 +12979,6 @@ impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureU serializer.serialize_str(self.as_str()) } } -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentIntentSetupFutureUsage { - OffSession, - OnSession, -} -impl UpdatePaymentIntentSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use UpdatePaymentIntentSetupFutureUsage::*; - match self { - OffSession => "off_session", - OnSession => "on_session", - } - } -} - -impl std::str::FromStr for UpdatePaymentIntentSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentIntentSetupFutureUsage::*; - match s { - "off_session" => Ok(OffSession), - "on_session" => Ok(OnSession), - _ => Err(()), - } - } -} -impl AsRef for UpdatePaymentIntentSetupFutureUsage { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdatePaymentIntentSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentIntentSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentIntentSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Shipping information for this PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdatePaymentIntentShipping<'a> { @@ -13464,19 +13029,6 @@ impl<'a> UpdatePaymentIntentShippingAddress<'a> { Self::default() } } -/// Use this parameter to automatically create a Transfer when the payment succeeds. -/// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentIntentTransferData { - /// The amount that will be transferred automatically when a charge succeeds. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, -} -impl UpdatePaymentIntentTransferData { - pub fn new() -> Self { - Self::default() - } -} impl<'a> UpdatePaymentIntent<'a> { /// Updates properties on a PaymentIntent object without confirming. /// @@ -13497,7 +13049,7 @@ impl<'a> UpdatePaymentIntent<'a> { pub struct ConfirmPaymentIntent<'a> { /// Controls when the funds will be captured from the customer's account. #[serde(skip_serializing_if = "Option::is_none")] - pub capture_method: Option, + pub capture_method: Option, /// Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`. /// This parameter is intended for simpler integrations that do not handle customer actions, like [saving cards without authentication](https://stripe.com/docs/payments/save-card-without-authentication). #[serde(skip_serializing_if = "Option::is_none")] @@ -13524,94 +13076,40 @@ pub struct ConfirmPaymentIntent<'a> { pub payment_method_data: Option>, /// Payment method-specific configuration for this PaymentIntent. #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_options: Option>, - /// Options to configure Radar. - /// Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session). - #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, - /// Email address that the receipt for the resulting payment will be sent to. - /// If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails). - #[serde(skip_serializing_if = "Option::is_none")] - pub receipt_email: Option<&'a str>, - /// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. - /// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. - /// This parameter is only used for cards and other redirect-based payment methods. - #[serde(skip_serializing_if = "Option::is_none")] - pub return_url: Option<&'a str>, - /// Indicates that you intend to make future payments with this PaymentIntent's payment method. - /// - /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. - /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. - /// - /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - /// - /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. - #[serde(skip_serializing_if = "Option::is_none")] - pub setup_future_usage: Option, - /// Shipping information for this PaymentIntent. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, - /// Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions. - #[serde(skip_serializing_if = "Option::is_none")] - pub use_stripe_sdk: Option, -} -impl<'a> ConfirmPaymentIntent<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Controls when the funds will be captured from the customer's account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentCaptureMethod { - Automatic, - AutomaticAsync, - Manual, -} -impl ConfirmPaymentIntentCaptureMethod { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentCaptureMethod::*; - match self { - Automatic => "automatic", - AutomaticAsync => "automatic_async", - Manual => "manual", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentCaptureMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentCaptureMethod::*; - match s { - "automatic" => Ok(Automatic), - "automatic_async" => Ok(AutomaticAsync), - "manual" => Ok(Manual), - _ => Err(()), - } - } -} -impl AsRef for ConfirmPaymentIntentCaptureMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ConfirmPaymentIntentCaptureMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentCaptureMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } + pub payment_method_options: Option>, + /// Options to configure Radar. + /// Learn more about [Radar Sessions](https://stripe.com/docs/radar/radar-session). + #[serde(skip_serializing_if = "Option::is_none")] + pub radar_options: Option>, + /// Email address that the receipt for the resulting payment will be sent to. + /// If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails). + #[serde(skip_serializing_if = "Option::is_none")] + pub receipt_email: Option<&'a str>, + /// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. + /// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme. + /// This parameter is only used for cards and other redirect-based payment methods. + #[serde(skip_serializing_if = "Option::is_none")] + pub return_url: Option<&'a str>, + /// Indicates that you intend to make future payments with this PaymentIntent's payment method. + /// + /// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. + /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + /// + /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + /// + /// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. + #[serde(skip_serializing_if = "Option::is_none")] + pub setup_future_usage: Option, + /// Shipping information for this PaymentIntent. + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping: Option>, + /// Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions. + #[serde(skip_serializing_if = "Option::is_none")] + pub use_stripe_sdk: Option, } -impl serde::Serialize for ConfirmPaymentIntentCaptureMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) +impl<'a> ConfirmPaymentIntent<'a> { + pub fn new() -> Self { + Self::default() } } #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -13643,7 +13141,7 @@ pub struct ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a> { pub offline: Option<&'a serde_json::Value>, /// If this is a Mandate accepted online, this hash contains details about the online acceptance. #[serde(skip_serializing_if = "Option::is_none")] - pub online: Option>, + pub online: Option>, /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] @@ -13654,19 +13152,6 @@ impl<'a> ConfirmPaymentIntentSecretKeyParamCustomerAcceptance<'a> { Self { accepted_at: None, offline: None, online: None, type_ } } } -/// If this is a Mandate accepted online, this hash contains details about the online acceptance. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceOnline<'a> { - /// The IP address from which the Mandate was accepted by the customer. - pub ip_address: &'a str, - /// The user agent of the browser from which the Mandate was accepted by the customer. - pub user_agent: &'a str, -} -impl<'a> ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceOnline<'a> { - pub fn new(ip_address: &'a str, user_agent: &'a str) -> Self { - Self { ip_address, user_agent } - } -} /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -13827,7 +13312,7 @@ pub enum ConfirmPaymentIntentOffSession { pub struct ConfirmPaymentIntentPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -13982,25 +13467,6 @@ impl<'a> ConfirmPaymentIntentPaymentMethodData<'a> { } } } -/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataAcssDebit<'a> { - /// Customer's bank account number. - pub account_number: &'a str, - /// Institution number of the customer's bank. - pub institution_number: &'a str, - /// Transit number of the customer's bank. - pub transit_number: &'a str, -} -impl<'a> ConfirmPaymentIntentPaymentMethodDataAcssDebit<'a> { - pub fn new( - account_number: &'a str, - institution_number: &'a str, - transit_number: &'a str, - ) -> Self { - Self { account_number, institution_number, transit_number } - } -} /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ConfirmPaymentIntentPaymentMethodDataAuBecsDebit<'a> { @@ -14524,28 +13990,13 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataIdealBank { pub struct ConfirmPaymentIntentPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } impl ConfirmPaymentIntentPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } -/// Customer's date of birth -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodDataKlarnaDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl ConfirmPaymentIntentPaymentMethodDataKlarnaDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct ConfirmPaymentIntentPaymentMethodDataP24 { @@ -15077,7 +14528,7 @@ pub struct ConfirmPaymentIntentPaymentMethodOptions<'a> { pub bancontact: Option, /// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub blik: Option>, + pub blik: Option>, /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub boleto: Option, @@ -15086,7 +14537,7 @@ pub struct ConfirmPaymentIntentPaymentMethodOptions<'a> { pub card: Option>, /// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub card_present: Option, + pub card_present: Option, /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub cashapp: Option, @@ -16110,19 +15561,6 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetu serializer.serialize_str(self.as_str()) } } -/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsBlik<'a> { - /// The 6-digit BLIK code that a customer has generated using their banking application. - /// Can only be set on confirmation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option<&'a str>, -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsBlik<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct ConfirmPaymentIntentPaymentMethodOptionsBoleto { @@ -17114,22 +16552,6 @@ impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutur serializer.serialize_str(self.as_str()) } } -/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCardPresent { - /// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity). - #[serde(skip_serializing_if = "Option::is_none")] - pub request_extended_authorization: Option, - /// Request ability to [increment](https://stripe.com/docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. - /// Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_incremental_authorization_support: Option, -} -impl ConfirmPaymentIntentPaymentMethodOptionsCardPresent { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct ConfirmPaymentIntentPaymentMethodOptionsCashapp { @@ -17302,7 +16724,7 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance<'a> { pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> { /// Configuration for the eu_bank_transfer funding type. #[serde(skip_serializing_if = "Option::is_none")] -pub eu_bank_transfer: Option>, +pub eu_bank_transfer: Option>, /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// @@ -17321,18 +16743,6 @@ impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer<'a> Self { eu_bank_transfer: None, requested_address_types: None, type_ } } } -/// Configuration for the eu_bank_transfer funding type. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { - /// The desired country code of the bank account information. - /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. - pub country: &'a str, -} -impl<'a> ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer<'a> { - pub fn new(country: &'a str) -> Self { - Self { country } - } -} /// List of address types that should be returned in the financial_addresses response. /// If not specified, all valid types will be returned. /// @@ -20079,64 +19489,6 @@ impl<'a> ConfirmPaymentIntentRadarOptions<'a> { Self::default() } } -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). -/// -/// If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ConfirmPaymentIntentSetupFutureUsage { - OffSession, - OnSession, -} -impl ConfirmPaymentIntentSetupFutureUsage { - pub fn as_str(self) -> &'static str { - use ConfirmPaymentIntentSetupFutureUsage::*; - match self { - OffSession => "off_session", - OnSession => "on_session", - } - } -} - -impl std::str::FromStr for ConfirmPaymentIntentSetupFutureUsage { - type Err = (); - fn from_str(s: &str) -> Result { - use ConfirmPaymentIntentSetupFutureUsage::*; - match s { - "off_session" => Ok(OffSession), - "on_session" => Ok(OnSession), - _ => Err(()), - } - } -} -impl AsRef for ConfirmPaymentIntentSetupFutureUsage { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ConfirmPaymentIntentSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ConfirmPaymentIntentSetupFutureUsage { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ConfirmPaymentIntentSetupFutureUsage { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Shipping information for this PaymentIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ConfirmPaymentIntentShipping<'a> { @@ -20358,27 +19710,13 @@ pub struct CapturePaymentIntent<'a> { /// is captured. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option, + pub transfer_data: Option, } impl<'a> CapturePaymentIntent<'a> { pub fn new() -> Self { Self::default() } } -/// The parameters that you can use to automatically create a transfer after the payment -/// is captured. -/// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CapturePaymentIntentTransferData { - /// The amount that will be transferred automatically when a charge succeeds. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, -} -impl CapturePaymentIntentTransferData { - pub fn new() -> Self { - Self::default() - } -} impl<'a> CapturePaymentIntent<'a> { /// Capture the funds of an existing uncaptured PaymentIntent when its status is `requires_capture`. /// @@ -20426,7 +19764,7 @@ pub struct IncrementAuthorizationPaymentIntent<'a> { /// The parameters used to automatically create a transfer after the payment is captured. /// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). #[serde(skip_serializing_if = "Option::is_none")] - pub transfer_data: Option, + pub transfer_data: Option, } impl<'a> IncrementAuthorizationPaymentIntent<'a> { pub fn new(amount: i64) -> Self { @@ -20441,19 +19779,6 @@ impl<'a> IncrementAuthorizationPaymentIntent<'a> { } } } -/// The parameters used to automatically create a transfer after the payment is captured. -/// Learn more about the [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct IncrementAuthorizationPaymentIntentTransferData { - /// The amount that will be transferred automatically when a charge succeeds. - #[serde(skip_serializing_if = "Option::is_none")] - pub amount: Option, -} -impl IncrementAuthorizationPaymentIntentTransferData { - pub fn new() -> Self { - Self::default() - } -} impl<'a> IncrementAuthorizationPaymentIntent<'a> { /// Perform an incremental authorization on an eligible /// [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the @@ -20560,3 +19885,96 @@ impl<'a> ApplyCustomerBalancePaymentIntent<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct OnlineParam<'a> { + /// The IP address from which the Mandate was accepted by the customer. + pub ip_address: &'a str, + /// The user agent of the browser from which the Mandate was accepted by the customer. + pub user_agent: &'a str, +} +impl<'a> OnlineParam<'a> { + pub fn new(ip_address: &'a str, user_agent: &'a str) -> Self { + Self { ip_address, user_agent } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct PaymentMethodParam<'a> { + /// Customer's bank account number. + pub account_number: &'a str, + /// Institution number of the customer's bank. + pub institution_number: &'a str, + /// Transit number of the customer's bank. + pub transit_number: &'a str, +} +impl<'a> PaymentMethodParam<'a> { + pub fn new( + account_number: &'a str, + institution_number: &'a str, + transit_number: &'a str, + ) -> Self { + Self { account_number, institution_number, transit_number } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct DateOfBirth { + /// The day of birth, between 1 and 31. + pub day: i64, + /// The month of birth, between 1 and 12. + pub month: i64, + /// The four-digit year of birth. + pub year: i64, +} +impl DateOfBirth { + pub fn new(day: i64, month: i64, year: i64) -> Self { + Self { day, month, year } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PaymentIntentPaymentMethodOptionsParam<'a> { + /// The 6-digit BLIK code that a customer has generated using their banking application. + /// Can only be set on confirmation. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option<&'a str>, +} +impl<'a> PaymentIntentPaymentMethodOptionsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PaymentMethodOptionsParam { + /// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity). + #[serde(skip_serializing_if = "Option::is_none")] + pub request_extended_authorization: Option, + /// Request ability to [increment](https://stripe.com/docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. + /// Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support. + #[serde(skip_serializing_if = "Option::is_none")] + pub request_incremental_authorization_support: Option, +} +impl PaymentMethodOptionsParam { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct EuBankTransferParams<'a> { + /// The desired country code of the bank account information. + /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`. + pub country: &'a str, +} +impl<'a> EuBankTransferParams<'a> { + pub fn new(country: &'a str) -> Self { + Self { country } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct TransferDataUpdateParams { + /// The amount that will be transferred automatically when a charge succeeds. + #[serde(skip_serializing_if = "Option::is_none")] + pub amount: Option, +} +impl TransferDataUpdateParams { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_core/src/setup_intent/requests.rs b/generated/stripe_core/src/setup_intent/requests.rs index a522eeeb9..068636fb7 100644 --- a/generated/stripe_core/src/setup_intent/requests.rs +++ b/generated/stripe_core/src/setup_intent/requests.rs @@ -32,7 +32,7 @@ pub struct CreateSetupIntent<'a> { /// Include `outbound` if you intend to use the payment method as the destination to send funds to. /// You can include both if you intend to use the payment method for both purposes. #[serde(skip_serializing_if = "Option::is_none")] - pub flow_directions: Option<&'a [CreateSetupIntentFlowDirections]>, + pub flow_directions: Option<&'a [stripe_shared::SetupIntentFlowDirections]>, /// This hash contains details about the mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). #[serde(skip_serializing_if = "Option::is_none")] @@ -155,61 +155,6 @@ impl serde::Serialize for CreateSetupIntentAutomaticPaymentMethodsAllowRedirects serializer.serialize_str(self.as_str()) } } -/// Indicates the directions of money movement for which this payment method is intended to be used. -/// -/// Include `inbound` if you intend to use the payment method as the origin to pull funds from. -/// Include `outbound` if you intend to use the payment method as the destination to send funds to. -/// You can include both if you intend to use the payment method for both purposes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateSetupIntentFlowDirections { - Inbound, - Outbound, -} -impl CreateSetupIntentFlowDirections { - pub fn as_str(self) -> &'static str { - use CreateSetupIntentFlowDirections::*; - match self { - Inbound => "inbound", - Outbound => "outbound", - } - } -} - -impl std::str::FromStr for CreateSetupIntentFlowDirections { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateSetupIntentFlowDirections::*; - match s { - "inbound" => Ok(Inbound), - "outbound" => Ok(Outbound), - _ => Err(()), - } - } -} -impl AsRef for CreateSetupIntentFlowDirections { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateSetupIntentFlowDirections { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateSetupIntentFlowDirections { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateSetupIntentFlowDirections { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// This hash contains details about the mandate to create. /// This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -233,7 +178,7 @@ pub struct CreateSetupIntentMandateDataCustomerAcceptance<'a> { pub offline: Option<&'a serde_json::Value>, /// If this is a Mandate accepted online, this hash contains details about the online acceptance. #[serde(skip_serializing_if = "Option::is_none")] - pub online: Option>, + pub online: Option>, /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] @@ -244,19 +189,6 @@ impl<'a> CreateSetupIntentMandateDataCustomerAcceptance<'a> { Self { accepted_at: None, offline: None, online: None, type_ } } } -/// If this is a Mandate accepted online, this hash contains details about the online acceptance. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentMandateDataCustomerAcceptanceOnline<'a> { - /// The IP address from which the Mandate was accepted by the customer. - pub ip_address: &'a str, - /// The user agent of the browser from which the Mandate was accepted by the customer. - pub user_agent: &'a str, -} -impl<'a> CreateSetupIntentMandateDataCustomerAcceptanceOnline<'a> { - pub fn new(ip_address: &'a str, user_agent: &'a str) -> Self { - Self { ip_address, user_agent } - } -} /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -315,7 +247,7 @@ impl serde::Serialize for CreateSetupIntentMandateDataCustomerAcceptanceType { pub struct CreateSetupIntentPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -336,7 +268,7 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, @@ -403,7 +335,7 @@ pub struct CreateSetupIntentPaymentMethodData<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, @@ -470,25 +402,6 @@ impl<'a> CreateSetupIntentPaymentMethodData<'a> { } } } -/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataAcssDebit<'a> { - /// Customer's bank account number. - pub account_number: &'a str, - /// Institution number of the customer's bank. - pub institution_number: &'a str, - /// Transit number of the customer's bank. - pub transit_number: &'a str, -} -impl<'a> CreateSetupIntentPaymentMethodDataAcssDebit<'a> { - pub fn new( - account_number: &'a str, - institution_number: &'a str, - transit_number: &'a str, - ) -> Self { - Self { account_number, institution_number, transit_number } - } -} /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateSetupIntentPaymentMethodDataAuBecsDebit<'a> { @@ -517,54 +430,6 @@ impl<'a> CreateSetupIntentPaymentMethodDataBacsDebit<'a> { Self::default() } } -/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataBillingDetails<'a> { - /// Billing address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Billing phone number (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> CreateSetupIntentPaymentMethodDataBillingDetails<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Billing address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataBillingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateSetupIntentPaymentMethodDataBillingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateSetupIntentPaymentMethodDataBoleto<'a> { @@ -1012,28 +877,13 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataIdealBank { pub struct CreateSetupIntentPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } impl CreateSetupIntentPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } -/// Customer's date of birth -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataKlarnaDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreateSetupIntentPaymentMethodDataKlarnaDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateSetupIntentPaymentMethodDataP24 { @@ -1170,19 +1020,6 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodDataP24Bank { serializer.serialize_str(self.as_str()) } } -/// Options to configure Radar. -/// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodDataRadarOptions<'a> { - /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. - #[serde(skip_serializing_if = "Option::is_none")] - pub session: Option<&'a str>, -} -impl<'a> CreateSetupIntentPaymentMethodDataRadarOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateSetupIntentPaymentMethodDataSepaDebit<'a> { @@ -1550,10 +1387,10 @@ pub struct CreateSetupIntentPaymentMethodOptions<'a> { pub card: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option>, + pub link: Option>, /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub sepa_debit: Option>, @@ -2281,31 +2118,6 @@ impl serde::Serialize for CreateSetupIntentPaymentMethodOptionsCardRequestThreeD serializer.serialize_str(self.as_str()) } } -/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsLink<'a> { - /// \[Deprecated\] This is a legacy parameter that no longer has any function. - #[serde(skip_serializing_if = "Option::is_none")] - pub persistent_token: Option<&'a str>, -} -impl<'a> CreateSetupIntentPaymentMethodOptionsLink<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSetupIntentPaymentMethodOptionsPaypal<'a> { - /// The PayPal Billing Agreement ID (BAID). - /// This is an ID generated by PayPal which represents the mandate between the merchant and the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_agreement_id: Option<&'a str>, -} -impl<'a> CreateSetupIntentPaymentMethodOptionsPaypal<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateSetupIntentPaymentMethodOptionsSepaDebit<'a> { @@ -2794,7 +2606,7 @@ pub struct UpdateSetupIntent<'a> { /// Include `outbound` if you intend to use the payment method as the destination to send funds to. /// You can include both if you intend to use the payment method for both purposes. #[serde(skip_serializing_if = "Option::is_none")] - pub flow_directions: Option<&'a [UpdateSetupIntentFlowDirections]>, + pub flow_directions: Option<&'a [stripe_shared::SetupIntentFlowDirections]>, /// 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. /// Individual keys can be unset by posting an empty value to them. @@ -2824,68 +2636,13 @@ impl<'a> UpdateSetupIntent<'a> { Self::default() } } -/// Indicates the directions of money movement for which this payment method is intended to be used. -/// -/// Include `inbound` if you intend to use the payment method as the origin to pull funds from. -/// Include `outbound` if you intend to use the payment method as the destination to send funds to. -/// You can include both if you intend to use the payment method for both purposes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateSetupIntentFlowDirections { - Inbound, - Outbound, -} -impl UpdateSetupIntentFlowDirections { - pub fn as_str(self) -> &'static str { - use UpdateSetupIntentFlowDirections::*; - match self { - Inbound => "inbound", - Outbound => "outbound", - } - } -} - -impl std::str::FromStr for UpdateSetupIntentFlowDirections { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateSetupIntentFlowDirections::*; - match s { - "inbound" => Ok(Inbound), - "outbound" => Ok(Outbound), - _ => Err(()), - } - } -} -impl AsRef for UpdateSetupIntentFlowDirections { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateSetupIntentFlowDirections { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateSetupIntentFlowDirections { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateSetupIntentFlowDirections { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// When included, this hash creates a PaymentMethod that is set as the [`payment_method`](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method). /// value in the SetupIntent. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateSetupIntentPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -2906,7 +2663,7 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, @@ -2973,7 +2730,7 @@ pub struct UpdateSetupIntentPaymentMethodData<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, @@ -3040,25 +2797,6 @@ impl<'a> UpdateSetupIntentPaymentMethodData<'a> { } } } -/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataAcssDebit<'a> { - /// Customer's bank account number. - pub account_number: &'a str, - /// Institution number of the customer's bank. - pub institution_number: &'a str, - /// Transit number of the customer's bank. - pub transit_number: &'a str, -} -impl<'a> UpdateSetupIntentPaymentMethodDataAcssDebit<'a> { - pub fn new( - account_number: &'a str, - institution_number: &'a str, - transit_number: &'a str, - ) -> Self { - Self { account_number, institution_number, transit_number } - } -} /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateSetupIntentPaymentMethodDataAuBecsDebit<'a> { @@ -3087,54 +2825,6 @@ impl<'a> UpdateSetupIntentPaymentMethodDataBacsDebit<'a> { Self::default() } } -/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataBillingDetails<'a> { - /// Billing address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Billing phone number (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpdateSetupIntentPaymentMethodDataBillingDetails<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Billing address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataBillingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateSetupIntentPaymentMethodDataBillingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateSetupIntentPaymentMethodDataBoleto<'a> { @@ -3582,28 +3272,13 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataIdealBank { pub struct UpdateSetupIntentPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } impl UpdateSetupIntentPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } -/// Customer's date of birth -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataKlarnaDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl UpdateSetupIntentPaymentMethodDataKlarnaDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateSetupIntentPaymentMethodDataP24 { @@ -3740,19 +3415,6 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodDataP24Bank { serializer.serialize_str(self.as_str()) } } -/// Options to configure Radar. -/// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodDataRadarOptions<'a> { - /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. - #[serde(skip_serializing_if = "Option::is_none")] - pub session: Option<&'a str>, -} -impl<'a> UpdateSetupIntentPaymentMethodDataRadarOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdateSetupIntentPaymentMethodDataSepaDebit<'a> { @@ -4120,10 +3782,10 @@ pub struct UpdateSetupIntentPaymentMethodOptions<'a> { pub card: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option>, + pub link: Option>, /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub sepa_debit: Option>, @@ -4851,31 +4513,6 @@ impl serde::Serialize for UpdateSetupIntentPaymentMethodOptionsCardRequestThreeD serializer.serialize_str(self.as_str()) } } -/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsLink<'a> { - /// \[Deprecated\] This is a legacy parameter that no longer has any function. - #[serde(skip_serializing_if = "Option::is_none")] - pub persistent_token: Option<&'a str>, -} -impl<'a> UpdateSetupIntentPaymentMethodOptionsLink<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSetupIntentPaymentMethodOptionsPaypal<'a> { - /// The PayPal Billing Agreement ID (BAID). - /// This is an ID generated by PayPal which represents the mandate between the merchant and the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_agreement_id: Option<&'a str>, -} -impl<'a> UpdateSetupIntentPaymentMethodOptionsPaypal<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateSetupIntentPaymentMethodOptionsSepaDebit<'a> { @@ -5246,7 +4883,7 @@ pub struct ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a> { pub offline: Option<&'a serde_json::Value>, /// If this is a Mandate accepted online, this hash contains details about the online acceptance. #[serde(skip_serializing_if = "Option::is_none")] - pub online: Option>, + pub online: Option>, /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[serde(rename = "type")] @@ -5257,19 +4894,6 @@ impl<'a> ConfirmSetupIntentSecretKeyParamCustomerAcceptance<'a> { Self { accepted_at: None, offline: None, online: None, type_ } } } -/// If this is a Mandate accepted online, this hash contains details about the online acceptance. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentSecretKeyParamCustomerAcceptanceOnline<'a> { - /// The IP address from which the Mandate was accepted by the customer. - pub ip_address: &'a str, - /// The user agent of the browser from which the Mandate was accepted by the customer. - pub user_agent: &'a str, -} -impl<'a> ConfirmSetupIntentSecretKeyParamCustomerAcceptanceOnline<'a> { - pub fn new(ip_address: &'a str, user_agent: &'a str) -> Self { - Self { ip_address, user_agent } - } -} /// The type of customer acceptance information included with the Mandate. /// One of `online` or `offline`. #[derive(Copy, Clone, Eq, PartialEq)] @@ -5420,7 +5044,7 @@ impl serde::Serialize for ConfirmSetupIntentClientKeyParamCustomerAcceptanceType pub struct ConfirmSetupIntentPaymentMethodData<'a> { /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit: Option>, + pub acss_debit: Option>, /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method. #[serde(skip_serializing_if = "Option::is_none")] pub affirm: Option<&'a serde_json::Value>, @@ -5441,7 +5065,7 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, @@ -5508,7 +5132,7 @@ pub struct ConfirmSetupIntentPaymentMethodData<'a> { /// Options to configure Radar. /// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. #[serde(skip_serializing_if = "Option::is_none")] - pub radar_options: Option>, + pub radar_options: Option>, /// If this is a `Revolut Pay` PaymentMethod, this hash contains details about the Revolut Pay payment method. #[serde(skip_serializing_if = "Option::is_none")] pub revolut_pay: Option<&'a serde_json::Value>, @@ -5575,25 +5199,6 @@ impl<'a> ConfirmSetupIntentPaymentMethodData<'a> { } } } -/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataAcssDebit<'a> { - /// Customer's bank account number. - pub account_number: &'a str, - /// Institution number of the customer's bank. - pub institution_number: &'a str, - /// Transit number of the customer's bank. - pub transit_number: &'a str, -} -impl<'a> ConfirmSetupIntentPaymentMethodDataAcssDebit<'a> { - pub fn new( - account_number: &'a str, - institution_number: &'a str, - transit_number: &'a str, - ) -> Self { - Self { account_number, institution_number, transit_number } - } -} /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ConfirmSetupIntentPaymentMethodDataAuBecsDebit<'a> { @@ -5622,54 +5227,6 @@ impl<'a> ConfirmSetupIntentPaymentMethodDataBacsDebit<'a> { Self::default() } } -/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataBillingDetails<'a> { - /// Billing address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Billing phone number (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> ConfirmSetupIntentPaymentMethodDataBillingDetails<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Billing address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataBillingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> ConfirmSetupIntentPaymentMethodDataBillingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ConfirmSetupIntentPaymentMethodDataBoleto<'a> { @@ -6117,28 +5674,13 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataIdealBank { pub struct ConfirmSetupIntentPaymentMethodDataKlarna { /// Customer's date of birth #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, } impl ConfirmSetupIntentPaymentMethodDataKlarna { pub fn new() -> Self { Self::default() } } -/// Customer's date of birth -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataKlarnaDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl ConfirmSetupIntentPaymentMethodDataKlarnaDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct ConfirmSetupIntentPaymentMethodDataP24 { @@ -6275,19 +5817,6 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodDataP24Bank { serializer.serialize_str(self.as_str()) } } -/// Options to configure Radar. -/// See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodDataRadarOptions<'a> { - /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. - #[serde(skip_serializing_if = "Option::is_none")] - pub session: Option<&'a str>, -} -impl<'a> ConfirmSetupIntentPaymentMethodDataRadarOptions<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct ConfirmSetupIntentPaymentMethodDataSepaDebit<'a> { @@ -6655,10 +6184,10 @@ pub struct ConfirmSetupIntentPaymentMethodOptions<'a> { pub card: Option>, /// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub link: Option>, + pub link: Option>, /// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. #[serde(skip_serializing_if = "Option::is_none")] - pub paypal: Option>, + pub paypal: Option>, /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[serde(skip_serializing_if = "Option::is_none")] pub sepa_debit: Option>, @@ -7386,31 +6915,6 @@ impl serde::Serialize for ConfirmSetupIntentPaymentMethodOptionsCardRequestThree serializer.serialize_str(self.as_str()) } } -/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsLink<'a> { - /// \[Deprecated\] This is a legacy parameter that no longer has any function. - #[serde(skip_serializing_if = "Option::is_none")] - pub persistent_token: Option<&'a str>, -} -impl<'a> ConfirmSetupIntentPaymentMethodOptionsLink<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct ConfirmSetupIntentPaymentMethodOptionsPaypal<'a> { - /// The PayPal Billing Agreement ID (BAID). - /// This is an ID generated by PayPal which represents the mandate between the merchant and the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub billing_agreement_id: Option<&'a str>, -} -impl<'a> ConfirmSetupIntentPaymentMethodOptionsPaypal<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `sepa_debit` SetupIntent, this sub-hash contains details about the SEPA Debit payment method options. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct ConfirmSetupIntentPaymentMethodOptionsSepaDebit<'a> { @@ -7745,7 +7249,7 @@ pub struct CancelSetupIntent<'a> { /// Reason for canceling this SetupIntent. /// Possible values are: `abandoned`, `requested_by_customer`, or `duplicate`. #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: Option, + pub cancellation_reason: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -7755,61 +7259,6 @@ impl<'a> CancelSetupIntent<'a> { Self::default() } } -/// Reason for canceling this SetupIntent. -/// Possible values are: `abandoned`, `requested_by_customer`, or `duplicate`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CancelSetupIntentCancellationReason { - Abandoned, - Duplicate, - RequestedByCustomer, -} -impl CancelSetupIntentCancellationReason { - pub fn as_str(self) -> &'static str { - use CancelSetupIntentCancellationReason::*; - match self { - Abandoned => "abandoned", - Duplicate => "duplicate", - RequestedByCustomer => "requested_by_customer", - } - } -} - -impl std::str::FromStr for CancelSetupIntentCancellationReason { - type Err = (); - fn from_str(s: &str) -> Result { - use CancelSetupIntentCancellationReason::*; - match s { - "abandoned" => Ok(Abandoned), - "duplicate" => Ok(Duplicate), - "requested_by_customer" => Ok(RequestedByCustomer), - _ => Err(()), - } - } -} -impl AsRef for CancelSetupIntentCancellationReason { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CancelSetupIntentCancellationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CancelSetupIntentCancellationReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CancelSetupIntentCancellationReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CancelSetupIntent<'a> { /// You can cancel a SetupIntent object when it’s in one of these statuses: `requires_payment_method`, `requires_confirmation`, or `requires_action`. /// @@ -7854,3 +7303,127 @@ impl<'a> VerifyMicrodepositsSetupIntent<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct OnlineParam<'a> { + /// The IP address from which the Mandate was accepted by the customer. + pub ip_address: &'a str, + /// The user agent of the browser from which the Mandate was accepted by the customer. + pub user_agent: &'a str, +} +impl<'a> OnlineParam<'a> { + pub fn new(ip_address: &'a str, user_agent: &'a str) -> Self { + Self { ip_address, user_agent } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct PaymentMethodParam<'a> { + /// Customer's bank account number. + pub account_number: &'a str, + /// Institution number of the customer's bank. + pub institution_number: &'a str, + /// Transit number of the customer's bank. + pub transit_number: &'a str, +} +impl<'a> PaymentMethodParam<'a> { + pub fn new( + account_number: &'a str, + institution_number: &'a str, + transit_number: &'a str, + ) -> Self { + Self { account_number, institution_number, transit_number } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BillingDetailsAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> BillingDetailsAddress<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct DateOfBirth { + /// The day of birth, between 1 and 31. + pub day: i64, + /// The month of birth, between 1 and 12. + pub month: i64, + /// The four-digit year of birth. + pub year: i64, +} +impl DateOfBirth { + pub fn new(day: i64, month: i64, year: i64) -> Self { + Self { day, month, year } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RadarOptions<'a> { + /// A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. + #[serde(skip_serializing_if = "Option::is_none")] + pub session: Option<&'a str>, +} +impl<'a> RadarOptions<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SetupIntentPaymentMethodOptionsParam<'a> { + /// \[Deprecated\] This is a legacy parameter that no longer has any function. + #[serde(skip_serializing_if = "Option::is_none")] + pub persistent_token: Option<&'a str>, +} +impl<'a> SetupIntentPaymentMethodOptionsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PaymentMethodOptionsParam<'a> { + /// The PayPal Billing Agreement ID (BAID). + /// This is an ID generated by PayPal which represents the mandate between the merchant and the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub billing_agreement_id: Option<&'a str>, +} +impl<'a> PaymentMethodOptionsParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BillingDetailsInnerParams<'a> { + /// Billing address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// Email address. + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<&'a str>, + /// Full name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// Billing phone number (including extension). + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, +} +impl<'a> BillingDetailsInnerParams<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_core/src/token/requests.rs b/generated/stripe_core/src/token/requests.rs index 76cc6dde2..253a7de1b 100644 --- a/generated/stripe_core/src/token/requests.rs +++ b/generated/stripe_core/src/token/requests.rs @@ -139,7 +139,7 @@ impl serde::Serialize for CreateTokenAccountBusinessType { pub struct CreateTokenAccountCompany<'a> { /// The company's primary address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The Kana variation of the company's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] pub address_kana: Option>, @@ -210,33 +210,6 @@ impl<'a> CreateTokenAccountCompany<'a> { Self::default() } } -/// The company's primary address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountCompanyAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateTokenAccountCompanyAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The Kana variation of the company's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateTokenAccountCompanyAddressKana<'a> { @@ -465,7 +438,7 @@ impl<'a> CreateTokenAccountCompanyVerificationDocument<'a> { pub struct CreateTokenAccountIndividual<'a> { /// The individual's primary address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The Kana variation of the the individual's primary address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] pub address_kana: Option>, @@ -474,7 +447,7 @@ pub struct CreateTokenAccountIndividual<'a> { pub address_kanji: Option>, /// The individual's date of birth. #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, /// The individual's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -529,46 +502,19 @@ pub struct CreateTokenAccountIndividual<'a> { pub political_exposure: Option, /// The individual's registered address. #[serde(skip_serializing_if = "Option::is_none")] - pub registered_address: Option>, + pub registered_address: Option>, /// The last four digits of the individual's Social Security Number (U.S. only). #[serde(skip_serializing_if = "Option::is_none")] pub ssn_last_4: Option<&'a str>, /// The individual's verification document information. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, + pub verification: Option>, } impl<'a> CreateTokenAccountIndividual<'a> { pub fn new() -> Self { Self::default() } } -/// The individual's primary address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateTokenAccountIndividualAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The Kana variation of the the individual's primary address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateTokenAccountIndividualAddressKana<'a> { @@ -629,21 +575,6 @@ impl<'a> CreateTokenAccountIndividualAddressKanji<'a> { Self::default() } } -/// The individual's date of birth. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTokenAccountIndividualDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreateTokenAccountIndividualDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CreateTokenAccountIndividualPoliticalExposure { @@ -695,82 +626,6 @@ impl serde::Serialize for CreateTokenAccountIndividualPoliticalExposure { serializer.serialize_str(self.as_str()) } } -/// The individual's registered address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualRegisteredAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateTokenAccountIndividualRegisteredAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The individual's verification document information. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualVerification<'a> { - /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_document: Option>, - /// An identifying document, either a passport or local ID card. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> CreateTokenAccountIndividualVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualVerificationAdditionalDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> CreateTokenAccountIndividualVerificationAdditionalDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An identifying document, either a passport or local ID card. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenAccountIndividualVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> CreateTokenAccountIndividualVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The bank account this token will represent. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateTokenBankAccount<'a> { @@ -1012,7 +867,7 @@ pub struct CreateTokenPerson<'a> { pub additional_tos_acceptances: Option>, /// The person's address. #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, + pub address: Option>, /// The Kana variation of the person's address (Japan only). #[serde(skip_serializing_if = "Option::is_none")] pub address_kana: Option>, @@ -1021,7 +876,7 @@ pub struct CreateTokenPerson<'a> { pub address_kanji: Option>, /// The person's date of birth. #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, + pub dob: Option, /// Documents that may be submitted to satisfy various informational requests. #[serde(skip_serializing_if = "Option::is_none")] pub documents: Option>, @@ -1083,7 +938,7 @@ pub struct CreateTokenPerson<'a> { pub political_exposure: Option<&'a str>, /// The person's registered address. #[serde(skip_serializing_if = "Option::is_none")] - pub registered_address: Option>, + pub registered_address: Option>, /// The relationship that this person has with the account's legal entity. #[serde(skip_serializing_if = "Option::is_none")] pub relationship: Option>, @@ -1092,7 +947,7 @@ pub struct CreateTokenPerson<'a> { pub ssn_last_4: Option<&'a str>, /// The person's verification status. #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, + pub verification: Option>, } impl<'a> CreateTokenPerson<'a> { pub fn new() -> Self { @@ -1129,33 +984,6 @@ impl<'a> CreateTokenPersonAdditionalTosAcceptancesAccount<'a> { Self::default() } } -/// The person's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateTokenPersonAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The Kana variation of the person's address (Japan only). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateTokenPersonAddressKana<'a> { @@ -1216,102 +1044,24 @@ impl<'a> CreateTokenPersonAddressKanji<'a> { Self::default() } } -/// The person's date of birth. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTokenPersonDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreateTokenPersonDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} /// Documents that may be submitted to satisfy various informational requests. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateTokenPersonDocuments<'a> { /// One or more documents that demonstrate proof that this person is authorized to represent the company. #[serde(skip_serializing_if = "Option::is_none")] - pub company_authorization: Option>, + pub company_authorization: Option>, /// One or more documents showing the person's passport page with photo and personal data. #[serde(skip_serializing_if = "Option::is_none")] - pub passport: Option>, + pub passport: Option>, /// One or more documents showing the person's visa required for living in the country where they are residing. #[serde(skip_serializing_if = "Option::is_none")] - pub visa: Option>, + pub visa: Option>, } impl<'a> CreateTokenPersonDocuments<'a> { pub fn new() -> Self { Self::default() } } -/// One or more documents that demonstrate proof that this person is authorized to represent the company. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonDocumentsCompanyAuthorization<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateTokenPersonDocumentsCompanyAuthorization<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the person's passport page with photo and personal data. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonDocumentsPassport<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateTokenPersonDocumentsPassport<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// One or more documents showing the person's visa required for living in the country where they are residing. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonDocumentsVisa<'a> { - /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. - #[serde(skip_serializing_if = "Option::is_none")] - pub files: Option<&'a [&'a str]>, -} -impl<'a> CreateTokenPersonDocumentsVisa<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The person's registered address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonRegisteredAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateTokenPersonRegisteredAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The relationship that this person has with the account's legal entity. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateTokenPersonRelationship<'a> { @@ -1346,41 +1096,69 @@ impl<'a> CreateTokenPersonRelationship<'a> { Self::default() } } -/// The person's verification status. +/// The PII this token represents. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonVerification<'a> { - /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_document: Option>, - /// An identifying document, either a passport or local ID card. +pub struct CreateTokenPii<'a> { + /// The `id_number` for the PII, in string form. #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, + pub id_number: Option<&'a str>, } -impl<'a> CreateTokenPersonVerification<'a> { +impl<'a> CreateTokenPii<'a> { pub fn new() -> Self { Self::default() } } -/// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. +impl<'a> CreateToken<'a> { + /// Creates a single-use token that represents a bank account’s details. + /// You can use this token with any API method in place of a bank account dictionary. + /// You can only use this token once. + /// To do so, attach it to a [Custom account](https://stripe.com/docs/api#accounts). + pub fn send(&self, client: &stripe::Client) -> stripe::Response { + client.send_form("/tokens", self, http_types::Method::Post) + } +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonVerificationAdditionalDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. +pub struct AddressSpecs<'a> { + /// City, district, suburb, town, or village. #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, } -impl<'a> CreateTokenPersonVerificationAdditionalDocument<'a> { +impl<'a> AddressSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// An identifying document, either a passport or local ID card. +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct DateOfBirthSpecs { + /// The day of birth, between 1 and 31. + pub day: i64, + /// The month of birth, between 1 and 12. + pub month: i64, + /// The four-digit year of birth. + pub year: i64, +} +impl DateOfBirthSpecs { + pub fn new(day: i64, month: i64, year: i64) -> Self { + Self { day, month, year } + } +} #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPersonVerificationDocument<'a> { +pub struct PersonVerificationDocumentSpecs<'a> { /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size. #[serde(skip_serializing_if = "Option::is_none")] @@ -1390,29 +1168,33 @@ pub struct CreateTokenPersonVerificationDocument<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub front: Option<&'a str>, } -impl<'a> CreateTokenPersonVerificationDocument<'a> { +impl<'a> PersonVerificationDocumentSpecs<'a> { pub fn new() -> Self { Self::default() } } -/// The PII this token represents. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTokenPii<'a> { - /// The `id_number` for the PII, in string form. +pub struct DocumentsParam<'a> { + /// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`. #[serde(skip_serializing_if = "Option::is_none")] - pub id_number: Option<&'a str>, + pub files: Option<&'a [&'a str]>, } -impl<'a> CreateTokenPii<'a> { +impl<'a> DocumentsParam<'a> { pub fn new() -> Self { Self::default() } } -impl<'a> CreateToken<'a> { - /// Creates a single-use token that represents a bank account’s details. - /// You can use this token with any API method in place of a bank account dictionary. - /// You can only use this token once. - /// To do so, attach it to a [Custom account](https://stripe.com/docs/api#accounts). - pub fn send(&self, client: &stripe::Client) -> stripe::Response { - client.send_form("/tokens", self, http_types::Method::Post) +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonVerificationSpecs<'a> { + /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_document: Option>, + /// An identifying document, either a passport or local ID card. + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option>, +} +impl<'a> PersonVerificationSpecs<'a> { + pub fn new() -> Self { + Self::default() } } diff --git a/generated/stripe_fraud/src/radar_value_list/requests.rs b/generated/stripe_fraud/src/radar_value_list/requests.rs index 4cee5e0ec..ac025d356 100644 --- a/generated/stripe_fraud/src/radar_value_list/requests.rs +++ b/generated/stripe_fraud/src/radar_value_list/requests.rs @@ -78,7 +78,7 @@ pub struct CreateRadarValueList<'a> { /// One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. /// Use `string` if the item type is unknown or mixed. #[serde(skip_serializing_if = "Option::is_none")] - pub item_type: Option, + pub item_type: Option, /// 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. /// Individual keys can be unset by posting an empty value to them. @@ -93,83 +93,6 @@ impl<'a> CreateRadarValueList<'a> { Self { alias, expand: None, item_type: None, metadata: None, name } } } -/// Type of the items in the value list. -/// One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. -/// Use `string` if the item type is unknown or mixed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateRadarValueListItemType { - CardBin, - CardFingerprint, - CaseSensitiveString, - Country, - CustomerId, - Email, - IpAddress, - SepaDebitFingerprint, - String, - UsBankAccountFingerprint, -} -impl CreateRadarValueListItemType { - pub fn as_str(self) -> &'static str { - use CreateRadarValueListItemType::*; - match self { - CardBin => "card_bin", - CardFingerprint => "card_fingerprint", - CaseSensitiveString => "case_sensitive_string", - Country => "country", - CustomerId => "customer_id", - Email => "email", - IpAddress => "ip_address", - SepaDebitFingerprint => "sepa_debit_fingerprint", - String => "string", - UsBankAccountFingerprint => "us_bank_account_fingerprint", - } - } -} - -impl std::str::FromStr for CreateRadarValueListItemType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateRadarValueListItemType::*; - match s { - "card_bin" => Ok(CardBin), - "card_fingerprint" => Ok(CardFingerprint), - "case_sensitive_string" => Ok(CaseSensitiveString), - "country" => Ok(Country), - "customer_id" => Ok(CustomerId), - "email" => Ok(Email), - "ip_address" => Ok(IpAddress), - "sepa_debit_fingerprint" => Ok(SepaDebitFingerprint), - "string" => Ok(String), - "us_bank_account_fingerprint" => Ok(UsBankAccountFingerprint), - _ => Err(()), - } - } -} -impl AsRef for CreateRadarValueListItemType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateRadarValueListItemType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateRadarValueListItemType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateRadarValueListItemType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateRadarValueList<'a> { /// Creates a new `ValueList` object, which can then be referenced in rules. pub fn send(&self, client: &stripe::Client) -> stripe::Response { diff --git a/generated/stripe_fraud/src/radar_value_list/types.rs b/generated/stripe_fraud/src/radar_value_list/types.rs index b297b1a6c..7defddd6b 100644 --- a/generated/stripe_fraud/src/radar_value_list/types.rs +++ b/generated/stripe_fraud/src/radar_value_list/types.rs @@ -15,7 +15,7 @@ pub struct RadarValueList { pub id: stripe_fraud::RadarValueListId, /// The type of items in the value list. /// One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. - pub item_type: RadarValueListItemType, + pub item_type: stripe_fraud::RadarValueListItemType, /// List of items contained within this value list. pub list_items: stripe_types::List, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -26,8 +26,13 @@ pub struct RadarValueList { /// The name of the value list. pub name: String, } -/// The type of items in the value list. -/// One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. +impl stripe_types::Object for RadarValueList { + type Id = stripe_fraud::RadarValueListId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(RadarValueListId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum RadarValueListItemType { CardBin, @@ -110,10 +115,3 @@ impl<'de> serde::Deserialize<'de> for RadarValueListItemType { .map_err(|_| serde::de::Error::custom("Unknown value for RadarValueListItemType")) } } -impl stripe_types::Object for RadarValueList { - type Id = stripe_fraud::RadarValueListId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(RadarValueListId); diff --git a/generated/stripe_issuing/src/issuing_authorization/requests.rs b/generated/stripe_issuing/src/issuing_authorization/requests.rs index de3ee7e10..e8433774a 100644 --- a/generated/stripe_issuing/src/issuing_authorization/requests.rs +++ b/generated/stripe_issuing/src/issuing_authorization/requests.rs @@ -28,67 +28,13 @@ pub struct ListIssuingAuthorization<'a> { pub starting_after: Option<&'a str>, /// Only return authorizations with the given status. One of `pending`, `closed`, or `reversed`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListIssuingAuthorization<'a> { pub fn new() -> Self { Self::default() } } -/// Only return authorizations with the given status. One of `pending`, `closed`, or `reversed`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingAuthorizationStatus { - Closed, - Pending, - Reversed, -} -impl ListIssuingAuthorizationStatus { - pub fn as_str(self) -> &'static str { - use ListIssuingAuthorizationStatus::*; - match self { - Closed => "closed", - Pending => "pending", - Reversed => "reversed", - } - } -} - -impl std::str::FromStr for ListIssuingAuthorizationStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingAuthorizationStatus::*; - match s { - "closed" => Ok(Closed), - "pending" => Ok(Pending), - "reversed" => Ok(Reversed), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingAuthorizationStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingAuthorizationStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingAuthorizationStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingAuthorizationStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIssuingAuthorization<'a> { /// Returns a list of Issuing `Authorization` objects. /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. @@ -241,7 +187,7 @@ pub struct CreateIssuingAuthorization<'a> { pub amount_details: Option, /// How the card details were provided. Defaults to online. #[serde(skip_serializing_if = "Option::is_none")] - pub authorization_method: Option, + pub authorization_method: Option, /// Card associated with this authorization. pub card: &'a str, /// The currency of the authorization. @@ -304,66 +250,6 @@ impl CreateIssuingAuthorizationAmountDetails { Self::default() } } -/// How the card details were provided. Defaults to online. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingAuthorizationAuthorizationMethod { - Chip, - Contactless, - KeyedIn, - Online, - Swipe, -} -impl CreateIssuingAuthorizationAuthorizationMethod { - pub fn as_str(self) -> &'static str { - use CreateIssuingAuthorizationAuthorizationMethod::*; - match self { - Chip => "chip", - Contactless => "contactless", - KeyedIn => "keyed_in", - Online => "online", - Swipe => "swipe", - } - } -} - -impl std::str::FromStr for CreateIssuingAuthorizationAuthorizationMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateIssuingAuthorizationAuthorizationMethod::*; - match s { - "chip" => Ok(Chip), - "contactless" => Ok(Contactless), - "keyed_in" => Ok(KeyedIn), - "online" => Ok(Online), - "swipe" => Ok(Swipe), - _ => Err(()), - } - } -} -impl AsRef for CreateIssuingAuthorizationAuthorizationMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateIssuingAuthorizationAuthorizationMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateIssuingAuthorizationAuthorizationMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateIssuingAuthorizationAuthorizationMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateIssuingAuthorizationMerchantData<'a> { diff --git a/generated/stripe_issuing/src/issuing_card/requests.rs b/generated/stripe_issuing/src/issuing_card/requests.rs index dde07f3eb..9340beada 100644 --- a/generated/stripe_issuing/src/issuing_card/requests.rs +++ b/generated/stripe_issuing/src/issuing_card/requests.rs @@ -34,122 +34,17 @@ pub struct ListIssuingCard<'a> { pub starting_after: Option<&'a str>, /// Only return cards that have the given status. One of `active`, `inactive`, or `canceled`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Only return cards that have the given type. One of `virtual` or `physical`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> ListIssuingCard<'a> { pub fn new() -> Self { Self::default() } } -/// Only return cards that have the given status. One of `active`, `inactive`, or `canceled`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingCardStatus { - Active, - Canceled, - Inactive, -} -impl ListIssuingCardStatus { - pub fn as_str(self) -> &'static str { - use ListIssuingCardStatus::*; - match self { - Active => "active", - Canceled => "canceled", - Inactive => "inactive", - } - } -} - -impl std::str::FromStr for ListIssuingCardStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingCardStatus::*; - match s { - "active" => Ok(Active), - "canceled" => Ok(Canceled), - "inactive" => Ok(Inactive), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingCardStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingCardStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingCardStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingCardStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Only return cards that have the given type. One of `virtual` or `physical`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingCardType { - Physical, - Virtual, -} -impl ListIssuingCardType { - pub fn as_str(self) -> &'static str { - use ListIssuingCardType::*; - match self { - Physical => "physical", - Virtual => "virtual", - } - } -} - -impl std::str::FromStr for ListIssuingCardType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingCardType::*; - match s { - "physical" => Ok(Physical), - "virtual" => Ok(Virtual), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingCardType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingCardType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingCardType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingCardType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIssuingCard<'a> { /// Returns a list of Issuing `Card` objects. /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. @@ -186,7 +81,7 @@ pub struct CreateIssuingCard<'a> { pub replacement_for: Option<&'a str>, /// If `replacement_for` is specified, this should indicate why that card is being replaced. #[serde(skip_serializing_if = "Option::is_none")] - pub replacement_reason: Option, + pub replacement_reason: Option, /// The address where the card will be shipped. #[serde(skip_serializing_if = "Option::is_none")] pub shipping: Option>, @@ -201,10 +96,10 @@ pub struct CreateIssuingCard<'a> { pub status: Option, /// The type of card to issue. Possible values are `physical` or `virtual`. #[serde(rename = "type")] - pub type_: CreateIssuingCardType, + pub type_: stripe_shared::IssuingCardType, } impl<'a> CreateIssuingCard<'a> { - pub fn new(currency: stripe_types::Currency, type_: CreateIssuingCardType) -> Self { + pub fn new(currency: stripe_types::Currency, type_: stripe_shared::IssuingCardType) -> Self { Self { cardholder: None, currency, @@ -220,63 +115,6 @@ impl<'a> CreateIssuingCard<'a> { } } } -/// If `replacement_for` is specified, this should indicate why that card is being replaced. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardReplacementReason { - Damaged, - Expired, - Lost, - Stolen, -} -impl CreateIssuingCardReplacementReason { - pub fn as_str(self) -> &'static str { - use CreateIssuingCardReplacementReason::*; - match self { - Damaged => "damaged", - Expired => "expired", - Lost => "lost", - Stolen => "stolen", - } - } -} - -impl std::str::FromStr for CreateIssuingCardReplacementReason { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateIssuingCardReplacementReason::*; - match s { - "damaged" => Ok(Damaged), - "expired" => Ok(Expired), - "lost" => Ok(Lost), - "stolen" => Ok(Stolen), - _ => Err(()), - } - } -} -impl AsRef for CreateIssuingCardReplacementReason { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateIssuingCardReplacementReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateIssuingCardReplacementReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateIssuingCardReplacementReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// The address where the card will be shipped. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateIssuingCardShipping<'a> { @@ -3697,57 +3535,6 @@ impl serde::Serialize for CreateIssuingCardStatus { serializer.serialize_str(self.as_str()) } } -/// The type of card to issue. Possible values are `physical` or `virtual`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardType { - Physical, - Virtual, -} -impl CreateIssuingCardType { - pub fn as_str(self) -> &'static str { - use CreateIssuingCardType::*; - match self { - Physical => "physical", - Virtual => "virtual", - } - } -} - -impl std::str::FromStr for CreateIssuingCardType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateIssuingCardType::*; - match s { - "physical" => Ok(Physical), - "virtual" => Ok(Virtual), - _ => Err(()), - } - } -} -impl AsRef for CreateIssuingCardType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateIssuingCardType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateIssuingCardType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateIssuingCardType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateIssuingCard<'a> { /// Creates an Issuing `Card` object. pub fn send(&self, client: &stripe::Client) -> stripe::Response { @@ -3801,7 +3588,7 @@ pub struct UpdateIssuingCard<'a> { /// Defaults to `inactive`. /// If this card is being canceled because it was lost or stolen, this information should be provided as `cancellation_reason`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> UpdateIssuingCard<'a> { pub fn new() -> Self { @@ -7060,63 +6847,6 @@ impl serde::Serialize for UpdateIssuingCardSpendingControlsSpendingLimitsInterva serializer.serialize_str(self.as_str()) } } -/// Dictates whether authorizations can be approved on this card. -/// May be blocked from activating cards depending on past-due Cardholder requirements. -/// Defaults to `inactive`. -/// If this card is being canceled because it was lost or stolen, this information should be provided as `cancellation_reason`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingCardStatus { - Active, - Canceled, - Inactive, -} -impl UpdateIssuingCardStatus { - pub fn as_str(self) -> &'static str { - use UpdateIssuingCardStatus::*; - match self { - Active => "active", - Canceled => "canceled", - Inactive => "inactive", - } - } -} - -impl std::str::FromStr for UpdateIssuingCardStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateIssuingCardStatus::*; - match s { - "active" => Ok(Active), - "canceled" => Ok(Canceled), - "inactive" => Ok(Inactive), - _ => Err(()), - } - } -} -impl AsRef for UpdateIssuingCardStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateIssuingCardStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateIssuingCardStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateIssuingCardStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> UpdateIssuingCard<'a> { /// Updates the specified Issuing `Card` object by setting the values of the parameters passed. /// Any parameters not provided will be left unchanged. diff --git a/generated/stripe_issuing/src/issuing_cardholder/requests.rs b/generated/stripe_issuing/src/issuing_cardholder/requests.rs index fe6bad3e3..bc8481ef8 100644 --- a/generated/stripe_issuing/src/issuing_cardholder/requests.rs +++ b/generated/stripe_issuing/src/issuing_cardholder/requests.rs @@ -28,122 +28,17 @@ pub struct ListIssuingCardholder<'a> { pub starting_after: Option<&'a str>, /// Only return cardholders that have the given status. One of `active`, `inactive`, or `blocked`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Only return cardholders that have the given type. One of `individual` or `company`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> ListIssuingCardholder<'a> { pub fn new() -> Self { Self::default() } } -/// Only return cardholders that have the given status. One of `active`, `inactive`, or `blocked`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingCardholderStatus { - Active, - Blocked, - Inactive, -} -impl ListIssuingCardholderStatus { - pub fn as_str(self) -> &'static str { - use ListIssuingCardholderStatus::*; - match self { - Active => "active", - Blocked => "blocked", - Inactive => "inactive", - } - } -} - -impl std::str::FromStr for ListIssuingCardholderStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingCardholderStatus::*; - match s { - "active" => Ok(Active), - "blocked" => Ok(Blocked), - "inactive" => Ok(Inactive), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingCardholderStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingCardholderStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingCardholderStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingCardholderStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Only return cardholders that have the given type. One of `individual` or `company`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingCardholderType { - Company, - Individual, -} -impl ListIssuingCardholderType { - pub fn as_str(self) -> &'static str { - use ListIssuingCardholderType::*; - match self { - Company => "company", - Individual => "individual", - } - } -} - -impl std::str::FromStr for ListIssuingCardholderType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingCardholderType::*; - match s { - "company" => Ok(Company), - "individual" => Ok(Individual), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingCardholderType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingCardholderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingCardholderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingCardholderType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIssuingCardholder<'a> { /// Returns a list of Issuing `Cardholder` objects. /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. @@ -162,10 +57,10 @@ impl<'a> ListIssuingCardholder<'a> { #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateIssuingCardholder<'a> { /// The cardholder's billing address. - pub billing: CreateIssuingCardholderBilling<'a>, + pub billing: BillingSpecs<'a>, /// Additional information about a `company` cardholder. #[serde(skip_serializing_if = "Option::is_none")] - pub company: Option>, + pub company: Option>, /// The cardholder's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -174,7 +69,7 @@ pub struct CreateIssuingCardholder<'a> { pub expand: Option<&'a [&'a str]>, /// Additional information about an `individual` cardholder. #[serde(skip_serializing_if = "Option::is_none")] - pub individual: Option>, + pub individual: Option>, /// 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. /// Individual keys can be unset by posting an empty value to them. @@ -196,7 +91,7 @@ pub struct CreateIssuingCardholder<'a> { /// Locales can be `de`, `en`, `es`, `fr`, or `it`. /// This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locales: Option<&'a [CreateIssuingCardholderPreferredLocales]>, + pub preferred_locales: Option<&'a [stripe_shared::IssuingCardholderPreferredLocales]>, /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[serde(skip_serializing_if = "Option::is_none")] @@ -208,10 +103,10 @@ pub struct CreateIssuingCardholder<'a> { /// See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> CreateIssuingCardholder<'a> { - pub fn new(billing: CreateIssuingCardholderBilling<'a>, name: &'a str) -> Self { + pub fn new(billing: BillingSpecs<'a>, name: &'a str) -> Self { Self { billing, company: None, @@ -228,217 +123,6 @@ impl<'a> CreateIssuingCardholder<'a> { } } } -/// The cardholder's billing address. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardholderBilling<'a> { - /// The cardholder’s billing address. - pub address: CreateIssuingCardholderBillingAddress<'a>, -} -impl<'a> CreateIssuingCardholderBilling<'a> { - pub fn new(address: CreateIssuingCardholderBillingAddress<'a>) -> Self { - Self { address } - } -} -/// The cardholder’s billing address. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardholderBillingAddress<'a> { - /// City, district, suburb, town, or village. - pub city: &'a str, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - pub country: &'a str, - /// Address line 1 (e.g., street, PO Box, or company name). - pub line1: &'a str, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - pub postal_code: &'a str, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateIssuingCardholderBillingAddress<'a> { - pub fn new(city: &'a str, country: &'a str, line1: &'a str, postal_code: &'a str) -> Self { - Self { city, country, line1, line2: None, postal_code, state: None } - } -} -/// Additional information about a `company` cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderCompany<'a> { - /// The entity's business ID number. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id: Option<&'a str>, -} -impl<'a> CreateIssuingCardholderCompany<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Additional information about an `individual` cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderIndividual<'a> { - /// Information related to the card_issuing program for this cardholder. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option>, - /// The date of birth of this cardholder. Cardholders must be older than 13 years old. - #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, - /// The first name of this cardholder. - /// Required before activating Cards. - /// This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name: Option<&'a str>, - /// The last name of this cardholder. - /// Required before activating Cards. - /// This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name: Option<&'a str>, - /// Government-issued ID document for this cardholder. - #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, -} -impl<'a> CreateIssuingCardholderIndividual<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Information related to the card_issuing program for this cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderIndividualCardIssuing<'a> { - /// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). - #[serde(skip_serializing_if = "Option::is_none")] - pub user_terms_acceptance: - Option>, -} -impl<'a> CreateIssuingCardholderIndividualCardIssuing<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderIndividualCardIssuingUserTermsAcceptance<'a> { - /// The Unix timestamp marking when the cardholder accepted the Authorized User Terms. - /// Required for Celtic Spend Card users. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the cardholder accepted the Authorized User Terms. - /// Required for Celtic Spend Card users. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the cardholder accepted the Authorized User Terms. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> CreateIssuingCardholderIndividualCardIssuingUserTermsAcceptance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The date of birth of this cardholder. Cardholders must be older than 13 years old. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateIssuingCardholderIndividualDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl CreateIssuingCardholderIndividualDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} -/// Government-issued ID document for this cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderIndividualVerification<'a> { - /// An identifying document, either a passport or local ID card. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> CreateIssuingCardholderIndividualVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An identifying document, either a passport or local ID card. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingCardholderIndividualVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> CreateIssuingCardholderIndividualVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The cardholder’s preferred locales (languages), ordered by preference. -/// Locales can be `de`, `en`, `es`, `fr`, or `it`. -/// This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardholderPreferredLocales { - De, - En, - Es, - Fr, - It, -} -impl CreateIssuingCardholderPreferredLocales { - pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderPreferredLocales::*; - match self { - De => "de", - En => "en", - Es => "es", - Fr => "fr", - It => "it", - } - } -} - -impl std::str::FromStr for CreateIssuingCardholderPreferredLocales { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateIssuingCardholderPreferredLocales::*; - match s { - "de" => Ok(De), - "en" => Ok(En), - "es" => Ok(Es), - "fr" => Ok(Fr), - "it" => Ok(It), - _ => Err(()), - } - } -} -impl AsRef for CreateIssuingCardholderPreferredLocales { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateIssuingCardholderPreferredLocales { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateIssuingCardholderPreferredLocales { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateIssuingCardholderPreferredLocales { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -3682,76 +3366,24 @@ impl serde::Serialize for CreateIssuingCardholderStatus { serializer.serialize_str(self.as_str()) } } -/// One of `individual` or `company`. -/// See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIssuingCardholderType { - Company, - Individual, -} -impl CreateIssuingCardholderType { - pub fn as_str(self) -> &'static str { - use CreateIssuingCardholderType::*; - match self { - Company => "company", - Individual => "individual", - } +impl<'a> CreateIssuingCardholder<'a> { + /// Creates a new Issuing `Cardholder` object that can be issued cards. + pub fn send( + &self, + client: &stripe::Client, + ) -> stripe::Response { + client.send_form("/issuing/cardholders", self, http_types::Method::Post) } } - -impl std::str::FromStr for CreateIssuingCardholderType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateIssuingCardholderType::*; - match s { - "company" => Ok(Company), - "individual" => Ok(Individual), - _ => Err(()), - } - } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct RetrieveIssuingCardholder<'a> { + /// Specifies which fields in the response should be expanded. + #[serde(skip_serializing_if = "Option::is_none")] + pub expand: Option<&'a [&'a str]>, } -impl AsRef for CreateIssuingCardholderType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateIssuingCardholderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateIssuingCardholderType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateIssuingCardholderType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'a> CreateIssuingCardholder<'a> { - /// Creates a new Issuing `Cardholder` object that can be issued cards. - pub fn send( - &self, - client: &stripe::Client, - ) -> stripe::Response { - client.send_form("/issuing/cardholders", self, http_types::Method::Post) - } -} -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct RetrieveIssuingCardholder<'a> { - /// Specifies which fields in the response should be expanded. - #[serde(skip_serializing_if = "Option::is_none")] - pub expand: Option<&'a [&'a str]>, -} -impl<'a> RetrieveIssuingCardholder<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> RetrieveIssuingCardholder<'a> { + pub fn new() -> Self { + Self::default() } } impl<'a> RetrieveIssuingCardholder<'a> { @@ -3768,10 +3400,10 @@ impl<'a> RetrieveIssuingCardholder<'a> { pub struct UpdateIssuingCardholder<'a> { /// The cardholder's billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub billing: Option>, + pub billing: Option>, /// Additional information about a `company` cardholder. #[serde(skip_serializing_if = "Option::is_none")] - pub company: Option>, + pub company: Option>, /// The cardholder's email address. #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<&'a str>, @@ -3780,7 +3412,7 @@ pub struct UpdateIssuingCardholder<'a> { pub expand: Option<&'a [&'a str]>, /// Additional information about an `individual` cardholder. #[serde(skip_serializing_if = "Option::is_none")] - pub individual: Option>, + pub individual: Option>, /// 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. /// Individual keys can be unset by posting an empty value to them. @@ -3796,7 +3428,7 @@ pub struct UpdateIssuingCardholder<'a> { /// Locales can be `de`, `en`, `es`, `fr`, or `it`. /// This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. #[serde(skip_serializing_if = "Option::is_none")] - pub preferred_locales: Option<&'a [UpdateIssuingCardholderPreferredLocales]>, + pub preferred_locales: Option<&'a [stripe_shared::IssuingCardholderPreferredLocales]>, /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[serde(skip_serializing_if = "Option::is_none")] @@ -3810,217 +3442,6 @@ impl<'a> UpdateIssuingCardholder<'a> { Self::default() } } -/// The cardholder's billing address. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateIssuingCardholderBilling<'a> { - /// The cardholder’s billing address. - pub address: UpdateIssuingCardholderBillingAddress<'a>, -} -impl<'a> UpdateIssuingCardholderBilling<'a> { - pub fn new(address: UpdateIssuingCardholderBillingAddress<'a>) -> Self { - Self { address } - } -} -/// The cardholder’s billing address. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateIssuingCardholderBillingAddress<'a> { - /// City, district, suburb, town, or village. - pub city: &'a str, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - pub country: &'a str, - /// Address line 1 (e.g., street, PO Box, or company name). - pub line1: &'a str, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - pub postal_code: &'a str, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateIssuingCardholderBillingAddress<'a> { - pub fn new(city: &'a str, country: &'a str, line1: &'a str, postal_code: &'a str) -> Self { - Self { city, country, line1, line2: None, postal_code, state: None } - } -} -/// Additional information about a `company` cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderCompany<'a> { - /// The entity's business ID number. - #[serde(skip_serializing_if = "Option::is_none")] - pub tax_id: Option<&'a str>, -} -impl<'a> UpdateIssuingCardholderCompany<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Additional information about an `individual` cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderIndividual<'a> { - /// Information related to the card_issuing program for this cardholder. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_issuing: Option>, - /// The date of birth of this cardholder. Cardholders must be older than 13 years old. - #[serde(skip_serializing_if = "Option::is_none")] - pub dob: Option, - /// The first name of this cardholder. - /// Required before activating Cards. - /// This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. - #[serde(skip_serializing_if = "Option::is_none")] - pub first_name: Option<&'a str>, - /// The last name of this cardholder. - /// Required before activating Cards. - /// This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. - #[serde(skip_serializing_if = "Option::is_none")] - pub last_name: Option<&'a str>, - /// Government-issued ID document for this cardholder. - #[serde(skip_serializing_if = "Option::is_none")] - pub verification: Option>, -} -impl<'a> UpdateIssuingCardholderIndividual<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Information related to the card_issuing program for this cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderIndividualCardIssuing<'a> { - /// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). - #[serde(skip_serializing_if = "Option::is_none")] - pub user_terms_acceptance: - Option>, -} -impl<'a> UpdateIssuingCardholderIndividualCardIssuing<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderIndividualCardIssuingUserTermsAcceptance<'a> { - /// The Unix timestamp marking when the cardholder accepted the Authorized User Terms. - /// Required for Celtic Spend Card users. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the cardholder accepted the Authorized User Terms. - /// Required for Celtic Spend Card users. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the cardholder accepted the Authorized User Terms. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdateIssuingCardholderIndividualCardIssuingUserTermsAcceptance<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The date of birth of this cardholder. Cardholders must be older than 13 years old. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateIssuingCardholderIndividualDob { - /// The day of birth, between 1 and 31. - pub day: i64, - /// The month of birth, between 1 and 12. - pub month: i64, - /// The four-digit year of birth. - pub year: i64, -} -impl UpdateIssuingCardholderIndividualDob { - pub fn new(day: i64, month: i64, year: i64) -> Self { - Self { day, month, year } - } -} -/// Government-issued ID document for this cardholder. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderIndividualVerification<'a> { - /// An identifying document, either a passport or local ID card. - #[serde(skip_serializing_if = "Option::is_none")] - pub document: Option>, -} -impl<'a> UpdateIssuingCardholderIndividualVerification<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An identifying document, either a passport or local ID card. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingCardholderIndividualVerificationDocument<'a> { - /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - #[serde(skip_serializing_if = "Option::is_none")] - pub back: Option<&'a str>, - /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. - #[serde(skip_serializing_if = "Option::is_none")] - pub front: Option<&'a str>, -} -impl<'a> UpdateIssuingCardholderIndividualVerificationDocument<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The cardholder’s preferred locales (languages), ordered by preference. -/// Locales can be `de`, `en`, `es`, `fr`, or `it`. -/// This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIssuingCardholderPreferredLocales { - De, - En, - Es, - Fr, - It, -} -impl UpdateIssuingCardholderPreferredLocales { - pub fn as_str(self) -> &'static str { - use UpdateIssuingCardholderPreferredLocales::*; - match self { - De => "de", - En => "en", - Es => "es", - Fr => "fr", - It => "it", - } - } -} - -impl std::str::FromStr for UpdateIssuingCardholderPreferredLocales { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateIssuingCardholderPreferredLocales::*; - match s { - "de" => Ok(De), - "en" => Ok(En), - "es" => Ok(Es), - "fr" => Ok(Fr), - "it" => Ok(It), - _ => Err(()), - } - } -} -impl AsRef for UpdateIssuingCardholderPreferredLocales { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateIssuingCardholderPreferredLocales { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateIssuingCardholderPreferredLocales { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateIssuingCardholderPreferredLocales { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -7279,3 +6700,142 @@ impl<'a> UpdateIssuingCardholder<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct RequiredAddress<'a> { + /// City, district, suburb, town, or village. + pub city: &'a str, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + pub country: &'a str, + /// Address line 1 (e.g., street, PO Box, or company name). + pub line1: &'a str, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + pub postal_code: &'a str, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> RequiredAddress<'a> { + pub fn new(city: &'a str, country: &'a str, line1: &'a str, postal_code: &'a str) -> Self { + Self { city, country, line1, line2: None, postal_code, state: None } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CompanyParam<'a> { + /// The entity's business ID number. + #[serde(skip_serializing_if = "Option::is_none")] + pub tax_id: Option<&'a str>, +} +impl<'a> CompanyParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct TermsAcceptanceParam<'a> { + /// The Unix timestamp marking when the cardholder accepted the Authorized User Terms. + /// Required for Celtic Spend Card users. + #[serde(skip_serializing_if = "Option::is_none")] + pub date: Option, + /// The IP address from which the cardholder accepted the Authorized User Terms. + /// Required for Celtic Spend Card users. + #[serde(skip_serializing_if = "Option::is_none")] + pub ip: Option<&'a str>, + /// The user agent of the browser from which the cardholder accepted the Authorized User Terms. + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option<&'a str>, +} +impl<'a> TermsAcceptanceParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct DateOfBirthSpecs { + /// The day of birth, between 1 and 31. + pub day: i64, + /// The month of birth, between 1 and 12. + pub month: i64, + /// The four-digit year of birth. + pub year: i64, +} +impl DateOfBirthSpecs { + pub fn new(day: i64, month: i64, year: i64) -> Self { + Self { day, month, year } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonVerificationDocumentParam<'a> { + /// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + #[serde(skip_serializing_if = "Option::is_none")] + pub back: Option<&'a str>, + /// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`. + #[serde(skip_serializing_if = "Option::is_none")] + pub front: Option<&'a str>, +} +impl<'a> PersonVerificationDocumentParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct BillingSpecs<'a> { + /// The cardholder’s billing address. + pub address: RequiredAddress<'a>, +} +impl<'a> BillingSpecs<'a> { + pub fn new(address: RequiredAddress<'a>) -> Self { + Self { address } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CardIssuingParam<'a> { + /// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). + #[serde(skip_serializing_if = "Option::is_none")] + pub user_terms_acceptance: Option>, +} +impl<'a> CardIssuingParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct PersonVerificationParam<'a> { + /// An identifying document, either a passport or local ID card. + #[serde(skip_serializing_if = "Option::is_none")] + pub document: Option>, +} +impl<'a> PersonVerificationParam<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct IndividualParam<'a> { + /// Information related to the card_issuing program for this cardholder. + #[serde(skip_serializing_if = "Option::is_none")] + pub card_issuing: Option>, + /// The date of birth of this cardholder. Cardholders must be older than 13 years old. + #[serde(skip_serializing_if = "Option::is_none")] + pub dob: Option, + /// The first name of this cardholder. + /// Required before activating Cards. + /// This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. + #[serde(skip_serializing_if = "Option::is_none")] + pub first_name: Option<&'a str>, + /// The last name of this cardholder. + /// Required before activating Cards. + /// This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters. + #[serde(skip_serializing_if = "Option::is_none")] + pub last_name: Option<&'a str>, + /// Government-issued ID document for this cardholder. + #[serde(skip_serializing_if = "Option::is_none")] + pub verification: Option>, +} +impl<'a> IndividualParam<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_issuing/src/issuing_dispute/requests.rs b/generated/stripe_issuing/src/issuing_dispute/requests.rs index d0c1cba4a..4bf5f5cbc 100644 --- a/generated/stripe_issuing/src/issuing_dispute/requests.rs +++ b/generated/stripe_issuing/src/issuing_dispute/requests.rs @@ -22,7 +22,7 @@ pub struct ListIssuingDispute<'a> { pub starting_after: Option<&'a str>, /// Select Issuing disputes with the given status. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// Select the Issuing dispute for the given transaction. #[serde(skip_serializing_if = "Option::is_none")] pub transaction: Option<&'a str>, @@ -32,66 +32,6 @@ impl<'a> ListIssuingDispute<'a> { Self::default() } } -/// Select Issuing disputes with the given status. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingDisputeStatus { - Expired, - Lost, - Submitted, - Unsubmitted, - Won, -} -impl ListIssuingDisputeStatus { - pub fn as_str(self) -> &'static str { - use ListIssuingDisputeStatus::*; - match self { - Expired => "expired", - Lost => "lost", - Submitted => "submitted", - Unsubmitted => "unsubmitted", - Won => "won", - } - } -} - -impl std::str::FromStr for ListIssuingDisputeStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingDisputeStatus::*; - match s { - "expired" => Ok(Expired), - "lost" => Ok(Lost), - "submitted" => Ok(Submitted), - "unsubmitted" => Ok(Unsubmitted), - "won" => Ok(Won), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingDisputeStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingDisputeStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingDisputeStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingDisputeStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIssuingDispute<'a> { /// Returns a list of Issuing `Dispute` objects. /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. @@ -146,10 +86,10 @@ pub struct CreateIssuingDisputeEvidence<'a> { pub canceled: Option>, /// Evidence provided when `reason` is 'duplicate'. #[serde(skip_serializing_if = "Option::is_none")] - pub duplicate: Option>, + pub duplicate: Option>, /// Evidence provided when `reason` is 'fraudulent'. #[serde(skip_serializing_if = "Option::is_none")] - pub fraudulent: Option>, + pub fraudulent: Option>, /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] pub merchandise_not_as_described: @@ -165,7 +105,7 @@ pub struct CreateIssuingDisputeEvidence<'a> { pub reason: Option, /// Evidence provided when `reason` is 'service_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] - pub service_not_as_described: Option>, + pub service_not_as_described: Option>, } impl<'a> CreateIssuingDisputeEvidence<'a> { pub fn new() -> Self { @@ -313,49 +253,6 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceCanceledReturnStatus { serializer.serialize_str(self.as_str()) } } -/// Evidence provided when `reason` is 'duplicate'. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceDuplicate<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_documentation: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the card statement showing that the product had already been paid for. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_statement: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the receipt showing that the product had been paid for in cash. - #[serde(skip_serializing_if = "Option::is_none")] - pub cash_receipt: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Image of the front and back of the check that was used to pay for the product. - #[serde(skip_serializing_if = "Option::is_none")] - pub check_image: Option<&'a str>, - /// Explanation of why the cardholder is disputing this transaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub explanation: Option<&'a str>, - /// Transaction (e.g., ipi_...) that the disputed transaction is a duplicate of. - /// Of the two or more transactions that are copies of each other, this is original undisputed one. - #[serde(skip_serializing_if = "Option::is_none")] - pub original_transaction: Option<&'a str>, -} -impl<'a> CreateIssuingDisputeEvidenceDuplicate<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Evidence provided when `reason` is 'fraudulent'. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceFraudulent<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_documentation: Option<&'a str>, - /// Explanation of why the cardholder is disputing this transaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub explanation: Option<&'a str>, -} -impl<'a> CreateIssuingDisputeEvidenceFraudulent<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { @@ -647,30 +544,6 @@ impl serde::Serialize for CreateIssuingDisputeEvidenceReason { serializer.serialize_str(self.as_str()) } } -/// Evidence provided when `reason` is 'service_not_as_described'. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateIssuingDisputeEvidenceServiceNotAsDescribed<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_documentation: Option<&'a str>, - /// Date when order was canceled. - #[serde(skip_serializing_if = "Option::is_none")] - pub canceled_at: Option, - /// Reason for canceling the order. - #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: Option<&'a str>, - /// Explanation of why the cardholder is disputing this transaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub explanation: Option<&'a str>, - /// Date when the product was received. - #[serde(skip_serializing_if = "Option::is_none")] - pub received_at: Option, -} -impl<'a> CreateIssuingDisputeEvidenceServiceNotAsDescribed<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Params for disputes related to Treasury FinancialAccounts #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreateIssuingDisputeTreasury<'a> { @@ -722,10 +595,10 @@ pub struct UpdateIssuingDisputeEvidence<'a> { pub canceled: Option>, /// Evidence provided when `reason` is 'duplicate'. #[serde(skip_serializing_if = "Option::is_none")] - pub duplicate: Option>, + pub duplicate: Option>, /// Evidence provided when `reason` is 'fraudulent'. #[serde(skip_serializing_if = "Option::is_none")] - pub fraudulent: Option>, + pub fraudulent: Option>, /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] pub merchandise_not_as_described: @@ -741,7 +614,7 @@ pub struct UpdateIssuingDisputeEvidence<'a> { pub reason: Option, /// Evidence provided when `reason` is 'service_not_as_described'. #[serde(skip_serializing_if = "Option::is_none")] - pub service_not_as_described: Option>, + pub service_not_as_described: Option>, } impl<'a> UpdateIssuingDisputeEvidence<'a> { pub fn new() -> Self { @@ -889,49 +762,6 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceCanceledReturnStatus { serializer.serialize_str(self.as_str()) } } -/// Evidence provided when `reason` is 'duplicate'. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceDuplicate<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_documentation: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the card statement showing that the product had already been paid for. - #[serde(skip_serializing_if = "Option::is_none")] - pub card_statement: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the receipt showing that the product had been paid for in cash. - #[serde(skip_serializing_if = "Option::is_none")] - pub cash_receipt: Option<&'a str>, - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Image of the front and back of the check that was used to pay for the product. - #[serde(skip_serializing_if = "Option::is_none")] - pub check_image: Option<&'a str>, - /// Explanation of why the cardholder is disputing this transaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub explanation: Option<&'a str>, - /// Transaction (e.g., ipi_...) that the disputed transaction is a duplicate of. - /// Of the two or more transactions that are copies of each other, this is original undisputed one. - #[serde(skip_serializing_if = "Option::is_none")] - pub original_transaction: Option<&'a str>, -} -impl<'a> UpdateIssuingDisputeEvidenceDuplicate<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Evidence provided when `reason` is 'fraudulent'. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceFraudulent<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_documentation: Option<&'a str>, - /// Explanation of why the cardholder is disputing this transaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub explanation: Option<&'a str>, -} -impl<'a> UpdateIssuingDisputeEvidenceFraudulent<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Evidence provided when `reason` is 'merchandise_not_as_described'. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdateIssuingDisputeEvidenceMerchandiseNotAsDescribed<'a> { @@ -1223,30 +1053,6 @@ impl serde::Serialize for UpdateIssuingDisputeEvidenceReason { serializer.serialize_str(self.as_str()) } } -/// Evidence provided when `reason` is 'service_not_as_described'. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateIssuingDisputeEvidenceServiceNotAsDescribed<'a> { - /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_documentation: Option<&'a str>, - /// Date when order was canceled. - #[serde(skip_serializing_if = "Option::is_none")] - pub canceled_at: Option, - /// Reason for canceling the order. - #[serde(skip_serializing_if = "Option::is_none")] - pub cancellation_reason: Option<&'a str>, - /// Explanation of why the cardholder is disputing this transaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub explanation: Option<&'a str>, - /// Date when the product was received. - #[serde(skip_serializing_if = "Option::is_none")] - pub received_at: Option, -} -impl<'a> UpdateIssuingDisputeEvidenceServiceNotAsDescribed<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> UpdateIssuingDispute<'a> { /// Updates the specified Issuing `Dispute` object by setting the values of the parameters passed. /// Any parameters not provided will be left unchanged. @@ -1313,3 +1119,67 @@ impl<'a> SubmitIssuingDispute<'a> { ) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct Duplicate<'a> { + /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_documentation: Option<&'a str>, + /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the card statement showing that the product had already been paid for. + #[serde(skip_serializing_if = "Option::is_none")] + pub card_statement: Option<&'a str>, + /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Copy of the receipt showing that the product had been paid for in cash. + #[serde(skip_serializing_if = "Option::is_none")] + pub cash_receipt: Option<&'a str>, + /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Image of the front and back of the check that was used to pay for the product. + #[serde(skip_serializing_if = "Option::is_none")] + pub check_image: Option<&'a str>, + /// Explanation of why the cardholder is disputing this transaction. + #[serde(skip_serializing_if = "Option::is_none")] + pub explanation: Option<&'a str>, + /// Transaction (e.g., ipi_...) that the disputed transaction is a duplicate of. + /// Of the two or more transactions that are copies of each other, this is original undisputed one. + #[serde(skip_serializing_if = "Option::is_none")] + pub original_transaction: Option<&'a str>, +} +impl<'a> Duplicate<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct Fraudulent<'a> { + /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_documentation: Option<&'a str>, + /// Explanation of why the cardholder is disputing this transaction. + #[serde(skip_serializing_if = "Option::is_none")] + pub explanation: Option<&'a str>, +} +impl<'a> Fraudulent<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ServiceNotAsDescribed<'a> { + /// (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_documentation: Option<&'a str>, + /// Date when order was canceled. + #[serde(skip_serializing_if = "Option::is_none")] + pub canceled_at: Option, + /// Reason for canceling the order. + #[serde(skip_serializing_if = "Option::is_none")] + pub cancellation_reason: Option<&'a str>, + /// Explanation of why the cardholder is disputing this transaction. + #[serde(skip_serializing_if = "Option::is_none")] + pub explanation: Option<&'a str>, + /// Date when the product was received. + #[serde(skip_serializing_if = "Option::is_none")] + pub received_at: Option, +} +impl<'a> ServiceNotAsDescribed<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_issuing/src/issuing_token/requests.rs b/generated/stripe_issuing/src/issuing_token/requests.rs index 7bd67c34a..151130859 100644 --- a/generated/stripe_issuing/src/issuing_token/requests.rs +++ b/generated/stripe_issuing/src/issuing_token/requests.rs @@ -24,7 +24,7 @@ pub struct ListIssuingToken<'a> { pub starting_after: Option<&'a str>, /// Select Issuing tokens with the given status. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListIssuingToken<'a> { pub fn new(card: &'a str) -> Self { @@ -39,63 +39,6 @@ impl<'a> ListIssuingToken<'a> { } } } -/// Select Issuing tokens with the given status. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingTokenStatus { - Active, - Deleted, - Requested, - Suspended, -} -impl ListIssuingTokenStatus { - pub fn as_str(self) -> &'static str { - use ListIssuingTokenStatus::*; - match self { - Active => "active", - Deleted => "deleted", - Requested => "requested", - Suspended => "suspended", - } - } -} - -impl std::str::FromStr for ListIssuingTokenStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingTokenStatus::*; - match s { - "active" => Ok(Active), - "deleted" => Ok(Deleted), - "requested" => Ok(Requested), - "suspended" => Ok(Suspended), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingTokenStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingTokenStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingTokenStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingTokenStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIssuingToken<'a> { /// Lists all Issuing `Token` objects for a given card. pub fn send( diff --git a/generated/stripe_issuing/src/issuing_transaction/requests.rs b/generated/stripe_issuing/src/issuing_transaction/requests.rs index 5474a7ac8..fbf237101 100644 --- a/generated/stripe_issuing/src/issuing_transaction/requests.rs +++ b/generated/stripe_issuing/src/issuing_transaction/requests.rs @@ -29,64 +29,13 @@ pub struct ListIssuingTransaction<'a> { /// Only return transactions that have the given type. One of `capture` or `refund`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> ListIssuingTransaction<'a> { pub fn new() -> Self { Self::default() } } -/// Only return transactions that have the given type. One of `capture` or `refund`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIssuingTransactionType { - Capture, - Refund, -} -impl ListIssuingTransactionType { - pub fn as_str(self) -> &'static str { - use ListIssuingTransactionType::*; - match self { - Capture => "capture", - Refund => "refund", - } - } -} - -impl std::str::FromStr for ListIssuingTransactionType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIssuingTransactionType::*; - match s { - "capture" => Ok(Capture), - "refund" => Ok(Refund), - _ => Err(()), - } - } -} -impl AsRef for ListIssuingTransactionType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIssuingTransactionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIssuingTransactionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIssuingTransactionType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIssuingTransaction<'a> { /// Returns a list of Issuing `Transaction` objects. /// The objects are sorted in descending order by creation date, with the most recently created object appearing first. @@ -1257,16 +1206,16 @@ impl serde::Serialize for CreateForceCaptureIssuingTransactionMerchantDataCatego pub struct CreateForceCaptureIssuingTransactionPurchaseDetails<'a> { /// Information about the flight that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub flight: Option>, + pub flight: Option>, /// Information about fuel that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub fuel: Option>, /// Information about lodging that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub lodging: Option, + pub lodging: Option, /// The line items in the purchase. #[serde(skip_serializing_if = "Option::is_none")] - pub receipt: Option<&'a [CreateForceCaptureIssuingTransactionPurchaseDetailsReceipt<'a>]>, + pub receipt: Option<&'a [ReceiptSpecs<'a>]>, /// A merchant-specific order number. #[serde(skip_serializing_if = "Option::is_none")] pub reference: Option<&'a str>, @@ -1276,58 +1225,6 @@ impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetails<'a> { Self::default() } } -/// Information about the flight that was purchased with this transaction. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsFlight<'a> { - /// The time that the flight departed. - #[serde(skip_serializing_if = "Option::is_none")] - pub departure_at: Option, - /// The name of the passenger. - #[serde(skip_serializing_if = "Option::is_none")] - pub passenger_name: Option<&'a str>, - /// Whether the ticket is refundable. - #[serde(skip_serializing_if = "Option::is_none")] - pub refundable: Option, - /// The legs of the trip. - #[serde(skip_serializing_if = "Option::is_none")] - pub segments: - Option<&'a [CreateForceCaptureIssuingTransactionPurchaseDetailsFlightSegments<'a>]>, - /// The travel agency that issued the ticket. - #[serde(skip_serializing_if = "Option::is_none")] - pub travel_agency: Option<&'a str>, -} -impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetailsFlight<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The legs of the trip. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsFlightSegments<'a> { - /// The three-letter IATA airport code of the flight's destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub arrival_airport_code: Option<&'a str>, - /// The airline carrier code. - #[serde(skip_serializing_if = "Option::is_none")] - pub carrier: Option<&'a str>, - /// The three-letter IATA airport code that the flight departed from. - #[serde(skip_serializing_if = "Option::is_none")] - pub departure_airport_code: Option<&'a str>, - /// The flight number. - #[serde(skip_serializing_if = "Option::is_none")] - pub flight_number: Option<&'a str>, - /// The flight's service class. - #[serde(skip_serializing_if = "Option::is_none")] - pub service_class: Option<&'a str>, - /// Whether a stopover is allowed on this flight. - #[serde(skip_serializing_if = "Option::is_none")] - pub stopover_allowed: Option, -} -impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetailsFlightSegments<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Information about fuel that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsFuel<'a> { @@ -1463,38 +1360,6 @@ impl serde::Serialize for CreateForceCaptureIssuingTransactionPurchaseDetailsFue serializer.serialize_str(self.as_str()) } } -/// Information about lodging that was purchased with this transaction. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsLodging { - /// The time of checking into the lodging. - #[serde(skip_serializing_if = "Option::is_none")] - pub check_in_at: Option, - /// The number of nights stayed at the lodging. - #[serde(skip_serializing_if = "Option::is_none")] - pub nights: Option, -} -impl CreateForceCaptureIssuingTransactionPurchaseDetailsLodging { - pub fn new() -> Self { - Self::default() - } -} -/// The line items in the purchase. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateForceCaptureIssuingTransactionPurchaseDetailsReceipt<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub quantity: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub total: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub unit_cost: Option, -} -impl<'a> CreateForceCaptureIssuingTransactionPurchaseDetailsReceipt<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> CreateForceCaptureIssuingTransaction<'a> { /// Allows the user to capture an arbitrary amount, also known as a forced capture. pub fn send( @@ -2610,16 +2475,16 @@ impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionMerchantDataCate pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetails<'a> { /// Information about the flight that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub flight: Option>, + pub flight: Option>, /// Information about fuel that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] pub fuel: Option>, /// Information about lodging that was purchased with this transaction. #[serde(skip_serializing_if = "Option::is_none")] - pub lodging: Option, + pub lodging: Option, /// The line items in the purchase. #[serde(skip_serializing_if = "Option::is_none")] - pub receipt: Option<&'a [CreateUnlinkedRefundIssuingTransactionPurchaseDetailsReceipt<'a>]>, + pub receipt: Option<&'a [ReceiptSpecs<'a>]>, /// A merchant-specific order number. #[serde(skip_serializing_if = "Option::is_none")] pub reference: Option<&'a str>, @@ -2629,58 +2494,6 @@ impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetails<'a> { Self::default() } } -/// Information about the flight that was purchased with this transaction. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFlight<'a> { - /// The time that the flight departed. - #[serde(skip_serializing_if = "Option::is_none")] - pub departure_at: Option, - /// The name of the passenger. - #[serde(skip_serializing_if = "Option::is_none")] - pub passenger_name: Option<&'a str>, - /// Whether the ticket is refundable. - #[serde(skip_serializing_if = "Option::is_none")] - pub refundable: Option, - /// The legs of the trip. - #[serde(skip_serializing_if = "Option::is_none")] - pub segments: - Option<&'a [CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFlightSegments<'a>]>, - /// The travel agency that issued the ticket. - #[serde(skip_serializing_if = "Option::is_none")] - pub travel_agency: Option<&'a str>, -} -impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFlight<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// The legs of the trip. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFlightSegments<'a> { - /// The three-letter IATA airport code of the flight's destination. - #[serde(skip_serializing_if = "Option::is_none")] - pub arrival_airport_code: Option<&'a str>, - /// The airline carrier code. - #[serde(skip_serializing_if = "Option::is_none")] - pub carrier: Option<&'a str>, - /// The three-letter IATA airport code that the flight departed from. - #[serde(skip_serializing_if = "Option::is_none")] - pub departure_airport_code: Option<&'a str>, - /// The flight number. - #[serde(skip_serializing_if = "Option::is_none")] - pub flight_number: Option<&'a str>, - /// The flight's service class. - #[serde(skip_serializing_if = "Option::is_none")] - pub service_class: Option<&'a str>, - /// Whether a stopover is allowed on this flight. - #[serde(skip_serializing_if = "Option::is_none")] - pub stopover_allowed: Option, -} -impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFlightSegments<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Information about fuel that was purchased with this transaction. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsFuel<'a> { @@ -2816,38 +2629,6 @@ impl serde::Serialize for CreateUnlinkedRefundIssuingTransactionPurchaseDetailsF serializer.serialize_str(self.as_str()) } } -/// Information about lodging that was purchased with this transaction. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsLodging { - /// The time of checking into the lodging. - #[serde(skip_serializing_if = "Option::is_none")] - pub check_in_at: Option, - /// The number of nights stayed at the lodging. - #[serde(skip_serializing_if = "Option::is_none")] - pub nights: Option, -} -impl CreateUnlinkedRefundIssuingTransactionPurchaseDetailsLodging { - pub fn new() -> Self { - Self::default() - } -} -/// The line items in the purchase. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateUnlinkedRefundIssuingTransactionPurchaseDetailsReceipt<'a> { - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub quantity: Option<&'a str>, - #[serde(skip_serializing_if = "Option::is_none")] - pub total: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub unit_cost: Option, -} -impl<'a> CreateUnlinkedRefundIssuingTransactionPurchaseDetailsReceipt<'a> { - pub fn new() -> Self { - Self::default() - } -} impl<'a> CreateUnlinkedRefundIssuingTransaction<'a> { /// Allows the user to refund an arbitrary amount, also known as a unlinked refund. pub fn send( @@ -2890,3 +2671,82 @@ impl<'a> RefundIssuingTransaction<'a> { ) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct FlightSegmentSpecs<'a> { + /// The three-letter IATA airport code of the flight's destination. + #[serde(skip_serializing_if = "Option::is_none")] + pub arrival_airport_code: Option<&'a str>, + /// The airline carrier code. + #[serde(skip_serializing_if = "Option::is_none")] + pub carrier: Option<&'a str>, + /// The three-letter IATA airport code that the flight departed from. + #[serde(skip_serializing_if = "Option::is_none")] + pub departure_airport_code: Option<&'a str>, + /// The flight number. + #[serde(skip_serializing_if = "Option::is_none")] + pub flight_number: Option<&'a str>, + /// The flight's service class. + #[serde(skip_serializing_if = "Option::is_none")] + pub service_class: Option<&'a str>, + /// Whether a stopover is allowed on this flight. + #[serde(skip_serializing_if = "Option::is_none")] + pub stopover_allowed: Option, +} +impl<'a> FlightSegmentSpecs<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct LodgingSpecs { + /// The time of checking into the lodging. + #[serde(skip_serializing_if = "Option::is_none")] + pub check_in_at: Option, + /// The number of nights stayed at the lodging. + #[serde(skip_serializing_if = "Option::is_none")] + pub nights: Option, +} +impl LodgingSpecs { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct ReceiptSpecs<'a> { + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub quantity: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub total: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub unit_cost: Option, +} +impl<'a> ReceiptSpecs<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct FlightSpecs<'a> { + /// The time that the flight departed. + #[serde(skip_serializing_if = "Option::is_none")] + pub departure_at: Option, + /// The name of the passenger. + #[serde(skip_serializing_if = "Option::is_none")] + pub passenger_name: Option<&'a str>, + /// Whether the ticket is refundable. + #[serde(skip_serializing_if = "Option::is_none")] + pub refundable: Option, + /// The legs of the trip. + #[serde(skip_serializing_if = "Option::is_none")] + pub segments: Option<&'a [FlightSegmentSpecs<'a>]>, + /// The travel agency that issued the ticket. + #[serde(skip_serializing_if = "Option::is_none")] + pub travel_agency: Option<&'a str>, +} +impl<'a> FlightSpecs<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_misc/src/financial_connections_session/requests.rs b/generated/stripe_misc/src/financial_connections_session/requests.rs index f730a19c4..5b394f73f 100644 --- a/generated/stripe_misc/src/financial_connections_session/requests.rs +++ b/generated/stripe_misc/src/financial_connections_session/requests.rs @@ -11,10 +11,10 @@ pub struct CreateFinancialConnectionsSession<'a> { /// List of data features that you would like to request access to. /// /// Possible values are `balances`, `transactions`, `ownership`, and `payment_method`. - pub permissions: &'a [CreateFinancialConnectionsSessionPermissions], + pub permissions: &'a [stripe_misc::FinancialConnectionsSessionPermissions], /// List of data features that you would like to retrieve upon account creation. #[serde(skip_serializing_if = "Option::is_none")] - pub prefetch: Option<&'a [CreateFinancialConnectionsSessionPrefetch]>, + pub prefetch: Option<&'a [stripe_misc::FinancialConnectionsSessionPrefetch]>, /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. #[serde(skip_serializing_if = "Option::is_none")] @@ -23,7 +23,7 @@ pub struct CreateFinancialConnectionsSession<'a> { impl<'a> CreateFinancialConnectionsSession<'a> { pub fn new( account_holder: CreateFinancialConnectionsSessionAccountHolder<'a>, - permissions: &'a [CreateFinancialConnectionsSessionPermissions], + permissions: &'a [stripe_misc::FinancialConnectionsSessionPermissions], ) -> Self { Self { account_holder, @@ -117,116 +117,6 @@ impl<'a> CreateFinancialConnectionsSessionFilters<'a> { Self { countries } } } -/// List of data features that you would like to request access to. -/// -/// Possible values are `balances`, `transactions`, `ownership`, and `payment_method`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateFinancialConnectionsSessionPermissions { - Balances, - Ownership, - PaymentMethod, - Transactions, -} -impl CreateFinancialConnectionsSessionPermissions { - pub fn as_str(self) -> &'static str { - use CreateFinancialConnectionsSessionPermissions::*; - match self { - Balances => "balances", - Ownership => "ownership", - PaymentMethod => "payment_method", - Transactions => "transactions", - } - } -} - -impl std::str::FromStr for CreateFinancialConnectionsSessionPermissions { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateFinancialConnectionsSessionPermissions::*; - match s { - "balances" => Ok(Balances), - "ownership" => Ok(Ownership), - "payment_method" => Ok(PaymentMethod), - "transactions" => Ok(Transactions), - _ => Err(()), - } - } -} -impl AsRef for CreateFinancialConnectionsSessionPermissions { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateFinancialConnectionsSessionPermissions { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateFinancialConnectionsSessionPermissions { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateFinancialConnectionsSessionPermissions { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// List of data features that you would like to retrieve upon account creation. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateFinancialConnectionsSessionPrefetch { - Balances, - Ownership, -} -impl CreateFinancialConnectionsSessionPrefetch { - pub fn as_str(self) -> &'static str { - use CreateFinancialConnectionsSessionPrefetch::*; - match self { - Balances => "balances", - Ownership => "ownership", - } - } -} - -impl std::str::FromStr for CreateFinancialConnectionsSessionPrefetch { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateFinancialConnectionsSessionPrefetch::*; - match s { - "balances" => Ok(Balances), - "ownership" => Ok(Ownership), - _ => Err(()), - } - } -} -impl AsRef for CreateFinancialConnectionsSessionPrefetch { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateFinancialConnectionsSessionPrefetch { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateFinancialConnectionsSessionPrefetch { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateFinancialConnectionsSessionPrefetch { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateFinancialConnectionsSession<'a> { /// To launch the Financial Connections authorization flow, create a `Session`. /// The session’s `client_secret` can be used to launch the flow using Stripe.js. diff --git a/generated/stripe_misc/src/financial_connections_session/types.rs b/generated/stripe_misc/src/financial_connections_session/types.rs index d51b556b3..a288cd2e8 100644 --- a/generated/stripe_misc/src/financial_connections_session/types.rs +++ b/generated/stripe_misc/src/financial_connections_session/types.rs @@ -16,15 +16,21 @@ pub struct FinancialConnectionsSession { /// 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, /// Permissions requested for accounts collected during this session. - pub permissions: Vec, + pub permissions: Vec, /// Data features requested to be retrieved upon account creation. - pub prefetch: Option>, + pub prefetch: Option>, /// For webview integrations only. /// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app. #[serde(skip_serializing_if = "Option::is_none")] pub return_url: Option, } -/// Permissions requested for accounts collected during this session. +impl stripe_types::Object for FinancialConnectionsSession { + type Id = stripe_misc::FinancialConnectionsSessionId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(FinancialConnectionsSessionId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum FinancialConnectionsSessionPermissions { Balances, @@ -90,7 +96,6 @@ impl<'de> serde::Deserialize<'de> for FinancialConnectionsSessionPermissions { }) } } -/// Data features requested to be retrieved upon account creation. #[derive(Copy, Clone, Eq, PartialEq)] pub enum FinancialConnectionsSessionPrefetch { Balances, @@ -150,10 +155,3 @@ impl<'de> serde::Deserialize<'de> for FinancialConnectionsSessionPrefetch { }) } } -impl stripe_types::Object for FinancialConnectionsSession { - type Id = stripe_misc::FinancialConnectionsSessionId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(FinancialConnectionsSessionId); diff --git a/generated/stripe_misc/src/identity_verification_report/requests.rs b/generated/stripe_misc/src/identity_verification_report/requests.rs index c173fd2ab..cf16cae8c 100644 --- a/generated/stripe_misc/src/identity_verification_report/requests.rs +++ b/generated/stripe_misc/src/identity_verification_report/requests.rs @@ -43,7 +43,7 @@ pub struct ListIdentityVerificationReport<'a> { /// Only return VerificationReports of this type #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// Only return VerificationReports created by this VerificationSession ID. /// It is allowed to provide a VerificationIntent ID. #[serde(skip_serializing_if = "Option::is_none")] @@ -54,57 +54,6 @@ impl<'a> ListIdentityVerificationReport<'a> { Self::default() } } -/// Only return VerificationReports of this type -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIdentityVerificationReportType { - Document, - IdNumber, -} -impl ListIdentityVerificationReportType { - pub fn as_str(self) -> &'static str { - use ListIdentityVerificationReportType::*; - match self { - Document => "document", - IdNumber => "id_number", - } - } -} - -impl std::str::FromStr for ListIdentityVerificationReportType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIdentityVerificationReportType::*; - match s { - "document" => Ok(Document), - "id_number" => Ok(IdNumber), - _ => Err(()), - } - } -} -impl AsRef for ListIdentityVerificationReportType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIdentityVerificationReportType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIdentityVerificationReportType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIdentityVerificationReportType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIdentityVerificationReport<'a> { /// List all verification reports. pub fn send( diff --git a/generated/stripe_misc/src/identity_verification_report/types.rs b/generated/stripe_misc/src/identity_verification_report/types.rs index 209aeec9b..efc91562c 100644 --- a/generated/stripe_misc/src/identity_verification_report/types.rs +++ b/generated/stripe_misc/src/identity_verification_report/types.rs @@ -30,11 +30,17 @@ pub struct IdentityVerificationReport { /// Type of report. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// ID of the VerificationSession that created this report. pub verification_session: Option, } -/// Type of report. +impl stripe_types::Object for IdentityVerificationReport { + type Id = stripe_misc::IdentityVerificationReportId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IdentityVerificationReportId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum IdentityVerificationReportType { Document, @@ -94,10 +100,3 @@ impl<'de> serde::Deserialize<'de> for IdentityVerificationReportType { }) } } -impl stripe_types::Object for IdentityVerificationReport { - type Id = stripe_misc::IdentityVerificationReportId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(IdentityVerificationReportId); diff --git a/generated/stripe_misc/src/identity_verification_session/requests.rs b/generated/stripe_misc/src/identity_verification_session/requests.rs index 0f3293139..2b93b6dcd 100644 --- a/generated/stripe_misc/src/identity_verification_session/requests.rs +++ b/generated/stripe_misc/src/identity_verification_session/requests.rs @@ -17,10 +17,10 @@ pub struct CreateIdentityVerificationSession<'a> { pub return_url: Option<&'a str>, /// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. #[serde(rename = "type")] - pub type_: CreateIdentityVerificationSessionType, + pub type_: stripe_misc::IdentityVerificationSessionType, } impl<'a> CreateIdentityVerificationSession<'a> { - pub fn new(type_: CreateIdentityVerificationSessionType) -> Self { + pub fn new(type_: stripe_misc::IdentityVerificationSessionType) -> Self { Self { expand: None, metadata: None, options: None, return_url: None, type_ } } } @@ -114,57 +114,6 @@ impl serde::Serialize for CreateIdentityVerificationSessionOptionsDocumentAllowe serializer.serialize_str(self.as_str()) } } -/// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateIdentityVerificationSessionType { - Document, - IdNumber, -} -impl CreateIdentityVerificationSessionType { - pub fn as_str(self) -> &'static str { - use CreateIdentityVerificationSessionType::*; - match self { - Document => "document", - IdNumber => "id_number", - } - } -} - -impl std::str::FromStr for CreateIdentityVerificationSessionType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateIdentityVerificationSessionType::*; - match s { - "document" => Ok(Document), - "id_number" => Ok(IdNumber), - _ => Err(()), - } - } -} -impl AsRef for CreateIdentityVerificationSessionType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateIdentityVerificationSessionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateIdentityVerificationSessionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateIdentityVerificationSessionType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateIdentityVerificationSession<'a> { /// Creates a VerificationSession object. /// @@ -228,71 +177,13 @@ pub struct ListIdentityVerificationSession<'a> { /// Only return VerificationSessions with this status. /// [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListIdentityVerificationSession<'a> { pub fn new() -> Self { Self::default() } } -/// Only return VerificationSessions with this status. -/// [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListIdentityVerificationSessionStatus { - Canceled, - Processing, - RequiresInput, - Verified, -} -impl ListIdentityVerificationSessionStatus { - pub fn as_str(self) -> &'static str { - use ListIdentityVerificationSessionStatus::*; - match self { - Canceled => "canceled", - Processing => "processing", - RequiresInput => "requires_input", - Verified => "verified", - } - } -} - -impl std::str::FromStr for ListIdentityVerificationSessionStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListIdentityVerificationSessionStatus::*; - match s { - "canceled" => Ok(Canceled), - "processing" => Ok(Processing), - "requires_input" => Ok(RequiresInput), - "verified" => Ok(Verified), - _ => Err(()), - } - } -} -impl AsRef for ListIdentityVerificationSessionStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListIdentityVerificationSessionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListIdentityVerificationSessionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListIdentityVerificationSessionStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListIdentityVerificationSession<'a> { /// Returns a list of VerificationSessions pub fn send( @@ -397,7 +288,7 @@ pub struct UpdateIdentityVerificationSession<'a> { /// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> UpdateIdentityVerificationSession<'a> { pub fn new() -> Self { @@ -494,57 +385,6 @@ impl serde::Serialize for UpdateIdentityVerificationSessionOptionsDocumentAllowe serializer.serialize_str(self.as_str()) } } -/// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateIdentityVerificationSessionType { - Document, - IdNumber, -} -impl UpdateIdentityVerificationSessionType { - pub fn as_str(self) -> &'static str { - use UpdateIdentityVerificationSessionType::*; - match self { - Document => "document", - IdNumber => "id_number", - } - } -} - -impl std::str::FromStr for UpdateIdentityVerificationSessionType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateIdentityVerificationSessionType::*; - match s { - "document" => Ok(Document), - "id_number" => Ok(IdNumber), - _ => Err(()), - } - } -} -impl AsRef for UpdateIdentityVerificationSessionType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateIdentityVerificationSessionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateIdentityVerificationSessionType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateIdentityVerificationSessionType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> UpdateIdentityVerificationSession<'a> { /// Updates a VerificationSession object. /// diff --git a/generated/stripe_misc/src/identity_verification_session/types.rs b/generated/stripe_misc/src/identity_verification_session/types.rs index c4243f3ea..12efafd0c 100644 --- a/generated/stripe_misc/src/identity_verification_session/types.rs +++ b/generated/stripe_misc/src/identity_verification_session/types.rs @@ -41,10 +41,10 @@ pub struct IdentityVerificationSession { 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, + pub status: stripe_misc::IdentityVerificationSessionStatus, /// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. #[serde(rename = "type")] - pub type_: Option, + pub type_: Option, /// 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. @@ -53,8 +53,13 @@ pub struct IdentityVerificationSession { /// The user’s verified data. pub verified_outputs: Option, } -/// Status of this VerificationSession. -/// [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). +impl stripe_types::Object for IdentityVerificationSession { + type Id = stripe_misc::IdentityVerificationSessionId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IdentityVerificationSessionId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum IdentityVerificationSessionStatus { Canceled, @@ -120,7 +125,6 @@ impl<'de> serde::Deserialize<'de> for IdentityVerificationSessionStatus { }) } } -/// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed. #[derive(Copy, Clone, Eq, PartialEq)] pub enum IdentityVerificationSessionType { Document, @@ -180,10 +184,3 @@ impl<'de> serde::Deserialize<'de> for IdentityVerificationSessionType { }) } } -impl stripe_types::Object for IdentityVerificationSession { - type Id = stripe_misc::IdentityVerificationSessionId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(IdentityVerificationSessionId); diff --git a/generated/stripe_misc/src/tax_product_registrations_resource_country_options_europe.rs b/generated/stripe_misc/src/tax_product_registrations_resource_country_options_europe.rs index 9a0c7b93c..a259a803b 100644 --- a/generated/stripe_misc/src/tax_product_registrations_resource_country_options_europe.rs +++ b/generated/stripe_misc/src/tax_product_registrations_resource_country_options_europe.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct TaxProductRegistrationsResourceCountryOptionsEurope { #[serde(skip_serializing_if = "Option::is_none")] pub standard: Option, diff --git a/generated/stripe_payment/src/payment_link/requests.rs b/generated/stripe_payment/src/payment_link/requests.rs index 968d1b538..4cd4cf81c 100644 --- a/generated/stripe_payment/src/payment_link/requests.rs +++ b/generated/stripe_payment/src/payment_link/requests.rs @@ -123,10 +123,10 @@ pub struct CreatePaymentLink<'a> { pub application_fee_percent: Option, /// Configuration for automatic tax collection. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Configuration for collecting the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_address_collection: Option, + pub billing_address_collection: Option, /// Configure fields to gather active consent from customers. #[serde(skip_serializing_if = "Option::is_none")] pub consent_collection: Option, @@ -140,7 +140,7 @@ pub struct CreatePaymentLink<'a> { pub custom_fields: Option<&'a [CreatePaymentLinkCustomFields<'a>]>, /// Display additional text for your customers using custom text. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_text: Option>, + pub custom_text: Option>, /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[serde(skip_serializing_if = "Option::is_none")] pub customer_creation: Option, @@ -178,7 +178,7 @@ pub struct CreatePaymentLink<'a> { /// The list of payment method types that customers can use. /// If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://stripe.com/docs/payments/payment-methods/integration-options#payment-method-product-support)). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [CreatePaymentLinkPaymentMethodTypes]>, + pub payment_method_types: Option<&'a [stripe_shared::PaymentLinkPaymentMethodTypes]>, /// Controls phone number collection settings during checkout. /// /// We recommend that you review your privacy policy and check with your legal contacts. @@ -193,7 +193,7 @@ pub struct CreatePaymentLink<'a> { /// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. /// Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`). #[serde(skip_serializing_if = "Option::is_none")] - pub submit_type: Option, + pub submit_type: Option, /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. #[serde(skip_serializing_if = "Option::is_none")] @@ -242,10 +242,10 @@ impl<'a> CreatePaymentLink<'a> { pub struct CreatePaymentLinkAfterCompletion<'a> { /// Configuration when `type=hosted_confirmation`. #[serde(skip_serializing_if = "Option::is_none")] - pub hosted_confirmation: Option>, + pub hosted_confirmation: Option>, /// Configuration when `type=redirect`. #[serde(skip_serializing_if = "Option::is_none")] - pub redirect: Option>, + pub redirect: Option>, /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[serde(rename = "type")] pub type_: CreatePaymentLinkAfterCompletionType, @@ -255,30 +255,6 @@ impl<'a> CreatePaymentLinkAfterCompletion<'a> { Self { hosted_confirmation: None, redirect: None, type_ } } } -/// Configuration when `type=hosted_confirmation`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkAfterCompletionHostedConfirmation<'a> { - /// A custom message to display to the customer after the purchase is complete. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom_message: Option<&'a str>, -} -impl<'a> CreatePaymentLinkAfterCompletionHostedConfirmation<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration when `type=redirect`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkAfterCompletionRedirect<'a> { - /// The URL the customer will be redirected to after the purchase is complete. - /// You can embed `{CHECKOUT_SESSION_ID}` into the URL to have the `id` of the completed [checkout session](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-id) included. - pub url: &'a str, -} -impl<'a> CreatePaymentLinkAfterCompletionRedirect<'a> { - pub fn new(url: &'a str) -> Self { - Self { url } - } -} /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum CreatePaymentLinkAfterCompletionType { @@ -330,68 +306,6 @@ impl serde::Serialize for CreatePaymentLinkAfterCompletionType { serializer.serialize_str(self.as_str()) } } -/// Configuration for automatic tax collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkAutomaticTax { - /// If `true`, tax will be calculated automatically using the customer's location. - pub enabled: bool, -} -impl CreatePaymentLinkAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Configuration for collecting the customer's billing address. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkBillingAddressCollection { - Auto, - Required, -} -impl CreatePaymentLinkBillingAddressCollection { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkBillingAddressCollection::*; - match self { - Auto => "auto", - Required => "required", - } - } -} - -impl std::str::FromStr for CreatePaymentLinkBillingAddressCollection { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkBillingAddressCollection::*; - match s { - "auto" => Ok(Auto), - "required" => Ok(Required), - _ => Err(()), - } - } -} -impl AsRef for CreatePaymentLinkBillingAddressCollection { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePaymentLinkBillingAddressCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentLinkBillingAddressCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentLinkBillingAddressCollection { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Configure fields to gather active consent from customers. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePaymentLinkConsentCollection { @@ -523,7 +437,7 @@ impl serde::Serialize for CreatePaymentLinkConsentCollectionTermsOfService { pub struct CreatePaymentLinkCustomFields<'a> { /// Configuration for `type=dropdown` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub dropdown: Option>, + pub dropdown: Option>, /// String of your choice that your integration can use to reconcile this field. /// Must be unique to this field, alphanumeric, and up to 200 characters. pub key: &'a str, @@ -552,31 +466,6 @@ impl<'a> CreatePaymentLinkCustomFields<'a> { Self { dropdown: None, key, label, numeric: None, optional: None, text: None, type_ } } } -/// Configuration for `type=dropdown` fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomFieldsDropdown<'a> { - /// The options available for the customer to select. Up to 200 options allowed. - pub options: &'a [CreatePaymentLinkCustomFieldsDropdownOptions<'a>], -} -impl<'a> CreatePaymentLinkCustomFieldsDropdown<'a> { - pub fn new(options: &'a [CreatePaymentLinkCustomFieldsDropdownOptions<'a>]) -> Self { - Self { options } - } -} -/// The options available for the customer to select. Up to 200 options allowed. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomFieldsDropdownOptions<'a> { - /// The label for the option, displayed to the customer. Up to 100 characters. - pub label: &'a str, - /// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. - /// Must be unique to this option, alphanumeric, and up to 100 characters. - pub value: &'a str, -} -impl<'a> CreatePaymentLinkCustomFieldsDropdownOptions<'a> { - pub fn new(label: &'a str, value: &'a str) -> Self { - Self { label, value } - } -} /// The label for the field, displayed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreatePaymentLinkCustomFieldsLabel<'a> { @@ -723,58 +612,6 @@ impl serde::Serialize for CreatePaymentLinkCustomFieldsType { serializer.serialize_str(self.as_str()) } } -/// Display additional text for your customers using custom text. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentLinkCustomText<'a> { - /// Custom text that should be displayed alongside shipping address collection. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_address: Option>, - /// Custom text that should be displayed alongside the payment confirmation button. - #[serde(skip_serializing_if = "Option::is_none")] - pub submit: Option>, - /// Custom text that should be displayed in place of the default terms of service agreement text. - #[serde(skip_serializing_if = "Option::is_none")] - pub terms_of_service_acceptance: - Option>, -} -impl<'a> CreatePaymentLinkCustomText<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Custom text that should be displayed alongside shipping address collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomTextShippingAddress<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> CreatePaymentLinkCustomTextShippingAddress<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} -/// Custom text that should be displayed alongside the payment confirmation button. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomTextSubmit<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> CreatePaymentLinkCustomTextSubmit<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} -/// Custom text that should be displayed in place of the default terms of service agreement text. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkCustomTextTermsOfServiceAcceptance<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> CreatePaymentLinkCustomTextTermsOfServiceAcceptance<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[derive(Copy, Clone, Eq, PartialEq)] pub enum CreatePaymentLinkCustomerCreation { @@ -848,7 +685,7 @@ pub struct CreatePaymentLinkInvoiceCreationInvoiceData<'a> { pub account_tax_ids: Option<&'a [&'a str]>, /// Default custom fields to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [CreatePaymentLinkInvoiceCreationInvoiceDataCustomFields<'a>]>, + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -870,19 +707,6 @@ impl<'a> CreatePaymentLinkInvoiceCreationInvoiceData<'a> { Self::default() } } -/// Default custom fields to be displayed on invoices for this customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkInvoiceCreationInvoiceDataCustomFields<'a> { - /// The name of the custom field. This may be up to 30 characters. - pub name: &'a str, - /// The value of the custom field. This may be up to 30 characters. - pub value: &'a str, -} -impl<'a> CreatePaymentLinkInvoiceCreationInvoiceDataCustomFields<'a> { - pub fn new(name: &'a str, value: &'a str) -> Self { - Self { name, value } - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { @@ -968,7 +792,7 @@ impl serde::Serialize pub struct CreatePaymentLinkLineItems<'a> { /// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout. #[serde(skip_serializing_if = "Option::is_none")] - pub adjustable_quantity: Option, + pub adjustable_quantity: Option, /// The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. pub price: &'a str, /// The quantity of the line item being purchased. @@ -979,27 +803,6 @@ impl<'a> CreatePaymentLinkLineItems<'a> { Self { adjustable_quantity: None, price, quantity } } } -/// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePaymentLinkLineItemsAdjustableQuantity { - /// Set to true if the quantity can be adjusted to any non-negative Integer. - pub enabled: bool, - /// The maximum quantity the customer can purchase. - /// By default this value is 99. - /// You can specify a value up to 999. - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// The minimum quantity the customer can purchase. - /// By default this value is 0. - /// If there is only one item in the cart then that item's quantity cannot go down to 0. - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, -} -impl CreatePaymentLinkLineItemsAdjustableQuantity { - pub fn new(enabled: bool) -> Self { - Self { enabled, maximum: None, minimum: None } - } -} /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreatePaymentLinkPaymentIntentData<'a> { @@ -1215,140 +1018,6 @@ impl serde::Serialize for CreatePaymentLinkPaymentMethodCollection { serializer.serialize_str(self.as_str()) } } -/// The list of payment method types that customers can use. -/// If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://stripe.com/docs/payments/payment-methods/integration-options#payment-method-product-support)). -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreatePaymentLinkPaymentMethodTypes { - Affirm, - AfterpayClearpay, - Alipay, - AuBecsDebit, - BacsDebit, - Bancontact, - Blik, - Boleto, - Card, - Cashapp, - Eps, - Fpx, - Giropay, - Grabpay, - Ideal, - Klarna, - Konbini, - Link, - Oxxo, - P24, - Paynow, - Paypal, - Pix, - Promptpay, - SepaDebit, - Sofort, - UsBankAccount, - WechatPay, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl CreatePaymentLinkPaymentMethodTypes { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkPaymentMethodTypes::*; - match self { - Affirm => "affirm", - AfterpayClearpay => "afterpay_clearpay", - Alipay => "alipay", - AuBecsDebit => "au_becs_debit", - BacsDebit => "bacs_debit", - Bancontact => "bancontact", - Blik => "blik", - Boleto => "boleto", - Card => "card", - Cashapp => "cashapp", - Eps => "eps", - Fpx => "fpx", - Giropay => "giropay", - Grabpay => "grabpay", - Ideal => "ideal", - Klarna => "klarna", - Konbini => "konbini", - Link => "link", - Oxxo => "oxxo", - P24 => "p24", - Paynow => "paynow", - Paypal => "paypal", - Pix => "pix", - Promptpay => "promptpay", - SepaDebit => "sepa_debit", - Sofort => "sofort", - UsBankAccount => "us_bank_account", - WechatPay => "wechat_pay", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for CreatePaymentLinkPaymentMethodTypes { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkPaymentMethodTypes::*; - match s { - "affirm" => Ok(Affirm), - "afterpay_clearpay" => Ok(AfterpayClearpay), - "alipay" => Ok(Alipay), - "au_becs_debit" => Ok(AuBecsDebit), - "bacs_debit" => Ok(BacsDebit), - "bancontact" => Ok(Bancontact), - "blik" => Ok(Blik), - "boleto" => Ok(Boleto), - "card" => Ok(Card), - "cashapp" => Ok(Cashapp), - "eps" => Ok(Eps), - "fpx" => Ok(Fpx), - "giropay" => Ok(Giropay), - "grabpay" => Ok(Grabpay), - "ideal" => Ok(Ideal), - "klarna" => Ok(Klarna), - "konbini" => Ok(Konbini), - "link" => Ok(Link), - "oxxo" => Ok(Oxxo), - "p24" => Ok(P24), - "paynow" => Ok(Paynow), - "paypal" => Ok(Paypal), - "pix" => Ok(Pix), - "promptpay" => Ok(Promptpay), - "sepa_debit" => Ok(SepaDebit), - "sofort" => Ok(Sofort), - "us_bank_account" => Ok(UsBankAccount), - "wechat_pay" => Ok(WechatPay), - _ => Err(()), - } - } -} -impl AsRef for CreatePaymentLinkPaymentMethodTypes { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePaymentLinkPaymentMethodTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentLinkPaymentMethodTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentLinkPaymentMethodTypes { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Controls phone number collection settings during checkout. /// /// We recommend that you review your privacy policy and check with your legal contacts. @@ -2151,64 +1820,6 @@ impl<'a> CreatePaymentLinkShippingOptions<'a> { Self::default() } } -/// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. -/// Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePaymentLinkSubmitType { - Auto, - Book, - Donate, - Pay, -} -impl CreatePaymentLinkSubmitType { - pub fn as_str(self) -> &'static str { - use CreatePaymentLinkSubmitType::*; - match self { - Auto => "auto", - Book => "book", - Donate => "donate", - Pay => "pay", - } - } -} - -impl std::str::FromStr for CreatePaymentLinkSubmitType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePaymentLinkSubmitType::*; - match s { - "auto" => Ok(Auto), - "book" => Ok(Book), - "donate" => Ok(Donate), - "pay" => Ok(Pay), - _ => Err(()), - } - } -} -impl AsRef for CreatePaymentLinkSubmitType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePaymentLinkSubmitType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePaymentLinkSubmitType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePaymentLinkSubmitType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -2280,17 +1891,17 @@ pub struct UpdatePaymentLink<'a> { pub allow_promotion_codes: Option, /// Configuration for automatic tax collection. #[serde(skip_serializing_if = "Option::is_none")] - pub automatic_tax: Option, + pub automatic_tax: Option, /// Configuration for collecting the customer's billing address. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_address_collection: Option, + pub billing_address_collection: Option, /// Collect additional information from your customer using custom fields. /// Up to 2 fields are supported. #[serde(skip_serializing_if = "Option::is_none")] pub custom_fields: Option<&'a [UpdatePaymentLinkCustomFields<'a>]>, /// Display additional text for your customers using custom text. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_text: Option>, + pub custom_text: Option>, /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[serde(skip_serializing_if = "Option::is_none")] pub customer_creation: Option, @@ -2326,7 +1937,7 @@ pub struct UpdatePaymentLink<'a> { /// The list of payment method types that customers can use. /// Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). #[serde(skip_serializing_if = "Option::is_none")] - pub payment_method_types: Option<&'a [UpdatePaymentLinkPaymentMethodTypes]>, + pub payment_method_types: Option<&'a [stripe_shared::PaymentLinkPaymentMethodTypes]>, /// Configuration for collecting the customer's shipping address. #[serde(skip_serializing_if = "Option::is_none")] pub shipping_address_collection: Option>, @@ -2345,10 +1956,10 @@ impl<'a> UpdatePaymentLink<'a> { pub struct UpdatePaymentLinkAfterCompletion<'a> { /// Configuration when `type=hosted_confirmation`. #[serde(skip_serializing_if = "Option::is_none")] - pub hosted_confirmation: Option>, + pub hosted_confirmation: Option>, /// Configuration when `type=redirect`. #[serde(skip_serializing_if = "Option::is_none")] - pub redirect: Option>, + pub redirect: Option>, /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[serde(rename = "type")] pub type_: UpdatePaymentLinkAfterCompletionType, @@ -2358,30 +1969,6 @@ impl<'a> UpdatePaymentLinkAfterCompletion<'a> { Self { hosted_confirmation: None, redirect: None, type_ } } } -/// Configuration when `type=hosted_confirmation`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkAfterCompletionHostedConfirmation<'a> { - /// A custom message to display to the customer after the purchase is complete. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom_message: Option<&'a str>, -} -impl<'a> UpdatePaymentLinkAfterCompletionHostedConfirmation<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Configuration when `type=redirect`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkAfterCompletionRedirect<'a> { - /// The URL the customer will be redirected to after the purchase is complete. - /// You can embed `{CHECKOUT_SESSION_ID}` into the URL to have the `id` of the completed [checkout session](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-id) included. - pub url: &'a str, -} -impl<'a> UpdatePaymentLinkAfterCompletionRedirect<'a> { - pub fn new(url: &'a str) -> Self { - Self { url } - } -} /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum UpdatePaymentLinkAfterCompletionType { @@ -2433,75 +2020,13 @@ impl serde::Serialize for UpdatePaymentLinkAfterCompletionType { serializer.serialize_str(self.as_str()) } } -/// Configuration for automatic tax collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkAutomaticTax { - /// If `true`, tax will be calculated automatically using the customer's location. - pub enabled: bool, -} -impl UpdatePaymentLinkAutomaticTax { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Configuration for collecting the customer's billing address. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePaymentLinkBillingAddressCollection { - Auto, - Required, -} -impl UpdatePaymentLinkBillingAddressCollection { - pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkBillingAddressCollection::*; - match self { - Auto => "auto", - Required => "required", - } - } -} - -impl std::str::FromStr for UpdatePaymentLinkBillingAddressCollection { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentLinkBillingAddressCollection::*; - match s { - "auto" => Ok(Auto), - "required" => Ok(Required), - _ => Err(()), - } - } -} -impl AsRef for UpdatePaymentLinkBillingAddressCollection { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdatePaymentLinkBillingAddressCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentLinkBillingAddressCollection { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentLinkBillingAddressCollection { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Collect additional information from your customer using custom fields. /// Up to 2 fields are supported. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdatePaymentLinkCustomFields<'a> { /// Configuration for `type=dropdown` fields. #[serde(skip_serializing_if = "Option::is_none")] - pub dropdown: Option>, + pub dropdown: Option>, /// String of your choice that your integration can use to reconcile this field. /// Must be unique to this field, alphanumeric, and up to 200 characters. pub key: &'a str, @@ -2530,31 +2055,6 @@ impl<'a> UpdatePaymentLinkCustomFields<'a> { Self { dropdown: None, key, label, numeric: None, optional: None, text: None, type_ } } } -/// Configuration for `type=dropdown` fields. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomFieldsDropdown<'a> { - /// The options available for the customer to select. Up to 200 options allowed. - pub options: &'a [UpdatePaymentLinkCustomFieldsDropdownOptions<'a>], -} -impl<'a> UpdatePaymentLinkCustomFieldsDropdown<'a> { - pub fn new(options: &'a [UpdatePaymentLinkCustomFieldsDropdownOptions<'a>]) -> Self { - Self { options } - } -} -/// The options available for the customer to select. Up to 200 options allowed. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomFieldsDropdownOptions<'a> { - /// The label for the option, displayed to the customer. Up to 100 characters. - pub label: &'a str, - /// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. - /// Must be unique to this option, alphanumeric, and up to 100 characters. - pub value: &'a str, -} -impl<'a> UpdatePaymentLinkCustomFieldsDropdownOptions<'a> { - pub fn new(label: &'a str, value: &'a str) -> Self { - Self { label, value } - } -} /// The label for the field, displayed to the customer. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdatePaymentLinkCustomFieldsLabel<'a> { @@ -2701,58 +2201,6 @@ impl serde::Serialize for UpdatePaymentLinkCustomFieldsType { serializer.serialize_str(self.as_str()) } } -/// Display additional text for your customers using custom text. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentLinkCustomText<'a> { - /// Custom text that should be displayed alongside shipping address collection. - #[serde(skip_serializing_if = "Option::is_none")] - pub shipping_address: Option>, - /// Custom text that should be displayed alongside the payment confirmation button. - #[serde(skip_serializing_if = "Option::is_none")] - pub submit: Option>, - /// Custom text that should be displayed in place of the default terms of service agreement text. - #[serde(skip_serializing_if = "Option::is_none")] - pub terms_of_service_acceptance: - Option>, -} -impl<'a> UpdatePaymentLinkCustomText<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Custom text that should be displayed alongside shipping address collection. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomTextShippingAddress<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> UpdatePaymentLinkCustomTextShippingAddress<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} -/// Custom text that should be displayed alongside the payment confirmation button. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomTextSubmit<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> UpdatePaymentLinkCustomTextSubmit<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} -/// Custom text that should be displayed in place of the default terms of service agreement text. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkCustomTextTermsOfServiceAcceptance<'a> { - /// Text may be up to 1200 characters in length. - pub message: &'a str, -} -impl<'a> UpdatePaymentLinkCustomTextTermsOfServiceAcceptance<'a> { - pub fn new(message: &'a str) -> Self { - Self { message } - } -} /// Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers). #[derive(Copy, Clone, Eq, PartialEq)] pub enum UpdatePaymentLinkCustomerCreation { @@ -2826,7 +2274,7 @@ pub struct UpdatePaymentLinkInvoiceCreationInvoiceData<'a> { pub account_tax_ids: Option<&'a [&'a str]>, /// Default custom fields to be displayed on invoices for this customer. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_fields: Option<&'a [UpdatePaymentLinkInvoiceCreationInvoiceDataCustomFields<'a>]>, + pub custom_fields: Option<&'a [CustomFieldParams<'a>]>, /// An arbitrary string attached to the object. Often useful for displaying to users. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option<&'a str>, @@ -2848,19 +2296,6 @@ impl<'a> UpdatePaymentLinkInvoiceCreationInvoiceData<'a> { Self::default() } } -/// Default custom fields to be displayed on invoices for this customer. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkInvoiceCreationInvoiceDataCustomFields<'a> { - /// The name of the custom field. This may be up to 30 characters. - pub name: &'a str, - /// The value of the custom field. This may be up to 30 characters. - pub value: &'a str, -} -impl<'a> UpdatePaymentLinkInvoiceCreationInvoiceDataCustomFields<'a> { - pub fn new(name: &'a str, value: &'a str) -> Self { - Self { name, value } - } -} /// Default options for invoice PDF rendering for this customer. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions { @@ -2946,7 +2381,7 @@ impl serde::Serialize pub struct UpdatePaymentLinkLineItems<'a> { /// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout. #[serde(skip_serializing_if = "Option::is_none")] - pub adjustable_quantity: Option, + pub adjustable_quantity: Option, /// The ID of an existing line item on the payment link. pub id: &'a str, /// The quantity of the line item being purchased. @@ -2958,27 +2393,6 @@ impl<'a> UpdatePaymentLinkLineItems<'a> { Self { adjustable_quantity: None, id, quantity: None } } } -/// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePaymentLinkLineItemsAdjustableQuantity { - /// Set to true if the quantity can be adjusted to any non-negative Integer. - pub enabled: bool, - /// The maximum quantity the customer can purchase. - /// By default this value is 99. - /// You can specify a value up to 999. - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// The minimum quantity the customer can purchase. - /// By default this value is 0. - /// If there is only one item in the cart then that item's quantity cannot go down to 0. - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, -} -impl UpdatePaymentLinkLineItemsAdjustableQuantity { - pub fn new(enabled: bool) -> Self { - Self { enabled, maximum: None, minimum: None } - } -} /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePaymentLinkPaymentIntentData<'a> { @@ -3061,140 +2475,6 @@ impl serde::Serialize for UpdatePaymentLinkPaymentMethodCollection { serializer.serialize_str(self.as_str()) } } -/// The list of payment method types that customers can use. -/// Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum UpdatePaymentLinkPaymentMethodTypes { - Affirm, - AfterpayClearpay, - Alipay, - AuBecsDebit, - BacsDebit, - Bancontact, - Blik, - Boleto, - Card, - Cashapp, - Eps, - Fpx, - Giropay, - Grabpay, - Ideal, - Klarna, - Konbini, - Link, - Oxxo, - P24, - Paynow, - Paypal, - Pix, - Promptpay, - SepaDebit, - Sofort, - UsBankAccount, - WechatPay, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl UpdatePaymentLinkPaymentMethodTypes { - pub fn as_str(self) -> &'static str { - use UpdatePaymentLinkPaymentMethodTypes::*; - match self { - Affirm => "affirm", - AfterpayClearpay => "afterpay_clearpay", - Alipay => "alipay", - AuBecsDebit => "au_becs_debit", - BacsDebit => "bacs_debit", - Bancontact => "bancontact", - Blik => "blik", - Boleto => "boleto", - Card => "card", - Cashapp => "cashapp", - Eps => "eps", - Fpx => "fpx", - Giropay => "giropay", - Grabpay => "grabpay", - Ideal => "ideal", - Klarna => "klarna", - Konbini => "konbini", - Link => "link", - Oxxo => "oxxo", - P24 => "p24", - Paynow => "paynow", - Paypal => "paypal", - Pix => "pix", - Promptpay => "promptpay", - SepaDebit => "sepa_debit", - Sofort => "sofort", - UsBankAccount => "us_bank_account", - WechatPay => "wechat_pay", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for UpdatePaymentLinkPaymentMethodTypes { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePaymentLinkPaymentMethodTypes::*; - match s { - "affirm" => Ok(Affirm), - "afterpay_clearpay" => Ok(AfterpayClearpay), - "alipay" => Ok(Alipay), - "au_becs_debit" => Ok(AuBecsDebit), - "bacs_debit" => Ok(BacsDebit), - "bancontact" => Ok(Bancontact), - "blik" => Ok(Blik), - "boleto" => Ok(Boleto), - "card" => Ok(Card), - "cashapp" => Ok(Cashapp), - "eps" => Ok(Eps), - "fpx" => Ok(Fpx), - "giropay" => Ok(Giropay), - "grabpay" => Ok(Grabpay), - "ideal" => Ok(Ideal), - "klarna" => Ok(Klarna), - "konbini" => Ok(Konbini), - "link" => Ok(Link), - "oxxo" => Ok(Oxxo), - "p24" => Ok(P24), - "paynow" => Ok(Paynow), - "paypal" => Ok(Paypal), - "pix" => Ok(Pix), - "promptpay" => Ok(Promptpay), - "sepa_debit" => Ok(SepaDebit), - "sofort" => Ok(Sofort), - "us_bank_account" => Ok(UsBankAccount), - "wechat_pay" => Ok(WechatPay), - _ => Err(()), - } - } -} -impl AsRef for UpdatePaymentLinkPaymentMethodTypes { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdatePaymentLinkPaymentMethodTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePaymentLinkPaymentMethodTypes { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePaymentLinkPaymentMethodTypes { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Configuration for collecting the customer's shipping address. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct UpdatePaymentLinkShippingAddressCollection<'a> { @@ -3997,3 +3277,117 @@ impl<'a> UpdatePaymentLink<'a> { client.send_form(&format!("/payment_links/{payment_link}"), self, http_types::Method::Post) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct AfterCompletionConfirmationPageParams<'a> { + /// A custom message to display to the customer after the purchase is complete. + #[serde(skip_serializing_if = "Option::is_none")] + pub custom_message: Option<&'a str>, +} +impl<'a> AfterCompletionConfirmationPageParams<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AfterCompletionRedirectParams<'a> { + /// The URL the customer will be redirected to after the purchase is complete. + /// You can embed `{CHECKOUT_SESSION_ID}` into the URL to have the `id` of the completed [checkout session](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-id) included. + pub url: &'a str, +} +impl<'a> AfterCompletionRedirectParams<'a> { + pub fn new(url: &'a str) -> Self { + Self { url } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AutomaticTaxParams { + /// If `true`, tax will be calculated automatically using the customer's location. + pub enabled: bool, +} +impl AutomaticTaxParams { + pub fn new(enabled: bool) -> Self { + Self { enabled } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomFieldOptionParam<'a> { + /// The label for the option, displayed to the customer. Up to 100 characters. + pub label: &'a str, + /// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. + /// Must be unique to this option, alphanumeric, and up to 100 characters. + pub value: &'a str, +} +impl<'a> CustomFieldOptionParam<'a> { + pub fn new(label: &'a str, value: &'a str) -> Self { + Self { label, value } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomTextPositionParam<'a> { + /// Text may be up to 1200 characters in length. + pub message: &'a str, +} +impl<'a> CustomTextPositionParam<'a> { + pub fn new(message: &'a str) -> Self { + Self { message } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomFieldParams<'a> { + /// The name of the custom field. This may be up to 30 characters. + pub name: &'a str, + /// The value of the custom field. This may be up to 30 characters. + pub value: &'a str, +} +impl<'a> CustomFieldParams<'a> { + pub fn new(name: &'a str, value: &'a str) -> Self { + Self { name, value } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct AdjustableQuantityParams { + /// Set to true if the quantity can be adjusted to any non-negative Integer. + pub enabled: bool, + /// The maximum quantity the customer can purchase. + /// By default this value is 99. + /// You can specify a value up to 999. + #[serde(skip_serializing_if = "Option::is_none")] + pub maximum: Option, + /// The minimum quantity the customer can purchase. + /// By default this value is 0. + /// If there is only one item in the cart then that item's quantity cannot go down to 0. + #[serde(skip_serializing_if = "Option::is_none")] + pub minimum: Option, +} +impl AdjustableQuantityParams { + pub fn new(enabled: bool) -> Self { + Self { enabled, maximum: None, minimum: None } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomFieldDropdownParam<'a> { + /// The options available for the customer to select. Up to 200 options allowed. + pub options: &'a [CustomFieldOptionParam<'a>], +} +impl<'a> CustomFieldDropdownParam<'a> { + pub fn new(options: &'a [CustomFieldOptionParam<'a>]) -> Self { + Self { options } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CustomTextParam<'a> { + /// Custom text that should be displayed alongside shipping address collection. + #[serde(skip_serializing_if = "Option::is_none")] + pub shipping_address: Option>, + /// Custom text that should be displayed alongside the payment confirmation button. + #[serde(skip_serializing_if = "Option::is_none")] + pub submit: Option>, + /// Custom text that should be displayed in place of the default terms of service agreement text. + #[serde(skip_serializing_if = "Option::is_none")] + pub terms_of_service_acceptance: Option>, +} +impl<'a> CustomTextParam<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_payment/src/payment_method/requests.rs b/generated/stripe_payment/src/payment_method/requests.rs index d59ffd8ab..12a0418ad 100644 --- a/generated/stripe_payment/src/payment_method/requests.rs +++ b/generated/stripe_payment/src/payment_method/requests.rs @@ -23,7 +23,7 @@ pub struct CreatePaymentMethod<'a> { pub bancontact: Option<&'a serde_json::Value>, /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method. #[serde(skip_serializing_if = "Option::is_none")] pub blik: Option<&'a serde_json::Value>, @@ -183,54 +183,6 @@ impl<'a> CreatePaymentMethodBacsDebit<'a> { Self::default() } } -/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodBillingDetails<'a> { - /// Billing address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Billing phone number (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> CreatePaymentMethodBillingDetails<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Billing address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePaymentMethodBillingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreatePaymentMethodBillingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreatePaymentMethodBoleto<'a> { @@ -1287,7 +1239,7 @@ impl<'a> RetrievePaymentMethod<'a> { pub struct UpdatePaymentMethod<'a> { /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_details: Option>, + pub billing_details: Option>, /// If this is a `card` PaymentMethod, this hash contains the user's card details. #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, @@ -1312,54 +1264,6 @@ impl<'a> UpdatePaymentMethod<'a> { Self::default() } } -/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodBillingDetails<'a> { - /// Billing address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Billing phone number (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpdatePaymentMethodBillingDetails<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Billing address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePaymentMethodBillingDetailsAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdatePaymentMethodBillingDetailsAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// If this is a `card` PaymentMethod, this hash contains the user's card details. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct UpdatePaymentMethodCard { @@ -1714,3 +1618,49 @@ impl<'a> DetachPaymentMethod<'a> { ) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BillingDetailsAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> BillingDetailsAddress<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct BillingDetailsInnerParams<'a> { + /// Billing address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// Email address. + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<&'a str>, + /// Full name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// Billing phone number (including extension). + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, +} +impl<'a> BillingDetailsInnerParams<'a> { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_payment/src/payment_method_config_resource_payment_method_properties.rs b/generated/stripe_payment/src/payment_method_config_resource_payment_method_properties.rs index 3d0daca42..ef32708bc 100644 --- a/generated/stripe_payment/src/payment_method_config_resource_payment_method_properties.rs +++ b/generated/stripe_payment/src/payment_method_config_resource_payment_method_properties.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodConfigResourcePaymentMethodProperties { /// Whether this payment method may be offered at checkout. /// True if `display_preference` is `on` and the payment method's capability is active. diff --git a/generated/stripe_payment/src/source/requests.rs b/generated/stripe_payment/src/source/requests.rs index cec362bb4..ce7c5efdd 100644 --- a/generated/stripe_payment/src/source/requests.rs +++ b/generated/stripe_payment/src/source/requests.rs @@ -89,7 +89,7 @@ pub struct CreateSource<'a> { pub original_source: Option<&'a str>, /// Information about the owner of the payment instrument that may be used or required by particular source types. #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option>, + pub owner: Option>, /// Optional parameters for the receiver flow. /// Can be set only if the source is a receiver (`flow` is `receiver`). #[serde(skip_serializing_if = "Option::is_none")] @@ -220,11 +220,11 @@ pub struct CreateSourceMandateAcceptance<'a> { /// The parameters required to store a mandate accepted offline. /// Should only be set if `mandate[type]` is `offline`. #[serde(skip_serializing_if = "Option::is_none")] - pub offline: Option>, + pub offline: Option>, /// The parameters required to store a mandate accepted online. /// Should only be set if `mandate[type]` is `online`. #[serde(skip_serializing_if = "Option::is_none")] - pub online: Option>, + pub online: Option>, /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). pub status: CreateSourceMandateAcceptanceStatus, @@ -249,37 +249,6 @@ impl<'a> CreateSourceMandateAcceptance<'a> { } } } -/// The parameters required to store a mandate accepted offline. -/// Should only be set if `mandate[type]` is `offline`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSourceMandateAcceptanceOffline<'a> { - /// An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. - pub contact_email: &'a str, -} -impl<'a> CreateSourceMandateAcceptanceOffline<'a> { - pub fn new(contact_email: &'a str) -> Self { - Self { contact_email } - } -} -/// The parameters required to store a mandate accepted online. -/// Should only be set if `mandate[type]` is `online`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceMandateAcceptanceOnline<'a> { - /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the mandate was accepted or refused by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the mandate was accepted or refused by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> CreateSourceMandateAcceptanceOnline<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). #[derive(Copy, Clone, Eq, PartialEq)] @@ -505,54 +474,6 @@ impl serde::Serialize for CreateSourceMandateNotificationMethod { serializer.serialize_str(self.as_str()) } } -/// Information about the owner of the payment instrument that may be used or required by particular source types. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceOwner<'a> { - /// Owner's address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Owner's email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Owner's full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Owner's phone number. - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> CreateSourceOwner<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Owner's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateSourceOwnerAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateSourceOwnerAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Optional parameters for the receiver flow. /// Can be set only if the source is a receiver (`flow` is `receiver`). #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -647,7 +568,7 @@ pub struct CreateSourceSourceOrder<'a> { /// Shipping address for the order. /// Required if any of the SKUs are for products that have `shippable` set to true. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, } impl<'a> CreateSourceSourceOrder<'a> { pub fn new() -> Self { @@ -735,57 +656,6 @@ impl serde::Serialize for CreateSourceSourceOrderItemsType { serializer.serialize_str(self.as_str()) } } -/// Shipping address for the order. -/// Required if any of the SKUs are for products that have `shippable` set to true. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSourceSourceOrderShipping<'a> { - /// Shipping address. - pub address: CreateSourceSourceOrderShippingAddress<'a>, - /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. - #[serde(skip_serializing_if = "Option::is_none")] - pub carrier: Option<&'a str>, - /// Recipient name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Recipient phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// The tracking number for a physical product, obtained from the delivery service. - /// If multiple tracking numbers were generated for this purchase, please separate them with commas. - #[serde(skip_serializing_if = "Option::is_none")] - pub tracking_number: Option<&'a str>, -} -impl<'a> CreateSourceSourceOrderShipping<'a> { - pub fn new(address: CreateSourceSourceOrderShippingAddress<'a>) -> Self { - Self { address, carrier: None, name: None, phone: None, tracking_number: None } - } -} -/// Shipping address. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateSourceSourceOrderShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - pub line1: &'a str, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> CreateSourceSourceOrderShippingAddress<'a> { - pub fn new(line1: &'a str) -> Self { - Self { city: None, country: None, line1, line2: None, postal_code: None, state: None } - } -} #[derive(Copy, Clone, Eq, PartialEq)] pub enum CreateSourceUsage { Reusable, @@ -861,7 +731,7 @@ pub struct UpdateSource<'a> { pub metadata: Option<&'a std::collections::HashMap>, /// Information about the owner of the payment instrument that may be used or required by particular source types. #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option>, + pub owner: Option>, /// Information about the items and shipping associated with the source. /// Required for transactional credit (for example Klarna) sources before you can charge it. #[serde(skip_serializing_if = "Option::is_none")] @@ -910,11 +780,11 @@ pub struct UpdateSourceMandateAcceptance<'a> { /// The parameters required to store a mandate accepted offline. /// Should only be set if `mandate[type]` is `offline`. #[serde(skip_serializing_if = "Option::is_none")] - pub offline: Option>, + pub offline: Option>, /// The parameters required to store a mandate accepted online. /// Should only be set if `mandate[type]` is `online`. #[serde(skip_serializing_if = "Option::is_none")] - pub online: Option>, + pub online: Option>, /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). pub status: UpdateSourceMandateAcceptanceStatus, @@ -939,37 +809,6 @@ impl<'a> UpdateSourceMandateAcceptance<'a> { } } } -/// The parameters required to store a mandate accepted offline. -/// Should only be set if `mandate[type]` is `offline`. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSourceMandateAcceptanceOffline<'a> { - /// An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. - pub contact_email: &'a str, -} -impl<'a> UpdateSourceMandateAcceptanceOffline<'a> { - pub fn new(contact_email: &'a str) -> Self { - Self { contact_email } - } -} -/// The parameters required to store a mandate accepted online. -/// Should only be set if `mandate[type]` is `online`. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSourceMandateAcceptanceOnline<'a> { - /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub date: Option, - /// The IP address from which the mandate was accepted or refused by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub ip: Option<&'a str>, - /// The user agent of the browser from which the mandate was accepted or refused by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option<&'a str>, -} -impl<'a> UpdateSourceMandateAcceptanceOnline<'a> { - pub fn new() -> Self { - Self::default() - } -} /// The status of the mandate acceptance. /// Either `accepted` (the mandate was accepted) or `refused` (the mandate was refused). #[derive(Copy, Clone, Eq, PartialEq)] @@ -1195,54 +1034,6 @@ impl serde::Serialize for UpdateSourceMandateNotificationMethod { serializer.serialize_str(self.as_str()) } } -/// Information about the owner of the payment instrument that may be used or required by particular source types. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSourceOwner<'a> { - /// Owner's address. - #[serde(skip_serializing_if = "Option::is_none")] - pub address: Option>, - /// Owner's email address. - #[serde(skip_serializing_if = "Option::is_none")] - pub email: Option<&'a str>, - /// Owner's full name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Owner's phone number. - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, -} -impl<'a> UpdateSourceOwner<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Owner's address. -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateSourceOwnerAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - #[serde(skip_serializing_if = "Option::is_none")] - pub line1: Option<&'a str>, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateSourceOwnerAddress<'a> { - pub fn new() -> Self { - Self::default() - } -} /// Information about the items and shipping associated with the source. /// Required for transactional credit (for example Klarna) sources before you can charge it. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] @@ -1253,7 +1044,7 @@ pub struct UpdateSourceSourceOrder<'a> { /// Shipping address for the order. /// Required if any of the SKUs are for products that have `shippable` set to true. #[serde(skip_serializing_if = "Option::is_none")] - pub shipping: Option>, + pub shipping: Option>, } impl<'a> UpdateSourceSourceOrder<'a> { pub fn new() -> Self { @@ -1341,57 +1132,6 @@ impl serde::Serialize for UpdateSourceSourceOrderItemsType { serializer.serialize_str(self.as_str()) } } -/// Shipping address for the order. -/// Required if any of the SKUs are for products that have `shippable` set to true. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSourceSourceOrderShipping<'a> { - /// Shipping address. - pub address: UpdateSourceSourceOrderShippingAddress<'a>, - /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. - #[serde(skip_serializing_if = "Option::is_none")] - pub carrier: Option<&'a str>, - /// Recipient name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option<&'a str>, - /// Recipient phone (including extension). - #[serde(skip_serializing_if = "Option::is_none")] - pub phone: Option<&'a str>, - /// The tracking number for a physical product, obtained from the delivery service. - /// If multiple tracking numbers were generated for this purchase, please separate them with commas. - #[serde(skip_serializing_if = "Option::is_none")] - pub tracking_number: Option<&'a str>, -} -impl<'a> UpdateSourceSourceOrderShipping<'a> { - pub fn new(address: UpdateSourceSourceOrderShippingAddress<'a>) -> Self { - Self { address, carrier: None, name: None, phone: None, tracking_number: None } - } -} -/// Shipping address. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateSourceSourceOrderShippingAddress<'a> { - /// City, district, suburb, town, or village. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option<&'a str>, - /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option<&'a str>, - /// Address line 1 (e.g., street, PO Box, or company name). - pub line1: &'a str, - /// Address line 2 (e.g., apartment, suite, unit, or building). - #[serde(skip_serializing_if = "Option::is_none")] - pub line2: Option<&'a str>, - /// ZIP or postal code. - #[serde(skip_serializing_if = "Option::is_none")] - pub postal_code: Option<&'a str>, - /// State, county, province, or region. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option<&'a str>, -} -impl<'a> UpdateSourceSourceOrderShippingAddress<'a> { - pub fn new(line1: &'a str) -> Self { - Self { city: None, country: None, line1, line2: None, postal_code: None, state: None } - } -} impl<'a> UpdateSource<'a> { /// Updates the specified source by setting the values of the parameters passed. /// Any parameters not provided will be left unchanged. @@ -1474,3 +1214,124 @@ impl<'a> SourceTransactionsSource<'a> { ) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct MandateOfflineAcceptanceParams<'a> { + /// An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. + pub contact_email: &'a str, +} +impl<'a> MandateOfflineAcceptanceParams<'a> { + pub fn new(contact_email: &'a str) -> Self { + Self { contact_email } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct MandateOnlineAcceptanceParams<'a> { + /// The Unix timestamp (in seconds) when the mandate was accepted or refused by the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub date: Option, + /// The IP address from which the mandate was accepted or refused by the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub ip: Option<&'a str>, + /// The user agent of the browser from which the mandate was accepted or refused by the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option<&'a str>, +} +impl<'a> MandateOnlineAcceptanceParams<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct SourceAddress<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + #[serde(skip_serializing_if = "Option::is_none")] + pub line1: Option<&'a str>, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> SourceAddress<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct Address<'a> { + /// City, district, suburb, town, or village. + #[serde(skip_serializing_if = "Option::is_none")] + pub city: Option<&'a str>, + /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + #[serde(skip_serializing_if = "Option::is_none")] + pub country: Option<&'a str>, + /// Address line 1 (e.g., street, PO Box, or company name). + pub line1: &'a str, + /// Address line 2 (e.g., apartment, suite, unit, or building). + #[serde(skip_serializing_if = "Option::is_none")] + pub line2: Option<&'a str>, + /// ZIP or postal code. + #[serde(skip_serializing_if = "Option::is_none")] + pub postal_code: Option<&'a str>, + /// State, county, province, or region. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option<&'a str>, +} +impl<'a> Address<'a> { + pub fn new(line1: &'a str) -> Self { + Self { city: None, country: None, line1, line2: None, postal_code: None, state: None } + } +} +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct Owner<'a> { + /// Owner's address. + #[serde(skip_serializing_if = "Option::is_none")] + pub address: Option>, + /// Owner's email address. + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<&'a str>, + /// Owner's full name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// Owner's phone number. + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, +} +impl<'a> Owner<'a> { + pub fn new() -> Self { + Self::default() + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct OrderShipping<'a> { + /// Shipping address. + pub address: Address<'a>, + /// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc. + #[serde(skip_serializing_if = "Option::is_none")] + pub carrier: Option<&'a str>, + /// Recipient name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<&'a str>, + /// Recipient phone (including extension). + #[serde(skip_serializing_if = "Option::is_none")] + pub phone: Option<&'a str>, + /// The tracking number for a physical product, obtained from the delivery service. + /// If multiple tracking numbers were generated for this purchase, please separate them with commas. + #[serde(skip_serializing_if = "Option::is_none")] + pub tracking_number: Option<&'a str>, +} +impl<'a> OrderShipping<'a> { + pub fn new(address: Address<'a>) -> Self { + Self { address, carrier: None, name: None, phone: None, tracking_number: None } + } +} diff --git a/generated/stripe_product/src/coupon/requests.rs b/generated/stripe_product/src/coupon/requests.rs index ae2cc2fbf..220fddf10 100644 --- a/generated/stripe_product/src/coupon/requests.rs +++ b/generated/stripe_product/src/coupon/requests.rs @@ -54,10 +54,10 @@ pub struct CreateCoupon<'a> { /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] pub currency_options: - Option<&'a std::collections::HashMap>, + Option<&'a std::collections::HashMap>, /// Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`. #[serde(skip_serializing_if = "Option::is_none")] - pub duration: Option, + 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")] pub duration_in_months: Option, @@ -107,72 +107,6 @@ impl<'a> CreateCouponAppliesTo<'a> { Self::default() } } -/// Coupons defined in each available currency option (only supported if `amount_off` is passed). -/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateCouponCurrencyOptions { - /// A positive integer representing the amount to subtract from an invoice total. - pub amount_off: i64, -} -impl CreateCouponCurrencyOptions { - pub fn new(amount_off: i64) -> Self { - Self { amount_off } - } -} -/// Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateCouponDuration { - Forever, - Once, - Repeating, -} -impl CreateCouponDuration { - pub fn as_str(self) -> &'static str { - use CreateCouponDuration::*; - match self { - Forever => "forever", - Once => "once", - Repeating => "repeating", - } - } -} - -impl std::str::FromStr for CreateCouponDuration { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateCouponDuration::*; - match s { - "forever" => Ok(Forever), - "once" => Ok(Once), - "repeating" => Ok(Repeating), - _ => Err(()), - } - } -} -impl AsRef for CreateCouponDuration { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateCouponDuration { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateCouponDuration { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateCouponDuration { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateCoupon<'a> { /// You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. /// Coupon creation is also accessible via the API if you need to create coupons on the fly. @@ -211,7 +145,7 @@ pub struct UpdateCoupon<'a> { /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] pub currency_options: - Option<&'a std::collections::HashMap>, + Option<&'a std::collections::HashMap>, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -231,18 +165,6 @@ impl<'a> UpdateCoupon<'a> { Self::default() } } -/// Coupons defined in each available currency option (only supported if the coupon is amount-based). -/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateCouponCurrencyOptions { - /// A positive integer representing the amount to subtract from an invoice total. - pub amount_off: i64, -} -impl UpdateCouponCurrencyOptions { - pub fn new(amount_off: i64) -> Self { - Self { amount_off } - } -} impl<'a> UpdateCoupon<'a> { /// Updates the metadata of a coupon. /// Other coupon details (currency, duration, amount_off) are, by design, not editable. @@ -273,3 +195,13 @@ impl DeleteCoupon { client.send_form(&format!("/coupons/{coupon}"), self, http_types::Method::Delete) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CurrencyOption { + /// A positive integer representing the amount to subtract from an invoice total. + pub amount_off: i64, +} +impl CurrencyOption { + pub fn new(amount_off: i64) -> Self { + Self { amount_off } + } +} diff --git a/generated/stripe_product/src/price/requests.rs b/generated/stripe_product/src/price/requests.rs index 5bb4f8685..2cda1596a 100644 --- a/generated/stripe_product/src/price/requests.rs +++ b/generated/stripe_product/src/price/requests.rs @@ -79,7 +79,7 @@ pub struct ListPrice<'a> { /// Only return prices of type `recurring` or `one_time`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> ListPrice<'a> { pub fn new() -> Self { @@ -209,57 +209,6 @@ impl serde::Serialize for ListPriceRecurringUsageType { serializer.serialize_str(self.as_str()) } } -/// Only return prices of type `recurring` or `one_time`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListPriceType { - OneTime, - Recurring, -} -impl ListPriceType { - pub fn as_str(self) -> &'static str { - use ListPriceType::*; - match self { - OneTime => "one_time", - Recurring => "recurring", - } - } -} - -impl std::str::FromStr for ListPriceType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListPriceType::*; - match s { - "one_time" => Ok(OneTime), - "recurring" => Ok(Recurring), - _ => Err(()), - } - } -} -impl AsRef for ListPriceType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListPriceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListPriceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListPriceType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListPrice<'a> { /// Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). /// For the list of inactive prices, set `active` to false. @@ -283,7 +232,7 @@ pub struct CreatePrice<'a> { /// `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). /// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. #[serde(skip_serializing_if = "Option::is_none")] - pub billing_scheme: Option, + pub billing_scheme: Option, /// 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). pub currency: stripe_types::Currency, @@ -294,7 +243,7 @@ pub struct CreatePrice<'a> { Option<&'a std::collections::HashMap>, /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_unit_amount: Option, + pub custom_unit_amount: Option, /// Specifies which fields in the response should be expanded. #[serde(skip_serializing_if = "Option::is_none")] pub expand: Option<&'a [&'a str]>, @@ -325,7 +274,7 @@ pub struct CreatePrice<'a> { /// 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, + pub tax_behavior: Option, /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -334,7 +283,7 @@ pub struct CreatePrice<'a> { /// Defines if the tiering price should be `graduated` or `volume` based. /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. #[serde(skip_serializing_if = "Option::is_none")] - pub tiers_mode: Option, + pub tiers_mode: 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, @@ -376,73 +325,19 @@ impl<'a> CreatePrice<'a> { } } } -/// Describes how to compute the price per period. -/// Either `per_unit` or `tiered`. -/// `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). -/// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceBillingScheme { - PerUnit, - Tiered, -} -impl CreatePriceBillingScheme { - pub fn as_str(self) -> &'static str { - use CreatePriceBillingScheme::*; - match self { - PerUnit => "per_unit", - Tiered => "tiered", - } - } -} - -impl std::str::FromStr for CreatePriceBillingScheme { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePriceBillingScheme::*; - match s { - "per_unit" => Ok(PerUnit), - "tiered" => Ok(Tiered), - _ => Err(()), - } - } -} -impl AsRef for CreatePriceBillingScheme { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePriceBillingScheme { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePriceBillingScheme { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePriceBillingScheme { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Prices defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[derive(Clone, Debug, Default, serde::Serialize)] pub struct CreatePriceCurrencyOptions { /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_unit_amount: Option, + pub custom_unit_amount: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// 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, + pub tax_behavior: Option, /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -461,84 +356,6 @@ impl CreatePriceCurrencyOptions { Self::default() } } -/// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePriceCurrencyOptionsCustomUnitAmount { - /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. - pub enabled: bool, - /// The maximum unit amount the customer can specify for this item. - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// The minimum unit amount the customer can specify for this item. - /// Must be at least the minimum charge amount. - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, - /// The starting unit amount which can be updated by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub preset: Option, -} -impl CreatePriceCurrencyOptionsCustomUnitAmount { - pub fn new(enabled: bool) -> Self { - Self { enabled, maximum: None, minimum: None, preset: None } - } -} -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// 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. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceCurrencyOptionsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl CreatePriceCurrencyOptionsTaxBehavior { - pub fn as_str(self) -> &'static str { - use CreatePriceCurrencyOptionsTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for CreatePriceCurrencyOptionsTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePriceCurrencyOptionsTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for CreatePriceCurrencyOptionsTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePriceCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePriceCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePriceCurrencyOptionsTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -583,27 +400,6 @@ pub enum CreatePriceCurrencyOptionsTiersUpTo { Inf, I64(i64), } -/// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreatePriceCustomUnitAmount { - /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. - pub enabled: bool, - /// The maximum unit amount the customer can specify for this item. - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// The minimum unit amount the customer can specify for this item. - /// Must be at least the minimum charge amount. - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, - /// The starting unit amount which can be updated by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub preset: Option, -} -impl CreatePriceCustomUnitAmount { - pub fn new(enabled: bool) -> Self { - Self { enabled, maximum: None, minimum: None, preset: None } - } -} /// These fields can be used to create a new product that this price will belong to. #[derive(Copy, Clone, Debug, serde::Serialize)] pub struct CreatePriceProductData<'a> { @@ -860,63 +656,6 @@ impl serde::Serialize for CreatePriceRecurringUsageType { serializer.serialize_str(self.as_str()) } } -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// 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. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl CreatePriceTaxBehavior { - pub fn as_str(self) -> &'static str { - use CreatePriceTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for CreatePriceTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePriceTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for CreatePriceTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePriceTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePriceTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePriceTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -961,58 +700,6 @@ pub enum CreatePriceTiersUpTo { Inf, I64(i64), } -/// Defines if the tiering price should be `graduated` or `volume` based. -/// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreatePriceTiersMode { - Graduated, - Volume, -} -impl CreatePriceTiersMode { - pub fn as_str(self) -> &'static str { - use CreatePriceTiersMode::*; - match self { - Graduated => "graduated", - Volume => "volume", - } - } -} - -impl std::str::FromStr for CreatePriceTiersMode { - type Err = (); - fn from_str(s: &str) -> Result { - use CreatePriceTiersMode::*; - match s { - "graduated" => Ok(Graduated), - "volume" => Ok(Volume), - _ => Err(()), - } - } -} -impl AsRef for CreatePriceTiersMode { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreatePriceTiersMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreatePriceTiersMode { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreatePriceTiersMode { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Apply a transformation to the reported usage or set quantity before computing the billed price. /// Cannot be combined with `tiers`. #[derive(Copy, Clone, Debug, serde::Serialize)] @@ -1136,7 +823,7 @@ pub struct UpdatePrice<'a> { /// 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, + 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, @@ -1152,13 +839,13 @@ impl<'a> UpdatePrice<'a> { pub struct UpdatePriceCurrencyOptions { /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. #[serde(skip_serializing_if = "Option::is_none")] - pub custom_unit_amount: Option, + pub custom_unit_amount: Option, /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. /// 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, + pub tax_behavior: Option, /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -1177,84 +864,6 @@ impl UpdatePriceCurrencyOptions { Self::default() } } -/// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdatePriceCurrencyOptionsCustomUnitAmount { - /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. - pub enabled: bool, - /// The maximum unit amount the customer can specify for this item. - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// The minimum unit amount the customer can specify for this item. - /// Must be at least the minimum charge amount. - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, - /// The starting unit amount which can be updated by the customer. - #[serde(skip_serializing_if = "Option::is_none")] - pub preset: Option, -} -impl UpdatePriceCurrencyOptionsCustomUnitAmount { - pub fn new(enabled: bool) -> Self { - Self { enabled, maximum: None, minimum: None, preset: None } - } -} -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// 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. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePriceCurrencyOptionsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl UpdatePriceCurrencyOptionsTaxBehavior { - pub fn as_str(self) -> &'static str { - use UpdatePriceCurrencyOptionsTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for UpdatePriceCurrencyOptionsTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePriceCurrencyOptionsTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for UpdatePriceCurrencyOptionsTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdatePriceCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePriceCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePriceCurrencyOptionsTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -1299,63 +908,6 @@ pub enum UpdatePriceCurrencyOptionsTiersUpTo { Inf, I64(i64), } -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// 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. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdatePriceTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl UpdatePriceTaxBehavior { - pub fn as_str(self) -> &'static str { - use UpdatePriceTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for UpdatePriceTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdatePriceTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for UpdatePriceTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdatePriceTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdatePriceTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdatePriceTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> UpdatePrice<'a> { /// Updates the specified price by setting the values of the parameters passed. /// Any parameters not provided are left unchanged. @@ -1367,3 +919,23 @@ impl<'a> UpdatePrice<'a> { client.send_form(&format!("/prices/{price}"), self, http_types::Method::Post) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct CustomUnitAmount { + /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. + pub enabled: bool, + /// The maximum unit amount the customer can specify for this item. + #[serde(skip_serializing_if = "Option::is_none")] + pub maximum: Option, + /// The minimum unit amount the customer can specify for this item. + /// Must be at least the minimum charge amount. + #[serde(skip_serializing_if = "Option::is_none")] + pub minimum: Option, + /// The starting unit amount which can be updated by the customer. + #[serde(skip_serializing_if = "Option::is_none")] + pub preset: Option, +} +impl CustomUnitAmount { + pub fn new(enabled: bool) -> Self { + Self { enabled, maximum: None, minimum: None, preset: None } + } +} diff --git a/generated/stripe_product/src/product/requests.rs b/generated/stripe_product/src/product/requests.rs index b78e79e4c..bbc43cf8d 100644 --- a/generated/stripe_product/src/product/requests.rs +++ b/generated/stripe_product/src/product/requests.rs @@ -59,7 +59,7 @@ pub struct CreateProduct<'a> { /// A list of up to 15 features for this product. /// These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table). #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option<&'a [CreateProductFeatures<'a>]>, + pub features: Option<&'a [Features<'a>]>, /// An identifier will be randomly generated by Stripe. /// You can optionally override this ID, but the ID must be unique across all products in your Stripe account. #[serde(skip_serializing_if = "Option::is_none")] @@ -77,7 +77,7 @@ pub struct CreateProduct<'a> { pub name: &'a str, /// The dimensions of this product for shipping purposes. #[serde(skip_serializing_if = "Option::is_none")] - pub package_dimensions: Option, + pub package_dimensions: Option, /// Whether this product is shipped (i.e., physical goods). #[serde(skip_serializing_if = "Option::is_none")] pub shippable: Option, @@ -99,7 +99,7 @@ pub struct CreateProduct<'a> { /// On API versions before `2018-02-05`, this field defaults to `good` for compatibility reasons. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// A label that represents units of this product. /// When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. #[serde(skip_serializing_if = "Option::is_none")] @@ -459,89 +459,6 @@ impl serde::Serialize for CreateProductDefaultPriceDataTaxBehavior { serializer.serialize_str(self.as_str()) } } -/// A list of up to 15 features for this product. -/// These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table). -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateProductFeatures<'a> { - /// The feature's name. Up to 80 characters long. - pub name: &'a str, -} -impl<'a> CreateProductFeatures<'a> { - pub fn new(name: &'a str) -> Self { - Self { name } - } -} -/// The dimensions of this product for shipping purposes. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateProductPackageDimensions { - /// Height, in inches. Maximum precision is 2 decimal places. - pub height: f64, - /// Length, in inches. Maximum precision is 2 decimal places. - pub length: f64, - /// Weight, in ounces. Maximum precision is 2 decimal places. - pub weight: f64, - /// Width, in inches. Maximum precision is 2 decimal places. - pub width: f64, -} -impl CreateProductPackageDimensions { - pub fn new(height: f64, length: f64, weight: f64, width: f64) -> Self { - Self { height, length, weight, width } - } -} -/// The type of the product. -/// Defaults to `service` if not explicitly specified, enabling use of this product with Subscriptions and Plans. -/// Set this parameter to `good` to use this product with Orders and SKUs. -/// On API versions before `2018-02-05`, this field defaults to `good` for compatibility reasons. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateProductType { - Good, - Service, -} -impl CreateProductType { - pub fn as_str(self) -> &'static str { - use CreateProductType::*; - match self { - Good => "good", - Service => "service", - } - } -} - -impl std::str::FromStr for CreateProductType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateProductType::*; - match s { - "good" => Ok(Good), - "service" => Ok(Service), - _ => Err(()), - } - } -} -impl AsRef for CreateProductType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateProductType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateProductType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateProductType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateProduct<'a> { /// Creates a new product object. pub fn send(&self, client: &stripe::Client) -> stripe::Response { @@ -588,7 +505,7 @@ pub struct UpdateProduct<'a> { /// A list of up to 15 features for this product. /// These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table). #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option<&'a [UpdateProductFeatures<'a>]>, + pub features: Option<&'a [Features<'a>]>, /// A list of up to 8 URLs of images for this product, meant to be displayable to the customer. #[serde(skip_serializing_if = "Option::is_none")] pub images: Option<&'a [&'a str]>, @@ -603,7 +520,7 @@ pub struct UpdateProduct<'a> { pub name: Option<&'a str>, /// The dimensions of this product for shipping purposes. #[serde(skip_serializing_if = "Option::is_none")] - pub package_dimensions: Option, + pub package_dimensions: Option, /// Whether this product is shipped (i.e., physical goods). #[serde(skip_serializing_if = "Option::is_none")] pub shippable: Option, @@ -633,35 +550,6 @@ impl<'a> UpdateProduct<'a> { Self::default() } } -/// A list of up to 15 features for this product. -/// These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table). -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateProductFeatures<'a> { - /// The feature's name. Up to 80 characters long. - pub name: &'a str, -} -impl<'a> UpdateProductFeatures<'a> { - pub fn new(name: &'a str) -> Self { - Self { name } - } -} -/// The dimensions of this product for shipping purposes. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateProductPackageDimensions { - /// Height, in inches. Maximum precision is 2 decimal places. - pub height: f64, - /// Length, in inches. Maximum precision is 2 decimal places. - pub length: f64, - /// Weight, in ounces. Maximum precision is 2 decimal places. - pub weight: f64, - /// Width, in inches. Maximum precision is 2 decimal places. - pub width: f64, -} -impl UpdateProductPackageDimensions { - pub fn new(height: f64, length: f64, weight: f64, width: f64) -> Self { - Self { height, length, weight, width } - } -} impl<'a> UpdateProduct<'a> { /// Updates the specific product by setting the values of the parameters passed. /// Any parameters not provided will be left unchanged. @@ -708,7 +596,7 @@ pub struct ListProduct<'a> { /// Only return products of this type. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, /// Only return products with the given url. #[serde(skip_serializing_if = "Option::is_none")] pub url: Option<&'a str>, @@ -718,57 +606,6 @@ impl<'a> ListProduct<'a> { Self::default() } } -/// Only return products of this type. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListProductType { - Good, - Service, -} -impl ListProductType { - pub fn as_str(self) -> &'static str { - use ListProductType::*; - match self { - Good => "good", - Service => "service", - } - } -} - -impl std::str::FromStr for ListProductType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListProductType::*; - match s { - "good" => Ok(Good), - "service" => Ok(Service), - _ => Err(()), - } - } -} -impl AsRef for ListProductType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListProductType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListProductType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListProductType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListProduct<'a> { /// Returns a list of your products. /// The products are returned sorted by creation date, with the most recently created products appearing first. @@ -801,3 +638,29 @@ impl DeleteProduct { client.send_form(&format!("/products/{id}"), self, http_types::Method::Delete) } } +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct Features<'a> { + /// The feature's name. Up to 80 characters long. + pub name: &'a str, +} +impl<'a> Features<'a> { + pub fn new(name: &'a str) -> Self { + Self { name } + } +} +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct PackageDimensionsSpecs { + /// Height, in inches. Maximum precision is 2 decimal places. + pub height: f64, + /// Length, in inches. Maximum precision is 2 decimal places. + pub length: f64, + /// Weight, in ounces. Maximum precision is 2 decimal places. + pub weight: f64, + /// Width, in inches. Maximum precision is 2 decimal places. + pub width: f64, +} +impl PackageDimensionsSpecs { + pub fn new(height: f64, length: f64, weight: f64, width: f64) -> Self { + Self { height, length, weight, width } + } +} diff --git a/generated/stripe_product/src/promotion_code/requests.rs b/generated/stripe_product/src/promotion_code/requests.rs index 46a294944..4cfd7c323 100644 --- a/generated/stripe_product/src/promotion_code/requests.rs +++ b/generated/stripe_product/src/promotion_code/requests.rs @@ -78,12 +78,8 @@ pub struct CreatePromotionCodeRestrictions<'a> { /// Promotion codes defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency_options: Option< - &'a std::collections::HashMap< - stripe_types::Currency, - CreatePromotionCodeRestrictionsCurrencyOptions, - >, - >, + pub currency_options: + Option<&'a std::collections::HashMap>, /// A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices. #[serde(skip_serializing_if = "Option::is_none")] pub first_time_transaction: Option, @@ -99,19 +95,6 @@ impl<'a> CreatePromotionCodeRestrictions<'a> { Self::default() } } -/// Promotion codes defined in each available currency option. -/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreatePromotionCodeRestrictionsCurrencyOptions { - /// Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum_amount: Option, -} -impl CreatePromotionCodeRestrictionsCurrencyOptions { - pub fn new() -> Self { - Self::default() - } -} impl<'a> CreatePromotionCode<'a> { /// A promotion code points to a coupon. /// You can optionally restrict the code to a specific customer, redemption limit, and expiration date. @@ -149,31 +132,14 @@ pub struct UpdatePromotionCodeRestrictions<'a> { /// Promotion codes defined in each available currency option. /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). #[serde(skip_serializing_if = "Option::is_none")] - pub currency_options: Option< - &'a std::collections::HashMap< - stripe_types::Currency, - UpdatePromotionCodeRestrictionsCurrencyOptions, - >, - >, + pub currency_options: + Option<&'a std::collections::HashMap>, } impl<'a> UpdatePromotionCodeRestrictions<'a> { pub fn new() -> Self { Self::default() } } -/// Promotion codes defined in each available currency option. -/// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdatePromotionCodeRestrictionsCurrencyOptions { - /// Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum_amount: Option, -} -impl UpdatePromotionCodeRestrictionsCurrencyOptions { - pub fn new() -> Self { - Self::default() - } -} impl<'a> UpdatePromotionCode<'a> { /// Updates the specified promotion code by setting the values of the parameters passed. /// Most fields are, by design, not editable. @@ -244,3 +210,14 @@ impl<'a> ListPromotionCode<'a> { stripe::ListPaginator::from_list_params("/promotion_codes", self) } } +#[derive(Copy, Clone, Debug, Default, serde::Serialize)] +pub struct CurrencyOption { + /// Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). + #[serde(skip_serializing_if = "Option::is_none")] + pub minimum_amount: Option, +} +impl CurrencyOption { + pub fn new() -> Self { + Self::default() + } +} diff --git a/generated/stripe_product/src/shipping_rate/requests.rs b/generated/stripe_product/src/shipping_rate/requests.rs index 1cf32cecb..ff26511fc 100644 --- a/generated/stripe_product/src/shipping_rate/requests.rs +++ b/generated/stripe_product/src/shipping_rate/requests.rs @@ -92,7 +92,7 @@ pub struct CreateShippingRate<'a> { /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. /// The Shipping tax code is `txcd_92010001`. #[serde(skip_serializing_if = "Option::is_none")] @@ -100,7 +100,7 @@ pub struct CreateShippingRate<'a> { /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } impl<'a> CreateShippingRate<'a> { pub fn new(display_name: &'a str) -> Self { @@ -310,171 +310,13 @@ pub struct CreateShippingRateFixedAmountCurrencyOptions { /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, } impl CreateShippingRateFixedAmountCurrencyOptions { pub fn new(amount: i64) -> Self { Self { amount, tax_behavior: None } } } -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - pub fn as_str(self) -> &'static str { - use CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateShippingRateTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl CreateShippingRateTaxBehavior { - pub fn as_str(self) -> &'static str { - use CreateShippingRateTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for CreateShippingRateTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateShippingRateTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for CreateShippingRateTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateShippingRateTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateShippingRateTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateShippingRateTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreateShippingRateType { - FixedAmount, -} -impl CreateShippingRateType { - pub fn as_str(self) -> &'static str { - use CreateShippingRateType::*; - match self { - FixedAmount => "fixed_amount", - } - } -} - -impl std::str::FromStr for CreateShippingRateType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateShippingRateType::*; - match s { - "fixed_amount" => Ok(FixedAmount), - _ => Err(()), - } - } -} -impl AsRef for CreateShippingRateType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateShippingRateType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateShippingRateType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateShippingRateType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateShippingRate<'a> { /// Creates a new shipping rate object. pub fn send(&self, client: &stripe::Client) -> stripe::Response { @@ -501,7 +343,7 @@ pub struct UpdateShippingRate<'a> { /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, } impl<'a> UpdateShippingRate<'a> { pub fn new() -> Self { @@ -536,123 +378,13 @@ pub struct UpdateShippingRateFixedAmountCurrencyOptions { /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_behavior: Option, + pub tax_behavior: Option, } impl UpdateShippingRateFixedAmountCurrencyOptions { pub fn new() -> Self { Self::default() } } -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - pub fn as_str(self) -> &'static str { - use UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateShippingRateFixedAmountCurrencyOptionsTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum UpdateShippingRateTaxBehavior { - Exclusive, - Inclusive, - Unspecified, -} -impl UpdateShippingRateTaxBehavior { - pub fn as_str(self) -> &'static str { - use UpdateShippingRateTaxBehavior::*; - match self { - Exclusive => "exclusive", - Inclusive => "inclusive", - Unspecified => "unspecified", - } - } -} - -impl std::str::FromStr for UpdateShippingRateTaxBehavior { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateShippingRateTaxBehavior::*; - match s { - "exclusive" => Ok(Exclusive), - "inclusive" => Ok(Inclusive), - "unspecified" => Ok(Unspecified), - _ => Err(()), - } - } -} -impl AsRef for UpdateShippingRateTaxBehavior { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateShippingRateTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateShippingRateTaxBehavior { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateShippingRateTaxBehavior { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> UpdateShippingRate<'a> { /// Updates an existing shipping rate object. pub fn send( diff --git a/generated/stripe_product/src/tax_rate/requests.rs b/generated/stripe_product/src/tax_rate/requests.rs index dd5a1261c..fa943d8d6 100644 --- a/generated/stripe_product/src/tax_rate/requests.rs +++ b/generated/stripe_product/src/tax_rate/requests.rs @@ -105,7 +105,7 @@ pub struct CreateTaxRate<'a> { 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, + pub tax_type: Option, } impl<'a> CreateTaxRate<'a> { pub fn new(display_name: &'a str, inclusive: bool, percentage: f64) -> Self { @@ -124,94 +124,6 @@ impl<'a> CreateTaxRate<'a> { } } } -/// The high-level tax type, such as `vat` or `sales_tax`. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum CreateTaxRateTaxType { - AmusementTax, - CommunicationsTax, - Gst, - Hst, - Igst, - Jct, - LeaseTax, - Pst, - Qst, - Rst, - SalesTax, - ServiceTax, - Vat, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl CreateTaxRateTaxType { - pub fn as_str(self) -> &'static str { - use CreateTaxRateTaxType::*; - match self { - AmusementTax => "amusement_tax", - CommunicationsTax => "communications_tax", - Gst => "gst", - Hst => "hst", - Igst => "igst", - Jct => "jct", - LeaseTax => "lease_tax", - Pst => "pst", - Qst => "qst", - Rst => "rst", - SalesTax => "sales_tax", - ServiceTax => "service_tax", - Vat => "vat", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for CreateTaxRateTaxType { - type Err = (); - fn from_str(s: &str) -> Result { - use CreateTaxRateTaxType::*; - match s { - "amusement_tax" => Ok(AmusementTax), - "communications_tax" => Ok(CommunicationsTax), - "gst" => Ok(Gst), - "hst" => Ok(Hst), - "igst" => Ok(Igst), - "jct" => Ok(Jct), - "lease_tax" => Ok(LeaseTax), - "pst" => Ok(Pst), - "qst" => Ok(Qst), - "rst" => Ok(Rst), - "sales_tax" => Ok(SalesTax), - "service_tax" => Ok(ServiceTax), - "vat" => Ok(Vat), - _ => Err(()), - } - } -} -impl AsRef for CreateTaxRateTaxType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreateTaxRateTaxType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreateTaxRateTaxType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreateTaxRateTaxType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> CreateTaxRate<'a> { /// Creates a new tax rate. pub fn send(&self, client: &stripe::Client) -> stripe::Response { @@ -254,101 +166,13 @@ pub struct UpdateTaxRate<'a> { 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, + pub tax_type: Option, } impl<'a> UpdateTaxRate<'a> { pub fn new() -> Self { Self::default() } } -/// The high-level tax type, such as `vat` or `sales_tax`. -#[derive(Copy, Clone, Eq, PartialEq)] -#[non_exhaustive] -pub enum UpdateTaxRateTaxType { - AmusementTax, - CommunicationsTax, - Gst, - Hst, - Igst, - Jct, - LeaseTax, - Pst, - Qst, - Rst, - SalesTax, - ServiceTax, - Vat, - /// An unrecognized value from Stripe. Should not be used as a request parameter. - Unknown, -} -impl UpdateTaxRateTaxType { - pub fn as_str(self) -> &'static str { - use UpdateTaxRateTaxType::*; - match self { - AmusementTax => "amusement_tax", - CommunicationsTax => "communications_tax", - Gst => "gst", - Hst => "hst", - Igst => "igst", - Jct => "jct", - LeaseTax => "lease_tax", - Pst => "pst", - Qst => "qst", - Rst => "rst", - SalesTax => "sales_tax", - ServiceTax => "service_tax", - Vat => "vat", - Unknown => "unknown", - } - } -} - -impl std::str::FromStr for UpdateTaxRateTaxType { - type Err = (); - fn from_str(s: &str) -> Result { - use UpdateTaxRateTaxType::*; - match s { - "amusement_tax" => Ok(AmusementTax), - "communications_tax" => Ok(CommunicationsTax), - "gst" => Ok(Gst), - "hst" => Ok(Hst), - "igst" => Ok(Igst), - "jct" => Ok(Jct), - "lease_tax" => Ok(LeaseTax), - "pst" => Ok(Pst), - "qst" => Ok(Qst), - "rst" => Ok(Rst), - "sales_tax" => Ok(SalesTax), - "service_tax" => Ok(ServiceTax), - "vat" => Ok(Vat), - _ => Err(()), - } - } -} -impl AsRef for UpdateTaxRateTaxType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for UpdateTaxRateTaxType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for UpdateTaxRateTaxType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for UpdateTaxRateTaxType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> UpdateTaxRate<'a> { /// Updates an existing tax rate. pub fn send( diff --git a/generated/stripe_shared/src/account.rs b/generated/stripe_shared/src/account.rs index 9a9ed7480..35ddb1405 100644 --- a/generated/stripe_shared/src/account.rs +++ b/generated/stripe_shared/src/account.rs @@ -18,7 +18,7 @@ pub struct Account { pub business_profile: Option, /// The business type. #[serde(skip_serializing_if = "Option::is_none")] - pub business_type: Option, + pub business_type: Option, #[serde(skip_serializing_if = "Option::is_none")] pub capabilities: Option, /// Whether the account can create live charges. @@ -72,9 +72,15 @@ pub struct Account { /// The Stripe account type. Can be `standard`, `express`, or `custom`. #[serde(rename = "type")] #[serde(skip_serializing_if = "Option::is_none")] - pub type_: Option, + pub type_: Option, } -/// The business type. +impl stripe_types::Object for Account { + type Id = stripe_shared::AccountId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(AccountId, "acct_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum AccountBusinessType { Company, @@ -139,7 +145,6 @@ impl<'de> serde::Deserialize<'de> for AccountBusinessType { .map_err(|_| serde::de::Error::custom("Unknown value for AccountBusinessType")) } } -/// The Stripe account type. Can be `standard`, `express`, or `custom`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum AccountType { Custom, @@ -200,10 +205,3 @@ impl<'de> serde::Deserialize<'de> for AccountType { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for AccountType")) } } -impl stripe_types::Object for Account { - type Id = stripe_shared::AccountId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(AccountId, "acct_"); diff --git a/generated/stripe_shared/src/account_capabilities.rs b/generated/stripe_shared/src/account_capabilities.rs index 4c8cc4bb7..8d2b9bc82 100644 --- a/generated/stripe_shared/src/account_capabilities.rs +++ b/generated/stripe_shared/src/account_capabilities.rs @@ -2,126 +2,125 @@ pub struct AccountCapabilities { /// The status of the Canadian pre-authorized debits payments capability of the account, or whether the account can directly process Canadian pre-authorized debits charges. #[serde(skip_serializing_if = "Option::is_none")] - pub acss_debit_payments: Option, + pub acss_debit_payments: Option, /// The status of the Affirm capability of the account, or whether the account can directly process Affirm charges. #[serde(skip_serializing_if = "Option::is_none")] - pub affirm_payments: Option, + pub affirm_payments: Option, /// The status of the Afterpay Clearpay capability of the account, or whether the account can directly process Afterpay Clearpay charges. #[serde(skip_serializing_if = "Option::is_none")] - pub afterpay_clearpay_payments: Option, + pub afterpay_clearpay_payments: Option, /// The status of the BECS Direct Debit (AU) payments capability of the account, or whether the account can directly process BECS Direct Debit (AU) charges. #[serde(skip_serializing_if = "Option::is_none")] - pub au_becs_debit_payments: Option, + pub au_becs_debit_payments: Option, /// The status of the Bacs Direct Debits payments capability of the account, or whether the account can directly process Bacs Direct Debits charges. #[serde(skip_serializing_if = "Option::is_none")] - pub bacs_debit_payments: Option, + pub bacs_debit_payments: Option, /// The status of the Bancontact payments capability of the account, or whether the account can directly process Bancontact charges. #[serde(skip_serializing_if = "Option::is_none")] - pub bancontact_payments: Option, + pub bancontact_payments: Option, /// The status of the customer_balance payments capability of the account, or whether the account can directly process customer_balance charges. #[serde(skip_serializing_if = "Option::is_none")] - pub bank_transfer_payments: Option, + pub bank_transfer_payments: Option, /// The status of the blik payments capability of the account, or whether the account can directly process blik charges. #[serde(skip_serializing_if = "Option::is_none")] - pub blik_payments: Option, + pub blik_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, + 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, + pub card_issuing: Option, /// The status of the card payments capability of the account, or whether the account can directly process credit and debit card charges. #[serde(skip_serializing_if = "Option::is_none")] - pub card_payments: Option, + pub card_payments: Option, /// The status of the Cartes Bancaires payments capability of the account, or whether the account can directly process Cartes Bancaires card charges in EUR currency. #[serde(skip_serializing_if = "Option::is_none")] - pub cartes_bancaires_payments: Option, + pub cartes_bancaires_payments: Option, /// The status of the Cash App Pay capability of the account, or whether the account can directly process Cash App Pay payments. #[serde(skip_serializing_if = "Option::is_none")] - pub cashapp_payments: Option, + pub cashapp_payments: Option, /// The status of the EPS payments capability of the account, or whether the account can directly process EPS charges. #[serde(skip_serializing_if = "Option::is_none")] - pub eps_payments: Option, + pub eps_payments: Option, /// The status of the FPX payments capability of the account, or whether the account can directly process FPX charges. #[serde(skip_serializing_if = "Option::is_none")] - pub fpx_payments: Option, + pub fpx_payments: Option, /// The status of the giropay payments capability of the account, or whether the account can directly process giropay charges. #[serde(skip_serializing_if = "Option::is_none")] - pub giropay_payments: Option, + pub giropay_payments: Option, /// The status of the GrabPay payments capability of the account, or whether the account can directly process GrabPay charges. #[serde(skip_serializing_if = "Option::is_none")] - pub grabpay_payments: Option, + pub grabpay_payments: Option, /// The status of the iDEAL payments capability of the account, or whether the account can directly process iDEAL charges. #[serde(skip_serializing_if = "Option::is_none")] - pub ideal_payments: Option, + pub ideal_payments: Option, /// The status of the india_international_payments capability of the account, or whether the account can process international charges (non INR) in India. #[serde(skip_serializing_if = "Option::is_none")] - pub india_international_payments: Option, + pub india_international_payments: Option, /// The status of the JCB payments capability of the account, or whether the account (Japan only) can directly process JCB credit card charges in JPY currency. #[serde(skip_serializing_if = "Option::is_none")] - pub jcb_payments: Option, + pub jcb_payments: Option, /// The status of the Klarna payments capability of the account, or whether the account can directly process Klarna charges. #[serde(skip_serializing_if = "Option::is_none")] - pub klarna_payments: Option, + pub klarna_payments: Option, /// The status of the konbini payments capability of the account, or whether the account can directly process konbini charges. #[serde(skip_serializing_if = "Option::is_none")] - pub konbini_payments: Option, + pub konbini_payments: Option, /// The status of the legacy payments capability of the account. #[serde(skip_serializing_if = "Option::is_none")] - pub legacy_payments: Option, + pub legacy_payments: Option, /// The status of the link_payments capability of the account, or whether the account can directly process Link charges. #[serde(skip_serializing_if = "Option::is_none")] - pub link_payments: Option, + pub link_payments: Option, /// The status of the OXXO payments capability of the account, or whether the account can directly process OXXO charges. #[serde(skip_serializing_if = "Option::is_none")] - pub oxxo_payments: Option, + pub oxxo_payments: Option, /// The status of the P24 payments capability of the account, or whether the account can directly process P24 charges. #[serde(skip_serializing_if = "Option::is_none")] - pub p24_payments: Option, + pub p24_payments: Option, /// The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. #[serde(skip_serializing_if = "Option::is_none")] - pub paynow_payments: Option, + pub paynow_payments: Option, /// The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. #[serde(skip_serializing_if = "Option::is_none")] - pub promptpay_payments: Option, + pub promptpay_payments: Option, /// The status of the RevolutPay capability of the account, or whether the account can directly process RevolutPay payments. #[serde(skip_serializing_if = "Option::is_none")] - pub revolut_pay_payments: Option, + pub revolut_pay_payments: Option, /// The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges. #[serde(skip_serializing_if = "Option::is_none")] - pub sepa_debit_payments: Option, + pub sepa_debit_payments: Option, /// The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges. #[serde(skip_serializing_if = "Option::is_none")] - pub sofort_payments: Option, + pub sofort_payments: Option, /// The status of the tax reporting 1099-K (US) capability of the account. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_reporting_us_1099_k: Option, + pub tax_reporting_us_1099_k: Option, /// The status of the tax reporting 1099-MISC (US) capability of the account. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_reporting_us_1099_misc: Option, + pub tax_reporting_us_1099_misc: Option, /// The status of the transfers capability of the account, or whether your platform can transfer funds to the account. #[serde(skip_serializing_if = "Option::is_none")] - pub transfers: Option, + pub transfers: Option, /// The status of the banking capability, or whether the account can have bank accounts. #[serde(skip_serializing_if = "Option::is_none")] - pub treasury: Option, + pub treasury: Option, /// The status of the US bank account ACH payments capability of the account, or whether the account can directly process US bank account charges. #[serde(skip_serializing_if = "Option::is_none")] - pub us_bank_account_ach_payments: Option, + pub us_bank_account_ach_payments: Option, /// The status of the Zip capability of the account, or whether the account can directly process Zip charges. #[serde(skip_serializing_if = "Option::is_none")] - pub zip_payments: Option, + pub zip_payments: Option, } -/// The status of the Canadian pre-authorized debits payments capability of the account, or whether the account can directly process Canadian pre-authorized debits charges. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesAcssDebitPayments { +pub enum AccountCapabilitiesStatus { Active, Inactive, Pending, } -impl AccountCapabilitiesAcssDebitPayments { +impl AccountCapabilitiesStatus { pub fn as_str(self) -> &'static str { - use AccountCapabilitiesAcssDebitPayments::*; + use AccountCapabilitiesStatus::*; match self { Active => "active", Inactive => "inactive", @@ -130,10 +129,10 @@ impl AccountCapabilitiesAcssDebitPayments { } } -impl std::str::FromStr for AccountCapabilitiesAcssDebitPayments { +impl std::str::FromStr for AccountCapabilitiesStatus { type Err = (); fn from_str(s: &str) -> Result { - use AccountCapabilitiesAcssDebitPayments::*; + use AccountCapabilitiesStatus::*; match s { "active" => Ok(Active), "inactive" => Ok(Inactive), @@ -142,23 +141,23 @@ impl std::str::FromStr for AccountCapabilitiesAcssDebitPayments { } } } -impl AsRef for AccountCapabilitiesAcssDebitPayments { +impl AsRef for AccountCapabilitiesStatus { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for AccountCapabilitiesAcssDebitPayments { +impl std::fmt::Display for AccountCapabilitiesStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for AccountCapabilitiesAcssDebitPayments { +impl std::fmt::Debug for AccountCapabilitiesStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for AccountCapabilitiesAcssDebitPayments { +impl serde::Serialize for AccountCapabilitiesStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -166,2284 +165,11 @@ impl serde::Serialize for AccountCapabilitiesAcssDebitPayments { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesAcssDebitPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesAcssDebitPayments") - }) - } -} -/// The status of the Affirm capability of the account, or whether the account can directly process Affirm charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesAffirmPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesAffirmPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesAffirmPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesAffirmPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesAffirmPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesAffirmPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesAffirmPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesAffirmPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesAffirmPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesAffirmPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesAffirmPayments") - }) - } -} -/// The status of the Afterpay Clearpay capability of the account, or whether the account can directly process Afterpay Clearpay charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesAfterpayClearpayPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesAfterpayClearpayPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesAfterpayClearpayPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesAfterpayClearpayPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesAfterpayClearpayPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesAfterpayClearpayPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesAfterpayClearpayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesAfterpayClearpayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesAfterpayClearpayPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesAfterpayClearpayPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for AccountCapabilitiesAfterpayClearpayPayments", - ) - }) - } -} -/// The status of the BECS Direct Debit (AU) payments capability of the account, or whether the account can directly process BECS Direct Debit (AU) charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesAuBecsDebitPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesAuBecsDebitPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesAuBecsDebitPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesAuBecsDebitPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesAuBecsDebitPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesAuBecsDebitPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesAuBecsDebitPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesAuBecsDebitPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesAuBecsDebitPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesAuBecsDebitPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesAuBecsDebitPayments") - }) - } -} -/// The status of the Bacs Direct Debits payments capability of the account, or whether the account can directly process Bacs Direct Debits charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesBacsDebitPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesBacsDebitPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesBacsDebitPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesBacsDebitPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesBacsDebitPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesBacsDebitPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesBacsDebitPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesBacsDebitPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesBacsDebitPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesBacsDebitPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesBacsDebitPayments") - }) - } -} -/// The status of the Bancontact payments capability of the account, or whether the account can directly process Bancontact charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesBancontactPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesBancontactPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesBancontactPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesBancontactPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesBancontactPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesBancontactPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesBancontactPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesBancontactPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesBancontactPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesBancontactPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesBancontactPayments") - }) - } -} -/// The status of the customer_balance payments capability of the account, or whether the account can directly process customer_balance charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesBankTransferPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesBankTransferPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesBankTransferPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesBankTransferPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesBankTransferPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesBankTransferPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesBankTransferPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesBankTransferPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesBankTransferPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesBankTransferPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesBankTransferPayments") - }) - } -} -/// The status of the blik payments capability of the account, or whether the account can directly process blik charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesBlikPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesBlikPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesBlikPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesBlikPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesBlikPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesBlikPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesBlikPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesBlikPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesBlikPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesBlikPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesBlikPayments") - }) - } -} -/// The status of the boleto payments capability of the account, or whether the account can directly process boleto charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesBoletoPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesBoletoPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesBoletoPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesBoletoPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesBoletoPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -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 { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesBoletoPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesBoletoPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesBoletoPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesBoletoPayments") - }) - } -} -/// The status of the card issuing capability of the account, or whether you can use Issuing to distribute funds on cards. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesCardIssuing { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesCardIssuing { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesCardIssuing::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesCardIssuing { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesCardIssuing::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesCardIssuing { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesCardIssuing { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesCardIssuing { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesCardIssuing { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesCardIssuing { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesCardIssuing") - }) - } -} -/// The status of the card payments capability of the account, or whether the account can directly process credit and debit card charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesCardPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesCardPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesCardPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesCardPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesCardPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesCardPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesCardPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesCardPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesCardPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesCardPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesCardPayments") - }) - } -} -/// The status of the Cartes Bancaires payments capability of the account, or whether the account can directly process Cartes Bancaires card charges in EUR currency. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesCartesBancairesPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesCartesBancairesPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesCartesBancairesPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesCartesBancairesPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesCartesBancairesPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesCartesBancairesPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesCartesBancairesPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesCartesBancairesPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesCartesBancairesPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesCartesBancairesPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesCartesBancairesPayments") - }) - } -} -/// The status of the Cash App Pay capability of the account, or whether the account can directly process Cash App Pay payments. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesCashappPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesCashappPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesCashappPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesCashappPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesCashappPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesCashappPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesCashappPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesCashappPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesCashappPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesCashappPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesCashappPayments") - }) - } -} -/// The status of the EPS payments capability of the account, or whether the account can directly process EPS charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesEpsPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesEpsPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesEpsPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesEpsPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesEpsPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesEpsPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesEpsPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesEpsPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesEpsPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesEpsPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesEpsPayments") - }) - } -} -/// The status of the FPX payments capability of the account, or whether the account can directly process FPX charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesFpxPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesFpxPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesFpxPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesFpxPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesFpxPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesFpxPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesFpxPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesFpxPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesFpxPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesFpxPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesFpxPayments") - }) - } -} -/// The status of the giropay payments capability of the account, or whether the account can directly process giropay charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesGiropayPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesGiropayPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesGiropayPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesGiropayPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesGiropayPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesGiropayPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesGiropayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesGiropayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesGiropayPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesGiropayPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesGiropayPayments") - }) - } -} -/// The status of the GrabPay payments capability of the account, or whether the account can directly process GrabPay charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesGrabpayPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesGrabpayPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesGrabpayPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesGrabpayPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesGrabpayPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesGrabpayPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesGrabpayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesGrabpayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesGrabpayPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesGrabpayPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesGrabpayPayments") - }) - } -} -/// The status of the iDEAL payments capability of the account, or whether the account can directly process iDEAL charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesIdealPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesIdealPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesIdealPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesIdealPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesIdealPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesIdealPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesIdealPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesIdealPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesIdealPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesIdealPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesIdealPayments") - }) - } -} -/// The status of the india_international_payments capability of the account, or whether the account can process international charges (non INR) in India. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesIndiaInternationalPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesIndiaInternationalPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesIndiaInternationalPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesIndiaInternationalPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesIndiaInternationalPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesIndiaInternationalPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesIndiaInternationalPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesIndiaInternationalPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesIndiaInternationalPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesIndiaInternationalPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for AccountCapabilitiesIndiaInternationalPayments", - ) - }) - } -} -/// The status of the JCB payments capability of the account, or whether the account (Japan only) can directly process JCB credit card charges in JPY currency. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesJcbPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesJcbPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesJcbPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesJcbPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesJcbPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesJcbPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesJcbPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesJcbPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesJcbPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesJcbPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesJcbPayments") - }) - } -} -/// The status of the Klarna payments capability of the account, or whether the account can directly process Klarna charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesKlarnaPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesKlarnaPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesKlarnaPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesKlarnaPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesKlarnaPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesKlarnaPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesKlarnaPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesKlarnaPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesKlarnaPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesKlarnaPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesKlarnaPayments") - }) - } -} -/// The status of the konbini payments capability of the account, or whether the account can directly process konbini charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesKonbiniPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesKonbiniPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesKonbiniPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesKonbiniPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesKonbiniPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesKonbiniPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesKonbiniPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesKonbiniPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesKonbiniPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesKonbiniPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesKonbiniPayments") - }) - } -} -/// The status of the legacy payments capability of the account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesLegacyPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesLegacyPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesLegacyPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesLegacyPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesLegacyPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesLegacyPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesLegacyPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesLegacyPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesLegacyPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesLegacyPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesLegacyPayments") - }) - } -} -/// The status of the link_payments capability of the account, or whether the account can directly process Link charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesLinkPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesLinkPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesLinkPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesLinkPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesLinkPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesLinkPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesLinkPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesLinkPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesLinkPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesLinkPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesLinkPayments") - }) - } -} -/// The status of the OXXO payments capability of the account, or whether the account can directly process OXXO charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesOxxoPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesOxxoPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesOxxoPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesOxxoPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesOxxoPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesOxxoPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesOxxoPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesOxxoPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesOxxoPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesOxxoPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesOxxoPayments") - }) - } -} -/// The status of the P24 payments capability of the account, or whether the account can directly process P24 charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesP24Payments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesP24Payments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesP24Payments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesP24Payments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesP24Payments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesP24Payments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesP24Payments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesP24Payments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesP24Payments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesP24Payments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesP24Payments") - }) - } -} -/// The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesPaynowPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesPaynowPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesPaynowPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesPaynowPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesPaynowPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesPaynowPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesPaynowPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesPaynowPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesPaynowPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesPaynowPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesPaynowPayments") - }) - } -} -/// The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesPromptpayPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesPromptpayPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesPromptpayPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesPromptpayPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesPromptpayPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesPromptpayPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesPromptpayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesPromptpayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesPromptpayPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesPromptpayPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesPromptpayPayments") - }) - } -} -/// The status of the RevolutPay capability of the account, or whether the account can directly process RevolutPay payments. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesRevolutPayPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesRevolutPayPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesRevolutPayPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesRevolutPayPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesRevolutPayPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesRevolutPayPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesRevolutPayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesRevolutPayPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesRevolutPayPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesRevolutPayPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesRevolutPayPayments") - }) - } -} -/// The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesSepaDebitPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesSepaDebitPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesSepaDebitPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesSepaDebitPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesSepaDebitPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesSepaDebitPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesSepaDebitPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesSepaDebitPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesSepaDebitPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesSepaDebitPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesSepaDebitPayments") - }) - } -} -/// The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesSofortPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesSofortPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesSofortPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesSofortPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesSofortPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesSofortPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesSofortPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesSofortPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesSofortPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesSofortPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesSofortPayments") - }) - } -} -/// The status of the tax reporting 1099-K (US) capability of the account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesTaxReportingUs1099K { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesTaxReportingUs1099K { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesTaxReportingUs1099K::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesTaxReportingUs1099K { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesTaxReportingUs1099K::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesTaxReportingUs1099K { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesTaxReportingUs1099K { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesTaxReportingUs1099K { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesTaxReportingUs1099K { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesTaxReportingUs1099K { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesTaxReportingUs1099K") - }) - } -} -/// The status of the tax reporting 1099-MISC (US) capability of the account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesTaxReportingUs1099Misc { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesTaxReportingUs1099Misc { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesTaxReportingUs1099Misc::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesTaxReportingUs1099Misc { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesTaxReportingUs1099Misc::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesTaxReportingUs1099Misc { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesTaxReportingUs1099Misc { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesTaxReportingUs1099Misc { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesTaxReportingUs1099Misc { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesTaxReportingUs1099Misc { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesTaxReportingUs1099Misc") - }) - } -} -/// The status of the transfers capability of the account, or whether your platform can transfer funds to the account. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesTransfers { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesTransfers { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesTransfers::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesTransfers { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesTransfers::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesTransfers { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesTransfers { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesTransfers { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesTransfers { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesTransfers { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for AccountCapabilitiesTransfers")) - } -} -/// The status of the banking capability, or whether the account can have bank accounts. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesTreasury { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesTreasury { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesTreasury::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesTreasury { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesTreasury::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesTreasury { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesTreasury { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesTreasury { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesTreasury { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesTreasury { +impl<'de> serde::Deserialize<'de> for AccountCapabilitiesStatus { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for AccountCapabilitiesTreasury")) - } -} -/// The status of the US bank account ACH payments capability of the account, or whether the account can directly process US bank account charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesUsBankAccountAchPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesUsBankAccountAchPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesUsBankAccountAchPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesUsBankAccountAchPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesUsBankAccountAchPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesUsBankAccountAchPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesUsBankAccountAchPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesUsBankAccountAchPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesUsBankAccountAchPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesUsBankAccountAchPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom( - "Unknown value for AccountCapabilitiesUsBankAccountAchPayments", - ) - }) - } -} -/// The status of the Zip capability of the account, or whether the account can directly process Zip charges. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum AccountCapabilitiesZipPayments { - Active, - Inactive, - Pending, -} -impl AccountCapabilitiesZipPayments { - pub fn as_str(self) -> &'static str { - use AccountCapabilitiesZipPayments::*; - match self { - Active => "active", - Inactive => "inactive", - Pending => "pending", - } - } -} - -impl std::str::FromStr for AccountCapabilitiesZipPayments { - type Err = (); - fn from_str(s: &str) -> Result { - use AccountCapabilitiesZipPayments::*; - match s { - "active" => Ok(Active), - "inactive" => Ok(Inactive), - "pending" => Ok(Pending), - _ => Err(()), - } - } -} -impl AsRef for AccountCapabilitiesZipPayments { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for AccountCapabilitiesZipPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for AccountCapabilitiesZipPayments { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for AccountCapabilitiesZipPayments { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for AccountCapabilitiesZipPayments { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for AccountCapabilitiesZipPayments") - }) + .map_err(|_| serde::de::Error::custom("Unknown value for AccountCapabilitiesStatus")) } } diff --git a/generated/stripe_shared/src/coupon.rs b/generated/stripe_shared/src/coupon.rs index 1bc2a1f55..50758d074 100644 --- a/generated/stripe_shared/src/coupon.rs +++ b/generated/stripe_shared/src/coupon.rs @@ -23,7 +23,7 @@ pub struct Coupon { >, /// One of `forever`, `once`, and `repeating`. /// Describes how long a customer who applies this coupon will get the discount. - pub duration: CouponDuration, + pub duration: stripe_shared::CouponDuration, /// If `duration` is `repeating`, the number of months the coupon applies. /// Null if coupon `duration` is `forever` or `once`. pub duration_in_months: Option, @@ -48,8 +48,13 @@ pub struct Coupon { /// Taking account of the above properties, whether this coupon can still be applied to a customer. pub valid: bool, } -/// One of `forever`, `once`, and `repeating`. -/// Describes how long a customer who applies this coupon will get the discount. +impl stripe_types::Object for Coupon { + type Id = stripe_shared::CouponId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(CouponId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum CouponDuration { Forever, @@ -110,10 +115,3 @@ impl<'de> serde::Deserialize<'de> for CouponDuration { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for CouponDuration")) } } -impl stripe_types::Object for Coupon { - type Id = stripe_shared::CouponId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(CouponId); diff --git a/generated/stripe_shared/src/credit_note.rs b/generated/stripe_shared/src/credit_note.rs index d578e4a9a..4a8289858 100644 --- a/generated/stripe_shared/src/credit_note.rs +++ b/generated/stripe_shared/src/credit_note.rs @@ -47,7 +47,7 @@ pub struct CreditNote { /// The link to download the PDF of the credit note. pub pdf: String, /// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. - pub reason: Option, + pub reason: Option, /// Refund related to this credit note. pub refund: Option>, /// The details of the cost of shipping, including the ShippingRate applied to the invoice. @@ -73,71 +73,6 @@ pub struct CreditNote { /// The time that the credit note was voided. pub voided_at: Option, } -/// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum CreditNoteReason { - Duplicate, - Fraudulent, - OrderChange, - ProductUnsatisfactory, -} -impl CreditNoteReason { - pub fn as_str(self) -> &'static str { - use CreditNoteReason::*; - match self { - Duplicate => "duplicate", - Fraudulent => "fraudulent", - OrderChange => "order_change", - ProductUnsatisfactory => "product_unsatisfactory", - } - } -} - -impl std::str::FromStr for CreditNoteReason { - type Err = (); - fn from_str(s: &str) -> Result { - use CreditNoteReason::*; - match s { - "duplicate" => Ok(Duplicate), - "fraudulent" => Ok(Fraudulent), - "order_change" => Ok(OrderChange), - "product_unsatisfactory" => Ok(ProductUnsatisfactory), - _ => Err(()), - } - } -} -impl AsRef for CreditNoteReason { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for CreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for CreditNoteReason { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for CreditNoteReason { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for CreditNoteReason { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for CreditNoteReason")) - } -} /// Status of this credit note, one of `issued` or `void`. /// Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). #[derive(Copy, Clone, Eq, PartialEq)] @@ -265,3 +200,67 @@ impl stripe_types::Object for CreditNote { } } stripe_types::def_id!(CreditNoteId, "cn_"); +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum CreditNoteReason { + Duplicate, + Fraudulent, + OrderChange, + ProductUnsatisfactory, +} +impl CreditNoteReason { + pub fn as_str(self) -> &'static str { + use CreditNoteReason::*; + match self { + Duplicate => "duplicate", + Fraudulent => "fraudulent", + OrderChange => "order_change", + ProductUnsatisfactory => "product_unsatisfactory", + } + } +} + +impl std::str::FromStr for CreditNoteReason { + type Err = (); + fn from_str(s: &str) -> Result { + use CreditNoteReason::*; + match s { + "duplicate" => Ok(Duplicate), + "fraudulent" => Ok(Fraudulent), + "order_change" => Ok(OrderChange), + "product_unsatisfactory" => Ok(ProductUnsatisfactory), + _ => Err(()), + } + } +} +impl AsRef for CreditNoteReason { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for CreditNoteReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for CreditNoteReason { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for CreditNoteReason { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +impl<'de> serde::Deserialize<'de> for CreditNoteReason { + fn deserialize>(deserializer: D) -> Result { + use std::str::FromStr; + let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for CreditNoteReason")) + } +} diff --git a/generated/stripe_shared/src/customer.rs b/generated/stripe_shared/src/customer.rs index 51d4de070..e9cb04106 100644 --- a/generated/stripe_shared/src/customer.rs +++ b/generated/stripe_shared/src/customer.rs @@ -94,7 +94,7 @@ pub struct Customer { /// Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. /// When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**. #[serde(skip_serializing_if = "Option::is_none")] - pub tax_exempt: Option, + pub tax_exempt: Option, /// The customer's tax IDs. #[serde(skip_serializing_if = "Option::is_none")] pub tax_ids: Option>, @@ -102,8 +102,13 @@ pub struct Customer { #[serde(skip_serializing_if = "Option::is_none")] pub test_clock: Option>, } -/// Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. -/// When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**. +impl stripe_types::Object for Customer { + type Id = stripe_shared::CustomerId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(CustomerId, "cus_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum CustomerTaxExempt { Exempt, @@ -165,10 +170,3 @@ impl<'de> serde::Deserialize<'de> for CustomerTaxExempt { .map_err(|_| serde::de::Error::custom("Unknown value for CustomerTaxExempt")) } } -impl stripe_types::Object for Customer { - type Id = stripe_shared::CustomerId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(CustomerId, "cus_"); diff --git a/generated/stripe_shared/src/file.rs b/generated/stripe_shared/src/file.rs index 48fab8b4a..770d75e0c 100644 --- a/generated/stripe_shared/src/file.rs +++ b/generated/stripe_shared/src/file.rs @@ -21,7 +21,7 @@ pub struct File { #[serde(skip_serializing_if = "Option::is_none")] pub links: Option>, /// The [purpose](https://stripe.com/docs/file-upload#uploading-a-file) of the uploaded file. - pub purpose: FilePurpose, + pub purpose: stripe_shared::FilePurpose, /// The size of the file object in bytes. pub size: u64, /// A suitable title for the document. @@ -32,7 +32,13 @@ pub struct File { /// Use your live secret API key to download the file from this URL. pub url: Option, } -/// The [purpose](https://stripe.com/docs/file-upload#uploading-a-file) of the uploaded file. +impl stripe_types::Object for File { + type Id = stripe_shared::FileId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(FileId, "file_"); #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum FilePurpose { @@ -133,10 +139,3 @@ impl<'de> serde::Deserialize<'de> for FilePurpose { Ok(Self::from_str(&s).unwrap_or(FilePurpose::Unknown)) } } -impl stripe_types::Object for File { - type Id = stripe_shared::FileId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(FileId, "file_"); diff --git a/generated/stripe_shared/src/invoice.rs b/generated/stripe_shared/src/invoice.rs index 2e9b6d2c6..c68e1e65d 100644 --- a/generated/stripe_shared/src/invoice.rs +++ b/generated/stripe_shared/src/invoice.rs @@ -83,7 +83,7 @@ pub struct Invoice { /// Either `charge_automatically`, or `send_invoice`. /// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. /// When sending an invoice, Stripe will email this invoice to the customer with payment instructions. - pub collection_method: InvoiceCollectionMethod, + pub collection_method: stripe_shared::InvoiceCollectionMethod, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -236,7 +236,7 @@ pub struct Invoice { pub statement_descriptor: Option, /// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. /// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview). - pub status: Option, + pub status: Option, pub status_transitions: stripe_shared::InvoicesStatusTransitions, /// The subscription that this invoice was prepared for, if any. pub subscription: Option>, @@ -361,52 +361,55 @@ impl<'de> serde::Deserialize<'de> for InvoiceBillingReason { .map_err(|_| serde::de::Error::custom("Unknown value for InvoiceBillingReason")) } } -/// Either `charge_automatically`, or `send_invoice`. -/// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. -/// When sending an invoice, Stripe will email this invoice to the customer with payment instructions. +/// The customer's tax exempt status. +/// Until the invoice is finalized, this field will equal `customer.tax_exempt`. +/// Once the invoice is finalized, this field will no longer be updated. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum InvoiceCollectionMethod { - ChargeAutomatically, - SendInvoice, +pub enum InvoiceCustomerTaxExempt { + Exempt, + None, + Reverse, } -impl InvoiceCollectionMethod { +impl InvoiceCustomerTaxExempt { pub fn as_str(self) -> &'static str { - use InvoiceCollectionMethod::*; + use InvoiceCustomerTaxExempt::*; match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", + Exempt => "exempt", + None => "none", + Reverse => "reverse", } } } -impl std::str::FromStr for InvoiceCollectionMethod { +impl std::str::FromStr for InvoiceCustomerTaxExempt { type Err = (); fn from_str(s: &str) -> Result { - use InvoiceCollectionMethod::*; + use InvoiceCustomerTaxExempt::*; match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), + "exempt" => Ok(Exempt), + "none" => Ok(None), + "reverse" => Ok(Reverse), _ => Err(()), } } } -impl AsRef for InvoiceCollectionMethod { +impl AsRef for InvoiceCustomerTaxExempt { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for InvoiceCollectionMethod { +impl std::fmt::Display for InvoiceCustomerTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for InvoiceCollectionMethod { +impl std::fmt::Debug for InvoiceCustomerTaxExempt { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for InvoiceCollectionMethod { +impl serde::Serialize for InvoiceCustomerTaxExempt { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -414,63 +417,64 @@ impl serde::Serialize for InvoiceCollectionMethod { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for InvoiceCollectionMethod { +impl<'de> serde::Deserialize<'de> for InvoiceCustomerTaxExempt { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for InvoiceCollectionMethod")) + .map_err(|_| serde::de::Error::custom("Unknown value for InvoiceCustomerTaxExempt")) } } -/// The customer's tax exempt status. -/// Until the invoice is finalized, this field will equal `customer.tax_exempt`. -/// Once the invoice is finalized, this field will no longer be updated. +impl stripe_types::Object for Invoice { + type Id = Option; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(InvoiceId, "in_"); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum InvoiceCustomerTaxExempt { - Exempt, - None, - Reverse, +pub enum InvoiceCollectionMethod { + ChargeAutomatically, + SendInvoice, } -impl InvoiceCustomerTaxExempt { +impl InvoiceCollectionMethod { pub fn as_str(self) -> &'static str { - use InvoiceCustomerTaxExempt::*; + use InvoiceCollectionMethod::*; match self { - Exempt => "exempt", - None => "none", - Reverse => "reverse", + ChargeAutomatically => "charge_automatically", + SendInvoice => "send_invoice", } } } -impl std::str::FromStr for InvoiceCustomerTaxExempt { +impl std::str::FromStr for InvoiceCollectionMethod { type Err = (); fn from_str(s: &str) -> Result { - use InvoiceCustomerTaxExempt::*; + use InvoiceCollectionMethod::*; match s { - "exempt" => Ok(Exempt), - "none" => Ok(None), - "reverse" => Ok(Reverse), + "charge_automatically" => Ok(ChargeAutomatically), + "send_invoice" => Ok(SendInvoice), _ => Err(()), } } } -impl AsRef for InvoiceCustomerTaxExempt { +impl AsRef for InvoiceCollectionMethod { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for InvoiceCustomerTaxExempt { +impl std::fmt::Display for InvoiceCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for InvoiceCustomerTaxExempt { +impl std::fmt::Debug for InvoiceCollectionMethod { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for InvoiceCustomerTaxExempt { +impl serde::Serialize for InvoiceCollectionMethod { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -478,16 +482,14 @@ impl serde::Serialize for InvoiceCustomerTaxExempt { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for InvoiceCustomerTaxExempt { +impl<'de> serde::Deserialize<'de> for InvoiceCollectionMethod { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for InvoiceCustomerTaxExempt")) + .map_err(|_| serde::de::Error::custom("Unknown value for InvoiceCollectionMethod")) } } -/// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. -/// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview). #[derive(Copy, Clone, Eq, PartialEq)] pub enum InvoiceStatus { Draft, @@ -554,10 +556,3 @@ impl<'de> serde::Deserialize<'de> for InvoiceStatus { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for InvoiceStatus")) } } -impl stripe_types::Object for Invoice { - type Id = Option; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(InvoiceId, "in_"); diff --git a/generated/stripe_shared/src/invoice_payment_method_options_acss_debit.rs b/generated/stripe_shared/src/invoice_payment_method_options_acss_debit.rs index 372794ff4..0b8edaf5d 100644 --- a/generated/stripe_shared/src/invoice_payment_method_options_acss_debit.rs +++ b/generated/stripe_shared/src/invoice_payment_method_options_acss_debit.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct InvoicePaymentMethodOptionsAcssDebit { #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: Option, diff --git a/generated/stripe_shared/src/invoice_payment_method_options_card.rs b/generated/stripe_shared/src/invoice_payment_method_options_card.rs index 46614eafb..bbf9c2773 100644 --- a/generated/stripe_shared/src/invoice_payment_method_options_card.rs +++ b/generated/stripe_shared/src/invoice_payment_method_options_card.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct InvoicePaymentMethodOptionsCard { #[serde(skip_serializing_if = "Option::is_none")] pub installments: Option, diff --git a/generated/stripe_shared/src/issuing_authorization.rs b/generated/stripe_shared/src/issuing_authorization.rs index 8f6075684..149c95001 100644 --- a/generated/stripe_shared/src/issuing_authorization.rs +++ b/generated/stripe_shared/src/issuing_authorization.rs @@ -18,7 +18,7 @@ pub struct IssuingAuthorization { /// Whether the authorization has been approved. pub approved: bool, /// How the card details were provided. - pub authorization_method: IssuingAuthorizationAuthorizationMethod, + pub authorization_method: stripe_shared::IssuingAuthorizationAuthorizationMethod, /// List of balance transactions associated with this authorization. pub balance_transactions: Vec, pub card: stripe_shared::IssuingCard, @@ -59,7 +59,7 @@ pub struct IssuingAuthorization { /// This field can be helpful in determining why a given authorization was approved/declined. pub request_history: Vec, /// The current status of the authorization in its lifecycle. - pub status: IssuingAuthorizationStatus, + pub status: stripe_shared::IssuingAuthorizationStatus, /// [Token](https://stripe.com/docs/api/issuing/tokens/object) object used for this authorization. /// If a network token was not used for this authorization, this field will be null. #[serde(skip_serializing_if = "Option::is_none")] @@ -75,7 +75,13 @@ pub struct IssuingAuthorization { /// Will populate as `null` when no digital wallet was utilized. pub wallet: Option, } -/// How the card details were provided. +impl stripe_types::Object for IssuingAuthorization { + type Id = stripe_shared::IssuingAuthorizationId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IssuingAuthorizationId, "iauth_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingAuthorizationAuthorizationMethod { Chip, @@ -144,7 +150,6 @@ impl<'de> serde::Deserialize<'de> for IssuingAuthorizationAuthorizationMethod { }) } } -/// The current status of the authorization in its lifecycle. #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingAuthorizationStatus { Closed, @@ -206,10 +211,3 @@ impl<'de> serde::Deserialize<'de> for IssuingAuthorizationStatus { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingAuthorizationStatus")) } } -impl stripe_types::Object for IssuingAuthorization { - type Id = stripe_shared::IssuingAuthorizationId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(IssuingAuthorizationId, "iauth_"); diff --git a/generated/stripe_shared/src/issuing_authorization_pending_request.rs b/generated/stripe_shared/src/issuing_authorization_pending_request.rs index 12cfb5412..6f6b1f49f 100644 --- a/generated/stripe_shared/src/issuing_authorization_pending_request.rs +++ b/generated/stripe_shared/src/issuing_authorization_pending_request.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct IssuingAuthorizationPendingRequest { /// The additional amount Stripe will hold if the authorization is approved, in the card's [currency](https://stripe.com/docs/api#issuing_authorization_object-pending-request-currency) and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). pub amount: i64, diff --git a/generated/stripe_shared/src/issuing_card.rs b/generated/stripe_shared/src/issuing_card.rs index c57da099c..1e33e9825 100644 --- a/generated/stripe_shared/src/issuing_card.rs +++ b/generated/stripe_shared/src/issuing_card.rs @@ -44,17 +44,17 @@ pub struct IssuingCard { /// The card this card replaces, if any. pub replacement_for: Option>, /// The reason why the previous card needed to be replaced. - pub replacement_reason: Option, + pub replacement_reason: Option, /// Where and how the card will be shipped. pub shipping: Option, pub spending_controls: stripe_shared::IssuingCardAuthorizationControls, /// Whether authorizations can be approved on this card. /// May be blocked from activating cards depending on past-due Cardholder requirements. /// Defaults to `inactive`. - pub status: IssuingCardStatus, + pub status: stripe_shared::IssuingCardStatus, /// The type of the card. #[serde(rename = "type")] - pub type_: IssuingCardType, + pub type_: stripe_shared::IssuingCardType, /// Information relating to digital wallets (like Apple Pay and Google Pay). pub wallets: Option, } @@ -121,7 +121,13 @@ impl<'de> serde::Deserialize<'de> for IssuingCardCancellationReason { }) } } -/// The reason why the previous card needed to be replaced. +impl stripe_types::Object for IssuingCard { + type Id = stripe_shared::IssuingCardId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IssuingCardId, "ic_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingCardReplacementReason { Damaged, @@ -186,9 +192,6 @@ impl<'de> serde::Deserialize<'de> for IssuingCardReplacementReason { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingCardReplacementReason")) } } -/// Whether authorizations can be approved on this card. -/// May be blocked from activating cards depending on past-due Cardholder requirements. -/// Defaults to `inactive`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingCardStatus { Active, @@ -250,7 +253,6 @@ impl<'de> serde::Deserialize<'de> for IssuingCardStatus { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingCardStatus")) } } -/// The type of the card. #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingCardType { Physical, @@ -309,10 +311,3 @@ impl<'de> serde::Deserialize<'de> for IssuingCardType { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingCardType")) } } -impl stripe_types::Object for IssuingCard { - type Id = stripe_shared::IssuingCardId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(IssuingCardId, "ic_"); diff --git a/generated/stripe_shared/src/issuing_cardholder.rs b/generated/stripe_shared/src/issuing_cardholder.rs index d16d0df26..72c641996 100644 --- a/generated/stripe_shared/src/issuing_cardholder.rs +++ b/generated/stripe_shared/src/issuing_cardholder.rs @@ -30,21 +30,25 @@ pub struct IssuingCardholder { /// The cardholder’s preferred locales (languages), ordered by preference. /// Locales can be `de`, `en`, `es`, `fr`, or `it`. /// This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. - pub preferred_locales: Option>, + pub preferred_locales: Option>, pub requirements: stripe_shared::IssuingCardholderRequirements, /// Rules that control spending across this cardholder's cards. /// Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. pub spending_controls: Option, /// Specifies whether to permit authorizations on this cardholder's cards. - pub status: IssuingCardholderStatus, + pub status: stripe_shared::IssuingCardholderStatus, /// One of `individual` or `company`. /// See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details. #[serde(rename = "type")] - pub type_: IssuingCardholderType, + pub type_: stripe_shared::IssuingCardholderType, } -/// The cardholder’s preferred locales (languages), ordered by preference. -/// Locales can be `de`, `en`, `es`, `fr`, or `it`. -/// This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. +impl stripe_types::Object for IssuingCardholder { + type Id = stripe_shared::IssuingCardholderId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IssuingCardholderId, "ich_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingCardholderPreferredLocales { De, @@ -113,7 +117,6 @@ impl<'de> serde::Deserialize<'de> for IssuingCardholderPreferredLocales { }) } } -/// Specifies whether to permit authorizations on this cardholder's cards. #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingCardholderStatus { Active, @@ -175,8 +178,6 @@ impl<'de> serde::Deserialize<'de> for IssuingCardholderStatus { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingCardholderStatus")) } } -/// One of `individual` or `company`. -/// See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details. #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingCardholderType { Company, @@ -235,10 +236,3 @@ impl<'de> serde::Deserialize<'de> for IssuingCardholderType { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingCardholderType")) } } -impl stripe_types::Object for IssuingCardholder { - type Id = stripe_shared::IssuingCardholderId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(IssuingCardholderId, "ich_"); diff --git a/generated/stripe_shared/src/issuing_dispute.rs b/generated/stripe_shared/src/issuing_dispute.rs index f9dc0e199..66e9fdbbf 100644 --- a/generated/stripe_shared/src/issuing_dispute.rs +++ b/generated/stripe_shared/src/issuing_dispute.rs @@ -23,14 +23,20 @@ pub struct IssuingDispute { /// This can be useful for storing additional information about the object in a structured format. pub metadata: std::collections::HashMap, /// Current status of the dispute. - pub status: IssuingDisputeStatus, + pub status: stripe_shared::IssuingDisputeStatus, /// The transaction being disputed. pub transaction: stripe_types::Expandable, /// [Treasury](https://stripe.com/docs/api/treasury) details related to this dispute if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts. #[serde(skip_serializing_if = "Option::is_none")] pub treasury: Option, } -/// Current status of the dispute. +impl stripe_types::Object for IssuingDispute { + type Id = stripe_shared::IssuingDisputeId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IssuingDisputeId, "idp_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum IssuingDisputeStatus { Expired, @@ -98,10 +104,3 @@ impl<'de> serde::Deserialize<'de> for IssuingDisputeStatus { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingDisputeStatus")) } } -impl stripe_types::Object for IssuingDispute { - type Id = stripe_shared::IssuingDisputeId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(IssuingDisputeId, "idp_"); diff --git a/generated/stripe_shared/src/issuing_token.rs b/generated/stripe_shared/src/issuing_token.rs index 09025e691..08b4e3748 100644 --- a/generated/stripe_shared/src/issuing_token.rs +++ b/generated/stripe_shared/src/issuing_token.rs @@ -25,7 +25,7 @@ pub struct IssuingToken { /// Measured in seconds since the Unix epoch. pub network_updated_at: stripe_types::Timestamp, /// The usage state of the token. - pub status: IssuingTokenStatus, + pub status: stripe_shared::IssuingTokenStatus, /// The digital wallet for this token, if one was used. #[serde(skip_serializing_if = "Option::is_none")] pub wallet_provider: Option, @@ -89,56 +89,53 @@ impl<'de> serde::Deserialize<'de> for IssuingTokenNetwork { .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTokenNetwork")) } } -/// The usage state of the token. +/// The digital wallet for this token, if one was used. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum IssuingTokenStatus { - Active, - Deleted, - Requested, - Suspended, +pub enum IssuingTokenWalletProvider { + ApplePay, + GooglePay, + SamsungPay, } -impl IssuingTokenStatus { +impl IssuingTokenWalletProvider { pub fn as_str(self) -> &'static str { - use IssuingTokenStatus::*; + use IssuingTokenWalletProvider::*; match self { - Active => "active", - Deleted => "deleted", - Requested => "requested", - Suspended => "suspended", + ApplePay => "apple_pay", + GooglePay => "google_pay", + SamsungPay => "samsung_pay", } } } -impl std::str::FromStr for IssuingTokenStatus { +impl std::str::FromStr for IssuingTokenWalletProvider { type Err = (); fn from_str(s: &str) -> Result { - use IssuingTokenStatus::*; + use IssuingTokenWalletProvider::*; match s { - "active" => Ok(Active), - "deleted" => Ok(Deleted), - "requested" => Ok(Requested), - "suspended" => Ok(Suspended), + "apple_pay" => Ok(ApplePay), + "google_pay" => Ok(GooglePay), + "samsung_pay" => Ok(SamsungPay), _ => Err(()), } } } -impl AsRef for IssuingTokenStatus { +impl AsRef for IssuingTokenWalletProvider { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for IssuingTokenStatus { +impl std::fmt::Display for IssuingTokenWalletProvider { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for IssuingTokenStatus { +impl std::fmt::Debug for IssuingTokenWalletProvider { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for IssuingTokenStatus { +impl serde::Serialize for IssuingTokenWalletProvider { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -146,61 +143,70 @@ impl serde::Serialize for IssuingTokenStatus { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for IssuingTokenStatus { +impl<'de> serde::Deserialize<'de> for IssuingTokenWalletProvider { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTokenStatus")) + .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTokenWalletProvider")) } } -/// The digital wallet for this token, if one was used. +impl stripe_types::Object for IssuingToken { + type Id = stripe_shared::IssuingTokenId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IssuingTokenId); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum IssuingTokenWalletProvider { - ApplePay, - GooglePay, - SamsungPay, +pub enum IssuingTokenStatus { + Active, + Deleted, + Requested, + Suspended, } -impl IssuingTokenWalletProvider { +impl IssuingTokenStatus { pub fn as_str(self) -> &'static str { - use IssuingTokenWalletProvider::*; + use IssuingTokenStatus::*; match self { - ApplePay => "apple_pay", - GooglePay => "google_pay", - SamsungPay => "samsung_pay", + Active => "active", + Deleted => "deleted", + Requested => "requested", + Suspended => "suspended", } } } -impl std::str::FromStr for IssuingTokenWalletProvider { +impl std::str::FromStr for IssuingTokenStatus { type Err = (); fn from_str(s: &str) -> Result { - use IssuingTokenWalletProvider::*; + use IssuingTokenStatus::*; match s { - "apple_pay" => Ok(ApplePay), - "google_pay" => Ok(GooglePay), - "samsung_pay" => Ok(SamsungPay), + "active" => Ok(Active), + "deleted" => Ok(Deleted), + "requested" => Ok(Requested), + "suspended" => Ok(Suspended), _ => Err(()), } } } -impl AsRef for IssuingTokenWalletProvider { +impl AsRef for IssuingTokenStatus { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for IssuingTokenWalletProvider { +impl std::fmt::Display for IssuingTokenStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for IssuingTokenWalletProvider { +impl std::fmt::Debug for IssuingTokenStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for IssuingTokenWalletProvider { +impl serde::Serialize for IssuingTokenStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -208,18 +214,11 @@ impl serde::Serialize for IssuingTokenWalletProvider { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for IssuingTokenWalletProvider { +impl<'de> serde::Deserialize<'de> for IssuingTokenStatus { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTokenWalletProvider")) - } -} -impl stripe_types::Object for IssuingToken { - type Id = stripe_shared::IssuingTokenId; - fn id(&self) -> &Self::Id { - &self.id + .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTokenStatus")) } } -stripe_types::def_id!(IssuingTokenId); diff --git a/generated/stripe_shared/src/issuing_transaction.rs b/generated/stripe_shared/src/issuing_transaction.rs index 6991fb7e7..8c515f8af 100644 --- a/generated/stripe_shared/src/issuing_transaction.rs +++ b/generated/stripe_shared/src/issuing_transaction.rs @@ -54,54 +54,57 @@ pub struct IssuingTransaction { pub treasury: Option, /// The nature of the transaction. #[serde(rename = "type")] - pub type_: IssuingTransactionType, + pub type_: stripe_shared::IssuingTransactionType, /// The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. pub wallet: Option, } -/// The nature of the transaction. +/// The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum IssuingTransactionType { - Capture, - Refund, +pub enum IssuingTransactionWallet { + ApplePay, + GooglePay, + SamsungPay, } -impl IssuingTransactionType { +impl IssuingTransactionWallet { pub fn as_str(self) -> &'static str { - use IssuingTransactionType::*; + use IssuingTransactionWallet::*; match self { - Capture => "capture", - Refund => "refund", + ApplePay => "apple_pay", + GooglePay => "google_pay", + SamsungPay => "samsung_pay", } } } -impl std::str::FromStr for IssuingTransactionType { +impl std::str::FromStr for IssuingTransactionWallet { type Err = (); fn from_str(s: &str) -> Result { - use IssuingTransactionType::*; + use IssuingTransactionWallet::*; match s { - "capture" => Ok(Capture), - "refund" => Ok(Refund), + "apple_pay" => Ok(ApplePay), + "google_pay" => Ok(GooglePay), + "samsung_pay" => Ok(SamsungPay), _ => Err(()), } } } -impl AsRef for IssuingTransactionType { +impl AsRef for IssuingTransactionWallet { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for IssuingTransactionType { +impl std::fmt::Display for IssuingTransactionWallet { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for IssuingTransactionType { +impl std::fmt::Debug for IssuingTransactionWallet { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for IssuingTransactionType { +impl serde::Serialize for IssuingTransactionWallet { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -109,61 +112,64 @@ impl serde::Serialize for IssuingTransactionType { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for IssuingTransactionType { +impl<'de> serde::Deserialize<'de> for IssuingTransactionWallet { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTransactionType")) + .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTransactionWallet")) } } -/// The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. +impl stripe_types::Object for IssuingTransaction { + type Id = stripe_shared::IssuingTransactionId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(IssuingTransactionId, "ipi_"); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum IssuingTransactionWallet { - ApplePay, - GooglePay, - SamsungPay, +pub enum IssuingTransactionType { + Capture, + Refund, } -impl IssuingTransactionWallet { +impl IssuingTransactionType { pub fn as_str(self) -> &'static str { - use IssuingTransactionWallet::*; + use IssuingTransactionType::*; match self { - ApplePay => "apple_pay", - GooglePay => "google_pay", - SamsungPay => "samsung_pay", + Capture => "capture", + Refund => "refund", } } } -impl std::str::FromStr for IssuingTransactionWallet { +impl std::str::FromStr for IssuingTransactionType { type Err = (); fn from_str(s: &str) -> Result { - use IssuingTransactionWallet::*; + use IssuingTransactionType::*; match s { - "apple_pay" => Ok(ApplePay), - "google_pay" => Ok(GooglePay), - "samsung_pay" => Ok(SamsungPay), + "capture" => Ok(Capture), + "refund" => Ok(Refund), _ => Err(()), } } } -impl AsRef for IssuingTransactionWallet { +impl AsRef for IssuingTransactionType { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for IssuingTransactionWallet { +impl std::fmt::Display for IssuingTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for IssuingTransactionWallet { +impl std::fmt::Debug for IssuingTransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for IssuingTransactionWallet { +impl serde::Serialize for IssuingTransactionType { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -171,18 +177,11 @@ impl serde::Serialize for IssuingTransactionWallet { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for IssuingTransactionWallet { +impl<'de> serde::Deserialize<'de> for IssuingTransactionType { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTransactionWallet")) - } -} -impl stripe_types::Object for IssuingTransaction { - type Id = stripe_shared::IssuingTransactionId; - fn id(&self) -> &Self::Id { - &self.id + .map_err(|_| serde::de::Error::custom("Unknown value for IssuingTransactionType")) } } -stripe_types::def_id!(IssuingTransactionId, "ipi_"); diff --git a/generated/stripe_shared/src/payment_flows_amount_details.rs b/generated/stripe_shared/src/payment_flows_amount_details.rs index eb8944c59..0ba1b5d1e 100644 --- a/generated/stripe_shared/src/payment_flows_amount_details.rs +++ b/generated/stripe_shared/src/payment_flows_amount_details.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentFlowsAmountDetails { #[serde(skip_serializing_if = "Option::is_none")] pub tip: Option, diff --git a/generated/stripe_shared/src/payment_intent.rs b/generated/stripe_shared/src/payment_intent.rs index f9d2907e3..71c8481c6 100644 --- a/generated/stripe_shared/src/payment_intent.rs +++ b/generated/stripe_shared/src/payment_intent.rs @@ -39,7 +39,7 @@ pub struct PaymentIntent { /// Reason for cancellation of this PaymentIntent, either user-provided (`duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`) or generated by Stripe internally (`failed_invoice`, `void_invoice`, or `automatic`). pub cancellation_reason: Option, /// Controls when the funds will be captured from the customer's account. - pub capture_method: PaymentIntentCaptureMethod, + pub capture_method: stripe_shared::PaymentIntentCaptureMethod, /// The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key. /// /// The client secret can be used to complete a payment from your frontend. @@ -48,7 +48,7 @@ pub struct PaymentIntent { /// /// Refer to our docs to [accept a payment](https://stripe.com/docs/payments/accept-a-payment?ui=elements) and learn about how `client_secret` should be handled. pub client_secret: Option, - pub confirmation_method: PaymentIntentConfirmationMethod, + pub confirmation_method: stripe_shared::PaymentIntentConfirmationMethod, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -104,7 +104,7 @@ pub struct PaymentIntent { /// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. /// /// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). - pub setup_future_usage: Option, + pub setup_future_usage: Option, /// Shipping information for this PaymentIntent. pub shipping: Option, /// This is a legacy field that will be removed in the future. @@ -202,7 +202,88 @@ impl<'de> serde::Deserialize<'de> for PaymentIntentCancellationReason { }) } } -/// Controls when the funds will be captured from the customer's account. +/// Status of this PaymentIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `requires_capture`, `canceled`, or `succeeded`. +/// Read more about each PaymentIntent [status](https://stripe.com/docs/payments/intents#intent-statuses). +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum PaymentIntentStatus { + Canceled, + Processing, + RequiresAction, + RequiresCapture, + RequiresConfirmation, + RequiresPaymentMethod, + Succeeded, +} +impl PaymentIntentStatus { + pub fn as_str(self) -> &'static str { + use PaymentIntentStatus::*; + match self { + Canceled => "canceled", + Processing => "processing", + RequiresAction => "requires_action", + RequiresCapture => "requires_capture", + RequiresConfirmation => "requires_confirmation", + RequiresPaymentMethod => "requires_payment_method", + Succeeded => "succeeded", + } + } +} + +impl std::str::FromStr for PaymentIntentStatus { + type Err = (); + fn from_str(s: &str) -> Result { + use PaymentIntentStatus::*; + match s { + "canceled" => Ok(Canceled), + "processing" => Ok(Processing), + "requires_action" => Ok(RequiresAction), + "requires_capture" => Ok(RequiresCapture), + "requires_confirmation" => Ok(RequiresConfirmation), + "requires_payment_method" => Ok(RequiresPaymentMethod), + "succeeded" => Ok(Succeeded), + _ => Err(()), + } + } +} +impl AsRef for PaymentIntentStatus { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for PaymentIntentStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for PaymentIntentStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for PaymentIntentStatus { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +impl<'de> serde::Deserialize<'de> for PaymentIntentStatus { + fn deserialize>(deserializer: D) -> Result { + use std::str::FromStr; + let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentStatus")) + } +} +impl stripe_types::Object for PaymentIntent { + type Id = stripe_shared::PaymentIntentId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(PaymentIntentId, "pi_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum PaymentIntentCaptureMethod { Automatic, @@ -323,12 +404,6 @@ impl<'de> serde::Deserialize<'de> for PaymentIntentConfirmationMethod { }) } } -/// Indicates that you intend to make future payments with this PaymentIntent's payment method. -/// -/// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. -/// If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. -/// -/// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). #[derive(Copy, Clone, Eq, PartialEq)] pub enum PaymentIntentSetupFutureUsage { OffSession, @@ -388,85 +463,3 @@ impl<'de> serde::Deserialize<'de> for PaymentIntentSetupFutureUsage { }) } } -/// Status of this PaymentIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `requires_capture`, `canceled`, or `succeeded`. -/// Read more about each PaymentIntent [status](https://stripe.com/docs/payments/intents#intent-statuses). -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentIntentStatus { - Canceled, - Processing, - RequiresAction, - RequiresCapture, - RequiresConfirmation, - RequiresPaymentMethod, - Succeeded, -} -impl PaymentIntentStatus { - pub fn as_str(self) -> &'static str { - use PaymentIntentStatus::*; - match self { - Canceled => "canceled", - Processing => "processing", - RequiresAction => "requires_action", - RequiresCapture => "requires_capture", - RequiresConfirmation => "requires_confirmation", - RequiresPaymentMethod => "requires_payment_method", - Succeeded => "succeeded", - } - } -} - -impl std::str::FromStr for PaymentIntentStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use PaymentIntentStatus::*; - match s { - "canceled" => Ok(Canceled), - "processing" => Ok(Processing), - "requires_action" => Ok(RequiresAction), - "requires_capture" => Ok(RequiresCapture), - "requires_confirmation" => Ok(RequiresConfirmation), - "requires_payment_method" => Ok(RequiresPaymentMethod), - "succeeded" => Ok(Succeeded), - _ => Err(()), - } - } -} -impl AsRef for PaymentIntentStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for PaymentIntentStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for PaymentIntentStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for PaymentIntentStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for PaymentIntentStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentStatus")) - } -} -impl stripe_types::Object for PaymentIntent { - type Id = stripe_shared::PaymentIntentId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(PaymentIntentId, "pi_"); diff --git a/generated/stripe_shared/src/payment_intent_card_processing.rs b/generated/stripe_shared/src/payment_intent_card_processing.rs index cb5147c74..1ba024f23 100644 --- a/generated/stripe_shared/src/payment_intent_card_processing.rs +++ b/generated/stripe_shared/src/payment_intent_card_processing.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentIntentCardProcessing { #[serde(skip_serializing_if = "Option::is_none")] pub customer_notification: Option, diff --git a/generated/stripe_shared/src/payment_intent_payment_method_options_sepa_debit.rs b/generated/stripe_shared/src/payment_intent_payment_method_options_sepa_debit.rs index dfee62d00..9f1e82ac6 100644 --- a/generated/stripe_shared/src/payment_intent_payment_method_options_sepa_debit.rs +++ b/generated/stripe_shared/src/payment_intent_payment_method_options_sepa_debit.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentIntentPaymentMethodOptionsSepaDebit { #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: diff --git a/generated/stripe_shared/src/payment_intent_processing.rs b/generated/stripe_shared/src/payment_intent_processing.rs index 4dbbc1b77..54b32cdcb 100644 --- a/generated/stripe_shared/src/payment_intent_processing.rs +++ b/generated/stripe_shared/src/payment_intent_processing.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct PaymentIntentProcessing { #[serde(skip_serializing_if = "Option::is_none")] pub card: Option, diff --git a/generated/stripe_shared/src/payment_link.rs b/generated/stripe_shared/src/payment_link.rs index 3536312de..11dcfb5a9 100644 --- a/generated/stripe_shared/src/payment_link.rs +++ b/generated/stripe_shared/src/payment_link.rs @@ -23,7 +23,7 @@ pub struct PaymentLink { pub application_fee_percent: Option, pub automatic_tax: stripe_shared::PaymentLinksResourceAutomaticTax, /// Configuration for collecting the customer's billing address. - pub billing_address_collection: PaymentLinkBillingAddressCollection, + pub billing_address_collection: stripe_shared::PaymentLinkBillingAddressCollection, /// When set, provides configuration to gather active consent from customers. pub consent_collection: Option, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -56,7 +56,7 @@ pub struct PaymentLink { pub payment_method_collection: PaymentLinkPaymentMethodCollection, /// The list of payment method types that customers can use. /// When `null`, Stripe will dynamically show relevant payment methods you've enabled in your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). - pub payment_method_types: Option>, + pub payment_method_types: Option>, pub phone_number_collection: stripe_shared::PaymentLinksResourcePhoneNumberCollection, /// Configuration for collecting the customer's shipping address. pub shipping_address_collection: @@ -64,7 +64,7 @@ pub struct PaymentLink { /// The shipping rate options applied to the session. pub shipping_options: Vec, /// Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button. - pub submit_type: PaymentLinkSubmitType, + pub submit_type: stripe_shared::PaymentLinkSubmitType, /// When creating a subscription, the specified configuration data will be used. /// There must be at least one line item with a recurring price to use `subscription_data`. pub subscription_data: Option, @@ -74,50 +74,50 @@ pub struct PaymentLink { /// The public URL that can be shared with customers. pub url: String, } -/// Configuration for collecting the customer's billing address. +/// Configuration for Customer creation during checkout. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentLinkBillingAddressCollection { - Auto, - Required, +pub enum PaymentLinkCustomerCreation { + Always, + IfRequired, } -impl PaymentLinkBillingAddressCollection { +impl PaymentLinkCustomerCreation { pub fn as_str(self) -> &'static str { - use PaymentLinkBillingAddressCollection::*; + use PaymentLinkCustomerCreation::*; match self { - Auto => "auto", - Required => "required", + Always => "always", + IfRequired => "if_required", } } } -impl std::str::FromStr for PaymentLinkBillingAddressCollection { +impl std::str::FromStr for PaymentLinkCustomerCreation { type Err = (); fn from_str(s: &str) -> Result { - use PaymentLinkBillingAddressCollection::*; + use PaymentLinkCustomerCreation::*; match s { - "auto" => Ok(Auto), - "required" => Ok(Required), + "always" => Ok(Always), + "if_required" => Ok(IfRequired), _ => Err(()), } } } -impl AsRef for PaymentLinkBillingAddressCollection { +impl AsRef for PaymentLinkCustomerCreation { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for PaymentLinkBillingAddressCollection { +impl std::fmt::Display for PaymentLinkCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for PaymentLinkBillingAddressCollection { +impl std::fmt::Debug for PaymentLinkCustomerCreation { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for PaymentLinkBillingAddressCollection { +impl serde::Serialize for PaymentLinkCustomerCreation { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -125,24 +125,23 @@ impl serde::Serialize for PaymentLinkBillingAddressCollection { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for PaymentLinkBillingAddressCollection { +impl<'de> serde::Deserialize<'de> for PaymentLinkCustomerCreation { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for PaymentLinkBillingAddressCollection") - }) + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for PaymentLinkCustomerCreation")) } } -/// Configuration for Customer creation during checkout. +/// Configuration for collecting a payment method during checkout. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentLinkCustomerCreation { +pub enum PaymentLinkPaymentMethodCollection { Always, IfRequired, } -impl PaymentLinkCustomerCreation { +impl PaymentLinkPaymentMethodCollection { pub fn as_str(self) -> &'static str { - use PaymentLinkCustomerCreation::*; + use PaymentLinkPaymentMethodCollection::*; match self { Always => "always", IfRequired => "if_required", @@ -150,10 +149,10 @@ impl PaymentLinkCustomerCreation { } } -impl std::str::FromStr for PaymentLinkCustomerCreation { +impl std::str::FromStr for PaymentLinkPaymentMethodCollection { type Err = (); fn from_str(s: &str) -> Result { - use PaymentLinkCustomerCreation::*; + use PaymentLinkPaymentMethodCollection::*; match s { "always" => Ok(Always), "if_required" => Ok(IfRequired), @@ -161,23 +160,23 @@ impl std::str::FromStr for PaymentLinkCustomerCreation { } } } -impl AsRef for PaymentLinkCustomerCreation { +impl AsRef for PaymentLinkPaymentMethodCollection { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for PaymentLinkCustomerCreation { +impl std::fmt::Display for PaymentLinkPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for PaymentLinkCustomerCreation { +impl std::fmt::Debug for PaymentLinkPaymentMethodCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for PaymentLinkCustomerCreation { +impl serde::Serialize for PaymentLinkPaymentMethodCollection { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -185,58 +184,65 @@ impl serde::Serialize for PaymentLinkCustomerCreation { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for PaymentLinkCustomerCreation { +impl<'de> serde::Deserialize<'de> for PaymentLinkPaymentMethodCollection { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for PaymentLinkCustomerCreation")) + Self::from_str(&s).map_err(|_| { + serde::de::Error::custom("Unknown value for PaymentLinkPaymentMethodCollection") + }) } } -/// Configuration for collecting a payment method during checkout. +impl stripe_types::Object for PaymentLink { + type Id = stripe_shared::PaymentLinkId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(PaymentLinkId, "plink_"); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum PaymentLinkPaymentMethodCollection { - Always, - IfRequired, +pub enum PaymentLinkBillingAddressCollection { + Auto, + Required, } -impl PaymentLinkPaymentMethodCollection { +impl PaymentLinkBillingAddressCollection { pub fn as_str(self) -> &'static str { - use PaymentLinkPaymentMethodCollection::*; + use PaymentLinkBillingAddressCollection::*; match self { - Always => "always", - IfRequired => "if_required", + Auto => "auto", + Required => "required", } } } -impl std::str::FromStr for PaymentLinkPaymentMethodCollection { +impl std::str::FromStr for PaymentLinkBillingAddressCollection { type Err = (); fn from_str(s: &str) -> Result { - use PaymentLinkPaymentMethodCollection::*; + use PaymentLinkBillingAddressCollection::*; match s { - "always" => Ok(Always), - "if_required" => Ok(IfRequired), + "auto" => Ok(Auto), + "required" => Ok(Required), _ => Err(()), } } } -impl AsRef for PaymentLinkPaymentMethodCollection { +impl AsRef for PaymentLinkBillingAddressCollection { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for PaymentLinkPaymentMethodCollection { +impl std::fmt::Display for PaymentLinkBillingAddressCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for PaymentLinkPaymentMethodCollection { +impl std::fmt::Debug for PaymentLinkBillingAddressCollection { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for PaymentLinkPaymentMethodCollection { +impl serde::Serialize for PaymentLinkBillingAddressCollection { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -244,17 +250,15 @@ impl serde::Serialize for PaymentLinkPaymentMethodCollection { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for PaymentLinkPaymentMethodCollection { +impl<'de> serde::Deserialize<'de> for PaymentLinkBillingAddressCollection { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for PaymentLinkPaymentMethodCollection") + serde::de::Error::custom("Unknown value for PaymentLinkBillingAddressCollection") }) } } -/// The list of payment method types that customers can use. -/// When `null`, Stripe will dynamically show relevant payment methods you've enabled in your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum PaymentLinkPaymentMethodTypes { @@ -394,7 +398,6 @@ impl<'de> serde::Deserialize<'de> for PaymentLinkPaymentMethodTypes { Ok(Self::from_str(&s).unwrap_or(PaymentLinkPaymentMethodTypes::Unknown)) } } -/// Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PaymentLinkSubmitType { Auto, @@ -459,10 +462,3 @@ impl<'de> serde::Deserialize<'de> for PaymentLinkSubmitType { .map_err(|_| serde::de::Error::custom("Unknown value for PaymentLinkSubmitType")) } } -impl stripe_types::Object for PaymentLink { - type Id = stripe_shared::PaymentLinkId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(PaymentLinkId, "plink_"); diff --git a/generated/stripe_shared/src/payment_method_details_card_installments.rs b/generated/stripe_shared/src/payment_method_details_card_installments.rs index edea2c197..45ddbf0f4 100644 --- a/generated/stripe_shared/src/payment_method_details_card_installments.rs +++ b/generated/stripe_shared/src/payment_method_details_card_installments.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodDetailsCardInstallments { /// Installment plan selected for the payment. pub plan: Option, diff --git a/generated/stripe_shared/src/payment_method_details_konbini.rs b/generated/stripe_shared/src/payment_method_details_konbini.rs index 305fa21cf..8c4c05f1b 100644 --- a/generated/stripe_shared/src/payment_method_details_konbini.rs +++ b/generated/stripe_shared/src/payment_method_details_konbini.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodDetailsKonbini { /// If the payment succeeded, this contains the details of the convenience store where the payment was completed. pub store: Option, diff --git a/generated/stripe_shared/src/payment_method_klarna.rs b/generated/stripe_shared/src/payment_method_klarna.rs index d29e328c6..310d1c2b1 100644 --- a/generated/stripe_shared/src/payment_method_klarna.rs +++ b/generated/stripe_shared/src/payment_method_klarna.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodKlarna { /// The customer's date of birth, if provided. pub dob: Option, diff --git a/generated/stripe_shared/src/payment_method_us_bank_account_status_details.rs b/generated/stripe_shared/src/payment_method_us_bank_account_status_details.rs index 73df8f388..c721bac94 100644 --- a/generated/stripe_shared/src/payment_method_us_bank_account_status_details.rs +++ b/generated/stripe_shared/src/payment_method_us_bank_account_status_details.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodUsBankAccountStatusDetails { #[serde(skip_serializing_if = "Option::is_none")] pub blocked: Option, diff --git a/generated/stripe_shared/src/plan.rs b/generated/stripe_shared/src/plan.rs index 4624b3164..b58a786b8 100644 --- a/generated/stripe_shared/src/plan.rs +++ b/generated/stripe_shared/src/plan.rs @@ -18,7 +18,7 @@ pub struct Plan { /// Specifies a usage aggregation strategy for plans of `usage_type=metered`. /// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. /// Defaults to `sum`. - pub aggregate_usage: Option, + pub aggregate_usage: Option, /// The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. /// Only set if `billing_scheme=per_unit`. pub amount: Option, @@ -29,7 +29,7 @@ pub struct Plan { /// Either `per_unit` or `tiered`. /// `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). /// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. - pub billing_scheme: PlanBillingScheme, + pub billing_scheme: stripe_shared::PlanBillingScheme, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -38,7 +38,7 @@ pub struct Plan { /// Unique identifier for the object. pub id: stripe_shared::PlanId, /// The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. - pub interval: PlanInterval, + pub interval: stripe_shared::PlanInterval, /// 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, @@ -59,7 +59,7 @@ pub struct Plan { /// Defines if the tiering price should be `graduated` or `volume` based. /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price. /// In `graduated` tiering, pricing can change as the quantity grows. - pub tiers_mode: Option, + pub tiers_mode: Option, /// Apply a transformation to the reported usage or set quantity before computing the amount billed. /// Cannot be combined with `tiers`. pub transform_usage: Option, @@ -70,11 +70,15 @@ pub struct Plan { /// `licensed` automatically bills the `quantity` set when adding it to a subscription. /// `metered` aggregates the total usage based on usage records. /// Defaults to `licensed`. - pub usage_type: PlanUsageType, + pub usage_type: stripe_shared::PlanUsageType, } -/// Specifies a usage aggregation strategy for plans of `usage_type=metered`. -/// Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. -/// Defaults to `sum`. +impl stripe_types::Object for Plan { + type Id = stripe_shared::PlanId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(PlanId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum PlanAggregateUsage { LastDuringPeriod, @@ -139,10 +143,6 @@ impl<'de> serde::Deserialize<'de> for PlanAggregateUsage { .map_err(|_| serde::de::Error::custom("Unknown value for PlanAggregateUsage")) } } -/// Describes how to compute the price per period. -/// Either `per_unit` or `tiered`. -/// `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). -/// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PlanBillingScheme { PerUnit, @@ -201,7 +201,6 @@ impl<'de> serde::Deserialize<'de> for PlanBillingScheme { .map_err(|_| serde::de::Error::custom("Unknown value for PlanBillingScheme")) } } -/// The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PlanInterval { Day, @@ -265,9 +264,6 @@ impl<'de> serde::Deserialize<'de> for PlanInterval { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PlanInterval")) } } -/// Defines if the tiering price should be `graduated` or `volume` based. -/// In `volume`-based tiering, the maximum quantity within a period determines the per unit price. -/// In `graduated` tiering, pricing can change as the quantity grows. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PlanTiersMode { Graduated, @@ -325,11 +321,6 @@ impl<'de> serde::Deserialize<'de> for PlanTiersMode { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PlanTiersMode")) } } -/// Configures how the quantity per period should be determined. -/// Can be either `metered` or `licensed`. -/// `licensed` automatically bills the `quantity` set when adding it to a subscription. -/// `metered` aggregates the total usage based on usage records. -/// Defaults to `licensed`. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PlanUsageType { Licensed, @@ -387,10 +378,3 @@ impl<'de> serde::Deserialize<'de> for PlanUsageType { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PlanUsageType")) } } -impl stripe_types::Object for Plan { - type Id = stripe_shared::PlanId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(PlanId); diff --git a/generated/stripe_shared/src/price.rs b/generated/stripe_shared/src/price.rs index 317d3c91d..345a63663 100644 --- a/generated/stripe_shared/src/price.rs +++ b/generated/stripe_shared/src/price.rs @@ -16,7 +16,7 @@ pub struct Price { /// Either `per_unit` or `tiered`. /// `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). /// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. - pub billing_scheme: PriceBillingScheme, + pub billing_scheme: stripe_shared::PriceBillingScheme, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -49,7 +49,7 @@ pub struct Price { /// 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. - pub tax_behavior: Option, + pub tax_behavior: Option, /// Each element represents a pricing tier. /// This parameter requires `billing_scheme` to be set to `tiered`. /// See also the documentation for `billing_scheme`. @@ -58,13 +58,13 @@ pub struct Price { /// Defines if the tiering price should be `graduated` or `volume` based. /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price. /// In `graduated` tiering, pricing can change as the quantity grows. - pub tiers_mode: Option, + pub tiers_mode: Option, /// Apply a transformation to the reported usage or set quantity before computing the amount billed. /// Cannot be combined with `tiers`. pub transform_quantity: Option, /// One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. #[serde(rename = "type")] - pub type_: PriceType, + pub type_: stripe_shared::PriceType, /// The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. /// Only set if `billing_scheme=per_unit`. pub unit_amount: Option, @@ -72,10 +72,13 @@ pub struct Price { /// Only set if `billing_scheme=per_unit`. pub unit_amount_decimal: Option, } -/// Describes how to compute the price per period. -/// Either `per_unit` or `tiered`. -/// `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). -/// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. +impl stripe_types::Object for Price { + type Id = stripe_shared::PriceId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(PriceId, "price_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum PriceBillingScheme { PerUnit, @@ -134,10 +137,6 @@ impl<'de> serde::Deserialize<'de> for PriceBillingScheme { .map_err(|_| serde::de::Error::custom("Unknown value for PriceBillingScheme")) } } -/// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. -/// 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. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PriceTaxBehavior { Exclusive, @@ -199,9 +198,6 @@ impl<'de> serde::Deserialize<'de> for PriceTaxBehavior { .map_err(|_| serde::de::Error::custom("Unknown value for PriceTaxBehavior")) } } -/// Defines if the tiering price should be `graduated` or `volume` based. -/// In `volume`-based tiering, the maximum quantity within a period determines the per unit price. -/// In `graduated` tiering, pricing can change as the quantity grows. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PriceTiersMode { Graduated, @@ -259,7 +255,6 @@ impl<'de> serde::Deserialize<'de> for PriceTiersMode { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PriceTiersMode")) } } -/// One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. #[derive(Copy, Clone, Eq, PartialEq)] pub enum PriceType { OneTime, @@ -317,10 +312,3 @@ impl<'de> serde::Deserialize<'de> for PriceType { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PriceType")) } } -impl stripe_types::Object for Price { - type Id = stripe_shared::PriceId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(PriceId, "price_"); diff --git a/generated/stripe_shared/src/product.rs b/generated/stripe_shared/src/product.rs index 9cfa7e5ba..e3dbf6195 100644 --- a/generated/stripe_shared/src/product.rs +++ b/generated/stripe_shared/src/product.rs @@ -47,7 +47,7 @@ pub struct Product { /// The type of the product. /// The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans. #[serde(rename = "type")] - pub type_: ProductType, + pub type_: stripe_shared::ProductType, /// A label that represents units of this product. /// When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. #[serde(skip_serializing_if = "Option::is_none")] @@ -57,8 +57,13 @@ pub struct Product { /// A URL of a publicly-accessible webpage for this product. pub url: Option, } -/// The type of the product. -/// The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans. +impl stripe_types::Object for Product { + type Id = stripe_shared::ProductId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(ProductId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum ProductType { Good, @@ -116,10 +121,3 @@ impl<'de> serde::Deserialize<'de> for ProductType { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for ProductType")) } } -impl stripe_types::Object for Product { - type Id = stripe_shared::ProductId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(ProductId); diff --git a/generated/stripe_shared/src/quote.rs b/generated/stripe_shared/src/quote.rs index b73708f91..e86e8d335 100644 --- a/generated/stripe_shared/src/quote.rs +++ b/generated/stripe_shared/src/quote.rs @@ -22,7 +22,7 @@ pub struct Quote { /// 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 and mark the subscription as `active`. /// Defaults to `charge_automatically`. - pub collection_method: QuoteCollectionMethod, + pub collection_method: stripe_shared::QuoteCollectionMethod, pub computed: stripe_shared::QuotesResourceComputed, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, @@ -71,7 +71,7 @@ pub struct Quote { /// See the [Connect documentation](https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details. pub on_behalf_of: Option>, /// The status of the quote. - pub status: QuoteStatus, + pub status: stripe_shared::QuoteStatus, pub status_transitions: stripe_shared::QuotesResourceStatusTransitions, /// The subscription that was created or updated from this quote. pub subscription: Option>, @@ -85,10 +85,13 @@ pub struct Quote { /// 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. pub transfer_data: Option, } -/// 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 and mark the subscription as `active`. -/// Defaults to `charge_automatically`. +impl stripe_types::Object for Quote { + type Id = stripe_shared::QuoteId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(QuoteId, "qt_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum QuoteCollectionMethod { ChargeAutomatically, @@ -147,7 +150,6 @@ impl<'de> serde::Deserialize<'de> for QuoteCollectionMethod { .map_err(|_| serde::de::Error::custom("Unknown value for QuoteCollectionMethod")) } } -/// The status of the quote. #[derive(Copy, Clone, Eq, PartialEq)] pub enum QuoteStatus { Accepted, @@ -211,10 +213,3 @@ impl<'de> serde::Deserialize<'de> for QuoteStatus { Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for QuoteStatus")) } } -impl stripe_types::Object for Quote { - type Id = stripe_shared::QuoteId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(QuoteId, "qt_"); diff --git a/generated/stripe_shared/src/setup_attempt_payment_method_details_card_wallet.rs b/generated/stripe_shared/src/setup_attempt_payment_method_details_card_wallet.rs index 28cea9b39..c133b7238 100644 --- a/generated/stripe_shared/src/setup_attempt_payment_method_details_card_wallet.rs +++ b/generated/stripe_shared/src/setup_attempt_payment_method_details_card_wallet.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct SetupAttemptPaymentMethodDetailsCardWallet { #[serde(skip_serializing_if = "Option::is_none")] pub apple_pay: Option, diff --git a/generated/stripe_shared/src/setup_intent.rs b/generated/stripe_shared/src/setup_intent.rs index 1c3b3d24b..e030c5837 100644 --- a/generated/stripe_shared/src/setup_intent.rs +++ b/generated/stripe_shared/src/setup_intent.rs @@ -35,7 +35,7 @@ pub struct SetupIntent { pub automatic_payment_methods: Option, /// Reason for cancellation of this SetupIntent, one of `abandoned`, `requested_by_customer`, or `duplicate`. - pub cancellation_reason: Option, + pub cancellation_reason: Option, /// The client secret of this SetupIntent. Used for client-side retrieval using a publishable key. /// /// The client secret can be used to complete payment setup from your frontend. @@ -56,7 +56,7 @@ pub struct SetupIntent { /// Include `inbound` if you intend to use the payment method as the origin to pull funds from. /// Include `outbound` if you intend to use the payment method as the destination to send funds to. /// You can include both if you intend to use the payment method for both purposes. - pub flow_directions: Option>, + pub flow_directions: Option>, /// Unique identifier for the object. pub id: stripe_shared::SetupIntentId, /// The error encountered in the previous SetupIntent confirmation. @@ -94,53 +94,62 @@ pub struct SetupIntent { /// If not provided, this value defaults to `off_session`. pub usage: String, } -/// Reason for cancellation of this SetupIntent, one of `abandoned`, `requested_by_customer`, or `duplicate`. +/// [Status](https://stripe.com/docs/payments/intents#intent-statuses) of this SetupIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `canceled`, or `succeeded`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum SetupIntentCancellationReason { - Abandoned, - Duplicate, - RequestedByCustomer, +pub enum SetupIntentStatus { + Canceled, + Processing, + RequiresAction, + RequiresConfirmation, + RequiresPaymentMethod, + Succeeded, } -impl SetupIntentCancellationReason { +impl SetupIntentStatus { pub fn as_str(self) -> &'static str { - use SetupIntentCancellationReason::*; + use SetupIntentStatus::*; match self { - Abandoned => "abandoned", - Duplicate => "duplicate", - RequestedByCustomer => "requested_by_customer", + Canceled => "canceled", + Processing => "processing", + RequiresAction => "requires_action", + RequiresConfirmation => "requires_confirmation", + RequiresPaymentMethod => "requires_payment_method", + Succeeded => "succeeded", } } } -impl std::str::FromStr for SetupIntentCancellationReason { +impl std::str::FromStr for SetupIntentStatus { type Err = (); fn from_str(s: &str) -> Result { - use SetupIntentCancellationReason::*; + use SetupIntentStatus::*; match s { - "abandoned" => Ok(Abandoned), - "duplicate" => Ok(Duplicate), - "requested_by_customer" => Ok(RequestedByCustomer), + "canceled" => Ok(Canceled), + "processing" => Ok(Processing), + "requires_action" => Ok(RequiresAction), + "requires_confirmation" => Ok(RequiresConfirmation), + "requires_payment_method" => Ok(RequiresPaymentMethod), + "succeeded" => Ok(Succeeded), _ => Err(()), } } } -impl AsRef for SetupIntentCancellationReason { +impl AsRef for SetupIntentStatus { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for SetupIntentCancellationReason { +impl std::fmt::Display for SetupIntentStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for SetupIntentCancellationReason { +impl std::fmt::Debug for SetupIntentStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for SetupIntentCancellationReason { +impl serde::Serialize for SetupIntentStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -148,63 +157,67 @@ impl serde::Serialize for SetupIntentCancellationReason { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for SetupIntentCancellationReason { +impl<'de> serde::Deserialize<'de> for SetupIntentStatus { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for SetupIntentCancellationReason") - }) + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for SetupIntentStatus")) } } -/// Indicates the directions of money movement for which this payment method is intended to be used. -/// -/// Include `inbound` if you intend to use the payment method as the origin to pull funds from. -/// Include `outbound` if you intend to use the payment method as the destination to send funds to. -/// You can include both if you intend to use the payment method for both purposes. +impl stripe_types::Object for SetupIntent { + type Id = stripe_shared::SetupIntentId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(SetupIntentId, "seti_"); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum SetupIntentFlowDirections { - Inbound, - Outbound, +pub enum SetupIntentCancellationReason { + Abandoned, + Duplicate, + RequestedByCustomer, } -impl SetupIntentFlowDirections { +impl SetupIntentCancellationReason { pub fn as_str(self) -> &'static str { - use SetupIntentFlowDirections::*; + use SetupIntentCancellationReason::*; match self { - Inbound => "inbound", - Outbound => "outbound", + Abandoned => "abandoned", + Duplicate => "duplicate", + RequestedByCustomer => "requested_by_customer", } } } -impl std::str::FromStr for SetupIntentFlowDirections { +impl std::str::FromStr for SetupIntentCancellationReason { type Err = (); fn from_str(s: &str) -> Result { - use SetupIntentFlowDirections::*; + use SetupIntentCancellationReason::*; match s { - "inbound" => Ok(Inbound), - "outbound" => Ok(Outbound), + "abandoned" => Ok(Abandoned), + "duplicate" => Ok(Duplicate), + "requested_by_customer" => Ok(RequestedByCustomer), _ => Err(()), } } } -impl AsRef for SetupIntentFlowDirections { +impl AsRef for SetupIntentCancellationReason { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for SetupIntentFlowDirections { +impl std::fmt::Display for SetupIntentCancellationReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for SetupIntentFlowDirections { +impl std::fmt::Debug for SetupIntentCancellationReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for SetupIntentFlowDirections { +impl serde::Serialize for SetupIntentCancellationReason { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -212,70 +225,58 @@ impl serde::Serialize for SetupIntentFlowDirections { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for SetupIntentFlowDirections { +impl<'de> serde::Deserialize<'de> for SetupIntentCancellationReason { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for SetupIntentFlowDirections")) + Self::from_str(&s).map_err(|_| { + serde::de::Error::custom("Unknown value for SetupIntentCancellationReason") + }) } } -/// [Status](https://stripe.com/docs/payments/intents#intent-statuses) of this SetupIntent, one of `requires_payment_method`, `requires_confirmation`, `requires_action`, `processing`, `canceled`, or `succeeded`. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum SetupIntentStatus { - Canceled, - Processing, - RequiresAction, - RequiresConfirmation, - RequiresPaymentMethod, - Succeeded, +pub enum SetupIntentFlowDirections { + Inbound, + Outbound, } -impl SetupIntentStatus { +impl SetupIntentFlowDirections { pub fn as_str(self) -> &'static str { - use SetupIntentStatus::*; + use SetupIntentFlowDirections::*; match self { - Canceled => "canceled", - Processing => "processing", - RequiresAction => "requires_action", - RequiresConfirmation => "requires_confirmation", - RequiresPaymentMethod => "requires_payment_method", - Succeeded => "succeeded", + Inbound => "inbound", + Outbound => "outbound", } } } -impl std::str::FromStr for SetupIntentStatus { +impl std::str::FromStr for SetupIntentFlowDirections { type Err = (); fn from_str(s: &str) -> Result { - use SetupIntentStatus::*; + use SetupIntentFlowDirections::*; match s { - "canceled" => Ok(Canceled), - "processing" => Ok(Processing), - "requires_action" => Ok(RequiresAction), - "requires_confirmation" => Ok(RequiresConfirmation), - "requires_payment_method" => Ok(RequiresPaymentMethod), - "succeeded" => Ok(Succeeded), + "inbound" => Ok(Inbound), + "outbound" => Ok(Outbound), _ => Err(()), } } } -impl AsRef for SetupIntentStatus { +impl AsRef for SetupIntentFlowDirections { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for SetupIntentStatus { +impl std::fmt::Display for SetupIntentFlowDirections { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for SetupIntentStatus { +impl std::fmt::Debug for SetupIntentFlowDirections { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for SetupIntentStatus { +impl serde::Serialize for SetupIntentFlowDirections { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -283,18 +284,11 @@ impl serde::Serialize for SetupIntentStatus { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for SetupIntentStatus { +impl<'de> serde::Deserialize<'de> for SetupIntentFlowDirections { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for SetupIntentStatus")) - } -} -impl stripe_types::Object for SetupIntent { - type Id = stripe_shared::SetupIntentId; - fn id(&self) -> &Self::Id { - &self.id + .map_err(|_| serde::de::Error::custom("Unknown value for SetupIntentFlowDirections")) } } -stripe_types::def_id!(SetupIntentId, "seti_"); diff --git a/generated/stripe_shared/src/setup_intent_payment_method_options_sepa_debit.rs b/generated/stripe_shared/src/setup_intent_payment_method_options_sepa_debit.rs index 557f66c5d..57fb0d3e5 100644 --- a/generated/stripe_shared/src/setup_intent_payment_method_options_sepa_debit.rs +++ b/generated/stripe_shared/src/setup_intent_payment_method_options_sepa_debit.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct SetupIntentPaymentMethodOptionsSepaDebit { #[serde(skip_serializing_if = "Option::is_none")] pub mandate_options: diff --git a/generated/stripe_shared/src/shipping_rate.rs b/generated/stripe_shared/src/shipping_rate.rs index 10a0da4bf..e42cccab9 100644 --- a/generated/stripe_shared/src/shipping_rate.rs +++ b/generated/stripe_shared/src/shipping_rate.rs @@ -26,16 +26,21 @@ pub struct ShippingRate { pub metadata: std::collections::HashMap, /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. /// One of `inclusive`, `exclusive`, or `unspecified`. - pub tax_behavior: Option, + pub tax_behavior: Option, /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID. /// The Shipping tax code is `txcd_92010001`. pub tax_code: Option>, /// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[serde(rename = "type")] - pub type_: ShippingRateType, + pub type_: stripe_shared::ShippingRateType, } -/// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. -/// One of `inclusive`, `exclusive`, or `unspecified`. +impl stripe_types::Object for ShippingRate { + type Id = stripe_shared::ShippingRateId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(ShippingRateId, "shr_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum ShippingRateTaxBehavior { Exclusive, @@ -97,7 +102,6 @@ impl<'de> serde::Deserialize<'de> for ShippingRateTaxBehavior { .map_err(|_| serde::de::Error::custom("Unknown value for ShippingRateTaxBehavior")) } } -/// The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now. #[derive(Copy, Clone, Eq, PartialEq)] pub enum ShippingRateType { FixedAmount, @@ -153,10 +157,3 @@ impl<'de> serde::Deserialize<'de> for ShippingRateType { .map_err(|_| serde::de::Error::custom("Unknown value for ShippingRateType")) } } -impl stripe_types::Object for ShippingRate { - type Id = stripe_shared::ShippingRateId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(ShippingRateId, "shr_"); diff --git a/generated/stripe_shared/src/shipping_rate_delivery_estimate.rs b/generated/stripe_shared/src/shipping_rate_delivery_estimate.rs index 08d849dfd..16875264f 100644 --- a/generated/stripe_shared/src/shipping_rate_delivery_estimate.rs +++ b/generated/stripe_shared/src/shipping_rate_delivery_estimate.rs @@ -1,4 +1,4 @@ -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct ShippingRateDeliveryEstimate { /// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. pub maximum: Option, diff --git a/generated/stripe_shared/src/subscription.rs b/generated/stripe_shared/src/subscription.rs index 923bd9ba4..ceb5ce379 100644 --- a/generated/stripe_shared/src/subscription.rs +++ b/generated/stripe_shared/src/subscription.rs @@ -29,7 +29,7 @@ pub struct Subscription { /// Either `charge_automatically`, or `send_invoice`. /// 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 and mark the subscription as `active`. - pub collection_method: SubscriptionCollectionMethod, + pub collection_method: stripe_shared::SubscriptionCollectionMethod, /// Time at which the object was created. Measured in seconds since the Unix epoch. pub created: stripe_types::Timestamp, /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. @@ -133,67 +133,6 @@ pub struct Subscription { /// If the subscription has a trial, the beginning of that trial. pub trial_start: Option, } -/// Either `charge_automatically`, or `send_invoice`. -/// 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 and mark the subscription as `active`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum SubscriptionCollectionMethod { - ChargeAutomatically, - SendInvoice, -} -impl SubscriptionCollectionMethod { - pub fn as_str(self) -> &'static str { - use SubscriptionCollectionMethod::*; - match self { - ChargeAutomatically => "charge_automatically", - SendInvoice => "send_invoice", - } - } -} - -impl std::str::FromStr for SubscriptionCollectionMethod { - type Err = (); - fn from_str(s: &str) -> Result { - use SubscriptionCollectionMethod::*; - match s { - "charge_automatically" => Ok(ChargeAutomatically), - "send_invoice" => Ok(SendInvoice), - _ => Err(()), - } - } -} -impl AsRef for SubscriptionCollectionMethod { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for SubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for SubscriptionCollectionMethod { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for SubscriptionCollectionMethod { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for SubscriptionCollectionMethod { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for SubscriptionCollectionMethod")) - } -} /// Possible values are `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, or `unpaid`. /// /// @@ -297,3 +236,61 @@ impl stripe_types::Object for Subscription { } } stripe_types::def_id!(SubscriptionId, "sub_"); +#[derive(Copy, Clone, Eq, PartialEq)] +pub enum SubscriptionCollectionMethod { + ChargeAutomatically, + SendInvoice, +} +impl SubscriptionCollectionMethod { + pub fn as_str(self) -> &'static str { + use SubscriptionCollectionMethod::*; + match self { + ChargeAutomatically => "charge_automatically", + SendInvoice => "send_invoice", + } + } +} + +impl std::str::FromStr for SubscriptionCollectionMethod { + type Err = (); + fn from_str(s: &str) -> Result { + use SubscriptionCollectionMethod::*; + match s { + "charge_automatically" => Ok(ChargeAutomatically), + "send_invoice" => Ok(SendInvoice), + _ => Err(()), + } + } +} +impl AsRef for SubscriptionCollectionMethod { + fn as_ref(&self) -> &str { + self.as_str() + } +} +impl std::fmt::Display for SubscriptionCollectionMethod { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +impl std::fmt::Debug for SubscriptionCollectionMethod { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} +impl serde::Serialize for SubscriptionCollectionMethod { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(self.as_str()) + } +} +impl<'de> serde::Deserialize<'de> for SubscriptionCollectionMethod { + fn deserialize>(deserializer: D) -> Result { + use std::str::FromStr; + let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for SubscriptionCollectionMethod")) + } +} diff --git a/generated/stripe_shared/src/subscription_schedule.rs b/generated/stripe_shared/src/subscription_schedule.rs index 9a495ab1a..e443ed53f 100644 --- a/generated/stripe_shared/src/subscription_schedule.rs +++ b/generated/stripe_shared/src/subscription_schedule.rs @@ -21,7 +21,7 @@ pub struct SubscriptionSchedule { /// Behavior of the subscription schedule and underlying subscription when it ends. /// Possible values are `release` or `cancel` with the default being `release`. /// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. - pub end_behavior: SubscriptionScheduleEndBehavior, + pub end_behavior: stripe_shared::SubscriptionScheduleEndBehavior, /// Unique identifier for the object. pub id: stripe_shared::SubscriptionScheduleId, /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. @@ -44,58 +44,61 @@ pub struct SubscriptionSchedule { /// ID of the test clock this subscription schedule belongs to. pub test_clock: Option>, } -/// Behavior of the subscription schedule and underlying subscription when it ends. -/// Possible values are `release` or `cancel` with the default being `release`. -/// `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. +/// The present status of the subscription schedule. +/// Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. +/// You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules). #[derive(Copy, Clone, Eq, PartialEq)] -pub enum SubscriptionScheduleEndBehavior { - Cancel, - None, - Release, - Renew, +pub enum SubscriptionScheduleStatus { + Active, + Canceled, + Completed, + NotStarted, + Released, } -impl SubscriptionScheduleEndBehavior { +impl SubscriptionScheduleStatus { pub fn as_str(self) -> &'static str { - use SubscriptionScheduleEndBehavior::*; + use SubscriptionScheduleStatus::*; match self { - Cancel => "cancel", - None => "none", - Release => "release", - Renew => "renew", + Active => "active", + Canceled => "canceled", + Completed => "completed", + NotStarted => "not_started", + Released => "released", } } } -impl std::str::FromStr for SubscriptionScheduleEndBehavior { +impl std::str::FromStr for SubscriptionScheduleStatus { type Err = (); fn from_str(s: &str) -> Result { - use SubscriptionScheduleEndBehavior::*; + use SubscriptionScheduleStatus::*; match s { - "cancel" => Ok(Cancel), - "none" => Ok(None), - "release" => Ok(Release), - "renew" => Ok(Renew), + "active" => Ok(Active), + "canceled" => Ok(Canceled), + "completed" => Ok(Completed), + "not_started" => Ok(NotStarted), + "released" => Ok(Released), _ => Err(()), } } } -impl AsRef for SubscriptionScheduleEndBehavior { +impl AsRef for SubscriptionScheduleStatus { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for SubscriptionScheduleEndBehavior { +impl std::fmt::Display for SubscriptionScheduleStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for SubscriptionScheduleEndBehavior { +impl std::fmt::Debug for SubscriptionScheduleStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for SubscriptionScheduleEndBehavior { +impl serde::Serialize for SubscriptionScheduleStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -103,70 +106,70 @@ impl serde::Serialize for SubscriptionScheduleEndBehavior { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for SubscriptionScheduleEndBehavior { +impl<'de> serde::Deserialize<'de> for SubscriptionScheduleStatus { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for SubscriptionScheduleEndBehavior") - }) + Self::from_str(&s) + .map_err(|_| serde::de::Error::custom("Unknown value for SubscriptionScheduleStatus")) } } -/// The present status of the subscription schedule. -/// Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`. -/// You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules). +impl stripe_types::Object for SubscriptionSchedule { + type Id = stripe_shared::SubscriptionScheduleId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(SubscriptionScheduleId, "sub_sched_"); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum SubscriptionScheduleStatus { - Active, - Canceled, - Completed, - NotStarted, - Released, +pub enum SubscriptionScheduleEndBehavior { + Cancel, + None, + Release, + Renew, } -impl SubscriptionScheduleStatus { +impl SubscriptionScheduleEndBehavior { pub fn as_str(self) -> &'static str { - use SubscriptionScheduleStatus::*; + use SubscriptionScheduleEndBehavior::*; match self { - Active => "active", - Canceled => "canceled", - Completed => "completed", - NotStarted => "not_started", - Released => "released", + Cancel => "cancel", + None => "none", + Release => "release", + Renew => "renew", } } } -impl std::str::FromStr for SubscriptionScheduleStatus { +impl std::str::FromStr for SubscriptionScheduleEndBehavior { type Err = (); fn from_str(s: &str) -> Result { - use SubscriptionScheduleStatus::*; + use SubscriptionScheduleEndBehavior::*; match s { - "active" => Ok(Active), - "canceled" => Ok(Canceled), - "completed" => Ok(Completed), - "not_started" => Ok(NotStarted), - "released" => Ok(Released), + "cancel" => Ok(Cancel), + "none" => Ok(None), + "release" => Ok(Release), + "renew" => Ok(Renew), _ => Err(()), } } } -impl AsRef for SubscriptionScheduleStatus { +impl AsRef for SubscriptionScheduleEndBehavior { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for SubscriptionScheduleStatus { +impl std::fmt::Display for SubscriptionScheduleEndBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for SubscriptionScheduleStatus { +impl std::fmt::Debug for SubscriptionScheduleEndBehavior { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for SubscriptionScheduleStatus { +impl serde::Serialize for SubscriptionScheduleEndBehavior { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -174,18 +177,12 @@ impl serde::Serialize for SubscriptionScheduleStatus { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for SubscriptionScheduleStatus { +impl<'de> serde::Deserialize<'de> for SubscriptionScheduleEndBehavior { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s) - .map_err(|_| serde::de::Error::custom("Unknown value for SubscriptionScheduleStatus")) - } -} -impl stripe_types::Object for SubscriptionSchedule { - type Id = stripe_shared::SubscriptionScheduleId; - fn id(&self) -> &Self::Id { - &self.id + Self::from_str(&s).map_err(|_| { + serde::de::Error::custom("Unknown value for SubscriptionScheduleEndBehavior") + }) } } -stripe_types::def_id!(SubscriptionScheduleId, "sub_sched_"); diff --git a/generated/stripe_shared/src/subscriptions_trials_resource_trial_settings.rs b/generated/stripe_shared/src/subscriptions_trials_resource_trial_settings.rs index f52b45108..c83a12296 100644 --- a/generated/stripe_shared/src/subscriptions_trials_resource_trial_settings.rs +++ b/generated/stripe_shared/src/subscriptions_trials_resource_trial_settings.rs @@ -1,5 +1,5 @@ /// Configures how this subscription behaves during the trial period. -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)] pub struct SubscriptionsTrialsResourceTrialSettings { pub end_behavior: stripe_shared::SubscriptionsTrialsResourceEndBehavior, } diff --git a/generated/stripe_shared/src/tax_rate.rs b/generated/stripe_shared/src/tax_rate.rs index 1851a75dc..478be3c3c 100644 --- a/generated/stripe_shared/src/tax_rate.rs +++ b/generated/stripe_shared/src/tax_rate.rs @@ -42,9 +42,15 @@ pub struct TaxRate { /// For example, "NY" for New York, United States. pub state: Option, /// The high-level tax type, such as `vat` or `sales_tax`. - pub tax_type: Option, + pub tax_type: Option, } -/// The high-level tax type, such as `vat` or `sales_tax`. +impl stripe_types::Object for TaxRate { + type Id = stripe_shared::TaxRateId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TaxRateId, "txr_"); #[derive(Copy, Clone, Eq, PartialEq)] #[non_exhaustive] pub enum TaxRateTaxType { @@ -139,10 +145,3 @@ impl<'de> serde::Deserialize<'de> for TaxRateTaxType { Ok(Self::from_str(&s).unwrap_or(TaxRateTaxType::Unknown)) } } -impl stripe_types::Object for TaxRate { - type Id = stripe_shared::TaxRateId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TaxRateId, "txr_"); diff --git a/generated/stripe_terminal/src/terminal_configuration/requests.rs b/generated/stripe_terminal/src/terminal_configuration/requests.rs index 42fa7d8d8..4336de8e2 100644 --- a/generated/stripe_terminal/src/terminal_configuration/requests.rs +++ b/generated/stripe_terminal/src/terminal_configuration/requests.rs @@ -8,10 +8,10 @@ pub struct CreateTerminalConfiguration<'a> { pub expand: Option<&'a [&'a str]>, /// Configurations for collecting transactions offline. #[serde(skip_serializing_if = "Option::is_none")] - pub offline: Option, + pub offline: Option, /// Tipping configurations for readers supporting on-reader tips #[serde(skip_serializing_if = "Option::is_none")] - pub tipping: Option>, + pub tipping: Option>, /// An object containing device type specific settings for Verifone P400 readers #[serde(skip_serializing_if = "Option::is_none")] pub verifone_p400: Option>, @@ -33,321 +33,6 @@ impl<'a> CreateTerminalConfigurationBbposWiseposE<'a> { Self::default() } } -/// Configurations for collecting transactions offline. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct CreateTerminalConfigurationOffline { - /// Determines whether to allow transactions to be collected while reader is offline. - /// Defaults to false. - pub enabled: bool, -} -impl CreateTerminalConfigurationOffline { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Tipping configurations for readers supporting on-reader tips -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTipping<'a> { - /// Tipping configuration for AUD - #[serde(skip_serializing_if = "Option::is_none")] - pub aud: Option>, - /// Tipping configuration for CAD - #[serde(skip_serializing_if = "Option::is_none")] - pub cad: Option>, - /// Tipping configuration for CHF - #[serde(skip_serializing_if = "Option::is_none")] - pub chf: Option>, - /// Tipping configuration for CZK - #[serde(skip_serializing_if = "Option::is_none")] - pub czk: Option>, - /// Tipping configuration for DKK - #[serde(skip_serializing_if = "Option::is_none")] - pub dkk: Option>, - /// Tipping configuration for EUR - #[serde(skip_serializing_if = "Option::is_none")] - pub eur: Option>, - /// Tipping configuration for GBP - #[serde(skip_serializing_if = "Option::is_none")] - pub gbp: Option>, - /// Tipping configuration for HKD - #[serde(skip_serializing_if = "Option::is_none")] - pub hkd: Option>, - /// Tipping configuration for MYR - #[serde(skip_serializing_if = "Option::is_none")] - pub myr: Option>, - /// Tipping configuration for NOK - #[serde(skip_serializing_if = "Option::is_none")] - pub nok: Option>, - /// Tipping configuration for NZD - #[serde(skip_serializing_if = "Option::is_none")] - pub nzd: Option>, - /// Tipping configuration for SEK - #[serde(skip_serializing_if = "Option::is_none")] - pub sek: Option>, - /// Tipping configuration for SGD - #[serde(skip_serializing_if = "Option::is_none")] - pub sgd: Option>, - /// Tipping configuration for USD - #[serde(skip_serializing_if = "Option::is_none")] - pub usd: Option>, -} -impl<'a> CreateTerminalConfigurationTipping<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for AUD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingAud<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingAud<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for CAD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingCad<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingCad<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for CHF -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingChf<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingChf<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for CZK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingCzk<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingCzk<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for DKK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingDkk<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingDkk<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for EUR -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingEur<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingEur<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for GBP -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingGbp<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingGbp<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for HKD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingHkd<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingHkd<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for MYR -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingMyr<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingMyr<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for NOK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingNok<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingNok<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for NZD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingNzd<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingNzd<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for SEK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingSek<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingSek<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for SGD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingSgd<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingSgd<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for USD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct CreateTerminalConfigurationTippingUsd<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> CreateTerminalConfigurationTippingUsd<'a> { - pub fn new() -> Self { - Self::default() - } -} /// An object containing device type specific settings for Verifone P400 readers #[derive(Copy, Clone, Debug, Default, serde::Serialize)] pub struct CreateTerminalConfigurationVerifoneP400<'a> { @@ -448,10 +133,10 @@ pub struct UpdateTerminalConfiguration<'a> { pub expand: Option<&'a [&'a str]>, /// Configurations for collecting transactions offline. #[serde(skip_serializing_if = "Option::is_none")] - pub offline: Option, + pub offline: Option, /// Tipping configurations for readers supporting on-reader tips #[serde(skip_serializing_if = "Option::is_none")] - pub tipping: Option>, + pub tipping: Option>, /// An object containing device type specific settings for Verifone P400 readers #[serde(skip_serializing_if = "Option::is_none")] pub verifone_p400: Option>, @@ -473,216 +158,72 @@ impl<'a> UpdateTerminalConfigurationBbposWiseposE<'a> { Self::default() } } -/// Configurations for collecting transactions offline. -#[derive(Copy, Clone, Debug, serde::Serialize)] -pub struct UpdateTerminalConfigurationOffline { - /// Determines whether to allow transactions to be collected while reader is offline. - /// Defaults to false. - pub enabled: bool, -} -impl UpdateTerminalConfigurationOffline { - pub fn new(enabled: bool) -> Self { - Self { enabled } - } -} -/// Tipping configurations for readers supporting on-reader tips -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTipping<'a> { - /// Tipping configuration for AUD - #[serde(skip_serializing_if = "Option::is_none")] - pub aud: Option>, - /// Tipping configuration for CAD - #[serde(skip_serializing_if = "Option::is_none")] - pub cad: Option>, - /// Tipping configuration for CHF - #[serde(skip_serializing_if = "Option::is_none")] - pub chf: Option>, - /// Tipping configuration for CZK - #[serde(skip_serializing_if = "Option::is_none")] - pub czk: Option>, - /// Tipping configuration for DKK - #[serde(skip_serializing_if = "Option::is_none")] - pub dkk: Option>, - /// Tipping configuration for EUR - #[serde(skip_serializing_if = "Option::is_none")] - pub eur: Option>, - /// Tipping configuration for GBP - #[serde(skip_serializing_if = "Option::is_none")] - pub gbp: Option>, - /// Tipping configuration for HKD - #[serde(skip_serializing_if = "Option::is_none")] - pub hkd: Option>, - /// Tipping configuration for MYR - #[serde(skip_serializing_if = "Option::is_none")] - pub myr: Option>, - /// Tipping configuration for NOK - #[serde(skip_serializing_if = "Option::is_none")] - pub nok: Option>, - /// Tipping configuration for NZD - #[serde(skip_serializing_if = "Option::is_none")] - pub nzd: Option>, - /// Tipping configuration for SEK - #[serde(skip_serializing_if = "Option::is_none")] - pub sek: Option>, - /// Tipping configuration for SGD - #[serde(skip_serializing_if = "Option::is_none")] - pub sgd: Option>, - /// Tipping configuration for USD - #[serde(skip_serializing_if = "Option::is_none")] - pub usd: Option>, -} -impl<'a> UpdateTerminalConfigurationTipping<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for AUD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingAud<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingAud<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for CAD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingCad<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingCad<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for CHF +/// An object containing device type specific settings for Verifone P400 readers #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingChf<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed +pub struct UpdateTerminalConfigurationVerifoneP400<'a> { + /// A File ID representing an image you would like displayed on the reader. #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, + pub splashscreen: Option<&'a str>, } -impl<'a> UpdateTerminalConfigurationTippingChf<'a> { +impl<'a> UpdateTerminalConfigurationVerifoneP400<'a> { pub fn new() -> Self { Self::default() } } -/// Tipping configuration for CZK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingCzk<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingCzk<'a> { - pub fn new() -> Self { - Self::default() +impl<'a> UpdateTerminalConfiguration<'a> { + /// Updates a new `Configuration` object. + pub fn send( + &self, + client: &stripe::Client, + configuration: &stripe_terminal::TerminalConfigurationId, + ) -> stripe::Response { + client.send_form( + &format!("/terminal/configurations/{configuration}"), + self, + http_types::Method::Post, + ) } } -/// Tipping configuration for DKK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingDkk<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingDkk<'a> { - pub fn new() -> Self { - Self::default() - } +#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] +#[serde(tag = "object")] +pub enum UpdateReturned { + #[serde(rename = "terminal.configuration")] + DeletedTerminalConfiguration(stripe_terminal::DeletedTerminalConfiguration), } -/// Tipping configuration for EUR #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingEur<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingEur<'a> { +pub struct DeleteTerminalConfiguration {} +impl DeleteTerminalConfiguration { pub fn new() -> Self { Self::default() } } -/// Tipping configuration for GBP -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingGbp<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingGbp<'a> { - pub fn new() -> Self { - Self::default() +impl DeleteTerminalConfiguration { + /// Deletes a `Configuration` object. + pub fn send( + &self, + client: &stripe::Client, + configuration: &stripe_terminal::TerminalConfigurationId, + ) -> stripe::Response { + client.send_form( + &format!("/terminal/configurations/{configuration}"), + self, + http_types::Method::Delete, + ) } } -/// Tipping configuration for HKD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingHkd<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed - #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, +#[derive(Copy, Clone, Debug, serde::Serialize)] +pub struct Offline { + /// Determines whether to allow transactions to be collected while reader is offline. + /// Defaults to false. + pub enabled: bool, } -impl<'a> UpdateTerminalConfigurationTippingHkd<'a> { - pub fn new() -> Self { - Self::default() +impl Offline { + pub fn new(enabled: bool) -> Self { + Self { enabled } } } -/// Tipping configuration for MYR #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingMyr<'a> { +pub struct CurrencySpecificConfig<'a> { /// Fixed amounts displayed when collecting a tip #[serde(skip_serializing_if = "Option::is_none")] pub fixed_amounts: Option<&'a [i64]>, @@ -693,151 +234,58 @@ pub struct UpdateTerminalConfigurationTippingMyr<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub smart_tip_threshold: Option, } -impl<'a> UpdateTerminalConfigurationTippingMyr<'a> { +impl<'a> CurrencySpecificConfig<'a> { pub fn new() -> Self { Self::default() } } -/// Tipping configuration for NOK #[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingNok<'a> { - /// Fixed amounts displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip - #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed +pub struct Tipping<'a> { + /// Tipping configuration for AUD #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingNok<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for NZD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingNzd<'a> { - /// Fixed amounts displayed when collecting a tip + pub aud: Option>, + /// Tipping configuration for CAD #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip + pub cad: Option>, + /// Tipping configuration for CHF #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + pub chf: Option>, + /// Tipping configuration for CZK #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingNzd<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for SEK -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingSek<'a> { - /// Fixed amounts displayed when collecting a tip + pub czk: Option>, + /// Tipping configuration for DKK #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip + pub dkk: Option>, + /// Tipping configuration for EUR #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + pub eur: Option>, + /// Tipping configuration for GBP #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingSek<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for SGD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingSgd<'a> { - /// Fixed amounts displayed when collecting a tip + pub gbp: Option>, + /// Tipping configuration for HKD #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip + pub hkd: Option>, + /// Tipping configuration for MYR #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + pub myr: Option>, + /// Tipping configuration for NOK #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingSgd<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// Tipping configuration for USD -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationTippingUsd<'a> { - /// Fixed amounts displayed when collecting a tip + pub nok: Option>, + /// Tipping configuration for NZD #[serde(skip_serializing_if = "Option::is_none")] - pub fixed_amounts: Option<&'a [i64]>, - /// Percentages displayed when collecting a tip + pub nzd: Option>, + /// Tipping configuration for SEK #[serde(skip_serializing_if = "Option::is_none")] - pub percentages: Option<&'a [i64]>, - /// Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + pub sek: Option>, + /// Tipping configuration for SGD #[serde(skip_serializing_if = "Option::is_none")] - pub smart_tip_threshold: Option, -} -impl<'a> UpdateTerminalConfigurationTippingUsd<'a> { - pub fn new() -> Self { - Self::default() - } -} -/// An object containing device type specific settings for Verifone P400 readers -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct UpdateTerminalConfigurationVerifoneP400<'a> { - /// A File ID representing an image you would like displayed on the reader. + pub sgd: Option>, + /// Tipping configuration for USD #[serde(skip_serializing_if = "Option::is_none")] - pub splashscreen: Option<&'a str>, -} -impl<'a> UpdateTerminalConfigurationVerifoneP400<'a> { - pub fn new() -> Self { - Self::default() - } -} -impl<'a> UpdateTerminalConfiguration<'a> { - /// Updates a new `Configuration` object. - pub fn send( - &self, - client: &stripe::Client, - configuration: &stripe_terminal::TerminalConfigurationId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/configurations/{configuration}"), - self, - http_types::Method::Post, - ) - } -} -#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)] -#[serde(tag = "object")] -pub enum UpdateReturned { - #[serde(rename = "terminal.configuration")] - DeletedTerminalConfiguration(stripe_terminal::DeletedTerminalConfiguration), + pub usd: Option>, } -#[derive(Copy, Clone, Debug, Default, serde::Serialize)] -pub struct DeleteTerminalConfiguration {} -impl DeleteTerminalConfiguration { +impl<'a> Tipping<'a> { pub fn new() -> Self { Self::default() } } -impl DeleteTerminalConfiguration { - /// Deletes a `Configuration` object. - pub fn send( - &self, - client: &stripe::Client, - configuration: &stripe_terminal::TerminalConfigurationId, - ) -> stripe::Response { - client.send_form( - &format!("/terminal/configurations/{configuration}"), - self, - http_types::Method::Delete, - ) - } -} diff --git a/generated/stripe_terminal/src/terminal_reader/requests.rs b/generated/stripe_terminal/src/terminal_reader/requests.rs index cb3c75407..0f841b964 100644 --- a/generated/stripe_terminal/src/terminal_reader/requests.rs +++ b/generated/stripe_terminal/src/terminal_reader/requests.rs @@ -101,7 +101,7 @@ impl<'a> CreateTerminalReader<'a> { pub struct ListTerminalReader<'a> { /// Filters readers by device type #[serde(skip_serializing_if = "Option::is_none")] - pub device_type: Option, + pub device_type: 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. @@ -134,69 +134,6 @@ impl<'a> ListTerminalReader<'a> { Self::default() } } -/// Filters readers by device type -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTerminalReaderDeviceType { - BbposChipper2x, - BbposWisepad3, - BbposWiseposE, - SimulatedWiseposE, - StripeM2, - VerifoneP400, -} -impl ListTerminalReaderDeviceType { - pub fn as_str(self) -> &'static str { - use ListTerminalReaderDeviceType::*; - match self { - BbposChipper2x => "bbpos_chipper2x", - BbposWisepad3 => "bbpos_wisepad3", - BbposWiseposE => "bbpos_wisepos_e", - SimulatedWiseposE => "simulated_wisepos_e", - StripeM2 => "stripe_m2", - VerifoneP400 => "verifone_P400", - } - } -} - -impl std::str::FromStr for ListTerminalReaderDeviceType { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTerminalReaderDeviceType::*; - match s { - "bbpos_chipper2x" => Ok(BbposChipper2x), - "bbpos_wisepad3" => Ok(BbposWisepad3), - "bbpos_wisepos_e" => Ok(BbposWiseposE), - "simulated_wisepos_e" => Ok(SimulatedWiseposE), - "stripe_m2" => Ok(StripeM2), - "verifone_P400" => Ok(VerifoneP400), - _ => Err(()), - } - } -} -impl AsRef for ListTerminalReaderDeviceType { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTerminalReaderDeviceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTerminalReaderDeviceType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTerminalReaderDeviceType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A status filter to filter readers to only offline or online readers #[derive(Copy, Clone, Eq, PartialEq)] pub enum ListTerminalReaderStatus { diff --git a/generated/stripe_terminal/src/terminal_reader/types.rs b/generated/stripe_terminal/src/terminal_reader/types.rs index fb5ebea37..dcef73b1f 100644 --- a/generated/stripe_terminal/src/terminal_reader/types.rs +++ b/generated/stripe_terminal/src/terminal_reader/types.rs @@ -10,7 +10,7 @@ pub struct TerminalReader { /// The current software version of the reader. pub device_sw_version: Option, /// Type of reader, one of `bbpos_wisepad3`, `stripe_m2`, `bbpos_chipper2x`, `bbpos_wisepos_e`, `verifone_P400`, or `simulated_wisepos_e`. - pub device_type: TerminalReaderDeviceType, + pub device_type: stripe_terminal::TerminalReaderDeviceType, /// Unique identifier for the object. pub id: stripe_terminal::TerminalReaderId, /// The local IP address of the reader. @@ -29,7 +29,13 @@ pub struct TerminalReader { /// The networking status of the reader. pub status: Option, } -/// Type of reader, one of `bbpos_wisepad3`, `stripe_m2`, `bbpos_chipper2x`, `bbpos_wisepos_e`, `verifone_P400`, or `simulated_wisepos_e`. +impl stripe_types::Object for TerminalReader { + type Id = stripe_terminal::TerminalReaderId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TerminalReaderId, "tmr_"); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TerminalReaderDeviceType { BbposChipper2x, @@ -100,10 +106,3 @@ impl<'de> serde::Deserialize<'de> for TerminalReaderDeviceType { .map_err(|_| serde::de::Error::custom("Unknown value for TerminalReaderDeviceType")) } } -impl stripe_types::Object for TerminalReader { - type Id = stripe_terminal::TerminalReaderId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TerminalReaderId, "tmr_"); diff --git a/generated/stripe_terminal/src/terminal_reader_reader_resource_process_config.rs b/generated/stripe_terminal/src/terminal_reader_reader_resource_process_config.rs index acb46ef38..000d3e32d 100644 --- a/generated/stripe_terminal/src/terminal_reader_reader_resource_process_config.rs +++ b/generated/stripe_terminal/src/terminal_reader_reader_resource_process_config.rs @@ -1,5 +1,5 @@ /// Represents a per-transaction override of a reader configuration -#[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +#[derive(Copy, Clone, Debug, Default, serde::Serialize, serde::Deserialize)] pub struct TerminalReaderReaderResourceProcessConfig { /// Override showing a tipping selection screen on this transaction. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs b/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs index c6b516f4f..dd64da691 100644 --- a/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs +++ b/generated/stripe_treasury/src/treasury_credit_reversal/requests.rs @@ -24,7 +24,7 @@ pub struct ListTreasuryCreditReversal<'a> { pub starting_after: Option<&'a str>, /// Only return CreditReversals for a given status. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListTreasuryCreditReversal<'a> { pub fn new(financial_account: &'a str) -> Self { @@ -39,60 +39,6 @@ impl<'a> ListTreasuryCreditReversal<'a> { } } } -/// Only return CreditReversals for a given status. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryCreditReversalStatus { - Canceled, - Posted, - Processing, -} -impl ListTreasuryCreditReversalStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryCreditReversalStatus::*; - match self { - Canceled => "canceled", - Posted => "posted", - Processing => "processing", - } - } -} - -impl std::str::FromStr for ListTreasuryCreditReversalStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryCreditReversalStatus::*; - match s { - "canceled" => Ok(Canceled), - "posted" => Ok(Posted), - "processing" => Ok(Processing), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryCreditReversalStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryCreditReversalStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryCreditReversalStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryCreditReversalStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListTreasuryCreditReversal<'a> { /// Returns a list of CreditReversals. pub fn send( diff --git a/generated/stripe_treasury/src/treasury_credit_reversal/types.rs b/generated/stripe_treasury/src/treasury_credit_reversal/types.rs index 25d432f48..8dea24d79 100644 --- a/generated/stripe_treasury/src/treasury_credit_reversal/types.rs +++ b/generated/stripe_treasury/src/treasury_credit_reversal/types.rs @@ -25,7 +25,7 @@ pub struct TreasuryCreditReversal { /// The ReceivedCredit being reversed. pub received_credit: String, /// Status of the CreditReversal - pub status: TreasuryCreditReversalStatus, + pub status: stripe_treasury::TreasuryCreditReversalStatus, pub status_transitions: stripe_treasury::TreasuryReceivedCreditsResourceStatusTransitions, /// The Transaction associated with this object. pub transaction: Option>, @@ -90,7 +90,13 @@ impl<'de> serde::Deserialize<'de> for TreasuryCreditReversalNetwork { }) } } -/// Status of the CreditReversal +impl stripe_types::Object for TreasuryCreditReversal { + type Id = stripe_treasury::TreasuryCreditReversalId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryCreditReversalId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryCreditReversalStatus { Canceled, @@ -152,10 +158,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryCreditReversalStatus { .map_err(|_| serde::de::Error::custom("Unknown value for TreasuryCreditReversalStatus")) } } -impl stripe_types::Object for TreasuryCreditReversal { - type Id = stripe_treasury::TreasuryCreditReversalId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryCreditReversalId); diff --git a/generated/stripe_treasury/src/treasury_financial_account/types.rs b/generated/stripe_treasury/src/treasury_financial_account/types.rs index 193cb4752..49c87555d 100644 --- a/generated/stripe_treasury/src/treasury_financial_account/types.rs +++ b/generated/stripe_treasury/src/treasury_financial_account/types.rs @@ -4,7 +4,7 @@ pub struct TreasuryFinancialAccount { /// The array of paths to active Features in the Features hash. #[serde(skip_serializing_if = "Option::is_none")] - pub active_features: Option>, + pub active_features: Option>, pub balance: stripe_treasury::TreasuryFinancialAccountsResourceBalance, /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). pub country: String, @@ -24,14 +24,14 @@ pub struct TreasuryFinancialAccount { pub metadata: Option>, /// The array of paths to pending Features in the Features hash. #[serde(skip_serializing_if = "Option::is_none")] - pub pending_features: Option>, + pub pending_features: Option>, /// The set of functionalities that the platform can restrict on the FinancialAccount. #[serde(skip_serializing_if = "Option::is_none")] pub platform_restrictions: Option, /// The array of paths to restricted Features in the Features hash. #[serde(skip_serializing_if = "Option::is_none")] - pub restricted_features: Option>, + pub restricted_features: Option>, /// The enum specifying what state the account is in. pub status: TreasuryFinancialAccountStatus, pub status_details: stripe_treasury::TreasuryFinancialAccountsResourceStatusDetails, @@ -39,74 +39,50 @@ pub struct TreasuryFinancialAccount { /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. pub supported_currencies: Vec, } -/// The array of paths to active Features in the Features hash. +/// The enum specifying what state the account is in. #[derive(Copy, Clone, Eq, PartialEq)] -pub enum TreasuryFinancialAccountActiveFeatures { - CardIssuing, - DepositInsurance, - FinancialAddressesAba, - InboundTransfersAch, - IntraStripeFlows, - OutboundPaymentsAch, - OutboundPaymentsUsDomesticWire, - OutboundTransfersAch, - OutboundTransfersUsDomesticWire, - RemoteDepositCapture, +pub enum TreasuryFinancialAccountStatus { + Closed, + Open, } -impl TreasuryFinancialAccountActiveFeatures { +impl TreasuryFinancialAccountStatus { pub fn as_str(self) -> &'static str { - use TreasuryFinancialAccountActiveFeatures::*; + use TreasuryFinancialAccountStatus::*; match self { - CardIssuing => "card_issuing", - DepositInsurance => "deposit_insurance", - FinancialAddressesAba => "financial_addresses.aba", - InboundTransfersAch => "inbound_transfers.ach", - IntraStripeFlows => "intra_stripe_flows", - OutboundPaymentsAch => "outbound_payments.ach", - OutboundPaymentsUsDomesticWire => "outbound_payments.us_domestic_wire", - OutboundTransfersAch => "outbound_transfers.ach", - OutboundTransfersUsDomesticWire => "outbound_transfers.us_domestic_wire", - RemoteDepositCapture => "remote_deposit_capture", + Closed => "closed", + Open => "open", } } } -impl std::str::FromStr for TreasuryFinancialAccountActiveFeatures { +impl std::str::FromStr for TreasuryFinancialAccountStatus { type Err = (); fn from_str(s: &str) -> Result { - use TreasuryFinancialAccountActiveFeatures::*; + use TreasuryFinancialAccountStatus::*; match s { - "card_issuing" => Ok(CardIssuing), - "deposit_insurance" => Ok(DepositInsurance), - "financial_addresses.aba" => Ok(FinancialAddressesAba), - "inbound_transfers.ach" => Ok(InboundTransfersAch), - "intra_stripe_flows" => Ok(IntraStripeFlows), - "outbound_payments.ach" => Ok(OutboundPaymentsAch), - "outbound_payments.us_domestic_wire" => Ok(OutboundPaymentsUsDomesticWire), - "outbound_transfers.ach" => Ok(OutboundTransfersAch), - "outbound_transfers.us_domestic_wire" => Ok(OutboundTransfersUsDomesticWire), - "remote_deposit_capture" => Ok(RemoteDepositCapture), + "closed" => Ok(Closed), + "open" => Ok(Open), _ => Err(()), } } } -impl AsRef for TreasuryFinancialAccountActiveFeatures { +impl AsRef for TreasuryFinancialAccountStatus { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for TreasuryFinancialAccountActiveFeatures { +impl std::fmt::Display for TreasuryFinancialAccountStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for TreasuryFinancialAccountActiveFeatures { +impl std::fmt::Debug for TreasuryFinancialAccountStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for TreasuryFinancialAccountActiveFeatures { +impl serde::Serialize for TreasuryFinancialAccountStatus { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -114,102 +90,24 @@ impl serde::Serialize for TreasuryFinancialAccountActiveFeatures { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for TreasuryFinancialAccountActiveFeatures { +impl<'de> serde::Deserialize<'de> for TreasuryFinancialAccountStatus { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for TreasuryFinancialAccountActiveFeatures") + serde::de::Error::custom("Unknown value for TreasuryFinancialAccountStatus") }) } } -/// The array of paths to pending Features in the Features hash. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum TreasuryFinancialAccountPendingFeatures { - CardIssuing, - DepositInsurance, - FinancialAddressesAba, - InboundTransfersAch, - IntraStripeFlows, - OutboundPaymentsAch, - OutboundPaymentsUsDomesticWire, - OutboundTransfersAch, - OutboundTransfersUsDomesticWire, - RemoteDepositCapture, -} -impl TreasuryFinancialAccountPendingFeatures { - pub fn as_str(self) -> &'static str { - use TreasuryFinancialAccountPendingFeatures::*; - match self { - CardIssuing => "card_issuing", - DepositInsurance => "deposit_insurance", - FinancialAddressesAba => "financial_addresses.aba", - InboundTransfersAch => "inbound_transfers.ach", - IntraStripeFlows => "intra_stripe_flows", - OutboundPaymentsAch => "outbound_payments.ach", - OutboundPaymentsUsDomesticWire => "outbound_payments.us_domestic_wire", - OutboundTransfersAch => "outbound_transfers.ach", - OutboundTransfersUsDomesticWire => "outbound_transfers.us_domestic_wire", - RemoteDepositCapture => "remote_deposit_capture", - } - } -} - -impl std::str::FromStr for TreasuryFinancialAccountPendingFeatures { - type Err = (); - fn from_str(s: &str) -> Result { - use TreasuryFinancialAccountPendingFeatures::*; - match s { - "card_issuing" => Ok(CardIssuing), - "deposit_insurance" => Ok(DepositInsurance), - "financial_addresses.aba" => Ok(FinancialAddressesAba), - "inbound_transfers.ach" => Ok(InboundTransfersAch), - "intra_stripe_flows" => Ok(IntraStripeFlows), - "outbound_payments.ach" => Ok(OutboundPaymentsAch), - "outbound_payments.us_domestic_wire" => Ok(OutboundPaymentsUsDomesticWire), - "outbound_transfers.ach" => Ok(OutboundTransfersAch), - "outbound_transfers.us_domestic_wire" => Ok(OutboundTransfersUsDomesticWire), - "remote_deposit_capture" => Ok(RemoteDepositCapture), - _ => Err(()), - } - } -} -impl AsRef for TreasuryFinancialAccountPendingFeatures { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for TreasuryFinancialAccountPendingFeatures { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for TreasuryFinancialAccountPendingFeatures { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for TreasuryFinancialAccountPendingFeatures { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for TreasuryFinancialAccountPendingFeatures { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for TreasuryFinancialAccountPendingFeatures") - }) +impl stripe_types::Object for TreasuryFinancialAccount { + type Id = stripe_treasury::TreasuryFinancialAccountId; + fn id(&self) -> &Self::Id { + &self.id } } -/// The array of paths to restricted Features in the Features hash. +stripe_types::def_id!(TreasuryFinancialAccountId); #[derive(Copy, Clone, Eq, PartialEq)] -pub enum TreasuryFinancialAccountRestrictedFeatures { +pub enum TreasuryFinancialAccountArray { CardIssuing, DepositInsurance, FinancialAddressesAba, @@ -221,9 +119,9 @@ pub enum TreasuryFinancialAccountRestrictedFeatures { OutboundTransfersUsDomesticWire, RemoteDepositCapture, } -impl TreasuryFinancialAccountRestrictedFeatures { +impl TreasuryFinancialAccountArray { pub fn as_str(self) -> &'static str { - use TreasuryFinancialAccountRestrictedFeatures::*; + use TreasuryFinancialAccountArray::*; match self { CardIssuing => "card_issuing", DepositInsurance => "deposit_insurance", @@ -239,10 +137,10 @@ impl TreasuryFinancialAccountRestrictedFeatures { } } -impl std::str::FromStr for TreasuryFinancialAccountRestrictedFeatures { +impl std::str::FromStr for TreasuryFinancialAccountArray { type Err = (); fn from_str(s: &str) -> Result { - use TreasuryFinancialAccountRestrictedFeatures::*; + use TreasuryFinancialAccountArray::*; match s { "card_issuing" => Ok(CardIssuing), "deposit_insurance" => Ok(DepositInsurance), @@ -258,23 +156,23 @@ impl std::str::FromStr for TreasuryFinancialAccountRestrictedFeatures { } } } -impl AsRef for TreasuryFinancialAccountRestrictedFeatures { +impl AsRef for TreasuryFinancialAccountArray { fn as_ref(&self) -> &str { self.as_str() } } -impl std::fmt::Display for TreasuryFinancialAccountRestrictedFeatures { +impl std::fmt::Display for TreasuryFinancialAccountArray { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl std::fmt::Debug for TreasuryFinancialAccountRestrictedFeatures { +impl std::fmt::Debug for TreasuryFinancialAccountArray { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.write_str(self.as_str()) } } -impl serde::Serialize for TreasuryFinancialAccountRestrictedFeatures { +impl serde::Serialize for TreasuryFinancialAccountArray { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -282,79 +180,12 @@ impl serde::Serialize for TreasuryFinancialAccountRestrictedFeatures { serializer.serialize_str(self.as_str()) } } -impl<'de> serde::Deserialize<'de> for TreasuryFinancialAccountRestrictedFeatures { +impl<'de> serde::Deserialize<'de> for TreasuryFinancialAccountArray { fn deserialize>(deserializer: D) -> Result { use std::str::FromStr; let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for TreasuryFinancialAccountRestrictedFeatures") + serde::de::Error::custom("Unknown value for TreasuryFinancialAccountArray") }) } } -/// The enum specifying what state the account is in. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum TreasuryFinancialAccountStatus { - Closed, - Open, -} -impl TreasuryFinancialAccountStatus { - pub fn as_str(self) -> &'static str { - use TreasuryFinancialAccountStatus::*; - match self { - Closed => "closed", - Open => "open", - } - } -} - -impl std::str::FromStr for TreasuryFinancialAccountStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use TreasuryFinancialAccountStatus::*; - match s { - "closed" => Ok(Closed), - "open" => Ok(Open), - _ => Err(()), - } - } -} -impl AsRef for TreasuryFinancialAccountStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for TreasuryFinancialAccountStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for TreasuryFinancialAccountStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for TreasuryFinancialAccountStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} -impl<'de> serde::Deserialize<'de> for TreasuryFinancialAccountStatus { - fn deserialize>(deserializer: D) -> Result { - use std::str::FromStr; - let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?; - Self::from_str(&s).map_err(|_| { - serde::de::Error::custom("Unknown value for TreasuryFinancialAccountStatus") - }) - } -} -impl stripe_types::Object for TreasuryFinancialAccount { - type Id = stripe_treasury::TreasuryFinancialAccountId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryFinancialAccountId); diff --git a/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs b/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs index 5ad27c501..401477a39 100644 --- a/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs +++ b/generated/stripe_treasury/src/treasury_inbound_transfer/requests.rs @@ -122,7 +122,7 @@ pub struct ListTreasuryInboundTransfer<'a> { pub starting_after: Option<&'a str>, /// Only return InboundTransfers that have the given status: `processing`, `succeeded`, `failed` or `canceled`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListTreasuryInboundTransfer<'a> { pub fn new(financial_account: &'a str) -> Self { @@ -136,63 +136,6 @@ impl<'a> ListTreasuryInboundTransfer<'a> { } } } -/// Only return InboundTransfers that have the given status: `processing`, `succeeded`, `failed` or `canceled`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryInboundTransferStatus { - Canceled, - Failed, - Processing, - Succeeded, -} -impl ListTreasuryInboundTransferStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryInboundTransferStatus::*; - match self { - Canceled => "canceled", - Failed => "failed", - Processing => "processing", - Succeeded => "succeeded", - } - } -} - -impl std::str::FromStr for ListTreasuryInboundTransferStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryInboundTransferStatus::*; - match s { - "canceled" => Ok(Canceled), - "failed" => Ok(Failed), - "processing" => Ok(Processing), - "succeeded" => Ok(Succeeded), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryInboundTransferStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryInboundTransferStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryInboundTransferStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryInboundTransferStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListTreasuryInboundTransfer<'a> { /// Returns a list of InboundTransfers sent from the specified FinancialAccount. pub fn send( diff --git a/generated/stripe_treasury/src/treasury_inbound_transfer/types.rs b/generated/stripe_treasury/src/treasury_inbound_transfer/types.rs index bd2f78ad0..643dc075f 100644 --- a/generated/stripe_treasury/src/treasury_inbound_transfer/types.rs +++ b/generated/stripe_treasury/src/treasury_inbound_transfer/types.rs @@ -41,16 +41,19 @@ pub struct TreasuryInboundTransfer { /// An InboundTransfer is `processing` if it is created and pending. /// The status changes to `succeeded` once the funds have been "confirmed" and a `transaction` is created and posted. /// The status changes to `failed` if the transfer fails. - pub status: TreasuryInboundTransferStatus, + pub status: stripe_treasury::TreasuryInboundTransferStatus, pub status_transitions: stripe_treasury::TreasuryInboundTransfersResourceInboundTransferResourceStatusTransitions, /// The Transaction associated with this object. pub transaction: Option>, } -/// Status of the InboundTransfer: `processing`, `succeeded`, `failed`, and `canceled`. -/// An InboundTransfer is `processing` if it is created and pending. -/// The status changes to `succeeded` once the funds have been "confirmed" and a `transaction` is created and posted. -/// The status changes to `failed` if the transfer fails. +impl stripe_types::Object for TreasuryInboundTransfer { + type Id = stripe_treasury::TreasuryInboundTransferId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryInboundTransferId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryInboundTransferStatus { Canceled, @@ -116,10 +119,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryInboundTransferStatus { }) } } -impl stripe_types::Object for TreasuryInboundTransfer { - type Id = stripe_treasury::TreasuryInboundTransferId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryInboundTransferId); diff --git a/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs b/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs index 04d739a46..de3c5b9c6 100644 --- a/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs +++ b/generated/stripe_treasury/src/treasury_outbound_payment/requests.rs @@ -513,7 +513,7 @@ pub struct ListTreasuryOutboundPayment<'a> { pub starting_after: Option<&'a str>, /// Only return OutboundPayments that have the given status: `processing`, `failed`, `posted`, `returned`, or `canceled`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListTreasuryOutboundPayment<'a> { pub fn new(financial_account: &'a str) -> Self { @@ -528,66 +528,6 @@ impl<'a> ListTreasuryOutboundPayment<'a> { } } } -/// Only return OutboundPayments that have the given status: `processing`, `failed`, `posted`, `returned`, or `canceled`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryOutboundPaymentStatus { - Canceled, - Failed, - Posted, - Processing, - Returned, -} -impl ListTreasuryOutboundPaymentStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryOutboundPaymentStatus::*; - match self { - Canceled => "canceled", - Failed => "failed", - Posted => "posted", - Processing => "processing", - Returned => "returned", - } - } -} - -impl std::str::FromStr for ListTreasuryOutboundPaymentStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryOutboundPaymentStatus::*; - match s { - "canceled" => Ok(Canceled), - "failed" => Ok(Failed), - "posted" => Ok(Posted), - "processing" => Ok(Processing), - "returned" => Ok(Returned), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryOutboundPaymentStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryOutboundPaymentStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryOutboundPaymentStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryOutboundPaymentStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListTreasuryOutboundPayment<'a> { /// Returns a list of OutboundPayments sent from the specified FinancialAccount. pub fn send( diff --git a/generated/stripe_treasury/src/treasury_outbound_payment/types.rs b/generated/stripe_treasury/src/treasury_outbound_payment/types.rs index e7ab08ff5..b6f6af50d 100644 --- a/generated/stripe_treasury/src/treasury_outbound_payment/types.rs +++ b/generated/stripe_treasury/src/treasury_outbound_payment/types.rs @@ -49,16 +49,19 @@ pub struct TreasuryOutboundPayment { /// An OutboundPayment is `processing` if it has been created and is pending. /// The status changes to `posted` once the OutboundPayment has been "confirmed" and funds have left the account, or to `failed` or `canceled`. /// If an OutboundPayment fails to arrive at its destination, its status will change to `returned`. - pub status: TreasuryOutboundPaymentStatus, + pub status: stripe_treasury::TreasuryOutboundPaymentStatus, pub status_transitions: stripe_treasury::TreasuryOutboundPaymentsResourceOutboundPaymentResourceStatusTransitions, /// The Transaction associated with this object. pub transaction: stripe_types::Expandable, } -/// Current status of the OutboundPayment: `processing`, `failed`, `posted`, `returned`, `canceled`. -/// An OutboundPayment is `processing` if it has been created and is pending. -/// The status changes to `posted` once the OutboundPayment has been "confirmed" and funds have left the account, or to `failed` or `canceled`. -/// If an OutboundPayment fails to arrive at its destination, its status will change to `returned`. +impl stripe_types::Object for TreasuryOutboundPayment { + type Id = stripe_treasury::TreasuryOutboundPaymentId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryOutboundPaymentId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryOutboundPaymentStatus { Canceled, @@ -127,10 +130,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryOutboundPaymentStatus { }) } } -impl stripe_types::Object for TreasuryOutboundPayment { - type Id = stripe_treasury::TreasuryOutboundPaymentId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryOutboundPaymentId); diff --git a/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs b/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs index f04fc9494..8524c3ef3 100644 --- a/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs +++ b/generated/stripe_treasury/src/treasury_outbound_transfer/requests.rs @@ -187,7 +187,7 @@ pub struct ListTreasuryOutboundTransfer<'a> { pub starting_after: Option<&'a str>, /// Only return OutboundTransfers that have the given status: `processing`, `canceled`, `failed`, `posted`, or `returned`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListTreasuryOutboundTransfer<'a> { pub fn new(financial_account: &'a str) -> Self { @@ -201,66 +201,6 @@ impl<'a> ListTreasuryOutboundTransfer<'a> { } } } -/// Only return OutboundTransfers that have the given status: `processing`, `canceled`, `failed`, `posted`, or `returned`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryOutboundTransferStatus { - Canceled, - Failed, - Posted, - Processing, - Returned, -} -impl ListTreasuryOutboundTransferStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryOutboundTransferStatus::*; - match self { - Canceled => "canceled", - Failed => "failed", - Posted => "posted", - Processing => "processing", - Returned => "returned", - } - } -} - -impl std::str::FromStr for ListTreasuryOutboundTransferStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryOutboundTransferStatus::*; - match s { - "canceled" => Ok(Canceled), - "failed" => Ok(Failed), - "posted" => Ok(Posted), - "processing" => Ok(Processing), - "returned" => Ok(Returned), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryOutboundTransferStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryOutboundTransferStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryOutboundTransferStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryOutboundTransferStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListTreasuryOutboundTransfer<'a> { /// Returns a list of OutboundTransfers sent from the specified FinancialAccount. pub fn send( diff --git a/generated/stripe_treasury/src/treasury_outbound_transfer/types.rs b/generated/stripe_treasury/src/treasury_outbound_transfer/types.rs index 575404b10..6753a8939 100644 --- a/generated/stripe_treasury/src/treasury_outbound_transfer/types.rs +++ b/generated/stripe_treasury/src/treasury_outbound_transfer/types.rs @@ -41,15 +41,18 @@ pub struct TreasuryOutboundTransfer { /// An OutboundTransfer is `processing` if it has been created and is pending. /// The status changes to `posted` once the OutboundTransfer has been "confirmed" and funds have left the account, or to `failed` or `canceled`. /// If an OutboundTransfer fails to arrive at its destination, its status will change to `returned`. - pub status: TreasuryOutboundTransferStatus, + pub status: stripe_treasury::TreasuryOutboundTransferStatus, pub status_transitions: stripe_treasury::TreasuryOutboundTransfersResourceStatusTransitions, /// The Transaction associated with this object. pub transaction: stripe_types::Expandable, } -/// Current status of the OutboundTransfer: `processing`, `failed`, `canceled`, `posted`, `returned`. -/// An OutboundTransfer is `processing` if it has been created and is pending. -/// The status changes to `posted` once the OutboundTransfer has been "confirmed" and funds have left the account, or to `failed` or `canceled`. -/// If an OutboundTransfer fails to arrive at its destination, its status will change to `returned`. +impl stripe_types::Object for TreasuryOutboundTransfer { + type Id = stripe_treasury::TreasuryOutboundTransferId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryOutboundTransferId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryOutboundTransferStatus { Canceled, @@ -118,10 +121,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryOutboundTransferStatus { }) } } -impl stripe_types::Object for TreasuryOutboundTransfer { - type Id = stripe_treasury::TreasuryOutboundTransferId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryOutboundTransferId); diff --git a/generated/stripe_treasury/src/treasury_received_credit/requests.rs b/generated/stripe_treasury/src/treasury_received_credit/requests.rs index f908259a2..3447fe410 100644 --- a/generated/stripe_treasury/src/treasury_received_credit/requests.rs +++ b/generated/stripe_treasury/src/treasury_received_credit/requests.rs @@ -24,7 +24,7 @@ pub struct ListTreasuryReceivedCredit<'a> { pub starting_after: Option<&'a str>, /// Only return ReceivedCredits that have the given status: `succeeded` or `failed`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListTreasuryReceivedCredit<'a> { pub fn new(financial_account: &'a str) -> Self { @@ -107,57 +107,6 @@ impl serde::Serialize for ListTreasuryReceivedCreditLinkedFlowsSourceFlowType { serializer.serialize_str(self.as_str()) } } -/// Only return ReceivedCredits that have the given status: `succeeded` or `failed`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryReceivedCreditStatus { - Failed, - Succeeded, -} -impl ListTreasuryReceivedCreditStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryReceivedCreditStatus::*; - match self { - Failed => "failed", - Succeeded => "succeeded", - } - } -} - -impl std::str::FromStr for ListTreasuryReceivedCreditStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryReceivedCreditStatus::*; - match s { - "failed" => Ok(Failed), - "succeeded" => Ok(Succeeded), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryReceivedCreditStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryReceivedCreditStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryReceivedCreditStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryReceivedCreditStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListTreasuryReceivedCredit<'a> { /// Returns a list of ReceivedCredits. pub fn send( diff --git a/generated/stripe_treasury/src/treasury_received_credit/types.rs b/generated/stripe_treasury/src/treasury_received_credit/types.rs index 55410cb34..ee1086421 100644 --- a/generated/stripe_treasury/src/treasury_received_credit/types.rs +++ b/generated/stripe_treasury/src/treasury_received_credit/types.rs @@ -31,7 +31,7 @@ pub reversal_details: Option>, @@ -166,9 +166,13 @@ impl<'de> serde::Deserialize<'de> for TreasuryReceivedCreditNetwork { }) } } -/// Status of the ReceivedCredit. -/// ReceivedCredits are created either `succeeded` (approved) or `failed` (declined). -/// If a ReceivedCredit is declined, the failure reason can be found in the `failure_code` field. +impl stripe_types::Object for TreasuryReceivedCredit { + type Id = stripe_treasury::TreasuryReceivedCreditId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryReceivedCreditId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryReceivedCreditStatus { Failed, @@ -227,10 +231,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryReceivedCreditStatus { .map_err(|_| serde::de::Error::custom("Unknown value for TreasuryReceivedCreditStatus")) } } -impl stripe_types::Object for TreasuryReceivedCredit { - type Id = stripe_treasury::TreasuryReceivedCreditId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryReceivedCreditId); diff --git a/generated/stripe_treasury/src/treasury_received_debit/requests.rs b/generated/stripe_treasury/src/treasury_received_debit/requests.rs index 7c554ec9b..2d6329a35 100644 --- a/generated/stripe_treasury/src/treasury_received_debit/requests.rs +++ b/generated/stripe_treasury/src/treasury_received_debit/requests.rs @@ -21,7 +21,7 @@ pub struct ListTreasuryReceivedDebit<'a> { pub starting_after: Option<&'a str>, /// Only return ReceivedDebits that have the given status: `succeeded` or `failed`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, } impl<'a> ListTreasuryReceivedDebit<'a> { pub fn new(financial_account: &'a str) -> Self { @@ -35,57 +35,6 @@ impl<'a> ListTreasuryReceivedDebit<'a> { } } } -/// Only return ReceivedDebits that have the given status: `succeeded` or `failed`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryReceivedDebitStatus { - Failed, - Succeeded, -} -impl ListTreasuryReceivedDebitStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryReceivedDebitStatus::*; - match self { - Failed => "failed", - Succeeded => "succeeded", - } - } -} - -impl std::str::FromStr for ListTreasuryReceivedDebitStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryReceivedDebitStatus::*; - match s { - "failed" => Ok(Failed), - "succeeded" => Ok(Succeeded), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryReceivedDebitStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryReceivedDebitStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryReceivedDebitStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryReceivedDebitStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} impl<'a> ListTreasuryReceivedDebit<'a> { /// Returns a list of ReceivedDebits. pub fn send( diff --git a/generated/stripe_treasury/src/treasury_received_debit/types.rs b/generated/stripe_treasury/src/treasury_received_debit/types.rs index 144faefd3..5f2a097a4 100644 --- a/generated/stripe_treasury/src/treasury_received_debit/types.rs +++ b/generated/stripe_treasury/src/treasury_received_debit/types.rs @@ -32,7 +32,7 @@ pub reversal_details: Option>, @@ -166,9 +166,13 @@ impl<'de> serde::Deserialize<'de> for TreasuryReceivedDebitNetwork { .map_err(|_| serde::de::Error::custom("Unknown value for TreasuryReceivedDebitNetwork")) } } -/// Status of the ReceivedDebit. -/// ReceivedDebits are created with a status of either `succeeded` (approved) or `failed` (declined). -/// The failure reason can be found under the `failure_code`. +impl stripe_types::Object for TreasuryReceivedDebit { + type Id = stripe_treasury::TreasuryReceivedDebitId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryReceivedDebitId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryReceivedDebitStatus { Failed, @@ -227,10 +231,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryReceivedDebitStatus { .map_err(|_| serde::de::Error::custom("Unknown value for TreasuryReceivedDebitStatus")) } } -impl stripe_types::Object for TreasuryReceivedDebit { - type Id = stripe_treasury::TreasuryReceivedDebitId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryReceivedDebitId); diff --git a/generated/stripe_treasury/src/treasury_transaction/requests.rs b/generated/stripe_treasury/src/treasury_transaction/requests.rs index 201ec3dad..d2674b6cd 100644 --- a/generated/stripe_treasury/src/treasury_transaction/requests.rs +++ b/generated/stripe_treasury/src/treasury_transaction/requests.rs @@ -48,7 +48,7 @@ pub struct ListTreasuryTransaction<'a> { pub starting_after: Option<&'a str>, /// Only return Transactions that have the given status: `open`, `posted`, or `void`. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, + pub status: Option, /// A filter for the `status_transitions.posted_at` timestamp. /// When using this filter, `status=posted` and `order_by=posted_at` must also be specified. #[serde(skip_serializing_if = "Option::is_none")] @@ -121,60 +121,6 @@ impl serde::Serialize for ListTreasuryTransactionOrderBy { serializer.serialize_str(self.as_str()) } } -/// Only return Transactions that have the given status: `open`, `posted`, or `void`. -#[derive(Copy, Clone, Eq, PartialEq)] -pub enum ListTreasuryTransactionStatus { - Open, - Posted, - Void, -} -impl ListTreasuryTransactionStatus { - pub fn as_str(self) -> &'static str { - use ListTreasuryTransactionStatus::*; - match self { - Open => "open", - Posted => "posted", - Void => "void", - } - } -} - -impl std::str::FromStr for ListTreasuryTransactionStatus { - type Err = (); - fn from_str(s: &str) -> Result { - use ListTreasuryTransactionStatus::*; - match s { - "open" => Ok(Open), - "posted" => Ok(Posted), - "void" => Ok(Void), - _ => Err(()), - } - } -} -impl AsRef for ListTreasuryTransactionStatus { - fn as_ref(&self) -> &str { - self.as_str() - } -} -impl std::fmt::Display for ListTreasuryTransactionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} - -impl std::fmt::Debug for ListTreasuryTransactionStatus { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.write_str(self.as_str()) - } -} -impl serde::Serialize for ListTreasuryTransactionStatus { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - serializer.serialize_str(self.as_str()) - } -} /// A filter for the `status_transitions.posted_at` timestamp. /// When using this filter, `status=posted` and `order_by=posted_at` must also be specified. #[derive(Copy, Clone, Debug, Default, serde::Serialize)] diff --git a/generated/stripe_treasury/src/treasury_transaction/types.rs b/generated/stripe_treasury/src/treasury_transaction/types.rs index 51f6bbdcc..016e9b292 100644 --- a/generated/stripe_treasury/src/treasury_transaction/types.rs +++ b/generated/stripe_treasury/src/treasury_transaction/types.rs @@ -27,7 +27,7 @@ pub struct TreasuryTransaction { /// 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, /// Status of the Transaction. - pub status: TreasuryTransactionStatus, + pub status: stripe_treasury::TreasuryTransactionStatus, pub status_transitions: stripe_treasury::TreasuryTransactionsResourceAbstractTransactionResourceStatusTransitions, } @@ -111,7 +111,13 @@ impl<'de> serde::Deserialize<'de> for TreasuryTransactionFlowType { .map_err(|_| serde::de::Error::custom("Unknown value for TreasuryTransactionFlowType")) } } -/// Status of the Transaction. +impl stripe_types::Object for TreasuryTransaction { + type Id = stripe_treasury::TreasuryTransactionId; + fn id(&self) -> &Self::Id { + &self.id + } +} +stripe_types::def_id!(TreasuryTransactionId); #[derive(Copy, Clone, Eq, PartialEq)] pub enum TreasuryTransactionStatus { Open, @@ -173,10 +179,3 @@ impl<'de> serde::Deserialize<'de> for TreasuryTransactionStatus { .map_err(|_| serde::de::Error::custom("Unknown value for TreasuryTransactionStatus")) } } -impl stripe_types::Object for TreasuryTransaction { - type Id = stripe_treasury::TreasuryTransactionId; - fn id(&self) -> &Self::Id { - &self.id - } -} -stripe_types::def_id!(TreasuryTransactionId); diff --git a/openapi/src/codegen.rs b/openapi/src/codegen.rs index 0a7d721ff..0d4935ad9 100644 --- a/openapi/src/codegen.rs +++ b/openapi/src/codegen.rs @@ -1,5 +1,5 @@ use std::fmt::Write as _; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use anyhow::Context; use indoc::formatdoc; @@ -38,7 +38,7 @@ impl CodeGen { } fn write_api_version_file(&self) -> anyhow::Result<()> { - let base_path = PathBuf::from(Crate::SHARED.generate_to()); + let base_path = Crate::SHARED.get_path(); let mut mod_rs_contents = String::new(); let mod_rs_path = base_path.join("mod.rs"); @@ -59,11 +59,12 @@ impl CodeGen { self.write_component(component)?; } - let crate_path = PathBuf::from(Crate::SHARED.generate_to()); + let crate_path = Crate::SHARED.get_path(); let crate_mod_path = crate_path.join("mod.rs"); for (ident, typ_info) in &self.components.extra_types { let mut out = String::new(); - self.components.write_object(&typ_info.obj, &typ_info.metadata, &mut out); + let metadata = ObjectMetadata::new(ident.clone(), ObjectKind::Type); + self.components.write_object(&typ_info.obj, &metadata, &mut out); write_to_file(out, crate_path.join(format!("{}.rs", typ_info.mod_path)))?; append_to_file( format!("pub mod {0}; pub use {0}::{1};", typ_info.mod_path, ident), @@ -124,13 +125,9 @@ impl CodeGen { Ok(()) } - fn write_component_requests( - &self, - comp: &StripeObject, - module_path: &Path, - ) -> anyhow::Result<()> { + fn write_component_requests(&self, comp: &StripeObject) -> anyhow::Result<()> { let req_content = gen_requests(&comp.requests, &self.components); - write_to_file(req_content, module_path.join("requests.rs"))?; + write_to_file(req_content, comp.get_requests_content_path())?; let feature_gate = comp.mod_path(); let new_mod_file_content = formatdoc! { r#" @@ -140,21 +137,14 @@ impl CodeGen { pub use requests::*; "# }; - append_to_file(new_mod_file_content, module_path.join("mod.rs")) + append_to_file(new_mod_file_content, comp.get_requests_module_path()) } #[tracing::instrument(level = "debug", skip_all, fields(path = %comp.path()))] fn write_component(&self, comp: &StripeObject) -> anyhow::Result<()> { - let krate = comp.krate_unwrapped(); - let types_are_shared = krate.for_types() == Crate::SHARED && krate.base() != Crate::SHARED; - let types_crate_path = PathBuf::from(krate.for_types().generate_to()); - let req_crate_path = PathBuf::from(krate.base().generate_to()); - let comp_mod = req_crate_path.join(comp.mod_path()); - let struct_defs = self.gen_struct_definitions_for_component(comp); - if comp.requests.is_empty() || types_are_shared { - let types_file = types_crate_path.join(format!("{}.rs", comp.mod_path())); - write_to_file(struct_defs, types_file)?; + if !comp.has_requests() || comp.types_split_from_requests() { + write_to_file(struct_defs, comp.get_types_content_path())?; append_to_file( format!( // NB: we add doc(hidden) and doc(inline) to hide the implementation details @@ -163,30 +153,47 @@ impl CodeGen { "#[doc(hidden)]\npub mod {0};#[doc(inline)]\npub use {0}::*;", comp.mod_path() ), - types_crate_path.join("mod.rs"), + comp.types_crate().get_path_to_mod(), )?; } else { - write_to_file(struct_defs, comp_mod.join("types.rs"))?; - append_to_file("pub(crate) mod types;", comp_mod.join("mod.rs"))?; + write_to_file(struct_defs, comp.get_types_content_path())?; + append_to_file("pub(crate) mod types;", comp.get_requests_module_path())?; append_to_file( format!("pub use {0}::types::*;", comp.mod_path()), - req_crate_path.join("mod.rs"), + comp.req_crate().get_path_to_mod(), )?; } if !comp.requests.is_empty() { - append_to_file(format!("pub mod {};", comp.mod_path()), req_crate_path.join("mod.rs"))?; - self.write_component_requests(comp, &comp_mod)?; + append_to_file( + format!("pub mod {};", comp.mod_path()), + comp.req_crate().get_path_to_mod(), + )?; + self.write_component_requests(comp)?; } // Reexport in this crate if we wrote types to `stripe_shared` instead of the // component's base crate. - if types_are_shared { + if comp.types_split_from_requests() { append_to_file( format!("pub use {}::{}::*;", Crate::SHARED, comp.mod_path()), - req_crate_path.join("mod.rs"), + comp.req_crate().get_path_to_mod(), )?; } + + for (ident, obj) in &comp.deduplicated_objects { + let mut out = String::new(); + let metadata = ObjectMetadata::new(ident.clone(), obj.info.kind); + self.components.write_object(&obj.object, &metadata, &mut out); + let dst_file = match obj.info.kind { + ObjectKind::RequestParam | ObjectKind::RequestReturned => { + comp.get_requests_content_path() + } + ObjectKind::Type => comp.get_types_content_path(), + }; + append_to_file(out, dst_file)?; + } + Ok(()) } diff --git a/openapi/src/components.rs b/openapi/src/components.rs index b3369a5fb..4beeff4b5 100644 --- a/openapi/src/components.rs +++ b/openapi/src/components.rs @@ -8,10 +8,11 @@ use tracing::{debug, info}; use crate::crate_inference::validate_crate_info; use crate::crates::{infer_crate_by_package, maybe_infer_crate_by_path, Crate}; +use crate::deduplication::{deduplicate_types, DeduppedObject}; use crate::overrides::Overrides; use crate::printable::{PrintableContainer, PrintableType}; use crate::requests::parse_requests; -use crate::rust_object::{ObjectMetadata, RustObject}; +use crate::rust_object::{ObjectKind, RustObject}; use crate::rust_type::{Container, PathToType, RustType}; use crate::spec::Spec; use crate::stripe_object::{ @@ -24,7 +25,8 @@ use crate::visitor::Visit; #[derive(Clone, Debug)] pub struct TypeSpec { pub obj: RustObject, - pub metadata: ObjectMetadata, + pub doc: Option, + pub ident: RustIdent, pub mod_path: String, } @@ -33,7 +35,7 @@ pub struct Components { pub extra_types: IndexMap, } -#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct PathInfo { pub krate: Crate, pub path: Option, @@ -48,12 +50,12 @@ impl PathInfo { impl Components { #[track_caller] pub fn get(&self, path: &ComponentPath) -> &StripeObject { - &self.components[path.as_ref()] + &self.components[path] } #[track_caller] pub fn get_mut(&mut self, path: &ComponentPath) -> &mut StripeObject { - &mut self.components[path.as_ref()] + &mut self.components[path] } pub fn get_crate_members(&self, krate: Crate) -> IndexSet<&ComponentPath> { @@ -69,13 +71,6 @@ impl Components { members } - #[track_caller] - pub fn resolve_path(&self, path: &ComponentPath) -> PathInfo { - let component = self.get(path); - let krate = component.krate_unwrapped().for_types(); - PathInfo { krate, path: None } - } - pub fn construct_printable_type_from_path(&self, path: &ComponentPath) -> PrintableType { let comp = self.get(path); PrintableType::QualifiedPath { @@ -99,27 +94,45 @@ impl Components { } RustType::Path { path: PathToType::ObjectId(path), is_ref } => { let obj = self.get(path); - let path_info = self.resolve_path(path); + let krate = obj.krate_unwrapped().for_types(); PrintableType::QualifiedPath { - path: Some(path_info), + path: Some(PathInfo::new(krate)), ident: obj.id_type_ident(), is_ref: *is_ref, has_ref: false, } } + RustType::Path { path: PathToType::Deduplicated { path, ident }, is_ref } => { + let referred_typ = self.get_dedupped_type(ident, path); + let has_ref = referred_typ.object.has_reference(self); + let path = if referred_typ.info.kind == ObjectKind::Type { + Some(PathInfo { + krate: self.get(path).krate_unwrapped().for_types(), + path: None, + }) + } else { + // For now, deduplicated request types always can just reference + // the same file + None + }; + PrintableType::QualifiedPath { + path, + ident: ident.clone(), + is_ref: *is_ref, + has_ref, + } + } RustType::Path { path: PathToType::Shared(ident), is_ref } => { let referred_typ = self.get_extra_type(ident); let has_ref = referred_typ.obj.has_reference(self); PrintableType::QualifiedPath { path: Some(PathInfo { krate: Crate::SHARED, path: None }), - has_ref, - is_ref: *is_ref, ident: ident.clone(), + is_ref: *is_ref, + has_ref, } } - RustType::Path { path: PathToType::Dedupped { .. }, is_ref: _ } => { - todo!() - } + RustType::Simple(typ) => PrintableType::Simple(*typ), RustType::Container(typ) => { let inner = Box::new(self.construct_printable_type(typ.value_typ())); @@ -151,8 +164,8 @@ impl Components { } pub fn filter_unused_components(&mut self) { - let mut unused = vec![]; loop { + let mut unused = vec![]; let graph = self.gen_component_dep_graph(); for (path, component) in &self.components { // This will be a false positive here since we don't include `ApiError` in @@ -173,7 +186,7 @@ impl Components { } debug!("Filtering unused components: {unused:#?}"); - for unused_mod in unused.drain(..) { + for unused_mod in unused { self.components.remove(unused_mod.as_ref()); } } @@ -190,14 +203,14 @@ impl Components { None } - // fn run_deduplication_pass(&mut self) { - // for comp in self.components.values_mut() { - // let extra_typs = deduplicate_types(comp); - // for (ident, typ) in extra_typs { - // comp.deduplicated_objects.insert(ident, typ); - // } - // } - // } + fn run_deduplication_pass(&mut self) { + for comp in self.components.values_mut() { + let extra_typs = deduplicate_types(comp); + for (ident, typ) in extra_typs { + comp.deduplicated_objects.insert(ident, typ); + } + } + } #[tracing::instrument(level = "debug", skip(self))] fn apply_overrides(&mut self) -> anyhow::Result<()> { @@ -210,7 +223,8 @@ impl Components { override_meta.metadata.ident.clone(), TypeSpec { obj, - metadata: override_meta.metadata, + doc: override_meta.metadata.doc, + ident: override_meta.metadata.ident, mod_path: override_meta.mod_path, }, ); @@ -223,6 +237,11 @@ impl Components { pub fn get_extra_type(&self, ident: &RustIdent) -> &TypeSpec { &self.extra_types[ident] } + + #[track_caller] + pub fn get_dedupped_type(&self, ident: &RustIdent, comp: &ComponentPath) -> &DeduppedObject { + &self.get(comp).deduplicated_objects[ident] + } } pub fn get_components(spec: &Spec) -> anyhow::Result { @@ -294,8 +313,8 @@ pub fn get_components(spec: &Spec) -> anyhow::Result { components.apply_overrides()?; debug!("Finished applying overrides"); - // components.run_deduplication_pass(); - // info!("Finished deduplication pass"); + components.run_deduplication_pass(); + info!("Finished deduplication pass"); Ok(components) } diff --git a/openapi/src/crate_inference.rs b/openapi/src/crate_inference.rs index 89a81e7fd..2f6afe2e1 100644 --- a/openapi/src/crate_inference.rs +++ b/openapi/src/crate_inference.rs @@ -126,8 +126,8 @@ impl Components { // used for webhooks const PATHS_IN_TYPES: &[&str] = &["event"]; - let mut required = vec![]; loop { + let mut required = vec![]; let graph = self.gen_component_dep_graph(); for (path, component) in &self.components { if component.krate_unwrapped().are_type_defs_shared() { @@ -156,7 +156,7 @@ impl Components { if done { break; } - for req in required.drain(..) { + for req in required { self.get_mut(&req).krate_unwrapped_mut().set_share_type_defs(); } } @@ -203,8 +203,8 @@ fn infer_crates_using_deps( components: &mut Components, infer_test: fn(&Components, &ComponentPath, &ComponentGraph) -> Option, ) { - let mut new_assignments: IndexMap = IndexMap::new(); loop { + let mut new_assignments: IndexMap = IndexMap::new(); let graph = components.gen_component_dep_graph(); for (path, component) in &components.components { if component.krate().is_some() { @@ -217,7 +217,7 @@ fn infer_crates_using_deps( let no_new_assignments = new_assignments.is_empty(); trace!("Inferred {new_assignments:#?}"); - for (mod_name, krate) in new_assignments.drain(..) { + for (mod_name, krate) in new_assignments { components.get_mut(&mod_name).assign_crate(krate); } if no_new_assignments { diff --git a/openapi/src/crates.rs b/openapi/src/crates.rs index 4ab132441..a5740b5a4 100644 --- a/openapi/src/crates.rs +++ b/openapi/src/crates.rs @@ -1,5 +1,6 @@ use std::fmt::{Display, Formatter}; use std::fs::read_to_string; +use std::path::PathBuf; use lazy_static::lazy_static; use serde::Deserialize; @@ -10,17 +11,25 @@ pub struct Crate(&'static str); impl Crate { pub const SHARED: Self = Self("stripe_shared"); - pub fn generate_to(self) -> String { + pub fn generated_out_path(self) -> String { + format!("crates/{}", self.name()) + } + + pub fn name(self) -> &'static str { + self.0 + } + + fn generate_to(self) -> String { let out_path = self.generated_out_path(); format!("{out_path}/src") } - pub fn generated_out_path(self) -> String { - format!("crates/{}", self.name()) + pub fn get_path(self) -> PathBuf { + PathBuf::from(self.generate_to()) } - pub fn name(self) -> &'static str { - &self.0 + pub fn get_path_to_mod(self) -> PathBuf { + self.get_path().join("mod.rs") } } diff --git a/openapi/src/deduplication.rs b/openapi/src/deduplication.rs index 5fa4bb38e..8dc1930ba 100644 --- a/openapi/src/deduplication.rs +++ b/openapi/src/deduplication.rs @@ -1,10 +1,8 @@ -use heck::ToLowerCamelCase; use indexmap::map::Entry; use indexmap::IndexMap; use tracing::debug; -use crate::components::TypeSpec; -use crate::rust_object::{ObjectMetadata, RustObject}; +use crate::rust_object::{ObjectKind, ObjectMetadata, RustObject}; use crate::rust_type::{PathToType, RustType}; use crate::stripe_object::StripeObject; use crate::types::{ComponentPath, RustIdent}; @@ -31,10 +29,16 @@ impl Visit<'_> for CollectDuplicateObjects { } } -#[derive(Debug)] -struct DeduppedObjectInfo { - ident: RustIdent, - gen_info: ObjectGenInfo, +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct DeduppedObjectInfo { + pub ident: RustIdent, + pub kind: ObjectKind, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash)] +pub struct DeduppedObject { + pub info: DeduppedObjectInfo, + pub object: RustObject, } #[derive(Debug)] @@ -57,7 +61,7 @@ impl VisitMut for DeduplicateObjects { if let Some((obj, _)) = typ.as_object_mut() { if let Some(dedup_spec) = self.objs.get(obj) { *typ = RustType::Path { - path: PathToType::Dedupped { + path: PathToType::Deduplicated { path: self.component_path.clone(), ident: dedup_spec.ident.clone(), }, @@ -69,7 +73,12 @@ impl VisitMut for DeduplicateObjects { } } -fn doc_implied_name(doc: &str) -> Option<&str> { +fn implied_name_from_meta_doc(metadata: &ObjectMetadata) -> Option<&str> { + let doc = metadata.doc.as_ref()?; + implied_name_from_doc(doc) +} + +fn implied_name_from_doc(doc: &str) -> Option<&str> { let mut words = doc.split_ascii_whitespace(); if words.next() != Some("The") { return None; @@ -81,8 +90,22 @@ fn doc_implied_name(doc: &str) -> Option<&str> { second_word } +fn maybe_infer_by_field_name(meta: &[ObjectMetadata]) -> Option { + let type_data = meta.iter().find(|m| m.kind == ObjectKind::Type)?; + let parent = type_data.parent.as_ref()?; + let field_name = type_data.field_name.as_ref()?; + + if meta.iter().any(|m| m.field_name.as_ref() != Some(field_name)) { + return None; + } + Some(DeduppedObjectInfo { + ident: RustIdent::joined(parent, field_name), + kind: ObjectKind::Type, + }) +} + /// Try to infer an identifier given metadata about identical objects -fn infer_ident_for_duplicate_objects(meta: &[ObjectMetadata]) -> Option { +fn infer_dedupped_ident(meta: &[ObjectMetadata]) -> Option { let first = meta.first().unwrap(); if let Some(title) = &first.title { // `param` is used very generally and will not be a helpful name to infer @@ -90,27 +113,38 @@ fn infer_ident_for_duplicate_objects(meta: &[ObjectMetadata]) -> Option Option { + if matches!(obj, RustObject::FieldlessEnum(_)) { + if let Some(dedupped) = maybe_infer_by_field_name(meta) { + return Some(dedupped); } } + let ident = infer_dedupped_ident(meta)?; + let first_kind = meta.first().unwrap().kind; + if meta.iter().all(|m| m.kind == first_kind) { + return Some(DeduppedObjectInfo { ident, kind: first_kind }); + } None } #[tracing::instrument(level = "debug", skip(comp), fields(path = %comp.path()))] -pub fn deduplicate_types(comp: &mut StripeObject) -> IndexMap { +pub fn deduplicate_types(comp: &mut StripeObject) -> IndexMap { let mut objs = IndexMap::new(); let comp_path = comp.path().clone(); @@ -126,20 +160,11 @@ pub fn deduplicate_types(comp: &mut StripeObject) -> IndexMap IndexMap Result<()> { let mut fmt_cmd = std::process::Command::new("cargo"); fmt_cmd.arg("+nightly").arg("fmt").arg("--"); for krate in &*ALL_CRATES { - fmt_cmd.arg(format!("out/{}", format!("{}/src/mod.rs", krate.generated_out_path()))); + fmt_cmd.arg(format!("out/{}/src/mod.rs", krate.generated_out_path())); } fmt_cmd.arg("out/stripe_webhook/mod.rs"); diff --git a/openapi/src/object_writing.rs b/openapi/src/object_writing.rs index eb04e75e2..81a7d50d4 100644 --- a/openapi/src/object_writing.rs +++ b/openapi/src/object_writing.rs @@ -28,7 +28,7 @@ impl Components { // If the object contains any references, we'll need to print with a lifetime let has_ref = obj.has_reference(self); - let lifetime = if has_ref { Some(Lifetime::new()) } else { None }; + let lifetime = if has_ref { Some(Lifetime) } else { None }; let ident = &metadata.ident; let mut writer = ObjectWriter::new(self, ident, metadata.kind); diff --git a/openapi/src/overrides.rs b/openapi/src/overrides.rs index 8964e3c93..7b37f3149 100644 --- a/openapi/src/overrides.rs +++ b/openapi/src/overrides.rs @@ -28,7 +28,7 @@ impl Overrides { })?; overrides.insert(obj, meta); } - Ok(Overrides { overrides }) + Ok(Self { overrides }) } } @@ -60,19 +60,10 @@ fn get_override_object( .context("Could not extract field")? .extract_object() .context("Not an object")?; - Ok(( - obj.clone(), - OverrideMetadata { - metadata: ObjectMetadata { - ident: RustIdent::unchanged(data.ident), - doc: Some(data.doc.to_string()), - title: None, - field_name: None, - kind: ObjectKind::Type, - }, - mod_path: data.mod_path.to_string(), - }, - )) + let metadata = ObjectMetadata::new(RustIdent::unchanged(data.ident), ObjectKind::Type) + .doc(data.doc.to_string()); + + Ok((obj.clone(), OverrideMetadata { metadata, mod_path: data.mod_path.to_string() })) } impl VisitMut for Overrides { diff --git a/openapi/src/printable.rs b/openapi/src/printable.rs index 829ec42e9..76537656f 100644 --- a/openapi/src/printable.rs +++ b/openapi/src/printable.rs @@ -154,26 +154,17 @@ impl Display for PrintableType { } } +/// For now, we only support a single lifetime, so always creates `'a` #[derive(Debug, Copy, Clone, Eq, PartialEq)] -pub struct Lifetime(&'static str); +pub struct Lifetime; impl Lifetime { - pub fn new() -> Self { - Self::default() - } - pub fn as_str(self) -> &'static str { - self.0 + "'a" } - pub fn as_param(self) -> String { - format!("<{self}>") - } -} - -impl Default for Lifetime { - fn default() -> Self { - Self("'a") + pub fn as_param(self) -> &'static str { + "<'a>" } } diff --git a/openapi/src/rust_object.rs b/openapi/src/rust_object.rs index d477accb7..e9a8c4127 100644 --- a/openapi/src/rust_object.rs +++ b/openapi/src/rust_object.rs @@ -30,11 +30,12 @@ pub struct ObjectMetadata { /// The name of the field in the OpenAPI schema pub field_name: Option, pub kind: ObjectKind, + pub parent: Option, } impl ObjectMetadata { pub fn new(ident: RustIdent, kind: ObjectKind) -> Self { - Self { ident, doc: None, title: None, field_name: None, kind } + Self { ident, doc: None, title: None, field_name: None, kind, parent: None } } /// Attach a doc comment. @@ -59,37 +60,37 @@ impl RustObject { pub fn visit<'a, T: Visit<'a>>(&'a self, visitor: &mut T) { match self { - RustObject::Struct(fields) => { + Self::Struct(fields) => { for field in fields { visitor.visit_typ(&field.rust_type); } } - RustObject::Enum(variants) => { + Self::Enum(variants) => { for variant in variants { if let Some(typ) = &variant.rust_type { visitor.visit_typ(typ); } } } - RustObject::FieldlessEnum(_) => {} + Self::FieldlessEnum(_) => {} } } pub fn visit_mut(&mut self, visitor: &mut T) { match self { - RustObject::Struct(fields) => { + Self::Struct(fields) => { for field in fields { visitor.visit_typ_mut(&mut field.rust_type); } } - RustObject::Enum(variants) => { + Self::Enum(variants) => { for variant in variants { if let Some(typ) = &mut variant.rust_type { visitor.visit_typ_mut(typ); } } } - RustObject::FieldlessEnum(_) => {} + Self::FieldlessEnum(_) => {} } } diff --git a/openapi/src/rust_type.rs b/openapi/src/rust_type.rs index 30ae4bd44..63f3bd2c2 100644 --- a/openapi/src/rust_type.rs +++ b/openapi/src/rust_type.rs @@ -5,12 +5,6 @@ use crate::rust_object::{ObjectMetadata, RustObject}; use crate::types::{ComponentPath, RustIdent}; use crate::visitor::{Visit, VisitMut}; -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -pub enum DeduppedLocation { - Request, - Types, -} - /// A path to a type defined elsewhere. #[derive(Debug, Clone, Eq, PartialEq, Hash)] pub enum PathToType { @@ -18,9 +12,8 @@ pub enum PathToType { Component(ComponentPath), /// The id for a top-level component. ObjectId(ComponentPath), - /// A type defined in `stripe_shared` Shared(RustIdent), - Dedupped { + Deduplicated { path: ComponentPath, ident: RustIdent, }, @@ -33,32 +26,26 @@ impl PathToType { // directly, e.g. `components.get(path).rust_obj().has_reference(components)`, // but this leads to infinite recursion because of the cyclical type definitions // in the spec. For now, `false` is always accurate, so is an easy workaround - PathToType::Component(_) => false, + Self::Component(_) => false, // Always either backed by `String` or `smol_str::SmolStr` - PathToType::ObjectId(_) => false, - PathToType::Shared(ident) => { - components.get_extra_type(ident).obj.has_reference(components) - } - PathToType::Dedupped { .. } => { - todo!() + Self::ObjectId(_) => false, + Self::Shared(ident) => components.get_extra_type(ident).obj.has_reference(components), + Self::Deduplicated { path, ident } => { + components.get_dedupped_type(ident, path).object.has_reference(components) } } } pub fn is_copy(&self, components: &Components) -> bool { match self { - // NB: see cyclical type issues below. This is likely overly - // conservative, but _most_ components type are far from `copy`, only - // wrong in a small number of cases that don't affect correctness, - // just not deriving `Copy` in all possible cases - PathToType::Component(_) => false, + Self::Component(comp) => components.get(comp).rust_obj().is_copy(components), // Always either backed by `String` or `smol_str::SmolStr` - PathToType::ObjectId(_) => false, - PathToType::Shared(ident) => components.get_extra_type(ident).obj.is_copy(components), - PathToType::Dedupped { .. } => { - todo!() + Self::ObjectId(_) => false, + Self::Shared(ident) => components.get_extra_type(ident).obj.is_copy(components), + Self::Deduplicated { path, ident } => { + components.get_dedupped_type(ident, path).object.is_copy(components) } } } diff --git a/openapi/src/spec_inference.rs b/openapi/src/spec_inference.rs index cd51473f1..f99737de6 100644 --- a/openapi/src/spec_inference.rs +++ b/openapi/src/spec_inference.rs @@ -86,15 +86,17 @@ impl<'a> Inference<'a> { } } - fn build_object_type(self, data: RustObject, ident: RustIdent) -> RustType { + fn build_object_type(self, data: RustObject) -> RustType { + let next_ident = self.next_ident(); RustType::Object( data, ObjectMetadata { - ident, + ident: next_ident, doc: self.description.map(|d| d.to_string()), title: self.title.map(|t| t.to_string()), field_name: self.field_name.map(|t| t.to_string()), kind: self.kind, + parent: Some(self.curr_ident.clone()), }, ) } @@ -171,7 +173,7 @@ impl<'a> Inference<'a> { let variants = build_enum_variants(&typ.enumeration); if !variants.is_empty() { - return self.build_object_type(RustObject::FieldlessEnum(variants), self.next_ident()); + return self.build_object_type(RustObject::FieldlessEnum(variants)); } if let Some(f_name) = self.field_name { if f_name == "currency" || f_name.ends_with("_currency") { @@ -241,7 +243,7 @@ impl<'a> Inference<'a> { .build_struct_field(prop_field_name, field_spec), ); } - self.build_object_type(RustObject::Struct(fields), next_ident) + self.build_object_type(RustObject::Struct(fields)) } fn infer_any_or_one_of(&self, fields: &[ReferenceOr], field: &Schema) -> RustType { @@ -259,7 +261,7 @@ impl<'a> Inference<'a> { RustType::ext(ExtType::RangeQueryTs) } else { let enum_ = self.build_enum_variants(fields).expect("Could not build enum with fields"); - self.build_object_type(RustObject::Enum(enum_), self.next_ident()) + self.build_object_type(RustObject::Enum(enum_)) } } diff --git a/openapi/src/stripe_object.rs b/openapi/src/stripe_object.rs index 87836cef9..6c6c7d8d9 100644 --- a/openapi/src/stripe_object.rs +++ b/openapi/src/stripe_object.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::path::PathBuf; use heck::ToSnakeCase; use indexmap::IndexMap; @@ -6,8 +7,8 @@ use lazy_static::lazy_static; use openapiv3::Schema; use serde::{Deserialize, Serialize}; -use crate::components::TypeSpec; use crate::crates::Crate; +use crate::deduplication::DeduppedObject; use crate::rust_object::{ObjectKind, RustObject}; use crate::rust_type::RustType; use crate::spec_inference::Inference; @@ -53,7 +54,7 @@ pub struct StripeObject { pub data: StripeObjectData, pub krate: Option, pub stripe_doc_url: Option, - pub deduplicated_objects: IndexMap, + pub deduplicated_objects: IndexMap, } impl StripeObject { @@ -82,6 +83,52 @@ impl StripeObject { self.resource.mod_path() } + pub fn types_split_from_requests(&self) -> bool { + self.types_are_shared() && self.krate_unwrapped().base() != Crate::SHARED + } + + /// Do schema definitions live in `stripe_shared`? + pub fn types_are_shared(&self) -> bool { + let krate = self.krate_unwrapped(); + krate.for_types() == Crate::SHARED + } + + /// The crate we write schema definitions to + pub fn types_crate(&self) -> Crate { + let krate = self.krate_unwrapped(); + krate.for_types() + } + + /// The crate we write request content to + pub fn req_crate(&self) -> Crate { + let krate = self.krate_unwrapped(); + krate.base() + } + + fn get_requests_folder_path(&self) -> PathBuf { + self.req_crate().get_path().join(self.mod_path()) + } + + pub fn get_requests_module_path(&self) -> PathBuf { + self.get_requests_folder_path().join("mod.rs") + } + + pub fn get_requests_content_path(&self) -> PathBuf { + self.get_requests_folder_path().join("requests.rs") + } + + pub fn get_types_content_path(&self) -> PathBuf { + if !self.has_requests() || self.types_split_from_requests() { + self.types_crate().get_path().join(format!("{}.rs", self.mod_path())) + } else { + self.get_requests_folder_path().join("types.rs") + } + } + + pub fn has_requests(&self) -> bool { + !self.requests.is_empty() + } + pub fn path(&self) -> &ComponentPath { &self.resource.path } @@ -102,7 +149,7 @@ impl StripeObject { &self.data.obj } - pub fn is_nested_resource_of(&self, other: &StripeObject) -> bool { + pub fn is_nested_resource_of(&self, other: &Self) -> bool { if self.requests.is_empty() { return false; } diff --git a/openapi/src/templates/object_writer.rs b/openapi/src/templates/object_writer.rs index a23621eb2..ad69710ab 100644 --- a/openapi/src/templates/object_writer.rs +++ b/openapi/src/templates/object_writer.rs @@ -53,7 +53,7 @@ impl<'a> ObjectWriter<'a> { self.components.construct_printable_type(typ) } - pub fn lifetime_param(&self) -> String { + pub fn lifetime_param(&self) -> &'static str { self.lifetime.map(|l| l.as_param()).unwrap_or_default() } diff --git a/openapi/src/templates/requests.rs b/openapi/src/templates/requests.rs index f9fc0c6c6..721347e62 100644 --- a/openapi/src/templates/requests.rs +++ b/openapi/src/templates/requests.rs @@ -33,11 +33,8 @@ impl RequestSpec { let mut req_out = String::with_capacity(128); self.write_req_body(&mut req_out, components); - let lifetime_str = if self.params.has_reference(components) { - Lifetime::new().as_param() - } else { - "".into() - }; + let lifetime_str = + if self.params.has_reference(components) { Lifetime.as_param() } else { "" }; let impl_for = components.construct_printable_type(&self.params); if let Some(pagination_kind) = as_pagination_kind(&self.returned) { self.gen_paginate( diff --git a/tests/tests/it/blocking/account.rs b/tests/tests/it/blocking/account.rs index c27deeb8c..895f5ff26 100644 --- a/tests/tests/it/blocking/account.rs +++ b/tests/tests/it/blocking/account.rs @@ -1,9 +1,6 @@ use stripe::AccountId; -use stripe_connect::account::{ - CreateAccount, CreateAccountCapabilities, CreateAccountCapabilitiesAcssDebitPayments, - ListAccount, -}; -use stripe_connect::AccountCapabilitiesCardPayments; +use stripe_connect::account::{CapabilitiesParam, CapabilityParam, CreateAccount, ListAccount}; +use stripe_connect::AccountCapabilitiesStatus; use crate::mock; @@ -28,15 +25,14 @@ fn is_account_listable() { fn create_account() { mock::with_client(|client| { let mut create = CreateAccount::new(); - let mut capabilities = CreateAccountCapabilities::new(); - capabilities.acss_debit_payments = - Some(CreateAccountCapabilitiesAcssDebitPayments { requested: Some(true) }); + let mut capabilities = CapabilitiesParam::new(); + capabilities.acss_debit_payments = Some(CapabilityParam { requested: Some(true) }); create.capabilities = Some(capabilities); let result = create.send(client).unwrap(); assert_eq!(result.email, Some("site@stripe.com".to_string())); assert_eq!( result.capabilities.unwrap().card_payments, - Some(AccountCapabilitiesCardPayments::Active) + Some(AccountCapabilitiesStatus::Active) ); }); } diff --git a/tests/tests/it/blocking/product.rs b/tests/tests/it/blocking/product.rs index 722e4ec3a..2dcc1e5f8 100644 --- a/tests/tests/it/blocking/product.rs +++ b/tests/tests/it/blocking/product.rs @@ -1,4 +1,4 @@ -use stripe_product::product::{CreateProduct, CreateProductFeatures}; +use stripe_product::product::{CreateProduct, Features}; use crate::mock; @@ -9,7 +9,7 @@ use crate::mock; fn create_product() { mock::with_client(|client| { let mut create = CreateProduct::new("my product"); - let features = vec![CreateProductFeatures::new("great feature")]; + let features = vec![Features::new("great feature")]; create.features = Some(&features); let product = create.send(client).unwrap();