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