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::{make_place, Deserialize, Result};
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
158 _ => <dyn Visitor>::ignore(),
159 })
160 }
161
162 fn deser_default() -> Self {
163 Self {
164 alipay_handle_redirect: Deserialize::default(),
165 boleto_display_details: Deserialize::default(),
166 card_await_notification: Deserialize::default(),
167 cashapp_handle_redirect_or_display_qr_code: Deserialize::default(),
168 display_bank_transfer_instructions: Deserialize::default(),
169 konbini_display_details: Deserialize::default(),
170 multibanco_display_details: Deserialize::default(),
171 oxxo_display_details: Deserialize::default(),
172 paynow_display_qr_code: Deserialize::default(),
173 pix_display_qr_code: Deserialize::default(),
174 promptpay_display_qr_code: Deserialize::default(),
175 redirect_to_url: Deserialize::default(),
176 swish_handle_redirect_or_display_qr_code: Deserialize::default(),
177 type_: Deserialize::default(),
178 use_stripe_sdk: Deserialize::default(),
179 verify_with_microdeposits: Deserialize::default(),
180 wechat_pay_display_qr_code: Deserialize::default(),
181 wechat_pay_redirect_to_android_app: Deserialize::default(),
182 wechat_pay_redirect_to_ios_app: Deserialize::default(),
183 }
184 }
185
186 fn take_out(&mut self) -> Option<Self::Out> {
187 let (
188 Some(alipay_handle_redirect),
189 Some(boleto_display_details),
190 Some(card_await_notification),
191 Some(cashapp_handle_redirect_or_display_qr_code),
192 Some(display_bank_transfer_instructions),
193 Some(konbini_display_details),
194 Some(multibanco_display_details),
195 Some(oxxo_display_details),
196 Some(paynow_display_qr_code),
197 Some(pix_display_qr_code),
198 Some(promptpay_display_qr_code),
199 Some(redirect_to_url),
200 Some(swish_handle_redirect_or_display_qr_code),
201 Some(type_),
202 Some(use_stripe_sdk),
203 Some(verify_with_microdeposits),
204 Some(wechat_pay_display_qr_code),
205 Some(wechat_pay_redirect_to_android_app),
206 Some(wechat_pay_redirect_to_ios_app),
207 ) = (
208 self.alipay_handle_redirect.take(),
209 self.boleto_display_details.take(),
210 self.card_await_notification,
211 self.cashapp_handle_redirect_or_display_qr_code.take(),
212 self.display_bank_transfer_instructions.take(),
213 self.konbini_display_details.take(),
214 self.multibanco_display_details.take(),
215 self.oxxo_display_details.take(),
216 self.paynow_display_qr_code.take(),
217 self.pix_display_qr_code.take(),
218 self.promptpay_display_qr_code.take(),
219 self.redirect_to_url.take(),
220 self.swish_handle_redirect_or_display_qr_code.take(),
221 self.type_.take(),
222 self.use_stripe_sdk.take(),
223 self.verify_with_microdeposits.take(),
224 self.wechat_pay_display_qr_code.take(),
225 self.wechat_pay_redirect_to_android_app.take(),
226 self.wechat_pay_redirect_to_ios_app.take(),
227 )
228 else {
229 return None;
230 };
231 Some(Self::Out {
232 alipay_handle_redirect,
233 boleto_display_details,
234 card_await_notification,
235 cashapp_handle_redirect_or_display_qr_code,
236 display_bank_transfer_instructions,
237 konbini_display_details,
238 multibanco_display_details,
239 oxxo_display_details,
240 paynow_display_qr_code,
241 pix_display_qr_code,
242 promptpay_display_qr_code,
243 redirect_to_url,
244 swish_handle_redirect_or_display_qr_code,
245 type_,
246 use_stripe_sdk,
247 verify_with_microdeposits,
248 wechat_pay_display_qr_code,
249 wechat_pay_redirect_to_android_app,
250 wechat_pay_redirect_to_ios_app,
251 })
252 }
253 }
254
255 impl Map for Builder<'_> {
256 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
257 self.builder.key(k)
258 }
259
260 fn finish(&mut self) -> Result<()> {
261 *self.out = self.builder.take_out();
262 Ok(())
263 }
264 }
265
266 impl ObjectDeser for PaymentIntentNextAction {
267 type Builder = PaymentIntentNextActionBuilder;
268 }
269
270 impl FromValueOpt for PaymentIntentNextAction {
271 fn from_value(v: Value) -> Option<Self> {
272 let Value::Object(obj) = v else {
273 return None;
274 };
275 let mut b = PaymentIntentNextActionBuilder::deser_default();
276 for (k, v) in obj {
277 match k.as_str() {
278 "alipay_handle_redirect" => {
279 b.alipay_handle_redirect = FromValueOpt::from_value(v)
280 }
281 "boleto_display_details" => {
282 b.boleto_display_details = FromValueOpt::from_value(v)
283 }
284 "card_await_notification" => {
285 b.card_await_notification = FromValueOpt::from_value(v)
286 }
287 "cashapp_handle_redirect_or_display_qr_code" => {
288 b.cashapp_handle_redirect_or_display_qr_code = FromValueOpt::from_value(v)
289 }
290 "display_bank_transfer_instructions" => {
291 b.display_bank_transfer_instructions = FromValueOpt::from_value(v)
292 }
293 "konbini_display_details" => {
294 b.konbini_display_details = FromValueOpt::from_value(v)
295 }
296 "multibanco_display_details" => {
297 b.multibanco_display_details = FromValueOpt::from_value(v)
298 }
299 "oxxo_display_details" => b.oxxo_display_details = FromValueOpt::from_value(v),
300 "paynow_display_qr_code" => {
301 b.paynow_display_qr_code = FromValueOpt::from_value(v)
302 }
303 "pix_display_qr_code" => b.pix_display_qr_code = FromValueOpt::from_value(v),
304 "promptpay_display_qr_code" => {
305 b.promptpay_display_qr_code = FromValueOpt::from_value(v)
306 }
307 "redirect_to_url" => b.redirect_to_url = FromValueOpt::from_value(v),
308 "swish_handle_redirect_or_display_qr_code" => {
309 b.swish_handle_redirect_or_display_qr_code = FromValueOpt::from_value(v)
310 }
311 "type" => b.type_ = FromValueOpt::from_value(v),
312 "use_stripe_sdk" => b.use_stripe_sdk = FromValueOpt::from_value(v),
313 "verify_with_microdeposits" => {
314 b.verify_with_microdeposits = FromValueOpt::from_value(v)
315 }
316 "wechat_pay_display_qr_code" => {
317 b.wechat_pay_display_qr_code = FromValueOpt::from_value(v)
318 }
319 "wechat_pay_redirect_to_android_app" => {
320 b.wechat_pay_redirect_to_android_app = FromValueOpt::from_value(v)
321 }
322 "wechat_pay_redirect_to_ios_app" => {
323 b.wechat_pay_redirect_to_ios_app = FromValueOpt::from_value(v)
324 }
325
326 _ => {}
327 }
328 }
329 b.take_out()
330 }
331 }
332};