mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
refactor(api_models): follow naming convention for wallets & paylater payment method data enums (#1338)
Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
@ -504,8 +504,8 @@ pub enum PayLaterData {
|
||||
#[schema(value_type = String)]
|
||||
billing_name: Secret<String>,
|
||||
},
|
||||
PayBright {},
|
||||
Walley {},
|
||||
PayBrightRedirect {},
|
||||
WalleyRedirect {},
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)]
|
||||
@ -809,16 +809,16 @@ pub struct BankDebitBilling {
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum WalletData {
|
||||
/// The wallet data for Ali Pay redirect
|
||||
AliPay(AliPayRedirection),
|
||||
AliPayRedirect(AliPayRedirection),
|
||||
/// The wallet data for Apple pay
|
||||
ApplePay(ApplePayWalletData),
|
||||
/// Wallet data for apple pay redirect flow
|
||||
ApplePayRedirect(Box<ApplePayRedirectData>),
|
||||
/// The wallet data for Google pay
|
||||
GooglePay(GooglePayWalletData),
|
||||
MbWay(Box<MbWayRedirection>),
|
||||
MbWayRedirect(Box<MbWayRedirection>),
|
||||
/// The wallet data for MobilePay redirect
|
||||
MobilePay(Box<MobilePayRedirection>),
|
||||
MobilePayRedirect(Box<MobilePayRedirection>),
|
||||
/// This is for paypal redirection
|
||||
PaypalRedirect(PaypalRedirection),
|
||||
/// The wallet data for Paypal
|
||||
|
||||
@ -158,14 +158,14 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
|
||||
})),
|
||||
api::PaymentMethodData::PayLater(_) => PaymentDetails::Klarna,
|
||||
api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
|
||||
api_models::payments::WalletData::MbWay(data) => {
|
||||
api_models::payments::WalletData::MbWayRedirect(data) => {
|
||||
PaymentDetails::Wallet(Box::new(WalletPMData {
|
||||
payment_brand: PaymentBrand::Mbway,
|
||||
account_id: Some(data.telephone_number.clone()),
|
||||
shopper_result_url: item.request.router_return_url.clone(),
|
||||
}))
|
||||
}
|
||||
api_models::payments::WalletData::AliPay { .. } => {
|
||||
api_models::payments::WalletData::AliPayRedirect { .. } => {
|
||||
PaymentDetails::Wallet(Box::new(WalletPMData {
|
||||
payment_brand: PaymentBrand::AliPay,
|
||||
account_id: None,
|
||||
|
||||
@ -1121,20 +1121,20 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
|
||||
};
|
||||
Ok(AdyenPaymentMethod::AdyenPaypal(Box::new(wallet)))
|
||||
}
|
||||
api_models::payments::WalletData::AliPay(_) => {
|
||||
api_models::payments::WalletData::AliPayRedirect(_) => {
|
||||
let alipay_data = AliPayData {
|
||||
payment_type: PaymentType::Alipay,
|
||||
};
|
||||
Ok(AdyenPaymentMethod::AliPay(Box::new(alipay_data)))
|
||||
}
|
||||
api_models::payments::WalletData::MbWay(data) => {
|
||||
api_models::payments::WalletData::MbWayRedirect(data) => {
|
||||
let mbway_data = MbwayData {
|
||||
payment_type: PaymentType::Mbway,
|
||||
telephone_number: data.telephone_number.clone(),
|
||||
};
|
||||
Ok(AdyenPaymentMethod::Mbway(Box::new(mbway_data)))
|
||||
}
|
||||
api_models::payments::WalletData::MobilePay(_) => {
|
||||
api_models::payments::WalletData::MobilePayRedirect(_) => {
|
||||
let data = MobilePayData {
|
||||
payment_type: PaymentType::MobilePay,
|
||||
};
|
||||
@ -1171,12 +1171,12 @@ impl<'a> TryFrom<&api::PayLaterData> for AdyenPaymentMethod<'a> {
|
||||
payment_type: PaymentType::Afterpaytouch,
|
||||
})))
|
||||
}
|
||||
api_models::payments::PayLaterData::PayBright { .. } => {
|
||||
api_models::payments::PayLaterData::PayBrightRedirect { .. } => {
|
||||
Ok(AdyenPaymentMethod::PayBright(Box::new(PayBrightData {
|
||||
payment_type: PaymentType::PayBright,
|
||||
})))
|
||||
}
|
||||
api_models::payments::PayLaterData::Walley { .. } => {
|
||||
api_models::payments::PayLaterData::WalleyRedirect { .. } => {
|
||||
Ok(AdyenPaymentMethod::Walley(Box::new(WalleyData {
|
||||
payment_type: PaymentType::Walley,
|
||||
})))
|
||||
|
||||
@ -1042,7 +1042,7 @@ fn create_stripe_payment_method(
|
||||
StripePaymentMethodType::Wechatpay,
|
||||
StripeBillingAddress::default(),
|
||||
)),
|
||||
payments::WalletData::AliPay(_) => Ok((
|
||||
payments::WalletData::AliPayRedirect(_) => Ok((
|
||||
StripePaymentMethodData::Wallet(StripeWallet::AlipayPayment(AlipayPayment {
|
||||
payment_method_types: StripePaymentMethodType::Alipay,
|
||||
payment_method_data_type: StripePaymentMethodType::Alipay,
|
||||
@ -2513,7 +2513,7 @@ impl
|
||||
});
|
||||
Ok(Self::Wallet(wallet_info))
|
||||
}
|
||||
payments::WalletData::AliPay(_) => {
|
||||
payments::WalletData::AliPayRedirect(_) => {
|
||||
let wallet_info = StripeWallet::AlipayPayment(AlipayPayment {
|
||||
payment_method_types: StripePaymentMethodType::Alipay,
|
||||
payment_method_data_type: StripePaymentMethodType::Alipay,
|
||||
|
||||
Reference in New Issue
Block a user