From 35494ed7b5f18e78f83ac96fce494373e38c015f Mon Sep 17 00:00:00 2001 From: oscar2d2 Date: Sat, 11 Nov 2023 11:24:16 -0800 Subject: [PATCH] Revert "refractor: change payment error message from not supported to not implemented" This reverts commit 7965aaf8411a1b905b3f4c864bac30839889ba83. --- .../src/connector/adyen/transformers.rs | 44 +++---- .../src/connector/cryptopay/transformers.rs | 7 +- .../src/connector/forte/transformers.rs | 7 +- .../router/src/connector/nmi/transformers.rs | 14 ++- .../router/src/connector/noon/transformers.rs | 14 ++- .../src/connector/payeezy/transformers.rs | 14 ++- .../src/connector/paypal/transformers.rs | 77 +++++++----- .../src/connector/powertranz/transformers.rs | 7 +- .../src/connector/shift4/transformers.rs | 64 ++++++---- .../src/connector/stripe/transformers.rs | 111 +++++++++++------- .../router/src/connector/volt/transformers.rs | 14 ++- 11 files changed, 223 insertions(+), 150 deletions(-) diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index b2112d5514a2..8bb287812800 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -1381,9 +1381,10 @@ impl<'a> TryFrom<&AdyenRouterData<&types::PaymentsAuthorizeRouterData>> | payments::PaymentMethodData::MandatePayment | payments::PaymentMethodData::Reward | payments::PaymentMethodData::Upi(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ))? + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Adyen", + })? } }, } @@ -1676,9 +1677,10 @@ impl<'a> TryFrom<&api_models::payments::BankDebitData> for AdyenPaymentMethod<'a }, ))), payments::BankDebitData::BecsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Adyen", + } .into()) } } @@ -1726,9 +1728,10 @@ impl<'a> TryFrom<&api_models::payments::VoucherData> for AdyenPaymentMethod<'a> payments::VoucherData::Efecty | payments::VoucherData::PagoEfectivo | payments::VoucherData::RedCompra - | payments::VoucherData::RedPagos => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ) + | payments::VoucherData::RedPagos => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Adyen", + } .into()), } } @@ -1912,9 +1915,10 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> { | payments::WalletData::GooglePayThirdPartySdk(_) | payments::WalletData::PaypalSdk(_) | payments::WalletData::WeChatPayQr(_) - | payments::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ) + | payments::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Adyen", + } .into()), } } @@ -1971,12 +1975,11 @@ impl<'a> TryFrom<(&api::PayLaterData, Option)> api_models::payments::PayLaterData::AtomeRedirect { .. } => { Ok(AdyenPaymentMethod::Atome) } - payments::PayLaterData::KlarnaSdk { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ) - .into()) + payments::PayLaterData::KlarnaSdk { .. } => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Adyen", } + .into()), } } } @@ -2107,9 +2110,10 @@ impl<'a> TryFrom<&api_models::payments::BankRedirectData> for AdyenPaymentMethod } payments::BankRedirectData::Interac { .. } | payments::BankRedirectData::Przelewy24 { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Adyen"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Adyen", + } .into()) } } diff --git a/crates/router/src/connector/cryptopay/transformers.rs b/crates/router/src/connector/cryptopay/transformers.rs index 3657380b30f1..0bc4ff3b3ae6 100644 --- a/crates/router/src/connector/cryptopay/transformers.rs +++ b/crates/router/src/connector/cryptopay/transformers.rs @@ -81,9 +81,10 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>> | api_models::payments::PaymentMethodData::Upi(_) | api_models::payments::PaymentMethodData::Voucher(_) | api_models::payments::PaymentMethodData::GiftCard(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("CryptoPay"), - )) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "CryptoPay", + }) } }?; Ok(cryptopay_request) diff --git a/crates/router/src/connector/forte/transformers.rs b/crates/router/src/connector/forte/transformers.rs index b2c0a0c6134a..dd78324c9b8b 100644 --- a/crates/router/src/connector/forte/transformers.rs +++ b/crates/router/src/connector/forte/transformers.rs @@ -113,9 +113,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for FortePaymentsRequest { | api_models::payments::PaymentMethodData::Upi(_) | api_models::payments::PaymentMethodData::Voucher(_) | api_models::payments::PaymentMethodData::GiftCard(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Forte"), - ))? + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Forte", + })? } } } diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs index beb0b7e8aabc..6e887f58858f 100644 --- a/crates/router/src/connector/nmi/transformers.rs +++ b/crates/router/src/connector/nmi/transformers.rs @@ -171,9 +171,10 @@ impl TryFrom<&api_models::payments::PaymentMethodData> for PaymentMethod { | api_models::payments::WalletData::WeChatPayQr(_) | api_models::payments::WalletData::CashappQr(_) | api_models::payments::WalletData::SwishQr(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("nmi"), - )) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "nmi", + }) .into_report() } }, @@ -187,9 +188,10 @@ impl TryFrom<&api_models::payments::PaymentMethodData> for PaymentMethod { | api::PaymentMethodData::Reward | api::PaymentMethodData::Upi(_) | api::PaymentMethodData::Voucher(_) - | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("nmi"), - )) + | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "nmi", + }) .into_report(), } } diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index 2ec879252d44..27a874930bcc 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -268,9 +268,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest { | api_models::payments::WalletData::WeChatPayQr(_) | api_models::payments::WalletData::CashappQr(_) | api_models::payments::WalletData::SwishQr(_) => { - Err(errors::ConnectorError::NotImplemented( - conn_utils::get_unimplemented_payment_method_error_message("Noon"), - )) + Err(errors::ConnectorError::NotSupported { + message: conn_utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Noon", + }) } }, api::PaymentMethodData::CardRedirect(_) @@ -284,9 +285,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest { | api::PaymentMethodData::Upi(_) | api::PaymentMethodData::Voucher(_) | api::PaymentMethodData::GiftCard(_) => { - Err(errors::ConnectorError::NotImplemented( - conn_utils::get_unimplemented_payment_method_error_message("Noon"), - )) + Err(errors::ConnectorError::NotSupported { + message: conn_utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Noon", + }) } }?, Some(item.request.currency), diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs index 7c941dd3d8f4..3a859b325300 100644 --- a/crates/router/src/connector/payeezy/transformers.rs +++ b/crates/router/src/connector/payeezy/transformers.rs @@ -70,9 +70,10 @@ impl TryFrom for PayeezyCardType { utils::CardIssuer::Visa => Ok(Self::Visa), utils::CardIssuer::Maestro | utils::CardIssuer::DinersClub | utils::CardIssuer::JCB => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Payeezy"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Payeezy", + } .into()) } } @@ -260,9 +261,10 @@ fn get_payment_method_data( | api::PaymentMethodData::Reward | api::PaymentMethodData::Upi(_) | api::PaymentMethodData::Voucher(_) - | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Payeezy"), - ) + | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Payeezy", + } .into()), } } diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs index fd32a344bfe6..0092363523e5 100644 --- a/crates/router/src/connector/paypal/transformers.rs +++ b/crates/router/src/connector/paypal/transformers.rs @@ -224,8 +224,11 @@ fn get_payment_source( })), BankRedirectData::BancontactCard { .. } | BankRedirectData::Blik { .. } - | BankRedirectData::Przelewy24 { .. } - | BankRedirectData::Bizum {} + | BankRedirectData::Przelewy24 { .. } => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Paypal"), + ) + .into()), + BankRedirectData::Bizum {} | BankRedirectData::Interac { .. } | BankRedirectData::OnlineBankingCzechRepublic { .. } | BankRedirectData::OnlineBankingFinland { .. } @@ -235,9 +238,10 @@ fn get_payment_source( | BankRedirectData::Trustly { .. } | BankRedirectData::OnlineBankingFpx { .. } | BankRedirectData::OnlineBankingThailand { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } @@ -355,9 +359,10 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP | api_models::payments::WalletData::WeChatPayQr(_) | api_models::payments::WalletData::CashappQr(_) | api_models::payments::WalletData::SwishQr(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ))? + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + })? } }, api::PaymentMethodData::BankRedirect(ref bank_redirection_data) => { @@ -409,15 +414,21 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP api_models::payments::PaymentMethodData::GiftCard(ref giftcard_data) => { Self::try_from(giftcard_data.as_ref()) } - api_models::payments::PaymentMethodData::MandatePayment - | api_models::payments::PaymentMethodData::Reward - | api_models::payments::PaymentMethodData::Crypto(_) - | api_models::payments::PaymentMethodData::Upi(_) => { + api_models::payments::PaymentMethodData::MandatePayment => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) .into()) } + api_models::payments::PaymentMethodData::Reward + | api_models::payments::PaymentMethodData::Crypto(_) + | api_models::payments::PaymentMethodData::Upi(_) => { + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } + .into()) + } } } } @@ -429,9 +440,10 @@ impl TryFrom<&api_models::payments::CardRedirectData> for PaypalPaymentsRequest api_models::payments::CardRedirectData::Knet {} | api_models::payments::CardRedirectData::Benefit {} | api_models::payments::CardRedirectData::MomoAtm {} => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } @@ -450,9 +462,10 @@ impl TryFrom<&api_models::payments::PayLaterData> for PaypalPaymentsRequest { | 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("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } @@ -467,9 +480,10 @@ impl TryFrom<&api_models::payments::BankDebitData> for PaypalPaymentsRequest { | api_models::payments::BankDebitData::SepaBankDebit { .. } | api_models::payments::BankDebitData::BecsBankDebit { .. } | api_models::payments::BankDebitData::BacsBankDebit { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } @@ -493,9 +507,10 @@ impl TryFrom<&api_models::payments::BankTransferData> for PaypalPaymentsRequest | api_models::payments::BankTransferData::MandiriVaBankTransfer { .. } | api_models::payments::BankTransferData::Pix {} | api_models::payments::BankTransferData::Pse {} => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } @@ -520,9 +535,10 @@ impl TryFrom<&api_models::payments::VoucherData> for PaypalPaymentsRequest { | api_models::payments::VoucherData::FamilyMart(_) | api_models::payments::VoucherData::Seicomart(_) | api_models::payments::VoucherData::PayEasy(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } @@ -535,9 +551,10 @@ impl TryFrom<&api_models::payments::GiftCardData> for PaypalPaymentsRequest { match value { api_models::payments::GiftCardData::Givex(_) | api_models::payments::GiftCardData::PaySafeCard {} => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Paypal"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Paypal", + } .into()) } } diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rs index eaec6170801c..83bca662ec21 100644 --- a/crates/router/src/connector/powertranz/transformers.rs +++ b/crates/router/src/connector/powertranz/transformers.rs @@ -113,9 +113,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest | api::PaymentMethodData::Reward | api::PaymentMethodData::Upi(_) | api::PaymentMethodData::Voucher(_) - | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("powertranz"), - )) + | api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "powertranz", + }) .into_report(), }?; // let billing_address = get_address_details(&item.address.billing, &item.request.email); diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rs index 037da05ff748..0dd3b8583490 100644 --- a/crates/router/src/connector/shift4/transformers.rs +++ b/crates/router/src/connector/shift4/transformers.rs @@ -166,9 +166,10 @@ impl TryFrom<&types::RouterData Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) + | payments::PaymentMethodData::Upi(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Shift4", + } .into()), } } @@ -208,9 +209,10 @@ impl TryFrom<&api_models::payments::WalletData> for Shift4PaymentMethod { | payments::WalletData::TouchNGoRedirect(_) | payments::WalletData::WeChatPayQr(_) | payments::WalletData::CashappQr(_) - | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) + | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Shift4", + } .into()), } } @@ -239,9 +241,10 @@ impl TryFrom<&api_models::payments::BankTransferData> for Shift4PaymentMethod { | payments::BankTransferData::DanamonVaBankTransfer { .. } | payments::BankTransferData::MandiriVaBankTransfer { .. } | payments::BankTransferData::Pix {} - | payments::BankTransferData::Pse {} => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) + | payments::BankTransferData::Pse {} => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Shift4", + } .into()), } } @@ -251,8 +254,11 @@ impl TryFrom<&api_models::payments::VoucherData> for Shift4PaymentMethod { type Error = Error; fn try_from(voucher_data: &api_models::payments::VoucherData) -> Result { match voucher_data { - payments::VoucherData::Boleto(_) - | payments::VoucherData::Efecty + payments::VoucherData::Boleto(_) => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Shift4"), + ) + .into()), + payments::VoucherData::Efecty | payments::VoucherData::PagoEfectivo | payments::VoucherData::RedCompra | payments::VoucherData::RedPagos @@ -264,9 +270,10 @@ impl TryFrom<&api_models::payments::VoucherData> for Shift4PaymentMethod { | payments::VoucherData::MiniStop(_) | payments::VoucherData::FamilyMart(_) | payments::VoucherData::Seicomart(_) - | payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) + | payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Shift4", + } .into()), } } @@ -276,12 +283,15 @@ impl TryFrom<&api_models::payments::GiftCardData> for Shift4PaymentMethod { type Error = Error; fn try_from(gift_card_data: &api_models::payments::GiftCardData) -> Result { match gift_card_data { - payments::GiftCardData::Givex(_) | payments::GiftCardData::PaySafeCard {} => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) - .into()) + payments::GiftCardData::Givex(_) => Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Shift4", } + .into()), + payments::GiftCardData::PaySafeCard {} => Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Shift4"), + ) + .into()), } } } @@ -407,8 +417,13 @@ impl TryFrom<&payments::BankRedirectData> for PaymentMethodType { payments::BankRedirectData::BancontactCard { .. } | payments::BankRedirectData::Blik { .. } | payments::BankRedirectData::Trustly { .. } - | payments::BankRedirectData::Przelewy24 { .. } - | payments::BankRedirectData::Bizum {} + | payments::BankRedirectData::Przelewy24 { .. } => { + Err(errors::ConnectorError::NotImplemented( + utils::get_unimplemented_payment_method_error_message("Shift4"), + ) + .into()) + } + payments::BankRedirectData::Bizum {} | payments::BankRedirectData::Interac { .. } | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } | payments::BankRedirectData::OnlineBankingFinland { .. } @@ -417,9 +432,10 @@ impl TryFrom<&payments::BankRedirectData> for PaymentMethodType { | payments::BankRedirectData::OpenBankingUk { .. } | payments::BankRedirectData::OnlineBankingFpx { .. } | payments::BankRedirectData::OnlineBankingThailand { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Shift4"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Shift4", + } .into()) } } diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index 8933c8aa0bdc..a783fd23fe19 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -678,9 +678,10 @@ impl TryFrom for StripePaymentMethodType { | enums::PaymentMethodType::FamilyMart | enums::PaymentMethodType::Seicomart | enums::PaymentMethodType::PayEasy - | enums::PaymentMethodType::Walley => Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + | enums::PaymentMethodType::Walley => Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()), } } @@ -912,9 +913,10 @@ impl TryFrom<&api_models::payments::PayLaterData> for StripePaymentMethodType { | payments::PayLaterData::WalleyRedirect {} | payments::PayLaterData::AlmaRedirect {} | payments::PayLaterData::AtomeRedirect {} => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - )) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + }) } } } @@ -931,8 +933,12 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodType { payments::BankRedirectData::Przelewy24 { .. } => Ok(Self::Przelewy24), payments::BankRedirectData::Eps { .. } => Ok(Self::Eps), payments::BankRedirectData::Blik { .. } => Ok(Self::Blik), - payments::BankRedirectData::OnlineBankingFpx { .. } - | payments::BankRedirectData::Bizum {} + payments::BankRedirectData::OnlineBankingFpx { .. } => { + Err(errors::ConnectorError::NotImplemented( + connector_util::get_unimplemented_payment_method_error_message("stripe"), + )) + } + payments::BankRedirectData::Bizum {} | payments::BankRedirectData::Interac { .. } | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } | payments::BankRedirectData::OnlineBankingFinland { .. } @@ -941,9 +947,10 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodType { | payments::BankRedirectData::OnlineBankingThailand { .. } | payments::BankRedirectData::OpenBankingUk { .. } | payments::BankRedirectData::Trustly { .. } => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - )) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + }) } } } @@ -958,8 +965,12 @@ impl ForeignTryFrom<&payments::WalletData> for Option { payments::WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)), payments::WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)), payments::WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)), - payments::WalletData::MobilePayRedirect(_) - | payments::WalletData::PaypalRedirect(_) + payments::WalletData::MobilePayRedirect(_) => { + Err(errors::ConnectorError::NotImplemented( + connector_util::get_unimplemented_payment_method_error_message("stripe"), + )) + } + payments::WalletData::PaypalRedirect(_) | payments::WalletData::AliPayQr(_) | payments::WalletData::AliPayHkRedirect(_) | payments::WalletData::MomoRedirect(_) @@ -979,9 +990,10 @@ impl ForeignTryFrom<&payments::WalletData> for Option { | payments::WalletData::TouchNGoRedirect(_) | payments::WalletData::SwishQr(_) | payments::WalletData::WeChatPayRedirect(_) => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - )) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + }) } } } @@ -1341,8 +1353,11 @@ fn create_stripe_payment_method( billing_details, )) } - payments::BankTransferData::Pix {} - | payments::BankTransferData::Pse {} + payments::BankTransferData::Pix {} => Err(errors::ConnectorError::NotImplemented( + connector_util::get_unimplemented_payment_method_error_message("stripe"), + ) + .into()), + payments::BankTransferData::Pse {} | payments::BankTransferData::PermataBankTransfer { .. } | payments::BankTransferData::BcaBankTransfer { .. } | payments::BankTransferData::BniVaBankTransfer { .. } @@ -1350,9 +1365,10 @@ fn create_stripe_payment_method( | payments::BankTransferData::CimbVaBankTransfer { .. } | payments::BankTransferData::DanamonVaBankTransfer { .. } | payments::BankTransferData::MandiriVaBankTransfer { .. } => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()) } } @@ -1364,9 +1380,10 @@ fn create_stripe_payment_method( payments::PaymentMethodData::GiftCard(giftcard_data) => match giftcard_data.deref() { payments::GiftCardData::Givex(_) | payments::GiftCardData::PaySafeCard {} => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()) } }, @@ -1374,12 +1391,11 @@ fn create_stripe_payment_method( payments::PaymentMethodData::CardRedirect(cardredirect_data) => match cardredirect_data { payments::CardRedirectData::Knet {} | payments::CardRedirectData::Benefit {} - | payments::CardRedirectData::MomoAtm {} => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) - .into()) + | payments::CardRedirectData::MomoAtm {} => Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", } + .into()), }, payments::PaymentMethodData::Reward => Err(errors::ConnectorError::NotImplemented( connector_util::get_unimplemented_payment_method_error_message("stripe"), @@ -1404,16 +1420,18 @@ fn create_stripe_payment_method( | payments::VoucherData::MiniStop(_) | payments::VoucherData::FamilyMart(_) | payments::VoucherData::Seicomart(_) - | payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + | payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()), }, payments::PaymentMethodData::Upi(_) | payments::PaymentMethodData::MandatePayment => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()) } } @@ -1550,9 +1568,10 @@ impl TryFrom<(&payments::WalletData, Option)> | payments::WalletData::TouchNGoRedirect(_) | payments::WalletData::SwishQr(_) | payments::WalletData::WeChatPayRedirect(_) => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()) } } @@ -1625,8 +1644,13 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData { preferred_language: preferred_language.to_owned(), }), ))), - payments::BankRedirectData::OnlineBankingFpx { .. } - | payments::BankRedirectData::Bizum {} + payments::BankRedirectData::OnlineBankingFpx { .. } => { + Err(errors::ConnectorError::NotImplemented( + connector_util::get_unimplemented_payment_method_error_message("stripe"), + ) + .into()) + } + payments::BankRedirectData::Bizum {} | payments::BankRedirectData::Interac { .. } | payments::BankRedirectData::OnlineBankingCzechRepublic { .. } | payments::BankRedirectData::OnlineBankingFinland { .. } @@ -1635,9 +1659,10 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData { | payments::BankRedirectData::OnlineBankingThailand { .. } | payments::BankRedirectData::OpenBankingUk { .. } | payments::BankRedirectData::Trustly { .. } => { - Err(errors::ConnectorError::NotImplemented( - connector_util::get_unimplemented_payment_method_error_message("stripe"), - ) + Err(errors::ConnectorError::NotSupported { + message: connector_util::SELECTED_PAYMENT_METHOD.to_string(), + connector: "stripe", + } .into()) } } diff --git a/crates/router/src/connector/volt/transformers.rs b/crates/router/src/connector/volt/transformers.rs index 964232c08131..e603ef2db06c 100644 --- a/crates/router/src/connector/volt/transformers.rs +++ b/crates/router/src/connector/volt/transformers.rs @@ -130,9 +130,10 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme | api_models::payments::BankRedirectData::Trustly { .. } | api_models::payments::BankRedirectData::OnlineBankingFpx { .. } | api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Volt"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Volt", + } .into()) } }, @@ -148,9 +149,10 @@ impl TryFrom<&VoltRouterData<&types::PaymentsAuthorizeRouterData>> for VoltPayme | api_models::payments::PaymentMethodData::Upi(_) | api_models::payments::PaymentMethodData::Voucher(_) | api_models::payments::PaymentMethodData::GiftCard(_) => { - Err(errors::ConnectorError::NotImplemented( - utils::get_unimplemented_payment_method_error_message("Volt"), - ) + Err(errors::ConnectorError::NotSupported { + message: utils::SELECTED_PAYMENT_METHOD.to_string(), + connector: "Volt", + } .into()) } }