Skip to content

Commit

Permalink
refactor(connector): [Shift4] change error message from NotSupported …
Browse files Browse the repository at this point in the history
…to NotImplemented (#2880)
  • Loading branch information
unpervertedkid authored Nov 30, 2023
1 parent 668b943 commit bc79d52
Showing 1 changed file with 31 additions and 58 deletions.
89 changes: 31 additions & 58 deletions crates/router/src/connector/shift4/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,9 @@ impl<T> TryFrom<&types::RouterData<T, types::PaymentsAuthorizeData, types::Payme
| payments::PaymentMethodData::Reward
| payments::PaymentMethodData::Upi(_)
| payments::PaymentMethodData::CardToken(_) => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Shift4",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into())
}
}
Expand All @@ -184,13 +183,8 @@ impl TryFrom<&api_models::payments::WalletData> for Shift4PaymentMethod {
match wallet_data {
payments::WalletData::AliPayRedirect(_)
| payments::WalletData::ApplePay(_)
| payments::WalletData::WeChatPayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into())
}
payments::WalletData::AliPayQr(_)
| payments::WalletData::WeChatPayRedirect(_)
| payments::WalletData::AliPayQr(_)
| payments::WalletData::AliPayHkRedirect(_)
| payments::WalletData::MomoRedirect(_)
| payments::WalletData::KakaoPayRedirect(_)
Expand All @@ -212,10 +206,9 @@ impl TryFrom<&api_models::payments::WalletData> for Shift4PaymentMethod {
| payments::WalletData::TouchNGoRedirect(_)
| payments::WalletData::WeChatPayQr(_)
| payments::WalletData::CashappQr(_)
| payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Shift4",
}
| payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
}
}
Expand All @@ -227,13 +220,8 @@ impl TryFrom<&api_models::payments::BankTransferData> for Shift4PaymentMethod {
bank_transfer_data: &api_models::payments::BankTransferData,
) -> Result<Self, Self::Error> {
match bank_transfer_data {
payments::BankTransferData::MultibancoBankTransfer { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into())
}
payments::BankTransferData::AchBankTransfer { .. }
payments::BankTransferData::MultibancoBankTransfer { .. }
| payments::BankTransferData::AchBankTransfer { .. }
| payments::BankTransferData::SepaBankTransfer { .. }
| payments::BankTransferData::BacsBankTransfer { .. }
| payments::BankTransferData::PermataBankTransfer { .. }
Expand All @@ -244,10 +232,9 @@ impl TryFrom<&api_models::payments::BankTransferData> for Shift4PaymentMethod {
| payments::BankTransferData::DanamonVaBankTransfer { .. }
| payments::BankTransferData::MandiriVaBankTransfer { .. }
| payments::BankTransferData::Pix {}
| payments::BankTransferData::Pse {} => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Shift4",
}
| payments::BankTransferData::Pse {} => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
}
}
Expand All @@ -257,11 +244,8 @@ impl TryFrom<&api_models::payments::VoucherData> for Shift4PaymentMethod {
type Error = Error;
fn try_from(voucher_data: &api_models::payments::VoucherData) -> Result<Self, Self::Error> {
match voucher_data {
payments::VoucherData::Boleto(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
payments::VoucherData::Efecty
payments::VoucherData::Boleto(_)
| payments::VoucherData::Efecty
| payments::VoucherData::PagoEfectivo
| payments::VoucherData::RedCompra
| payments::VoucherData::RedPagos
Expand All @@ -273,10 +257,9 @@ impl TryFrom<&api_models::payments::VoucherData> for Shift4PaymentMethod {
| payments::VoucherData::MiniStop(_)
| payments::VoucherData::FamilyMart(_)
| payments::VoucherData::Seicomart(_)
| payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Shift4",
}
| payments::VoucherData::PayEasy(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
}
}
Expand All @@ -286,15 +269,12 @@ impl TryFrom<&api_models::payments::GiftCardData> for Shift4PaymentMethod {
type Error = Error;
fn try_from(gift_card_data: &api_models::payments::GiftCardData) -> Result<Self, Self::Error> {
match gift_card_data {
payments::GiftCardData::Givex(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Shift4",
payments::GiftCardData::Givex(_) | payments::GiftCardData::PaySafeCard {} => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into())
}
.into()),
payments::GiftCardData::PaySafeCard {} => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
}
}
}
Expand Down Expand Up @@ -401,10 +381,9 @@ impl<T> TryFrom<&types::RouterData<T, types::CompleteAuthorizeData, types::Payme
| Some(payments::PaymentMethodData::Reward)
| Some(payments::PaymentMethodData::Upi(_))
| Some(api::PaymentMethodData::CardToken(_))
| None => Err(errors::ConnectorError::NotSupported {
message: "Flow".to_string(),
connector: "Shift4",
}
| None => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
}
}
Expand All @@ -421,13 +400,8 @@ impl TryFrom<&payments::BankRedirectData> for PaymentMethodType {
payments::BankRedirectData::BancontactCard { .. }
| payments::BankRedirectData::Blik { .. }
| payments::BankRedirectData::Trustly { .. }
| payments::BankRedirectData::Przelewy24 { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into())
}
payments::BankRedirectData::Bizum {}
| payments::BankRedirectData::Przelewy24 { .. }
| payments::BankRedirectData::Bizum {}
| payments::BankRedirectData::Interac { .. }
| payments::BankRedirectData::OnlineBankingCzechRepublic { .. }
| payments::BankRedirectData::OnlineBankingFinland { .. }
Expand All @@ -436,10 +410,9 @@ impl TryFrom<&payments::BankRedirectData> for PaymentMethodType {
| payments::BankRedirectData::OpenBankingUk { .. }
| payments::BankRedirectData::OnlineBankingFpx { .. }
| payments::BankRedirectData::OnlineBankingThailand { .. } => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Shift4",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into())
}
}
Expand Down

0 comments on commit bc79d52

Please sign in to comment.