mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
refactor(payment_methods): enable country currency filter for cards (#4056)
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user