From 9fb2a8301453b47e2d1c17e215f740bea8eaa91a Mon Sep 17 00:00:00 2001 From: Amisha Prabhat <55580080+Aprabhat19@users.noreply.github.com> Date: Fri, 24 May 2024 15:10:31 +0530 Subject: [PATCH] fix(payment_methods): revert the filter for getting the mcas which are disabled (#4756) --- crates/diesel_models/src/query/merchant_connector_account.rs | 4 +--- crates/router/src/core/payment_methods/cards.rs | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rs index cc73bd7a5323..bd24d12ec22c 100644 --- a/crates/diesel_models/src/query/merchant_connector_account.rs +++ b/crates/diesel_models/src/query/merchant_connector_account.rs @@ -124,9 +124,7 @@ impl MerchantConnectorAccount { if get_disabled { generics::generic_filter::<::Table, _, _, _>( conn, - dsl::merchant_id - .eq(merchant_id.to_owned()) - .and(dsl::disabled.eq(true)), + dsl::merchant_id.eq(merchant_id.to_owned()), None, None, Some(dsl::created_at.asc()), diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 5a12334c3859..9fe8d899ea3e 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -3700,7 +3700,12 @@ pub async fn get_mca_status( .change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound { id: merchant_id.to_string(), })?; + let mut mca_ids = HashSet::new(); + let mcas = mcas + .into_iter() + .filter(|mca| mca.disabled == Some(true)) + .collect::>(); for mca in mcas { mca_ids.insert(mca.merchant_connector_id);