mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(pm_auth): Added mca status check in pml (#5421)
This commit is contained in:
@ -2356,7 +2356,8 @@ pub async fn list_payment_methods(
|
||||
.await?;
|
||||
|
||||
// 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);
|
||||
|
||||
@ -2663,33 +2664,34 @@ pub async fn list_payment_methods(
|
||||
});
|
||||
|
||||
if let Some(config) = pm_auth_config {
|
||||
config
|
||||
.enabled_payment_methods
|
||||
.iter()
|
||||
.for_each(|inner_config| {
|
||||
if inner_config.payment_method_type == *payment_method_type {
|
||||
let pm = pmt_to_auth_connector
|
||||
.get(&inner_config.payment_method)
|
||||
.cloned();
|
||||
for inner_config in config.enabled_payment_methods.iter() {
|
||||
let is_active_mca = all_mcas
|
||||
.iter()
|
||||
.any(|mca| mca.merchant_connector_id == inner_config.mca_id);
|
||||
|
||||
let inner_map = if let Some(mut inner_map) = pm {
|
||||
inner_map.insert(
|
||||
*payment_method_type,
|
||||
inner_config.connector_name.clone(),
|
||||
);
|
||||
inner_map
|
||||
} else {
|
||||
HashMap::from([(
|
||||
*payment_method_type,
|
||||
inner_config.connector_name.clone(),
|
||||
)])
|
||||
};
|
||||
if inner_config.payment_method_type == *payment_method_type && is_active_mca
|
||||
{
|
||||
let pm = pmt_to_auth_connector
|
||||
.get(&inner_config.payment_method)
|
||||
.cloned();
|
||||
|
||||
pmt_to_auth_connector
|
||||
.insert(inner_config.payment_method, inner_map);
|
||||
val.push(inner_config.clone());
|
||||
}
|
||||
});
|
||||
let inner_map = if let Some(mut inner_map) = pm {
|
||||
inner_map.insert(
|
||||
*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());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user