#[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 PaymentIntentPaymentMethodOptionsUsBankAccount {
pub financial_connections: Option<stripe_shared::LinkedAccountOptionsCommon>,
pub mandate_options: Option<stripe_shared::PaymentMethodOptionsUsBankAccountMandateOptions>,
pub setup_future_usage: Option<PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,
pub target_date: Option<String>,
pub transaction_purpose:
Option<PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose>,
pub verification_method:
Option<PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PaymentIntentPaymentMethodOptionsUsBankAccount").finish_non_exhaustive()
}
}
#[doc(hidden)]
pub struct PaymentIntentPaymentMethodOptionsUsBankAccountBuilder {
financial_connections: Option<Option<stripe_shared::LinkedAccountOptionsCommon>>,
mandate_options: Option<Option<stripe_shared::PaymentMethodOptionsUsBankAccountMandateOptions>>,
setup_future_usage:
Option<Option<PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>>,
target_date: Option<Option<String>>,
transaction_purpose:
Option<Option<PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose>>,
verification_method:
Option<Option<PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>>,
}
#[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 PaymentIntentPaymentMethodOptionsUsBankAccount {
fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
Place::new(out)
}
}
struct Builder<'a> {
out: &'a mut Option<PaymentIntentPaymentMethodOptionsUsBankAccount>,
builder: PaymentIntentPaymentMethodOptionsUsBankAccountBuilder,
}
impl Visitor for Place<PaymentIntentPaymentMethodOptionsUsBankAccount> {
fn map(&mut self) -> Result<Box<dyn Map + '_>> {
Ok(Box::new(Builder {
out: &mut self.out,
builder: PaymentIntentPaymentMethodOptionsUsBankAccountBuilder::deser_default(),
}))
}
}
impl MapBuilder for PaymentIntentPaymentMethodOptionsUsBankAccountBuilder {
type Out = PaymentIntentPaymentMethodOptionsUsBankAccount;
fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
Ok(match k {
"financial_connections" => Deserialize::begin(&mut self.financial_connections),
"mandate_options" => Deserialize::begin(&mut self.mandate_options),
"setup_future_usage" => Deserialize::begin(&mut self.setup_future_usage),
"target_date" => Deserialize::begin(&mut self.target_date),
"transaction_purpose" => Deserialize::begin(&mut self.transaction_purpose),
"verification_method" => Deserialize::begin(&mut self.verification_method),
_ => <dyn Visitor>::ignore(),
})
}
fn deser_default() -> Self {
Self {
financial_connections: Some(None),
mandate_options: Some(None),
setup_future_usage: Some(None),
target_date: Some(None),
transaction_purpose: Some(None),
verification_method: Some(None),
}
}
fn take_out(&mut self) -> Option<Self::Out> {
let (
Some(financial_connections),
Some(mandate_options),
Some(setup_future_usage),
Some(target_date),
Some(transaction_purpose),
Some(verification_method),
) = (
self.financial_connections.take(),
self.mandate_options.take(),
self.setup_future_usage.take(),
self.target_date.take(),
self.transaction_purpose.take(),
self.verification_method.take(),
)
else {
return None;
};
Some(Self::Out {
financial_connections,
mandate_options,
setup_future_usage,
target_date,
transaction_purpose,
verification_method,
})
}
}
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 PaymentIntentPaymentMethodOptionsUsBankAccount {
type Builder = PaymentIntentPaymentMethodOptionsUsBankAccountBuilder;
}
impl FromValueOpt for PaymentIntentPaymentMethodOptionsUsBankAccount {
fn from_value(v: Value) -> Option<Self> {
let Value::Object(obj) = v else {
return None;
};
let mut b = PaymentIntentPaymentMethodOptionsUsBankAccountBuilder::deser_default();
for (k, v) in obj {
match k.as_str() {
"financial_connections" => {
b.financial_connections = FromValueOpt::from_value(v)
}
"mandate_options" => b.mandate_options = FromValueOpt::from_value(v),
"setup_future_usage" => b.setup_future_usage = FromValueOpt::from_value(v),
"target_date" => b.target_date = FromValueOpt::from_value(v),
"transaction_purpose" => b.transaction_purpose = FromValueOpt::from_value(v),
"verification_method" => b.verification_method = FromValueOpt::from_value(v),
_ => {}
}
}
b.take_out()
}
}
};
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
Unknown(String),
}
impl PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
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 PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
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 PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage))
.finish_non_exhaustive()
}
}
#[cfg(feature = "serialize")]
impl serde::Serialize for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
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 PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
crate::Place::new(out)
}
}
impl miniserde::de::Visitor
for crate::Place<PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>
{
fn string(&mut self, s: &str) -> miniserde::Result<()> {
use std::str::FromStr;
self.out = Some(
PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::from_str(s)
.expect("infallible"),
);
Ok(())
}
}
stripe_types::impl_from_val_with_from_str!(
PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
);
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for PaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
{
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"))
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
Goods,
Other,
Services,
Unspecified,
Unknown(String),
}
impl PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
pub fn as_str(&self) -> &str {
use PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match self {
Goods => "goods",
Other => "other",
Services => "services",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match s {
"goods" => Ok(Goods),
"other" => Ok(Other),
"services" => Ok(Services),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
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 PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
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 PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose))
.finish_non_exhaustive()
}
}
#[cfg(feature = "serialize")]
impl serde::Serialize for PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
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 PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
crate::Place::new(out)
}
}
impl miniserde::de::Visitor
for crate::Place<PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose>
{
fn string(&mut self, s: &str) -> miniserde::Result<()> {
use std::str::FromStr;
self.out = Some(
PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::from_str(s)
.expect("infallible"),
);
Ok(())
}
}
stripe_types::impl_from_val_with_from_str!(
PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
);
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for PaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
{
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"))
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
Automatic,
Instant,
Microdeposits,
Unknown(String),
}
impl PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
pub fn as_str(&self) -> &str {
use PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
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 PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
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 PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod))
.finish_non_exhaustive()
}
}
#[cfg(feature = "serialize")]
impl serde::Serialize for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
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 PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
crate::Place::new(out)
}
}
impl miniserde::de::Visitor
for crate::Place<PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>
{
fn string(&mut self, s: &str) -> miniserde::Result<()> {
use std::str::FromStr;
self.out = Some(
PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::from_str(s)
.expect("infallible"),
);
Ok(())
}
}
stripe_types::impl_from_val_with_from_str!(
PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
);
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for PaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
{
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"))
}
}