Skip to main content

stripe_shared/
checkout_session_payment_method_options.rs

1#[derive(Clone, Eq, PartialEq)]
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 CheckoutSessionPaymentMethodOptions {
6    pub acss_debit: Option<stripe_shared::CheckoutAcssDebitPaymentMethodOptions>,
7    pub affirm: Option<stripe_shared::CheckoutAffirmPaymentMethodOptions>,
8    pub afterpay_clearpay: Option<stripe_shared::CheckoutAfterpayClearpayPaymentMethodOptions>,
9    pub alipay: Option<stripe_shared::CheckoutAlipayPaymentMethodOptions>,
10    pub alma: Option<stripe_shared::CheckoutAlmaPaymentMethodOptions>,
11    pub amazon_pay: Option<stripe_shared::CheckoutAmazonPayPaymentMethodOptions>,
12    pub au_becs_debit: Option<stripe_shared::CheckoutAuBecsDebitPaymentMethodOptions>,
13    pub bacs_debit: Option<stripe_shared::CheckoutBacsDebitPaymentMethodOptions>,
14    pub bancontact: Option<stripe_shared::CheckoutBancontactPaymentMethodOptions>,
15    pub billie: Option<stripe_shared::CheckoutBilliePaymentMethodOptions>,
16    pub boleto: Option<stripe_shared::CheckoutBoletoPaymentMethodOptions>,
17    pub card: Option<stripe_shared::CheckoutCardPaymentMethodOptions>,
18    pub cashapp: Option<stripe_shared::CheckoutCashappPaymentMethodOptions>,
19    pub customer_balance: Option<stripe_shared::CheckoutCustomerBalancePaymentMethodOptions>,
20    pub eps: Option<stripe_shared::CheckoutEpsPaymentMethodOptions>,
21    pub fpx: Option<stripe_shared::CheckoutFpxPaymentMethodOptions>,
22    pub giropay: Option<stripe_shared::CheckoutGiropayPaymentMethodOptions>,
23    pub grabpay: Option<stripe_shared::CheckoutGrabPayPaymentMethodOptions>,
24    pub ideal: Option<stripe_shared::CheckoutIdealPaymentMethodOptions>,
25    pub kakao_pay: Option<stripe_shared::CheckoutKakaoPayPaymentMethodOptions>,
26    pub klarna: Option<stripe_shared::CheckoutKlarnaPaymentMethodOptions>,
27    pub konbini: Option<stripe_shared::CheckoutKonbiniPaymentMethodOptions>,
28    pub kr_card: Option<stripe_shared::CheckoutKrCardPaymentMethodOptions>,
29    pub link: Option<stripe_shared::CheckoutLinkPaymentMethodOptions>,
30    pub mobilepay: Option<stripe_shared::CheckoutMobilepayPaymentMethodOptions>,
31    pub multibanco: Option<stripe_shared::CheckoutMultibancoPaymentMethodOptions>,
32    pub naver_pay: Option<stripe_shared::CheckoutNaverPayPaymentMethodOptions>,
33    pub oxxo: Option<stripe_shared::CheckoutOxxoPaymentMethodOptions>,
34    pub p24: Option<stripe_shared::CheckoutP24PaymentMethodOptions>,
35    pub payco: Option<stripe_shared::CheckoutPaycoPaymentMethodOptions>,
36    pub paynow: Option<stripe_shared::CheckoutPaynowPaymentMethodOptions>,
37    pub paypal: Option<stripe_shared::CheckoutPaypalPaymentMethodOptions>,
38    pub payto: Option<stripe_shared::CheckoutPaytoPaymentMethodOptions>,
39    pub pix: Option<stripe_shared::CheckoutPixPaymentMethodOptions>,
40    pub revolut_pay: Option<stripe_shared::CheckoutRevolutPayPaymentMethodOptions>,
41    pub samsung_pay: Option<stripe_shared::CheckoutSamsungPayPaymentMethodOptions>,
42    pub satispay: Option<stripe_shared::CheckoutSatispayPaymentMethodOptions>,
43    pub scalapay: Option<stripe_shared::CheckoutScalapayPaymentMethodOptions>,
44    pub sepa_debit: Option<stripe_shared::CheckoutSepaDebitPaymentMethodOptions>,
45    pub sofort: Option<stripe_shared::CheckoutSofortPaymentMethodOptions>,
46    pub sunbit: Option<stripe_shared::CheckoutSunbitPaymentMethodOptions>,
47    pub swish: Option<stripe_shared::CheckoutSwishPaymentMethodOptions>,
48    pub twint: Option<stripe_shared::CheckoutTwintPaymentMethodOptions>,
49    pub upi: Option<stripe_shared::CheckoutUpiPaymentMethodOptions>,
50    pub us_bank_account: Option<stripe_shared::CheckoutUsBankAccountPaymentMethodOptions>,
51    pub wechat_pay: Option<stripe_shared::CheckoutWechatPayPaymentMethodOptions>,
52}
53#[cfg(feature = "redact-generated-debug")]
54impl std::fmt::Debug for CheckoutSessionPaymentMethodOptions {
55    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
56        f.debug_struct("CheckoutSessionPaymentMethodOptions").finish_non_exhaustive()
57    }
58}
59#[doc(hidden)]
60pub struct CheckoutSessionPaymentMethodOptionsBuilder {
61    acss_debit: Option<Option<stripe_shared::CheckoutAcssDebitPaymentMethodOptions>>,
62    affirm: Option<Option<stripe_shared::CheckoutAffirmPaymentMethodOptions>>,
63    afterpay_clearpay: Option<Option<stripe_shared::CheckoutAfterpayClearpayPaymentMethodOptions>>,
64    alipay: Option<Option<stripe_shared::CheckoutAlipayPaymentMethodOptions>>,
65    alma: Option<Option<stripe_shared::CheckoutAlmaPaymentMethodOptions>>,
66    amazon_pay: Option<Option<stripe_shared::CheckoutAmazonPayPaymentMethodOptions>>,
67    au_becs_debit: Option<Option<stripe_shared::CheckoutAuBecsDebitPaymentMethodOptions>>,
68    bacs_debit: Option<Option<stripe_shared::CheckoutBacsDebitPaymentMethodOptions>>,
69    bancontact: Option<Option<stripe_shared::CheckoutBancontactPaymentMethodOptions>>,
70    billie: Option<Option<stripe_shared::CheckoutBilliePaymentMethodOptions>>,
71    boleto: Option<Option<stripe_shared::CheckoutBoletoPaymentMethodOptions>>,
72    card: Option<Option<stripe_shared::CheckoutCardPaymentMethodOptions>>,
73    cashapp: Option<Option<stripe_shared::CheckoutCashappPaymentMethodOptions>>,
74    customer_balance: Option<Option<stripe_shared::CheckoutCustomerBalancePaymentMethodOptions>>,
75    eps: Option<Option<stripe_shared::CheckoutEpsPaymentMethodOptions>>,
76    fpx: Option<Option<stripe_shared::CheckoutFpxPaymentMethodOptions>>,
77    giropay: Option<Option<stripe_shared::CheckoutGiropayPaymentMethodOptions>>,
78    grabpay: Option<Option<stripe_shared::CheckoutGrabPayPaymentMethodOptions>>,
79    ideal: Option<Option<stripe_shared::CheckoutIdealPaymentMethodOptions>>,
80    kakao_pay: Option<Option<stripe_shared::CheckoutKakaoPayPaymentMethodOptions>>,
81    klarna: Option<Option<stripe_shared::CheckoutKlarnaPaymentMethodOptions>>,
82    konbini: Option<Option<stripe_shared::CheckoutKonbiniPaymentMethodOptions>>,
83    kr_card: Option<Option<stripe_shared::CheckoutKrCardPaymentMethodOptions>>,
84    link: Option<Option<stripe_shared::CheckoutLinkPaymentMethodOptions>>,
85    mobilepay: Option<Option<stripe_shared::CheckoutMobilepayPaymentMethodOptions>>,
86    multibanco: Option<Option<stripe_shared::CheckoutMultibancoPaymentMethodOptions>>,
87    naver_pay: Option<Option<stripe_shared::CheckoutNaverPayPaymentMethodOptions>>,
88    oxxo: Option<Option<stripe_shared::CheckoutOxxoPaymentMethodOptions>>,
89    p24: Option<Option<stripe_shared::CheckoutP24PaymentMethodOptions>>,
90    payco: Option<Option<stripe_shared::CheckoutPaycoPaymentMethodOptions>>,
91    paynow: Option<Option<stripe_shared::CheckoutPaynowPaymentMethodOptions>>,
92    paypal: Option<Option<stripe_shared::CheckoutPaypalPaymentMethodOptions>>,
93    payto: Option<Option<stripe_shared::CheckoutPaytoPaymentMethodOptions>>,
94    pix: Option<Option<stripe_shared::CheckoutPixPaymentMethodOptions>>,
95    revolut_pay: Option<Option<stripe_shared::CheckoutRevolutPayPaymentMethodOptions>>,
96    samsung_pay: Option<Option<stripe_shared::CheckoutSamsungPayPaymentMethodOptions>>,
97    satispay: Option<Option<stripe_shared::CheckoutSatispayPaymentMethodOptions>>,
98    scalapay: Option<Option<stripe_shared::CheckoutScalapayPaymentMethodOptions>>,
99    sepa_debit: Option<Option<stripe_shared::CheckoutSepaDebitPaymentMethodOptions>>,
100    sofort: Option<Option<stripe_shared::CheckoutSofortPaymentMethodOptions>>,
101    sunbit: Option<Option<stripe_shared::CheckoutSunbitPaymentMethodOptions>>,
102    swish: Option<Option<stripe_shared::CheckoutSwishPaymentMethodOptions>>,
103    twint: Option<Option<stripe_shared::CheckoutTwintPaymentMethodOptions>>,
104    upi: Option<Option<stripe_shared::CheckoutUpiPaymentMethodOptions>>,
105    us_bank_account: Option<Option<stripe_shared::CheckoutUsBankAccountPaymentMethodOptions>>,
106    wechat_pay: Option<Option<stripe_shared::CheckoutWechatPayPaymentMethodOptions>>,
107}
108
109#[allow(
110    unused_variables,
111    irrefutable_let_patterns,
112    clippy::let_unit_value,
113    clippy::match_single_binding,
114    clippy::single_match
115)]
116const _: () = {
117    use miniserde::de::{Map, Visitor};
118    use miniserde::json::Value;
119    use miniserde::{Deserialize, Result, make_place};
120    use stripe_types::miniserde_helpers::FromValueOpt;
121    use stripe_types::{MapBuilder, ObjectDeser};
122
123    make_place!(Place);
124
125    impl Deserialize for CheckoutSessionPaymentMethodOptions {
126        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
127            Place::new(out)
128        }
129    }
130
131    struct Builder<'a> {
132        out: &'a mut Option<CheckoutSessionPaymentMethodOptions>,
133        builder: CheckoutSessionPaymentMethodOptionsBuilder,
134    }
135
136    impl Visitor for Place<CheckoutSessionPaymentMethodOptions> {
137        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
138            Ok(Box::new(Builder {
139                out: &mut self.out,
140                builder: CheckoutSessionPaymentMethodOptionsBuilder::deser_default(),
141            }))
142        }
143    }
144
145    impl MapBuilder for CheckoutSessionPaymentMethodOptionsBuilder {
146        type Out = CheckoutSessionPaymentMethodOptions;
147        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
148            Ok(match k {
149                "acss_debit" => Deserialize::begin(&mut self.acss_debit),
150                "affirm" => Deserialize::begin(&mut self.affirm),
151                "afterpay_clearpay" => Deserialize::begin(&mut self.afterpay_clearpay),
152                "alipay" => Deserialize::begin(&mut self.alipay),
153                "alma" => Deserialize::begin(&mut self.alma),
154                "amazon_pay" => Deserialize::begin(&mut self.amazon_pay),
155                "au_becs_debit" => Deserialize::begin(&mut self.au_becs_debit),
156                "bacs_debit" => Deserialize::begin(&mut self.bacs_debit),
157                "bancontact" => Deserialize::begin(&mut self.bancontact),
158                "billie" => Deserialize::begin(&mut self.billie),
159                "boleto" => Deserialize::begin(&mut self.boleto),
160                "card" => Deserialize::begin(&mut self.card),
161                "cashapp" => Deserialize::begin(&mut self.cashapp),
162                "customer_balance" => Deserialize::begin(&mut self.customer_balance),
163                "eps" => Deserialize::begin(&mut self.eps),
164                "fpx" => Deserialize::begin(&mut self.fpx),
165                "giropay" => Deserialize::begin(&mut self.giropay),
166                "grabpay" => Deserialize::begin(&mut self.grabpay),
167                "ideal" => Deserialize::begin(&mut self.ideal),
168                "kakao_pay" => Deserialize::begin(&mut self.kakao_pay),
169                "klarna" => Deserialize::begin(&mut self.klarna),
170                "konbini" => Deserialize::begin(&mut self.konbini),
171                "kr_card" => Deserialize::begin(&mut self.kr_card),
172                "link" => Deserialize::begin(&mut self.link),
173                "mobilepay" => Deserialize::begin(&mut self.mobilepay),
174                "multibanco" => Deserialize::begin(&mut self.multibanco),
175                "naver_pay" => Deserialize::begin(&mut self.naver_pay),
176                "oxxo" => Deserialize::begin(&mut self.oxxo),
177                "p24" => Deserialize::begin(&mut self.p24),
178                "payco" => Deserialize::begin(&mut self.payco),
179                "paynow" => Deserialize::begin(&mut self.paynow),
180                "paypal" => Deserialize::begin(&mut self.paypal),
181                "payto" => Deserialize::begin(&mut self.payto),
182                "pix" => Deserialize::begin(&mut self.pix),
183                "revolut_pay" => Deserialize::begin(&mut self.revolut_pay),
184                "samsung_pay" => Deserialize::begin(&mut self.samsung_pay),
185                "satispay" => Deserialize::begin(&mut self.satispay),
186                "scalapay" => Deserialize::begin(&mut self.scalapay),
187                "sepa_debit" => Deserialize::begin(&mut self.sepa_debit),
188                "sofort" => Deserialize::begin(&mut self.sofort),
189                "sunbit" => Deserialize::begin(&mut self.sunbit),
190                "swish" => Deserialize::begin(&mut self.swish),
191                "twint" => Deserialize::begin(&mut self.twint),
192                "upi" => Deserialize::begin(&mut self.upi),
193                "us_bank_account" => Deserialize::begin(&mut self.us_bank_account),
194                "wechat_pay" => Deserialize::begin(&mut self.wechat_pay),
195                _ => <dyn Visitor>::ignore(),
196            })
197        }
198
199        fn deser_default() -> Self {
200            Self {
201                acss_debit: Some(None),
202                affirm: Some(None),
203                afterpay_clearpay: Some(None),
204                alipay: Some(None),
205                alma: Some(None),
206                amazon_pay: Some(None),
207                au_becs_debit: Some(None),
208                bacs_debit: Some(None),
209                bancontact: Some(None),
210                billie: Some(None),
211                boleto: Some(None),
212                card: Some(None),
213                cashapp: Some(None),
214                customer_balance: Some(None),
215                eps: Some(None),
216                fpx: Some(None),
217                giropay: Some(None),
218                grabpay: Some(None),
219                ideal: Some(None),
220                kakao_pay: Some(None),
221                klarna: Some(None),
222                konbini: Some(None),
223                kr_card: Some(None),
224                link: Some(None),
225                mobilepay: Some(None),
226                multibanco: Some(None),
227                naver_pay: Some(None),
228                oxxo: Some(None),
229                p24: Some(None),
230                payco: Some(None),
231                paynow: Some(None),
232                paypal: Some(None),
233                payto: Some(None),
234                pix: Some(None),
235                revolut_pay: Some(None),
236                samsung_pay: Some(None),
237                satispay: Some(None),
238                scalapay: Some(None),
239                sepa_debit: Some(None),
240                sofort: Some(None),
241                sunbit: Some(None),
242                swish: Some(None),
243                twint: Some(None),
244                upi: Some(None),
245                us_bank_account: Some(None),
246                wechat_pay: Some(None),
247            }
248        }
249
250        fn take_out(&mut self) -> Option<Self::Out> {
251            let (
252                Some(acss_debit),
253                Some(affirm),
254                Some(afterpay_clearpay),
255                Some(alipay),
256                Some(alma),
257                Some(amazon_pay),
258                Some(au_becs_debit),
259                Some(bacs_debit),
260                Some(bancontact),
261                Some(billie),
262                Some(boleto),
263                Some(card),
264                Some(cashapp),
265                Some(customer_balance),
266                Some(eps),
267                Some(fpx),
268                Some(giropay),
269                Some(grabpay),
270                Some(ideal),
271                Some(kakao_pay),
272                Some(klarna),
273                Some(konbini),
274                Some(kr_card),
275                Some(link),
276                Some(mobilepay),
277                Some(multibanco),
278                Some(naver_pay),
279                Some(oxxo),
280                Some(p24),
281                Some(payco),
282                Some(paynow),
283                Some(paypal),
284                Some(payto),
285                Some(pix),
286                Some(revolut_pay),
287                Some(samsung_pay),
288                Some(satispay),
289                Some(scalapay),
290                Some(sepa_debit),
291                Some(sofort),
292                Some(sunbit),
293                Some(swish),
294                Some(twint),
295                Some(upi),
296                Some(us_bank_account),
297                Some(wechat_pay),
298            ) = (
299                self.acss_debit.take(),
300                self.affirm.take(),
301                self.afterpay_clearpay.take(),
302                self.alipay.take(),
303                self.alma.take(),
304                self.amazon_pay.take(),
305                self.au_becs_debit.take(),
306                self.bacs_debit.take(),
307                self.bancontact.take(),
308                self.billie.take(),
309                self.boleto.take(),
310                self.card.take(),
311                self.cashapp.take(),
312                self.customer_balance.take(),
313                self.eps.take(),
314                self.fpx.take(),
315                self.giropay.take(),
316                self.grabpay.take(),
317                self.ideal.take(),
318                self.kakao_pay.take(),
319                self.klarna.take(),
320                self.konbini.take(),
321                self.kr_card.take(),
322                self.link.take(),
323                self.mobilepay.take(),
324                self.multibanco.take(),
325                self.naver_pay.take(),
326                self.oxxo.take(),
327                self.p24.take(),
328                self.payco.take(),
329                self.paynow.take(),
330                self.paypal.take(),
331                self.payto.take(),
332                self.pix.take(),
333                self.revolut_pay.take(),
334                self.samsung_pay.take(),
335                self.satispay.take(),
336                self.scalapay.take(),
337                self.sepa_debit.take(),
338                self.sofort.take(),
339                self.sunbit.take(),
340                self.swish.take(),
341                self.twint.take(),
342                self.upi.take(),
343                self.us_bank_account.take(),
344                self.wechat_pay.take(),
345            )
346            else {
347                return None;
348            };
349            Some(Self::Out {
350                acss_debit,
351                affirm,
352                afterpay_clearpay,
353                alipay,
354                alma,
355                amazon_pay,
356                au_becs_debit,
357                bacs_debit,
358                bancontact,
359                billie,
360                boleto,
361                card,
362                cashapp,
363                customer_balance,
364                eps,
365                fpx,
366                giropay,
367                grabpay,
368                ideal,
369                kakao_pay,
370                klarna,
371                konbini,
372                kr_card,
373                link,
374                mobilepay,
375                multibanco,
376                naver_pay,
377                oxxo,
378                p24,
379                payco,
380                paynow,
381                paypal,
382                payto,
383                pix,
384                revolut_pay,
385                samsung_pay,
386                satispay,
387                scalapay,
388                sepa_debit,
389                sofort,
390                sunbit,
391                swish,
392                twint,
393                upi,
394                us_bank_account,
395                wechat_pay,
396            })
397        }
398    }
399
400    impl Map for Builder<'_> {
401        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
402            self.builder.key(k)
403        }
404
405        fn finish(&mut self) -> Result<()> {
406            *self.out = self.builder.take_out();
407            Ok(())
408        }
409    }
410
411    impl ObjectDeser for CheckoutSessionPaymentMethodOptions {
412        type Builder = CheckoutSessionPaymentMethodOptionsBuilder;
413    }
414
415    impl FromValueOpt for CheckoutSessionPaymentMethodOptions {
416        fn from_value(v: Value) -> Option<Self> {
417            let Value::Object(obj) = v else {
418                return None;
419            };
420            let mut b = CheckoutSessionPaymentMethodOptionsBuilder::deser_default();
421            for (k, v) in obj {
422                match k.as_str() {
423                    "acss_debit" => b.acss_debit = FromValueOpt::from_value(v),
424                    "affirm" => b.affirm = FromValueOpt::from_value(v),
425                    "afterpay_clearpay" => b.afterpay_clearpay = FromValueOpt::from_value(v),
426                    "alipay" => b.alipay = FromValueOpt::from_value(v),
427                    "alma" => b.alma = FromValueOpt::from_value(v),
428                    "amazon_pay" => b.amazon_pay = FromValueOpt::from_value(v),
429                    "au_becs_debit" => b.au_becs_debit = FromValueOpt::from_value(v),
430                    "bacs_debit" => b.bacs_debit = FromValueOpt::from_value(v),
431                    "bancontact" => b.bancontact = FromValueOpt::from_value(v),
432                    "billie" => b.billie = FromValueOpt::from_value(v),
433                    "boleto" => b.boleto = FromValueOpt::from_value(v),
434                    "card" => b.card = FromValueOpt::from_value(v),
435                    "cashapp" => b.cashapp = FromValueOpt::from_value(v),
436                    "customer_balance" => b.customer_balance = FromValueOpt::from_value(v),
437                    "eps" => b.eps = FromValueOpt::from_value(v),
438                    "fpx" => b.fpx = FromValueOpt::from_value(v),
439                    "giropay" => b.giropay = FromValueOpt::from_value(v),
440                    "grabpay" => b.grabpay = FromValueOpt::from_value(v),
441                    "ideal" => b.ideal = FromValueOpt::from_value(v),
442                    "kakao_pay" => b.kakao_pay = FromValueOpt::from_value(v),
443                    "klarna" => b.klarna = FromValueOpt::from_value(v),
444                    "konbini" => b.konbini = FromValueOpt::from_value(v),
445                    "kr_card" => b.kr_card = FromValueOpt::from_value(v),
446                    "link" => b.link = FromValueOpt::from_value(v),
447                    "mobilepay" => b.mobilepay = FromValueOpt::from_value(v),
448                    "multibanco" => b.multibanco = FromValueOpt::from_value(v),
449                    "naver_pay" => b.naver_pay = FromValueOpt::from_value(v),
450                    "oxxo" => b.oxxo = FromValueOpt::from_value(v),
451                    "p24" => b.p24 = FromValueOpt::from_value(v),
452                    "payco" => b.payco = FromValueOpt::from_value(v),
453                    "paynow" => b.paynow = FromValueOpt::from_value(v),
454                    "paypal" => b.paypal = FromValueOpt::from_value(v),
455                    "payto" => b.payto = FromValueOpt::from_value(v),
456                    "pix" => b.pix = FromValueOpt::from_value(v),
457                    "revolut_pay" => b.revolut_pay = FromValueOpt::from_value(v),
458                    "samsung_pay" => b.samsung_pay = FromValueOpt::from_value(v),
459                    "satispay" => b.satispay = FromValueOpt::from_value(v),
460                    "scalapay" => b.scalapay = FromValueOpt::from_value(v),
461                    "sepa_debit" => b.sepa_debit = FromValueOpt::from_value(v),
462                    "sofort" => b.sofort = FromValueOpt::from_value(v),
463                    "sunbit" => b.sunbit = FromValueOpt::from_value(v),
464                    "swish" => b.swish = FromValueOpt::from_value(v),
465                    "twint" => b.twint = FromValueOpt::from_value(v),
466                    "upi" => b.upi = FromValueOpt::from_value(v),
467                    "us_bank_account" => b.us_bank_account = FromValueOpt::from_value(v),
468                    "wechat_pay" => b.wechat_pay = FromValueOpt::from_value(v),
469                    _ => {}
470                }
471            }
472            b.take_out()
473        }
474    }
475};