use serde::{Deserialize, Serialize};
use crate::client::{Client, Response};
use crate::ids::{SetupAttemptId, SetupIntentId};
use crate::params::{Expand, Expandable, List, Object, Paginable, RangeQuery, Timestamp};
use crate::resources::{
Account, ApiErrors, Application, Customer, Mandate, PaymentMethod,
PaymentMethodDetailsCardWalletApplePay, PaymentMethodDetailsCardWalletGooglePay, SetupIntent,
};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttempt {
pub id: SetupAttemptId,
pub application: Option<Expandable<Application>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub attach_to_self: Option<bool>,
pub created: Timestamp,
pub customer: Option<Expandable<Customer>>,
pub flow_directions: Option<Vec<SetupAttemptFlowDirections>>,
pub livemode: bool,
pub on_behalf_of: Option<Expandable<Account>>,
pub payment_method: Expandable<PaymentMethod>,
pub payment_method_details: SetupAttemptPaymentMethodDetails,
pub setup_error: Option<Box<ApiErrors>>,
pub setup_intent: Expandable<SetupIntent>,
pub status: String,
pub usage: String,
}
impl SetupAttempt {
pub fn list(client: &Client, params: &ListSetupAttempts<'_>) -> Response<List<SetupAttempt>> {
client.get_query("/setup_attempts", params)
}
}
impl Object for SetupAttempt {
type Id = SetupAttemptId;
fn id(&self) -> Self::Id {
self.id.clone()
}
fn object(&self) -> &'static str {
"setup_attempt"
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetails {
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<SetupAttemptPaymentMethodDetailsAcssDebit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<SetupAttemptPaymentMethodDetailsAuBecsDebit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<SetupAttemptPaymentMethodDetailsBacsDebit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bancontact: Option<SetupAttemptPaymentMethodDetailsBancontact>,
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<SetupAttemptPaymentMethodDetailsBoleto>,
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<SetupAttemptPaymentMethodDetailsCard>,
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present: Option<SetupAttemptPaymentMethodDetailsCardPresent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp: Option<SetupAttemptPaymentMethodDetailsCashapp>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<SetupAttemptPaymentMethodDetailsIdeal>,
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<SetupAttemptPaymentMethodDetailsKlarna>,
#[serde(skip_serializing_if = "Option::is_none")]
pub link: Option<SetupAttemptPaymentMethodDetailsLink>,
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<SetupAttemptPaymentMethodDetailsPaypal>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<SetupAttemptPaymentMethodDetailsSepaDebit>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<SetupAttemptPaymentMethodDetailsSofort>,
#[serde(rename = "type")]
pub type_: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<SetupAttemptPaymentMethodDetailsUsBankAccount>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsAcssDebit {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsAuBecsDebit {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsBacsDebit {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsBancontact {
pub bank_code: Option<String>,
pub bank_name: Option<String>,
pub bic: Option<String>,
pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
pub iban_last4: Option<String>,
pub preferred_language: Option<SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage>,
pub verified_name: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsBoleto {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsCard {
pub brand: Option<String>,
pub checks: Option<SetupAttemptPaymentMethodDetailsCardChecks>,
pub country: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub exp_month: Option<i64>,
pub exp_year: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub fingerprint: Option<String>,
pub funding: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub iin: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub issuer: Option<String>,
pub last4: Option<String>,
pub network: Option<String>,
pub three_d_secure: Option<ThreeDSecureDetails>,
pub wallet: Option<SetupAttemptPaymentMethodDetailsCardWallet>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsCardChecks {
pub address_line1_check: Option<String>,
pub address_postal_code_check: Option<String>,
pub cvc_check: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsCardPresent {
pub generated_card: Option<Expandable<PaymentMethod>>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsCardWallet {
#[serde(skip_serializing_if = "Option::is_none")]
pub apple_pay: Option<PaymentMethodDetailsCardWalletApplePay>,
#[serde(skip_serializing_if = "Option::is_none")]
pub google_pay: Option<PaymentMethodDetailsCardWalletGooglePay>,
#[serde(rename = "type")]
pub type_: SetupAttemptPaymentMethodDetailsCardWalletType,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsCashapp {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsIdeal {
pub bank: Option<SetupAttemptPaymentMethodDetailsIdealBank>,
pub bic: Option<SetupAttemptPaymentMethodDetailsIdealBic>,
pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
pub iban_last4: Option<String>,
pub verified_name: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsKlarna {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsLink {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsPaypal {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsSepaDebit {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsSofort {
pub bank_code: Option<String>,
pub bank_name: Option<String>,
pub bic: Option<String>,
pub generated_sepa_debit: Option<Expandable<PaymentMethod>>,
pub generated_sepa_debit_mandate: Option<Expandable<Mandate>>,
pub iban_last4: Option<String>,
pub preferred_language: Option<SetupAttemptPaymentMethodDetailsSofortPreferredLanguage>,
pub verified_name: Option<String>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct SetupAttemptPaymentMethodDetailsUsBankAccount {}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ThreeDSecureDetails {
pub authentication_flow: Option<ThreeDSecureDetailsAuthenticationFlow>,
pub electronic_commerce_indicator: Option<ThreeDSecureDetailsElectronicCommerceIndicator>,
pub result: Option<ThreeDSecureDetailsResult>,
pub result_reason: Option<ThreeDSecureDetailsResultReason>,
pub transaction_id: Option<String>,
pub version: Option<ThreeDSecureDetailsVersion>,
}
#[derive(Clone, Debug, Serialize)]
pub struct ListSetupAttempts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub created: Option<RangeQuery<Timestamp>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ending_before: Option<SetupAttemptId>,
#[serde(skip_serializing_if = "Expand::is_empty")]
pub expand: &'a [&'a str],
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<u64>,
pub setup_intent: SetupIntentId,
#[serde(skip_serializing_if = "Option::is_none")]
pub starting_after: Option<SetupAttemptId>,
}
impl<'a> ListSetupAttempts<'a> {
pub fn new(setup_intent: SetupIntentId) -> Self {
ListSetupAttempts {
created: Default::default(),
ending_before: Default::default(),
expand: Default::default(),
limit: Default::default(),
setup_intent,
starting_after: Default::default(),
}
}
}
impl Paginable for ListSetupAttempts<'_> {
type O = SetupAttempt;
fn set_last(&mut self, item: Self::O) {
self.starting_after = Some(item.id());
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SetupAttemptFlowDirections {
Inbound,
Outbound,
}
impl SetupAttemptFlowDirections {
pub fn as_str(self) -> &'static str {
match self {
SetupAttemptFlowDirections::Inbound => "inbound",
SetupAttemptFlowDirections::Outbound => "outbound",
}
}
}
impl AsRef<str> for SetupAttemptFlowDirections {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SetupAttemptFlowDirections {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SetupAttemptFlowDirections {
fn default() -> Self {
Self::Inbound
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
De,
En,
Fr,
Nl,
}
impl SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
pub fn as_str(self) -> &'static str {
match self {
SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::De => "de",
SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::En => "en",
SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::Fr => "fr",
SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage::Nl => "nl",
}
}
}
impl AsRef<str> for SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SetupAttemptPaymentMethodDetailsBancontactPreferredLanguage {
fn default() -> Self {
Self::De
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SetupAttemptPaymentMethodDetailsCardWalletType {
ApplePay,
GooglePay,
Link,
}
impl SetupAttemptPaymentMethodDetailsCardWalletType {
pub fn as_str(self) -> &'static str {
match self {
SetupAttemptPaymentMethodDetailsCardWalletType::ApplePay => "apple_pay",
SetupAttemptPaymentMethodDetailsCardWalletType::GooglePay => "google_pay",
SetupAttemptPaymentMethodDetailsCardWalletType::Link => "link",
}
}
}
impl AsRef<str> for SetupAttemptPaymentMethodDetailsCardWalletType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SetupAttemptPaymentMethodDetailsCardWalletType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SetupAttemptPaymentMethodDetailsCardWalletType {
fn default() -> Self {
Self::ApplePay
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SetupAttemptPaymentMethodDetailsIdealBank {
AbnAmro,
AsnBank,
Bunq,
Handelsbanken,
Ing,
Knab,
Moneyou,
N26,
Nn,
Rabobank,
Regiobank,
Revolut,
SnsBank,
TriodosBank,
VanLanschot,
Yoursafe,
}
impl SetupAttemptPaymentMethodDetailsIdealBank {
pub fn as_str(self) -> &'static str {
match self {
SetupAttemptPaymentMethodDetailsIdealBank::AbnAmro => "abn_amro",
SetupAttemptPaymentMethodDetailsIdealBank::AsnBank => "asn_bank",
SetupAttemptPaymentMethodDetailsIdealBank::Bunq => "bunq",
SetupAttemptPaymentMethodDetailsIdealBank::Handelsbanken => "handelsbanken",
SetupAttemptPaymentMethodDetailsIdealBank::Ing => "ing",
SetupAttemptPaymentMethodDetailsIdealBank::Knab => "knab",
SetupAttemptPaymentMethodDetailsIdealBank::Moneyou => "moneyou",
SetupAttemptPaymentMethodDetailsIdealBank::N26 => "n26",
SetupAttemptPaymentMethodDetailsIdealBank::Nn => "nn",
SetupAttemptPaymentMethodDetailsIdealBank::Rabobank => "rabobank",
SetupAttemptPaymentMethodDetailsIdealBank::Regiobank => "regiobank",
SetupAttemptPaymentMethodDetailsIdealBank::Revolut => "revolut",
SetupAttemptPaymentMethodDetailsIdealBank::SnsBank => "sns_bank",
SetupAttemptPaymentMethodDetailsIdealBank::TriodosBank => "triodos_bank",
SetupAttemptPaymentMethodDetailsIdealBank::VanLanschot => "van_lanschot",
SetupAttemptPaymentMethodDetailsIdealBank::Yoursafe => "yoursafe",
}
}
}
impl AsRef<str> for SetupAttemptPaymentMethodDetailsIdealBank {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SetupAttemptPaymentMethodDetailsIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SetupAttemptPaymentMethodDetailsIdealBank {
fn default() -> Self {
Self::AbnAmro
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SetupAttemptPaymentMethodDetailsIdealBic {
#[serde(rename = "ABNANL2A")]
Abnanl2a,
#[serde(rename = "ASNBNL21")]
Asnbnl21,
#[serde(rename = "BITSNL2A")]
Bitsnl2a,
#[serde(rename = "BUNQNL2A")]
Bunqnl2a,
#[serde(rename = "FVLBNL22")]
Fvlbnl22,
#[serde(rename = "HANDNL2A")]
Handnl2a,
#[serde(rename = "INGBNL2A")]
Ingbnl2a,
#[serde(rename = "KNABNL2H")]
Knabnl2h,
#[serde(rename = "MOYONL21")]
Moyonl21,
#[serde(rename = "NNBANL2G")]
Nnbanl2g,
#[serde(rename = "NTSBDEB1")]
Ntsbdeb1,
#[serde(rename = "RABONL2U")]
Rabonl2u,
#[serde(rename = "RBRBNL21")]
Rbrbnl21,
#[serde(rename = "REVOIE23")]
Revoie23,
#[serde(rename = "REVOLT21")]
Revolt21,
#[serde(rename = "SNSBNL2A")]
Snsbnl2a,
#[serde(rename = "TRIONL2U")]
Trionl2u,
}
impl SetupAttemptPaymentMethodDetailsIdealBic {
pub fn as_str(self) -> &'static str {
match self {
SetupAttemptPaymentMethodDetailsIdealBic::Abnanl2a => "ABNANL2A",
SetupAttemptPaymentMethodDetailsIdealBic::Asnbnl21 => "ASNBNL21",
SetupAttemptPaymentMethodDetailsIdealBic::Bitsnl2a => "BITSNL2A",
SetupAttemptPaymentMethodDetailsIdealBic::Bunqnl2a => "BUNQNL2A",
SetupAttemptPaymentMethodDetailsIdealBic::Fvlbnl22 => "FVLBNL22",
SetupAttemptPaymentMethodDetailsIdealBic::Handnl2a => "HANDNL2A",
SetupAttemptPaymentMethodDetailsIdealBic::Ingbnl2a => "INGBNL2A",
SetupAttemptPaymentMethodDetailsIdealBic::Knabnl2h => "KNABNL2H",
SetupAttemptPaymentMethodDetailsIdealBic::Moyonl21 => "MOYONL21",
SetupAttemptPaymentMethodDetailsIdealBic::Nnbanl2g => "NNBANL2G",
SetupAttemptPaymentMethodDetailsIdealBic::Ntsbdeb1 => "NTSBDEB1",
SetupAttemptPaymentMethodDetailsIdealBic::Rabonl2u => "RABONL2U",
SetupAttemptPaymentMethodDetailsIdealBic::Rbrbnl21 => "RBRBNL21",
SetupAttemptPaymentMethodDetailsIdealBic::Revoie23 => "REVOIE23",
SetupAttemptPaymentMethodDetailsIdealBic::Revolt21 => "REVOLT21",
SetupAttemptPaymentMethodDetailsIdealBic::Snsbnl2a => "SNSBNL2A",
SetupAttemptPaymentMethodDetailsIdealBic::Trionl2u => "TRIONL2U",
}
}
}
impl AsRef<str> for SetupAttemptPaymentMethodDetailsIdealBic {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SetupAttemptPaymentMethodDetailsIdealBic {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SetupAttemptPaymentMethodDetailsIdealBic {
fn default() -> Self {
Self::Abnanl2a
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
De,
En,
Fr,
Nl,
}
impl SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
pub fn as_str(self) -> &'static str {
match self {
SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::De => "de",
SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::En => "en",
SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::Fr => "fr",
SetupAttemptPaymentMethodDetailsSofortPreferredLanguage::Nl => "nl",
}
}
}
impl AsRef<str> for SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for SetupAttemptPaymentMethodDetailsSofortPreferredLanguage {
fn default() -> Self {
Self::De
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ThreeDSecureDetailsAuthenticationFlow {
Challenge,
Frictionless,
}
impl ThreeDSecureDetailsAuthenticationFlow {
pub fn as_str(self) -> &'static str {
match self {
ThreeDSecureDetailsAuthenticationFlow::Challenge => "challenge",
ThreeDSecureDetailsAuthenticationFlow::Frictionless => "frictionless",
}
}
}
impl AsRef<str> for ThreeDSecureDetailsAuthenticationFlow {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ThreeDSecureDetailsAuthenticationFlow {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ThreeDSecureDetailsAuthenticationFlow {
fn default() -> Self {
Self::Challenge
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ThreeDSecureDetailsElectronicCommerceIndicator {
#[serde(rename = "01")]
V01,
#[serde(rename = "02")]
V02,
#[serde(rename = "05")]
V05,
#[serde(rename = "06")]
V06,
#[serde(rename = "07")]
V07,
}
impl ThreeDSecureDetailsElectronicCommerceIndicator {
pub fn as_str(self) -> &'static str {
match self {
ThreeDSecureDetailsElectronicCommerceIndicator::V01 => "01",
ThreeDSecureDetailsElectronicCommerceIndicator::V02 => "02",
ThreeDSecureDetailsElectronicCommerceIndicator::V05 => "05",
ThreeDSecureDetailsElectronicCommerceIndicator::V06 => "06",
ThreeDSecureDetailsElectronicCommerceIndicator::V07 => "07",
}
}
}
impl AsRef<str> for ThreeDSecureDetailsElectronicCommerceIndicator {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ThreeDSecureDetailsElectronicCommerceIndicator {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ThreeDSecureDetailsElectronicCommerceIndicator {
fn default() -> Self {
Self::V01
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ThreeDSecureDetailsResult {
AttemptAcknowledged,
Authenticated,
Exempted,
Failed,
NotSupported,
ProcessingError,
}
impl ThreeDSecureDetailsResult {
pub fn as_str(self) -> &'static str {
match self {
ThreeDSecureDetailsResult::AttemptAcknowledged => "attempt_acknowledged",
ThreeDSecureDetailsResult::Authenticated => "authenticated",
ThreeDSecureDetailsResult::Exempted => "exempted",
ThreeDSecureDetailsResult::Failed => "failed",
ThreeDSecureDetailsResult::NotSupported => "not_supported",
ThreeDSecureDetailsResult::ProcessingError => "processing_error",
}
}
}
impl AsRef<str> for ThreeDSecureDetailsResult {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ThreeDSecureDetailsResult {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ThreeDSecureDetailsResult {
fn default() -> Self {
Self::AttemptAcknowledged
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ThreeDSecureDetailsResultReason {
Abandoned,
Bypassed,
Canceled,
CardNotEnrolled,
NetworkNotSupported,
ProtocolError,
Rejected,
}
impl ThreeDSecureDetailsResultReason {
pub fn as_str(self) -> &'static str {
match self {
ThreeDSecureDetailsResultReason::Abandoned => "abandoned",
ThreeDSecureDetailsResultReason::Bypassed => "bypassed",
ThreeDSecureDetailsResultReason::Canceled => "canceled",
ThreeDSecureDetailsResultReason::CardNotEnrolled => "card_not_enrolled",
ThreeDSecureDetailsResultReason::NetworkNotSupported => "network_not_supported",
ThreeDSecureDetailsResultReason::ProtocolError => "protocol_error",
ThreeDSecureDetailsResultReason::Rejected => "rejected",
}
}
}
impl AsRef<str> for ThreeDSecureDetailsResultReason {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ThreeDSecureDetailsResultReason {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ThreeDSecureDetailsResultReason {
fn default() -> Self {
Self::Abandoned
}
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ThreeDSecureDetailsVersion {
#[serde(rename = "1.0.2")]
V1_0_2,
#[serde(rename = "2.1.0")]
V2_1_0,
#[serde(rename = "2.2.0")]
V2_2_0,
}
impl ThreeDSecureDetailsVersion {
pub fn as_str(self) -> &'static str {
match self {
ThreeDSecureDetailsVersion::V1_0_2 => "1.0.2",
ThreeDSecureDetailsVersion::V2_1_0 => "2.1.0",
ThreeDSecureDetailsVersion::V2_2_0 => "2.2.0",
}
}
}
impl AsRef<str> for ThreeDSecureDetailsVersion {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl std::fmt::Display for ThreeDSecureDetailsVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
self.as_str().fmt(f)
}
}
impl std::default::Default for ThreeDSecureDetailsVersion {
fn default() -> Self {
Self::V1_0_2
}
}