fix(router): allow zero amount for payment intent in list payment methods (#3090)

This commit is contained in:
Shanks
2023-12-08 17:36:17 +05:30
committed by GitHub
parent bf674380d5
commit b283b6b662

View File

@ -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(