fix(pm_auth): Added mca status check in pml (#5421)

This commit is contained in:
Sarthak Soni
2024-08-02 18:58:51 +05:30
committed by GitHub
parent f3677f268c
commit e9bd345464

View File

@ -2356,7 +2356,8 @@ pub async fn list_payment_methods(
.await?; .await?;
// filter out connectors based on the business country // filter out connectors based on the business country
let filtered_mcas = helpers::filter_mca_based_on_business_profile(all_mcas, profile_id.clone()); let filtered_mcas =
helpers::filter_mca_based_on_business_profile(all_mcas.clone(), profile_id.clone());
logger::debug!(mca_before_filtering=?filtered_mcas); logger::debug!(mca_before_filtering=?filtered_mcas);
@ -2663,11 +2664,13 @@ pub async fn list_payment_methods(
}); });
if let Some(config) = pm_auth_config { if let Some(config) = pm_auth_config {
config for inner_config in config.enabled_payment_methods.iter() {
.enabled_payment_methods let is_active_mca = all_mcas
.iter() .iter()
.for_each(|inner_config| { .any(|mca| mca.merchant_connector_id == inner_config.mca_id);
if inner_config.payment_method_type == *payment_method_type {
if inner_config.payment_method_type == *payment_method_type && is_active_mca
{
let pm = pmt_to_auth_connector let pm = pmt_to_auth_connector
.get(&inner_config.payment_method) .get(&inner_config.payment_method)
.cloned(); .cloned();
@ -2685,11 +2688,10 @@ pub async fn list_payment_methods(
)]) )])
}; };
pmt_to_auth_connector pmt_to_auth_connector.insert(inner_config.payment_method, inner_map);
.insert(inner_config.payment_method, inner_map);
val.push(inner_config.clone()); val.push(inner_config.clone());
} }
}); }
}; };
} }
} }