#[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 PaymentMethodDetailsCard {
pub amount_authorized: Option<i64>,
pub authorization_code: Option<String>,
pub brand: Option<String>,
pub capture_before: Option<stripe_types::Timestamp>,
pub checks: Option<stripe_shared::PaymentMethodDetailsCardChecks>,
pub country: Option<String>,
pub description: Option<String>,
pub exp_month: i64,
pub exp_year: i64,
pub extended_authorization: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesExtendedAuthorizationExtendedAuthorization>,
pub fingerprint: Option<String>,
pub funding: Option<String>,
pub iin: Option<String>,
pub incremental_authorization: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesIncrementalAuthorizationIncrementalAuthorization>,
pub installments: Option<stripe_shared::PaymentMethodDetailsCardInstallments>,
pub issuer: Option<String>,
pub last4: Option<String>,
pub mandate: Option<String>,
pub moto: Option<bool>,
pub multicapture: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceMulticapture>,
pub network: Option<String>,
pub network_token: Option<stripe_shared::PaymentMethodDetailsCardNetworkToken>,
pub network_transaction_id: Option<String>,
pub overcapture: Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesOvercaptureOvercapture>,
pub regulated_status: Option<PaymentMethodDetailsCardRegulatedStatus>,
pub three_d_secure: Option<stripe_shared::ThreeDSecureDetailsCharge>,
pub wallet: Option<stripe_shared::PaymentMethodDetailsCardWallet>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for PaymentMethodDetailsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PaymentMethodDetailsCard").finish_non_exhaustive()
}
}
#[doc(hidden)]
pub struct PaymentMethodDetailsCardBuilder {
amount_authorized: Option<Option<i64>>,
authorization_code: Option<Option<String>>,
brand: Option<Option<String>>,
capture_before: Option<Option<stripe_types::Timestamp>>,
checks: Option<Option<stripe_shared::PaymentMethodDetailsCardChecks>>,
country: Option<Option<String>>,
description: Option<Option<String>>,
exp_month: Option<i64>,
exp_year: Option<i64>,
extended_authorization: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesExtendedAuthorizationExtendedAuthorization>>,
fingerprint: Option<Option<String>>,
funding: Option<Option<String>>,
iin: Option<Option<String>>,
incremental_authorization: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesIncrementalAuthorizationIncrementalAuthorization>>,
installments: Option<Option<stripe_shared::PaymentMethodDetailsCardInstallments>>,
issuer: Option<Option<String>>,
last4: Option<Option<String>>,
mandate: Option<Option<String>>,
moto: Option<Option<bool>>,
multicapture: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceMulticapture>>,
network: Option<Option<String>>,
network_token: Option<Option<stripe_shared::PaymentMethodDetailsCardNetworkToken>>,
network_transaction_id: Option<Option<String>>,
overcapture: Option<Option<stripe_shared::PaymentFlowsPrivatePaymentMethodsCardDetailsApiResourceEnterpriseFeaturesOvercaptureOvercapture>>,
regulated_status: Option<Option<PaymentMethodDetailsCardRegulatedStatus>>,
three_d_secure: Option<Option<stripe_shared::ThreeDSecureDetailsCharge>>,
wallet: Option<Option<stripe_shared::PaymentMethodDetailsCardWallet>>,
}
#[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 PaymentMethodDetailsCard {
fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
Place::new(out)
}
}
struct Builder<'a> {
out: &'a mut Option<PaymentMethodDetailsCard>,
builder: PaymentMethodDetailsCardBuilder,
}
impl Visitor for Place<PaymentMethodDetailsCard> {
fn map(&mut self) -> Result<Box<dyn Map + '_>> {
Ok(Box::new(Builder {
out: &mut self.out,
builder: PaymentMethodDetailsCardBuilder::deser_default(),
}))
}
}
impl MapBuilder for PaymentMethodDetailsCardBuilder {
type Out = PaymentMethodDetailsCard;
fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
Ok(match k {
"amount_authorized" => Deserialize::begin(&mut self.amount_authorized),
"authorization_code" => Deserialize::begin(&mut self.authorization_code),
"brand" => Deserialize::begin(&mut self.brand),
"capture_before" => Deserialize::begin(&mut self.capture_before),
"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),
"extended_authorization" => Deserialize::begin(&mut self.extended_authorization),
"fingerprint" => Deserialize::begin(&mut self.fingerprint),
"funding" => Deserialize::begin(&mut self.funding),
"iin" => Deserialize::begin(&mut self.iin),
"incremental_authorization" => {
Deserialize::begin(&mut self.incremental_authorization)
}
"installments" => Deserialize::begin(&mut self.installments),
"issuer" => Deserialize::begin(&mut self.issuer),
"last4" => Deserialize::begin(&mut self.last4),
"mandate" => Deserialize::begin(&mut self.mandate),
"moto" => Deserialize::begin(&mut self.moto),
"multicapture" => Deserialize::begin(&mut self.multicapture),
"network" => Deserialize::begin(&mut self.network),
"network_token" => Deserialize::begin(&mut self.network_token),
"network_transaction_id" => Deserialize::begin(&mut self.network_transaction_id),
"overcapture" => Deserialize::begin(&mut self.overcapture),
"regulated_status" => Deserialize::begin(&mut self.regulated_status),
"three_d_secure" => Deserialize::begin(&mut self.three_d_secure),
"wallet" => Deserialize::begin(&mut self.wallet),
_ => <dyn Visitor>::ignore(),
})
}
fn deser_default() -> Self {
Self {
amount_authorized: Some(None),
authorization_code: Some(None),
brand: Some(None),
capture_before: Some(None),
checks: Some(None),
country: Some(None),
description: Some(None),
exp_month: None,
exp_year: None,
extended_authorization: Some(None),
fingerprint: Some(None),
funding: Some(None),
iin: Some(None),
incremental_authorization: Some(None),
installments: Some(None),
issuer: Some(None),
last4: Some(None),
mandate: Some(None),
moto: Some(None),
multicapture: Some(None),
network: Some(None),
network_token: Some(None),
network_transaction_id: Some(None),
overcapture: Some(None),
regulated_status: Some(None),
three_d_secure: Some(None),
wallet: Some(None),
}
}
fn take_out(&mut self) -> Option<Self::Out> {
let (
Some(amount_authorized),
Some(authorization_code),
Some(brand),
Some(capture_before),
Some(checks),
Some(country),
Some(description),
Some(exp_month),
Some(exp_year),
Some(extended_authorization),
Some(fingerprint),
Some(funding),
Some(iin),
Some(incremental_authorization),
Some(installments),
Some(issuer),
Some(last4),
Some(mandate),
Some(moto),
Some(multicapture),
Some(network),
Some(network_token),
Some(network_transaction_id),
Some(overcapture),
Some(regulated_status),
Some(three_d_secure),
Some(wallet),
) = (
self.amount_authorized,
self.authorization_code.take(),
self.brand.take(),
self.capture_before,
self.checks.take(),
self.country.take(),
self.description.take(),
self.exp_month,
self.exp_year,
self.extended_authorization.take(),
self.fingerprint.take(),
self.funding.take(),
self.iin.take(),
self.incremental_authorization.take(),
self.installments.take(),
self.issuer.take(),
self.last4.take(),
self.mandate.take(),
self.moto,
self.multicapture.take(),
self.network.take(),
self.network_token,
self.network_transaction_id.take(),
self.overcapture.take(),
self.regulated_status.take(),
self.three_d_secure.take(),
self.wallet.take(),
)
else {
return None;
};
Some(Self::Out {
amount_authorized,
authorization_code,
brand,
capture_before,
checks,
country,
description,
exp_month,
exp_year,
extended_authorization,
fingerprint,
funding,
iin,
incremental_authorization,
installments,
issuer,
last4,
mandate,
moto,
multicapture,
network,
network_token,
network_transaction_id,
overcapture,
regulated_status,
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 PaymentMethodDetailsCard {
type Builder = PaymentMethodDetailsCardBuilder;
}
impl FromValueOpt for PaymentMethodDetailsCard {
fn from_value(v: Value) -> Option<Self> {
let Value::Object(obj) = v else {
return None;
};
let mut b = PaymentMethodDetailsCardBuilder::deser_default();
for (k, v) in obj {
match k.as_str() {
"amount_authorized" => b.amount_authorized = FromValueOpt::from_value(v),
"authorization_code" => b.authorization_code = FromValueOpt::from_value(v),
"brand" => b.brand = FromValueOpt::from_value(v),
"capture_before" => b.capture_before = 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),
"extended_authorization" => {
b.extended_authorization = 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),
"incremental_authorization" => {
b.incremental_authorization = FromValueOpt::from_value(v)
}
"installments" => b.installments = FromValueOpt::from_value(v),
"issuer" => b.issuer = FromValueOpt::from_value(v),
"last4" => b.last4 = FromValueOpt::from_value(v),
"mandate" => b.mandate = FromValueOpt::from_value(v),
"moto" => b.moto = FromValueOpt::from_value(v),
"multicapture" => b.multicapture = FromValueOpt::from_value(v),
"network" => b.network = FromValueOpt::from_value(v),
"network_token" => b.network_token = FromValueOpt::from_value(v),
"network_transaction_id" => {
b.network_transaction_id = FromValueOpt::from_value(v)
}
"overcapture" => b.overcapture = FromValueOpt::from_value(v),
"regulated_status" => b.regulated_status = 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()
}
}
};
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PaymentMethodDetailsCardRegulatedStatus {
Regulated,
Unregulated,
Unknown(String),
}
impl PaymentMethodDetailsCardRegulatedStatus {
pub fn as_str(&self) -> &str {
use PaymentMethodDetailsCardRegulatedStatus::*;
match self {
Regulated => "regulated",
Unregulated => "unregulated",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for PaymentMethodDetailsCardRegulatedStatus {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use PaymentMethodDetailsCardRegulatedStatus::*;
match s {
"regulated" => Ok(Regulated),
"unregulated" => Ok(Unregulated),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"PaymentMethodDetailsCardRegulatedStatus"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for PaymentMethodDetailsCardRegulatedStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for PaymentMethodDetailsCardRegulatedStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for PaymentMethodDetailsCardRegulatedStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(PaymentMethodDetailsCardRegulatedStatus)).finish_non_exhaustive()
}
}
#[cfg(feature = "serialize")]
impl serde::Serialize for PaymentMethodDetailsCardRegulatedStatus {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl miniserde::Deserialize for PaymentMethodDetailsCardRegulatedStatus {
fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
crate::Place::new(out)
}
}
impl miniserde::de::Visitor for crate::Place<PaymentMethodDetailsCardRegulatedStatus> {
fn string(&mut self, s: &str) -> miniserde::Result<()> {
use std::str::FromStr;
self.out = Some(PaymentMethodDetailsCardRegulatedStatus::from_str(s).expect("infallible"));
Ok(())
}
}
stripe_types::impl_from_val_with_from_str!(PaymentMethodDetailsCardRegulatedStatus);
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for PaymentMethodDetailsCardRegulatedStatus {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}