Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(connector): [multisafepay] Remove Default Case Handling (#2586)

Panagiotis Ganelis7adc6a05b60f
diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs
index a8366fadf8..385c85e0aa 100644
--- a/crates/router/src/connector/multisafepay/transformers.rs
+++ b/crates/router/src/connector/multisafepay/transformers.rs
@@ -229,11 +229,13 @@ impl TryFrom<utils::CardIssuer> for Gateway {
utils::CardIssuer::Maestro => Ok(Self::Maestro),
utils::CardIssuer::Discover => Ok(Self::Discover),
utils::CardIssuer::Visa => Ok(Self::Visa),
- _ => Err(errors::ConnectorError::NotSupported {
- message: issuer.to_string(),
- connector: "Multisafe pay",
+ utils::CardIssuer::DinersClub | utils::CardIssuer::JCB => {
+ Err(errors::ConnectorError::NotSupported {
+ message: issuer.to_string(),
+ connector: "Multisafe pay",
+ }
+ .into())
}
- .into()),
}
}
}
@@ -247,8 +249,31 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MultisafepayPaymentsReques
api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
api::WalletData::GooglePay(_) => Type::Direct,
api::WalletData::PaypalRedirect(_) => Type::Redirect,
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment method".to_string(),
+ api::WalletData::AliPayQr(_)
+ | api::WalletData::AliPayRedirect(_)
+ | api::WalletData::AliPayHkRedirect(_)
+ | api::WalletData::MomoRedirect(_)
+ | api::WalletData::KakaoPayRedirect(_)
+ | api::WalletData::GoPayRedirect(_)
+ | api::WalletData::GcashRedirect(_)
+ | api::WalletData::ApplePay(_)
+ | api::WalletData::ApplePayRedirect(_)
+ | api::WalletData::ApplePayThirdPartySdk(_)
+ | api::WalletData::DanaRedirect {}
+ | api::WalletData::GooglePayRedirect(_)
+ | api::WalletData::GooglePayThirdPartySdk(_)
+ | api::WalletData::MbWayRedirect(_)
+ | api::WalletData::MobilePayRedirect(_)
+ | api::WalletData::PaypalSdk(_)
+ | api::WalletData::SamsungPay(_)
+ | api::WalletData::TwintRedirect {}
+ | api::WalletData::VippsRedirect {}
+ | api::WalletData::TouchNGoRedirect(_)
+ | api::WalletData::WeChatPayRedirect(_)
+ | api::WalletData::WeChatPayQr(_)
+ | api::WalletData::CashappQr(_)
+ | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
},
api::PaymentMethodData::PayLater(ref _paylater) => Type::Redirect,
@@ -262,8 +287,31 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MultisafepayPaymentsReques
api::PaymentMethodData::Wallet(ref wallet_data) => Some(match wallet_data {
api::WalletData::GooglePay(_) => Gateway::Googlepay,
api::WalletData::PaypalRedirect(_) => Gateway::Paypal,
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment method".to_string(),
+ api::WalletData::AliPayQr(_)
+ | api::WalletData::AliPayRedirect(_)
+ | api::WalletData::AliPayHkRedirect(_)
+ | api::WalletData::MomoRedirect(_)
+ | api::WalletData::KakaoPayRedirect(_)
+ | api::WalletData::GoPayRedirect(_)
+ | api::WalletData::GcashRedirect(_)
+ | api::WalletData::ApplePay(_)
+ | api::WalletData::ApplePayRedirect(_)
+ | api::WalletData::ApplePayThirdPartySdk(_)
+ | api::WalletData::DanaRedirect {}
+ | api::WalletData::GooglePayRedirect(_)
+ | api::WalletData::GooglePayThirdPartySdk(_)
+ | api::WalletData::MbWayRedirect(_)
+ | api::WalletData::MobilePayRedirect(_)
+ | api::WalletData::PaypalSdk(_)
+ | api::WalletData::SamsungPay(_)
+ | api::WalletData::TwintRedirect {}
+ | api::WalletData::VippsRedirect {}
+ | api::WalletData::TouchNGoRedirect(_)
+ | api::WalletData::WeChatPayRedirect(_)
+ | api::WalletData::WeChatPayQr(_)
+ | api::WalletData::CashappQr(_)
+ | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
}),
api::PaymentMethodData::PayLater(
@@ -273,8 +321,17 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MultisafepayPaymentsReques
},
) => Some(Gateway::Klarna),
api::PaymentMethodData::MandatePayment => None,
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment method".to_string(),
+ api::PaymentMethodData::CardRedirect(_)
+ | api::PaymentMethodData::PayLater(_)
+ | api::PaymentMethodData::BankRedirect(_)
+ | api::PaymentMethodData::BankDebit(_)
+ | api::PaymentMethodData::BankTransfer(_)
+ | api::PaymentMethodData::Crypto(_)
+ | api::PaymentMethodData::Reward
+ | api::PaymentMethodData::Upi(_)
+ | api::PaymentMethodData::Voucher(_)
+ | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
};
let description = item.get_description()?;
@@ -354,8 +411,31 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MultisafepayPaymentsReques
})))
}
api::WalletData::PaypalRedirect(_) => None,
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment method".to_string(),
+ api::WalletData::AliPayQr(_)
+ | api::WalletData::AliPayRedirect(_)
+ | api::WalletData::AliPayHkRedirect(_)
+ | api::WalletData::MomoRedirect(_)
+ | api::WalletData::KakaoPayRedirect(_)
+ | api::WalletData::GoPayRedirect(_)
+ | api::WalletData::GcashRedirect(_)
+ | api::WalletData::ApplePay(_)
+ | api::WalletData::ApplePayRedirect(_)
+ | api::WalletData::ApplePayThirdPartySdk(_)
+ | api::WalletData::DanaRedirect {}
+ | api::WalletData::GooglePayRedirect(_)
+ | api::WalletData::GooglePayThirdPartySdk(_)
+ | api::WalletData::MbWayRedirect(_)
+ | api::WalletData::MobilePayRedirect(_)
+ | api::WalletData::PaypalSdk(_)
+ | api::WalletData::SamsungPay(_)
+ | api::WalletData::TwintRedirect {}
+ | api::WalletData::VippsRedirect {}
+ | api::WalletData::TouchNGoRedirect(_)
+ | api::WalletData::WeChatPayRedirect(_)
+ | api::WalletData::WeChatPayQr(_)
+ | api::WalletData::CashappQr(_)
+ | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
},
api::PaymentMethodData::PayLater(ref paylater) => {
@@ -365,15 +445,36 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MultisafepayPaymentsReques
billing_email,
..
} => billing_email.clone(),
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment method".to_string(),
- ))?,
+ api_models::payments::PayLaterData::KlarnaSdk { token: _ }
+ | api_models::payments::PayLaterData::AffirmRedirect {}
+ | api_models::payments::PayLaterData::AfterpayClearpayRedirect {
+ billing_email: _,
+ billing_name: _,
+ }
+ | api_models::payments::PayLaterData::PayBrightRedirect {}
+ | api_models::payments::PayLaterData::WalleyRedirect {}
+ | api_models::payments::PayLaterData::AlmaRedirect {}
+ | api_models::payments::PayLaterData::AtomeRedirect {} => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message(
+ "multisafepay",
+ ),
+ ))?
+ }
}),
}))
}
api::PaymentMethodData::MandatePayment => None,
- _ => Err(errors::ConnectorError::NotImplemented(
- "Payment method".to_string(),
+ api::PaymentMethodData::CardRedirect(_)
+ | api::PaymentMethodData::BankRedirect(_)
+ | api::PaymentMethodData::BankDebit(_)
+ | api::PaymentMethodData::BankTransfer(_)
+ | api::PaymentMethodData::Crypto(_)
+ | api::PaymentMethodData::Reward
+ | api::PaymentMethodData::Upi(_)
+ | api::PaymentMethodData::Voucher(_)
+ | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
};