Bug: [FEATURE] Fixes in PM Auth



### Feature Description

Bugs related to PML in PM Auth needs to be fixed

### Possible Implementation

Implementation depends on the specific bugs encountered.

### Have you spent some time checking if this feature request has been raised before?

- [X] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [X] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 70a0a4e4cd1..a55e9c76b0f 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -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);
 
@@ -2667,33 +2668,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();
-
-                                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());
-                            }
-                        });
+                    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);
+
+                        if inner_config.payment_method_type == *payment_method_type && is_active_mca
+                        {
+                            let pm = pmt_to_auth_connector
+                                .get(&inner_config.payment_method)
+                                .cloned();
+
+                            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());
+                        }
+                    }
                 };
             }
         }

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
Added a check in mca for pm_auth_connectors to include only the active ones.
If a Pm auth connector is disabled, it should not show up in the `pm_auth_connector` field in PML response  

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->


## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
1. Deactivate the pm_auth account - 
```
curl --location --request POST 'http://localhost:8080/account/merchant_1721742760/connectors/mca_r7PzL0AWF5tHJ8sUWqIG' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
  "connector_type": "payment_method_auth",
  "status": "inactive",
  "metadata": {
    "city": "NY",
    "unit": "245"
  }
}'
```
2. Call PML for merchant
```
curl --location --request GET 'http://localhost:8080/account/payment_methods?client_secret=pay_zj0McWhRpiXD0LHDLUmf_secret_59U5b2KF3XTaYnkVCkh5' \
--header 'Accept: application/json' \
--header 'api-key: pk_dev_96d5dd30db4542d9bb0135c05abf79f3' \
--data-raw ''
```
Resposne 
```
{
    "redirect_url": "https://google.com/success",
    "currency": "USD",
    "payment_methods": [
        {
            "payment_method": "pay_later",
            "payment_method_types": [
                {
                    "payment_method_type": "klarna",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {
                        "email": {
                            "required_field": "email",
                            "display_name": "email",
                            "field_type": "user_email_address",
                            "value": "guest@example.com"
                        },
                        "payment_method_data.pay_later.klarna.billing_country": {
                            "required_field": "payment_method_data.pay_later.klarna.billing_country",
                            "display_name": "billing_country",
                            "field_type": {
                                "user_address_country": {
                                    "options": [
                                        "ALL"
                                    ]
                                }
                            },
                            "value": null
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "afterpay_clearpay",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {
                        "payment_method_data.pay_later.afterpay_clearpay_redirect.billing_email": {
                            "required_field": "payment_method_data.pay_later.afterpay_clearpay_redirect.billing_email",
                            "display_name": "billing_email",
                            "field_type": "user_email_address",
                            "value": null
                        },
                        "name": {
                            "required_field": "name",
                            "display_name": "cust_name",
                            "field_type": "user_full_name",
                            "value": "John Doe"
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "affirm",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {},
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        },
        {
            "payment_method": "bank_transfer",
            "payment_method_types": [
                {
                    "payment_method_type": "ach",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {},
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "sepa",
                    "payment_experience": [
                        {
                            "payment_experience_type": "redirect_to_url",
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": null,
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        {
                            "card_network": "Visa",
                            "surcharge_details": null,
                            "eligible_connectors": [
                                "stripe"
                            ]
                        },
                        {
                            "card_network": "Mastercard",
                            "surcharge_details": null,
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {
                        "payment_method_data.card.card_exp_month": {
                            "required_field": "payment_method_data.card.card_exp_month",
                            "display_name": "card_exp_month",
                            "field_type": "user_card_expiry_month",
                            "value": null
                        },
                        "payment_method_data.card.card_number": {
                            "required_field": "payment_method_data.card.card_number",
                            "display_name": "card_number",
                            "field_type": "user_card_number",
                            "value": null
                        },
                        "payment_method_data.card.card_exp_year": {
                            "required_field": "payment_method_data.card.card_exp_year",
                            "display_name": "card_exp_year",
                            "field_type": "user_card_expiry_year",
                            "value": null
                        },
                        "payment_method_data.card.card_cvc": {
                            "required_field": "payment_method_data.card.card_cvc",
                            "display_name": "card_cvc",
                            "field_type": "user_card_cvc",
                            "value": null
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        {
                            "card_network": "Mastercard",
                            "surcharge_details": null,
                            "eligible_connectors": [
                                "stripe"
                            ]
                        },
                        {
                            "card_network": "Visa",
                            "surcharge_details": null,
                            "eligible_connectors": [
                                "stripe"
                            ]
                        }
                    ],
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": null,
                    "required_fields": {
                        "payment_method_data.card.card_cvc": {
                            "required_field": "payment_method_data.card.card_cvc",
                            "display_name": "card_cvc",
                            "field_type": "user_card_cvc",
                            "value": null
                        },
                        "payment_method_data.card.card_number": {
                            "required_field": "payment_method_data.card.card_number",
                            "display_name": "card_number",
                            "field_type": "user_card_number",
                            "value": null
                        },
                        "payment_method_data.card.card_exp_month": {
                            "required_field": "payment_method_data.card.card_exp_month",
                            "display_name": "card_exp_month",
                            "field_type": "user_card_expiry_month",
                            "value": null
                        },
                        "payment_method_data.card.card_exp_year": {
                            "required_field": "payment_method_data.card.card_exp_year",
                            "display_name": "card_exp_year",
                            "field_type": "user_card_expiry_year",
                            "value": null
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        },
        {
            "payment_method": "bank_debit",
            "payment_method_types": [
                {
                    "payment_method_type": "ach",
                    "payment_experience": null,
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": {
                        "eligible_connectors": [
                            "stripe"
                        ]
                    },
                    "bank_transfers": null,
                    "required_fields": {
                        "billing.address.first_name": {
                            "required_field": "payment_method_data.billing.address.first_name",
                            "display_name": "billing_first_name",
                            "field_type": "user_billing_name",
                            "value": "joseph"
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "sepa",
                    "payment_experience": null,
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": {
                        "eligible_connectors": [
                            "stripe"
                        ]
                    },
                    "bank_transfers": null,
                    "required_fields": {
                        "billing.address.first_name": {
                            "required_field": "payment_method_data.billing.address.first_name",
                            "display_name": "billing_first_name",
                            "field_type": "user_billing_name",
                            "value": "joseph"
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "bacs",
                    "payment_experience": null,
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": {
                        "eligible_connectors": [
                            "stripe"
                        ]
                    },
                    "bank_transfers": null,
                    "required_fields": {
                        "billing.address.first_name": {
                            "required_field": "payment_method_data.billing.address.first_name",
                            "display_name": "billing_first_name",
                            "field_type": "user_billing_name",
                            "value": "joseph"
                        }
                    },
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        },
        {
            "payment_method": "bank_transfer",
            "payment_method_types": [
                {
                    "payment_method_type": "ach",
                    "payment_experience": null,
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": {
                        "eligible_connectors": [
                            "stripe"
                        ]
                    },
                    "required_fields": {},
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "sepa",
                    "payment_experience": null,
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": {
                        "eligible_connectors": [
                            "stripe"
                        ]
                    },
                    "required_fields": null,
                    "surcharge_details": null,
                    "pm_auth_connector": null
                },
                {
                    "payment_method_type": "bacs",
                    "payment_experience": null,
                    "card_networks": null,
                    "bank_names": null,
                    "bank_debits": null,
                    "bank_transfers": {
                        "eligible_connectors": [
                            "stripe"
                        ]
                    },
                    "required_fields": null,
                    "surcharge_details": null,
                    "pm_auth_connector": null
                }
            ]
        }
    ],
    "mandate_payment": null,
    "merchant_name": "Sarthak1",
    "show_surcharge_breakup_screen": false,
    "payment_type": "normal",
    "request_external_three_ds_authentication": false,
    "collect_shipping_details_from_wallets": false,
    "collect_billing_details_from_wallets": false
}
```

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
