Skip to main content

stripe_shared/
setup_attempt_payment_method_details.rs

1#[derive(Clone)]
2#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
4#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
5pub struct SetupAttemptPaymentMethodDetails {
6    pub acss_debit: Option<stripe_shared::SetupAttemptPaymentMethodDetailsAcssDebit>,
7    pub amazon_pay: Option<stripe_shared::SetupAttemptPaymentMethodDetailsAmazonPay>,
8    pub au_becs_debit: Option<stripe_shared::SetupAttemptPaymentMethodDetailsAuBecsDebit>,
9    pub bacs_debit: Option<stripe_shared::SetupAttemptPaymentMethodDetailsBacsDebit>,
10    pub bancontact: Option<stripe_shared::SetupAttemptPaymentMethodDetailsBancontact>,
11    pub boleto: Option<stripe_shared::SetupAttemptPaymentMethodDetailsBoleto>,
12    pub card: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCard>,
13    pub card_present: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardPresent>,
14    pub cashapp: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCashapp>,
15    pub ideal: Option<stripe_shared::SetupAttemptPaymentMethodDetailsIdeal>,
16    pub kakao_pay: Option<stripe_shared::SetupAttemptPaymentMethodDetailsKakaoPay>,
17    pub klarna: Option<stripe_shared::SetupAttemptPaymentMethodDetailsKlarna>,
18    pub kr_card: Option<stripe_shared::SetupAttemptPaymentMethodDetailsKrCard>,
19    pub link: Option<stripe_shared::SetupAttemptPaymentMethodDetailsLink>,
20    pub naver_pay: Option<stripe_shared::SetupAttemptPaymentMethodDetailsNaverPay>,
21    pub nz_bank_account: Option<stripe_shared::SetupAttemptPaymentMethodDetailsNzBankAccount>,
22    pub paypal: Option<stripe_shared::SetupAttemptPaymentMethodDetailsPaypal>,
23    pub payto: Option<stripe_shared::SetupAttemptPaymentMethodDetailsPayto>,
24    pub pix: Option<stripe_shared::SetupAttemptPaymentMethodDetailsPix>,
25    pub revolut_pay: Option<stripe_shared::SetupAttemptPaymentMethodDetailsRevolutPay>,
26    pub satispay:
27        Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsSatispaySetupAttemptDetails>,
28    pub sepa_debit: Option<stripe_shared::SetupAttemptPaymentMethodDetailsSepaDebit>,
29    pub sofort: Option<stripe_shared::SetupAttemptPaymentMethodDetailsSofort>,
30    pub twint: Option<stripe_shared::SetupAttemptPaymentMethodDetailsTwint>,
31    /// The type of the payment method used in the SetupIntent (e.g., `card`).
32    /// An additional hash is included on `payment_method_details` with a name matching this value.
33    /// It contains confirmation-specific information for the payment method.
34    #[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(rename = "type"))]
35    pub type_: String,
36    pub upi: Option<stripe_shared::SetupAttemptPaymentMethodDetailsUpi>,
37    pub us_bank_account: Option<stripe_shared::SetupAttemptPaymentMethodDetailsUsBankAccount>,
38}
39#[cfg(feature = "redact-generated-debug")]
40impl std::fmt::Debug for SetupAttemptPaymentMethodDetails {
41    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
42        f.debug_struct("SetupAttemptPaymentMethodDetails").finish_non_exhaustive()
43    }
44}
45#[doc(hidden)]
46pub struct SetupAttemptPaymentMethodDetailsBuilder {
47    acss_debit: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsAcssDebit>>,
48    amazon_pay: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsAmazonPay>>,
49    au_becs_debit: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsAuBecsDebit>>,
50    bacs_debit: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsBacsDebit>>,
51    bancontact: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsBancontact>>,
52    boleto: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsBoleto>>,
53    card: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCard>>,
54    card_present: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardPresent>>,
55    cashapp: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCashapp>>,
56    ideal: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsIdeal>>,
57    kakao_pay: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsKakaoPay>>,
58    klarna: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsKlarna>>,
59    kr_card: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsKrCard>>,
60    link: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsLink>>,
61    naver_pay: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsNaverPay>>,
62    nz_bank_account: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsNzBankAccount>>,
63    paypal: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsPaypal>>,
64    payto: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsPayto>>,
65    pix: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsPix>>,
66    revolut_pay: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsRevolutPay>>,
67    satispay:
68        Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsSatispaySetupAttemptDetails>>,
69    sepa_debit: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsSepaDebit>>,
70    sofort: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsSofort>>,
71    twint: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsTwint>>,
72    type_: Option<String>,
73    upi: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsUpi>>,
74    us_bank_account: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsUsBankAccount>>,
75}
76
77#[allow(
78    unused_variables,
79    irrefutable_let_patterns,
80    clippy::let_unit_value,
81    clippy::match_single_binding,
82    clippy::single_match
83)]
84const _: () = {
85    use miniserde::de::{Map, Visitor};
86    use miniserde::json::Value;
87    use miniserde::{Deserialize, Result, make_place};
88    use stripe_types::miniserde_helpers::FromValueOpt;
89    use stripe_types::{MapBuilder, ObjectDeser};
90
91    make_place!(Place);
92
93    impl Deserialize for SetupAttemptPaymentMethodDetails {
94        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
95            Place::new(out)
96        }
97    }
98
99    struct Builder<'a> {
100        out: &'a mut Option<SetupAttemptPaymentMethodDetails>,
101        builder: SetupAttemptPaymentMethodDetailsBuilder,
102    }
103
104    impl Visitor for Place<SetupAttemptPaymentMethodDetails> {
105        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
106            Ok(Box::new(Builder {
107                out: &mut self.out,
108                builder: SetupAttemptPaymentMethodDetailsBuilder::deser_default(),
109            }))
110        }
111    }
112
113    impl MapBuilder for SetupAttemptPaymentMethodDetailsBuilder {
114        type Out = SetupAttemptPaymentMethodDetails;
115        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
116            Ok(match k {
117                "acss_debit" => Deserialize::begin(&mut self.acss_debit),
118                "amazon_pay" => Deserialize::begin(&mut self.amazon_pay),
119                "au_becs_debit" => Deserialize::begin(&mut self.au_becs_debit),
120                "bacs_debit" => Deserialize::begin(&mut self.bacs_debit),
121                "bancontact" => Deserialize::begin(&mut self.bancontact),
122                "boleto" => Deserialize::begin(&mut self.boleto),
123                "card" => Deserialize::begin(&mut self.card),
124                "card_present" => Deserialize::begin(&mut self.card_present),
125                "cashapp" => Deserialize::begin(&mut self.cashapp),
126                "ideal" => Deserialize::begin(&mut self.ideal),
127                "kakao_pay" => Deserialize::begin(&mut self.kakao_pay),
128                "klarna" => Deserialize::begin(&mut self.klarna),
129                "kr_card" => Deserialize::begin(&mut self.kr_card),
130                "link" => Deserialize::begin(&mut self.link),
131                "naver_pay" => Deserialize::begin(&mut self.naver_pay),
132                "nz_bank_account" => Deserialize::begin(&mut self.nz_bank_account),
133                "paypal" => Deserialize::begin(&mut self.paypal),
134                "payto" => Deserialize::begin(&mut self.payto),
135                "pix" => Deserialize::begin(&mut self.pix),
136                "revolut_pay" => Deserialize::begin(&mut self.revolut_pay),
137                "satispay" => Deserialize::begin(&mut self.satispay),
138                "sepa_debit" => Deserialize::begin(&mut self.sepa_debit),
139                "sofort" => Deserialize::begin(&mut self.sofort),
140                "twint" => Deserialize::begin(&mut self.twint),
141                "type" => Deserialize::begin(&mut self.type_),
142                "upi" => Deserialize::begin(&mut self.upi),
143                "us_bank_account" => Deserialize::begin(&mut self.us_bank_account),
144                _ => <dyn Visitor>::ignore(),
145            })
146        }
147
148        fn deser_default() -> Self {
149            Self {
150                acss_debit: Some(None),
151                amazon_pay: Some(None),
152                au_becs_debit: Some(None),
153                bacs_debit: Some(None),
154                bancontact: Some(None),
155                boleto: Some(None),
156                card: Some(None),
157                card_present: Some(None),
158                cashapp: Some(None),
159                ideal: Some(None),
160                kakao_pay: Some(None),
161                klarna: Some(None),
162                kr_card: Some(None),
163                link: Some(None),
164                naver_pay: Some(None),
165                nz_bank_account: Some(None),
166                paypal: Some(None),
167                payto: Some(None),
168                pix: Some(None),
169                revolut_pay: Some(None),
170                satispay: Some(None),
171                sepa_debit: Some(None),
172                sofort: Some(None),
173                twint: Some(None),
174                type_: None,
175                upi: Some(None),
176                us_bank_account: Some(None),
177            }
178        }
179
180        fn take_out(&mut self) -> Option<Self::Out> {
181            let (
182                Some(acss_debit),
183                Some(amazon_pay),
184                Some(au_becs_debit),
185                Some(bacs_debit),
186                Some(bancontact),
187                Some(boleto),
188                Some(card),
189                Some(card_present),
190                Some(cashapp),
191                Some(ideal),
192                Some(kakao_pay),
193                Some(klarna),
194                Some(kr_card),
195                Some(link),
196                Some(naver_pay),
197                Some(nz_bank_account),
198                Some(paypal),
199                Some(payto),
200                Some(pix),
201                Some(revolut_pay),
202                Some(satispay),
203                Some(sepa_debit),
204                Some(sofort),
205                Some(twint),
206                Some(type_),
207                Some(upi),
208                Some(us_bank_account),
209            ) = (
210                self.acss_debit,
211                self.amazon_pay,
212                self.au_becs_debit,
213                self.bacs_debit,
214                self.bancontact.take(),
215                self.boleto,
216                self.card.take(),
217                self.card_present.take(),
218                self.cashapp,
219                self.ideal.take(),
220                self.kakao_pay,
221                self.klarna,
222                self.kr_card,
223                self.link,
224                self.naver_pay.take(),
225                self.nz_bank_account,
226                self.paypal,
227                self.payto,
228                self.pix.take(),
229                self.revolut_pay,
230                self.satispay,
231                self.sepa_debit,
232                self.sofort.take(),
233                self.twint,
234                self.type_.take(),
235                self.upi,
236                self.us_bank_account,
237            )
238            else {
239                return None;
240            };
241            Some(Self::Out {
242                acss_debit,
243                amazon_pay,
244                au_becs_debit,
245                bacs_debit,
246                bancontact,
247                boleto,
248                card,
249                card_present,
250                cashapp,
251                ideal,
252                kakao_pay,
253                klarna,
254                kr_card,
255                link,
256                naver_pay,
257                nz_bank_account,
258                paypal,
259                payto,
260                pix,
261                revolut_pay,
262                satispay,
263                sepa_debit,
264                sofort,
265                twint,
266                type_,
267                upi,
268                us_bank_account,
269            })
270        }
271    }
272
273    impl Map for Builder<'_> {
274        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
275            self.builder.key(k)
276        }
277
278        fn finish(&mut self) -> Result<()> {
279            *self.out = self.builder.take_out();
280            Ok(())
281        }
282    }
283
284    impl ObjectDeser for SetupAttemptPaymentMethodDetails {
285        type Builder = SetupAttemptPaymentMethodDetailsBuilder;
286    }
287
288    impl FromValueOpt for SetupAttemptPaymentMethodDetails {
289        fn from_value(v: Value) -> Option<Self> {
290            let Value::Object(obj) = v else {
291                return None;
292            };
293            let mut b = SetupAttemptPaymentMethodDetailsBuilder::deser_default();
294            for (k, v) in obj {
295                match k.as_str() {
296                    "acss_debit" => b.acss_debit = FromValueOpt::from_value(v),
297                    "amazon_pay" => b.amazon_pay = FromValueOpt::from_value(v),
298                    "au_becs_debit" => b.au_becs_debit = FromValueOpt::from_value(v),
299                    "bacs_debit" => b.bacs_debit = FromValueOpt::from_value(v),
300                    "bancontact" => b.bancontact = FromValueOpt::from_value(v),
301                    "boleto" => b.boleto = FromValueOpt::from_value(v),
302                    "card" => b.card = FromValueOpt::from_value(v),
303                    "card_present" => b.card_present = FromValueOpt::from_value(v),
304                    "cashapp" => b.cashapp = FromValueOpt::from_value(v),
305                    "ideal" => b.ideal = FromValueOpt::from_value(v),
306                    "kakao_pay" => b.kakao_pay = FromValueOpt::from_value(v),
307                    "klarna" => b.klarna = FromValueOpt::from_value(v),
308                    "kr_card" => b.kr_card = FromValueOpt::from_value(v),
309                    "link" => b.link = FromValueOpt::from_value(v),
310                    "naver_pay" => b.naver_pay = FromValueOpt::from_value(v),
311                    "nz_bank_account" => b.nz_bank_account = FromValueOpt::from_value(v),
312                    "paypal" => b.paypal = FromValueOpt::from_value(v),
313                    "payto" => b.payto = FromValueOpt::from_value(v),
314                    "pix" => b.pix = FromValueOpt::from_value(v),
315                    "revolut_pay" => b.revolut_pay = FromValueOpt::from_value(v),
316                    "satispay" => b.satispay = FromValueOpt::from_value(v),
317                    "sepa_debit" => b.sepa_debit = FromValueOpt::from_value(v),
318                    "sofort" => b.sofort = FromValueOpt::from_value(v),
319                    "twint" => b.twint = FromValueOpt::from_value(v),
320                    "type" => b.type_ = FromValueOpt::from_value(v),
321                    "upi" => b.upi = FromValueOpt::from_value(v),
322                    "us_bank_account" => b.us_bank_account = FromValueOpt::from_value(v),
323                    _ => {}
324                }
325            }
326            b.take_out()
327        }
328    }
329};