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