Skip to content

Commit 9ae10dc

Browse files
authored
refactor(payment_methods): enable country currency filter for cards (#4056)
1 parent 1e32c6e commit 9ae10dc

File tree

1 file changed

+14
-2
lines changed
  • crates/router/src/core/payment_methods

1 file changed

+14
-2
lines changed

crates/router/src/core/payment_methods/cards.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,15 +2356,27 @@ fn filter_pm_based_on_config<'a>(
23562356
.or_else(|| config.0.get("default"))
23572357
.and_then(|inner| match payment_method_type {
23582358
api_enums::PaymentMethodType::Credit | api_enums::PaymentMethodType::Debit => {
2359+
let country_currency_filter = inner
2360+
.0
2361+
.get(&settings::PaymentMethodFilterKey::PaymentMethodType(
2362+
*payment_method_type,
2363+
))
2364+
.map(|value| global_country_currency_filter(value, country, currency));
2365+
23592366
card_network_filter(country, currency, card_network, inner);
23602367

2361-
payment_attempt
2368+
let capture_method_filter = payment_attempt
23622369
.and_then(|inner| inner.capture_method)
23632370
.and_then(|capture_method| {
23642371
(capture_method == storage_enums::CaptureMethod::Manual).then(|| {
23652372
filter_pm_based_on_capture_method_used(inner, payment_method_type)
23662373
})
2367-
})
2374+
});
2375+
2376+
Some(
2377+
country_currency_filter.unwrap_or(true)
2378+
&& capture_method_filter.unwrap_or(true),
2379+
)
23682380
}
23692381
payment_method_type => inner
23702382
.0

0 commit comments

Comments
 (0)