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