1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct SetupAttemptPaymentMethodDetailsCard {
5 pub brand: Option<String>,
8 pub checks: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardChecks>,
10 pub country: Option<String>,
13 pub description: Option<String>,
16 pub exp_month: Option<i64>,
18 pub exp_year: Option<i64>,
20 pub fingerprint: Option<String>,
26 pub funding: Option<String>,
28 pub iin: Option<String>,
31 pub issuer: Option<String>,
34 pub last4: Option<String>,
36 pub network: Option<String>,
39 pub three_d_secure: Option<stripe_shared::ThreeDSecureDetails>,
41 pub wallet: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardWallet>,
43}
44#[doc(hidden)]
45pub struct SetupAttemptPaymentMethodDetailsCardBuilder {
46 brand: Option<Option<String>>,
47 checks: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardChecks>>,
48 country: Option<Option<String>>,
49 description: Option<Option<String>>,
50 exp_month: Option<Option<i64>>,
51 exp_year: Option<Option<i64>>,
52 fingerprint: Option<Option<String>>,
53 funding: Option<Option<String>>,
54 iin: Option<Option<String>>,
55 issuer: Option<Option<String>>,
56 last4: Option<Option<String>>,
57 network: Option<Option<String>>,
58 three_d_secure: Option<Option<stripe_shared::ThreeDSecureDetails>>,
59 wallet: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardWallet>>,
60}
61
62#[allow(
63 unused_variables,
64 irrefutable_let_patterns,
65 clippy::let_unit_value,
66 clippy::match_single_binding,
67 clippy::single_match
68)]
69const _: () = {
70 use miniserde::de::{Map, Visitor};
71 use miniserde::json::Value;
72 use miniserde::{make_place, Deserialize, Result};
73 use stripe_types::miniserde_helpers::FromValueOpt;
74 use stripe_types::{MapBuilder, ObjectDeser};
75
76 make_place!(Place);
77
78 impl Deserialize for SetupAttemptPaymentMethodDetailsCard {
79 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
80 Place::new(out)
81 }
82 }
83
84 struct Builder<'a> {
85 out: &'a mut Option<SetupAttemptPaymentMethodDetailsCard>,
86 builder: SetupAttemptPaymentMethodDetailsCardBuilder,
87 }
88
89 impl Visitor for Place<SetupAttemptPaymentMethodDetailsCard> {
90 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
91 Ok(Box::new(Builder {
92 out: &mut self.out,
93 builder: SetupAttemptPaymentMethodDetailsCardBuilder::deser_default(),
94 }))
95 }
96 }
97
98 impl MapBuilder for SetupAttemptPaymentMethodDetailsCardBuilder {
99 type Out = SetupAttemptPaymentMethodDetailsCard;
100 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
101 Ok(match k {
102 "brand" => Deserialize::begin(&mut self.brand),
103 "checks" => Deserialize::begin(&mut self.checks),
104 "country" => Deserialize::begin(&mut self.country),
105 "description" => Deserialize::begin(&mut self.description),
106 "exp_month" => Deserialize::begin(&mut self.exp_month),
107 "exp_year" => Deserialize::begin(&mut self.exp_year),
108 "fingerprint" => Deserialize::begin(&mut self.fingerprint),
109 "funding" => Deserialize::begin(&mut self.funding),
110 "iin" => Deserialize::begin(&mut self.iin),
111 "issuer" => Deserialize::begin(&mut self.issuer),
112 "last4" => Deserialize::begin(&mut self.last4),
113 "network" => Deserialize::begin(&mut self.network),
114 "three_d_secure" => Deserialize::begin(&mut self.three_d_secure),
115 "wallet" => Deserialize::begin(&mut self.wallet),
116
117 _ => <dyn Visitor>::ignore(),
118 })
119 }
120
121 fn deser_default() -> Self {
122 Self {
123 brand: Deserialize::default(),
124 checks: Deserialize::default(),
125 country: Deserialize::default(),
126 description: Deserialize::default(),
127 exp_month: Deserialize::default(),
128 exp_year: Deserialize::default(),
129 fingerprint: Deserialize::default(),
130 funding: Deserialize::default(),
131 iin: Deserialize::default(),
132 issuer: Deserialize::default(),
133 last4: Deserialize::default(),
134 network: Deserialize::default(),
135 three_d_secure: Deserialize::default(),
136 wallet: Deserialize::default(),
137 }
138 }
139
140 fn take_out(&mut self) -> Option<Self::Out> {
141 let (
142 Some(brand),
143 Some(checks),
144 Some(country),
145 Some(description),
146 Some(exp_month),
147 Some(exp_year),
148 Some(fingerprint),
149 Some(funding),
150 Some(iin),
151 Some(issuer),
152 Some(last4),
153 Some(network),
154 Some(three_d_secure),
155 Some(wallet),
156 ) = (
157 self.brand.take(),
158 self.checks.take(),
159 self.country.take(),
160 self.description.take(),
161 self.exp_month,
162 self.exp_year,
163 self.fingerprint.take(),
164 self.funding.take(),
165 self.iin.take(),
166 self.issuer.take(),
167 self.last4.take(),
168 self.network.take(),
169 self.three_d_secure.take(),
170 self.wallet,
171 )
172 else {
173 return None;
174 };
175 Some(Self::Out {
176 brand,
177 checks,
178 country,
179 description,
180 exp_month,
181 exp_year,
182 fingerprint,
183 funding,
184 iin,
185 issuer,
186 last4,
187 network,
188 three_d_secure,
189 wallet,
190 })
191 }
192 }
193
194 impl Map for Builder<'_> {
195 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
196 self.builder.key(k)
197 }
198
199 fn finish(&mut self) -> Result<()> {
200 *self.out = self.builder.take_out();
201 Ok(())
202 }
203 }
204
205 impl ObjectDeser for SetupAttemptPaymentMethodDetailsCard {
206 type Builder = SetupAttemptPaymentMethodDetailsCardBuilder;
207 }
208
209 impl FromValueOpt for SetupAttemptPaymentMethodDetailsCard {
210 fn from_value(v: Value) -> Option<Self> {
211 let Value::Object(obj) = v else {
212 return None;
213 };
214 let mut b = SetupAttemptPaymentMethodDetailsCardBuilder::deser_default();
215 for (k, v) in obj {
216 match k.as_str() {
217 "brand" => b.brand = FromValueOpt::from_value(v),
218 "checks" => b.checks = FromValueOpt::from_value(v),
219 "country" => b.country = FromValueOpt::from_value(v),
220 "description" => b.description = FromValueOpt::from_value(v),
221 "exp_month" => b.exp_month = FromValueOpt::from_value(v),
222 "exp_year" => b.exp_year = FromValueOpt::from_value(v),
223 "fingerprint" => b.fingerprint = FromValueOpt::from_value(v),
224 "funding" => b.funding = FromValueOpt::from_value(v),
225 "iin" => b.iin = FromValueOpt::from_value(v),
226 "issuer" => b.issuer = FromValueOpt::from_value(v),
227 "last4" => b.last4 = FromValueOpt::from_value(v),
228 "network" => b.network = FromValueOpt::from_value(v),
229 "three_d_secure" => b.three_d_secure = FromValueOpt::from_value(v),
230 "wallet" => b.wallet = FromValueOpt::from_value(v),
231
232 _ => {}
233 }
234 }
235 b.take_out()
236 }
237 }
238};