Skip to main content

stripe_payment/confirmation_token/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct RetrieveConfirmationTokenBuilder {
9    #[serde(skip_serializing_if = "Option::is_none")]
10    expand: Option<Vec<String>>,
11}
12#[cfg(feature = "redact-generated-debug")]
13impl std::fmt::Debug for RetrieveConfirmationTokenBuilder {
14    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
15        f.debug_struct("RetrieveConfirmationTokenBuilder").finish_non_exhaustive()
16    }
17}
18impl RetrieveConfirmationTokenBuilder {
19    fn new() -> Self {
20        Self { expand: None }
21    }
22}
23/// Retrieves an existing ConfirmationToken object
24#[derive(Clone)]
25#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
26#[derive(serde::Serialize)]
27pub struct RetrieveConfirmationToken {
28    inner: RetrieveConfirmationTokenBuilder,
29    confirmation_token: stripe_payment::ConfirmationTokenId,
30}
31#[cfg(feature = "redact-generated-debug")]
32impl std::fmt::Debug for RetrieveConfirmationToken {
33    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
34        f.debug_struct("RetrieveConfirmationToken").finish_non_exhaustive()
35    }
36}
37impl RetrieveConfirmationToken {
38    /// Construct a new `RetrieveConfirmationToken`.
39    pub fn new(confirmation_token: impl Into<stripe_payment::ConfirmationTokenId>) -> Self {
40        Self {
41            confirmation_token: confirmation_token.into(),
42            inner: RetrieveConfirmationTokenBuilder::new(),
43        }
44    }
45    /// Specifies which fields in the response should be expanded.
46    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
47        self.inner.expand = Some(expand.into());
48        self
49    }
50}
51impl RetrieveConfirmationToken {
52    /// Send the request and return the deserialized response.
53    pub async fn send<C: StripeClient>(
54        &self,
55        client: &C,
56    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
57        self.customize().send(client).await
58    }
59
60    /// Send the request and return the deserialized response, blocking until completion.
61    pub fn send_blocking<C: StripeBlockingClient>(
62        &self,
63        client: &C,
64    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
65        self.customize().send_blocking(client)
66    }
67}
68
69impl StripeRequest for RetrieveConfirmationToken {
70    type Output = stripe_payment::ConfirmationToken;
71
72    fn build(&self) -> RequestBuilder {
73        let confirmation_token = &self.confirmation_token;
74        RequestBuilder::new(StripeMethod::Get, format!("/confirmation_tokens/{confirmation_token}"))
75            .query(&self.inner)
76    }
77}
78#[derive(Clone)]
79#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
80#[derive(serde::Serialize)]
81struct CreateConfirmationTokenBuilder {
82    #[serde(skip_serializing_if = "Option::is_none")]
83    expand: Option<Vec<String>>,
84    #[serde(skip_serializing_if = "Option::is_none")]
85    payment_method: Option<String>,
86    #[serde(skip_serializing_if = "Option::is_none")]
87    payment_method_data: Option<CreateConfirmationTokenPaymentMethodData>,
88    #[serde(skip_serializing_if = "Option::is_none")]
89    payment_method_options: Option<CreateConfirmationTokenPaymentMethodOptions>,
90    #[serde(skip_serializing_if = "Option::is_none")]
91    return_url: Option<String>,
92    #[serde(skip_serializing_if = "Option::is_none")]
93    setup_future_usage: Option<stripe_payment::ConfirmationTokenSetupFutureUsage>,
94    #[serde(skip_serializing_if = "Option::is_none")]
95    shipping: Option<CreateConfirmationTokenShipping>,
96}
97#[cfg(feature = "redact-generated-debug")]
98impl std::fmt::Debug for CreateConfirmationTokenBuilder {
99    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
100        f.debug_struct("CreateConfirmationTokenBuilder").finish_non_exhaustive()
101    }
102}
103impl CreateConfirmationTokenBuilder {
104    fn new() -> Self {
105        Self {
106            expand: None,
107            payment_method: None,
108            payment_method_data: None,
109            payment_method_options: None,
110            return_url: None,
111            setup_future_usage: None,
112            shipping: None,
113        }
114    }
115}
116/// If provided, this hash will be used to create a PaymentMethod.
117#[derive(Clone)]
118#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
119#[derive(serde::Serialize)]
120pub struct CreateConfirmationTokenPaymentMethodData {
121    /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
122    #[serde(skip_serializing_if = "Option::is_none")]
123    pub acss_debit: Option<CreateConfirmationTokenPaymentMethodDataAcssDebit>,
124    /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method.
125    #[serde(skip_serializing_if = "Option::is_none")]
126    #[serde(with = "stripe_types::with_serde_json_opt")]
127    pub affirm: Option<miniserde::json::Value>,
128    /// If this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.
129    #[serde(skip_serializing_if = "Option::is_none")]
130    #[serde(with = "stripe_types::with_serde_json_opt")]
131    pub afterpay_clearpay: Option<miniserde::json::Value>,
132    /// If this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.
133    #[serde(skip_serializing_if = "Option::is_none")]
134    #[serde(with = "stripe_types::with_serde_json_opt")]
135    pub alipay: Option<miniserde::json::Value>,
136    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
137    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
138    /// The field defaults to `unspecified`.
139    #[serde(skip_serializing_if = "Option::is_none")]
140    pub allow_redisplay: Option<CreateConfirmationTokenPaymentMethodDataAllowRedisplay>,
141    /// If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.
142    #[serde(skip_serializing_if = "Option::is_none")]
143    #[serde(with = "stripe_types::with_serde_json_opt")]
144    pub alma: Option<miniserde::json::Value>,
145    /// If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
146    #[serde(skip_serializing_if = "Option::is_none")]
147    #[serde(with = "stripe_types::with_serde_json_opt")]
148    pub amazon_pay: Option<miniserde::json::Value>,
149    /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
150    #[serde(skip_serializing_if = "Option::is_none")]
151    pub au_becs_debit: Option<CreateConfirmationTokenPaymentMethodDataAuBecsDebit>,
152    /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
153    #[serde(skip_serializing_if = "Option::is_none")]
154    pub bacs_debit: Option<CreateConfirmationTokenPaymentMethodDataBacsDebit>,
155    /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.
156    #[serde(skip_serializing_if = "Option::is_none")]
157    #[serde(with = "stripe_types::with_serde_json_opt")]
158    pub bancontact: Option<miniserde::json::Value>,
159    /// If this is a `billie` PaymentMethod, this hash contains details about the Billie payment method.
160    #[serde(skip_serializing_if = "Option::is_none")]
161    #[serde(with = "stripe_types::with_serde_json_opt")]
162    pub billie: Option<miniserde::json::Value>,
163    /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
164    #[serde(skip_serializing_if = "Option::is_none")]
165    pub billing_details: Option<CreateConfirmationTokenPaymentMethodDataBillingDetails>,
166    /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method.
167    #[serde(skip_serializing_if = "Option::is_none")]
168    #[serde(with = "stripe_types::with_serde_json_opt")]
169    pub blik: Option<miniserde::json::Value>,
170    /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
171    #[serde(skip_serializing_if = "Option::is_none")]
172    pub boleto: Option<CreateConfirmationTokenPaymentMethodDataBoleto>,
173    /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
174    #[serde(skip_serializing_if = "Option::is_none")]
175    #[serde(with = "stripe_types::with_serde_json_opt")]
176    pub cashapp: Option<miniserde::json::Value>,
177    /// If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
178    #[serde(skip_serializing_if = "Option::is_none")]
179    #[serde(with = "stripe_types::with_serde_json_opt")]
180    pub crypto: Option<miniserde::json::Value>,
181    /// If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
182    #[serde(skip_serializing_if = "Option::is_none")]
183    #[serde(with = "stripe_types::with_serde_json_opt")]
184    pub customer_balance: Option<miniserde::json::Value>,
185    /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
186    #[serde(skip_serializing_if = "Option::is_none")]
187    pub eps: Option<CreateConfirmationTokenPaymentMethodDataEps>,
188    /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
189    #[serde(skip_serializing_if = "Option::is_none")]
190    pub fpx: Option<CreateConfirmationTokenPaymentMethodDataFpx>,
191    /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.
192    #[serde(skip_serializing_if = "Option::is_none")]
193    #[serde(with = "stripe_types::with_serde_json_opt")]
194    pub giropay: Option<miniserde::json::Value>,
195    /// If this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.
196    #[serde(skip_serializing_if = "Option::is_none")]
197    #[serde(with = "stripe_types::with_serde_json_opt")]
198    pub grabpay: Option<miniserde::json::Value>,
199    /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
200    #[serde(skip_serializing_if = "Option::is_none")]
201    pub ideal: Option<CreateConfirmationTokenPaymentMethodDataIdeal>,
202    /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
203    #[serde(skip_serializing_if = "Option::is_none")]
204    #[serde(with = "stripe_types::with_serde_json_opt")]
205    pub interac_present: Option<miniserde::json::Value>,
206    /// If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method.
207    #[serde(skip_serializing_if = "Option::is_none")]
208    #[serde(with = "stripe_types::with_serde_json_opt")]
209    pub kakao_pay: Option<miniserde::json::Value>,
210    /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
211    #[serde(skip_serializing_if = "Option::is_none")]
212    pub klarna: Option<CreateConfirmationTokenPaymentMethodDataKlarna>,
213    /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method.
214    #[serde(skip_serializing_if = "Option::is_none")]
215    #[serde(with = "stripe_types::with_serde_json_opt")]
216    pub konbini: Option<miniserde::json::Value>,
217    /// If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method.
218    #[serde(skip_serializing_if = "Option::is_none")]
219    #[serde(with = "stripe_types::with_serde_json_opt")]
220    pub kr_card: Option<miniserde::json::Value>,
221    /// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method.
222    #[serde(skip_serializing_if = "Option::is_none")]
223    #[serde(with = "stripe_types::with_serde_json_opt")]
224    pub link: Option<miniserde::json::Value>,
225    /// If this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.
226    #[serde(skip_serializing_if = "Option::is_none")]
227    #[serde(with = "stripe_types::with_serde_json_opt")]
228    pub mb_way: Option<miniserde::json::Value>,
229    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
230    /// This can be useful for storing additional information about the object in a structured format.
231    /// Individual keys can be unset by posting an empty value to them.
232    /// All keys can be unset by posting an empty value to `metadata`.
233    #[serde(skip_serializing_if = "Option::is_none")]
234    pub metadata: Option<std::collections::HashMap<String, String>>,
235    /// If this is a `mobilepay` PaymentMethod, this hash contains details about the MobilePay payment method.
236    #[serde(skip_serializing_if = "Option::is_none")]
237    #[serde(with = "stripe_types::with_serde_json_opt")]
238    pub mobilepay: Option<miniserde::json::Value>,
239    /// If this is a `multibanco` PaymentMethod, this hash contains details about the Multibanco payment method.
240    #[serde(skip_serializing_if = "Option::is_none")]
241    #[serde(with = "stripe_types::with_serde_json_opt")]
242    pub multibanco: Option<miniserde::json::Value>,
243    /// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
244    #[serde(skip_serializing_if = "Option::is_none")]
245    pub naver_pay: Option<CreateConfirmationTokenPaymentMethodDataNaverPay>,
246    /// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
247    #[serde(skip_serializing_if = "Option::is_none")]
248    pub nz_bank_account: Option<CreateConfirmationTokenPaymentMethodDataNzBankAccount>,
249    /// If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.
250    #[serde(skip_serializing_if = "Option::is_none")]
251    #[serde(with = "stripe_types::with_serde_json_opt")]
252    pub oxxo: Option<miniserde::json::Value>,
253    /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
254    #[serde(skip_serializing_if = "Option::is_none")]
255    pub p24: Option<CreateConfirmationTokenPaymentMethodDataP24>,
256    /// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method.
257    #[serde(skip_serializing_if = "Option::is_none")]
258    #[serde(with = "stripe_types::with_serde_json_opt")]
259    pub pay_by_bank: Option<miniserde::json::Value>,
260    /// If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method.
261    #[serde(skip_serializing_if = "Option::is_none")]
262    #[serde(with = "stripe_types::with_serde_json_opt")]
263    pub payco: Option<miniserde::json::Value>,
264    /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method.
265    #[serde(skip_serializing_if = "Option::is_none")]
266    #[serde(with = "stripe_types::with_serde_json_opt")]
267    pub paynow: Option<miniserde::json::Value>,
268    /// If this is a `paypal` PaymentMethod, this hash contains details about the PayPal payment method.
269    #[serde(skip_serializing_if = "Option::is_none")]
270    #[serde(with = "stripe_types::with_serde_json_opt")]
271    pub paypal: Option<miniserde::json::Value>,
272    /// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
273    #[serde(skip_serializing_if = "Option::is_none")]
274    pub payto: Option<CreateConfirmationTokenPaymentMethodDataPayto>,
275    /// If this is a `pix` PaymentMethod, this hash contains details about the Pix payment method.
276    #[serde(skip_serializing_if = "Option::is_none")]
277    #[serde(with = "stripe_types::with_serde_json_opt")]
278    pub pix: Option<miniserde::json::Value>,
279    /// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method.
280    #[serde(skip_serializing_if = "Option::is_none")]
281    #[serde(with = "stripe_types::with_serde_json_opt")]
282    pub promptpay: Option<miniserde::json::Value>,
283    /// Options to configure Radar.
284    /// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
285    #[serde(skip_serializing_if = "Option::is_none")]
286    pub radar_options: Option<CreateConfirmationTokenPaymentMethodDataRadarOptions>,
287    /// If this is a `revolut_pay` PaymentMethod, this hash contains details about the Revolut Pay payment method.
288    #[serde(skip_serializing_if = "Option::is_none")]
289    #[serde(with = "stripe_types::with_serde_json_opt")]
290    pub revolut_pay: Option<miniserde::json::Value>,
291    /// If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method.
292    #[serde(skip_serializing_if = "Option::is_none")]
293    #[serde(with = "stripe_types::with_serde_json_opt")]
294    pub samsung_pay: Option<miniserde::json::Value>,
295    /// If this is a `satispay` PaymentMethod, this hash contains details about the Satispay payment method.
296    #[serde(skip_serializing_if = "Option::is_none")]
297    #[serde(with = "stripe_types::with_serde_json_opt")]
298    pub satispay: Option<miniserde::json::Value>,
299    /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
300    #[serde(skip_serializing_if = "Option::is_none")]
301    pub sepa_debit: Option<CreateConfirmationTokenPaymentMethodDataSepaDebit>,
302    /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
303    #[serde(skip_serializing_if = "Option::is_none")]
304    pub sofort: Option<CreateConfirmationTokenPaymentMethodDataSofort>,
305    /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method.
306    #[serde(skip_serializing_if = "Option::is_none")]
307    #[serde(with = "stripe_types::with_serde_json_opt")]
308    pub swish: Option<miniserde::json::Value>,
309    /// If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
310    #[serde(skip_serializing_if = "Option::is_none")]
311    #[serde(with = "stripe_types::with_serde_json_opt")]
312    pub twint: Option<miniserde::json::Value>,
313    /// The type of the PaymentMethod.
314    /// An additional hash is included on the PaymentMethod with a name matching this value.
315    /// It contains additional information specific to the PaymentMethod type.
316    #[serde(rename = "type")]
317    pub type_: CreateConfirmationTokenPaymentMethodDataType,
318    /// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
319    #[serde(skip_serializing_if = "Option::is_none")]
320    pub upi: Option<CreateConfirmationTokenPaymentMethodDataUpi>,
321    /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
322    #[serde(skip_serializing_if = "Option::is_none")]
323    pub us_bank_account: Option<CreateConfirmationTokenPaymentMethodDataUsBankAccount>,
324    /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.
325    #[serde(skip_serializing_if = "Option::is_none")]
326    #[serde(with = "stripe_types::with_serde_json_opt")]
327    pub wechat_pay: Option<miniserde::json::Value>,
328    /// If this is a `zip` PaymentMethod, this hash contains details about the Zip payment method.
329    #[serde(skip_serializing_if = "Option::is_none")]
330    #[serde(with = "stripe_types::with_serde_json_opt")]
331    pub zip: Option<miniserde::json::Value>,
332}
333#[cfg(feature = "redact-generated-debug")]
334impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodData {
335    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
336        f.debug_struct("CreateConfirmationTokenPaymentMethodData").finish_non_exhaustive()
337    }
338}
339impl CreateConfirmationTokenPaymentMethodData {
340    pub fn new(type_: impl Into<CreateConfirmationTokenPaymentMethodDataType>) -> Self {
341        Self {
342            acss_debit: None,
343            affirm: None,
344            afterpay_clearpay: None,
345            alipay: None,
346            allow_redisplay: None,
347            alma: None,
348            amazon_pay: None,
349            au_becs_debit: None,
350            bacs_debit: None,
351            bancontact: None,
352            billie: None,
353            billing_details: None,
354            blik: None,
355            boleto: None,
356            cashapp: None,
357            crypto: None,
358            customer_balance: None,
359            eps: None,
360            fpx: None,
361            giropay: None,
362            grabpay: None,
363            ideal: None,
364            interac_present: None,
365            kakao_pay: None,
366            klarna: None,
367            konbini: None,
368            kr_card: None,
369            link: None,
370            mb_way: None,
371            metadata: None,
372            mobilepay: None,
373            multibanco: None,
374            naver_pay: None,
375            nz_bank_account: None,
376            oxxo: None,
377            p24: None,
378            pay_by_bank: None,
379            payco: None,
380            paynow: None,
381            paypal: None,
382            payto: None,
383            pix: None,
384            promptpay: None,
385            radar_options: None,
386            revolut_pay: None,
387            samsung_pay: None,
388            satispay: None,
389            sepa_debit: None,
390            sofort: None,
391            swish: None,
392            twint: None,
393            type_: type_.into(),
394            upi: None,
395            us_bank_account: None,
396            wechat_pay: None,
397            zip: None,
398        }
399    }
400}
401/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
402#[derive(Clone, Eq, PartialEq)]
403#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
404#[derive(serde::Serialize)]
405pub struct CreateConfirmationTokenPaymentMethodDataAcssDebit {
406    /// Customer's bank account number.
407    pub account_number: String,
408    /// Institution number of the customer's bank.
409    pub institution_number: String,
410    /// Transit number of the customer's bank.
411    pub transit_number: String,
412}
413#[cfg(feature = "redact-generated-debug")]
414impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataAcssDebit {
415    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
416        f.debug_struct("CreateConfirmationTokenPaymentMethodDataAcssDebit").finish_non_exhaustive()
417    }
418}
419impl CreateConfirmationTokenPaymentMethodDataAcssDebit {
420    pub fn new(
421        account_number: impl Into<String>,
422        institution_number: impl Into<String>,
423        transit_number: impl Into<String>,
424    ) -> Self {
425        Self {
426            account_number: account_number.into(),
427            institution_number: institution_number.into(),
428            transit_number: transit_number.into(),
429        }
430    }
431}
432/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
433/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
434/// The field defaults to `unspecified`.
435#[derive(Clone, Eq, PartialEq)]
436#[non_exhaustive]
437pub enum CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
438    Always,
439    Limited,
440    Unspecified,
441    /// An unrecognized value from Stripe. Should not be used as a request parameter.
442    Unknown(String),
443}
444impl CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
445    pub fn as_str(&self) -> &str {
446        use CreateConfirmationTokenPaymentMethodDataAllowRedisplay::*;
447        match self {
448            Always => "always",
449            Limited => "limited",
450            Unspecified => "unspecified",
451            Unknown(v) => v,
452        }
453    }
454}
455
456impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
457    type Err = std::convert::Infallible;
458    fn from_str(s: &str) -> Result<Self, Self::Err> {
459        use CreateConfirmationTokenPaymentMethodDataAllowRedisplay::*;
460        match s {
461            "always" => Ok(Always),
462            "limited" => Ok(Limited),
463            "unspecified" => Ok(Unspecified),
464            v => {
465                tracing::warn!(
466                    "Unknown value '{}' for enum '{}'",
467                    v,
468                    "CreateConfirmationTokenPaymentMethodDataAllowRedisplay"
469                );
470                Ok(Unknown(v.to_owned()))
471            }
472        }
473    }
474}
475impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
476    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
477        f.write_str(self.as_str())
478    }
479}
480
481#[cfg(not(feature = "redact-generated-debug"))]
482impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
483    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
484        f.write_str(self.as_str())
485    }
486}
487#[cfg(feature = "redact-generated-debug")]
488impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
489    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
490        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataAllowRedisplay))
491            .finish_non_exhaustive()
492    }
493}
494impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
495    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
496    where
497        S: serde::Serializer,
498    {
499        serializer.serialize_str(self.as_str())
500    }
501}
502#[cfg(feature = "deserialize")]
503impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataAllowRedisplay {
504    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
505        use std::str::FromStr;
506        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
507        Ok(Self::from_str(&s).expect("infallible"))
508    }
509}
510/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
511#[derive(Clone, Eq, PartialEq)]
512#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
513#[derive(serde::Serialize)]
514pub struct CreateConfirmationTokenPaymentMethodDataAuBecsDebit {
515    /// The account number for the bank account.
516    pub account_number: String,
517    /// Bank-State-Branch number of the bank account.
518    pub bsb_number: String,
519}
520#[cfg(feature = "redact-generated-debug")]
521impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataAuBecsDebit {
522    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
523        f.debug_struct("CreateConfirmationTokenPaymentMethodDataAuBecsDebit")
524            .finish_non_exhaustive()
525    }
526}
527impl CreateConfirmationTokenPaymentMethodDataAuBecsDebit {
528    pub fn new(account_number: impl Into<String>, bsb_number: impl Into<String>) -> Self {
529        Self { account_number: account_number.into(), bsb_number: bsb_number.into() }
530    }
531}
532/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
533#[derive(Clone, Eq, PartialEq)]
534#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
535#[derive(serde::Serialize)]
536pub struct CreateConfirmationTokenPaymentMethodDataBacsDebit {
537    /// Account number of the bank account that the funds will be debited from.
538    #[serde(skip_serializing_if = "Option::is_none")]
539    pub account_number: Option<String>,
540    /// Sort code of the bank account. (e.g., `10-20-30`)
541    #[serde(skip_serializing_if = "Option::is_none")]
542    pub sort_code: Option<String>,
543}
544#[cfg(feature = "redact-generated-debug")]
545impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataBacsDebit {
546    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
547        f.debug_struct("CreateConfirmationTokenPaymentMethodDataBacsDebit").finish_non_exhaustive()
548    }
549}
550impl CreateConfirmationTokenPaymentMethodDataBacsDebit {
551    pub fn new() -> Self {
552        Self { account_number: None, sort_code: None }
553    }
554}
555impl Default for CreateConfirmationTokenPaymentMethodDataBacsDebit {
556    fn default() -> Self {
557        Self::new()
558    }
559}
560/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
561#[derive(Clone, Eq, PartialEq)]
562#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
563#[derive(serde::Serialize)]
564pub struct CreateConfirmationTokenPaymentMethodDataBillingDetails {
565    /// Billing address.
566    #[serde(skip_serializing_if = "Option::is_none")]
567    pub address: Option<CreateConfirmationTokenPaymentMethodDataBillingDetailsAddress>,
568    /// Email address.
569    #[serde(skip_serializing_if = "Option::is_none")]
570    pub email: Option<String>,
571    /// Full name.
572    #[serde(skip_serializing_if = "Option::is_none")]
573    pub name: Option<String>,
574    /// Billing phone number (including extension).
575    #[serde(skip_serializing_if = "Option::is_none")]
576    pub phone: Option<String>,
577    /// Taxpayer identification number.
578    /// Used only for transactions between LATAM buyers and non-LATAM sellers.
579    #[serde(skip_serializing_if = "Option::is_none")]
580    pub tax_id: Option<String>,
581}
582#[cfg(feature = "redact-generated-debug")]
583impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataBillingDetails {
584    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
585        f.debug_struct("CreateConfirmationTokenPaymentMethodDataBillingDetails")
586            .finish_non_exhaustive()
587    }
588}
589impl CreateConfirmationTokenPaymentMethodDataBillingDetails {
590    pub fn new() -> Self {
591        Self { address: None, email: None, name: None, phone: None, tax_id: None }
592    }
593}
594impl Default for CreateConfirmationTokenPaymentMethodDataBillingDetails {
595    fn default() -> Self {
596        Self::new()
597    }
598}
599/// Billing address.
600#[derive(Clone, Eq, PartialEq)]
601#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
602#[derive(serde::Serialize)]
603pub struct CreateConfirmationTokenPaymentMethodDataBillingDetailsAddress {
604    /// City, district, suburb, town, or village.
605    #[serde(skip_serializing_if = "Option::is_none")]
606    pub city: Option<String>,
607    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
608    #[serde(skip_serializing_if = "Option::is_none")]
609    pub country: Option<String>,
610    /// Address line 1, such as the street, PO Box, or company name.
611    #[serde(skip_serializing_if = "Option::is_none")]
612    pub line1: Option<String>,
613    /// Address line 2, such as the apartment, suite, unit, or building.
614    #[serde(skip_serializing_if = "Option::is_none")]
615    pub line2: Option<String>,
616    /// ZIP or postal code.
617    #[serde(skip_serializing_if = "Option::is_none")]
618    pub postal_code: Option<String>,
619    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
620    #[serde(skip_serializing_if = "Option::is_none")]
621    pub state: Option<String>,
622}
623#[cfg(feature = "redact-generated-debug")]
624impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataBillingDetailsAddress {
625    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
626        f.debug_struct("CreateConfirmationTokenPaymentMethodDataBillingDetailsAddress")
627            .finish_non_exhaustive()
628    }
629}
630impl CreateConfirmationTokenPaymentMethodDataBillingDetailsAddress {
631    pub fn new() -> Self {
632        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
633    }
634}
635impl Default for CreateConfirmationTokenPaymentMethodDataBillingDetailsAddress {
636    fn default() -> Self {
637        Self::new()
638    }
639}
640/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
641#[derive(Clone, Eq, PartialEq)]
642#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
643#[derive(serde::Serialize)]
644pub struct CreateConfirmationTokenPaymentMethodDataBoleto {
645    /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
646    pub tax_id: String,
647}
648#[cfg(feature = "redact-generated-debug")]
649impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataBoleto {
650    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
651        f.debug_struct("CreateConfirmationTokenPaymentMethodDataBoleto").finish_non_exhaustive()
652    }
653}
654impl CreateConfirmationTokenPaymentMethodDataBoleto {
655    pub fn new(tax_id: impl Into<String>) -> Self {
656        Self { tax_id: tax_id.into() }
657    }
658}
659/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
660#[derive(Clone, Eq, PartialEq)]
661#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
662#[derive(serde::Serialize)]
663pub struct CreateConfirmationTokenPaymentMethodDataEps {
664    /// The customer's bank.
665    #[serde(skip_serializing_if = "Option::is_none")]
666    pub bank: Option<CreateConfirmationTokenPaymentMethodDataEpsBank>,
667}
668#[cfg(feature = "redact-generated-debug")]
669impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataEps {
670    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
671        f.debug_struct("CreateConfirmationTokenPaymentMethodDataEps").finish_non_exhaustive()
672    }
673}
674impl CreateConfirmationTokenPaymentMethodDataEps {
675    pub fn new() -> Self {
676        Self { bank: None }
677    }
678}
679impl Default for CreateConfirmationTokenPaymentMethodDataEps {
680    fn default() -> Self {
681        Self::new()
682    }
683}
684/// The customer's bank.
685#[derive(Clone, Eq, PartialEq)]
686#[non_exhaustive]
687pub enum CreateConfirmationTokenPaymentMethodDataEpsBank {
688    ArzteUndApothekerBank,
689    AustrianAnadiBankAg,
690    BankAustria,
691    BankhausCarlSpangler,
692    BankhausSchelhammerUndSchatteraAg,
693    BawagPskAg,
694    BksBankAg,
695    BrullKallmusBankAg,
696    BtvVierLanderBank,
697    CapitalBankGraweGruppeAg,
698    DeutscheBankAg,
699    Dolomitenbank,
700    EasybankAg,
701    ErsteBankUndSparkassen,
702    HypoAlpeadriabankInternationalAg,
703    HypoBankBurgenlandAktiengesellschaft,
704    HypoNoeLbFurNiederosterreichUWien,
705    HypoOberosterreichSalzburgSteiermark,
706    HypoTirolBankAg,
707    HypoVorarlbergBankAg,
708    MarchfelderBank,
709    OberbankAg,
710    RaiffeisenBankengruppeOsterreich,
711    SchoellerbankAg,
712    SpardaBankWien,
713    VolksbankGruppe,
714    VolkskreditbankAg,
715    VrBankBraunau,
716    /// An unrecognized value from Stripe. Should not be used as a request parameter.
717    Unknown(String),
718}
719impl CreateConfirmationTokenPaymentMethodDataEpsBank {
720    pub fn as_str(&self) -> &str {
721        use CreateConfirmationTokenPaymentMethodDataEpsBank::*;
722        match self {
723            ArzteUndApothekerBank => "arzte_und_apotheker_bank",
724            AustrianAnadiBankAg => "austrian_anadi_bank_ag",
725            BankAustria => "bank_austria",
726            BankhausCarlSpangler => "bankhaus_carl_spangler",
727            BankhausSchelhammerUndSchatteraAg => "bankhaus_schelhammer_und_schattera_ag",
728            BawagPskAg => "bawag_psk_ag",
729            BksBankAg => "bks_bank_ag",
730            BrullKallmusBankAg => "brull_kallmus_bank_ag",
731            BtvVierLanderBank => "btv_vier_lander_bank",
732            CapitalBankGraweGruppeAg => "capital_bank_grawe_gruppe_ag",
733            DeutscheBankAg => "deutsche_bank_ag",
734            Dolomitenbank => "dolomitenbank",
735            EasybankAg => "easybank_ag",
736            ErsteBankUndSparkassen => "erste_bank_und_sparkassen",
737            HypoAlpeadriabankInternationalAg => "hypo_alpeadriabank_international_ag",
738            HypoBankBurgenlandAktiengesellschaft => "hypo_bank_burgenland_aktiengesellschaft",
739            HypoNoeLbFurNiederosterreichUWien => "hypo_noe_lb_fur_niederosterreich_u_wien",
740            HypoOberosterreichSalzburgSteiermark => "hypo_oberosterreich_salzburg_steiermark",
741            HypoTirolBankAg => "hypo_tirol_bank_ag",
742            HypoVorarlbergBankAg => "hypo_vorarlberg_bank_ag",
743            MarchfelderBank => "marchfelder_bank",
744            OberbankAg => "oberbank_ag",
745            RaiffeisenBankengruppeOsterreich => "raiffeisen_bankengruppe_osterreich",
746            SchoellerbankAg => "schoellerbank_ag",
747            SpardaBankWien => "sparda_bank_wien",
748            VolksbankGruppe => "volksbank_gruppe",
749            VolkskreditbankAg => "volkskreditbank_ag",
750            VrBankBraunau => "vr_bank_braunau",
751            Unknown(v) => v,
752        }
753    }
754}
755
756impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataEpsBank {
757    type Err = std::convert::Infallible;
758    fn from_str(s: &str) -> Result<Self, Self::Err> {
759        use CreateConfirmationTokenPaymentMethodDataEpsBank::*;
760        match s {
761            "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank),
762            "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg),
763            "bank_austria" => Ok(BankAustria),
764            "bankhaus_carl_spangler" => Ok(BankhausCarlSpangler),
765            "bankhaus_schelhammer_und_schattera_ag" => Ok(BankhausSchelhammerUndSchatteraAg),
766            "bawag_psk_ag" => Ok(BawagPskAg),
767            "bks_bank_ag" => Ok(BksBankAg),
768            "brull_kallmus_bank_ag" => Ok(BrullKallmusBankAg),
769            "btv_vier_lander_bank" => Ok(BtvVierLanderBank),
770            "capital_bank_grawe_gruppe_ag" => Ok(CapitalBankGraweGruppeAg),
771            "deutsche_bank_ag" => Ok(DeutscheBankAg),
772            "dolomitenbank" => Ok(Dolomitenbank),
773            "easybank_ag" => Ok(EasybankAg),
774            "erste_bank_und_sparkassen" => Ok(ErsteBankUndSparkassen),
775            "hypo_alpeadriabank_international_ag" => Ok(HypoAlpeadriabankInternationalAg),
776            "hypo_bank_burgenland_aktiengesellschaft" => Ok(HypoBankBurgenlandAktiengesellschaft),
777            "hypo_noe_lb_fur_niederosterreich_u_wien" => Ok(HypoNoeLbFurNiederosterreichUWien),
778            "hypo_oberosterreich_salzburg_steiermark" => Ok(HypoOberosterreichSalzburgSteiermark),
779            "hypo_tirol_bank_ag" => Ok(HypoTirolBankAg),
780            "hypo_vorarlberg_bank_ag" => Ok(HypoVorarlbergBankAg),
781            "marchfelder_bank" => Ok(MarchfelderBank),
782            "oberbank_ag" => Ok(OberbankAg),
783            "raiffeisen_bankengruppe_osterreich" => Ok(RaiffeisenBankengruppeOsterreich),
784            "schoellerbank_ag" => Ok(SchoellerbankAg),
785            "sparda_bank_wien" => Ok(SpardaBankWien),
786            "volksbank_gruppe" => Ok(VolksbankGruppe),
787            "volkskreditbank_ag" => Ok(VolkskreditbankAg),
788            "vr_bank_braunau" => Ok(VrBankBraunau),
789            v => {
790                tracing::warn!(
791                    "Unknown value '{}' for enum '{}'",
792                    v,
793                    "CreateConfirmationTokenPaymentMethodDataEpsBank"
794                );
795                Ok(Unknown(v.to_owned()))
796            }
797        }
798    }
799}
800impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataEpsBank {
801    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
802        f.write_str(self.as_str())
803    }
804}
805
806#[cfg(not(feature = "redact-generated-debug"))]
807impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataEpsBank {
808    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
809        f.write_str(self.as_str())
810    }
811}
812#[cfg(feature = "redact-generated-debug")]
813impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataEpsBank {
814    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
815        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataEpsBank))
816            .finish_non_exhaustive()
817    }
818}
819impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataEpsBank {
820    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
821    where
822        S: serde::Serializer,
823    {
824        serializer.serialize_str(self.as_str())
825    }
826}
827#[cfg(feature = "deserialize")]
828impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataEpsBank {
829    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
830        use std::str::FromStr;
831        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
832        Ok(Self::from_str(&s).expect("infallible"))
833    }
834}
835/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
836#[derive(Clone, Eq, PartialEq)]
837#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
838#[derive(serde::Serialize)]
839pub struct CreateConfirmationTokenPaymentMethodDataFpx {
840    /// Account holder type for FPX transaction
841    #[serde(skip_serializing_if = "Option::is_none")]
842    pub account_holder_type: Option<CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType>,
843    /// The customer's bank.
844    pub bank: CreateConfirmationTokenPaymentMethodDataFpxBank,
845}
846#[cfg(feature = "redact-generated-debug")]
847impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataFpx {
848    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
849        f.debug_struct("CreateConfirmationTokenPaymentMethodDataFpx").finish_non_exhaustive()
850    }
851}
852impl CreateConfirmationTokenPaymentMethodDataFpx {
853    pub fn new(bank: impl Into<CreateConfirmationTokenPaymentMethodDataFpxBank>) -> Self {
854        Self { account_holder_type: None, bank: bank.into() }
855    }
856}
857/// Account holder type for FPX transaction
858#[derive(Clone, Eq, PartialEq)]
859#[non_exhaustive]
860pub enum CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
861    Company,
862    Individual,
863    /// An unrecognized value from Stripe. Should not be used as a request parameter.
864    Unknown(String),
865}
866impl CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
867    pub fn as_str(&self) -> &str {
868        use CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType::*;
869        match self {
870            Company => "company",
871            Individual => "individual",
872            Unknown(v) => v,
873        }
874    }
875}
876
877impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
878    type Err = std::convert::Infallible;
879    fn from_str(s: &str) -> Result<Self, Self::Err> {
880        use CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType::*;
881        match s {
882            "company" => Ok(Company),
883            "individual" => Ok(Individual),
884            v => {
885                tracing::warn!(
886                    "Unknown value '{}' for enum '{}'",
887                    v,
888                    "CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType"
889                );
890                Ok(Unknown(v.to_owned()))
891            }
892        }
893    }
894}
895impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
896    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
897        f.write_str(self.as_str())
898    }
899}
900
901#[cfg(not(feature = "redact-generated-debug"))]
902impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
903    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
904        f.write_str(self.as_str())
905    }
906}
907#[cfg(feature = "redact-generated-debug")]
908impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
909    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
910        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType))
911            .finish_non_exhaustive()
912    }
913}
914impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
915    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
916    where
917        S: serde::Serializer,
918    {
919        serializer.serialize_str(self.as_str())
920    }
921}
922#[cfg(feature = "deserialize")]
923impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataFpxAccountHolderType {
924    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
925        use std::str::FromStr;
926        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
927        Ok(Self::from_str(&s).expect("infallible"))
928    }
929}
930/// The customer's bank.
931#[derive(Clone, Eq, PartialEq)]
932#[non_exhaustive]
933pub enum CreateConfirmationTokenPaymentMethodDataFpxBank {
934    AffinBank,
935    Agrobank,
936    AllianceBank,
937    Ambank,
938    BankIslam,
939    BankMuamalat,
940    BankOfChina,
941    BankRakyat,
942    Bsn,
943    Cimb,
944    DeutscheBank,
945    HongLeongBank,
946    Hsbc,
947    Kfh,
948    Maybank2e,
949    Maybank2u,
950    Ocbc,
951    PbEnterprise,
952    PublicBank,
953    Rhb,
954    StandardChartered,
955    Uob,
956    /// An unrecognized value from Stripe. Should not be used as a request parameter.
957    Unknown(String),
958}
959impl CreateConfirmationTokenPaymentMethodDataFpxBank {
960    pub fn as_str(&self) -> &str {
961        use CreateConfirmationTokenPaymentMethodDataFpxBank::*;
962        match self {
963            AffinBank => "affin_bank",
964            Agrobank => "agrobank",
965            AllianceBank => "alliance_bank",
966            Ambank => "ambank",
967            BankIslam => "bank_islam",
968            BankMuamalat => "bank_muamalat",
969            BankOfChina => "bank_of_china",
970            BankRakyat => "bank_rakyat",
971            Bsn => "bsn",
972            Cimb => "cimb",
973            DeutscheBank => "deutsche_bank",
974            HongLeongBank => "hong_leong_bank",
975            Hsbc => "hsbc",
976            Kfh => "kfh",
977            Maybank2e => "maybank2e",
978            Maybank2u => "maybank2u",
979            Ocbc => "ocbc",
980            PbEnterprise => "pb_enterprise",
981            PublicBank => "public_bank",
982            Rhb => "rhb",
983            StandardChartered => "standard_chartered",
984            Uob => "uob",
985            Unknown(v) => v,
986        }
987    }
988}
989
990impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataFpxBank {
991    type Err = std::convert::Infallible;
992    fn from_str(s: &str) -> Result<Self, Self::Err> {
993        use CreateConfirmationTokenPaymentMethodDataFpxBank::*;
994        match s {
995            "affin_bank" => Ok(AffinBank),
996            "agrobank" => Ok(Agrobank),
997            "alliance_bank" => Ok(AllianceBank),
998            "ambank" => Ok(Ambank),
999            "bank_islam" => Ok(BankIslam),
1000            "bank_muamalat" => Ok(BankMuamalat),
1001            "bank_of_china" => Ok(BankOfChina),
1002            "bank_rakyat" => Ok(BankRakyat),
1003            "bsn" => Ok(Bsn),
1004            "cimb" => Ok(Cimb),
1005            "deutsche_bank" => Ok(DeutscheBank),
1006            "hong_leong_bank" => Ok(HongLeongBank),
1007            "hsbc" => Ok(Hsbc),
1008            "kfh" => Ok(Kfh),
1009            "maybank2e" => Ok(Maybank2e),
1010            "maybank2u" => Ok(Maybank2u),
1011            "ocbc" => Ok(Ocbc),
1012            "pb_enterprise" => Ok(PbEnterprise),
1013            "public_bank" => Ok(PublicBank),
1014            "rhb" => Ok(Rhb),
1015            "standard_chartered" => Ok(StandardChartered),
1016            "uob" => Ok(Uob),
1017            v => {
1018                tracing::warn!(
1019                    "Unknown value '{}' for enum '{}'",
1020                    v,
1021                    "CreateConfirmationTokenPaymentMethodDataFpxBank"
1022                );
1023                Ok(Unknown(v.to_owned()))
1024            }
1025        }
1026    }
1027}
1028impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataFpxBank {
1029    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1030        f.write_str(self.as_str())
1031    }
1032}
1033
1034#[cfg(not(feature = "redact-generated-debug"))]
1035impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataFpxBank {
1036    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1037        f.write_str(self.as_str())
1038    }
1039}
1040#[cfg(feature = "redact-generated-debug")]
1041impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataFpxBank {
1042    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1043        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataFpxBank))
1044            .finish_non_exhaustive()
1045    }
1046}
1047impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataFpxBank {
1048    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1049    where
1050        S: serde::Serializer,
1051    {
1052        serializer.serialize_str(self.as_str())
1053    }
1054}
1055#[cfg(feature = "deserialize")]
1056impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataFpxBank {
1057    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1058        use std::str::FromStr;
1059        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1060        Ok(Self::from_str(&s).expect("infallible"))
1061    }
1062}
1063/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
1064#[derive(Clone, Eq, PartialEq)]
1065#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1066#[derive(serde::Serialize)]
1067pub struct CreateConfirmationTokenPaymentMethodDataIdeal {
1068    /// The customer's bank.
1069    /// Only use this parameter for existing customers.
1070    /// Don't use it for new customers.
1071    #[serde(skip_serializing_if = "Option::is_none")]
1072    pub bank: Option<CreateConfirmationTokenPaymentMethodDataIdealBank>,
1073}
1074#[cfg(feature = "redact-generated-debug")]
1075impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataIdeal {
1076    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1077        f.debug_struct("CreateConfirmationTokenPaymentMethodDataIdeal").finish_non_exhaustive()
1078    }
1079}
1080impl CreateConfirmationTokenPaymentMethodDataIdeal {
1081    pub fn new() -> Self {
1082        Self { bank: None }
1083    }
1084}
1085impl Default for CreateConfirmationTokenPaymentMethodDataIdeal {
1086    fn default() -> Self {
1087        Self::new()
1088    }
1089}
1090/// The customer's bank.
1091/// Only use this parameter for existing customers.
1092/// Don't use it for new customers.
1093#[derive(Clone, Eq, PartialEq)]
1094#[non_exhaustive]
1095pub enum CreateConfirmationTokenPaymentMethodDataIdealBank {
1096    AbnAmro,
1097    Adyen,
1098    AsnBank,
1099    Bunq,
1100    Buut,
1101    Finom,
1102    Handelsbanken,
1103    Ing,
1104    Knab,
1105    Mollie,
1106    Moneyou,
1107    N26,
1108    Nn,
1109    Rabobank,
1110    Regiobank,
1111    Revolut,
1112    SnsBank,
1113    TriodosBank,
1114    VanLanschot,
1115    Yoursafe,
1116    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1117    Unknown(String),
1118}
1119impl CreateConfirmationTokenPaymentMethodDataIdealBank {
1120    pub fn as_str(&self) -> &str {
1121        use CreateConfirmationTokenPaymentMethodDataIdealBank::*;
1122        match self {
1123            AbnAmro => "abn_amro",
1124            Adyen => "adyen",
1125            AsnBank => "asn_bank",
1126            Bunq => "bunq",
1127            Buut => "buut",
1128            Finom => "finom",
1129            Handelsbanken => "handelsbanken",
1130            Ing => "ing",
1131            Knab => "knab",
1132            Mollie => "mollie",
1133            Moneyou => "moneyou",
1134            N26 => "n26",
1135            Nn => "nn",
1136            Rabobank => "rabobank",
1137            Regiobank => "regiobank",
1138            Revolut => "revolut",
1139            SnsBank => "sns_bank",
1140            TriodosBank => "triodos_bank",
1141            VanLanschot => "van_lanschot",
1142            Yoursafe => "yoursafe",
1143            Unknown(v) => v,
1144        }
1145    }
1146}
1147
1148impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataIdealBank {
1149    type Err = std::convert::Infallible;
1150    fn from_str(s: &str) -> Result<Self, Self::Err> {
1151        use CreateConfirmationTokenPaymentMethodDataIdealBank::*;
1152        match s {
1153            "abn_amro" => Ok(AbnAmro),
1154            "adyen" => Ok(Adyen),
1155            "asn_bank" => Ok(AsnBank),
1156            "bunq" => Ok(Bunq),
1157            "buut" => Ok(Buut),
1158            "finom" => Ok(Finom),
1159            "handelsbanken" => Ok(Handelsbanken),
1160            "ing" => Ok(Ing),
1161            "knab" => Ok(Knab),
1162            "mollie" => Ok(Mollie),
1163            "moneyou" => Ok(Moneyou),
1164            "n26" => Ok(N26),
1165            "nn" => Ok(Nn),
1166            "rabobank" => Ok(Rabobank),
1167            "regiobank" => Ok(Regiobank),
1168            "revolut" => Ok(Revolut),
1169            "sns_bank" => Ok(SnsBank),
1170            "triodos_bank" => Ok(TriodosBank),
1171            "van_lanschot" => Ok(VanLanschot),
1172            "yoursafe" => Ok(Yoursafe),
1173            v => {
1174                tracing::warn!(
1175                    "Unknown value '{}' for enum '{}'",
1176                    v,
1177                    "CreateConfirmationTokenPaymentMethodDataIdealBank"
1178                );
1179                Ok(Unknown(v.to_owned()))
1180            }
1181        }
1182    }
1183}
1184impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataIdealBank {
1185    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1186        f.write_str(self.as_str())
1187    }
1188}
1189
1190#[cfg(not(feature = "redact-generated-debug"))]
1191impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataIdealBank {
1192    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1193        f.write_str(self.as_str())
1194    }
1195}
1196#[cfg(feature = "redact-generated-debug")]
1197impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataIdealBank {
1198    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1199        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataIdealBank))
1200            .finish_non_exhaustive()
1201    }
1202}
1203impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataIdealBank {
1204    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1205    where
1206        S: serde::Serializer,
1207    {
1208        serializer.serialize_str(self.as_str())
1209    }
1210}
1211#[cfg(feature = "deserialize")]
1212impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataIdealBank {
1213    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1214        use std::str::FromStr;
1215        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1216        Ok(Self::from_str(&s).expect("infallible"))
1217    }
1218}
1219/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
1220#[derive(Copy, Clone, Eq, PartialEq)]
1221#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1222#[derive(serde::Serialize)]
1223pub struct CreateConfirmationTokenPaymentMethodDataKlarna {
1224    /// Customer's date of birth
1225    #[serde(skip_serializing_if = "Option::is_none")]
1226    pub dob: Option<CreateConfirmationTokenPaymentMethodDataKlarnaDob>,
1227}
1228#[cfg(feature = "redact-generated-debug")]
1229impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataKlarna {
1230    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1231        f.debug_struct("CreateConfirmationTokenPaymentMethodDataKlarna").finish_non_exhaustive()
1232    }
1233}
1234impl CreateConfirmationTokenPaymentMethodDataKlarna {
1235    pub fn new() -> Self {
1236        Self { dob: None }
1237    }
1238}
1239impl Default for CreateConfirmationTokenPaymentMethodDataKlarna {
1240    fn default() -> Self {
1241        Self::new()
1242    }
1243}
1244/// Customer's date of birth
1245#[derive(Copy, Clone, Eq, PartialEq)]
1246#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1247#[derive(serde::Serialize)]
1248pub struct CreateConfirmationTokenPaymentMethodDataKlarnaDob {
1249    /// The day of birth, between 1 and 31.
1250    pub day: i64,
1251    /// The month of birth, between 1 and 12.
1252    pub month: i64,
1253    /// The four-digit year of birth.
1254    pub year: i64,
1255}
1256#[cfg(feature = "redact-generated-debug")]
1257impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataKlarnaDob {
1258    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1259        f.debug_struct("CreateConfirmationTokenPaymentMethodDataKlarnaDob").finish_non_exhaustive()
1260    }
1261}
1262impl CreateConfirmationTokenPaymentMethodDataKlarnaDob {
1263    pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
1264        Self { day: day.into(), month: month.into(), year: year.into() }
1265    }
1266}
1267/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
1268#[derive(Clone, Eq, PartialEq)]
1269#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1270#[derive(serde::Serialize)]
1271pub struct CreateConfirmationTokenPaymentMethodDataNaverPay {
1272    /// Whether to use Naver Pay points or a card to fund this transaction.
1273    /// If not provided, this defaults to `card`.
1274    #[serde(skip_serializing_if = "Option::is_none")]
1275    pub funding: Option<CreateConfirmationTokenPaymentMethodDataNaverPayFunding>,
1276}
1277#[cfg(feature = "redact-generated-debug")]
1278impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataNaverPay {
1279    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1280        f.debug_struct("CreateConfirmationTokenPaymentMethodDataNaverPay").finish_non_exhaustive()
1281    }
1282}
1283impl CreateConfirmationTokenPaymentMethodDataNaverPay {
1284    pub fn new() -> Self {
1285        Self { funding: None }
1286    }
1287}
1288impl Default for CreateConfirmationTokenPaymentMethodDataNaverPay {
1289    fn default() -> Self {
1290        Self::new()
1291    }
1292}
1293/// Whether to use Naver Pay points or a card to fund this transaction.
1294/// If not provided, this defaults to `card`.
1295#[derive(Clone, Eq, PartialEq)]
1296#[non_exhaustive]
1297pub enum CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1298    Card,
1299    Points,
1300    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1301    Unknown(String),
1302}
1303impl CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1304    pub fn as_str(&self) -> &str {
1305        use CreateConfirmationTokenPaymentMethodDataNaverPayFunding::*;
1306        match self {
1307            Card => "card",
1308            Points => "points",
1309            Unknown(v) => v,
1310        }
1311    }
1312}
1313
1314impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1315    type Err = std::convert::Infallible;
1316    fn from_str(s: &str) -> Result<Self, Self::Err> {
1317        use CreateConfirmationTokenPaymentMethodDataNaverPayFunding::*;
1318        match s {
1319            "card" => Ok(Card),
1320            "points" => Ok(Points),
1321            v => {
1322                tracing::warn!(
1323                    "Unknown value '{}' for enum '{}'",
1324                    v,
1325                    "CreateConfirmationTokenPaymentMethodDataNaverPayFunding"
1326                );
1327                Ok(Unknown(v.to_owned()))
1328            }
1329        }
1330    }
1331}
1332impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1333    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1334        f.write_str(self.as_str())
1335    }
1336}
1337
1338#[cfg(not(feature = "redact-generated-debug"))]
1339impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1340    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1341        f.write_str(self.as_str())
1342    }
1343}
1344#[cfg(feature = "redact-generated-debug")]
1345impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1346    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1347        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataNaverPayFunding))
1348            .finish_non_exhaustive()
1349    }
1350}
1351impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1352    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1353    where
1354        S: serde::Serializer,
1355    {
1356        serializer.serialize_str(self.as_str())
1357    }
1358}
1359#[cfg(feature = "deserialize")]
1360impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataNaverPayFunding {
1361    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1362        use std::str::FromStr;
1363        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1364        Ok(Self::from_str(&s).expect("infallible"))
1365    }
1366}
1367/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
1368#[derive(Clone, Eq, PartialEq)]
1369#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1370#[derive(serde::Serialize)]
1371pub struct CreateConfirmationTokenPaymentMethodDataNzBankAccount {
1372    /// The name on the bank account.
1373    /// Only required if the account holder name is different from the name of the authorized signatory collected in the PaymentMethod’s billing details.
1374    #[serde(skip_serializing_if = "Option::is_none")]
1375    pub account_holder_name: Option<String>,
1376    /// The account number for the bank account.
1377    pub account_number: String,
1378    /// The numeric code for the bank account's bank.
1379    pub bank_code: String,
1380    /// The numeric code for the bank account's bank branch.
1381    pub branch_code: String,
1382    #[serde(skip_serializing_if = "Option::is_none")]
1383    pub reference: Option<String>,
1384    /// The suffix of the bank account number.
1385    pub suffix: String,
1386}
1387#[cfg(feature = "redact-generated-debug")]
1388impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataNzBankAccount {
1389    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1390        f.debug_struct("CreateConfirmationTokenPaymentMethodDataNzBankAccount")
1391            .finish_non_exhaustive()
1392    }
1393}
1394impl CreateConfirmationTokenPaymentMethodDataNzBankAccount {
1395    pub fn new(
1396        account_number: impl Into<String>,
1397        bank_code: impl Into<String>,
1398        branch_code: impl Into<String>,
1399        suffix: impl Into<String>,
1400    ) -> Self {
1401        Self {
1402            account_holder_name: None,
1403            account_number: account_number.into(),
1404            bank_code: bank_code.into(),
1405            branch_code: branch_code.into(),
1406            reference: None,
1407            suffix: suffix.into(),
1408        }
1409    }
1410}
1411/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
1412#[derive(Clone, Eq, PartialEq)]
1413#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1414#[derive(serde::Serialize)]
1415pub struct CreateConfirmationTokenPaymentMethodDataP24 {
1416    /// The customer's bank.
1417    #[serde(skip_serializing_if = "Option::is_none")]
1418    pub bank: Option<CreateConfirmationTokenPaymentMethodDataP24Bank>,
1419}
1420#[cfg(feature = "redact-generated-debug")]
1421impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataP24 {
1422    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1423        f.debug_struct("CreateConfirmationTokenPaymentMethodDataP24").finish_non_exhaustive()
1424    }
1425}
1426impl CreateConfirmationTokenPaymentMethodDataP24 {
1427    pub fn new() -> Self {
1428        Self { bank: None }
1429    }
1430}
1431impl Default for CreateConfirmationTokenPaymentMethodDataP24 {
1432    fn default() -> Self {
1433        Self::new()
1434    }
1435}
1436/// The customer's bank.
1437#[derive(Clone, Eq, PartialEq)]
1438#[non_exhaustive]
1439pub enum CreateConfirmationTokenPaymentMethodDataP24Bank {
1440    AliorBank,
1441    BankMillennium,
1442    BankNowyBfgSa,
1443    BankPekaoSa,
1444    BankiSpbdzielcze,
1445    Blik,
1446    BnpParibas,
1447    Boz,
1448    CitiHandlowy,
1449    CreditAgricole,
1450    Envelobank,
1451    EtransferPocztowy24,
1452    GetinBank,
1453    Ideabank,
1454    Ing,
1455    Inteligo,
1456    MbankMtransfer,
1457    NestPrzelew,
1458    NoblePay,
1459    PbacZIpko,
1460    PlusBank,
1461    SantanderPrzelew24,
1462    TmobileUsbugiBankowe,
1463    ToyotaBank,
1464    Velobank,
1465    VolkswagenBank,
1466    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1467    Unknown(String),
1468}
1469impl CreateConfirmationTokenPaymentMethodDataP24Bank {
1470    pub fn as_str(&self) -> &str {
1471        use CreateConfirmationTokenPaymentMethodDataP24Bank::*;
1472        match self {
1473            AliorBank => "alior_bank",
1474            BankMillennium => "bank_millennium",
1475            BankNowyBfgSa => "bank_nowy_bfg_sa",
1476            BankPekaoSa => "bank_pekao_sa",
1477            BankiSpbdzielcze => "banki_spbdzielcze",
1478            Blik => "blik",
1479            BnpParibas => "bnp_paribas",
1480            Boz => "boz",
1481            CitiHandlowy => "citi_handlowy",
1482            CreditAgricole => "credit_agricole",
1483            Envelobank => "envelobank",
1484            EtransferPocztowy24 => "etransfer_pocztowy24",
1485            GetinBank => "getin_bank",
1486            Ideabank => "ideabank",
1487            Ing => "ing",
1488            Inteligo => "inteligo",
1489            MbankMtransfer => "mbank_mtransfer",
1490            NestPrzelew => "nest_przelew",
1491            NoblePay => "noble_pay",
1492            PbacZIpko => "pbac_z_ipko",
1493            PlusBank => "plus_bank",
1494            SantanderPrzelew24 => "santander_przelew24",
1495            TmobileUsbugiBankowe => "tmobile_usbugi_bankowe",
1496            ToyotaBank => "toyota_bank",
1497            Velobank => "velobank",
1498            VolkswagenBank => "volkswagen_bank",
1499            Unknown(v) => v,
1500        }
1501    }
1502}
1503
1504impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataP24Bank {
1505    type Err = std::convert::Infallible;
1506    fn from_str(s: &str) -> Result<Self, Self::Err> {
1507        use CreateConfirmationTokenPaymentMethodDataP24Bank::*;
1508        match s {
1509            "alior_bank" => Ok(AliorBank),
1510            "bank_millennium" => Ok(BankMillennium),
1511            "bank_nowy_bfg_sa" => Ok(BankNowyBfgSa),
1512            "bank_pekao_sa" => Ok(BankPekaoSa),
1513            "banki_spbdzielcze" => Ok(BankiSpbdzielcze),
1514            "blik" => Ok(Blik),
1515            "bnp_paribas" => Ok(BnpParibas),
1516            "boz" => Ok(Boz),
1517            "citi_handlowy" => Ok(CitiHandlowy),
1518            "credit_agricole" => Ok(CreditAgricole),
1519            "envelobank" => Ok(Envelobank),
1520            "etransfer_pocztowy24" => Ok(EtransferPocztowy24),
1521            "getin_bank" => Ok(GetinBank),
1522            "ideabank" => Ok(Ideabank),
1523            "ing" => Ok(Ing),
1524            "inteligo" => Ok(Inteligo),
1525            "mbank_mtransfer" => Ok(MbankMtransfer),
1526            "nest_przelew" => Ok(NestPrzelew),
1527            "noble_pay" => Ok(NoblePay),
1528            "pbac_z_ipko" => Ok(PbacZIpko),
1529            "plus_bank" => Ok(PlusBank),
1530            "santander_przelew24" => Ok(SantanderPrzelew24),
1531            "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe),
1532            "toyota_bank" => Ok(ToyotaBank),
1533            "velobank" => Ok(Velobank),
1534            "volkswagen_bank" => Ok(VolkswagenBank),
1535            v => {
1536                tracing::warn!(
1537                    "Unknown value '{}' for enum '{}'",
1538                    v,
1539                    "CreateConfirmationTokenPaymentMethodDataP24Bank"
1540                );
1541                Ok(Unknown(v.to_owned()))
1542            }
1543        }
1544    }
1545}
1546impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataP24Bank {
1547    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1548        f.write_str(self.as_str())
1549    }
1550}
1551
1552#[cfg(not(feature = "redact-generated-debug"))]
1553impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataP24Bank {
1554    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1555        f.write_str(self.as_str())
1556    }
1557}
1558#[cfg(feature = "redact-generated-debug")]
1559impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataP24Bank {
1560    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1561        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataP24Bank))
1562            .finish_non_exhaustive()
1563    }
1564}
1565impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataP24Bank {
1566    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1567    where
1568        S: serde::Serializer,
1569    {
1570        serializer.serialize_str(self.as_str())
1571    }
1572}
1573#[cfg(feature = "deserialize")]
1574impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataP24Bank {
1575    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1576        use std::str::FromStr;
1577        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1578        Ok(Self::from_str(&s).expect("infallible"))
1579    }
1580}
1581/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
1582#[derive(Clone, Eq, PartialEq)]
1583#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1584#[derive(serde::Serialize)]
1585pub struct CreateConfirmationTokenPaymentMethodDataPayto {
1586    /// The account number for the bank account.
1587    #[serde(skip_serializing_if = "Option::is_none")]
1588    pub account_number: Option<String>,
1589    /// Bank-State-Branch number of the bank account.
1590    #[serde(skip_serializing_if = "Option::is_none")]
1591    pub bsb_number: Option<String>,
1592    /// The PayID alias for the bank account.
1593    #[serde(skip_serializing_if = "Option::is_none")]
1594    pub pay_id: Option<String>,
1595}
1596#[cfg(feature = "redact-generated-debug")]
1597impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataPayto {
1598    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1599        f.debug_struct("CreateConfirmationTokenPaymentMethodDataPayto").finish_non_exhaustive()
1600    }
1601}
1602impl CreateConfirmationTokenPaymentMethodDataPayto {
1603    pub fn new() -> Self {
1604        Self { account_number: None, bsb_number: None, pay_id: None }
1605    }
1606}
1607impl Default for CreateConfirmationTokenPaymentMethodDataPayto {
1608    fn default() -> Self {
1609        Self::new()
1610    }
1611}
1612/// Options to configure Radar.
1613/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
1614#[derive(Clone, Eq, PartialEq)]
1615#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1616#[derive(serde::Serialize)]
1617pub struct CreateConfirmationTokenPaymentMethodDataRadarOptions {
1618    /// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
1619    #[serde(skip_serializing_if = "Option::is_none")]
1620    pub session: Option<String>,
1621}
1622#[cfg(feature = "redact-generated-debug")]
1623impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataRadarOptions {
1624    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1625        f.debug_struct("CreateConfirmationTokenPaymentMethodDataRadarOptions")
1626            .finish_non_exhaustive()
1627    }
1628}
1629impl CreateConfirmationTokenPaymentMethodDataRadarOptions {
1630    pub fn new() -> Self {
1631        Self { session: None }
1632    }
1633}
1634impl Default for CreateConfirmationTokenPaymentMethodDataRadarOptions {
1635    fn default() -> Self {
1636        Self::new()
1637    }
1638}
1639/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
1640#[derive(Clone, Eq, PartialEq)]
1641#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1642#[derive(serde::Serialize)]
1643pub struct CreateConfirmationTokenPaymentMethodDataSepaDebit {
1644    /// IBAN of the bank account.
1645    pub iban: String,
1646}
1647#[cfg(feature = "redact-generated-debug")]
1648impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataSepaDebit {
1649    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1650        f.debug_struct("CreateConfirmationTokenPaymentMethodDataSepaDebit").finish_non_exhaustive()
1651    }
1652}
1653impl CreateConfirmationTokenPaymentMethodDataSepaDebit {
1654    pub fn new(iban: impl Into<String>) -> Self {
1655        Self { iban: iban.into() }
1656    }
1657}
1658/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
1659#[derive(Clone, Eq, PartialEq)]
1660#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1661#[derive(serde::Serialize)]
1662pub struct CreateConfirmationTokenPaymentMethodDataSofort {
1663    /// Two-letter ISO code representing the country the bank account is located in.
1664    pub country: CreateConfirmationTokenPaymentMethodDataSofortCountry,
1665}
1666#[cfg(feature = "redact-generated-debug")]
1667impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataSofort {
1668    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1669        f.debug_struct("CreateConfirmationTokenPaymentMethodDataSofort").finish_non_exhaustive()
1670    }
1671}
1672impl CreateConfirmationTokenPaymentMethodDataSofort {
1673    pub fn new(country: impl Into<CreateConfirmationTokenPaymentMethodDataSofortCountry>) -> Self {
1674        Self { country: country.into() }
1675    }
1676}
1677/// Two-letter ISO code representing the country the bank account is located in.
1678#[derive(Clone, Eq, PartialEq)]
1679#[non_exhaustive]
1680pub enum CreateConfirmationTokenPaymentMethodDataSofortCountry {
1681    At,
1682    Be,
1683    De,
1684    Es,
1685    It,
1686    Nl,
1687    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1688    Unknown(String),
1689}
1690impl CreateConfirmationTokenPaymentMethodDataSofortCountry {
1691    pub fn as_str(&self) -> &str {
1692        use CreateConfirmationTokenPaymentMethodDataSofortCountry::*;
1693        match self {
1694            At => "AT",
1695            Be => "BE",
1696            De => "DE",
1697            Es => "ES",
1698            It => "IT",
1699            Nl => "NL",
1700            Unknown(v) => v,
1701        }
1702    }
1703}
1704
1705impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataSofortCountry {
1706    type Err = std::convert::Infallible;
1707    fn from_str(s: &str) -> Result<Self, Self::Err> {
1708        use CreateConfirmationTokenPaymentMethodDataSofortCountry::*;
1709        match s {
1710            "AT" => Ok(At),
1711            "BE" => Ok(Be),
1712            "DE" => Ok(De),
1713            "ES" => Ok(Es),
1714            "IT" => Ok(It),
1715            "NL" => Ok(Nl),
1716            v => {
1717                tracing::warn!(
1718                    "Unknown value '{}' for enum '{}'",
1719                    v,
1720                    "CreateConfirmationTokenPaymentMethodDataSofortCountry"
1721                );
1722                Ok(Unknown(v.to_owned()))
1723            }
1724        }
1725    }
1726}
1727impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataSofortCountry {
1728    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1729        f.write_str(self.as_str())
1730    }
1731}
1732
1733#[cfg(not(feature = "redact-generated-debug"))]
1734impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataSofortCountry {
1735    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1736        f.write_str(self.as_str())
1737    }
1738}
1739#[cfg(feature = "redact-generated-debug")]
1740impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataSofortCountry {
1741    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1742        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataSofortCountry))
1743            .finish_non_exhaustive()
1744    }
1745}
1746impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataSofortCountry {
1747    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1748    where
1749        S: serde::Serializer,
1750    {
1751        serializer.serialize_str(self.as_str())
1752    }
1753}
1754#[cfg(feature = "deserialize")]
1755impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataSofortCountry {
1756    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1757        use std::str::FromStr;
1758        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1759        Ok(Self::from_str(&s).expect("infallible"))
1760    }
1761}
1762/// The type of the PaymentMethod.
1763/// An additional hash is included on the PaymentMethod with a name matching this value.
1764/// It contains additional information specific to the PaymentMethod type.
1765#[derive(Clone, Eq, PartialEq)]
1766#[non_exhaustive]
1767pub enum CreateConfirmationTokenPaymentMethodDataType {
1768    AcssDebit,
1769    Affirm,
1770    AfterpayClearpay,
1771    Alipay,
1772    Alma,
1773    AmazonPay,
1774    AuBecsDebit,
1775    BacsDebit,
1776    Bancontact,
1777    Billie,
1778    Blik,
1779    Boleto,
1780    Cashapp,
1781    Crypto,
1782    CustomerBalance,
1783    Eps,
1784    Fpx,
1785    Giropay,
1786    Grabpay,
1787    Ideal,
1788    KakaoPay,
1789    Klarna,
1790    Konbini,
1791    KrCard,
1792    Link,
1793    MbWay,
1794    Mobilepay,
1795    Multibanco,
1796    NaverPay,
1797    NzBankAccount,
1798    Oxxo,
1799    P24,
1800    PayByBank,
1801    Payco,
1802    Paynow,
1803    Paypal,
1804    Payto,
1805    Pix,
1806    Promptpay,
1807    RevolutPay,
1808    SamsungPay,
1809    Satispay,
1810    SepaDebit,
1811    Sofort,
1812    Swish,
1813    Twint,
1814    Upi,
1815    UsBankAccount,
1816    WechatPay,
1817    Zip,
1818    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1819    Unknown(String),
1820}
1821impl CreateConfirmationTokenPaymentMethodDataType {
1822    pub fn as_str(&self) -> &str {
1823        use CreateConfirmationTokenPaymentMethodDataType::*;
1824        match self {
1825            AcssDebit => "acss_debit",
1826            Affirm => "affirm",
1827            AfterpayClearpay => "afterpay_clearpay",
1828            Alipay => "alipay",
1829            Alma => "alma",
1830            AmazonPay => "amazon_pay",
1831            AuBecsDebit => "au_becs_debit",
1832            BacsDebit => "bacs_debit",
1833            Bancontact => "bancontact",
1834            Billie => "billie",
1835            Blik => "blik",
1836            Boleto => "boleto",
1837            Cashapp => "cashapp",
1838            Crypto => "crypto",
1839            CustomerBalance => "customer_balance",
1840            Eps => "eps",
1841            Fpx => "fpx",
1842            Giropay => "giropay",
1843            Grabpay => "grabpay",
1844            Ideal => "ideal",
1845            KakaoPay => "kakao_pay",
1846            Klarna => "klarna",
1847            Konbini => "konbini",
1848            KrCard => "kr_card",
1849            Link => "link",
1850            MbWay => "mb_way",
1851            Mobilepay => "mobilepay",
1852            Multibanco => "multibanco",
1853            NaverPay => "naver_pay",
1854            NzBankAccount => "nz_bank_account",
1855            Oxxo => "oxxo",
1856            P24 => "p24",
1857            PayByBank => "pay_by_bank",
1858            Payco => "payco",
1859            Paynow => "paynow",
1860            Paypal => "paypal",
1861            Payto => "payto",
1862            Pix => "pix",
1863            Promptpay => "promptpay",
1864            RevolutPay => "revolut_pay",
1865            SamsungPay => "samsung_pay",
1866            Satispay => "satispay",
1867            SepaDebit => "sepa_debit",
1868            Sofort => "sofort",
1869            Swish => "swish",
1870            Twint => "twint",
1871            Upi => "upi",
1872            UsBankAccount => "us_bank_account",
1873            WechatPay => "wechat_pay",
1874            Zip => "zip",
1875            Unknown(v) => v,
1876        }
1877    }
1878}
1879
1880impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataType {
1881    type Err = std::convert::Infallible;
1882    fn from_str(s: &str) -> Result<Self, Self::Err> {
1883        use CreateConfirmationTokenPaymentMethodDataType::*;
1884        match s {
1885            "acss_debit" => Ok(AcssDebit),
1886            "affirm" => Ok(Affirm),
1887            "afterpay_clearpay" => Ok(AfterpayClearpay),
1888            "alipay" => Ok(Alipay),
1889            "alma" => Ok(Alma),
1890            "amazon_pay" => Ok(AmazonPay),
1891            "au_becs_debit" => Ok(AuBecsDebit),
1892            "bacs_debit" => Ok(BacsDebit),
1893            "bancontact" => Ok(Bancontact),
1894            "billie" => Ok(Billie),
1895            "blik" => Ok(Blik),
1896            "boleto" => Ok(Boleto),
1897            "cashapp" => Ok(Cashapp),
1898            "crypto" => Ok(Crypto),
1899            "customer_balance" => Ok(CustomerBalance),
1900            "eps" => Ok(Eps),
1901            "fpx" => Ok(Fpx),
1902            "giropay" => Ok(Giropay),
1903            "grabpay" => Ok(Grabpay),
1904            "ideal" => Ok(Ideal),
1905            "kakao_pay" => Ok(KakaoPay),
1906            "klarna" => Ok(Klarna),
1907            "konbini" => Ok(Konbini),
1908            "kr_card" => Ok(KrCard),
1909            "link" => Ok(Link),
1910            "mb_way" => Ok(MbWay),
1911            "mobilepay" => Ok(Mobilepay),
1912            "multibanco" => Ok(Multibanco),
1913            "naver_pay" => Ok(NaverPay),
1914            "nz_bank_account" => Ok(NzBankAccount),
1915            "oxxo" => Ok(Oxxo),
1916            "p24" => Ok(P24),
1917            "pay_by_bank" => Ok(PayByBank),
1918            "payco" => Ok(Payco),
1919            "paynow" => Ok(Paynow),
1920            "paypal" => Ok(Paypal),
1921            "payto" => Ok(Payto),
1922            "pix" => Ok(Pix),
1923            "promptpay" => Ok(Promptpay),
1924            "revolut_pay" => Ok(RevolutPay),
1925            "samsung_pay" => Ok(SamsungPay),
1926            "satispay" => Ok(Satispay),
1927            "sepa_debit" => Ok(SepaDebit),
1928            "sofort" => Ok(Sofort),
1929            "swish" => Ok(Swish),
1930            "twint" => Ok(Twint),
1931            "upi" => Ok(Upi),
1932            "us_bank_account" => Ok(UsBankAccount),
1933            "wechat_pay" => Ok(WechatPay),
1934            "zip" => Ok(Zip),
1935            v => {
1936                tracing::warn!(
1937                    "Unknown value '{}' for enum '{}'",
1938                    v,
1939                    "CreateConfirmationTokenPaymentMethodDataType"
1940                );
1941                Ok(Unknown(v.to_owned()))
1942            }
1943        }
1944    }
1945}
1946impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataType {
1947    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1948        f.write_str(self.as_str())
1949    }
1950}
1951
1952#[cfg(not(feature = "redact-generated-debug"))]
1953impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataType {
1954    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1955        f.write_str(self.as_str())
1956    }
1957}
1958#[cfg(feature = "redact-generated-debug")]
1959impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataType {
1960    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1961        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataType))
1962            .finish_non_exhaustive()
1963    }
1964}
1965impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataType {
1966    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1967    where
1968        S: serde::Serializer,
1969    {
1970        serializer.serialize_str(self.as_str())
1971    }
1972}
1973#[cfg(feature = "deserialize")]
1974impl<'de> serde::Deserialize<'de> for CreateConfirmationTokenPaymentMethodDataType {
1975    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1976        use std::str::FromStr;
1977        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1978        Ok(Self::from_str(&s).expect("infallible"))
1979    }
1980}
1981/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
1982#[derive(Clone, Eq, PartialEq)]
1983#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1984#[derive(serde::Serialize)]
1985pub struct CreateConfirmationTokenPaymentMethodDataUpi {
1986    /// Configuration options for setting up an eMandate
1987    #[serde(skip_serializing_if = "Option::is_none")]
1988    pub mandate_options: Option<CreateConfirmationTokenPaymentMethodDataUpiMandateOptions>,
1989}
1990#[cfg(feature = "redact-generated-debug")]
1991impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUpi {
1992    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1993        f.debug_struct("CreateConfirmationTokenPaymentMethodDataUpi").finish_non_exhaustive()
1994    }
1995}
1996impl CreateConfirmationTokenPaymentMethodDataUpi {
1997    pub fn new() -> Self {
1998        Self { mandate_options: None }
1999    }
2000}
2001impl Default for CreateConfirmationTokenPaymentMethodDataUpi {
2002    fn default() -> Self {
2003        Self::new()
2004    }
2005}
2006/// Configuration options for setting up an eMandate
2007#[derive(Clone, Eq, PartialEq)]
2008#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2009#[derive(serde::Serialize)]
2010pub struct CreateConfirmationTokenPaymentMethodDataUpiMandateOptions {
2011    /// Amount to be charged for future payments.
2012    #[serde(skip_serializing_if = "Option::is_none")]
2013    pub amount: Option<i64>,
2014    /// One of `fixed` or `maximum`.
2015    /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
2016    /// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
2017    #[serde(skip_serializing_if = "Option::is_none")]
2018    pub amount_type: Option<CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType>,
2019    /// A description of the mandate or subscription that is meant to be displayed to the customer.
2020    #[serde(skip_serializing_if = "Option::is_none")]
2021    pub description: Option<String>,
2022    /// End date of the mandate or subscription.
2023    #[serde(skip_serializing_if = "Option::is_none")]
2024    pub end_date: Option<stripe_types::Timestamp>,
2025}
2026#[cfg(feature = "redact-generated-debug")]
2027impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUpiMandateOptions {
2028    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2029        f.debug_struct("CreateConfirmationTokenPaymentMethodDataUpiMandateOptions")
2030            .finish_non_exhaustive()
2031    }
2032}
2033impl CreateConfirmationTokenPaymentMethodDataUpiMandateOptions {
2034    pub fn new() -> Self {
2035        Self { amount: None, amount_type: None, description: None, end_date: None }
2036    }
2037}
2038impl Default for CreateConfirmationTokenPaymentMethodDataUpiMandateOptions {
2039    fn default() -> Self {
2040        Self::new()
2041    }
2042}
2043/// One of `fixed` or `maximum`.
2044/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
2045/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
2046#[derive(Clone, Eq, PartialEq)]
2047#[non_exhaustive]
2048pub enum CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2049    Fixed,
2050    Maximum,
2051    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2052    Unknown(String),
2053}
2054impl CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2055    pub fn as_str(&self) -> &str {
2056        use CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType::*;
2057        match self {
2058            Fixed => "fixed",
2059            Maximum => "maximum",
2060            Unknown(v) => v,
2061        }
2062    }
2063}
2064
2065impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2066    type Err = std::convert::Infallible;
2067    fn from_str(s: &str) -> Result<Self, Self::Err> {
2068        use CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType::*;
2069        match s {
2070            "fixed" => Ok(Fixed),
2071            "maximum" => Ok(Maximum),
2072            v => {
2073                tracing::warn!(
2074                    "Unknown value '{}' for enum '{}'",
2075                    v,
2076                    "CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType"
2077                );
2078                Ok(Unknown(v.to_owned()))
2079            }
2080        }
2081    }
2082}
2083impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2084    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2085        f.write_str(self.as_str())
2086    }
2087}
2088
2089#[cfg(not(feature = "redact-generated-debug"))]
2090impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2091    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2092        f.write_str(self.as_str())
2093    }
2094}
2095#[cfg(feature = "redact-generated-debug")]
2096impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2097    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2098        f.debug_struct(stringify!(
2099            CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType
2100        ))
2101        .finish_non_exhaustive()
2102    }
2103}
2104impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType {
2105    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2106    where
2107        S: serde::Serializer,
2108    {
2109        serializer.serialize_str(self.as_str())
2110    }
2111}
2112#[cfg(feature = "deserialize")]
2113impl<'de> serde::Deserialize<'de>
2114    for CreateConfirmationTokenPaymentMethodDataUpiMandateOptionsAmountType
2115{
2116    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2117        use std::str::FromStr;
2118        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2119        Ok(Self::from_str(&s).expect("infallible"))
2120    }
2121}
2122/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
2123#[derive(Clone, Eq, PartialEq)]
2124#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2125#[derive(serde::Serialize)]
2126pub struct CreateConfirmationTokenPaymentMethodDataUsBankAccount {
2127    /// Account holder type: individual or company.
2128    #[serde(skip_serializing_if = "Option::is_none")]
2129    pub account_holder_type:
2130        Option<CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType>,
2131    /// Account number of the bank account.
2132    #[serde(skip_serializing_if = "Option::is_none")]
2133    pub account_number: Option<String>,
2134    /// Account type: checkings or savings. Defaults to checking if omitted.
2135    #[serde(skip_serializing_if = "Option::is_none")]
2136    pub account_type: Option<CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType>,
2137    /// The ID of a Financial Connections Account to use as a payment method.
2138    #[serde(skip_serializing_if = "Option::is_none")]
2139    pub financial_connections_account: Option<String>,
2140    /// Routing number of the bank account.
2141    #[serde(skip_serializing_if = "Option::is_none")]
2142    pub routing_number: Option<String>,
2143}
2144#[cfg(feature = "redact-generated-debug")]
2145impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUsBankAccount {
2146    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2147        f.debug_struct("CreateConfirmationTokenPaymentMethodDataUsBankAccount")
2148            .finish_non_exhaustive()
2149    }
2150}
2151impl CreateConfirmationTokenPaymentMethodDataUsBankAccount {
2152    pub fn new() -> Self {
2153        Self {
2154            account_holder_type: None,
2155            account_number: None,
2156            account_type: None,
2157            financial_connections_account: None,
2158            routing_number: None,
2159        }
2160    }
2161}
2162impl Default for CreateConfirmationTokenPaymentMethodDataUsBankAccount {
2163    fn default() -> Self {
2164        Self::new()
2165    }
2166}
2167/// Account holder type: individual or company.
2168#[derive(Clone, Eq, PartialEq)]
2169#[non_exhaustive]
2170pub enum CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2171    Company,
2172    Individual,
2173    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2174    Unknown(String),
2175}
2176impl CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2177    pub fn as_str(&self) -> &str {
2178        use CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType::*;
2179        match self {
2180            Company => "company",
2181            Individual => "individual",
2182            Unknown(v) => v,
2183        }
2184    }
2185}
2186
2187impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2188    type Err = std::convert::Infallible;
2189    fn from_str(s: &str) -> Result<Self, Self::Err> {
2190        use CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType::*;
2191        match s {
2192            "company" => Ok(Company),
2193            "individual" => Ok(Individual),
2194            v => {
2195                tracing::warn!(
2196                    "Unknown value '{}' for enum '{}'",
2197                    v,
2198                    "CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType"
2199                );
2200                Ok(Unknown(v.to_owned()))
2201            }
2202        }
2203    }
2204}
2205impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2206    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2207        f.write_str(self.as_str())
2208    }
2209}
2210
2211#[cfg(not(feature = "redact-generated-debug"))]
2212impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2213    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2214        f.write_str(self.as_str())
2215    }
2216}
2217#[cfg(feature = "redact-generated-debug")]
2218impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2219    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2220        f.debug_struct(stringify!(
2221            CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType
2222        ))
2223        .finish_non_exhaustive()
2224    }
2225}
2226impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType {
2227    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2228    where
2229        S: serde::Serializer,
2230    {
2231        serializer.serialize_str(self.as_str())
2232    }
2233}
2234#[cfg(feature = "deserialize")]
2235impl<'de> serde::Deserialize<'de>
2236    for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountHolderType
2237{
2238    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2239        use std::str::FromStr;
2240        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2241        Ok(Self::from_str(&s).expect("infallible"))
2242    }
2243}
2244/// Account type: checkings or savings. Defaults to checking if omitted.
2245#[derive(Clone, Eq, PartialEq)]
2246#[non_exhaustive]
2247pub enum CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2248    Checking,
2249    Savings,
2250    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2251    Unknown(String),
2252}
2253impl CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2254    pub fn as_str(&self) -> &str {
2255        use CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType::*;
2256        match self {
2257            Checking => "checking",
2258            Savings => "savings",
2259            Unknown(v) => v,
2260        }
2261    }
2262}
2263
2264impl std::str::FromStr for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2265    type Err = std::convert::Infallible;
2266    fn from_str(s: &str) -> Result<Self, Self::Err> {
2267        use CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType::*;
2268        match s {
2269            "checking" => Ok(Checking),
2270            "savings" => Ok(Savings),
2271            v => {
2272                tracing::warn!(
2273                    "Unknown value '{}' for enum '{}'",
2274                    v,
2275                    "CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType"
2276                );
2277                Ok(Unknown(v.to_owned()))
2278            }
2279        }
2280    }
2281}
2282impl std::fmt::Display for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2283    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2284        f.write_str(self.as_str())
2285    }
2286}
2287
2288#[cfg(not(feature = "redact-generated-debug"))]
2289impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2290    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2291        f.write_str(self.as_str())
2292    }
2293}
2294#[cfg(feature = "redact-generated-debug")]
2295impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2296    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2297        f.debug_struct(stringify!(CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType))
2298            .finish_non_exhaustive()
2299    }
2300}
2301impl serde::Serialize for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType {
2302    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2303    where
2304        S: serde::Serializer,
2305    {
2306        serializer.serialize_str(self.as_str())
2307    }
2308}
2309#[cfg(feature = "deserialize")]
2310impl<'de> serde::Deserialize<'de>
2311    for CreateConfirmationTokenPaymentMethodDataUsBankAccountAccountType
2312{
2313    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2314        use std::str::FromStr;
2315        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2316        Ok(Self::from_str(&s).expect("infallible"))
2317    }
2318}
2319/// Payment-method-specific configuration for this ConfirmationToken.
2320#[derive(Clone, Eq, PartialEq)]
2321#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2322#[derive(serde::Serialize)]
2323pub struct CreateConfirmationTokenPaymentMethodOptions {
2324    /// Configuration for any card payments confirmed using this ConfirmationToken.
2325    #[serde(skip_serializing_if = "Option::is_none")]
2326    pub card: Option<CreateConfirmationTokenPaymentMethodOptionsCard>,
2327}
2328#[cfg(feature = "redact-generated-debug")]
2329impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptions {
2330    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2331        f.debug_struct("CreateConfirmationTokenPaymentMethodOptions").finish_non_exhaustive()
2332    }
2333}
2334impl CreateConfirmationTokenPaymentMethodOptions {
2335    pub fn new() -> Self {
2336        Self { card: None }
2337    }
2338}
2339impl Default for CreateConfirmationTokenPaymentMethodOptions {
2340    fn default() -> Self {
2341        Self::new()
2342    }
2343}
2344/// Configuration for any card payments confirmed using this ConfirmationToken.
2345#[derive(Clone, Eq, PartialEq)]
2346#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2347#[derive(serde::Serialize)]
2348pub struct CreateConfirmationTokenPaymentMethodOptionsCard {
2349    /// Installment configuration for payments confirmed using this ConfirmationToken.
2350    #[serde(skip_serializing_if = "Option::is_none")]
2351    pub installments: Option<CreateConfirmationTokenPaymentMethodOptionsCardInstallments>,
2352}
2353#[cfg(feature = "redact-generated-debug")]
2354impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCard {
2355    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2356        f.debug_struct("CreateConfirmationTokenPaymentMethodOptionsCard").finish_non_exhaustive()
2357    }
2358}
2359impl CreateConfirmationTokenPaymentMethodOptionsCard {
2360    pub fn new() -> Self {
2361        Self { installments: None }
2362    }
2363}
2364impl Default for CreateConfirmationTokenPaymentMethodOptionsCard {
2365    fn default() -> Self {
2366        Self::new()
2367    }
2368}
2369/// Installment configuration for payments confirmed using this ConfirmationToken.
2370#[derive(Clone, Eq, PartialEq)]
2371#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2372#[derive(serde::Serialize)]
2373pub struct CreateConfirmationTokenPaymentMethodOptionsCardInstallments {
2374    /// The selected installment plan to use for this payment attempt.
2375    /// This parameter can only be provided during confirmation.
2376    pub plan: CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlan,
2377}
2378#[cfg(feature = "redact-generated-debug")]
2379impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCardInstallments {
2380    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2381        f.debug_struct("CreateConfirmationTokenPaymentMethodOptionsCardInstallments")
2382            .finish_non_exhaustive()
2383    }
2384}
2385impl CreateConfirmationTokenPaymentMethodOptionsCardInstallments {
2386    pub fn new(
2387        plan: impl Into<CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlan>,
2388    ) -> Self {
2389        Self { plan: plan.into() }
2390    }
2391}
2392/// The selected installment plan to use for this payment attempt.
2393/// This parameter can only be provided during confirmation.
2394#[derive(Clone, Eq, PartialEq)]
2395#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2396#[derive(serde::Serialize)]
2397pub struct CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlan {
2398    /// For `fixed_count` installment plans, this is required.
2399    /// It represents the number of installment payments your customer will make to their credit card.
2400    #[serde(skip_serializing_if = "Option::is_none")]
2401    pub count: Option<u64>,
2402    /// For `fixed_count` installment plans, this is required.
2403    /// It represents the interval between installment payments your customer will make to their credit card.
2404    /// One of `month`.
2405    #[serde(skip_serializing_if = "Option::is_none")]
2406    pub interval: Option<CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval>,
2407    /// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
2408    #[serde(rename = "type")]
2409    pub type_: CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType,
2410}
2411#[cfg(feature = "redact-generated-debug")]
2412impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlan {
2413    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2414        f.debug_struct("CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlan")
2415            .finish_non_exhaustive()
2416    }
2417}
2418impl CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlan {
2419    pub fn new(
2420        type_: impl Into<CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType>,
2421    ) -> Self {
2422        Self { count: None, interval: None, type_: type_.into() }
2423    }
2424}
2425/// For `fixed_count` installment plans, this is required.
2426/// It represents the interval between installment payments your customer will make to their credit card.
2427/// One of `month`.
2428#[derive(Clone, Eq, PartialEq)]
2429#[non_exhaustive]
2430pub enum CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2431    Month,
2432    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2433    Unknown(String),
2434}
2435impl CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2436    pub fn as_str(&self) -> &str {
2437        use CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval::*;
2438        match self {
2439            Month => "month",
2440            Unknown(v) => v,
2441        }
2442    }
2443}
2444
2445impl std::str::FromStr for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2446    type Err = std::convert::Infallible;
2447    fn from_str(s: &str) -> Result<Self, Self::Err> {
2448        use CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval::*;
2449        match s {
2450            "month" => Ok(Month),
2451            v => {
2452                tracing::warn!(
2453                    "Unknown value '{}' for enum '{}'",
2454                    v,
2455                    "CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval"
2456                );
2457                Ok(Unknown(v.to_owned()))
2458            }
2459        }
2460    }
2461}
2462impl std::fmt::Display for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2463    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2464        f.write_str(self.as_str())
2465    }
2466}
2467
2468#[cfg(not(feature = "redact-generated-debug"))]
2469impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2470    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2471        f.write_str(self.as_str())
2472    }
2473}
2474#[cfg(feature = "redact-generated-debug")]
2475impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2476    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2477        f.debug_struct(stringify!(
2478            CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval
2479        ))
2480        .finish_non_exhaustive()
2481    }
2482}
2483impl serde::Serialize for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval {
2484    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2485    where
2486        S: serde::Serializer,
2487    {
2488        serializer.serialize_str(self.as_str())
2489    }
2490}
2491#[cfg(feature = "deserialize")]
2492impl<'de> serde::Deserialize<'de>
2493    for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanInterval
2494{
2495    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2496        use std::str::FromStr;
2497        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2498        Ok(Self::from_str(&s).expect("infallible"))
2499    }
2500}
2501/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
2502#[derive(Clone, Eq, PartialEq)]
2503#[non_exhaustive]
2504pub enum CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2505    Bonus,
2506    FixedCount,
2507    Revolving,
2508    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2509    Unknown(String),
2510}
2511impl CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2512    pub fn as_str(&self) -> &str {
2513        use CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType::*;
2514        match self {
2515            Bonus => "bonus",
2516            FixedCount => "fixed_count",
2517            Revolving => "revolving",
2518            Unknown(v) => v,
2519        }
2520    }
2521}
2522
2523impl std::str::FromStr for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2524    type Err = std::convert::Infallible;
2525    fn from_str(s: &str) -> Result<Self, Self::Err> {
2526        use CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType::*;
2527        match s {
2528            "bonus" => Ok(Bonus),
2529            "fixed_count" => Ok(FixedCount),
2530            "revolving" => Ok(Revolving),
2531            v => {
2532                tracing::warn!(
2533                    "Unknown value '{}' for enum '{}'",
2534                    v,
2535                    "CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType"
2536                );
2537                Ok(Unknown(v.to_owned()))
2538            }
2539        }
2540    }
2541}
2542impl std::fmt::Display for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2543    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2544        f.write_str(self.as_str())
2545    }
2546}
2547
2548#[cfg(not(feature = "redact-generated-debug"))]
2549impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2550    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2551        f.write_str(self.as_str())
2552    }
2553}
2554#[cfg(feature = "redact-generated-debug")]
2555impl std::fmt::Debug for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2556    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2557        f.debug_struct(stringify!(
2558            CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType
2559        ))
2560        .finish_non_exhaustive()
2561    }
2562}
2563impl serde::Serialize for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType {
2564    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2565    where
2566        S: serde::Serializer,
2567    {
2568        serializer.serialize_str(self.as_str())
2569    }
2570}
2571#[cfg(feature = "deserialize")]
2572impl<'de> serde::Deserialize<'de>
2573    for CreateConfirmationTokenPaymentMethodOptionsCardInstallmentsPlanType
2574{
2575    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2576        use std::str::FromStr;
2577        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2578        Ok(Self::from_str(&s).expect("infallible"))
2579    }
2580}
2581/// Shipping information for this ConfirmationToken.
2582#[derive(Clone, Eq, PartialEq)]
2583#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2584#[derive(serde::Serialize)]
2585pub struct CreateConfirmationTokenShipping {
2586    /// Shipping address
2587    pub address: CreateConfirmationTokenShippingAddress,
2588    /// Recipient name.
2589    pub name: String,
2590    /// Recipient phone (including extension)
2591    #[serde(skip_serializing_if = "Option::is_none")]
2592    pub phone: Option<String>,
2593}
2594#[cfg(feature = "redact-generated-debug")]
2595impl std::fmt::Debug for CreateConfirmationTokenShipping {
2596    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2597        f.debug_struct("CreateConfirmationTokenShipping").finish_non_exhaustive()
2598    }
2599}
2600impl CreateConfirmationTokenShipping {
2601    pub fn new(
2602        address: impl Into<CreateConfirmationTokenShippingAddress>,
2603        name: impl Into<String>,
2604    ) -> Self {
2605        Self { address: address.into(), name: name.into(), phone: None }
2606    }
2607}
2608/// Shipping address
2609#[derive(Clone, Eq, PartialEq)]
2610#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2611#[derive(serde::Serialize)]
2612pub struct CreateConfirmationTokenShippingAddress {
2613    /// City, district, suburb, town, or village.
2614    #[serde(skip_serializing_if = "Option::is_none")]
2615    pub city: Option<String>,
2616    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
2617    #[serde(skip_serializing_if = "Option::is_none")]
2618    pub country: Option<String>,
2619    /// Address line 1, such as the street, PO Box, or company name.
2620    #[serde(skip_serializing_if = "Option::is_none")]
2621    pub line1: Option<String>,
2622    /// Address line 2, such as the apartment, suite, unit, or building.
2623    #[serde(skip_serializing_if = "Option::is_none")]
2624    pub line2: Option<String>,
2625    /// ZIP or postal code.
2626    #[serde(skip_serializing_if = "Option::is_none")]
2627    pub postal_code: Option<String>,
2628    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
2629    #[serde(skip_serializing_if = "Option::is_none")]
2630    pub state: Option<String>,
2631}
2632#[cfg(feature = "redact-generated-debug")]
2633impl std::fmt::Debug for CreateConfirmationTokenShippingAddress {
2634    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2635        f.debug_struct("CreateConfirmationTokenShippingAddress").finish_non_exhaustive()
2636    }
2637}
2638impl CreateConfirmationTokenShippingAddress {
2639    pub fn new() -> Self {
2640        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
2641    }
2642}
2643impl Default for CreateConfirmationTokenShippingAddress {
2644    fn default() -> Self {
2645        Self::new()
2646    }
2647}
2648/// Creates a test mode Confirmation Token server side for your integration tests.
2649#[derive(Clone)]
2650#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2651#[derive(serde::Serialize)]
2652pub struct CreateConfirmationToken {
2653    inner: CreateConfirmationTokenBuilder,
2654}
2655#[cfg(feature = "redact-generated-debug")]
2656impl std::fmt::Debug for CreateConfirmationToken {
2657    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2658        f.debug_struct("CreateConfirmationToken").finish_non_exhaustive()
2659    }
2660}
2661impl CreateConfirmationToken {
2662    /// Construct a new `CreateConfirmationToken`.
2663    pub fn new() -> Self {
2664        Self { inner: CreateConfirmationTokenBuilder::new() }
2665    }
2666    /// Specifies which fields in the response should be expanded.
2667    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2668        self.inner.expand = Some(expand.into());
2669        self
2670    }
2671    /// ID of an existing PaymentMethod.
2672    pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
2673        self.inner.payment_method = Some(payment_method.into());
2674        self
2675    }
2676    /// If provided, this hash will be used to create a PaymentMethod.
2677    pub fn payment_method_data(
2678        mut self,
2679        payment_method_data: impl Into<CreateConfirmationTokenPaymentMethodData>,
2680    ) -> Self {
2681        self.inner.payment_method_data = Some(payment_method_data.into());
2682        self
2683    }
2684    /// Payment-method-specific configuration for this ConfirmationToken.
2685    pub fn payment_method_options(
2686        mut self,
2687        payment_method_options: impl Into<CreateConfirmationTokenPaymentMethodOptions>,
2688    ) -> Self {
2689        self.inner.payment_method_options = Some(payment_method_options.into());
2690        self
2691    }
2692    /// Return URL used to confirm the Intent.
2693    pub fn return_url(mut self, return_url: impl Into<String>) -> Self {
2694        self.inner.return_url = Some(return_url.into());
2695        self
2696    }
2697    /// Indicates that you intend to make future payments with this ConfirmationToken's payment method.
2698    ///
2699    /// The presence of this property will [attach the payment method](https://docs.stripe.com/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.
2700    pub fn setup_future_usage(
2701        mut self,
2702        setup_future_usage: impl Into<stripe_payment::ConfirmationTokenSetupFutureUsage>,
2703    ) -> Self {
2704        self.inner.setup_future_usage = Some(setup_future_usage.into());
2705        self
2706    }
2707    /// Shipping information for this ConfirmationToken.
2708    pub fn shipping(mut self, shipping: impl Into<CreateConfirmationTokenShipping>) -> Self {
2709        self.inner.shipping = Some(shipping.into());
2710        self
2711    }
2712}
2713impl Default for CreateConfirmationToken {
2714    fn default() -> Self {
2715        Self::new()
2716    }
2717}
2718impl CreateConfirmationToken {
2719    /// Send the request and return the deserialized response.
2720    pub async fn send<C: StripeClient>(
2721        &self,
2722        client: &C,
2723    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2724        self.customize().send(client).await
2725    }
2726
2727    /// Send the request and return the deserialized response, blocking until completion.
2728    pub fn send_blocking<C: StripeBlockingClient>(
2729        &self,
2730        client: &C,
2731    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2732        self.customize().send_blocking(client)
2733    }
2734}
2735
2736impl StripeRequest for CreateConfirmationToken {
2737    type Output = stripe_payment::ConfirmationToken;
2738
2739    fn build(&self) -> RequestBuilder {
2740        RequestBuilder::new(StripeMethod::Post, "/test_helpers/confirmation_tokens")
2741            .form(&self.inner)
2742    }
2743}