stripe_shared/
setup_intent_payment_method_options_sepa_debit.rs1#[derive(Clone, Eq, PartialEq)]
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 SetupIntentPaymentMethodOptionsSepaDebit {
6 pub mandate_options:
7 Option<stripe_shared::SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit>,
8}
9#[cfg(feature = "redact-generated-debug")]
10impl std::fmt::Debug for SetupIntentPaymentMethodOptionsSepaDebit {
11 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
12 f.debug_struct("SetupIntentPaymentMethodOptionsSepaDebit").finish_non_exhaustive()
13 }
14}
15#[doc(hidden)]
16pub struct SetupIntentPaymentMethodOptionsSepaDebitBuilder {
17 mandate_options:
18 Option<Option<stripe_shared::SetupIntentPaymentMethodOptionsMandateOptionsSepaDebit>>,
19}
20
21#[allow(
22 unused_variables,
23 irrefutable_let_patterns,
24 clippy::let_unit_value,
25 clippy::match_single_binding,
26 clippy::single_match
27)]
28const _: () = {
29 use miniserde::de::{Map, Visitor};
30 use miniserde::json::Value;
31 use miniserde::{Deserialize, Result, make_place};
32 use stripe_types::miniserde_helpers::FromValueOpt;
33 use stripe_types::{MapBuilder, ObjectDeser};
34
35 make_place!(Place);
36
37 impl Deserialize for SetupIntentPaymentMethodOptionsSepaDebit {
38 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
39 Place::new(out)
40 }
41 }
42
43 struct Builder<'a> {
44 out: &'a mut Option<SetupIntentPaymentMethodOptionsSepaDebit>,
45 builder: SetupIntentPaymentMethodOptionsSepaDebitBuilder,
46 }
47
48 impl Visitor for Place<SetupIntentPaymentMethodOptionsSepaDebit> {
49 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
50 Ok(Box::new(Builder {
51 out: &mut self.out,
52 builder: SetupIntentPaymentMethodOptionsSepaDebitBuilder::deser_default(),
53 }))
54 }
55 }
56
57 impl MapBuilder for SetupIntentPaymentMethodOptionsSepaDebitBuilder {
58 type Out = SetupIntentPaymentMethodOptionsSepaDebit;
59 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
60 Ok(match k {
61 "mandate_options" => Deserialize::begin(&mut self.mandate_options),
62 _ => <dyn Visitor>::ignore(),
63 })
64 }
65
66 fn deser_default() -> Self {
67 Self { mandate_options: Deserialize::default() }
68 }
69
70 fn take_out(&mut self) -> Option<Self::Out> {
71 let (Some(mandate_options),) = (self.mandate_options.take(),) else {
72 return None;
73 };
74 Some(Self::Out { mandate_options })
75 }
76 }
77
78 impl Map for Builder<'_> {
79 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
80 self.builder.key(k)
81 }
82
83 fn finish(&mut self) -> Result<()> {
84 *self.out = self.builder.take_out();
85 Ok(())
86 }
87 }
88
89 impl ObjectDeser for SetupIntentPaymentMethodOptionsSepaDebit {
90 type Builder = SetupIntentPaymentMethodOptionsSepaDebitBuilder;
91 }
92
93 impl FromValueOpt for SetupIntentPaymentMethodOptionsSepaDebit {
94 fn from_value(v: Value) -> Option<Self> {
95 let Value::Object(obj) = v else {
96 return None;
97 };
98 let mut b = SetupIntentPaymentMethodOptionsSepaDebitBuilder::deser_default();
99 for (k, v) in obj {
100 match k.as_str() {
101 "mandate_options" => b.mandate_options = FromValueOpt::from_value(v),
102 _ => {}
103 }
104 }
105 b.take_out()
106 }
107 }
108};