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: parse allowed_payment_method_types only if there is some value p… (#2161)

Kashif46f14191ab7e
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 88ea12388d..ee5f34938f 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1351,9 +1351,11 @@ pub async fn filter_payment_methods(
payment_intent
.allowed_payment_method_types
.clone()
- .parse_value("Vec<PaymentMethodType>")
- .map_err(|error| logger::error!(%error, "Failed to deserialize PaymentIntent allowed_payment_method_types"))
- .ok()
+ .map(|val| val.parse_value("Vec<PaymentMethodType>"))
+ .transpose()
+ .unwrap_or_else(|error| {
+ logger::error!(%error, "Failed to deserialize PaymentIntent allowed_payment_method_types"); None
+ })
});
for payment_method_type_info in payment_methods_enabled