1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct PaymentMethodDetailsCard {
5 pub amount_authorized: Option<i64>,
7 pub authorization_code: Option<String>,
9 pub brand: Option<String>,
12 pub capture_before: Option<stripe_types::Timestamp>,
14 pub checks: Option<stripe_shared::PaymentMethodDetailsCardChecks>,
16 pub country: Option<String>,
19 pub description: Option<String>,
22 pub exp_month: i64,
24 pub exp_year: i64,
26pub extended_authorization: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesExtendedAuthorizationExtendedAuthorization>,
27 pub fingerprint: Option<String>,
33 pub funding: Option<String>,
35 pub iin: Option<String>,
38pub incremental_authorization: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesIncrementalAuthorizationIncrementalAuthorization>,
39 pub installments: Option<stripe_shared::PaymentMethodDetailsCardInstallments>,
43 pub issuer: Option<String>,
46 pub last4: Option<String>,
48 pub mandate: Option<String>,
50 pub moto: Option<bool>,
52pub multicapture: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceMulticapture>,
53 pub network: Option<String>,
56 pub network_token: Option<stripe_shared::PaymentMethodDetailsCardNetworkToken>,
58 pub network_transaction_id: Option<String>,
62pub overcapture: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesOvercaptureOvercapture>,
63 pub regulated_status: Option<PaymentMethodDetailsCardRegulatedStatus>,
65 pub three_d_secure: Option<stripe_shared::ThreeDSecureDetailsCharge>,
67 pub wallet: Option<stripe_shared::PaymentMethodDetailsCardWallet>,
69
70}
71#[doc(hidden)]
72pub struct PaymentMethodDetailsCardBuilder {
73 amount_authorized: Option<Option<i64>>,
74authorization_code: Option<Option<String>>,
75brand: Option<Option<String>>,
76capture_before: Option<Option<stripe_types::Timestamp>>,
77checks: Option<Option<stripe_shared::PaymentMethodDetailsCardChecks>>,
78country: Option<Option<String>>,
79description: Option<Option<String>>,
80exp_month: Option<i64>,
81exp_year: Option<i64>,
82extended_authorization: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesExtendedAuthorizationExtendedAuthorization>>,
83fingerprint: Option<Option<String>>,
84funding: Option<Option<String>>,
85iin: Option<Option<String>>,
86incremental_authorization: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesIncrementalAuthorizationIncrementalAuthorization>>,
87installments: Option<Option<stripe_shared::PaymentMethodDetailsCardInstallments>>,
88issuer: Option<Option<String>>,
89last4: Option<Option<String>>,
90mandate: Option<Option<String>>,
91moto: Option<Option<bool>>,
92multicapture: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceMulticapture>>,
93network: Option<Option<String>>,
94network_token: Option<Option<stripe_shared::PaymentMethodDetailsCardNetworkToken>>,
95network_transaction_id: Option<Option<String>>,
96overcapture: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesOvercaptureOvercapture>>,
97regulated_status: Option<Option<PaymentMethodDetailsCardRegulatedStatus>>,
98three_d_secure: Option<Option<stripe_shared::ThreeDSecureDetailsCharge>>,
99wallet: Option<Option<stripe_shared::PaymentMethodDetailsCardWallet>>,
100
101}
102
103#[allow(
104 unused_variables,
105 irrefutable_let_patterns,
106 clippy::let_unit_value,
107 clippy::match_single_binding,
108 clippy::single_match
109)]
110const _: () = {
111 use miniserde::de::{Map, Visitor};
112 use miniserde::json::Value;
113 use miniserde::{Deserialize, Result, make_place};
114 use stripe_types::miniserde_helpers::FromValueOpt;
115 use stripe_types::{MapBuilder, ObjectDeser};
116
117 make_place!(Place);
118
119 impl Deserialize for PaymentMethodDetailsCard {
120 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
121 Place::new(out)
122 }
123 }
124
125 struct Builder<'a> {
126 out: &'a mut Option<PaymentMethodDetailsCard>,
127 builder: PaymentMethodDetailsCardBuilder,
128 }
129
130 impl Visitor for Place<PaymentMethodDetailsCard> {
131 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
132 Ok(Box::new(Builder {
133 out: &mut self.out,
134 builder: PaymentMethodDetailsCardBuilder::deser_default(),
135 }))
136 }
137 }
138
139 impl MapBuilder for PaymentMethodDetailsCardBuilder {
140 type Out = PaymentMethodDetailsCard;
141 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
142 Ok(match k {
143 "amount_authorized" => Deserialize::begin(&mut self.amount_authorized),
144 "authorization_code" => Deserialize::begin(&mut self.authorization_code),
145 "brand" => Deserialize::begin(&mut self.brand),
146 "capture_before" => Deserialize::begin(&mut self.capture_before),
147 "checks" => Deserialize::begin(&mut self.checks),
148 "country" => Deserialize::begin(&mut self.country),
149 "description" => Deserialize::begin(&mut self.description),
150 "exp_month" => Deserialize::begin(&mut self.exp_month),
151 "exp_year" => Deserialize::begin(&mut self.exp_year),
152 "extended_authorization" => Deserialize::begin(&mut self.extended_authorization),
153 "fingerprint" => Deserialize::begin(&mut self.fingerprint),
154 "funding" => Deserialize::begin(&mut self.funding),
155 "iin" => Deserialize::begin(&mut self.iin),
156 "incremental_authorization" => {
157 Deserialize::begin(&mut self.incremental_authorization)
158 }
159 "installments" => Deserialize::begin(&mut self.installments),
160 "issuer" => Deserialize::begin(&mut self.issuer),
161 "last4" => Deserialize::begin(&mut self.last4),
162 "mandate" => Deserialize::begin(&mut self.mandate),
163 "moto" => Deserialize::begin(&mut self.moto),
164 "multicapture" => Deserialize::begin(&mut self.multicapture),
165 "network" => Deserialize::begin(&mut self.network),
166 "network_token" => Deserialize::begin(&mut self.network_token),
167 "network_transaction_id" => Deserialize::begin(&mut self.network_transaction_id),
168 "overcapture" => Deserialize::begin(&mut self.overcapture),
169 "regulated_status" => Deserialize::begin(&mut self.regulated_status),
170 "three_d_secure" => Deserialize::begin(&mut self.three_d_secure),
171 "wallet" => Deserialize::begin(&mut self.wallet),
172 _ => <dyn Visitor>::ignore(),
173 })
174 }
175
176 fn deser_default() -> Self {
177 Self {
178 amount_authorized: Deserialize::default(),
179 authorization_code: Deserialize::default(),
180 brand: Deserialize::default(),
181 capture_before: Deserialize::default(),
182 checks: Deserialize::default(),
183 country: Deserialize::default(),
184 description: Deserialize::default(),
185 exp_month: Deserialize::default(),
186 exp_year: Deserialize::default(),
187 extended_authorization: Deserialize::default(),
188 fingerprint: Deserialize::default(),
189 funding: Deserialize::default(),
190 iin: Deserialize::default(),
191 incremental_authorization: Deserialize::default(),
192 installments: Deserialize::default(),
193 issuer: Deserialize::default(),
194 last4: Deserialize::default(),
195 mandate: Deserialize::default(),
196 moto: Deserialize::default(),
197 multicapture: Deserialize::default(),
198 network: Deserialize::default(),
199 network_token: Deserialize::default(),
200 network_transaction_id: Deserialize::default(),
201 overcapture: Deserialize::default(),
202 regulated_status: Deserialize::default(),
203 three_d_secure: Deserialize::default(),
204 wallet: Deserialize::default(),
205 }
206 }
207
208 fn take_out(&mut self) -> Option<Self::Out> {
209 let (
210 Some(amount_authorized),
211 Some(authorization_code),
212 Some(brand),
213 Some(capture_before),
214 Some(checks),
215 Some(country),
216 Some(description),
217 Some(exp_month),
218 Some(exp_year),
219 Some(extended_authorization),
220 Some(fingerprint),
221 Some(funding),
222 Some(iin),
223 Some(incremental_authorization),
224 Some(installments),
225 Some(issuer),
226 Some(last4),
227 Some(mandate),
228 Some(moto),
229 Some(multicapture),
230 Some(network),
231 Some(network_token),
232 Some(network_transaction_id),
233 Some(overcapture),
234 Some(regulated_status),
235 Some(three_d_secure),
236 Some(wallet),
237 ) = (
238 self.amount_authorized,
239 self.authorization_code.take(),
240 self.brand.take(),
241 self.capture_before,
242 self.checks.take(),
243 self.country.take(),
244 self.description.take(),
245 self.exp_month,
246 self.exp_year,
247 self.extended_authorization,
248 self.fingerprint.take(),
249 self.funding.take(),
250 self.iin.take(),
251 self.incremental_authorization,
252 self.installments,
253 self.issuer.take(),
254 self.last4.take(),
255 self.mandate.take(),
256 self.moto,
257 self.multicapture,
258 self.network.take(),
259 self.network_token,
260 self.network_transaction_id.take(),
261 self.overcapture,
262 self.regulated_status,
263 self.three_d_secure.take(),
264 self.wallet.take(),
265 )
266 else {
267 return None;
268 };
269 Some(Self::Out {
270 amount_authorized,
271 authorization_code,
272 brand,
273 capture_before,
274 checks,
275 country,
276 description,
277 exp_month,
278 exp_year,
279 extended_authorization,
280 fingerprint,
281 funding,
282 iin,
283 incremental_authorization,
284 installments,
285 issuer,
286 last4,
287 mandate,
288 moto,
289 multicapture,
290 network,
291 network_token,
292 network_transaction_id,
293 overcapture,
294 regulated_status,
295 three_d_secure,
296 wallet,
297 })
298 }
299 }
300
301 impl Map for Builder<'_> {
302 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
303 self.builder.key(k)
304 }
305
306 fn finish(&mut self) -> Result<()> {
307 *self.out = self.builder.take_out();
308 Ok(())
309 }
310 }
311
312 impl ObjectDeser for PaymentMethodDetailsCard {
313 type Builder = PaymentMethodDetailsCardBuilder;
314 }
315
316 impl FromValueOpt for PaymentMethodDetailsCard {
317 fn from_value(v: Value) -> Option<Self> {
318 let Value::Object(obj) = v else {
319 return None;
320 };
321 let mut b = PaymentMethodDetailsCardBuilder::deser_default();
322 for (k, v) in obj {
323 match k.as_str() {
324 "amount_authorized" => b.amount_authorized = FromValueOpt::from_value(v),
325 "authorization_code" => b.authorization_code = FromValueOpt::from_value(v),
326 "brand" => b.brand = FromValueOpt::from_value(v),
327 "capture_before" => b.capture_before = FromValueOpt::from_value(v),
328 "checks" => b.checks = FromValueOpt::from_value(v),
329 "country" => b.country = FromValueOpt::from_value(v),
330 "description" => b.description = FromValueOpt::from_value(v),
331 "exp_month" => b.exp_month = FromValueOpt::from_value(v),
332 "exp_year" => b.exp_year = FromValueOpt::from_value(v),
333 "extended_authorization" => {
334 b.extended_authorization = FromValueOpt::from_value(v)
335 }
336 "fingerprint" => b.fingerprint = FromValueOpt::from_value(v),
337 "funding" => b.funding = FromValueOpt::from_value(v),
338 "iin" => b.iin = FromValueOpt::from_value(v),
339 "incremental_authorization" => {
340 b.incremental_authorization = FromValueOpt::from_value(v)
341 }
342 "installments" => b.installments = FromValueOpt::from_value(v),
343 "issuer" => b.issuer = FromValueOpt::from_value(v),
344 "last4" => b.last4 = FromValueOpt::from_value(v),
345 "mandate" => b.mandate = FromValueOpt::from_value(v),
346 "moto" => b.moto = FromValueOpt::from_value(v),
347 "multicapture" => b.multicapture = FromValueOpt::from_value(v),
348 "network" => b.network = FromValueOpt::from_value(v),
349 "network_token" => b.network_token = FromValueOpt::from_value(v),
350 "network_transaction_id" => {
351 b.network_transaction_id = FromValueOpt::from_value(v)
352 }
353 "overcapture" => b.overcapture = FromValueOpt::from_value(v),
354 "regulated_status" => b.regulated_status = FromValueOpt::from_value(v),
355 "three_d_secure" => b.three_d_secure = FromValueOpt::from_value(v),
356 "wallet" => b.wallet = FromValueOpt::from_value(v),
357 _ => {}
358 }
359 }
360 b.take_out()
361 }
362 }
363};
364#[derive(Copy, Clone, Eq, PartialEq)]
366pub enum PaymentMethodDetailsCardRegulatedStatus {
367 Regulated,
368 Unregulated,
369}
370impl PaymentMethodDetailsCardRegulatedStatus {
371 pub fn as_str(self) -> &'static str {
372 use PaymentMethodDetailsCardRegulatedStatus::*;
373 match self {
374 Regulated => "regulated",
375 Unregulated => "unregulated",
376 }
377 }
378}
379
380impl std::str::FromStr for PaymentMethodDetailsCardRegulatedStatus {
381 type Err = stripe_types::StripeParseError;
382 fn from_str(s: &str) -> Result<Self, Self::Err> {
383 use PaymentMethodDetailsCardRegulatedStatus::*;
384 match s {
385 "regulated" => Ok(Regulated),
386 "unregulated" => Ok(Unregulated),
387 _ => Err(stripe_types::StripeParseError),
388 }
389 }
390}
391impl std::fmt::Display for PaymentMethodDetailsCardRegulatedStatus {
392 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
393 f.write_str(self.as_str())
394 }
395}
396
397impl std::fmt::Debug for PaymentMethodDetailsCardRegulatedStatus {
398 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
399 f.write_str(self.as_str())
400 }
401}
402#[cfg(feature = "serialize")]
403impl serde::Serialize for PaymentMethodDetailsCardRegulatedStatus {
404 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
405 where
406 S: serde::Serializer,
407 {
408 serializer.serialize_str(self.as_str())
409 }
410}
411impl miniserde::Deserialize for PaymentMethodDetailsCardRegulatedStatus {
412 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
413 crate::Place::new(out)
414 }
415}
416
417impl miniserde::de::Visitor for crate::Place<PaymentMethodDetailsCardRegulatedStatus> {
418 fn string(&mut self, s: &str) -> miniserde::Result<()> {
419 use std::str::FromStr;
420 self.out = Some(
421 PaymentMethodDetailsCardRegulatedStatus::from_str(s).map_err(|_| miniserde::Error)?,
422 );
423 Ok(())
424 }
425}
426
427stripe_types::impl_from_val_with_from_str!(PaymentMethodDetailsCardRegulatedStatus);
428#[cfg(feature = "deserialize")]
429impl<'de> serde::Deserialize<'de> for PaymentMethodDetailsCardRegulatedStatus {
430 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
431 use std::str::FromStr;
432 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
433 Self::from_str(&s).map_err(|_| {
434 serde::de::Error::custom("Unknown value for PaymentMethodDetailsCardRegulatedStatus")
435 })
436 }
437}