Skip to content

Commit b5ea8db

Browse files
refactor(connector): [Zen] change error message from NotSupported to NotImplemented (#2831)
1 parent 2a4f5d1 commit b5ea8db

File tree

1 file changed

+32
-59
lines changed

1 file changed

+32
-59
lines changed

crates/router/src/connector/zen/transformers.rs

Lines changed: 32 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,9 @@ impl
290290
| api_models::payments::VoucherData::FamilyMart { .. }
291291
| api_models::payments::VoucherData::Seicomart { .. }
292292
| api_models::payments::VoucherData::PayEasy { .. } => {
293-
Err(errors::ConnectorError::NotSupported {
294-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
295-
connector: "Zen",
296-
})?
293+
Err(errors::ConnectorError::NotImplemented(
294+
utils::get_unimplemented_payment_method_error_message("Zen"),
295+
))?
297296
}
298297
};
299298
Ok(Self::ApiRequest(Box::new(ApiRequest {
@@ -342,12 +341,8 @@ impl
342341
api_models::payments::BankTransferData::Pse { .. } => {
343342
ZenPaymentChannels::PclBoacompraPse
344343
}
345-
api_models::payments::BankTransferData::SepaBankTransfer { .. } => {
346-
Err(errors::ConnectorError::NotImplemented(
347-
utils::get_unimplemented_payment_method_error_message("Zen"),
348-
))?
349-
}
350-
api_models::payments::BankTransferData::AchBankTransfer { .. }
344+
api_models::payments::BankTransferData::SepaBankTransfer { .. }
345+
| api_models::payments::BankTransferData::AchBankTransfer { .. }
351346
| api_models::payments::BankTransferData::BacsBankTransfer { .. }
352347
| api_models::payments::BankTransferData::PermataBankTransfer { .. }
353348
| api_models::payments::BankTransferData::BcaBankTransfer { .. }
@@ -356,10 +351,9 @@ impl
356351
| api_models::payments::BankTransferData::CimbVaBankTransfer { .. }
357352
| api_models::payments::BankTransferData::DanamonVaBankTransfer { .. }
358353
| api_models::payments::BankTransferData::MandiriVaBankTransfer { .. } => {
359-
Err(errors::ConnectorError::NotSupported {
360-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
361-
connector: "Zen",
362-
})?
354+
Err(errors::ConnectorError::NotImplemented(
355+
utils::get_unimplemented_payment_method_error_message("Zen"),
356+
))?
363357
}
364358
};
365359
Ok(Self::ApiRequest(Box::new(ApiRequest {
@@ -489,12 +483,8 @@ impl
489483
api_models::payments::WalletData::WeChatPayRedirect(_)
490484
| api_models::payments::WalletData::PaypalRedirect(_)
491485
| api_models::payments::WalletData::ApplePay(_)
492-
| api_models::payments::WalletData::GooglePay(_) => {
493-
Err(errors::ConnectorError::NotImplemented(
494-
utils::get_unimplemented_payment_method_error_message("Zen"),
495-
))?
496-
}
497-
api_models::payments::WalletData::AliPayQr(_)
486+
| api_models::payments::WalletData::GooglePay(_)
487+
| api_models::payments::WalletData::AliPayQr(_)
498488
| api_models::payments::WalletData::AliPayRedirect(_)
499489
| api_models::payments::WalletData::AliPayHkRedirect(_)
500490
| api_models::payments::WalletData::MomoRedirect(_)
@@ -514,10 +504,9 @@ impl
514504
| api_models::payments::WalletData::CashappQr(_)
515505
| api_models::payments::WalletData::SwishQr(_)
516506
| api_models::payments::WalletData::WeChatPayQr(_) => {
517-
Err(errors::ConnectorError::NotSupported {
518-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
519-
connector: "Zen",
520-
})?
507+
Err(errors::ConnectorError::NotImplemented(
508+
utils::get_unimplemented_payment_method_error_message("Zen"),
509+
))?
521510
}
522511
};
523512
let terminal_uuid = session_data
@@ -719,10 +708,9 @@ impl TryFrom<&ZenRouterData<&types::PaymentsAuthorizeRouterData>> for ZenPayment
719708
| api_models::payments::PaymentMethodData::MandatePayment
720709
| api_models::payments::PaymentMethodData::Reward
721710
| api_models::payments::PaymentMethodData::Upi(_) => {
722-
Err(errors::ConnectorError::NotSupported {
723-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
724-
connector: "Zen",
725-
})?
711+
Err(errors::ConnectorError::NotImplemented(
712+
utils::get_unimplemented_payment_method_error_message("Zen"),
713+
))?
726714
}
727715
}
728716
}
@@ -736,13 +724,8 @@ impl TryFrom<&api_models::payments::BankRedirectData> for ZenPaymentsRequest {
736724
| api_models::payments::BankRedirectData::Sofort { .. }
737725
| api_models::payments::BankRedirectData::BancontactCard { .. }
738726
| api_models::payments::BankRedirectData::Blik { .. }
739-
| api_models::payments::BankRedirectData::Trustly { .. } => {
740-
Err(errors::ConnectorError::NotImplemented(
741-
utils::get_unimplemented_payment_method_error_message("Zen"),
742-
)
743-
.into())
744-
}
745-
api_models::payments::BankRedirectData::Eps { .. }
727+
| api_models::payments::BankRedirectData::Trustly { .. }
728+
| api_models::payments::BankRedirectData::Eps { .. }
746729
| api_models::payments::BankRedirectData::Giropay { .. }
747730
| api_models::payments::BankRedirectData::Przelewy24 { .. }
748731
| api_models::payments::BankRedirectData::Bizum {}
@@ -754,10 +737,9 @@ impl TryFrom<&api_models::payments::BankRedirectData> for ZenPaymentsRequest {
754737
| api_models::payments::BankRedirectData::OpenBankingUk { .. }
755738
| api_models::payments::BankRedirectData::OnlineBankingFpx { .. }
756739
| api_models::payments::BankRedirectData::OnlineBankingThailand { .. } => {
757-
Err(errors::ConnectorError::NotSupported {
758-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
759-
connector: "Zen",
760-
}
740+
Err(errors::ConnectorError::NotImplemented(
741+
utils::get_unimplemented_payment_method_error_message("Zen"),
742+
)
761743
.into())
762744
}
763745
}
@@ -776,10 +758,9 @@ impl TryFrom<&api_models::payments::PayLaterData> for ZenPaymentsRequest {
776758
| api_models::payments::PayLaterData::WalleyRedirect {}
777759
| api_models::payments::PayLaterData::AlmaRedirect {}
778760
| api_models::payments::PayLaterData::AtomeRedirect {} => {
779-
Err(errors::ConnectorError::NotSupported {
780-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
781-
connector: "Zen",
782-
}
761+
Err(errors::ConnectorError::NotImplemented(
762+
utils::get_unimplemented_payment_method_error_message("Zen"),
763+
)
783764
.into())
784765
}
785766
}
@@ -794,10 +775,9 @@ impl TryFrom<&api_models::payments::BankDebitData> for ZenPaymentsRequest {
794775
| api_models::payments::BankDebitData::SepaBankDebit { .. }
795776
| api_models::payments::BankDebitData::BecsBankDebit { .. }
796777
| api_models::payments::BankDebitData::BacsBankDebit { .. } => {
797-
Err(errors::ConnectorError::NotSupported {
798-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
799-
connector: "Zen",
800-
}
778+
Err(errors::ConnectorError::NotImplemented(
779+
utils::get_unimplemented_payment_method_error_message("Zen"),
780+
)
801781
.into())
802782
}
803783
}
@@ -811,10 +791,9 @@ impl TryFrom<&api_models::payments::CardRedirectData> for ZenPaymentsRequest {
811791
api_models::payments::CardRedirectData::Knet {}
812792
| api_models::payments::CardRedirectData::Benefit {}
813793
| api_models::payments::CardRedirectData::MomoAtm {} => {
814-
Err(errors::ConnectorError::NotSupported {
815-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
816-
connector: "Zen",
817-
}
794+
Err(errors::ConnectorError::NotImplemented(
795+
utils::get_unimplemented_payment_method_error_message("Zen"),
796+
)
818797
.into())
819798
}
820799
}
@@ -825,19 +804,13 @@ impl TryFrom<&api_models::payments::GiftCardData> for ZenPaymentsRequest {
825804
type Error = error_stack::Report<errors::ConnectorError>;
826805
fn try_from(value: &api_models::payments::GiftCardData) -> Result<Self, Self::Error> {
827806
match value {
828-
api_models::payments::GiftCardData::PaySafeCard {} => {
807+
api_models::payments::GiftCardData::PaySafeCard {}
808+
| api_models::payments::GiftCardData::Givex(_) => {
829809
Err(errors::ConnectorError::NotImplemented(
830810
utils::get_unimplemented_payment_method_error_message("Zen"),
831811
)
832812
.into())
833813
}
834-
api_models::payments::GiftCardData::Givex(_) => {
835-
Err(errors::ConnectorError::NotSupported {
836-
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
837-
connector: "Zen",
838-
}
839-
.into())
840-
}
841814
}
842815
}
843816
}

0 commit comments

Comments
 (0)