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::{make_place, Deserialize, Result};
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
121 _ => <dyn Visitor>::ignore(),
122 })
123 }
124
125 fn deser_default() -> Self {
126 Self {
127 acss_debit: Deserialize::default(),
128 amazon_pay: Deserialize::default(),
129 au_becs_debit: Deserialize::default(),
130 bacs_debit: Deserialize::default(),
131 bancontact: Deserialize::default(),
132 boleto: Deserialize::default(),
133 card: Deserialize::default(),
134 card_present: Deserialize::default(),
135 cashapp: Deserialize::default(),
136 ideal: Deserialize::default(),
137 kakao_pay: Deserialize::default(),
138 klarna: Deserialize::default(),
139 kr_card: Deserialize::default(),
140 link: Deserialize::default(),
141 naver_pay: Deserialize::default(),
142 nz_bank_account: Deserialize::default(),
143 paypal: Deserialize::default(),
144 revolut_pay: Deserialize::default(),
145 sepa_debit: Deserialize::default(),
146 sofort: Deserialize::default(),
147 type_: Deserialize::default(),
148 us_bank_account: Deserialize::default(),
149 }
150 }
151
152 fn take_out(&mut self) -> Option<Self::Out> {
153 let (
154 Some(acss_debit),
155 Some(amazon_pay),
156 Some(au_becs_debit),
157 Some(bacs_debit),
158 Some(bancontact),
159 Some(boleto),
160 Some(card),
161 Some(card_present),
162 Some(cashapp),
163 Some(ideal),
164 Some(kakao_pay),
165 Some(klarna),
166 Some(kr_card),
167 Some(link),
168 Some(naver_pay),
169 Some(nz_bank_account),
170 Some(paypal),
171 Some(revolut_pay),
172 Some(sepa_debit),
173 Some(sofort),
174 Some(type_),
175 Some(us_bank_account),
176 ) = (
177 self.acss_debit,
178 self.amazon_pay,
179 self.au_becs_debit,
180 self.bacs_debit,
181 self.bancontact.take(),
182 self.boleto,
183 self.card.take(),
184 self.card_present.take(),
185 self.cashapp,
186 self.ideal.take(),
187 self.kakao_pay,
188 self.klarna,
189 self.kr_card,
190 self.link,
191 self.naver_pay.take(),
192 self.nz_bank_account,
193 self.paypal,
194 self.revolut_pay,
195 self.sepa_debit,
196 self.sofort.take(),
197 self.type_.take(),
198 self.us_bank_account,
199 )
200 else {
201 return None;
202 };
203 Some(Self::Out {
204 acss_debit,
205 amazon_pay,
206 au_becs_debit,
207 bacs_debit,
208 bancontact,
209 boleto,
210 card,
211 card_present,
212 cashapp,
213 ideal,
214 kakao_pay,
215 klarna,
216 kr_card,
217 link,
218 naver_pay,
219 nz_bank_account,
220 paypal,
221 revolut_pay,
222 sepa_debit,
223 sofort,
224 type_,
225 us_bank_account,
226 })
227 }
228 }
229
230 impl<'a> Map for Builder<'a> {
231 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
232 self.builder.key(k)
233 }
234
235 fn finish(&mut self) -> Result<()> {
236 *self.out = self.builder.take_out();
237 Ok(())
238 }
239 }
240
241 impl ObjectDeser for SetupAttemptPaymentMethodDetails {
242 type Builder = SetupAttemptPaymentMethodDetailsBuilder;
243 }
244
245 impl FromValueOpt for SetupAttemptPaymentMethodDetails {
246 fn from_value(v: Value) -> Option<Self> {
247 let Value::Object(obj) = v else {
248 return None;
249 };
250 let mut b = SetupAttemptPaymentMethodDetailsBuilder::deser_default();
251 for (k, v) in obj {
252 match k.as_str() {
253 "acss_debit" => b.acss_debit = FromValueOpt::from_value(v),
254 "amazon_pay" => b.amazon_pay = FromValueOpt::from_value(v),
255 "au_becs_debit" => b.au_becs_debit = FromValueOpt::from_value(v),
256 "bacs_debit" => b.bacs_debit = FromValueOpt::from_value(v),
257 "bancontact" => b.bancontact = FromValueOpt::from_value(v),
258 "boleto" => b.boleto = FromValueOpt::from_value(v),
259 "card" => b.card = FromValueOpt::from_value(v),
260 "card_present" => b.card_present = FromValueOpt::from_value(v),
261 "cashapp" => b.cashapp = FromValueOpt::from_value(v),
262 "ideal" => b.ideal = FromValueOpt::from_value(v),
263 "kakao_pay" => b.kakao_pay = FromValueOpt::from_value(v),
264 "klarna" => b.klarna = FromValueOpt::from_value(v),
265 "kr_card" => b.kr_card = FromValueOpt::from_value(v),
266 "link" => b.link = FromValueOpt::from_value(v),
267 "naver_pay" => b.naver_pay = FromValueOpt::from_value(v),
268 "nz_bank_account" => b.nz_bank_account = FromValueOpt::from_value(v),
269 "paypal" => b.paypal = FromValueOpt::from_value(v),
270 "revolut_pay" => b.revolut_pay = FromValueOpt::from_value(v),
271 "sepa_debit" => b.sepa_debit = FromValueOpt::from_value(v),
272 "sofort" => b.sofort = FromValueOpt::from_value(v),
273 "type" => b.type_ = FromValueOpt::from_value(v),
274 "us_bank_account" => b.us_bank_account = FromValueOpt::from_value(v),
275
276 _ => {}
277 }
278 }
279 b.take_out()
280 }
281 }
282};