1#[derive(Clone)]
25#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
26#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
27pub struct SetupIntent {
28 pub allowed_payment_method_types:
31 Option<Vec<stripe_shared::SetupIntentAllowedPaymentMethodTypes>>,
32 pub application: Option<stripe_types::Expandable<stripe_shared::Application>>,
34 pub attach_to_self: Option<bool>,
39 pub automatic_payment_methods:
41 Option<stripe_shared::PaymentFlowsAutomaticPaymentMethodsSetupIntent>,
42 pub cancellation_reason: Option<stripe_shared::SetupIntentCancellationReason>,
44 pub client_secret: Option<String>,
50 pub created: stripe_types::Timestamp,
52 pub customer: Option<stripe_types::Expandable<stripe_shared::Customer>>,
57 pub customer_account: Option<String>,
62 pub description: Option<String>,
64 pub excluded_payment_method_types:
66 Option<Vec<stripe_shared::SetupIntentExcludedPaymentMethodTypes>>,
67 pub flow_directions: Option<Vec<stripe_shared::SetupIntentFlowDirections>>,
73 pub id: stripe_shared::SetupIntentId,
75 pub last_setup_error: Option<Box<stripe_shared::ApiErrors>>,
77 pub latest_attempt: Option<stripe_types::Expandable<stripe_shared::SetupAttempt>>,
79 pub livemode: bool,
82 pub managed_payments: Option<stripe_shared::SmorResourceManagedPayments>,
83 pub mandate: Option<stripe_types::Expandable<stripe_shared::Mandate>>,
85 pub metadata: Option<std::collections::HashMap<String, String>>,
88 pub next_action: Option<stripe_shared::SetupIntentNextAction>,
90 pub on_behalf_of: Option<stripe_types::Expandable<stripe_shared::Account>>,
92 pub payment_method: Option<stripe_types::Expandable<stripe_shared::PaymentMethod>>,
95 pub payment_method_configuration_details:
97 Option<stripe_shared::PaymentMethodConfigBizPaymentMethodConfigurationDetails>,
98 pub payment_method_options: Option<stripe_shared::SetupIntentPaymentMethodOptions>,
100 pub payment_method_types: Vec<String>,
104 pub single_use_mandate: Option<stripe_types::Expandable<stripe_shared::Mandate>>,
106 pub status: SetupIntentStatus,
108 pub usage: String,
114}
115#[cfg(feature = "redact-generated-debug")]
116impl std::fmt::Debug for SetupIntent {
117 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
118 f.debug_struct("SetupIntent").finish_non_exhaustive()
119 }
120}
121#[doc(hidden)]
122pub struct SetupIntentBuilder {
123 allowed_payment_method_types:
124 Option<Option<Vec<stripe_shared::SetupIntentAllowedPaymentMethodTypes>>>,
125 application: Option<Option<stripe_types::Expandable<stripe_shared::Application>>>,
126 attach_to_self: Option<Option<bool>>,
127 automatic_payment_methods:
128 Option<Option<stripe_shared::PaymentFlowsAutomaticPaymentMethodsSetupIntent>>,
129 cancellation_reason: Option<Option<stripe_shared::SetupIntentCancellationReason>>,
130 client_secret: Option<Option<String>>,
131 created: Option<stripe_types::Timestamp>,
132 customer: Option<Option<stripe_types::Expandable<stripe_shared::Customer>>>,
133 customer_account: Option<Option<String>>,
134 description: Option<Option<String>>,
135 excluded_payment_method_types:
136 Option<Option<Vec<stripe_shared::SetupIntentExcludedPaymentMethodTypes>>>,
137 flow_directions: Option<Option<Vec<stripe_shared::SetupIntentFlowDirections>>>,
138 id: Option<stripe_shared::SetupIntentId>,
139 last_setup_error: Option<Option<Box<stripe_shared::ApiErrors>>>,
140 latest_attempt: Option<Option<stripe_types::Expandable<stripe_shared::SetupAttempt>>>,
141 livemode: Option<bool>,
142 managed_payments: Option<Option<stripe_shared::SmorResourceManagedPayments>>,
143 mandate: Option<Option<stripe_types::Expandable<stripe_shared::Mandate>>>,
144 metadata: Option<Option<std::collections::HashMap<String, String>>>,
145 next_action: Option<Option<stripe_shared::SetupIntentNextAction>>,
146 on_behalf_of: Option<Option<stripe_types::Expandable<stripe_shared::Account>>>,
147 payment_method: Option<Option<stripe_types::Expandable<stripe_shared::PaymentMethod>>>,
148 payment_method_configuration_details:
149 Option<Option<stripe_shared::PaymentMethodConfigBizPaymentMethodConfigurationDetails>>,
150 payment_method_options: Option<Option<stripe_shared::SetupIntentPaymentMethodOptions>>,
151 payment_method_types: Option<Vec<String>>,
152 single_use_mandate: Option<Option<stripe_types::Expandable<stripe_shared::Mandate>>>,
153 status: Option<SetupIntentStatus>,
154 usage: Option<String>,
155}
156
157#[allow(
158 unused_variables,
159 irrefutable_let_patterns,
160 clippy::let_unit_value,
161 clippy::match_single_binding,
162 clippy::single_match
163)]
164const _: () = {
165 use miniserde::de::{Map, Visitor};
166 use miniserde::json::Value;
167 use miniserde::{Deserialize, Result, make_place};
168 use stripe_types::miniserde_helpers::FromValueOpt;
169 use stripe_types::{MapBuilder, ObjectDeser};
170
171 make_place!(Place);
172
173 impl Deserialize for SetupIntent {
174 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
175 Place::new(out)
176 }
177 }
178
179 struct Builder<'a> {
180 out: &'a mut Option<SetupIntent>,
181 builder: SetupIntentBuilder,
182 }
183
184 impl Visitor for Place<SetupIntent> {
185 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
186 Ok(Box::new(Builder {
187 out: &mut self.out,
188 builder: SetupIntentBuilder::deser_default(),
189 }))
190 }
191 }
192
193 impl MapBuilder for SetupIntentBuilder {
194 type Out = SetupIntent;
195 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
196 Ok(match k {
197 "allowed_payment_method_types" => {
198 Deserialize::begin(&mut self.allowed_payment_method_types)
199 }
200 "application" => Deserialize::begin(&mut self.application),
201 "attach_to_self" => Deserialize::begin(&mut self.attach_to_self),
202 "automatic_payment_methods" => {
203 Deserialize::begin(&mut self.automatic_payment_methods)
204 }
205 "cancellation_reason" => Deserialize::begin(&mut self.cancellation_reason),
206 "client_secret" => Deserialize::begin(&mut self.client_secret),
207 "created" => Deserialize::begin(&mut self.created),
208 "customer" => Deserialize::begin(&mut self.customer),
209 "customer_account" => Deserialize::begin(&mut self.customer_account),
210 "description" => Deserialize::begin(&mut self.description),
211 "excluded_payment_method_types" => {
212 Deserialize::begin(&mut self.excluded_payment_method_types)
213 }
214 "flow_directions" => Deserialize::begin(&mut self.flow_directions),
215 "id" => Deserialize::begin(&mut self.id),
216 "last_setup_error" => Deserialize::begin(&mut self.last_setup_error),
217 "latest_attempt" => Deserialize::begin(&mut self.latest_attempt),
218 "livemode" => Deserialize::begin(&mut self.livemode),
219 "managed_payments" => Deserialize::begin(&mut self.managed_payments),
220 "mandate" => Deserialize::begin(&mut self.mandate),
221 "metadata" => Deserialize::begin(&mut self.metadata),
222 "next_action" => Deserialize::begin(&mut self.next_action),
223 "on_behalf_of" => Deserialize::begin(&mut self.on_behalf_of),
224 "payment_method" => Deserialize::begin(&mut self.payment_method),
225 "payment_method_configuration_details" => {
226 Deserialize::begin(&mut self.payment_method_configuration_details)
227 }
228 "payment_method_options" => Deserialize::begin(&mut self.payment_method_options),
229 "payment_method_types" => Deserialize::begin(&mut self.payment_method_types),
230 "single_use_mandate" => Deserialize::begin(&mut self.single_use_mandate),
231 "status" => Deserialize::begin(&mut self.status),
232 "usage" => Deserialize::begin(&mut self.usage),
233 _ => <dyn Visitor>::ignore(),
234 })
235 }
236
237 fn deser_default() -> Self {
238 Self {
239 allowed_payment_method_types: Some(None),
240 application: Some(None),
241 attach_to_self: Some(None),
242 automatic_payment_methods: Some(None),
243 cancellation_reason: Some(None),
244 client_secret: Some(None),
245 created: None,
246 customer: Some(None),
247 customer_account: Some(None),
248 description: Some(None),
249 excluded_payment_method_types: Some(None),
250 flow_directions: Some(None),
251 id: None,
252 last_setup_error: Some(None),
253 latest_attempt: Some(None),
254 livemode: None,
255 managed_payments: Some(None),
256 mandate: Some(None),
257 metadata: Some(None),
258 next_action: Some(None),
259 on_behalf_of: Some(None),
260 payment_method: Some(None),
261 payment_method_configuration_details: Some(None),
262 payment_method_options: Some(None),
263 payment_method_types: None,
264 single_use_mandate: Some(None),
265 status: None,
266 usage: None,
267 }
268 }
269
270 fn take_out(&mut self) -> Option<Self::Out> {
271 let (
272 Some(allowed_payment_method_types),
273 Some(application),
274 Some(attach_to_self),
275 Some(automatic_payment_methods),
276 Some(cancellation_reason),
277 Some(client_secret),
278 Some(created),
279 Some(customer),
280 Some(customer_account),
281 Some(description),
282 Some(excluded_payment_method_types),
283 Some(flow_directions),
284 Some(id),
285 Some(last_setup_error),
286 Some(latest_attempt),
287 Some(livemode),
288 Some(managed_payments),
289 Some(mandate),
290 Some(metadata),
291 Some(next_action),
292 Some(on_behalf_of),
293 Some(payment_method),
294 Some(payment_method_configuration_details),
295 Some(payment_method_options),
296 Some(payment_method_types),
297 Some(single_use_mandate),
298 Some(status),
299 Some(usage),
300 ) = (
301 self.allowed_payment_method_types.take(),
302 self.application.take(),
303 self.attach_to_self,
304 self.automatic_payment_methods.take(),
305 self.cancellation_reason.take(),
306 self.client_secret.take(),
307 self.created,
308 self.customer.take(),
309 self.customer_account.take(),
310 self.description.take(),
311 self.excluded_payment_method_types.take(),
312 self.flow_directions.take(),
313 self.id.take(),
314 self.last_setup_error.take(),
315 self.latest_attempt.take(),
316 self.livemode,
317 self.managed_payments,
318 self.mandate.take(),
319 self.metadata.take(),
320 self.next_action.take(),
321 self.on_behalf_of.take(),
322 self.payment_method.take(),
323 self.payment_method_configuration_details.take(),
324 self.payment_method_options.take(),
325 self.payment_method_types.take(),
326 self.single_use_mandate.take(),
327 self.status.take(),
328 self.usage.take(),
329 )
330 else {
331 return None;
332 };
333 Some(Self::Out {
334 allowed_payment_method_types,
335 application,
336 attach_to_self,
337 automatic_payment_methods,
338 cancellation_reason,
339 client_secret,
340 created,
341 customer,
342 customer_account,
343 description,
344 excluded_payment_method_types,
345 flow_directions,
346 id,
347 last_setup_error,
348 latest_attempt,
349 livemode,
350 managed_payments,
351 mandate,
352 metadata,
353 next_action,
354 on_behalf_of,
355 payment_method,
356 payment_method_configuration_details,
357 payment_method_options,
358 payment_method_types,
359 single_use_mandate,
360 status,
361 usage,
362 })
363 }
364 }
365
366 impl Map for Builder<'_> {
367 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
368 self.builder.key(k)
369 }
370
371 fn finish(&mut self) -> Result<()> {
372 *self.out = self.builder.take_out();
373 Ok(())
374 }
375 }
376
377 impl ObjectDeser for SetupIntent {
378 type Builder = SetupIntentBuilder;
379 }
380
381 impl FromValueOpt for SetupIntent {
382 fn from_value(v: Value) -> Option<Self> {
383 let Value::Object(obj) = v else {
384 return None;
385 };
386 let mut b = SetupIntentBuilder::deser_default();
387 for (k, v) in obj {
388 match k.as_str() {
389 "allowed_payment_method_types" => {
390 b.allowed_payment_method_types = FromValueOpt::from_value(v)
391 }
392 "application" => b.application = FromValueOpt::from_value(v),
393 "attach_to_self" => b.attach_to_self = FromValueOpt::from_value(v),
394 "automatic_payment_methods" => {
395 b.automatic_payment_methods = FromValueOpt::from_value(v)
396 }
397 "cancellation_reason" => b.cancellation_reason = FromValueOpt::from_value(v),
398 "client_secret" => b.client_secret = FromValueOpt::from_value(v),
399 "created" => b.created = FromValueOpt::from_value(v),
400 "customer" => b.customer = FromValueOpt::from_value(v),
401 "customer_account" => b.customer_account = FromValueOpt::from_value(v),
402 "description" => b.description = FromValueOpt::from_value(v),
403 "excluded_payment_method_types" => {
404 b.excluded_payment_method_types = FromValueOpt::from_value(v)
405 }
406 "flow_directions" => b.flow_directions = FromValueOpt::from_value(v),
407 "id" => b.id = FromValueOpt::from_value(v),
408 "last_setup_error" => b.last_setup_error = FromValueOpt::from_value(v),
409 "latest_attempt" => b.latest_attempt = FromValueOpt::from_value(v),
410 "livemode" => b.livemode = FromValueOpt::from_value(v),
411 "managed_payments" => b.managed_payments = FromValueOpt::from_value(v),
412 "mandate" => b.mandate = FromValueOpt::from_value(v),
413 "metadata" => b.metadata = FromValueOpt::from_value(v),
414 "next_action" => b.next_action = FromValueOpt::from_value(v),
415 "on_behalf_of" => b.on_behalf_of = FromValueOpt::from_value(v),
416 "payment_method" => b.payment_method = FromValueOpt::from_value(v),
417 "payment_method_configuration_details" => {
418 b.payment_method_configuration_details = FromValueOpt::from_value(v)
419 }
420 "payment_method_options" => {
421 b.payment_method_options = FromValueOpt::from_value(v)
422 }
423 "payment_method_types" => b.payment_method_types = FromValueOpt::from_value(v),
424 "single_use_mandate" => b.single_use_mandate = FromValueOpt::from_value(v),
425 "status" => b.status = FromValueOpt::from_value(v),
426 "usage" => b.usage = FromValueOpt::from_value(v),
427 _ => {}
428 }
429 }
430 b.take_out()
431 }
432 }
433};
434#[cfg(feature = "serialize")]
435impl serde::Serialize for SetupIntent {
436 fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
437 use serde::ser::SerializeStruct;
438 let mut s = s.serialize_struct("SetupIntent", 29)?;
439 s.serialize_field("allowed_payment_method_types", &self.allowed_payment_method_types)?;
440 s.serialize_field("application", &self.application)?;
441 s.serialize_field("attach_to_self", &self.attach_to_self)?;
442 s.serialize_field("automatic_payment_methods", &self.automatic_payment_methods)?;
443 s.serialize_field("cancellation_reason", &self.cancellation_reason)?;
444 s.serialize_field("client_secret", &self.client_secret)?;
445 s.serialize_field("created", &self.created)?;
446 s.serialize_field("customer", &self.customer)?;
447 s.serialize_field("customer_account", &self.customer_account)?;
448 s.serialize_field("description", &self.description)?;
449 s.serialize_field("excluded_payment_method_types", &self.excluded_payment_method_types)?;
450 s.serialize_field("flow_directions", &self.flow_directions)?;
451 s.serialize_field("id", &self.id)?;
452 s.serialize_field("last_setup_error", &self.last_setup_error)?;
453 s.serialize_field("latest_attempt", &self.latest_attempt)?;
454 s.serialize_field("livemode", &self.livemode)?;
455 s.serialize_field("managed_payments", &self.managed_payments)?;
456 s.serialize_field("mandate", &self.mandate)?;
457 s.serialize_field("metadata", &self.metadata)?;
458 s.serialize_field("next_action", &self.next_action)?;
459 s.serialize_field("on_behalf_of", &self.on_behalf_of)?;
460 s.serialize_field("payment_method", &self.payment_method)?;
461 s.serialize_field(
462 "payment_method_configuration_details",
463 &self.payment_method_configuration_details,
464 )?;
465 s.serialize_field("payment_method_options", &self.payment_method_options)?;
466 s.serialize_field("payment_method_types", &self.payment_method_types)?;
467 s.serialize_field("single_use_mandate", &self.single_use_mandate)?;
468 s.serialize_field("status", &self.status)?;
469 s.serialize_field("usage", &self.usage)?;
470
471 s.serialize_field("object", "setup_intent")?;
472 s.end()
473 }
474}
475#[derive(Clone, Eq, PartialEq)]
477#[non_exhaustive]
478pub enum SetupIntentStatus {
479 Canceled,
480 Processing,
481 RequiresAction,
482 RequiresConfirmation,
483 RequiresPaymentMethod,
484 Succeeded,
485 Unknown(String),
487}
488impl SetupIntentStatus {
489 pub fn as_str(&self) -> &str {
490 use SetupIntentStatus::*;
491 match self {
492 Canceled => "canceled",
493 Processing => "processing",
494 RequiresAction => "requires_action",
495 RequiresConfirmation => "requires_confirmation",
496 RequiresPaymentMethod => "requires_payment_method",
497 Succeeded => "succeeded",
498 Unknown(v) => v,
499 }
500 }
501}
502
503impl std::str::FromStr for SetupIntentStatus {
504 type Err = std::convert::Infallible;
505 fn from_str(s: &str) -> Result<Self, Self::Err> {
506 use SetupIntentStatus::*;
507 match s {
508 "canceled" => Ok(Canceled),
509 "processing" => Ok(Processing),
510 "requires_action" => Ok(RequiresAction),
511 "requires_confirmation" => Ok(RequiresConfirmation),
512 "requires_payment_method" => Ok(RequiresPaymentMethod),
513 "succeeded" => Ok(Succeeded),
514 v => {
515 tracing::warn!("Unknown value '{}' for enum '{}'", v, "SetupIntentStatus");
516 Ok(Unknown(v.to_owned()))
517 }
518 }
519 }
520}
521impl std::fmt::Display for SetupIntentStatus {
522 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
523 f.write_str(self.as_str())
524 }
525}
526
527#[cfg(not(feature = "redact-generated-debug"))]
528impl std::fmt::Debug for SetupIntentStatus {
529 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
530 f.write_str(self.as_str())
531 }
532}
533#[cfg(feature = "redact-generated-debug")]
534impl std::fmt::Debug for SetupIntentStatus {
535 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
536 f.debug_struct(stringify!(SetupIntentStatus)).finish_non_exhaustive()
537 }
538}
539#[cfg(feature = "serialize")]
540impl serde::Serialize for SetupIntentStatus {
541 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
542 where
543 S: serde::Serializer,
544 {
545 serializer.serialize_str(self.as_str())
546 }
547}
548impl miniserde::Deserialize for SetupIntentStatus {
549 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
550 crate::Place::new(out)
551 }
552}
553
554impl miniserde::de::Visitor for crate::Place<SetupIntentStatus> {
555 fn string(&mut self, s: &str) -> miniserde::Result<()> {
556 use std::str::FromStr;
557 self.out = Some(SetupIntentStatus::from_str(s).expect("infallible"));
558 Ok(())
559 }
560}
561
562stripe_types::impl_from_val_with_from_str!(SetupIntentStatus);
563#[cfg(feature = "deserialize")]
564impl<'de> serde::Deserialize<'de> for SetupIntentStatus {
565 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
566 use std::str::FromStr;
567 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
568 Ok(Self::from_str(&s).expect("infallible"))
569 }
570}
571impl stripe_types::Object for SetupIntent {
572 type Id = stripe_shared::SetupIntentId;
573 fn id(&self) -> &Self::Id {
574 &self.id
575 }
576
577 fn into_id(self) -> Self::Id {
578 self.id
579 }
580}
581stripe_types::def_id!(SetupIntentId);
582#[derive(Clone, Eq, PartialEq)]
583#[non_exhaustive]
584pub enum SetupIntentAllowedPaymentMethodTypes {
585 AcssDebit,
586 Affirm,
587 AfterpayClearpay,
588 Alipay,
589 Alma,
590 AmazonPay,
591 AuBecsDebit,
592 BacsDebit,
593 Bancontact,
594 Billie,
595 Bizum,
596 Blik,
597 BokuPromptpay,
598 Boleto,
599 CapchasePay,
600 Card,
601 Cashapp,
602 CheckScan,
603 ClickToPay,
604 Crypto,
605 CustomerBalance,
606 DemoPay,
607 Duitnow,
608 DummyAuthPush,
609 DummyPassthroughCard,
610 Edenred,
611 Eps,
612 Fpx,
613 Gcash,
614 Getbalance,
615 GiftCard,
616 Giropay,
617 Gopay,
618 Grabpay,
619 IdBankTransfer,
620 Ideal,
621 KakaoPay,
622 Klarna,
623 Knet,
624 Konbini,
625 KrCard,
626 KrMarket,
627 Kriya,
628 Link,
629 MbWay,
630 Mobilepay,
631 Momo,
632 Mondu,
633 Multibanco,
634 NaverPay,
635 Netbanking,
636 NgBank,
637 NgBankTransfer,
638 NgCard,
639 NgMarket,
640 NgUssd,
641 NgWallet,
642 NzBankAccount,
643 Octopus,
644 Oxxo,
645 P24,
646 PaperCheck,
647 PayByBank,
648 Payco,
649 Paynow,
650 Paypal,
651 Paypay,
652 Payto,
653 Pix,
654 Promptpay,
655 Qris,
656 Rechnung,
657 RevolutPay,
658 SamsungPay,
659 Satispay,
660 Scalapay,
661 SepaDebit,
662 Sequra,
663 ShopPay,
664 Shopeepay,
665 Sofort,
666 SouthKoreaMarket,
667 StripeBalance,
668 Sunbit,
669 Swish,
670 Tamara,
671 TestPay,
672 Truemoney,
673 Twint,
674 Upi,
675 UsBankAccount,
676 UsCashVoucher,
677 Vipps,
678 WechatPay,
679 Wero,
680 Zip,
681 Unknown(String),
683}
684impl SetupIntentAllowedPaymentMethodTypes {
685 pub fn as_str(&self) -> &str {
686 use SetupIntentAllowedPaymentMethodTypes::*;
687 match self {
688 AcssDebit => "acss_debit",
689 Affirm => "affirm",
690 AfterpayClearpay => "afterpay_clearpay",
691 Alipay => "alipay",
692 Alma => "alma",
693 AmazonPay => "amazon_pay",
694 AuBecsDebit => "au_becs_debit",
695 BacsDebit => "bacs_debit",
696 Bancontact => "bancontact",
697 Billie => "billie",
698 Bizum => "bizum",
699 Blik => "blik",
700 BokuPromptpay => "boku_promptpay",
701 Boleto => "boleto",
702 CapchasePay => "capchase_pay",
703 Card => "card",
704 Cashapp => "cashapp",
705 CheckScan => "check_scan",
706 ClickToPay => "click_to_pay",
707 Crypto => "crypto",
708 CustomerBalance => "customer_balance",
709 DemoPay => "demo_pay",
710 Duitnow => "duitnow",
711 DummyAuthPush => "dummy_auth_push",
712 DummyPassthroughCard => "dummy_passthrough_card",
713 Edenred => "edenred",
714 Eps => "eps",
715 Fpx => "fpx",
716 Gcash => "gcash",
717 Getbalance => "getbalance",
718 GiftCard => "gift_card",
719 Giropay => "giropay",
720 Gopay => "gopay",
721 Grabpay => "grabpay",
722 IdBankTransfer => "id_bank_transfer",
723 Ideal => "ideal",
724 KakaoPay => "kakao_pay",
725 Klarna => "klarna",
726 Knet => "knet",
727 Konbini => "konbini",
728 KrCard => "kr_card",
729 KrMarket => "kr_market",
730 Kriya => "kriya",
731 Link => "link",
732 MbWay => "mb_way",
733 Mobilepay => "mobilepay",
734 Momo => "momo",
735 Mondu => "mondu",
736 Multibanco => "multibanco",
737 NaverPay => "naver_pay",
738 Netbanking => "netbanking",
739 NgBank => "ng_bank",
740 NgBankTransfer => "ng_bank_transfer",
741 NgCard => "ng_card",
742 NgMarket => "ng_market",
743 NgUssd => "ng_ussd",
744 NgWallet => "ng_wallet",
745 NzBankAccount => "nz_bank_account",
746 Octopus => "octopus",
747 Oxxo => "oxxo",
748 P24 => "p24",
749 PaperCheck => "paper_check",
750 PayByBank => "pay_by_bank",
751 Payco => "payco",
752 Paynow => "paynow",
753 Paypal => "paypal",
754 Paypay => "paypay",
755 Payto => "payto",
756 Pix => "pix",
757 Promptpay => "promptpay",
758 Qris => "qris",
759 Rechnung => "rechnung",
760 RevolutPay => "revolut_pay",
761 SamsungPay => "samsung_pay",
762 Satispay => "satispay",
763 Scalapay => "scalapay",
764 SepaDebit => "sepa_debit",
765 Sequra => "sequra",
766 ShopPay => "shop_pay",
767 Shopeepay => "shopeepay",
768 Sofort => "sofort",
769 SouthKoreaMarket => "south_korea_market",
770 StripeBalance => "stripe_balance",
771 Sunbit => "sunbit",
772 Swish => "swish",
773 Tamara => "tamara",
774 TestPay => "test_pay",
775 Truemoney => "truemoney",
776 Twint => "twint",
777 Upi => "upi",
778 UsBankAccount => "us_bank_account",
779 UsCashVoucher => "us_cash_voucher",
780 Vipps => "vipps",
781 WechatPay => "wechat_pay",
782 Wero => "wero",
783 Zip => "zip",
784 Unknown(v) => v,
785 }
786 }
787}
788
789impl std::str::FromStr for SetupIntentAllowedPaymentMethodTypes {
790 type Err = std::convert::Infallible;
791 fn from_str(s: &str) -> Result<Self, Self::Err> {
792 use SetupIntentAllowedPaymentMethodTypes::*;
793 match s {
794 "acss_debit" => Ok(AcssDebit),
795 "affirm" => Ok(Affirm),
796 "afterpay_clearpay" => Ok(AfterpayClearpay),
797 "alipay" => Ok(Alipay),
798 "alma" => Ok(Alma),
799 "amazon_pay" => Ok(AmazonPay),
800 "au_becs_debit" => Ok(AuBecsDebit),
801 "bacs_debit" => Ok(BacsDebit),
802 "bancontact" => Ok(Bancontact),
803 "billie" => Ok(Billie),
804 "bizum" => Ok(Bizum),
805 "blik" => Ok(Blik),
806 "boku_promptpay" => Ok(BokuPromptpay),
807 "boleto" => Ok(Boleto),
808 "capchase_pay" => Ok(CapchasePay),
809 "card" => Ok(Card),
810 "cashapp" => Ok(Cashapp),
811 "check_scan" => Ok(CheckScan),
812 "click_to_pay" => Ok(ClickToPay),
813 "crypto" => Ok(Crypto),
814 "customer_balance" => Ok(CustomerBalance),
815 "demo_pay" => Ok(DemoPay),
816 "duitnow" => Ok(Duitnow),
817 "dummy_auth_push" => Ok(DummyAuthPush),
818 "dummy_passthrough_card" => Ok(DummyPassthroughCard),
819 "edenred" => Ok(Edenred),
820 "eps" => Ok(Eps),
821 "fpx" => Ok(Fpx),
822 "gcash" => Ok(Gcash),
823 "getbalance" => Ok(Getbalance),
824 "gift_card" => Ok(GiftCard),
825 "giropay" => Ok(Giropay),
826 "gopay" => Ok(Gopay),
827 "grabpay" => Ok(Grabpay),
828 "id_bank_transfer" => Ok(IdBankTransfer),
829 "ideal" => Ok(Ideal),
830 "kakao_pay" => Ok(KakaoPay),
831 "klarna" => Ok(Klarna),
832 "knet" => Ok(Knet),
833 "konbini" => Ok(Konbini),
834 "kr_card" => Ok(KrCard),
835 "kr_market" => Ok(KrMarket),
836 "kriya" => Ok(Kriya),
837 "link" => Ok(Link),
838 "mb_way" => Ok(MbWay),
839 "mobilepay" => Ok(Mobilepay),
840 "momo" => Ok(Momo),
841 "mondu" => Ok(Mondu),
842 "multibanco" => Ok(Multibanco),
843 "naver_pay" => Ok(NaverPay),
844 "netbanking" => Ok(Netbanking),
845 "ng_bank" => Ok(NgBank),
846 "ng_bank_transfer" => Ok(NgBankTransfer),
847 "ng_card" => Ok(NgCard),
848 "ng_market" => Ok(NgMarket),
849 "ng_ussd" => Ok(NgUssd),
850 "ng_wallet" => Ok(NgWallet),
851 "nz_bank_account" => Ok(NzBankAccount),
852 "octopus" => Ok(Octopus),
853 "oxxo" => Ok(Oxxo),
854 "p24" => Ok(P24),
855 "paper_check" => Ok(PaperCheck),
856 "pay_by_bank" => Ok(PayByBank),
857 "payco" => Ok(Payco),
858 "paynow" => Ok(Paynow),
859 "paypal" => Ok(Paypal),
860 "paypay" => Ok(Paypay),
861 "payto" => Ok(Payto),
862 "pix" => Ok(Pix),
863 "promptpay" => Ok(Promptpay),
864 "qris" => Ok(Qris),
865 "rechnung" => Ok(Rechnung),
866 "revolut_pay" => Ok(RevolutPay),
867 "samsung_pay" => Ok(SamsungPay),
868 "satispay" => Ok(Satispay),
869 "scalapay" => Ok(Scalapay),
870 "sepa_debit" => Ok(SepaDebit),
871 "sequra" => Ok(Sequra),
872 "shop_pay" => Ok(ShopPay),
873 "shopeepay" => Ok(Shopeepay),
874 "sofort" => Ok(Sofort),
875 "south_korea_market" => Ok(SouthKoreaMarket),
876 "stripe_balance" => Ok(StripeBalance),
877 "sunbit" => Ok(Sunbit),
878 "swish" => Ok(Swish),
879 "tamara" => Ok(Tamara),
880 "test_pay" => Ok(TestPay),
881 "truemoney" => Ok(Truemoney),
882 "twint" => Ok(Twint),
883 "upi" => Ok(Upi),
884 "us_bank_account" => Ok(UsBankAccount),
885 "us_cash_voucher" => Ok(UsCashVoucher),
886 "vipps" => Ok(Vipps),
887 "wechat_pay" => Ok(WechatPay),
888 "wero" => Ok(Wero),
889 "zip" => Ok(Zip),
890 v => {
891 tracing::warn!(
892 "Unknown value '{}' for enum '{}'",
893 v,
894 "SetupIntentAllowedPaymentMethodTypes"
895 );
896 Ok(Unknown(v.to_owned()))
897 }
898 }
899 }
900}
901impl std::fmt::Display for SetupIntentAllowedPaymentMethodTypes {
902 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
903 f.write_str(self.as_str())
904 }
905}
906
907#[cfg(not(feature = "redact-generated-debug"))]
908impl std::fmt::Debug for SetupIntentAllowedPaymentMethodTypes {
909 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
910 f.write_str(self.as_str())
911 }
912}
913#[cfg(feature = "redact-generated-debug")]
914impl std::fmt::Debug for SetupIntentAllowedPaymentMethodTypes {
915 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
916 f.debug_struct(stringify!(SetupIntentAllowedPaymentMethodTypes)).finish_non_exhaustive()
917 }
918}
919impl serde::Serialize for SetupIntentAllowedPaymentMethodTypes {
920 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
921 where
922 S: serde::Serializer,
923 {
924 serializer.serialize_str(self.as_str())
925 }
926}
927impl miniserde::Deserialize for SetupIntentAllowedPaymentMethodTypes {
928 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
929 crate::Place::new(out)
930 }
931}
932
933impl miniserde::de::Visitor for crate::Place<SetupIntentAllowedPaymentMethodTypes> {
934 fn string(&mut self, s: &str) -> miniserde::Result<()> {
935 use std::str::FromStr;
936 self.out = Some(SetupIntentAllowedPaymentMethodTypes::from_str(s).expect("infallible"));
937 Ok(())
938 }
939}
940
941stripe_types::impl_from_val_with_from_str!(SetupIntentAllowedPaymentMethodTypes);
942#[cfg(feature = "deserialize")]
943impl<'de> serde::Deserialize<'de> for SetupIntentAllowedPaymentMethodTypes {
944 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
945 use std::str::FromStr;
946 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
947 Ok(Self::from_str(&s).expect("infallible"))
948 }
949}
950#[derive(Clone, Eq, PartialEq)]
951#[non_exhaustive]
952pub enum SetupIntentCancellationReason {
953 Abandoned,
954 Duplicate,
955 RequestedByCustomer,
956 Unknown(String),
958}
959impl SetupIntentCancellationReason {
960 pub fn as_str(&self) -> &str {
961 use SetupIntentCancellationReason::*;
962 match self {
963 Abandoned => "abandoned",
964 Duplicate => "duplicate",
965 RequestedByCustomer => "requested_by_customer",
966 Unknown(v) => v,
967 }
968 }
969}
970
971impl std::str::FromStr for SetupIntentCancellationReason {
972 type Err = std::convert::Infallible;
973 fn from_str(s: &str) -> Result<Self, Self::Err> {
974 use SetupIntentCancellationReason::*;
975 match s {
976 "abandoned" => Ok(Abandoned),
977 "duplicate" => Ok(Duplicate),
978 "requested_by_customer" => Ok(RequestedByCustomer),
979 v => {
980 tracing::warn!(
981 "Unknown value '{}' for enum '{}'",
982 v,
983 "SetupIntentCancellationReason"
984 );
985 Ok(Unknown(v.to_owned()))
986 }
987 }
988 }
989}
990impl std::fmt::Display for SetupIntentCancellationReason {
991 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
992 f.write_str(self.as_str())
993 }
994}
995
996#[cfg(not(feature = "redact-generated-debug"))]
997impl std::fmt::Debug for SetupIntentCancellationReason {
998 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
999 f.write_str(self.as_str())
1000 }
1001}
1002#[cfg(feature = "redact-generated-debug")]
1003impl std::fmt::Debug for SetupIntentCancellationReason {
1004 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1005 f.debug_struct(stringify!(SetupIntentCancellationReason)).finish_non_exhaustive()
1006 }
1007}
1008impl serde::Serialize for SetupIntentCancellationReason {
1009 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1010 where
1011 S: serde::Serializer,
1012 {
1013 serializer.serialize_str(self.as_str())
1014 }
1015}
1016impl miniserde::Deserialize for SetupIntentCancellationReason {
1017 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1018 crate::Place::new(out)
1019 }
1020}
1021
1022impl miniserde::de::Visitor for crate::Place<SetupIntentCancellationReason> {
1023 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1024 use std::str::FromStr;
1025 self.out = Some(SetupIntentCancellationReason::from_str(s).expect("infallible"));
1026 Ok(())
1027 }
1028}
1029
1030stripe_types::impl_from_val_with_from_str!(SetupIntentCancellationReason);
1031#[cfg(feature = "deserialize")]
1032impl<'de> serde::Deserialize<'de> for SetupIntentCancellationReason {
1033 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1034 use std::str::FromStr;
1035 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1036 Ok(Self::from_str(&s).expect("infallible"))
1037 }
1038}
1039#[derive(Clone, Eq, PartialEq)]
1040#[non_exhaustive]
1041pub enum SetupIntentExcludedPaymentMethodTypes {
1042 AcssDebit,
1043 Affirm,
1044 AfterpayClearpay,
1045 Alipay,
1046 Alma,
1047 AmazonPay,
1048 AuBecsDebit,
1049 BacsDebit,
1050 Bancontact,
1051 Billie,
1052 Bizum,
1053 Blik,
1054 Boleto,
1055 Card,
1056 Cashapp,
1057 Crypto,
1058 CustomerBalance,
1059 Eps,
1060 Fpx,
1061 Giropay,
1062 Grabpay,
1063 Ideal,
1064 KakaoPay,
1065 Klarna,
1066 Konbini,
1067 KrCard,
1068 MbWay,
1069 Mobilepay,
1070 Multibanco,
1071 NaverPay,
1072 NzBankAccount,
1073 Oxxo,
1074 P24,
1075 PayByBank,
1076 Payco,
1077 Paynow,
1078 Paypal,
1079 Payto,
1080 Pix,
1081 Promptpay,
1082 RevolutPay,
1083 SamsungPay,
1084 Satispay,
1085 Scalapay,
1086 SepaDebit,
1087 Sofort,
1088 Sunbit,
1089 Swish,
1090 Twint,
1091 Upi,
1092 UsBankAccount,
1093 WechatPay,
1094 Zip,
1095 Unknown(String),
1097}
1098impl SetupIntentExcludedPaymentMethodTypes {
1099 pub fn as_str(&self) -> &str {
1100 use SetupIntentExcludedPaymentMethodTypes::*;
1101 match self {
1102 AcssDebit => "acss_debit",
1103 Affirm => "affirm",
1104 AfterpayClearpay => "afterpay_clearpay",
1105 Alipay => "alipay",
1106 Alma => "alma",
1107 AmazonPay => "amazon_pay",
1108 AuBecsDebit => "au_becs_debit",
1109 BacsDebit => "bacs_debit",
1110 Bancontact => "bancontact",
1111 Billie => "billie",
1112 Bizum => "bizum",
1113 Blik => "blik",
1114 Boleto => "boleto",
1115 Card => "card",
1116 Cashapp => "cashapp",
1117 Crypto => "crypto",
1118 CustomerBalance => "customer_balance",
1119 Eps => "eps",
1120 Fpx => "fpx",
1121 Giropay => "giropay",
1122 Grabpay => "grabpay",
1123 Ideal => "ideal",
1124 KakaoPay => "kakao_pay",
1125 Klarna => "klarna",
1126 Konbini => "konbini",
1127 KrCard => "kr_card",
1128 MbWay => "mb_way",
1129 Mobilepay => "mobilepay",
1130 Multibanco => "multibanco",
1131 NaverPay => "naver_pay",
1132 NzBankAccount => "nz_bank_account",
1133 Oxxo => "oxxo",
1134 P24 => "p24",
1135 PayByBank => "pay_by_bank",
1136 Payco => "payco",
1137 Paynow => "paynow",
1138 Paypal => "paypal",
1139 Payto => "payto",
1140 Pix => "pix",
1141 Promptpay => "promptpay",
1142 RevolutPay => "revolut_pay",
1143 SamsungPay => "samsung_pay",
1144 Satispay => "satispay",
1145 Scalapay => "scalapay",
1146 SepaDebit => "sepa_debit",
1147 Sofort => "sofort",
1148 Sunbit => "sunbit",
1149 Swish => "swish",
1150 Twint => "twint",
1151 Upi => "upi",
1152 UsBankAccount => "us_bank_account",
1153 WechatPay => "wechat_pay",
1154 Zip => "zip",
1155 Unknown(v) => v,
1156 }
1157 }
1158}
1159
1160impl std::str::FromStr for SetupIntentExcludedPaymentMethodTypes {
1161 type Err = std::convert::Infallible;
1162 fn from_str(s: &str) -> Result<Self, Self::Err> {
1163 use SetupIntentExcludedPaymentMethodTypes::*;
1164 match s {
1165 "acss_debit" => Ok(AcssDebit),
1166 "affirm" => Ok(Affirm),
1167 "afterpay_clearpay" => Ok(AfterpayClearpay),
1168 "alipay" => Ok(Alipay),
1169 "alma" => Ok(Alma),
1170 "amazon_pay" => Ok(AmazonPay),
1171 "au_becs_debit" => Ok(AuBecsDebit),
1172 "bacs_debit" => Ok(BacsDebit),
1173 "bancontact" => Ok(Bancontact),
1174 "billie" => Ok(Billie),
1175 "bizum" => Ok(Bizum),
1176 "blik" => Ok(Blik),
1177 "boleto" => Ok(Boleto),
1178 "card" => Ok(Card),
1179 "cashapp" => Ok(Cashapp),
1180 "crypto" => Ok(Crypto),
1181 "customer_balance" => Ok(CustomerBalance),
1182 "eps" => Ok(Eps),
1183 "fpx" => Ok(Fpx),
1184 "giropay" => Ok(Giropay),
1185 "grabpay" => Ok(Grabpay),
1186 "ideal" => Ok(Ideal),
1187 "kakao_pay" => Ok(KakaoPay),
1188 "klarna" => Ok(Klarna),
1189 "konbini" => Ok(Konbini),
1190 "kr_card" => Ok(KrCard),
1191 "mb_way" => Ok(MbWay),
1192 "mobilepay" => Ok(Mobilepay),
1193 "multibanco" => Ok(Multibanco),
1194 "naver_pay" => Ok(NaverPay),
1195 "nz_bank_account" => Ok(NzBankAccount),
1196 "oxxo" => Ok(Oxxo),
1197 "p24" => Ok(P24),
1198 "pay_by_bank" => Ok(PayByBank),
1199 "payco" => Ok(Payco),
1200 "paynow" => Ok(Paynow),
1201 "paypal" => Ok(Paypal),
1202 "payto" => Ok(Payto),
1203 "pix" => Ok(Pix),
1204 "promptpay" => Ok(Promptpay),
1205 "revolut_pay" => Ok(RevolutPay),
1206 "samsung_pay" => Ok(SamsungPay),
1207 "satispay" => Ok(Satispay),
1208 "scalapay" => Ok(Scalapay),
1209 "sepa_debit" => Ok(SepaDebit),
1210 "sofort" => Ok(Sofort),
1211 "sunbit" => Ok(Sunbit),
1212 "swish" => Ok(Swish),
1213 "twint" => Ok(Twint),
1214 "upi" => Ok(Upi),
1215 "us_bank_account" => Ok(UsBankAccount),
1216 "wechat_pay" => Ok(WechatPay),
1217 "zip" => Ok(Zip),
1218 v => {
1219 tracing::warn!(
1220 "Unknown value '{}' for enum '{}'",
1221 v,
1222 "SetupIntentExcludedPaymentMethodTypes"
1223 );
1224 Ok(Unknown(v.to_owned()))
1225 }
1226 }
1227 }
1228}
1229impl std::fmt::Display for SetupIntentExcludedPaymentMethodTypes {
1230 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1231 f.write_str(self.as_str())
1232 }
1233}
1234
1235#[cfg(not(feature = "redact-generated-debug"))]
1236impl std::fmt::Debug for SetupIntentExcludedPaymentMethodTypes {
1237 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1238 f.write_str(self.as_str())
1239 }
1240}
1241#[cfg(feature = "redact-generated-debug")]
1242impl std::fmt::Debug for SetupIntentExcludedPaymentMethodTypes {
1243 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1244 f.debug_struct(stringify!(SetupIntentExcludedPaymentMethodTypes)).finish_non_exhaustive()
1245 }
1246}
1247impl serde::Serialize for SetupIntentExcludedPaymentMethodTypes {
1248 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1249 where
1250 S: serde::Serializer,
1251 {
1252 serializer.serialize_str(self.as_str())
1253 }
1254}
1255impl miniserde::Deserialize for SetupIntentExcludedPaymentMethodTypes {
1256 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1257 crate::Place::new(out)
1258 }
1259}
1260
1261impl miniserde::de::Visitor for crate::Place<SetupIntentExcludedPaymentMethodTypes> {
1262 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1263 use std::str::FromStr;
1264 self.out = Some(SetupIntentExcludedPaymentMethodTypes::from_str(s).expect("infallible"));
1265 Ok(())
1266 }
1267}
1268
1269stripe_types::impl_from_val_with_from_str!(SetupIntentExcludedPaymentMethodTypes);
1270#[cfg(feature = "deserialize")]
1271impl<'de> serde::Deserialize<'de> for SetupIntentExcludedPaymentMethodTypes {
1272 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1273 use std::str::FromStr;
1274 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1275 Ok(Self::from_str(&s).expect("infallible"))
1276 }
1277}
1278#[derive(Clone, Eq, PartialEq)]
1279#[non_exhaustive]
1280pub enum SetupIntentFlowDirections {
1281 Inbound,
1282 Outbound,
1283 Unknown(String),
1285}
1286impl SetupIntentFlowDirections {
1287 pub fn as_str(&self) -> &str {
1288 use SetupIntentFlowDirections::*;
1289 match self {
1290 Inbound => "inbound",
1291 Outbound => "outbound",
1292 Unknown(v) => v,
1293 }
1294 }
1295}
1296
1297impl std::str::FromStr for SetupIntentFlowDirections {
1298 type Err = std::convert::Infallible;
1299 fn from_str(s: &str) -> Result<Self, Self::Err> {
1300 use SetupIntentFlowDirections::*;
1301 match s {
1302 "inbound" => Ok(Inbound),
1303 "outbound" => Ok(Outbound),
1304 v => {
1305 tracing::warn!("Unknown value '{}' for enum '{}'", v, "SetupIntentFlowDirections");
1306 Ok(Unknown(v.to_owned()))
1307 }
1308 }
1309 }
1310}
1311impl std::fmt::Display for SetupIntentFlowDirections {
1312 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1313 f.write_str(self.as_str())
1314 }
1315}
1316
1317#[cfg(not(feature = "redact-generated-debug"))]
1318impl std::fmt::Debug for SetupIntentFlowDirections {
1319 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1320 f.write_str(self.as_str())
1321 }
1322}
1323#[cfg(feature = "redact-generated-debug")]
1324impl std::fmt::Debug for SetupIntentFlowDirections {
1325 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1326 f.debug_struct(stringify!(SetupIntentFlowDirections)).finish_non_exhaustive()
1327 }
1328}
1329impl serde::Serialize for SetupIntentFlowDirections {
1330 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1331 where
1332 S: serde::Serializer,
1333 {
1334 serializer.serialize_str(self.as_str())
1335 }
1336}
1337impl miniserde::Deserialize for SetupIntentFlowDirections {
1338 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1339 crate::Place::new(out)
1340 }
1341}
1342
1343impl miniserde::de::Visitor for crate::Place<SetupIntentFlowDirections> {
1344 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1345 use std::str::FromStr;
1346 self.out = Some(SetupIntentFlowDirections::from_str(s).expect("infallible"));
1347 Ok(())
1348 }
1349}
1350
1351stripe_types::impl_from_val_with_from_str!(SetupIntentFlowDirections);
1352#[cfg(feature = "deserialize")]
1353impl<'de> serde::Deserialize<'de> for SetupIntentFlowDirections {
1354 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1355 use std::str::FromStr;
1356 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1357 Ok(Self::from_str(&s).expect("infallible"))
1358 }
1359}