Bug: [FEATURE] Add toggle for extended card bin 



### Feature Description

Add toggle for displaying extended card bin in PaymentResposne

### Possible Implementation

Add toggle for displaying extended card bin in PaymentResposne

### 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?

None
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index b62d3afd4a8..5e03033977e 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -243,10 +243,11 @@ where
                                 })
                                 .collect::<Vec<_>>()
                                 .concat();
+
                             let additional_payment_data = match &payment_data.payment_method_data {
                                 Some(pmd) => {
                                     let additional_payment_data =
-                                        get_additional_payment_data(pmd, db).await;
+                                        get_additional_payment_data(pmd, db, &profile_id).await;
                                     Some(additional_payment_data)
                                 }
                                 None => payment_data
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 702b63b5c08..d2a2896de8c 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3649,11 +3649,23 @@ mod test {
 pub async fn get_additional_payment_data(
     pm_data: &api_models::payments::PaymentMethodData,
     db: &dyn StorageInterface,
+    profile_id: &str,
 ) -> api_models::payments::AdditionalPaymentData {
     match pm_data {
         api_models::payments::PaymentMethodData::Card(card_data) => {
             let card_isin = Some(card_data.card_number.clone().get_card_isin());
-            let card_extended_bin = Some(card_data.card_number.clone().get_card_extended_bin());
+            let enable_extended_bin =db
+            .find_config_by_key_unwrap_or(
+                format!("{}_enable_extended_card_bin", profile_id).as_str(),
+             Some("false".to_string()))
+            .await.map_err(|err| services::logger::error!(message="Failed to fetch the config", extended_card_bin_error=?err)).ok();
+
+            let card_extended_bin = match enable_extended_bin {
+                Some(config) if config.config == "true" => {
+                    Some(card_data.card_number.clone().get_card_extended_bin())
+                }
+                _ => None,
+            };
             let last4 = Some(card_data.card_number.clone().get_last4());
             if card_data.card_issuer.is_some()
                 && card_data.card_network.is_some()
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 125f79956ac..89c996236a3 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -415,13 +415,23 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
             .and_then(|pmd| pmd.payment_method_data.clone());
 
         let store = state.clone().store;
+        let profile_id = payment_intent
+            .profile_id
+            .clone()
+            .get_required_value("profile_id")
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("'profile_id' not set in payment intent")?;
 
         let additional_pm_data_fut = tokio::spawn(
             async move {
                 Ok(n_request_payment_method_data
                     .async_map(|payment_method_data| async move {
-                        helpers::get_additional_payment_data(&payment_method_data, store.as_ref())
-                            .await
+                        helpers::get_additional_payment_data(
+                            &payment_method_data,
+                            store.as_ref(),
+                            profile_id.as_ref(),
+                        )
+                        .await
                     })
                     .await)
             }
@@ -1059,12 +1069,19 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
             .clone();
         let payment_token = payment_data.token.clone();
         let payment_method_type = payment_data.payment_attempt.payment_method_type;
+        let profile_id = payment_data
+            .payment_intent
+            .profile_id
+            .as_ref()
+            .get_required_value("profile_id")
+            .change_context(errors::ApiErrorResponse::InternalServerError)?;
         let payment_experience = payment_data.payment_attempt.payment_experience;
         let additional_pm_data = payment_data
             .payment_method_data
             .as_ref()
             .async_map(|payment_method_data| async {
-                helpers::get_additional_payment_data(payment_method_data, &*state.store).await
+                helpers::get_additional_payment_data(payment_method_data, &*state.store, profile_id)
+                    .await
             })
             .await
             .as_ref()
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index aaebccd8802..e770da70747 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -258,7 +258,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
                 .as_ref()
                 .map(|address| address.address_id.clone()),
             attempt_id,
-            profile_id,
+            profile_id.clone(),
             session_expiry,
         )
         .await?;
@@ -277,6 +277,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
                 .map(|address| address.address_id.clone()),
             &payment_method_info,
             merchant_key_store,
+            profile_id,
         )
         .await?;
 
@@ -771,6 +772,7 @@ impl PaymentCreate {
         payment_method_billing_address_id: Option<String>,
         payment_method_info: &Option<PaymentMethod>,
         key_store: &domain::MerchantKeyStore,
+        profile_id: String,
     ) -> RouterResult<(
         storage::PaymentAttemptNew,
         Option<api_models::payments::AdditionalPaymentData>,
@@ -794,7 +796,12 @@ impl PaymentCreate {
                 payment_method_data_request.payment_method_data.as_ref()
             })
             .async_map(|payment_method_data| async {
-                helpers::get_additional_payment_data(payment_method_data, &*state.store).await
+                helpers::get_additional_payment_data(
+                    payment_method_data,
+                    &*state.store,
+                    &profile_id,
+                )
+                .await
             })
             .await;
 
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 804d1dbc800..0aaa6006052 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -593,12 +593,20 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
                 storage_enums::AttemptStatus::ConfirmationAwaited
             }
         };
+        let profile_id = payment_data
+            .payment_intent
+            .profile_id
+            .as_ref()
+            .get_required_value("profile_id")
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable("'profile_id' not set in payment intent")?;
 
         let additional_pm_data = payment_data
             .payment_method_data
             .as_ref()
             .async_map(|payment_method_data| async {
-                helpers::get_additional_payment_data(payment_method_data, &*state.store).await
+                helpers::get_additional_payment_data(payment_method_data, &*state.store, profile_id)
+                    .await
             })
             .await
             .as_ref()

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

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

## Description
Add profile level config to toggle the display for the extended card bin in Payment Response .

### Additional Changes

- [ ] This PR modifies the API contract
- [x] 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?
 

- Create a MA and an MCA
- Make a payment with the toggle for that profile_id as false, as it is default
- In the response the card_bin_extended field will be null
<img width="1049" alt="Screenshot 2024-04-24 at 4 13 09 AM" src="https://github.com/juspay/hyperswitch/assets/55580080/d1dd3166-de79-49fd-8c03-f115125db0a4">

- Now set the toggle for that profile_id as true by hitting the following curl:
```
curl --location 'http://localhost:8080/configs/{profile_id}_enable_extended_card_bin' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: {{admin_api_key}}' \
--data '{
    "key":"{profile_id}_enable_extended_card_bin",
    "value":"true"
}'
```
> <img width="1210" alt="Screenshot 2024-05-02 at 1 06 08 PM" src="https://github.com/juspay/hyperswitch/assets/55580080/89341370-de38-4280-a527-72ca8dc13549">


> > The config will also be stored in the database, to check you can run the following query
> ```
>  SELECT * FROM configs WHERE key = '{profile_id}_enable_extended_card_bin';
>  ```

> <img width="1210" alt="Screenshot 2024-05-02 at 1 07 48 PM" src="https://github.com/juspay/hyperswitch/assets/55580080/c020a3cf-3154-45e6-a079-04a7490a8930">


- Create another payment , now in the Response card_bin_extended field won't be null, as the extended card bin config has been set to true
<img width="1049" alt="Screenshot 2024-04-24 at 4 14 50 AM" src="https://github.com/juspay/hyperswitch/assets/55580080/aab6d569-bfa0-4a3e-bd3b-bebbb3525fbc">





## 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
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
