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::{Deserialize, Result, make_place};
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 _ => <dyn Visitor>::ignore(),
117 })
118 }
119
120 fn deser_default() -> Self {
121 Self {
122 brand: Deserialize::default(),
123 checks: Deserialize::default(),
124 country: Deserialize::default(),
125 description: Deserialize::default(),
126 exp_month: Deserialize::default(),
127 exp_year: Deserialize::default(),
128 fingerprint: Deserialize::default(),
129 funding: Deserialize::default(),
130 iin: Deserialize::default(),
131 issuer: Deserialize::default(),
132 last4: Deserialize::default(),
133 network: Deserialize::default(),
134 three_d_secure: Deserialize::default(),
135 wallet: Deserialize::default(),
136 }
137 }
138
139 fn take_out(&mut self) -> Option<Self::Out> {
140 let (
141 Some(brand),
142 Some(checks),
143 Some(country),
144 Some(description),
145 Some(exp_month),
146 Some(exp_year),
147 Some(fingerprint),
148 Some(funding),
149 Some(iin),
150 Some(issuer),
151 Some(last4),
152 Some(network),
153 Some(three_d_secure),
154 Some(wallet),
155 ) = (
156 self.brand.take(),
157 self.checks.take(),
158 self.country.take(),
159 self.description.take(),
160 self.exp_month,
161 self.exp_year,
162 self.fingerprint.take(),
163 self.funding.take(),
164 self.iin.take(),
165 self.issuer.take(),
166 self.last4.take(),
167 self.network.take(),
168 self.three_d_secure.take(),
169 self.wallet,
170 )
171 else {
172 return None;
173 };
174 Some(Self::Out {
175 brand,
176 checks,
177 country,
178 description,
179 exp_month,
180 exp_year,
181 fingerprint,
182 funding,
183 iin,
184 issuer,
185 last4,
186 network,
187 three_d_secure,
188 wallet,
189 })
190 }
191 }
192
193 impl Map for Builder<'_> {
194 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
195 self.builder.key(k)
196 }
197
198 fn finish(&mut self) -> Result<()> {
199 *self.out = self.builder.take_out();
200 Ok(())
201 }
202 }
203
204 impl ObjectDeser for SetupAttemptPaymentMethodDetailsCard {
205 type Builder = SetupAttemptPaymentMethodDetailsCardBuilder;
206 }
207
208 impl FromValueOpt for SetupAttemptPaymentMethodDetailsCard {
209 fn from_value(v: Value) -> Option<Self> {
210 let Value::Object(obj) = v else {
211 return None;
212 };
213 let mut b = SetupAttemptPaymentMethodDetailsCardBuilder::deser_default();
214 for (k, v) in obj {
215 match k.as_str() {
216 "brand" => b.brand = FromValueOpt::from_value(v),
217 "checks" => b.checks = FromValueOpt::from_value(v),
218 "country" => b.country = FromValueOpt::from_value(v),
219 "description" => b.description = FromValueOpt::from_value(v),
220 "exp_month" => b.exp_month = FromValueOpt::from_value(v),
221 "exp_year" => b.exp_year = FromValueOpt::from_value(v),
222 "fingerprint" => b.fingerprint = FromValueOpt::from_value(v),
223 "funding" => b.funding = FromValueOpt::from_value(v),
224 "iin" => b.iin = FromValueOpt::from_value(v),
225 "issuer" => b.issuer = FromValueOpt::from_value(v),
226 "last4" => b.last4 = FromValueOpt::from_value(v),
227 "network" => b.network = FromValueOpt::from_value(v),
228 "three_d_secure" => b.three_d_secure = FromValueOpt::from_value(v),
229 "wallet" => b.wallet = FromValueOpt::from_value(v),
230 _ => {}
231 }
232 }
233 b.take_out()
234 }
235 }
236};