mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(revert): populate payment method details in payments response (#5785)
This commit is contained in:
@ -3,7 +3,7 @@ use std::{
|
||||
fmt,
|
||||
num::NonZeroI64,
|
||||
};
|
||||
pub mod additional_info;
|
||||
|
||||
use cards::CardNumber;
|
||||
use common_utils::{
|
||||
consts::default_payments_list_limit,
|
||||
@ -2026,8 +2026,6 @@ pub enum AdditionalPaymentData {
|
||||
Card(Box<AdditionalCardInfo>),
|
||||
BankRedirect {
|
||||
bank_name: Option<common_enums::BankNames>,
|
||||
#[serde(flatten)]
|
||||
additional_details: Option<additional_info::BankRedirectDetails>,
|
||||
},
|
||||
Wallet {
|
||||
apple_pay: Option<ApplepayPaymentMethod>,
|
||||
@ -2035,18 +2033,18 @@ pub enum AdditionalPaymentData {
|
||||
PayLater {
|
||||
klarna_sdk: Option<KlarnaSdkPaymentMethod>,
|
||||
},
|
||||
BankTransfer(additional_info::BankTransferAdditionalData),
|
||||
Crypto(CryptoData),
|
||||
BankDebit(additional_info::BankDebitAdditionalData),
|
||||
BankTransfer {},
|
||||
Crypto {},
|
||||
BankDebit {},
|
||||
MandatePayment {},
|
||||
Reward {},
|
||||
RealTimePayment(RealTimePaymentData),
|
||||
Upi(additional_info::UpiAdditionalData),
|
||||
GiftCard(additional_info::GiftCardAdditionalData),
|
||||
Voucher(VoucherData),
|
||||
CardRedirect(CardRedirectData),
|
||||
CardToken(additional_info::CardTokenAdditionalData),
|
||||
OpenBanking(OpenBankingData),
|
||||
RealTimePayment {},
|
||||
Upi {},
|
||||
GiftCard {},
|
||||
Voucher {},
|
||||
CardRedirect {},
|
||||
CardToken {},
|
||||
OpenBanking {},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||
@ -3013,21 +3011,21 @@ where
|
||||
{
|
||||
match payment_method_data {
|
||||
PaymentMethodDataResponse::Reward {} => serializer.serialize_str("reward"),
|
||||
PaymentMethodDataResponse::BankDebit(_)
|
||||
| PaymentMethodDataResponse::BankRedirect(_)
|
||||
PaymentMethodDataResponse::BankDebit {}
|
||||
| PaymentMethodDataResponse::BankRedirect {}
|
||||
| PaymentMethodDataResponse::Card(_)
|
||||
| PaymentMethodDataResponse::CardRedirect(_)
|
||||
| PaymentMethodDataResponse::CardToken(_)
|
||||
| PaymentMethodDataResponse::Crypto(_)
|
||||
| PaymentMethodDataResponse::CardRedirect {}
|
||||
| PaymentMethodDataResponse::CardToken {}
|
||||
| PaymentMethodDataResponse::Crypto {}
|
||||
| PaymentMethodDataResponse::MandatePayment {}
|
||||
| PaymentMethodDataResponse::GiftCard(_)
|
||||
| PaymentMethodDataResponse::GiftCard {}
|
||||
| PaymentMethodDataResponse::PayLater(_)
|
||||
| PaymentMethodDataResponse::RealTimePayment(_)
|
||||
| PaymentMethodDataResponse::Upi(_)
|
||||
| PaymentMethodDataResponse::RealTimePayment {}
|
||||
| PaymentMethodDataResponse::Upi {}
|
||||
| PaymentMethodDataResponse::Wallet {}
|
||||
| PaymentMethodDataResponse::BankTransfer(_)
|
||||
| PaymentMethodDataResponse::OpenBanking(_)
|
||||
| PaymentMethodDataResponse::Voucher(_) => {
|
||||
| PaymentMethodDataResponse::BankTransfer {}
|
||||
| PaymentMethodDataResponse::OpenBanking {}
|
||||
| PaymentMethodDataResponse::Voucher {} => {
|
||||
payment_method_data_response.serialize(serializer)
|
||||
}
|
||||
}
|
||||
@ -3043,28 +3041,23 @@ where
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PaymentMethodDataResponse {
|
||||
#[serde(rename = "card")]
|
||||
Card(Box<CardResponse>),
|
||||
#[schema(value_type = BankTransferAdditionalData)]
|
||||
BankTransfer(additional_info::BankTransferAdditionalData),
|
||||
BankTransfer {},
|
||||
Wallet {},
|
||||
PayLater(Box<PaylaterResponse>),
|
||||
#[schema(value_type = BankRedirectAdditionalData)]
|
||||
BankRedirect(additional_info::BankRedirectAdditionalData),
|
||||
Crypto(CryptoData),
|
||||
#[schema(value_type = BankDebitAdditionalData)]
|
||||
BankDebit(additional_info::BankDebitAdditionalData),
|
||||
BankRedirect {},
|
||||
Crypto {},
|
||||
BankDebit {},
|
||||
MandatePayment {},
|
||||
Reward {},
|
||||
RealTimePayment(RealTimePaymentData),
|
||||
#[schema(value_type = UpiAdditionalData)]
|
||||
Upi(additional_info::UpiAdditionalData),
|
||||
Voucher(VoucherData),
|
||||
#[schema(value_type = GiftCardAdditionalData)]
|
||||
GiftCard(additional_info::GiftCardAdditionalData),
|
||||
CardRedirect(CardRedirectData),
|
||||
#[schema(value_type = CardTokenAdditionalData)]
|
||||
CardToken(additional_info::CardTokenAdditionalData),
|
||||
OpenBanking(OpenBankingData),
|
||||
RealTimePayment {},
|
||||
Upi {},
|
||||
Voucher {},
|
||||
GiftCard {},
|
||||
CardRedirect {},
|
||||
CardToken {},
|
||||
OpenBanking {},
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -4306,27 +4299,19 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
|
||||
None => Self::PayLater(Box::new(PaylaterResponse { klarna_sdk: None })),
|
||||
},
|
||||
AdditionalPaymentData::Wallet { .. } => Self::Wallet {},
|
||||
AdditionalPaymentData::BankRedirect {
|
||||
bank_name,
|
||||
additional_details,
|
||||
} => Self::BankRedirect(additional_info::BankRedirectAdditionalData {
|
||||
bank_name,
|
||||
additional_details,
|
||||
}),
|
||||
AdditionalPaymentData::Crypto(crypto) => Self::Crypto(crypto),
|
||||
AdditionalPaymentData::BankDebit(bank_debit) => Self::BankDebit(bank_debit),
|
||||
AdditionalPaymentData::BankRedirect { .. } => Self::BankRedirect {},
|
||||
AdditionalPaymentData::Crypto {} => Self::Crypto {},
|
||||
AdditionalPaymentData::BankDebit {} => Self::BankDebit {},
|
||||
AdditionalPaymentData::MandatePayment {} => Self::MandatePayment {},
|
||||
AdditionalPaymentData::Reward {} => Self::Reward {},
|
||||
AdditionalPaymentData::RealTimePayment(realtime_payment) => {
|
||||
Self::RealTimePayment(realtime_payment)
|
||||
}
|
||||
AdditionalPaymentData::Upi(upi) => Self::Upi(upi),
|
||||
AdditionalPaymentData::BankTransfer(bank_transfer) => Self::BankTransfer(bank_transfer),
|
||||
AdditionalPaymentData::Voucher(voucher) => Self::Voucher(voucher),
|
||||
AdditionalPaymentData::GiftCard(gift_card) => Self::GiftCard(gift_card),
|
||||
AdditionalPaymentData::CardRedirect(card_redirect) => Self::CardRedirect(card_redirect),
|
||||
AdditionalPaymentData::CardToken(card_token) => Self::CardToken(card_token),
|
||||
AdditionalPaymentData::OpenBanking(open_banking) => Self::OpenBanking(open_banking),
|
||||
AdditionalPaymentData::RealTimePayment {} => Self::RealTimePayment {},
|
||||
AdditionalPaymentData::Upi {} => Self::Upi {},
|
||||
AdditionalPaymentData::BankTransfer {} => Self::BankTransfer {},
|
||||
AdditionalPaymentData::Voucher {} => Self::Voucher {},
|
||||
AdditionalPaymentData::GiftCard {} => Self::GiftCard {},
|
||||
AdditionalPaymentData::CardRedirect {} => Self::CardRedirect {},
|
||||
AdditionalPaymentData::CardToken {} => Self::CardToken {},
|
||||
AdditionalPaymentData::OpenBanking {} => Self::OpenBanking {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,220 +0,0 @@
|
||||
use common_utils::pii::{self};
|
||||
use masking::{
|
||||
masked_string::{MaskedBankAccount, MaskedIban, MaskedRoutingNumber, MaskedSortCode},
|
||||
Secret,
|
||||
};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::enums as api_enums;
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BankDebitAdditionalData {
|
||||
Ach(Box<AchBankDebitAdditionalData>),
|
||||
Bacs(Box<BacsBankDebitAdditionalData>),
|
||||
Becs(Box<BecsBankDebitAdditionalData>),
|
||||
Sepa(Box<SepaBankDebitAdditionalData>),
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct AchBankDebitAdditionalData {
|
||||
/// Partially masked account number for ach bank debit payment
|
||||
#[schema(value_type = String, example = "0001****3456")]
|
||||
pub account_number: Secret<MaskedBankAccount>,
|
||||
|
||||
/// Partially masked routing number for ach bank debit payment
|
||||
#[schema(value_type = String, example = "110***000")]
|
||||
pub routing_number: Secret<MaskedRoutingNumber>,
|
||||
|
||||
/// Bank account's owner name
|
||||
#[schema(value_type = Option<String>, example = "John Doe")]
|
||||
pub bank_account_holder_name: Option<Secret<String>>,
|
||||
|
||||
/// Name of the bank
|
||||
#[schema(value_type = Option<BankNames>, example = "ach")]
|
||||
pub bank_name: Option<common_enums::BankNames>,
|
||||
|
||||
/// Bank account type
|
||||
#[schema(value_type = Option<BankType>, example = "checking")]
|
||||
pub bank_type: Option<common_enums::BankType>,
|
||||
|
||||
/// Bank holder entity type
|
||||
#[schema(value_type = Option<BankHolderType>, example = "personal")]
|
||||
pub bank_holder_type: Option<common_enums::BankHolderType>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct BacsBankDebitAdditionalData {
|
||||
/// Partially masked account number for Bacs payment method
|
||||
#[schema(value_type = String, example = "0001****3456")]
|
||||
pub account_number: Secret<MaskedBankAccount>,
|
||||
|
||||
/// Partially masked sort code for Bacs payment method
|
||||
#[schema(value_type = String, example = "108800")]
|
||||
pub sort_code: Secret<MaskedSortCode>,
|
||||
|
||||
/// Bank account's owner name
|
||||
#[schema(value_type = Option<String>, example = "John Doe")]
|
||||
pub bank_account_holder_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct BecsBankDebitAdditionalData {
|
||||
/// Partially masked account number for Becs payment method
|
||||
#[schema(value_type = String, example = "0001****3456")]
|
||||
pub account_number: Secret<MaskedBankAccount>,
|
||||
|
||||
/// Bank-State-Branch (bsb) number
|
||||
#[schema(value_type = String, example = "000000")]
|
||||
pub bsb_number: Secret<String>,
|
||||
|
||||
/// Bank account's owner name
|
||||
#[schema(value_type = Option<String>, example = "John Doe")]
|
||||
pub bank_account_holder_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct SepaBankDebitAdditionalData {
|
||||
/// Partially masked international bank account number (iban) for SEPA
|
||||
#[schema(value_type = String, example = "DE8937******013000")]
|
||||
pub iban: Secret<MaskedIban>,
|
||||
|
||||
/// Bank account's owner name
|
||||
#[schema(value_type = Option<String>, example = "John Doe")]
|
||||
pub bank_account_holder_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case", tag = "type")]
|
||||
pub struct BankRedirectAdditionalData {
|
||||
/// Name of the bank
|
||||
#[schema(value_type = Option<BankNames>)]
|
||||
pub bank_name: Option<common_enums::BankNames>,
|
||||
#[serde(flatten)]
|
||||
pub additional_details: Option<BankRedirectDetails>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub enum BankRedirectDetails {
|
||||
BancontactCard(Box<BancontactBankRedirectAdditionalData>),
|
||||
Blik(Box<BlikBankRedirectAdditionalData>),
|
||||
Giropay(Box<GiropayBankRedirectAdditionalData>),
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct BancontactBankRedirectAdditionalData {
|
||||
/// Last 4 digits of the card number
|
||||
#[schema(value_type = Option<String>, example = "4242")]
|
||||
pub last4: Option<String>,
|
||||
|
||||
/// The card's expiry month
|
||||
#[schema(value_type = Option<String>, example = "12")]
|
||||
pub card_exp_month: Option<Secret<String>>,
|
||||
|
||||
/// The card's expiry year
|
||||
#[schema(value_type = Option<String>, example = "24")]
|
||||
pub card_exp_year: Option<Secret<String>>,
|
||||
|
||||
/// The card holder's name
|
||||
#[schema(value_type = Option<String>, example = "John Test")]
|
||||
pub card_holder_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct BlikBankRedirectAdditionalData {
|
||||
#[schema(value_type = Option<String>, example = "3GD9MO")]
|
||||
pub blik_code: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct GiropayBankRedirectAdditionalData {
|
||||
#[schema(value_type = Option<String>)]
|
||||
/// Masked bank account bic code
|
||||
pub bic: Option<Secret<MaskedSortCode>>,
|
||||
|
||||
/// Partially masked international bank account number (iban) for SEPA
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub iban: Option<Secret<MaskedIban>>,
|
||||
|
||||
/// Country for bank payment
|
||||
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
|
||||
pub country: Option<api_enums::CountryAlpha2>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BankTransferAdditionalData {
|
||||
Ach {},
|
||||
Sepa {},
|
||||
Bacs {},
|
||||
Multibanco {},
|
||||
Permata {},
|
||||
Bca {},
|
||||
BniVa {},
|
||||
BriVa {},
|
||||
CimbVa {},
|
||||
DanamonVa {},
|
||||
MandiriVa {},
|
||||
Pix(Box<PixBankTransferAdditionalData>),
|
||||
Pse {},
|
||||
LocalBankTransfer(Box<LocalBankTransferAdditionalData>),
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct PixBankTransferAdditionalData {
|
||||
/// Partially masked unique key for pix transfer
|
||||
#[schema(value_type = Option<String>, example = "a1f4102e ****** 6fa48899c1d1")]
|
||||
pub pix_key: Option<Secret<MaskedBankAccount>>,
|
||||
|
||||
/// Partially masked CPF - CPF is a Brazilian tax identification number
|
||||
#[schema(value_type = Option<String>, example = "**** 124689")]
|
||||
pub cpf: Option<Secret<MaskedBankAccount>>,
|
||||
|
||||
/// Partially masked CNPJ - CNPJ is a Brazilian company tax identification number
|
||||
#[schema(value_type = Option<String>, example = "**** 417312")]
|
||||
pub cnpj: Option<Secret<MaskedBankAccount>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct LocalBankTransferAdditionalData {
|
||||
/// Partially masked bank code
|
||||
#[schema(value_type = Option<String>, example = "**** OA2312")]
|
||||
pub bank_code: Option<Secret<MaskedBankAccount>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum GiftCardAdditionalData {
|
||||
Givex(Box<GivexGiftCardAdditionalData>),
|
||||
PaySafeCard {},
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct GivexGiftCardAdditionalData {
|
||||
/// Last 4 digits of the gift card number
|
||||
#[schema(value_type = String, example = "4242")]
|
||||
pub last4: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct CardTokenAdditionalData {
|
||||
/// The card holder's name
|
||||
#[schema(value_type = String, example = "John Test")]
|
||||
pub card_holder_name: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum UpiAdditionalData {
|
||||
UpiCollect(Box<UpiCollectAdditionalData>),
|
||||
#[schema(value_type = UpiIntentData)]
|
||||
UpiIntent(Box<super::UpiIntentData>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpiCollectAdditionalData {
|
||||
/// Masked VPA ID
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub vpa_id: Option<Secret<String, pii::UpiVpaMaskingStrategy>>,
|
||||
}
|
||||
@ -1,13 +1,10 @@
|
||||
use api_models::payments::{additional_info as payment_additional_types, ExtendedCardInfo};
|
||||
use api_models::payments::ExtendedCardInfo;
|
||||
use common_enums::enums as api_enums;
|
||||
use common_utils::{
|
||||
id_type,
|
||||
pii::{self, Email},
|
||||
};
|
||||
use masking::{
|
||||
masked_string::{MaskedBankAccount, MaskedIban, MaskedRoutingNumber, MaskedSortCode},
|
||||
PeekInterface, Secret,
|
||||
};
|
||||
use masking::Secret;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::Date;
|
||||
|
||||
@ -584,17 +581,6 @@ impl From<api_models::payments::CardRedirectData> for CardRedirectData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CardRedirectData> for api_models::payments::CardRedirectData {
|
||||
fn from(value: CardRedirectData) -> Self {
|
||||
match value {
|
||||
CardRedirectData::Knet {} => Self::Knet {},
|
||||
CardRedirectData::Benefit {} => Self::Benefit {},
|
||||
CardRedirectData::MomoAtm {} => Self::MomoAtm {},
|
||||
CardRedirectData::CardRedirect {} => Self::CardRedirect {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::WalletData> for WalletData {
|
||||
fn from(value: api_models::payments::WalletData) -> Self {
|
||||
match value {
|
||||
@ -814,19 +800,6 @@ impl From<api_models::payments::CryptoData> for CryptoData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CryptoData> for api_models::payments::CryptoData {
|
||||
fn from(value: CryptoData) -> Self {
|
||||
let CryptoData {
|
||||
pay_currency,
|
||||
network,
|
||||
} = value;
|
||||
Self {
|
||||
pay_currency,
|
||||
network,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::UpiData> for UpiData {
|
||||
fn from(value: api_models::payments::UpiData) -> Self {
|
||||
match value {
|
||||
@ -838,19 +811,6 @@ impl From<api_models::payments::UpiData> for UpiData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<UpiData> for api_models::payments::additional_info::UpiAdditionalData {
|
||||
fn from(value: UpiData) -> Self {
|
||||
match value {
|
||||
UpiData::UpiCollect(upi) => Self::UpiCollect(Box::new(
|
||||
payment_additional_types::UpiCollectAdditionalData { vpa_id: upi.vpa_id },
|
||||
)),
|
||||
UpiData::UpiIntent(_) => {
|
||||
Self::UpiIntent(Box::new(api_models::payments::UpiIntentData {}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::VoucherData> for VoucherData {
|
||||
fn from(value: api_models::payments::VoucherData) -> Self {
|
||||
match value {
|
||||
@ -882,66 +842,6 @@ impl From<api_models::payments::VoucherData> for VoucherData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<BoletoVoucherData>> for Box<api_models::payments::BoletoVoucherData> {
|
||||
fn from(value: Box<BoletoVoucherData>) -> Self {
|
||||
Self::new(api_models::payments::BoletoVoucherData {
|
||||
social_security_number: value.social_security_number,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<AlfamartVoucherData>> for Box<api_models::payments::AlfamartVoucherData> {
|
||||
fn from(_value: Box<AlfamartVoucherData>) -> Self {
|
||||
Self::new(api_models::payments::AlfamartVoucherData {
|
||||
first_name: None,
|
||||
last_name: None,
|
||||
email: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<IndomaretVoucherData>> for Box<api_models::payments::IndomaretVoucherData> {
|
||||
fn from(_value: Box<IndomaretVoucherData>) -> Self {
|
||||
Self::new(api_models::payments::IndomaretVoucherData {
|
||||
first_name: None,
|
||||
last_name: None,
|
||||
email: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<JCSVoucherData>> for Box<api_models::payments::JCSVoucherData> {
|
||||
fn from(_value: Box<JCSVoucherData>) -> Self {
|
||||
Self::new(api_models::payments::JCSVoucherData {
|
||||
first_name: None,
|
||||
last_name: None,
|
||||
email: None,
|
||||
phone_number: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VoucherData> for api_models::payments::VoucherData {
|
||||
fn from(value: VoucherData) -> Self {
|
||||
match value {
|
||||
VoucherData::Boleto(boleto_data) => Self::Boleto(boleto_data.into()),
|
||||
VoucherData::Alfamart(alfa_mart) => Self::Alfamart(alfa_mart.into()),
|
||||
VoucherData::Indomaret(info_maret) => Self::Indomaret(info_maret.into()),
|
||||
VoucherData::SevenEleven(jcs_data)
|
||||
| VoucherData::Lawson(jcs_data)
|
||||
| VoucherData::MiniStop(jcs_data)
|
||||
| VoucherData::FamilyMart(jcs_data)
|
||||
| VoucherData::Seicomart(jcs_data)
|
||||
| VoucherData::PayEasy(jcs_data) => Self::SevenEleven(jcs_data.into()),
|
||||
VoucherData::Efecty => Self::Efecty,
|
||||
VoucherData::PagoEfectivo => Self::PagoEfectivo,
|
||||
VoucherData::RedCompra => Self::RedCompra,
|
||||
VoucherData::RedPagos => Self::RedPagos,
|
||||
VoucherData::Oxxo => Self::Oxxo,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::GiftCardData> for GiftCardData {
|
||||
fn from(value: api_models::payments::GiftCardData) -> Self {
|
||||
match value {
|
||||
@ -954,29 +854,6 @@ impl From<api_models::payments::GiftCardData> for GiftCardData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GiftCardData> for payment_additional_types::GiftCardAdditionalData {
|
||||
fn from(value: GiftCardData) -> Self {
|
||||
match value {
|
||||
GiftCardData::Givex(details) => Self::Givex(Box::new(
|
||||
payment_additional_types::GivexGiftCardAdditionalData {
|
||||
last4: details
|
||||
.number
|
||||
.peek()
|
||||
.chars()
|
||||
.rev()
|
||||
.take(4)
|
||||
.collect::<String>()
|
||||
.chars()
|
||||
.rev()
|
||||
.collect::<String>()
|
||||
.into(),
|
||||
},
|
||||
)),
|
||||
GiftCardData::PaySafeCard {} => Self::PaySafeCard {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::CardToken> for CardToken {
|
||||
fn from(value: api_models::payments::CardToken) -> Self {
|
||||
let api_models::payments::CardToken {
|
||||
@ -990,15 +867,6 @@ impl From<api_models::payments::CardToken> for CardToken {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CardToken> for payment_additional_types::CardTokenAdditionalData {
|
||||
fn from(value: CardToken) -> Self {
|
||||
let CardToken {
|
||||
card_holder_name, ..
|
||||
} = value;
|
||||
Self { card_holder_name }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::BankDebitData> for BankDebitData {
|
||||
fn from(value: api_models::payments::BankDebitData) -> Self {
|
||||
match value {
|
||||
@ -1039,65 +907,6 @@ impl From<api_models::payments::BankDebitData> for BankDebitData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BankDebitData> for api_models::payments::additional_info::BankDebitAdditionalData {
|
||||
fn from(value: BankDebitData) -> Self {
|
||||
match value {
|
||||
BankDebitData::AchBankDebit {
|
||||
account_number,
|
||||
routing_number,
|
||||
bank_name,
|
||||
bank_type,
|
||||
bank_holder_type,
|
||||
} => Self::Ach(Box::new(
|
||||
payment_additional_types::AchBankDebitAdditionalData {
|
||||
account_number: Secret::from(MaskedBankAccount::from(
|
||||
account_number.peek().to_owned(),
|
||||
)),
|
||||
routing_number: Secret::from(MaskedRoutingNumber::from(
|
||||
routing_number.peek().to_owned(),
|
||||
)),
|
||||
bank_name,
|
||||
bank_type,
|
||||
bank_holder_type,
|
||||
bank_account_holder_name: None,
|
||||
},
|
||||
)),
|
||||
BankDebitData::SepaBankDebit { iban, .. } => Self::Sepa(Box::new(
|
||||
payment_additional_types::SepaBankDebitAdditionalData {
|
||||
iban: Secret::from(MaskedIban::from(iban.peek().to_owned())),
|
||||
bank_account_holder_name: None,
|
||||
},
|
||||
)),
|
||||
BankDebitData::BecsBankDebit {
|
||||
account_number,
|
||||
bsb_number,
|
||||
..
|
||||
} => Self::Becs(Box::new(
|
||||
payment_additional_types::BecsBankDebitAdditionalData {
|
||||
account_number: Secret::from(MaskedBankAccount::from(
|
||||
account_number.peek().to_owned(),
|
||||
)),
|
||||
bsb_number,
|
||||
bank_account_holder_name: None,
|
||||
},
|
||||
)),
|
||||
BankDebitData::BacsBankDebit {
|
||||
account_number,
|
||||
sort_code,
|
||||
..
|
||||
} => Self::Bacs(Box::new(
|
||||
payment_additional_types::BacsBankDebitAdditionalData {
|
||||
account_number: Secret::from(MaskedBankAccount::from(
|
||||
account_number.peek().to_owned(),
|
||||
)),
|
||||
sort_code: Secret::from(MaskedSortCode::from(sort_code.peek().to_owned())),
|
||||
bank_account_holder_name: None,
|
||||
},
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::BankTransferData> for BankTransferData {
|
||||
fn from(value: api_models::payments::BankTransferData) -> Self {
|
||||
match value {
|
||||
@ -1145,42 +954,6 @@ impl From<api_models::payments::BankTransferData> for BankTransferData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BankTransferData> for api_models::payments::additional_info::BankTransferAdditionalData {
|
||||
fn from(value: BankTransferData) -> Self {
|
||||
match value {
|
||||
BankTransferData::AchBankTransfer {} => Self::Ach {},
|
||||
BankTransferData::SepaBankTransfer {} => Self::Sepa {},
|
||||
BankTransferData::BacsBankTransfer {} => Self::Bacs {},
|
||||
BankTransferData::MultibancoBankTransfer {} => Self::Multibanco {},
|
||||
BankTransferData::PermataBankTransfer {} => Self::Permata {},
|
||||
BankTransferData::BcaBankTransfer {} => Self::Bca {},
|
||||
BankTransferData::BniVaBankTransfer {} => Self::BniVa {},
|
||||
BankTransferData::BriVaBankTransfer {} => Self::BriVa {},
|
||||
BankTransferData::CimbVaBankTransfer {} => Self::CimbVa {},
|
||||
BankTransferData::DanamonVaBankTransfer {} => Self::DanamonVa {},
|
||||
BankTransferData::MandiriVaBankTransfer {} => Self::MandiriVa {},
|
||||
BankTransferData::Pix { pix_key, cpf, cnpj } => Self::Pix(Box::new(
|
||||
api_models::payments::additional_info::PixBankTransferAdditionalData {
|
||||
pix_key: pix_key.map(|pix_key| {
|
||||
Secret::from(MaskedBankAccount::from(pix_key.peek().to_owned()))
|
||||
}),
|
||||
cpf: cpf
|
||||
.map(|cpf| Secret::from(MaskedBankAccount::from(cpf.peek().to_owned()))),
|
||||
cnpj: cnpj
|
||||
.map(|cnpj| Secret::from(MaskedBankAccount::from(cnpj.peek().to_owned()))),
|
||||
},
|
||||
)),
|
||||
BankTransferData::Pse {} => Self::Pse {},
|
||||
BankTransferData::LocalBankTransfer { bank_code } => Self::LocalBankTransfer(Box::new(
|
||||
api_models::payments::additional_info::LocalBankTransferAdditionalData {
|
||||
bank_code: bank_code
|
||||
.map(|bank_code| Secret::from(MaskedBankAccount::from(bank_code))),
|
||||
},
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::RealTimePaymentData> for RealTimePaymentData {
|
||||
fn from(value: api_models::payments::RealTimePaymentData) -> Self {
|
||||
match value {
|
||||
@ -1192,17 +965,6 @@ impl From<api_models::payments::RealTimePaymentData> for RealTimePaymentData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<RealTimePaymentData> for api_models::payments::RealTimePaymentData {
|
||||
fn from(value: RealTimePaymentData) -> Self {
|
||||
match value {
|
||||
RealTimePaymentData::Fps {} => Self::Fps {},
|
||||
RealTimePaymentData::DuitNow {} => Self::DuitNow {},
|
||||
RealTimePaymentData::PromptPay {} => Self::PromptPay {},
|
||||
RealTimePaymentData::VietQr {} => Self::VietQr {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<api_models::payments::OpenBankingData> for OpenBankingData {
|
||||
fn from(value: api_models::payments::OpenBankingData) -> Self {
|
||||
match value {
|
||||
@ -1211,14 +973,6 @@ impl From<api_models::payments::OpenBankingData> for OpenBankingData {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<OpenBankingData> for api_models::payments::OpenBankingData {
|
||||
fn from(value: OpenBankingData) -> Self {
|
||||
match value {
|
||||
OpenBankingData::OpenBankingPIS {} => Self::OpenBankingPIS {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct TokenizedCardValue1 {
|
||||
|
||||
@ -33,12 +33,8 @@ mod bytes;
|
||||
#[cfg(feature = "bytes")]
|
||||
pub use self::bytes::SecretBytesMut;
|
||||
|
||||
#[cfg(all(feature = "alloc", feature = "serde"))]
|
||||
pub mod masked_string;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
mod string;
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
mod vec;
|
||||
|
||||
|
||||
@ -1,100 +0,0 @@
|
||||
//!
|
||||
//! Secret truncated strings
|
||||
//!
|
||||
//! Using type aliases for truncating and masking different types of string values.
|
||||
|
||||
use alloc::string::{String, ToString};
|
||||
|
||||
use super::SerializableSecret;
|
||||
|
||||
/// Function for masking alphanumeric characters in a string
|
||||
/// examples
|
||||
/// Sort Code
|
||||
/// (12-34-56, 2, 2) -> 12-**-56
|
||||
/// Routing number
|
||||
/// (026009593, 3, 3) -> 026***593
|
||||
/// CNPJ
|
||||
/// (12345678901, 4, 4) -> 1234***8901
|
||||
/// Pix key
|
||||
/// (123e-a452-1243-1244-000, 4, 4) -> 123e-****-****-****-000
|
||||
/// IBAN
|
||||
/// (AL35202111090000000001234567, 5, 5) -> AL352******************34567
|
||||
fn apply_mask(val: &str, unmasked_char_count: usize, min_masked_char_count: usize) -> String {
|
||||
let len = val.len();
|
||||
if len <= unmasked_char_count {
|
||||
return val.to_string();
|
||||
}
|
||||
|
||||
let mask_start_index =
|
||||
// For showing only last `unmasked_char_count` characters
|
||||
if len < (unmasked_char_count * 2 + min_masked_char_count) {
|
||||
0
|
||||
// For showing first and last `unmasked_char_count` characters
|
||||
} else {
|
||||
unmasked_char_count
|
||||
};
|
||||
let mask_end_index = len - unmasked_char_count - 1;
|
||||
|
||||
val.chars()
|
||||
.enumerate()
|
||||
.fold(String::new(), |mut acc, (index, ch)| {
|
||||
if ch.is_alphanumeric() && (mask_start_index..=mask_end_index).contains(&index) {
|
||||
acc.push('*');
|
||||
} else {
|
||||
acc.push(ch);
|
||||
}
|
||||
acc
|
||||
})
|
||||
}
|
||||
|
||||
/// Masked sort code
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct MaskedSortCode(pub String);
|
||||
|
||||
impl SerializableSecret for MaskedSortCode {}
|
||||
impl From<String> for MaskedSortCode {
|
||||
fn from(src: String) -> Self {
|
||||
let masked_value = apply_mask(src.as_ref(), 2, 2);
|
||||
Self(masked_value)
|
||||
}
|
||||
}
|
||||
|
||||
/// Masked Routing number
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct MaskedRoutingNumber(pub String);
|
||||
|
||||
impl SerializableSecret for MaskedRoutingNumber {}
|
||||
impl From<String> for MaskedRoutingNumber {
|
||||
fn from(src: String) -> Self {
|
||||
let masked_value = apply_mask(src.as_ref(), 3, 3);
|
||||
Self(masked_value)
|
||||
}
|
||||
}
|
||||
|
||||
/// Masked bank account
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct MaskedBankAccount(pub String);
|
||||
|
||||
impl SerializableSecret for MaskedBankAccount {}
|
||||
impl From<String> for MaskedBankAccount {
|
||||
fn from(src: String) -> Self {
|
||||
let masked_value = apply_mask(src.as_ref(), 4, 4);
|
||||
Self(masked_value)
|
||||
}
|
||||
}
|
||||
|
||||
/// Masked IBAN
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct MaskedIban(pub String);
|
||||
|
||||
impl SerializableSecret for MaskedIban {}
|
||||
impl From<String> for MaskedIban {
|
||||
fn from(src: String) -> Self {
|
||||
let masked_value = apply_mask(src.as_ref(), 5, 5);
|
||||
Self(masked_value)
|
||||
}
|
||||
}
|
||||
@ -250,8 +250,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::enums::MandateStatus,
|
||||
api_models::enums::PaymentExperience,
|
||||
api_models::enums::BankNames,
|
||||
api_models::enums::BankType,
|
||||
api_models::enums::BankHolderType,
|
||||
api_models::enums::CardNetwork,
|
||||
api_models::enums::DisputeStage,
|
||||
api_models::enums::DisputeStatus,
|
||||
@ -572,24 +570,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::CustomerDetailsResponse,
|
||||
api_models::payments::OpenBankingData,
|
||||
api_models::payments::OpenBankingSessionToken,
|
||||
api_models::payments::additional_info::CardTokenAdditionalData,
|
||||
api_models::payments::additional_info::BankDebitAdditionalData,
|
||||
api_models::payments::additional_info::AchBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::BacsBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::BecsBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::SepaBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::BankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::BankRedirectDetails,
|
||||
api_models::payments::additional_info::BancontactBankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::BlikBankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::GiropayBankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::BankTransferAdditionalData,
|
||||
api_models::payments::additional_info::PixBankTransferAdditionalData,
|
||||
api_models::payments::additional_info::LocalBankTransferAdditionalData,
|
||||
api_models::payments::additional_info::GiftCardAdditionalData,
|
||||
api_models::payments::additional_info::GivexGiftCardAdditionalData,
|
||||
api_models::payments::additional_info::UpiAdditionalData,
|
||||
api_models::payments::additional_info::UpiCollectAdditionalData,
|
||||
)),
|
||||
modifiers(&SecurityAddon)
|
||||
)]
|
||||
|
||||
@ -167,8 +167,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::enums::MandateStatus,
|
||||
api_models::enums::PaymentExperience,
|
||||
api_models::enums::BankNames,
|
||||
api_models::enums::BankType,
|
||||
api_models::enums::BankHolderType,
|
||||
api_models::enums::CardNetwork,
|
||||
api_models::enums::DisputeStage,
|
||||
api_models::enums::DisputeStatus,
|
||||
@ -488,24 +486,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::CustomerDetailsResponse,
|
||||
api_models::payments::OpenBankingData,
|
||||
api_models::payments::OpenBankingSessionToken,
|
||||
api_models::payments::additional_info::CardTokenAdditionalData,
|
||||
api_models::payments::additional_info::BankDebitAdditionalData,
|
||||
api_models::payments::additional_info::AchBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::BacsBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::BecsBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::SepaBankDebitAdditionalData,
|
||||
api_models::payments::additional_info::BankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::BankRedirectDetails,
|
||||
api_models::payments::additional_info::BancontactBankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::BlikBankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::GiropayBankRedirectAdditionalData,
|
||||
api_models::payments::additional_info::BankTransferAdditionalData,
|
||||
api_models::payments::additional_info::PixBankTransferAdditionalData,
|
||||
api_models::payments::additional_info::LocalBankTransferAdditionalData,
|
||||
api_models::payments::additional_info::GiftCardAdditionalData,
|
||||
api_models::payments::additional_info::GivexGiftCardAdditionalData,
|
||||
api_models::payments::additional_info::UpiAdditionalData,
|
||||
api_models::payments::additional_info::UpiCollectAdditionalData,
|
||||
)),
|
||||
modifiers(&SecurityAddon)
|
||||
)]
|
||||
|
||||
@ -4,10 +4,7 @@ use std::{borrow::Cow, str::FromStr};
|
||||
use api_models::customers::CustomerRequestWithEmail;
|
||||
use api_models::{
|
||||
mandates::RecurringDetails,
|
||||
payments::{
|
||||
additional_info as payment_additional_types, AddressDetailsWithPhone,
|
||||
RequestSurchargeDetails,
|
||||
},
|
||||
payments::{AddressDetailsWithPhone, RequestSurchargeDetails},
|
||||
};
|
||||
use base64::Engine;
|
||||
use common_enums::ConnectorType;
|
||||
@ -34,10 +31,7 @@ use hyperswitch_domain_models::{
|
||||
};
|
||||
use hyperswitch_interfaces::integrity::{CheckIntegrity, FlowIntegrity, GetIntegrityObject};
|
||||
use josekit::jwe;
|
||||
use masking::{
|
||||
masked_string::{MaskedIban, MaskedSortCode},
|
||||
ExposeInterface, PeekInterface,
|
||||
};
|
||||
use masking::{ExposeInterface, PeekInterface};
|
||||
use openssl::{
|
||||
derive::Deriver,
|
||||
pkey::PKey,
|
||||
@ -4000,67 +3994,16 @@ pub async fn get_additional_payment_data(
|
||||
domain::BankRedirectData::Eps { bank_name, .. } => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankRedirect {
|
||||
bank_name: bank_name.to_owned(),
|
||||
additional_details: None,
|
||||
})
|
||||
}
|
||||
domain::BankRedirectData::Ideal { bank_name, .. } => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankRedirect {
|
||||
bank_name: bank_name.to_owned(),
|
||||
additional_details: None,
|
||||
})
|
||||
}
|
||||
domain::BankRedirectData::BancontactCard {
|
||||
card_number,
|
||||
card_exp_month,
|
||||
card_exp_year,
|
||||
} => Some(api_models::payments::AdditionalPaymentData::BankRedirect {
|
||||
bank_name: None,
|
||||
additional_details: Some(
|
||||
payment_additional_types::BankRedirectDetails::BancontactCard(Box::new(
|
||||
payment_additional_types::BancontactBankRedirectAdditionalData {
|
||||
last4: card_number.as_ref().map(|c| c.get_last4()),
|
||||
card_exp_month: card_exp_month.clone(),
|
||||
card_exp_year: card_exp_year.clone(),
|
||||
card_holder_name: None,
|
||||
},
|
||||
)),
|
||||
),
|
||||
}),
|
||||
domain::BankRedirectData::Blik { blik_code } => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankRedirect {
|
||||
bank_name: None,
|
||||
additional_details: blik_code.as_ref().map(|blik_code| {
|
||||
payment_additional_types::BankRedirectDetails::Blik(Box::new(
|
||||
payment_additional_types::BlikBankRedirectAdditionalData {
|
||||
blik_code: Some(blik_code.to_owned()),
|
||||
},
|
||||
))
|
||||
}),
|
||||
})
|
||||
_ => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankRedirect { bank_name: None })
|
||||
}
|
||||
domain::BankRedirectData::Giropay {
|
||||
bank_account_bic,
|
||||
bank_account_iban,
|
||||
} => Some(api_models::payments::AdditionalPaymentData::BankRedirect {
|
||||
bank_name: None,
|
||||
additional_details: Some(payment_additional_types::BankRedirectDetails::Giropay(
|
||||
Box::new(
|
||||
payment_additional_types::GiropayBankRedirectAdditionalData {
|
||||
bic: bank_account_bic.as_ref().map(|bic| {
|
||||
masking::Secret::from(MaskedSortCode::from(bic.peek().to_owned()))
|
||||
}),
|
||||
iban: bank_account_iban.as_ref().map(|iban| {
|
||||
masking::Secret::from(MaskedIban::from(iban.peek().to_owned()))
|
||||
}),
|
||||
country: None,
|
||||
},
|
||||
),
|
||||
)),
|
||||
}),
|
||||
_ => Some(api_models::payments::AdditionalPaymentData::BankRedirect {
|
||||
bank_name: None,
|
||||
additional_details: None,
|
||||
}),
|
||||
},
|
||||
domain::PaymentMethodData::Wallet(wallet) => match wallet {
|
||||
domain::WalletData::ApplePay(apple_pay_wallet_data) => {
|
||||
@ -4077,49 +4020,41 @@ pub async fn get_additional_payment_data(
|
||||
domain::PaymentMethodData::PayLater(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::PayLater { klarna_sdk: None })
|
||||
}
|
||||
domain::PaymentMethodData::BankTransfer(bank_transfer) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankTransfer(
|
||||
(*(bank_transfer.to_owned())).into(),
|
||||
))
|
||||
domain::PaymentMethodData::BankTransfer(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankTransfer {})
|
||||
}
|
||||
domain::PaymentMethodData::Crypto(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::Crypto {})
|
||||
}
|
||||
domain::PaymentMethodData::BankDebit(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::BankDebit {})
|
||||
}
|
||||
domain::PaymentMethodData::Crypto(crypto) => Some(
|
||||
api_models::payments::AdditionalPaymentData::Crypto(crypto.to_owned().into()),
|
||||
),
|
||||
domain::PaymentMethodData::BankDebit(bank_debit) => Some(
|
||||
api_models::payments::AdditionalPaymentData::BankDebit(bank_debit.to_owned().into()),
|
||||
),
|
||||
domain::PaymentMethodData::MandatePayment => {
|
||||
Some(api_models::payments::AdditionalPaymentData::MandatePayment {})
|
||||
}
|
||||
domain::PaymentMethodData::Reward => {
|
||||
Some(api_models::payments::AdditionalPaymentData::Reward {})
|
||||
}
|
||||
domain::PaymentMethodData::RealTimePayment(realtime_payment) => Some(
|
||||
api_models::payments::AdditionalPaymentData::RealTimePayment(
|
||||
(*(realtime_payment.to_owned())).into(),
|
||||
),
|
||||
),
|
||||
domain::PaymentMethodData::Upi(upi) => Some(
|
||||
api_models::payments::AdditionalPaymentData::Upi(upi.to_owned().into()),
|
||||
),
|
||||
domain::PaymentMethodData::CardRedirect(card_redirect) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::CardRedirect(
|
||||
card_redirect.to_owned().into(),
|
||||
))
|
||||
domain::PaymentMethodData::RealTimePayment(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::RealTimePayment {})
|
||||
}
|
||||
domain::PaymentMethodData::Voucher(voucher) => Some(
|
||||
api_models::payments::AdditionalPaymentData::Voucher(voucher.to_owned().into()),
|
||||
),
|
||||
domain::PaymentMethodData::GiftCard(gift_card) => Some(
|
||||
api_models::payments::AdditionalPaymentData::GiftCard((*(gift_card.to_owned())).into()),
|
||||
),
|
||||
domain::PaymentMethodData::CardToken(card_token) => Some(
|
||||
api_models::payments::AdditionalPaymentData::CardToken(card_token.to_owned().into()),
|
||||
),
|
||||
domain::PaymentMethodData::OpenBanking(open_banking) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::OpenBanking(
|
||||
open_banking.to_owned().into(),
|
||||
))
|
||||
domain::PaymentMethodData::Upi(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::Upi {})
|
||||
}
|
||||
domain::PaymentMethodData::CardRedirect(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::CardRedirect {})
|
||||
}
|
||||
domain::PaymentMethodData::Voucher(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::Voucher {})
|
||||
}
|
||||
domain::PaymentMethodData::GiftCard(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::GiftCard {})
|
||||
}
|
||||
domain::PaymentMethodData::CardToken(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::CardToken {})
|
||||
}
|
||||
domain::PaymentMethodData::OpenBanking(_) => {
|
||||
Some(api_models::payments::AdditionalPaymentData::OpenBanking {})
|
||||
}
|
||||
domain::PaymentMethodData::NetworkToken(_) => None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user