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,33 +2664,34 @@ 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 {
let pm = pmt_to_auth_connector
.get(&inner_config.payment_method)
.cloned();
let inner_map = if let Some(mut inner_map) = pm { if inner_config.payment_method_type == *payment_method_type && is_active_mca
inner_map.insert( {
*payment_method_type, let pm = pmt_to_auth_connector
inner_config.connector_name.clone(), .get(&inner_config.payment_method)
); .cloned();
inner_map
} else {
HashMap::from([(
*payment_method_type,
inner_config.connector_name.clone(),
)])
};
pmt_to_auth_connector let inner_map = if let Some(mut inner_map) = pm {
.insert(inner_config.payment_method, inner_map); inner_map.insert(
val.push(inner_config.clone()); *payment_method_type,
} inner_config.connector_name.clone(),
}); );
inner_map
} else {
HashMap::from([(
*payment_method_type,
inner_config.connector_name.clone(),
)])
};
pmt_to_auth_connector.insert(inner_config.payment_method, inner_map);
val.push(inner_config.clone());
}
}
}; };
} }
} }