Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(frm): restrict enabled mca for frm connectors (#5499)

chikke srujan7718800e1fc4
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index 114dff566c..a5d78377a8 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -183,10 +183,26 @@ pub async fn should_call_frm<F: Send + Clone>(
&key_store,
)
.await
- .change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_account.get_id().get_string_repr().to_owned(),
+ .map_err(|error| {
+ logger::error!(
+ "{:?}",
+ error.change_context(
+ errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+ id: merchant_account.get_id().get_string_repr().to_owned(),
+ }
+ )
+ )
})
.ok();
+ let enabled_merchant_connector_account_from_db_option =
+ merchant_connector_account_from_db_option.and_then(|mca| {
+ if mca.disabled.unwrap_or(false) {
+ logger::info!("No eligible connector found for FRM");
+ None
+ } else {
+ Some(mca)
+ }
+ });
#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
let merchant_connector_account_from_db_option: Option<
@@ -198,7 +214,7 @@ pub async fn should_call_frm<F: Send + Clone>(
todo!()
};
- match merchant_connector_account_from_db_option {
+ match enabled_merchant_connector_account_from_db_option {
Some(merchant_connector_account_from_db) => {
let frm_configs_option = merchant_connector_account_from_db
.frm_configs