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