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