Skip to content

Commit

Permalink
Revert "refractor: change payment error message from not supported to…
Browse files Browse the repository at this point in the history
… not implemented"

This reverts commit 7965aaf.
  • Loading branch information
oscar2d2 committed Nov 11, 2023
1 parent 7965aaf commit 35494ed
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 150 deletions.
44 changes: 24 additions & 20 deletions crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})?
}
},
}
Expand Down Expand Up @@ -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())
}
}
Expand Down Expand Up @@ -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()),
}
}
Expand Down Expand Up @@ -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()),
}
}
Expand Down Expand Up @@ -1971,12 +1975,11 @@ impl<'a> TryFrom<(&api::PayLaterData, Option<api_enums::CountryAlpha2>)>
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()),
}
}
}
Expand Down Expand Up @@ -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())
}
}
Expand Down
7 changes: 4 additions & 3 deletions crates/router/src/connector/cryptopay/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions crates/router/src/connector/forte/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})?
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions crates/router/src/connector/nmi/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
},
Expand All @@ -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(),
}
}
Expand Down
14 changes: 8 additions & 6 deletions crates/router/src/connector/noon/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(_)
Expand All @@ -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),
Expand Down
14 changes: 8 additions & 6 deletions crates/router/src/connector/payeezy/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ impl TryFrom<utils::CardIssuer> 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())
}
}
Expand Down Expand Up @@ -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()),
}
}
Expand Down
77 changes: 47 additions & 30 deletions crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 { .. }
Expand All @@ -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())
}
}
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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())
}
}
}
}
Expand All @@ -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())
}
}
Expand All @@ -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())
}
}
Expand All @@ -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())
}
}
Expand All @@ -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())
}
}
Expand All @@ -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())
}
}
Expand All @@ -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())
}
}
Expand Down
7 changes: 4 additions & 3 deletions crates/router/src/connector/powertranz/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 35494ed

Please sign in to comment.