refactor(payment_methods): enable country currency filter for cards (#4056)

This commit is contained in:
Chethan Rao
2024-03-14 15:56:35 +05:30
committed by GitHub
parent 1e32c6e873
commit 9ae10dc4d0

View File

@ -2356,15 +2356,27 @@ fn filter_pm_based_on_config<'a>(
.or_else(|| config.0.get("default"))
.and_then(|inner| match payment_method_type {
api_enums::PaymentMethodType::Credit | api_enums::PaymentMethodType::Debit => {
let country_currency_filter = inner
.0
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
*payment_method_type,
))
.map(|value| global_country_currency_filter(value, country, currency));
card_network_filter(country, currency, card_network, inner);
payment_attempt
let capture_method_filter = payment_attempt
.and_then(|inner| inner.capture_method)
.and_then(|capture_method| {
(capture_method == storage_enums::CaptureMethod::Manual).then(|| {
filter_pm_based_on_capture_method_used(inner, payment_method_type)
})
})
});
Some(
country_currency_filter.unwrap_or(true)
&& capture_method_filter.unwrap_or(true),
)
}
payment_method_type => inner
.0