1use 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#[derive(Clone, Debug, Default, Deserialize, Serialize)]
18pub struct SetupAttempt {
19 pub id: SetupAttemptId,
21
22 pub application: Option<Expandable<Application>>,
24
25 #[serde(skip_serializing_if = "Option::is_none")]
31 pub attach_to_self: Option<bool>,
32
33 pub created: Timestamp,
37
38 pub customer: Option<Expandable<Customer>>,
40
41 pub flow_directions: Option<Vec<SetupAttemptFlowDirections>>,
48
49 pub livemode: bool,
51
52 pub on_behalf_of: Option<Expandable<Account>>,
54
55 pub payment_method: Expandable<PaymentMethod>,
57
58 pub payment_method_details: SetupAttemptPaymentMethodDetails,
59
60 pub setup_error: Option<Box<ApiErrors>>,
62
63 pub setup_intent: Expandable<SetupIntent>,
65
66 pub status: String,
68
69 pub usage: String,
71}
72
73impl SetupAttempt {
74 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 #[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 pub bank_code: Option<String>,
158
159 pub bank_name: Option<String>,
161
162 pub bic: Option<String>,
164
165 pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
167
168 pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
170
171 pub iban_last4: Option<String>,
173
174 pub preferred_language: Option<SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage>,
177
178 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 pub brand: Option<String>,
194
195 pub checks: Option<SetupAttemptPaymentMethodDetailsCardChecks>,
197
198 pub country: Option<String>,
202
203 #[serde(skip_serializing_if = "Option::is_none")]
207 pub description: Option<String>,
208
209 pub exp_month: Option<i64>,
211
212 pub exp_year: Option<i64>,
214
215 #[serde(skip_serializing_if = "Option::is_none")]
220 pub fingerprint: Option<String>,
221
222 pub funding: Option<String>,
226
227 #[serde(skip_serializing_if = "Option::is_none")]
231 pub iin: Option<String>,
232
233 #[serde(skip_serializing_if = "Option::is_none")]
237 pub issuer: Option<String>,
238
239 pub last4: Option<String>,
241
242 pub network: Option<String>,
246
247 pub three_d_secure: Option<ThreeDSecureDetails>,
249
250 pub wallet: Option<SetupAttemptPaymentMethodDetailsCardWallet>,
252}
253
254#[derive(Clone, Debug, Default, Deserialize, Serialize)]
255pub struct SetupAttemptPaymentMethodDetailsCardChecks {
256 pub address_line1_check: Option<String>,
258
259 pub address_postal_code_check: Option<String>,
261
262 pub cvc_check: Option<String>,
264}
265
266#[derive(Clone, Debug, Default, Deserialize, Serialize)]
267pub struct SetupAttemptPaymentMethodDetailsCardPresent {
268 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 #[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 pub bank: Option<SetupAttemptPaymentMethodDetailsIdealBank>,
297
298 pub bic: Option<SetupAttemptPaymentMethodDetailsIdealBic>,
300
301 pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
303
304 pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
306
307 pub iban_last4: Option<String>,
309
310 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 pub bank_code: Option<String>,
333
334 pub bank_name: Option<String>,
336
337 pub bic: Option<String>,
339
340 pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
342
343 pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
345
346 pub iban_last4: Option<String>,
348
349 pub preferred_language: Option<SetupAttemptPaymentMethodDetailsSofortPreferredLanguage>,
352
353 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 pub authentication_flow: Option<ThreeDSecureDetailsAuthenticationFlow>,
368
369 pub electronic_commerce_indicator: Option<ThreeDSecureDetailsElectronicCommerceIndicator>,
373
374 pub result: Option<ThreeDSecureDetailsResult>,
376
377 pub result_reason: Option<ThreeDSecureDetailsResultReason>,
380
381 pub transaction_id: Option<String>,
384
385 pub version: Option<ThreeDSecureDetailsVersion>,
387}
388
389#[derive(Clone, Debug, Serialize)]
391pub struct ListSetupAttempts<'a> {
392 #[serde(skip_serializing_if = "Option::is_none")]
396 pub created: Option<RangeQuery<Timestamp>>,
397
398 #[serde(skip_serializing_if = "Option::is_none")]
403 pub ending_before: Option<SetupAttemptId>,
404
405 #[serde(skip_serializing_if = "Expand::is_empty")]
407 pub expand: &'a [&'a str],
408
409 #[serde(skip_serializing_if = "Option::is_none")]
413 pub limit: Option<u64>,
414
415 pub setup_intent: SetupIntentId,
418
419 #[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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#[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}