1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct PaymentIntentNextAction {
5 pub alipay_handle_redirect: Option<stripe_shared::PaymentIntentNextActionAlipayHandleRedirect>,
6 pub boleto_display_details: Option<stripe_shared::PaymentIntentNextActionBoleto>,
7 pub card_await_notification:
8 Option<stripe_shared::PaymentIntentNextActionCardAwaitNotification>,
9 pub cashapp_handle_redirect_or_display_qr_code:
10 Option<stripe_shared::PaymentIntentNextActionCashappHandleRedirectOrDisplayQrCode>,
11 pub display_bank_transfer_instructions:
12 Option<stripe_shared::PaymentIntentNextActionDisplayBankTransferInstructions>,
13 pub konbini_display_details: Option<stripe_shared::PaymentIntentNextActionKonbini>,
14 pub multibanco_display_details:
15 Option<stripe_shared::PaymentIntentNextActionDisplayMultibancoDetails>,
16 pub oxxo_display_details: Option<stripe_shared::PaymentIntentNextActionDisplayOxxoDetails>,
17 pub paynow_display_qr_code: Option<stripe_shared::PaymentIntentNextActionPaynowDisplayQrCode>,
18 pub pix_display_qr_code: Option<stripe_shared::PaymentIntentNextActionPixDisplayQrCode>,
19 pub promptpay_display_qr_code:
20 Option<stripe_shared::PaymentIntentNextActionPromptpayDisplayQrCode>,
21 pub redirect_to_url: Option<stripe_shared::PaymentIntentNextActionRedirectToUrl>,
22 pub swish_handle_redirect_or_display_qr_code:
23 Option<stripe_shared::PaymentIntentNextActionSwishHandleRedirectOrDisplayQrCode>,
24 #[cfg_attr(any(feature = "deserialize", feature = "serialize"), serde(rename = "type"))]
28 pub type_: String,
29 #[cfg_attr(
32 any(feature = "deserialize", feature = "serialize"),
33 serde(with = "stripe_types::with_serde_json_opt")
34 )]
35 pub use_stripe_sdk: Option<miniserde::json::Value>,
36 pub verify_with_microdeposits:
37 Option<stripe_shared::PaymentIntentNextActionVerifyWithMicrodeposits>,
38 pub wechat_pay_display_qr_code:
39 Option<stripe_shared::PaymentIntentNextActionWechatPayDisplayQrCode>,
40 pub wechat_pay_redirect_to_android_app:
41 Option<stripe_shared::PaymentIntentNextActionWechatPayRedirectToAndroidApp>,
42 pub wechat_pay_redirect_to_ios_app:
43 Option<stripe_shared::PaymentIntentNextActionWechatPayRedirectToIosApp>,
44}
45#[doc(hidden)]
46pub struct PaymentIntentNextActionBuilder {
47 alipay_handle_redirect:
48 Option<Option<stripe_shared::PaymentIntentNextActionAlipayHandleRedirect>>,
49 boleto_display_details: Option<Option<stripe_shared::PaymentIntentNextActionBoleto>>,
50 card_await_notification:
51 Option<Option<stripe_shared::PaymentIntentNextActionCardAwaitNotification>>,
52 cashapp_handle_redirect_or_display_qr_code:
53 Option<Option<stripe_shared::PaymentIntentNextActionCashappHandleRedirectOrDisplayQrCode>>,
54 display_bank_transfer_instructions:
55 Option<Option<stripe_shared::PaymentIntentNextActionDisplayBankTransferInstructions>>,
56 konbini_display_details: Option<Option<stripe_shared::PaymentIntentNextActionKonbini>>,
57 multibanco_display_details:
58 Option<Option<stripe_shared::PaymentIntentNextActionDisplayMultibancoDetails>>,
59 oxxo_display_details: Option<Option<stripe_shared::PaymentIntentNextActionDisplayOxxoDetails>>,
60 paynow_display_qr_code:
61 Option<Option<stripe_shared::PaymentIntentNextActionPaynowDisplayQrCode>>,
62 pix_display_qr_code: Option<Option<stripe_shared::PaymentIntentNextActionPixDisplayQrCode>>,
63 promptpay_display_qr_code:
64 Option<Option<stripe_shared::PaymentIntentNextActionPromptpayDisplayQrCode>>,
65 redirect_to_url: Option<Option<stripe_shared::PaymentIntentNextActionRedirectToUrl>>,
66 swish_handle_redirect_or_display_qr_code:
67 Option<Option<stripe_shared::PaymentIntentNextActionSwishHandleRedirectOrDisplayQrCode>>,
68 type_: Option<String>,
69 use_stripe_sdk: Option<Option<miniserde::json::Value>>,
70 verify_with_microdeposits:
71 Option<Option<stripe_shared::PaymentIntentNextActionVerifyWithMicrodeposits>>,
72 wechat_pay_display_qr_code:
73 Option<Option<stripe_shared::PaymentIntentNextActionWechatPayDisplayQrCode>>,
74 wechat_pay_redirect_to_android_app:
75 Option<Option<stripe_shared::PaymentIntentNextActionWechatPayRedirectToAndroidApp>>,
76 wechat_pay_redirect_to_ios_app:
77 Option<Option<stripe_shared::PaymentIntentNextActionWechatPayRedirectToIosApp>>,
78}
79
80#[allow(
81 unused_variables,
82 irrefutable_let_patterns,
83 clippy::let_unit_value,
84 clippy::match_single_binding,
85 clippy::single_match
86)]
87const _: () = {
88 use miniserde::de::{Map, Visitor};
89 use miniserde::json::Value;
90 use miniserde::{Deserialize, Result, make_place};
91 use stripe_types::miniserde_helpers::FromValueOpt;
92 use stripe_types::{MapBuilder, ObjectDeser};
93
94 make_place!(Place);
95
96 impl Deserialize for PaymentIntentNextAction {
97 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
98 Place::new(out)
99 }
100 }
101
102 struct Builder<'a> {
103 out: &'a mut Option<PaymentIntentNextAction>,
104 builder: PaymentIntentNextActionBuilder,
105 }
106
107 impl Visitor for Place<PaymentIntentNextAction> {
108 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
109 Ok(Box::new(Builder {
110 out: &mut self.out,
111 builder: PaymentIntentNextActionBuilder::deser_default(),
112 }))
113 }
114 }
115
116 impl MapBuilder for PaymentIntentNextActionBuilder {
117 type Out = PaymentIntentNextAction;
118 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
119 Ok(match k {
120 "alipay_handle_redirect" => Deserialize::begin(&mut self.alipay_handle_redirect),
121 "boleto_display_details" => Deserialize::begin(&mut self.boleto_display_details),
122 "card_await_notification" => Deserialize::begin(&mut self.card_await_notification),
123 "cashapp_handle_redirect_or_display_qr_code" => {
124 Deserialize::begin(&mut self.cashapp_handle_redirect_or_display_qr_code)
125 }
126 "display_bank_transfer_instructions" => {
127 Deserialize::begin(&mut self.display_bank_transfer_instructions)
128 }
129 "konbini_display_details" => Deserialize::begin(&mut self.konbini_display_details),
130 "multibanco_display_details" => {
131 Deserialize::begin(&mut self.multibanco_display_details)
132 }
133 "oxxo_display_details" => Deserialize::begin(&mut self.oxxo_display_details),
134 "paynow_display_qr_code" => Deserialize::begin(&mut self.paynow_display_qr_code),
135 "pix_display_qr_code" => Deserialize::begin(&mut self.pix_display_qr_code),
136 "promptpay_display_qr_code" => {
137 Deserialize::begin(&mut self.promptpay_display_qr_code)
138 }
139 "redirect_to_url" => Deserialize::begin(&mut self.redirect_to_url),
140 "swish_handle_redirect_or_display_qr_code" => {
141 Deserialize::begin(&mut self.swish_handle_redirect_or_display_qr_code)
142 }
143 "type" => Deserialize::begin(&mut self.type_),
144 "use_stripe_sdk" => Deserialize::begin(&mut self.use_stripe_sdk),
145 "verify_with_microdeposits" => {
146 Deserialize::begin(&mut self.verify_with_microdeposits)
147 }
148 "wechat_pay_display_qr_code" => {
149 Deserialize::begin(&mut self.wechat_pay_display_qr_code)
150 }
151 "wechat_pay_redirect_to_android_app" => {
152 Deserialize::begin(&mut self.wechat_pay_redirect_to_android_app)
153 }
154 "wechat_pay_redirect_to_ios_app" => {
155 Deserialize::begin(&mut self.wechat_pay_redirect_to_ios_app)
156 }
157 _ => <dyn Visitor>::ignore(),
158 })
159 }
160
161 fn deser_default() -> Self {
162 Self {
163 alipay_handle_redirect: Deserialize::default(),
164 boleto_display_details: Deserialize::default(),
165 card_await_notification: Deserialize::default(),
166 cashapp_handle_redirect_or_display_qr_code: Deserialize::default(),
167 display_bank_transfer_instructions: Deserialize::default(),
168 konbini_display_details: Deserialize::default(),
169 multibanco_display_details: Deserialize::default(),
170 oxxo_display_details: Deserialize::default(),
171 paynow_display_qr_code: Deserialize::default(),
172 pix_display_qr_code: Deserialize::default(),
173 promptpay_display_qr_code: Deserialize::default(),
174 redirect_to_url: Deserialize::default(),
175 swish_handle_redirect_or_display_qr_code: Deserialize::default(),
176 type_: Deserialize::default(),
177 use_stripe_sdk: Deserialize::default(),
178 verify_with_microdeposits: Deserialize::default(),
179 wechat_pay_display_qr_code: Deserialize::default(),
180 wechat_pay_redirect_to_android_app: Deserialize::default(),
181 wechat_pay_redirect_to_ios_app: Deserialize::default(),
182 }
183 }
184
185 fn take_out(&mut self) -> Option<Self::Out> {
186 let (
187 Some(alipay_handle_redirect),
188 Some(boleto_display_details),
189 Some(card_await_notification),
190 Some(cashapp_handle_redirect_or_display_qr_code),
191 Some(display_bank_transfer_instructions),
192 Some(konbini_display_details),
193 Some(multibanco_display_details),
194 Some(oxxo_display_details),
195 Some(paynow_display_qr_code),
196 Some(pix_display_qr_code),
197 Some(promptpay_display_qr_code),
198 Some(redirect_to_url),
199 Some(swish_handle_redirect_or_display_qr_code),
200 Some(type_),
201 Some(use_stripe_sdk),
202 Some(verify_with_microdeposits),
203 Some(wechat_pay_display_qr_code),
204 Some(wechat_pay_redirect_to_android_app),
205 Some(wechat_pay_redirect_to_ios_app),
206 ) = (
207 self.alipay_handle_redirect.take(),
208 self.boleto_display_details.take(),
209 self.card_await_notification,
210 self.cashapp_handle_redirect_or_display_qr_code.take(),
211 self.display_bank_transfer_instructions.take(),
212 self.konbini_display_details.take(),
213 self.multibanco_display_details.take(),
214 self.oxxo_display_details.take(),
215 self.paynow_display_qr_code.take(),
216 self.pix_display_qr_code.take(),
217 self.promptpay_display_qr_code.take(),
218 self.redirect_to_url.take(),
219 self.swish_handle_redirect_or_display_qr_code.take(),
220 self.type_.take(),
221 self.use_stripe_sdk.take(),
222 self.verify_with_microdeposits.take(),
223 self.wechat_pay_display_qr_code.take(),
224 self.wechat_pay_redirect_to_android_app.take(),
225 self.wechat_pay_redirect_to_ios_app.take(),
226 )
227 else {
228 return None;
229 };
230 Some(Self::Out {
231 alipay_handle_redirect,
232 boleto_display_details,
233 card_await_notification,
234 cashapp_handle_redirect_or_display_qr_code,
235 display_bank_transfer_instructions,
236 konbini_display_details,
237 multibanco_display_details,
238 oxxo_display_details,
239 paynow_display_qr_code,
240 pix_display_qr_code,
241 promptpay_display_qr_code,
242 redirect_to_url,
243 swish_handle_redirect_or_display_qr_code,
244 type_,
245 use_stripe_sdk,
246 verify_with_microdeposits,
247 wechat_pay_display_qr_code,
248 wechat_pay_redirect_to_android_app,
249 wechat_pay_redirect_to_ios_app,
250 })
251 }
252 }
253
254 impl Map for Builder<'_> {
255 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
256 self.builder.key(k)
257 }
258
259 fn finish(&mut self) -> Result<()> {
260 *self.out = self.builder.take_out();
261 Ok(())
262 }
263 }
264
265 impl ObjectDeser for PaymentIntentNextAction {
266 type Builder = PaymentIntentNextActionBuilder;
267 }
268
269 impl FromValueOpt for PaymentIntentNextAction {
270 fn from_value(v: Value) -> Option<Self> {
271 let Value::Object(obj) = v else {
272 return None;
273 };
274 let mut b = PaymentIntentNextActionBuilder::deser_default();
275 for (k, v) in obj {
276 match k.as_str() {
277 "alipay_handle_redirect" => {
278 b.alipay_handle_redirect = FromValueOpt::from_value(v)
279 }
280 "boleto_display_details" => {
281 b.boleto_display_details = FromValueOpt::from_value(v)
282 }
283 "card_await_notification" => {
284 b.card_await_notification = FromValueOpt::from_value(v)
285 }
286 "cashapp_handle_redirect_or_display_qr_code" => {
287 b.cashapp_handle_redirect_or_display_qr_code = FromValueOpt::from_value(v)
288 }
289 "display_bank_transfer_instructions" => {
290 b.display_bank_transfer_instructions = FromValueOpt::from_value(v)
291 }
292 "konbini_display_details" => {
293 b.konbini_display_details = FromValueOpt::from_value(v)
294 }
295 "multibanco_display_details" => {
296 b.multibanco_display_details = FromValueOpt::from_value(v)
297 }
298 "oxxo_display_details" => b.oxxo_display_details = FromValueOpt::from_value(v),
299 "paynow_display_qr_code" => {
300 b.paynow_display_qr_code = FromValueOpt::from_value(v)
301 }
302 "pix_display_qr_code" => b.pix_display_qr_code = FromValueOpt::from_value(v),
303 "promptpay_display_qr_code" => {
304 b.promptpay_display_qr_code = FromValueOpt::from_value(v)
305 }
306 "redirect_to_url" => b.redirect_to_url = FromValueOpt::from_value(v),
307 "swish_handle_redirect_or_display_qr_code" => {
308 b.swish_handle_redirect_or_display_qr_code = FromValueOpt::from_value(v)
309 }
310 "type" => b.type_ = FromValueOpt::from_value(v),
311 "use_stripe_sdk" => b.use_stripe_sdk = FromValueOpt::from_value(v),
312 "verify_with_microdeposits" => {
313 b.verify_with_microdeposits = FromValueOpt::from_value(v)
314 }
315 "wechat_pay_display_qr_code" => {
316 b.wechat_pay_display_qr_code = FromValueOpt::from_value(v)
317 }
318 "wechat_pay_redirect_to_android_app" => {
319 b.wechat_pay_redirect_to_android_app = FromValueOpt::from_value(v)
320 }
321 "wechat_pay_redirect_to_ios_app" => {
322 b.wechat_pay_redirect_to_ios_app = FromValueOpt::from_value(v)
323 }
324 _ => {}
325 }
326 }
327 b.take_out()
328 }
329 }
330};