mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
refactor(router): store ApplepayPaymentMethod in payment_method_data column of payment_attempt table (#3940)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1359,6 +1359,12 @@ pub struct AdditionalCardInfo {
|
|||||||
pub card_holder_name: Option<Secret<String>>,
|
pub card_holder_name: Option<Secret<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum Wallets {
|
||||||
|
ApplePay(ApplepayPaymentMethod),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum AdditionalPaymentData {
|
pub enum AdditionalPaymentData {
|
||||||
@ -1366,7 +1372,7 @@ pub enum AdditionalPaymentData {
|
|||||||
BankRedirect {
|
BankRedirect {
|
||||||
bank_name: Option<api_enums::BankNames>,
|
bank_name: Option<api_enums::BankNames>,
|
||||||
},
|
},
|
||||||
Wallet {},
|
Wallet(Option<Wallets>),
|
||||||
PayLater {},
|
PayLater {},
|
||||||
BankTransfer {},
|
BankTransfer {},
|
||||||
Crypto {},
|
Crypto {},
|
||||||
@ -1939,7 +1945,7 @@ pub enum PaymentMethodDataResponse {
|
|||||||
#[serde(rename = "card")]
|
#[serde(rename = "card")]
|
||||||
Card(Box<CardResponse>),
|
Card(Box<CardResponse>),
|
||||||
BankTransfer {},
|
BankTransfer {},
|
||||||
Wallet {},
|
Wallet(Option<Wallets>),
|
||||||
PayLater {},
|
PayLater {},
|
||||||
Paypal {},
|
Paypal {},
|
||||||
BankRedirect {},
|
BankRedirect {},
|
||||||
@ -2868,7 +2874,7 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
|
|||||||
match payment_method_data {
|
match payment_method_data {
|
||||||
AdditionalPaymentData::Card(card) => Self::Card(Box::new(CardResponse::from(*card))),
|
AdditionalPaymentData::Card(card) => Self::Card(Box::new(CardResponse::from(*card))),
|
||||||
AdditionalPaymentData::PayLater {} => Self::PayLater {},
|
AdditionalPaymentData::PayLater {} => Self::PayLater {},
|
||||||
AdditionalPaymentData::Wallet {} => Self::Wallet {},
|
AdditionalPaymentData::Wallet(wallet) => Self::Wallet(wallet),
|
||||||
AdditionalPaymentData::BankRedirect { .. } => Self::BankRedirect {},
|
AdditionalPaymentData::BankRedirect { .. } => Self::BankRedirect {},
|
||||||
AdditionalPaymentData::Crypto {} => Self::Crypto {},
|
AdditionalPaymentData::Crypto {} => Self::Crypto {},
|
||||||
AdditionalPaymentData::BankDebit {} => Self::BankDebit {},
|
AdditionalPaymentData::BankDebit {} => Self::BankDebit {},
|
||||||
|
|||||||
@ -3448,9 +3448,16 @@ pub async fn get_additional_payment_data(
|
|||||||
_ => api_models::payments::AdditionalPaymentData::BankRedirect { bank_name: None },
|
_ => api_models::payments::AdditionalPaymentData::BankRedirect { bank_name: None },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
api_models::payments::PaymentMethodData::Wallet(_) => {
|
api_models::payments::PaymentMethodData::Wallet(wallet) => match wallet {
|
||||||
api_models::payments::AdditionalPaymentData::Wallet {}
|
api_models::payments::WalletData::ApplePay(apple_pay_wallet_data) => {
|
||||||
}
|
api_models::payments::AdditionalPaymentData::Wallet(Some(
|
||||||
|
api_models::payments::Wallets::ApplePay(
|
||||||
|
apple_pay_wallet_data.payment_method.to_owned(),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
_ => api_models::payments::AdditionalPaymentData::Wallet(None),
|
||||||
|
},
|
||||||
api_models::payments::PaymentMethodData::PayLater(_) => {
|
api_models::payments::PaymentMethodData::PayLater(_) => {
|
||||||
api_models::payments::AdditionalPaymentData::PayLater {}
|
api_models::payments::AdditionalPaymentData::PayLater {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user