Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api_models): follow naming convention for wallets & paylater payment method data enums #1338

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,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)]
Expand Down Expand Up @@ -789,14 +789,14 @@ 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),
/// 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
Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/connector/aci/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,20 +1057,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,
};
Expand Down Expand Up @@ -1107,12 +1107,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,
})))
Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/connector/stripe/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,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,
Expand Down Expand Up @@ -2472,7 +2472,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,
Expand Down