Skip to content

Commit

Permalink
refractor: change payment error message from not supported to not imp…
Browse files Browse the repository at this point in the history
…lemented
  • Loading branch information
oscar2d2 committed Nov 11, 2023
1 parent b3d5062 commit 7965aaf
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 223 deletions.
44 changes: 20 additions & 24 deletions crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,10 +1381,9 @@ impl<'a> TryFrom<&AdyenRouterData<&types::PaymentsAuthorizeRouterData>>
| payments::PaymentMethodData::MandatePayment
| payments::PaymentMethodData::Reward
| payments::PaymentMethodData::Upi(_) => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Adyen",
})?
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?
}
},
}
Expand Down Expand Up @@ -1677,10 +1676,9 @@ impl<'a> TryFrom<&api_models::payments::BankDebitData> for AdyenPaymentMethod<'a
},
))),
payments::BankDebitData::BecsBankDebit { .. } => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Adyen",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into())
}
}
Expand Down Expand Up @@ -1728,10 +1726,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Adyen",
}
| payments::VoucherData::RedPagos => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into()),
}
}
Expand Down Expand Up @@ -1915,10 +1912,9 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
| payments::WalletData::GooglePayThirdPartySdk(_)
| payments::WalletData::PaypalSdk(_)
| payments::WalletData::WeChatPayQr(_)
| payments::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Adyen",
}
| payments::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into()),
}
}
Expand Down Expand Up @@ -1975,11 +1971,12 @@ impl<'a> TryFrom<(&api::PayLaterData, Option<api_enums::CountryAlpha2>)>
api_models::payments::PayLaterData::AtomeRedirect { .. } => {
Ok(AdyenPaymentMethod::Atome)
}
payments::PayLaterData::KlarnaSdk { .. } => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Adyen",
payments::PayLaterData::KlarnaSdk { .. } => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into())
}
.into()),
}
}
}
Expand Down Expand Up @@ -2110,10 +2107,9 @@ impl<'a> TryFrom<&api_models::payments::BankRedirectData> for AdyenPaymentMethod
}
payments::BankRedirectData::Interac { .. }
| payments::BankRedirectData::Przelewy24 { .. } => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Adyen",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into())
}
}
Expand Down
7 changes: 3 additions & 4 deletions crates/router/src/connector/cryptopay/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ impl TryFrom<&CryptopayRouterData<&types::PaymentsAuthorizeRouterData>>
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::GiftCard(_) => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "CryptoPay",
})
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("CryptoPay"),
))
}
}?;
Ok(cryptopay_request)
Expand Down
7 changes: 3 additions & 4 deletions crates/router/src/connector/forte/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for FortePaymentsRequest {
| api_models::payments::PaymentMethodData::Upi(_)
| api_models::payments::PaymentMethodData::Voucher(_)
| api_models::payments::PaymentMethodData::GiftCard(_) => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Forte",
})?
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Forte"),
))?
}
}
}
Expand Down
14 changes: 6 additions & 8 deletions crates/router/src/connector/nmi/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "nmi",
})
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nmi"),
))
.into_report()
}
},
Expand All @@ -188,10 +187,9 @@ impl TryFrom<&api_models::payments::PaymentMethodData> for PaymentMethod {
| api::PaymentMethodData::Reward
| api::PaymentMethodData::Upi(_)
| api::PaymentMethodData::Voucher(_)
| api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "nmi",
})
| api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nmi"),
))
.into_report(),
}
}
Expand Down
14 changes: 6 additions & 8 deletions crates/router/src/connector/noon/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
| api_models::payments::WalletData::WeChatPayQr(_)
| api_models::payments::WalletData::CashappQr(_)
| api_models::payments::WalletData::SwishQr(_) => {
Err(errors::ConnectorError::NotSupported {
message: conn_utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Noon",
})
Err(errors::ConnectorError::NotImplemented(
conn_utils::get_unimplemented_payment_method_error_message("Noon"),
))
}
},
api::PaymentMethodData::CardRedirect(_)
Expand All @@ -285,10 +284,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
| api::PaymentMethodData::Upi(_)
| api::PaymentMethodData::Voucher(_)
| api::PaymentMethodData::GiftCard(_) => {
Err(errors::ConnectorError::NotSupported {
message: conn_utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Noon",
})
Err(errors::ConnectorError::NotImplemented(
conn_utils::get_unimplemented_payment_method_error_message("Noon"),
))
}
}?,
Some(item.request.currency),
Expand Down
14 changes: 6 additions & 8 deletions crates/router/src/connector/payeezy/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ impl TryFrom<utils::CardIssuer> for PayeezyCardType {
utils::CardIssuer::Visa => Ok(Self::Visa),

utils::CardIssuer::Maestro | utils::CardIssuer::DinersClub | utils::CardIssuer::JCB => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Payeezy",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Payeezy"),
)
.into())
}
}
Expand Down Expand Up @@ -261,10 +260,9 @@ fn get_payment_method_data(
| api::PaymentMethodData::Reward
| api::PaymentMethodData::Upi(_)
| api::PaymentMethodData::Voucher(_)
| api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Payeezy",
}
| api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Payeezy"),
)
.into()),
}
}
Expand Down
77 changes: 30 additions & 47 deletions crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,8 @@ fn get_payment_source(
})),
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Blik { .. }
| BankRedirectData::Przelewy24 { .. } => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into()),
BankRedirectData::Bizum {}
| BankRedirectData::Przelewy24 { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
| BankRedirectData::OnlineBankingFinland { .. }
Expand All @@ -238,10 +235,9 @@ fn get_payment_source(
| BankRedirectData::Trustly { .. }
| BankRedirectData::OnlineBankingFpx { .. }
| BankRedirectData::OnlineBankingThailand { .. } => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand Down Expand Up @@ -359,10 +355,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
})?
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
))?
}
},
api::PaymentMethodData::BankRedirect(ref bank_redirection_data) => {
Expand Down Expand Up @@ -414,21 +409,15 @@ 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::MandatePayment
| api_models::payments::PaymentMethodData::Reward
| api_models::payments::PaymentMethodData::Crypto(_)
| api_models::payments::PaymentMethodData::Upi(_) => {
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 @@ -440,10 +429,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand All @@ -462,10 +450,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand All @@ -480,10 +467,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand All @@ -507,10 +493,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand All @@ -535,10 +520,9 @@ 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::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand All @@ -551,10 +535,9 @@ impl TryFrom<&api_models::payments::GiftCardData> for PaypalPaymentsRequest {
match value {
api_models::payments::GiftCardData::Givex(_)
| api_models::payments::GiftCardData::PaySafeCard {} => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
}
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Paypal"),
)
.into())
}
}
Expand Down
7 changes: 3 additions & 4 deletions crates/router/src/connector/powertranz/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest
| api::PaymentMethodData::Reward
| api::PaymentMethodData::Upi(_)
| api::PaymentMethodData::Voucher(_)
| api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "powertranz",
})
| api::PaymentMethodData::GiftCard(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("powertranz"),
))
.into_report(),
}?;
// let billing_address = get_address_details(&item.address.billing, &item.request.email);
Expand Down
Loading

0 comments on commit 7965aaf

Please sign in to comment.