mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(payment_methods): make ApplepayPaymentMethod in payment_method_data column of payment_attempt table as json (#4154)
This commit is contained in:
@ -1576,12 +1576,6 @@ pub struct AdditionalCardInfo {
|
|||||||
pub authentication_data: Option<serde_json::Value>,
|
pub authentication_data: Option<serde_json::Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[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 {
|
||||||
@ -1589,7 +1583,9 @@ pub enum AdditionalPaymentData {
|
|||||||
BankRedirect {
|
BankRedirect {
|
||||||
bank_name: Option<api_enums::BankNames>,
|
bank_name: Option<api_enums::BankNames>,
|
||||||
},
|
},
|
||||||
Wallet(Option<Wallets>),
|
Wallet {
|
||||||
|
apple_pay: Option<ApplepayPaymentMethod>,
|
||||||
|
},
|
||||||
PayLater {},
|
PayLater {},
|
||||||
BankTransfer {},
|
BankTransfer {},
|
||||||
Crypto {},
|
Crypto {},
|
||||||
@ -2495,7 +2491,7 @@ where
|
|||||||
| PaymentMethodDataResponse::PayLater {}
|
| PaymentMethodDataResponse::PayLater {}
|
||||||
| PaymentMethodDataResponse::Paypal {}
|
| PaymentMethodDataResponse::Paypal {}
|
||||||
| PaymentMethodDataResponse::Upi {}
|
| PaymentMethodDataResponse::Upi {}
|
||||||
| PaymentMethodDataResponse::Wallet(_)
|
| PaymentMethodDataResponse::Wallet {}
|
||||||
| PaymentMethodDataResponse::BankTransfer {}
|
| PaymentMethodDataResponse::BankTransfer {}
|
||||||
| PaymentMethodDataResponse::Voucher {} => {
|
| PaymentMethodDataResponse::Voucher {} => {
|
||||||
payment_method_data_response.serialize(serializer)
|
payment_method_data_response.serialize(serializer)
|
||||||
@ -2512,7 +2508,7 @@ pub enum PaymentMethodDataResponse {
|
|||||||
#[serde(rename = "card")]
|
#[serde(rename = "card")]
|
||||||
Card(Box<CardResponse>),
|
Card(Box<CardResponse>),
|
||||||
BankTransfer {},
|
BankTransfer {},
|
||||||
Wallet(Option<Wallets>),
|
Wallet {},
|
||||||
PayLater {},
|
PayLater {},
|
||||||
Paypal {},
|
Paypal {},
|
||||||
BankRedirect {},
|
BankRedirect {},
|
||||||
@ -3451,7 +3447,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(wallet) => Self::Wallet(wallet),
|
AdditionalPaymentData::Wallet { .. } => Self::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 {},
|
||||||
|
|||||||
@ -3527,13 +3527,11 @@ pub async fn get_additional_payment_data(
|
|||||||
}
|
}
|
||||||
api_models::payments::PaymentMethodData::Wallet(wallet) => match wallet {
|
api_models::payments::PaymentMethodData::Wallet(wallet) => match wallet {
|
||||||
api_models::payments::WalletData::ApplePay(apple_pay_wallet_data) => {
|
api_models::payments::WalletData::ApplePay(apple_pay_wallet_data) => {
|
||||||
api_models::payments::AdditionalPaymentData::Wallet(Some(
|
api_models::payments::AdditionalPaymentData::Wallet {
|
||||||
api_models::payments::Wallets::ApplePay(
|
apple_pay: Some(apple_pay_wallet_data.payment_method.to_owned()),
|
||||||
apple_pay_wallet_data.payment_method.to_owned(),
|
}
|
||||||
),
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
_ => api_models::payments::AdditionalPaymentData::Wallet(None),
|
_ => api_models::payments::AdditionalPaymentData::Wallet { apple_pay: 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