#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
pub struct SetupAttemptPaymentMethodDetailsCard {
pub brand: Option<String>,
pub checks: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardChecks>,
pub country: Option<String>,
pub description: Option<String>,
pub exp_month: Option<i64>,
pub exp_year: Option<i64>,
pub fingerprint: Option<String>,
pub funding: Option<String>,
pub iin: Option<String>,
pub issuer: Option<String>,
pub last4: Option<String>,
pub moto: Option<bool>,
pub network: Option<String>,
pub three_d_secure: Option<stripe_shared::ThreeDSecureDetails>,
pub wallet: Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardWallet>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for SetupAttemptPaymentMethodDetailsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SetupAttemptPaymentMethodDetailsCard").finish_non_exhaustive()
}
}
#[doc(hidden)]
pub struct SetupAttemptPaymentMethodDetailsCardBuilder {
brand: Option<Option<String>>,
checks: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardChecks>>,
country: Option<Option<String>>,
description: Option<Option<String>>,
exp_month: Option<Option<i64>>,
exp_year: Option<Option<i64>>,
fingerprint: Option<Option<String>>,
funding: Option<Option<String>>,
iin: Option<Option<String>>,
issuer: Option<Option<String>>,
last4: Option<Option<String>>,
moto: Option<Option<bool>>,
network: Option<Option<String>>,
three_d_secure: Option<Option<stripe_shared::ThreeDSecureDetails>>,
wallet: Option<Option<stripe_shared::SetupAttemptPaymentMethodDetailsCardWallet>>,
}
#[allow(
unused_variables,
irrefutable_let_patterns,
clippy::let_unit_value,
clippy::match_single_binding,
clippy::single_match
)]
const _: () = {
use miniserde::de::{Map, Visitor};
use miniserde::json::Value;
use miniserde::{Deserialize, Result, make_place};
use stripe_types::miniserde_helpers::FromValueOpt;
use stripe_types::{MapBuilder, ObjectDeser};
make_place!(Place);
impl Deserialize for SetupAttemptPaymentMethodDetailsCard {
fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
Place::new(out)
}
}
struct Builder<'a> {
out: &'a mut Option<SetupAttemptPaymentMethodDetailsCard>,
builder: SetupAttemptPaymentMethodDetailsCardBuilder,
}
impl Visitor for Place<SetupAttemptPaymentMethodDetailsCard> {
fn map(&mut self) -> Result<Box<dyn Map + '_>> {
Ok(Box::new(Builder {
out: &mut self.out,
builder: SetupAttemptPaymentMethodDetailsCardBuilder::deser_default(),
}))
}
}
impl MapBuilder for SetupAttemptPaymentMethodDetailsCardBuilder {
type Out = SetupAttemptPaymentMethodDetailsCard;
fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
Ok(match k {
"brand" => Deserialize::begin(&mut self.brand),
"checks" => Deserialize::begin(&mut self.checks),
"country" => Deserialize::begin(&mut self.country),
"description" => Deserialize::begin(&mut self.description),
"exp_month" => Deserialize::begin(&mut self.exp_month),
"exp_year" => Deserialize::begin(&mut self.exp_year),
"fingerprint" => Deserialize::begin(&mut self.fingerprint),
"funding" => Deserialize::begin(&mut self.funding),
"iin" => Deserialize::begin(&mut self.iin),
"issuer" => Deserialize::begin(&mut self.issuer),
"last4" => Deserialize::begin(&mut self.last4),
"moto" => Deserialize::begin(&mut self.moto),
"network" => Deserialize::begin(&mut self.network),
"three_d_secure" => Deserialize::begin(&mut self.three_d_secure),
"wallet" => Deserialize::begin(&mut self.wallet),
_ => <dyn Visitor>::ignore(),
})
}
fn deser_default() -> Self {
Self {
brand: Some(None),
checks: Some(None),
country: Some(None),
description: Some(None),
exp_month: Some(None),
exp_year: Some(None),
fingerprint: Some(None),
funding: Some(None),
iin: Some(None),
issuer: Some(None),
last4: Some(None),
moto: Some(None),
network: Some(None),
three_d_secure: Some(None),
wallet: Some(None),
}
}
fn take_out(&mut self) -> Option<Self::Out> {
let (
Some(brand),
Some(checks),
Some(country),
Some(description),
Some(exp_month),
Some(exp_year),
Some(fingerprint),
Some(funding),
Some(iin),
Some(issuer),
Some(last4),
Some(moto),
Some(network),
Some(three_d_secure),
Some(wallet),
) = (
self.brand.take(),
self.checks.take(),
self.country.take(),
self.description.take(),
self.exp_month,
self.exp_year,
self.fingerprint.take(),
self.funding.take(),
self.iin.take(),
self.issuer.take(),
self.last4.take(),
self.moto,
self.network.take(),
self.three_d_secure.take(),
self.wallet.take(),
)
else {
return None;
};
Some(Self::Out {
brand,
checks,
country,
description,
exp_month,
exp_year,
fingerprint,
funding,
iin,
issuer,
last4,
moto,
network,
three_d_secure,
wallet,
})
}
}
impl Map for Builder<'_> {
fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
self.builder.key(k)
}
fn finish(&mut self) -> Result<()> {
*self.out = self.builder.take_out();
Ok(())
}
}
impl ObjectDeser for SetupAttemptPaymentMethodDetailsCard {
type Builder = SetupAttemptPaymentMethodDetailsCardBuilder;
}
impl FromValueOpt for SetupAttemptPaymentMethodDetailsCard {
fn from_value(v: Value) -> Option<Self> {
let Value::Object(obj) = v else {
return None;
};
let mut b = SetupAttemptPaymentMethodDetailsCardBuilder::deser_default();
for (k, v) in obj {
match k.as_str() {
"brand" => b.brand = FromValueOpt::from_value(v),
"checks" => b.checks = FromValueOpt::from_value(v),
"country" => b.country = FromValueOpt::from_value(v),
"description" => b.description = FromValueOpt::from_value(v),
"exp_month" => b.exp_month = FromValueOpt::from_value(v),
"exp_year" => b.exp_year = FromValueOpt::from_value(v),
"fingerprint" => b.fingerprint = FromValueOpt::from_value(v),
"funding" => b.funding = FromValueOpt::from_value(v),
"iin" => b.iin = FromValueOpt::from_value(v),
"issuer" => b.issuer = FromValueOpt::from_value(v),
"last4" => b.last4 = FromValueOpt::from_value(v),
"moto" => b.moto = FromValueOpt::from_value(v),
"network" => b.network = FromValueOpt::from_value(v),
"three_d_secure" => b.three_d_secure = FromValueOpt::from_value(v),
"wallet" => b.wallet = FromValueOpt::from_value(v),
_ => {}
}
}
b.take_out()
}
}
};