stripe/resources/generated/
setup_attempt.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::client::{Client, Response};
6use crate::ids::{SetupAttemptId, SetupIntentId};
7use crate::params::{Expand, Expandable, List, Object, Paginable, RangeQuery, Timestamp};
8use crate::resources::{
9    Account, ApiErrors, Application, Customer, Mandate, PaymentMethod,
10    PaymentMethodDetailsCardWalletApplePay, PaymentMethodDetailsCardWalletGooglePay, SetupIntent,
11};
12use serde::{Deserialize, Serialize};
13
14/// The resource representing a Stripe "PaymentFlowsSetupIntentSetupAttempt".
15///
16/// For more details see <https://stripe.com/docs/api/setup_attempts/object>
17#[derive(Clone, Debug, Default, Deserialize, Serialize)]
18pub struct SetupAttempt {
19    /// Unique identifier for the object.
20    pub id: SetupAttemptId,
21
22    /// The value of [application](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application) on the SetupIntent at the time of this confirmation.
23    pub application: Option<Expandable<Application>>,
24
25    /// If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
26    ///
27    /// It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers.
28    ///
29    /// It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub attach_to_self: Option<bool>,
32
33    /// Time at which the object was created.
34    ///
35    /// Measured in seconds since the Unix epoch.
36    pub created: Timestamp,
37
38    /// The value of [customer](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer) on the SetupIntent at the time of this confirmation.
39    pub customer: Option<Expandable<Customer>>,
40
41    /// Indicates the directions of money movement for which this payment method is intended to be used.
42    ///
43    /// Include `inbound` if you intend to use the payment method as the origin to pull funds from.
44    ///
45    /// Include `outbound` if you intend to use the payment method as the destination to send funds to.
46    /// You can include both if you intend to use the payment method for both purposes.
47    pub flow_directions: Option<Vec<SetupAttemptFlowDirections>>,
48
49    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
50    pub livemode: bool,
51
52    /// The value of [on_behalf_of](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of) on the SetupIntent at the time of this confirmation.
53    pub on_behalf_of: Option<Expandable<Account>>,
54
55    /// ID of the payment method used with this SetupAttempt.
56    pub payment_method: Expandable<PaymentMethod>,
57
58    pub payment_method_details: SetupAttemptPaymentMethodDetails,
59
60    /// The error encountered during this attempt to confirm the SetupIntent, if any.
61    pub setup_error: Option<Box<ApiErrors>>,
62
63    /// ID of the SetupIntent that this attempt belongs to.
64    pub setup_intent: Expandable<SetupIntent>,
65
66    /// Status of this SetupAttempt, one of `requires_confirmation`, `requires_action`, `processing`, `succeeded`, `failed`, or `abandoned`.
67    pub status: String,
68
69    /// The value of [usage](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage) on the SetupIntent at the time of this confirmation, one of `off_session` or `on_session`.
70    pub usage: String,
71}
72
73impl SetupAttempt {
74    /// Returns a list of SetupAttempts that associate with a provided SetupIntent.
75    pub fn list(client: &Client, params: &ListSetupAttempts<'_>) -> Response<List<SetupAttempt>> {
76        client.get_query("/setup_attempts", params)
77    }
78}
79
80impl Object for SetupAttempt {
81    type Id = SetupAttemptId;
82    fn id(&self) -> Self::Id {
83        self.id.clone()
84    }
85    fn object(&self) -> &'static str {
86        "setup_attempt"
87    }
88}
89
90#[derive(Clone, Debug, Default, Deserialize, Serialize)]
91pub struct SetupAttemptPaymentMethodDetails {
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub acss_debit: Option<SetupAttemptPaymentMethodDetailsAcssDebit>,
94
95    #[serde(skip_serializing_if = "Option::is_none")]
96    pub au_becs_debit: Option<SetupAttemptPaymentMethodDetailsAuBecsDebit>,
97
98    #[serde(skip_serializing_if = "Option::is_none")]
99    pub bacs_debit: Option<SetupAttemptPaymentMethodDetailsBacsDebit>,
100
101    #[serde(skip_serializing_if = "Option::is_none")]
102    pub bancontact: Option<SetupAttemptPaymentMethodDetailsBancontact>,
103
104    #[serde(skip_serializing_if = "Option::is_none")]
105    pub boleto: Option<SetupAttemptPaymentMethodDetailsBoleto>,
106
107    #[serde(skip_serializing_if = "Option::is_none")]
108    pub card: Option<SetupAttemptPaymentMethodDetailsCard>,
109
110    #[serde(skip_serializing_if = "Option::is_none")]
111    pub card_present: Option<SetupAttemptPaymentMethodDetailsCardPresent>,
112
113    #[serde(skip_serializing_if = "Option::is_none")]
114    pub cashapp: Option<SetupAttemptPaymentMethodDetailsCashapp>,
115
116    #[serde(skip_serializing_if = "Option::is_none")]
117    pub ideal: Option<SetupAttemptPaymentMethodDetailsIdeal>,
118
119    #[serde(skip_serializing_if = "Option::is_none")]
120    pub klarna: Option<SetupAttemptPaymentMethodDetailsKlarna>,
121
122    #[serde(skip_serializing_if = "Option::is_none")]
123    pub link: Option<SetupAttemptPaymentMethodDetailsLink>,
124
125    #[serde(skip_serializing_if = "Option::is_none")]
126    pub paypal: Option<SetupAttemptPaymentMethodDetailsPaypal>,
127
128    #[serde(skip_serializing_if = "Option::is_none")]
129    pub sepa_debit: Option<SetupAttemptPaymentMethodDetailsSepaDebit>,
130
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub sofort: Option<SetupAttemptPaymentMethodDetailsSofort>,
133
134    /// The type of the payment method used in the SetupIntent (e.g., `card`).
135    ///
136    /// An additional hash is included on `payment_method_details` with a name matching this value.
137    /// It contains confirmation-specific information for the payment method.
138    #[serde(rename = "type")]
139    pub type_: String,
140
141    #[serde(skip_serializing_if = "Option::is_none")]
142    pub us_bank_account: Option<SetupAttemptPaymentMethodDetailsUsBankAccount>,
143}
144
145#[derive(Clone, Debug, Default, Deserialize, Serialize)]
146pub struct SetupAttemptPaymentMethodDetailsAcssDebit {}
147
148#[derive(Clone, Debug, Default, Deserialize, Serialize)]
149pub struct SetupAttemptPaymentMethodDetailsAuBecsDebit {}
150
151#[derive(Clone, Debug, Default, Deserialize, Serialize)]
152pub struct SetupAttemptPaymentMethodDetailsBacsDebit {}
153
154#[derive(Clone, Debug, Default, Deserialize, Serialize)]
155pub struct SetupAttemptPaymentMethodDetailsBancontact {
156    /// Bank code of bank associated with the bank account.
157    pub bank_code: Option<String>,
158
159    /// Name of the bank associated with the bank account.
160    pub bank_name: Option<String>,
161
162    /// Bank Identifier Code of the bank associated with the bank account.
163    pub bic: Option<String>,
164
165    /// The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
166    pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
167
168    /// The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
169    pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
170
171    /// Last four characters of the IBAN.
172    pub iban_last4: Option<String>,
173
174    /// Preferred language of the Bancontact authorization page that the customer is redirected to.
175    /// Can be one of `en`, `de`, `fr`, or `nl`.
176    pub preferred_language: Option<SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage>,
177
178    /// Owner's verified full name.
179    ///
180    /// Values are verified or provided by Bancontact directly (if supported) at the time of authorization or settlement.
181    /// They cannot be set or mutated.
182    pub verified_name: Option<String>,
183}
184
185#[derive(Clone, Debug, Default, Deserialize, Serialize)]
186pub struct SetupAttemptPaymentMethodDetailsBoleto {}
187
188#[derive(Clone, Debug, Default, Deserialize, Serialize)]
189pub struct SetupAttemptPaymentMethodDetailsCard {
190    /// Card brand.
191    ///
192    /// Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
193    pub brand: Option<String>,
194
195    /// Check results by Card networks on Card address and CVC at the time of authorization.
196    pub checks: Option<SetupAttemptPaymentMethodDetailsCardChecks>,
197
198    /// Two-letter ISO code representing the country of the card.
199    ///
200    /// You could use this attribute to get a sense of the international breakdown of cards you've collected.
201    pub country: Option<String>,
202
203    /// A high-level description of the type of cards issued in this range.
204    ///
205    /// (For internal use only and not typically available in standard API requests.).
206    #[serde(skip_serializing_if = "Option::is_none")]
207    pub description: Option<String>,
208
209    /// Two-digit number representing the card's expiration month.
210    pub exp_month: Option<i64>,
211
212    /// Four-digit number representing the card's expiration year.
213    pub exp_year: Option<i64>,
214
215    /// Uniquely identifies this particular card number.
216    ///
217    /// You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example.
218    /// For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.  *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.*.
219    #[serde(skip_serializing_if = "Option::is_none")]
220    pub fingerprint: Option<String>,
221
222    /// Card funding type.
223    ///
224    /// Can be `credit`, `debit`, `prepaid`, or `unknown`.
225    pub funding: Option<String>,
226
227    /// Issuer identification number of the card.
228    ///
229    /// (For internal use only and not typically available in standard API requests.).
230    #[serde(skip_serializing_if = "Option::is_none")]
231    pub iin: Option<String>,
232
233    /// The name of the card's issuing bank.
234    ///
235    /// (For internal use only and not typically available in standard API requests.).
236    #[serde(skip_serializing_if = "Option::is_none")]
237    pub issuer: Option<String>,
238
239    /// The last four digits of the card.
240    pub last4: Option<String>,
241
242    /// Identifies which network this charge was processed on.
243    ///
244    /// Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
245    pub network: Option<String>,
246
247    /// Populated if this authorization used 3D Secure authentication.
248    pub three_d_secure: Option<ThreeDSecureDetails>,
249
250    /// If this Card is part of a card wallet, this contains the details of the card wallet.
251    pub wallet: Option<SetupAttemptPaymentMethodDetailsCardWallet>,
252}
253
254#[derive(Clone, Debug, Default, Deserialize, Serialize)]
255pub struct SetupAttemptPaymentMethodDetailsCardChecks {
256    /// If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
257    pub address_line1_check: Option<String>,
258
259    /// If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
260    pub address_postal_code_check: Option<String>,
261
262    /// If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
263    pub cvc_check: Option<String>,
264}
265
266#[derive(Clone, Debug, Default, Deserialize, Serialize)]
267pub struct SetupAttemptPaymentMethodDetailsCardPresent {
268    /// The ID of the Card PaymentMethod which was generated by this SetupAttempt.
269    pub generated_card: Option<Expandable<PaymentMethod>>,
270}
271
272#[derive(Clone, Debug, Default, Deserialize, Serialize)]
273pub struct SetupAttemptPaymentMethodDetailsCardWallet {
274    #[serde(skip_serializing_if = "Option::is_none")]
275    pub apple_pay: Option<PaymentMethodDetailsCardWalletApplePay>,
276
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub google_pay: Option<PaymentMethodDetailsCardWalletGooglePay>,
279
280    /// The type of the card wallet, one of `apple_pay`, `google_pay`, or `link`.
281    ///
282    /// An additional hash is included on the Wallet subhash with a name matching this value.
283    /// It contains additional information specific to the card wallet type.
284    #[serde(rename = "type")]
285    pub type_: SetupAttemptPaymentMethodDetailsCardWalletType,
286}
287
288#[derive(Clone, Debug, Default, Deserialize, Serialize)]
289pub struct SetupAttemptPaymentMethodDetailsCashapp {}
290
291#[derive(Clone, Debug, Default, Deserialize, Serialize)]
292pub struct SetupAttemptPaymentMethodDetailsIdeal {
293    /// The customer's bank.
294    ///
295    /// Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`.
296    pub bank: Option<SetupAttemptPaymentMethodDetailsIdealBank>,
297
298    /// The Bank Identifier Code of the customer's bank.
299    pub bic: Option<SetupAttemptPaymentMethodDetailsIdealBic>,
300
301    /// The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
302    pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
303
304    /// The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
305    pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
306
307    /// Last four characters of the IBAN.
308    pub iban_last4: Option<String>,
309
310    /// Owner's verified full name.
311    ///
312    /// Values are verified or provided by iDEAL directly (if supported) at the time of authorization or settlement.
313    /// They cannot be set or mutated.
314    pub verified_name: Option<String>,
315}
316
317#[derive(Clone, Debug, Default, Deserialize, Serialize)]
318pub struct SetupAttemptPaymentMethodDetailsKlarna {}
319
320#[derive(Clone, Debug, Default, Deserialize, Serialize)]
321pub struct SetupAttemptPaymentMethodDetailsLink {}
322
323#[derive(Clone, Debug, Default, Deserialize, Serialize)]
324pub struct SetupAttemptPaymentMethodDetailsPaypal {}
325
326#[derive(Clone, Debug, Default, Deserialize, Serialize)]
327pub struct SetupAttemptPaymentMethodDetailsSepaDebit {}
328
329#[derive(Clone, Debug, Default, Deserialize, Serialize)]
330pub struct SetupAttemptPaymentMethodDetailsSofort {
331    /// Bank code of bank associated with the bank account.
332    pub bank_code: Option<String>,
333
334    /// Name of the bank associated with the bank account.
335    pub bank_name: Option<String>,
336
337    /// Bank Identifier Code of the bank associated with the bank account.
338    pub bic: Option<String>,
339
340    /// The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
341    pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
342
343    /// The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
344    pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
345
346    /// Last four characters of the IBAN.
347    pub iban_last4: Option<String>,
348
349    /// Preferred language of the Sofort authorization page that the customer is redirected to.
350    /// Can be one of `en`, `de`, `fr`, or `nl`.
351    pub preferred_language: Option<SetupAttemptPaymentMethodDetailsSofortPreferredLanguage>,
352
353    /// Owner's verified full name.
354    ///
355    /// Values are verified or provided by Sofort directly (if supported) at the time of authorization or settlement.
356    /// They cannot be set or mutated.
357    pub verified_name: Option<String>,
358}
359
360#[derive(Clone, Debug, Default, Deserialize, Serialize)]
361pub struct SetupAttemptPaymentMethodDetailsUsBankAccount {}
362
363#[derive(Clone, Debug, Default, Deserialize, Serialize)]
364pub struct ThreeDSecureDetails {
365    /// For authenticated transactions: how the customer was authenticated by
366    /// the issuing bank.
367    pub authentication_flow: Option<ThreeDSecureDetailsAuthenticationFlow>,
368
369    /// The Electronic Commerce Indicator (ECI).
370    ///
371    /// A protocol-level field indicating what degree of authentication was performed.
372    pub electronic_commerce_indicator: Option<ThreeDSecureDetailsElectronicCommerceIndicator>,
373
374    /// Indicates the outcome of 3D Secure authentication.
375    pub result: Option<ThreeDSecureDetailsResult>,
376
377    /// Additional information about why 3D Secure succeeded or failed based
378    /// on the `result`.
379    pub result_reason: Option<ThreeDSecureDetailsResultReason>,
380
381    /// The 3D Secure 1 XID or 3D Secure 2 Directory Server Transaction ID
382    /// (dsTransId) for this payment.
383    pub transaction_id: Option<String>,
384
385    /// The version of 3D Secure that was used.
386    pub version: Option<ThreeDSecureDetailsVersion>,
387}
388
389/// The parameters for `SetupAttempt::list`.
390#[derive(Clone, Debug, Serialize)]
391pub struct ListSetupAttempts<'a> {
392    /// A filter on the list, based on the object `created` field.
393    ///
394    /// The value can be a string with an integer Unix timestamp or a dictionary with a number of different query options.
395    #[serde(skip_serializing_if = "Option::is_none")]
396    pub created: Option<RangeQuery<Timestamp>>,
397
398    /// A cursor for use in pagination.
399    ///
400    /// `ending_before` is an object ID that defines your place in the list.
401    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
402    #[serde(skip_serializing_if = "Option::is_none")]
403    pub ending_before: Option<SetupAttemptId>,
404
405    /// Specifies which fields in the response should be expanded.
406    #[serde(skip_serializing_if = "Expand::is_empty")]
407    pub expand: &'a [&'a str],
408
409    /// A limit on the number of objects to be returned.
410    ///
411    /// Limit can range between 1 and 100, and the default is 10.
412    #[serde(skip_serializing_if = "Option::is_none")]
413    pub limit: Option<u64>,
414
415    /// Only return SetupAttempts created by the SetupIntent specified by
416    /// this ID.
417    pub setup_intent: SetupIntentId,
418
419    /// A cursor for use in pagination.
420    ///
421    /// `starting_after` is an object ID that defines your place in the list.
422    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
423    #[serde(skip_serializing_if = "Option::is_none")]
424    pub starting_after: Option<SetupAttemptId>,
425}
426
427impl<'a> ListSetupAttempts<'a> {
428    pub fn new(setup_intent: SetupIntentId) -> Self {
429        ListSetupAttempts {
430            created: Default::default(),
431            ending_before: Default::default(),
432            expand: Default::default(),
433            limit: Default::default(),
434            setup_intent,
435            starting_after: Default::default(),
436        }
437    }
438}
439impl Paginable for ListSetupAttempts<'_> {
440    type O = SetupAttempt;
441    fn set_last(&mut self, item: Self::O) {
442        self.starting_after = Some(item.id());
443    }
444}
445/// An enum representing the possible values of an `SetupAttempt`'s `flow_directions` field.
446#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
447#[serde(rename_all = "snake_case")]
448pub enum SetupAttemptFlowDirections {
449    Inbound,
450    Outbound,
451}
452
453impl SetupAttemptFlowDirections {
454    pub fn as_str(self) -> &'static str {
455        match self {
456            SetupAttemptFlowDirections::Inbound => "inbound",
457            SetupAttemptFlowDirections::Outbound => "outbound",
458        }
459    }
460}
461
462impl AsRef<str> for SetupAttemptFlowDirections {
463    fn as_ref(&self) -> &str {
464        self.as_str()
465    }
466}
467
468impl std::fmt::Display for SetupAttemptFlowDirections {
469    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
470        self.as_str().fmt(f)
471    }
472}
473impl std::default::Default for SetupAttemptFlowDirections {
474    fn default() -> Self {
475        Self::Inbound
476    }
477}
478
479/// An enum representing the possible values of an `SetupAttemptPaymentMethodDetailsBancontact`'s `preferred_language` field.
480#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
481#[serde(rename_all = "snake_case")]
482pub enum SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
483    De,
484    En,
485    Fr,
486    Nl,
487}
488
489impl SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
490    pub fn as_str(self) -> &'static str {
491        match self {
492            SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::De => "de",
493            SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::En => "en",
494            SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::Fr => "fr",
495            SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::Nl => "nl",
496        }
497    }
498}
499
500impl AsRef<str> for SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
501    fn as_ref(&self) -> &str {
502        self.as_str()
503    }
504}
505
506impl std::fmt::Display for SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
507    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
508        self.as_str().fmt(f)
509    }
510}
511impl std::default::Default for SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
512    fn default() -> Self {
513        Self::De
514    }
515}
516
517/// An enum representing the possible values of an `SetupAttemptPaymentMethodDetailsCardWallet`'s `type` field.
518#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
519#[serde(rename_all = "snake_case")]
520pub enum SetupAttemptPaymentMethodDetailsCardWalletType {
521    ApplePay,
522    GooglePay,
523    Link,
524}
525
526impl SetupAttemptPaymentMethodDetailsCardWalletType {
527    pub fn as_str(self) -> &'static str {
528        match self {
529            SetupAttemptPaymentMethodDetailsCardWalletType::ApplePay => "apple_pay",
530            SetupAttemptPaymentMethodDetailsCardWalletType::GooglePay => "google_pay",
531            SetupAttemptPaymentMethodDetailsCardWalletType::Link => "link",
532        }
533    }
534}
535
536impl AsRef<str> for SetupAttemptPaymentMethodDetailsCardWalletType {
537    fn as_ref(&self) -> &str {
538        self.as_str()
539    }
540}
541
542impl std::fmt::Display for SetupAttemptPaymentMethodDetailsCardWalletType {
543    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
544        self.as_str().fmt(f)
545    }
546}
547impl std::default::Default for SetupAttemptPaymentMethodDetailsCardWalletType {
548    fn default() -> Self {
549        Self::ApplePay
550    }
551}
552
553/// An enum representing the possible values of an `SetupAttemptPaymentMethodDetailsIdeal`'s `bank` field.
554#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
555#[serde(rename_all = "snake_case")]
556pub enum SetupAttemptPaymentMethodDetailsIdealBank {
557    AbnAmro,
558    AsnBank,
559    Bunq,
560    Handelsbanken,
561    Ing,
562    Knab,
563    Moneyou,
564    N26,
565    Nn,
566    Rabobank,
567    Regiobank,
568    Revolut,
569    SnsBank,
570    TriodosBank,
571    VanLanschot,
572    Yoursafe,
573}
574
575impl SetupAttemptPaymentMethodDetailsIdealBank {
576    pub fn as_str(self) -> &'static str {
577        match self {
578            SetupAttemptPaymentMethodDetailsIdealBank::AbnAmro => "abn_amro",
579            SetupAttemptPaymentMethodDetailsIdealBank::AsnBank => "asn_bank",
580            SetupAttemptPaymentMethodDetailsIdealBank::Bunq => "bunq",
581            SetupAttemptPaymentMethodDetailsIdealBank::Handelsbanken => "handelsbanken",
582            SetupAttemptPaymentMethodDetailsIdealBank::Ing => "ing",
583            SetupAttemptPaymentMethodDetailsIdealBank::Knab => "knab",
584            SetupAttemptPaymentMethodDetailsIdealBank::Moneyou => "moneyou",
585            SetupAttemptPaymentMethodDetailsIdealBank::N26 => "n26",
586            SetupAttemptPaymentMethodDetailsIdealBank::Nn => "nn",
587            SetupAttemptPaymentMethodDetailsIdealBank::Rabobank => "rabobank",
588            SetupAttemptPaymentMethodDetailsIdealBank::Regiobank => "regiobank",
589            SetupAttemptPaymentMethodDetailsIdealBank::Revolut => "revolut",
590            SetupAttemptPaymentMethodDetailsIdealBank::SnsBank => "sns_bank",
591            SetupAttemptPaymentMethodDetailsIdealBank::TriodosBank => "triodos_bank",
592            SetupAttemptPaymentMethodDetailsIdealBank::VanLanschot => "van_lanschot",
593            SetupAttemptPaymentMethodDetailsIdealBank::Yoursafe => "yoursafe",
594        }
595    }
596}
597
598impl AsRef<str> for SetupAttemptPaymentMethodDetailsIdealBank {
599    fn as_ref(&self) -> &str {
600        self.as_str()
601    }
602}
603
604impl std::fmt::Display for SetupAttemptPaymentMethodDetailsIdealBank {
605    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
606        self.as_str().fmt(f)
607    }
608}
609impl std::default::Default for SetupAttemptPaymentMethodDetailsIdealBank {
610    fn default() -> Self {
611        Self::AbnAmro
612    }
613}
614
615/// An enum representing the possible values of an `SetupAttemptPaymentMethodDetailsIdeal`'s `bic` field.
616#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
617#[serde(rename_all = "snake_case")]
618pub enum SetupAttemptPaymentMethodDetailsIdealBic {
619    #[serde(rename = "ABNANL2A")]
620    Abnanl2a,
621    #[serde(rename = "ASNBNL21")]
622    Asnbnl21,
623    #[serde(rename = "BITSNL2A")]
624    Bitsnl2a,
625    #[serde(rename = "BUNQNL2A")]
626    Bunqnl2a,
627    #[serde(rename = "FVLBNL22")]
628    Fvlbnl22,
629    #[serde(rename = "HANDNL2A")]
630    Handnl2a,
631    #[serde(rename = "INGBNL2A")]
632    Ingbnl2a,
633    #[serde(rename = "KNABNL2H")]
634    Knabnl2h,
635    #[serde(rename = "MOYONL21")]
636    Moyonl21,
637    #[serde(rename = "NNBANL2G")]
638    Nnbanl2g,
639    #[serde(rename = "NTSBDEB1")]
640    Ntsbdeb1,
641    #[serde(rename = "RABONL2U")]
642    Rabonl2u,
643    #[serde(rename = "RBRBNL21")]
644    Rbrbnl21,
645    #[serde(rename = "REVOIE23")]
646    Revoie23,
647    #[serde(rename = "REVOLT21")]
648    Revolt21,
649    #[serde(rename = "SNSBNL2A")]
650    Snsbnl2a,
651    #[serde(rename = "TRIONL2U")]
652    Trionl2u,
653}
654
655impl SetupAttemptPaymentMethodDetailsIdealBic {
656    pub fn as_str(self) -> &'static str {
657        match self {
658            SetupAttemptPaymentMethodDetailsIdealBic::Abnanl2a => "ABNANL2A",
659            SetupAttemptPaymentMethodDetailsIdealBic::Asnbnl21 => "ASNBNL21",
660            SetupAttemptPaymentMethodDetailsIdealBic::Bitsnl2a => "BITSNL2A",
661            SetupAttemptPaymentMethodDetailsIdealBic::Bunqnl2a => "BUNQNL2A",
662            SetupAttemptPaymentMethodDetailsIdealBic::Fvlbnl22 => "FVLBNL22",
663            SetupAttemptPaymentMethodDetailsIdealBic::Handnl2a => "HANDNL2A",
664            SetupAttemptPaymentMethodDetailsIdealBic::Ingbnl2a => "INGBNL2A",
665            SetupAttemptPaymentMethodDetailsIdealBic::Knabnl2h => "KNABNL2H",
666            SetupAttemptPaymentMethodDetailsIdealBic::Moyonl21 => "MOYONL21",
667            SetupAttemptPaymentMethodDetailsIdealBic::Nnbanl2g => "NNBANL2G",
668            SetupAttemptPaymentMethodDetailsIdealBic::Ntsbdeb1 => "NTSBDEB1",
669            SetupAttemptPaymentMethodDetailsIdealBic::Rabonl2u => "RABONL2U",
670            SetupAttemptPaymentMethodDetailsIdealBic::Rbrbnl21 => "RBRBNL21",
671            SetupAttemptPaymentMethodDetailsIdealBic::Revoie23 => "REVOIE23",
672            SetupAttemptPaymentMethodDetailsIdealBic::Revolt21 => "REVOLT21",
673            SetupAttemptPaymentMethodDetailsIdealBic::Snsbnl2a => "SNSBNL2A",
674            SetupAttemptPaymentMethodDetailsIdealBic::Trionl2u => "TRIONL2U",
675        }
676    }
677}
678
679impl AsRef<str> for SetupAttemptPaymentMethodDetailsIdealBic {
680    fn as_ref(&self) -> &str {
681        self.as_str()
682    }
683}
684
685impl std::fmt::Display for SetupAttemptPaymentMethodDetailsIdealBic {
686    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
687        self.as_str().fmt(f)
688    }
689}
690impl std::default::Default for SetupAttemptPaymentMethodDetailsIdealBic {
691    fn default() -> Self {
692        Self::Abnanl2a
693    }
694}
695
696/// An enum representing the possible values of an `SetupAttemptPaymentMethodDetailsSofort`'s `preferred_language` field.
697#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
698#[serde(rename_all = "snake_case")]
699pub enum SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
700    De,
701    En,
702    Fr,
703    Nl,
704}
705
706impl SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
707    pub fn as_str(self) -> &'static str {
708        match self {
709            SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::De => "de",
710            SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::En => "en",
711            SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::Fr => "fr",
712            SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::Nl => "nl",
713        }
714    }
715}
716
717impl AsRef<str> for SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
718    fn as_ref(&self) -> &str {
719        self.as_str()
720    }
721}
722
723impl std::fmt::Display for SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
724    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
725        self.as_str().fmt(f)
726    }
727}
728impl std::default::Default for SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
729    fn default() -> Self {
730        Self::De
731    }
732}
733
734/// An enum representing the possible values of an `ThreeDSecureDetails`'s `authentication_flow` field.
735#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
736#[serde(rename_all = "snake_case")]
737pub enum ThreeDSecureDetailsAuthenticationFlow {
738    Challenge,
739    Frictionless,
740}
741
742impl ThreeDSecureDetailsAuthenticationFlow {
743    pub fn as_str(self) -> &'static str {
744        match self {
745            ThreeDSecureDetailsAuthenticationFlow::Challenge => "challenge",
746            ThreeDSecureDetailsAuthenticationFlow::Frictionless => "frictionless",
747        }
748    }
749}
750
751impl AsRef<str> for ThreeDSecureDetailsAuthenticationFlow {
752    fn as_ref(&self) -> &str {
753        self.as_str()
754    }
755}
756
757impl std::fmt::Display for ThreeDSecureDetailsAuthenticationFlow {
758    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
759        self.as_str().fmt(f)
760    }
761}
762impl std::default::Default for ThreeDSecureDetailsAuthenticationFlow {
763    fn default() -> Self {
764        Self::Challenge
765    }
766}
767
768/// An enum representing the possible values of an `ThreeDSecureDetails`'s `electronic_commerce_indicator` field.
769#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
770#[serde(rename_all = "snake_case")]
771pub enum ThreeDSecureDetailsElectronicCommerceIndicator {
772    #[serde(rename = "01")]
773    V01,
774    #[serde(rename = "02")]
775    V02,
776    #[serde(rename = "05")]
777    V05,
778    #[serde(rename = "06")]
779    V06,
780    #[serde(rename = "07")]
781    V07,
782}
783
784impl ThreeDSecureDetailsElectronicCommerceIndicator {
785    pub fn as_str(self) -> &'static str {
786        match self {
787            ThreeDSecureDetailsElectronicCommerceIndicator::V01 => "01",
788            ThreeDSecureDetailsElectronicCommerceIndicator::V02 => "02",
789            ThreeDSecureDetailsElectronicCommerceIndicator::V05 => "05",
790            ThreeDSecureDetailsElectronicCommerceIndicator::V06 => "06",
791            ThreeDSecureDetailsElectronicCommerceIndicator::V07 => "07",
792        }
793    }
794}
795
796impl AsRef<str> for ThreeDSecureDetailsElectronicCommerceIndicator {
797    fn as_ref(&self) -> &str {
798        self.as_str()
799    }
800}
801
802impl std::fmt::Display for ThreeDSecureDetailsElectronicCommerceIndicator {
803    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
804        self.as_str().fmt(f)
805    }
806}
807impl std::default::Default for ThreeDSecureDetailsElectronicCommerceIndicator {
808    fn default() -> Self {
809        Self::V01
810    }
811}
812
813/// An enum representing the possible values of an `ThreeDSecureDetails`'s `result` field.
814#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
815#[serde(rename_all = "snake_case")]
816pub enum ThreeDSecureDetailsResult {
817    AttemptAcknowledged,
818    Authenticated,
819    Exempted,
820    Failed,
821    NotSupported,
822    ProcessingError,
823}
824
825impl ThreeDSecureDetailsResult {
826    pub fn as_str(self) -> &'static str {
827        match self {
828            ThreeDSecureDetailsResult::AttemptAcknowledged => "attempt_acknowledged",
829            ThreeDSecureDetailsResult::Authenticated => "authenticated",
830            ThreeDSecureDetailsResult::Exempted => "exempted",
831            ThreeDSecureDetailsResult::Failed => "failed",
832            ThreeDSecureDetailsResult::NotSupported => "not_supported",
833            ThreeDSecureDetailsResult::ProcessingError => "processing_error",
834        }
835    }
836}
837
838impl AsRef<str> for ThreeDSecureDetailsResult {
839    fn as_ref(&self) -> &str {
840        self.as_str()
841    }
842}
843
844impl std::fmt::Display for ThreeDSecureDetailsResult {
845    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
846        self.as_str().fmt(f)
847    }
848}
849impl std::default::Default for ThreeDSecureDetailsResult {
850    fn default() -> Self {
851        Self::AttemptAcknowledged
852    }
853}
854
855/// An enum representing the possible values of an `ThreeDSecureDetails`'s `result_reason` field.
856#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
857#[serde(rename_all = "snake_case")]
858pub enum ThreeDSecureDetailsResultReason {
859    Abandoned,
860    Bypassed,
861    Canceled,
862    CardNotEnrolled,
863    NetworkNotSupported,
864    ProtocolError,
865    Rejected,
866}
867
868impl ThreeDSecureDetailsResultReason {
869    pub fn as_str(self) -> &'static str {
870        match self {
871            ThreeDSecureDetailsResultReason::Abandoned => "abandoned",
872            ThreeDSecureDetailsResultReason::Bypassed => "bypassed",
873            ThreeDSecureDetailsResultReason::Canceled => "canceled",
874            ThreeDSecureDetailsResultReason::CardNotEnrolled => "card_not_enrolled",
875            ThreeDSecureDetailsResultReason::NetworkNotSupported => "network_not_supported",
876            ThreeDSecureDetailsResultReason::ProtocolError => "protocol_error",
877            ThreeDSecureDetailsResultReason::Rejected => "rejected",
878        }
879    }
880}
881
882impl AsRef<str> for ThreeDSecureDetailsResultReason {
883    fn as_ref(&self) -> &str {
884        self.as_str()
885    }
886}
887
888impl std::fmt::Display for ThreeDSecureDetailsResultReason {
889    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
890        self.as_str().fmt(f)
891    }
892}
893impl std::default::Default for ThreeDSecureDetailsResultReason {
894    fn default() -> Self {
895        Self::Abandoned
896    }
897}
898
899/// An enum representing the possible values of an `ThreeDSecureDetails`'s `version` field.
900#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
901#[serde(rename_all = "snake_case")]
902pub enum ThreeDSecureDetailsVersion {
903    #[serde(rename = "1.0.2")]
904    V1_0_2,
905    #[serde(rename = "2.1.0")]
906    V2_1_0,
907    #[serde(rename = "2.2.0")]
908    V2_2_0,
909}
910
911impl ThreeDSecureDetailsVersion {
912    pub fn as_str(self) -> &'static str {
913        match self {
914            ThreeDSecureDetailsVersion::V1_0_2 => "1.0.2",
915            ThreeDSecureDetailsVersion::V2_1_0 => "2.1.0",
916            ThreeDSecureDetailsVersion::V2_2_0 => "2.2.0",
917        }
918    }
919}
920
921impl AsRef<str> for ThreeDSecureDetailsVersion {
922    fn as_ref(&self) -> &str {
923        self.as_str()
924    }
925}
926
927impl std::fmt::Display for ThreeDSecureDetailsVersion {
928    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
929        self.as_str().fmt(f)
930    }
931}
932impl std::default::Default for ThreeDSecureDetailsVersion {
933    fn default() -> Self {
934        Self::V1_0_2
935    }
936}