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::{make_place, Deserialize, Result};
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
173 _ => <dyn Visitor>::ignore(),
174 })
175 }
176
177 fn deser_default() -> Self {
178 Self {
179 amount_authorized: Deserialize::default(),
180 authorization_code: Deserialize::default(),
181 brand: Deserialize::default(),
182 capture_before: Deserialize::default(),
183 checks: Deserialize::default(),
184 country: Deserialize::default(),
185 description: Deserialize::default(),
186 exp_month: Deserialize::default(),
187 exp_year: Deserialize::default(),
188 extended_authorization: Deserialize::default(),
189 fingerprint: Deserialize::default(),
190 funding: Deserialize::default(),
191 iin: Deserialize::default(),
192 incremental_authorization: Deserialize::default(),
193 installments: Deserialize::default(),
194 issuer: Deserialize::default(),
195 last4: Deserialize::default(),
196 mandate: Deserialize::default(),
197 moto: Deserialize::default(),
198 multicapture: Deserialize::default(),
199 network: Deserialize::default(),
200 network_token: Deserialize::default(),
201 network_transaction_id: Deserialize::default(),
202 overcapture: Deserialize::default(),
203 regulated_status: Deserialize::default(),
204 three_d_secure: Deserialize::default(),
205 wallet: Deserialize::default(),
206 }
207 }
208
209 fn take_out(&mut self) -> Option<Self::Out> {
210 let (
211 Some(amount_authorized),
212 Some(authorization_code),
213 Some(brand),
214 Some(capture_before),
215 Some(checks),
216 Some(country),
217 Some(description),
218 Some(exp_month),
219 Some(exp_year),
220 Some(extended_authorization),
221 Some(fingerprint),
222 Some(funding),
223 Some(iin),
224 Some(incremental_authorization),
225 Some(installments),
226 Some(issuer),
227 Some(last4),
228 Some(mandate),
229 Some(moto),
230 Some(multicapture),
231 Some(network),
232 Some(network_token),
233 Some(network_transaction_id),
234 Some(overcapture),
235 Some(regulated_status),
236 Some(three_d_secure),
237 Some(wallet),
238 ) = (
239 self.amount_authorized,
240 self.authorization_code.take(),
241 self.brand.take(),
242 self.capture_before,
243 self.checks.take(),
244 self.country.take(),
245 self.description.take(),
246 self.exp_month,
247 self.exp_year,
248 self.extended_authorization,
249 self.fingerprint.take(),
250 self.funding.take(),
251 self.iin.take(),
252 self.incremental_authorization,
253 self.installments,
254 self.issuer.take(),
255 self.last4.take(),
256 self.mandate.take(),
257 self.moto,
258 self.multicapture,
259 self.network.take(),
260 self.network_token,
261 self.network_transaction_id.take(),
262 self.overcapture,
263 self.regulated_status,
264 self.three_d_secure.take(),
265 self.wallet.take(),
266 )
267 else {
268 return None;
269 };
270 Some(Self::Out {
271 amount_authorized,
272 authorization_code,
273 brand,
274 capture_before,
275 checks,
276 country,
277 description,
278 exp_month,
279 exp_year,
280 extended_authorization,
281 fingerprint,
282 funding,
283 iin,
284 incremental_authorization,
285 installments,
286 issuer,
287 last4,
288 mandate,
289 moto,
290 multicapture,
291 network,
292 network_token,
293 network_transaction_id,
294 overcapture,
295 regulated_status,
296 three_d_secure,
297 wallet,
298 })
299 }
300 }
301
302 impl<'a> Map for Builder<'a> {
303 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
304 self.builder.key(k)
305 }
306
307 fn finish(&mut self) -> Result<()> {
308 *self.out = self.builder.take_out();
309 Ok(())
310 }
311 }
312
313 impl ObjectDeser for PaymentMethodDetailsCard {
314 type Builder = PaymentMethodDetailsCardBuilder;
315 }
316
317 impl FromValueOpt for PaymentMethodDetailsCard {
318 fn from_value(v: Value) -> Option<Self> {
319 let Value::Object(obj) = v else {
320 return None;
321 };
322 let mut b = PaymentMethodDetailsCardBuilder::deser_default();
323 for (k, v) in obj {
324 match k.as_str() {
325 "amount_authorized" => b.amount_authorized = FromValueOpt::from_value(v),
326 "authorization_code" => b.authorization_code = FromValueOpt::from_value(v),
327 "brand" => b.brand = FromValueOpt::from_value(v),
328 "capture_before" => b.capture_before = FromValueOpt::from_value(v),
329 "checks" => b.checks = FromValueOpt::from_value(v),
330 "country" => b.country = FromValueOpt::from_value(v),
331 "description" => b.description = FromValueOpt::from_value(v),
332 "exp_month" => b.exp_month = FromValueOpt::from_value(v),
333 "exp_year" => b.exp_year = FromValueOpt::from_value(v),
334 "extended_authorization" => {
335 b.extended_authorization = FromValueOpt::from_value(v)
336 }
337 "fingerprint" => b.fingerprint = FromValueOpt::from_value(v),
338 "funding" => b.funding = FromValueOpt::from_value(v),
339 "iin" => b.iin = FromValueOpt::from_value(v),
340 "incremental_authorization" => {
341 b.incremental_authorization = FromValueOpt::from_value(v)
342 }
343 "installments" => b.installments = FromValueOpt::from_value(v),
344 "issuer" => b.issuer = FromValueOpt::from_value(v),
345 "last4" => b.last4 = FromValueOpt::from_value(v),
346 "mandate" => b.mandate = FromValueOpt::from_value(v),
347 "moto" => b.moto = FromValueOpt::from_value(v),
348 "multicapture" => b.multicapture = FromValueOpt::from_value(v),
349 "network" => b.network = FromValueOpt::from_value(v),
350 "network_token" => b.network_token = FromValueOpt::from_value(v),
351 "network_transaction_id" => {
352 b.network_transaction_id = FromValueOpt::from_value(v)
353 }
354 "overcapture" => b.overcapture = FromValueOpt::from_value(v),
355 "regulated_status" => b.regulated_status = FromValueOpt::from_value(v),
356 "three_d_secure" => b.three_d_secure = FromValueOpt::from_value(v),
357 "wallet" => b.wallet = FromValueOpt::from_value(v),
358
359 _ => {}
360 }
361 }
362 b.take_out()
363 }
364 }
365};
366#[derive(Copy, Clone, Eq, PartialEq)]
368pub enum PaymentMethodDetailsCardRegulatedStatus {
369 Regulated,
370 Unregulated,
371}
372impl PaymentMethodDetailsCardRegulatedStatus {
373 pub fn as_str(self) -> &'static str {
374 use PaymentMethodDetailsCardRegulatedStatus::*;
375 match self {
376 Regulated => "regulated",
377 Unregulated => "unregulated",
378 }
379 }
380}
381
382impl std::str::FromStr for PaymentMethodDetailsCardRegulatedStatus {
383 type Err = stripe_types::StripeParseError;
384 fn from_str(s: &str) -> Result<Self, Self::Err> {
385 use PaymentMethodDetailsCardRegulatedStatus::*;
386 match s {
387 "regulated" => Ok(Regulated),
388 "unregulated" => Ok(Unregulated),
389 _ => Err(stripe_types::StripeParseError),
390 }
391 }
392}
393impl std::fmt::Display for PaymentMethodDetailsCardRegulatedStatus {
394 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
395 f.write_str(self.as_str())
396 }
397}
398
399impl std::fmt::Debug for PaymentMethodDetailsCardRegulatedStatus {
400 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
401 f.write_str(self.as_str())
402 }
403}
404#[cfg(feature = "serialize")]
405impl serde::Serialize for PaymentMethodDetailsCardRegulatedStatus {
406 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
407 where
408 S: serde::Serializer,
409 {
410 serializer.serialize_str(self.as_str())
411 }
412}
413impl miniserde::Deserialize for PaymentMethodDetailsCardRegulatedStatus {
414 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
415 crate::Place::new(out)
416 }
417}
418
419impl miniserde::de::Visitor for crate::Place<PaymentMethodDetailsCardRegulatedStatus> {
420 fn string(&mut self, s: &str) -> miniserde::Result<()> {
421 use std::str::FromStr;
422 self.out = Some(
423 PaymentMethodDetailsCardRegulatedStatus::from_str(s).map_err(|_| miniserde::Error)?,
424 );
425 Ok(())
426 }
427}
428
429stripe_types::impl_from_val_with_from_str!(PaymentMethodDetailsCardRegulatedStatus);
430#[cfg(feature = "deserialize")]
431impl<'de> serde::Deserialize<'de> for PaymentMethodDetailsCardRegulatedStatus {
432 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
433 use std::str::FromStr;
434 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
435 Self::from_str(&s).map_err(|_| {
436 serde::de::Error::custom("Unknown value for PaymentMethodDetailsCardRegulatedStatus")
437 })
438 }
439}