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