Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(router): Validate 'card' as a PaymentMethodType (#7919)

Anurag Thakur3f1d59815372
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index edd62680d2..33a2eb9a98 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2958,10 +2958,18 @@ pub fn validate_payment_method_type_against_payment_method(
payment_method_type: api_enums::PaymentMethodType,
) -> bool {
match payment_method {
+ #[cfg(feature = "v1")]
api_enums::PaymentMethod::Card => matches!(
payment_method_type,
api_enums::PaymentMethodType::Credit | api_enums::PaymentMethodType::Debit
),
+ #[cfg(feature = "v2")]
+ api_enums::PaymentMethod::Card => matches!(
+ payment_method_type,
+ api_enums::PaymentMethodType::Credit
+ | api_enums::PaymentMethodType::Debit
+ | api_enums::PaymentMethodType::Card
+ ),
api_enums::PaymentMethod::PayLater => matches!(
payment_method_type,
api_enums::PaymentMethodType::Affirm