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): allow zero amount for payment intent in list payment methods (#3090)

Shanksb283b6b662c9
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 84aef952a5..aaecd86627 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2237,7 +2237,7 @@ fn filter_amount_based(payment_method: &RequestPaymentMethodTypes, amount: Optio
// (Some(amt), Some(max_amt)) => amt <= max_amt,
// (_, _) => true,
// };
- min_check && max_check
+ (min_check && max_check) || amount == Some(0)
}
fn filter_pm_based_on_allowed_types(
@@ -2296,8 +2296,9 @@ fn filter_payment_amount_based(
pm: &RequestPaymentMethodTypes,
) -> bool {
let amount = payment_intent.amount;
- pm.maximum_amount.map_or(true, |amt| amount < amt.into())
- && pm.minimum_amount.map_or(true, |amt| amount > amt.into())
+ (pm.maximum_amount.map_or(true, |amt| amount <= amt.into())
+ && pm.minimum_amount.map_or(true, |amt| amount >= amt.into()))
+ || payment_intent.amount == 0
}
async fn filter_payment_mandate_based(