Issue:
Bug: [REFACTOR] Inclusion of kill switch in `configs` table



## Description
This refactor will ensure to be presence of a kill switch(merchant-wise) for Blocklist Feature.
We will always check for a Boolean entry in `configs` table i.e `guard_blocklist_for_{merchant_id}` and all the blocklist flows(validation & fingerprint generation) will only run if the variable is set to be true.
Else if the data is not present it will take it false(as default) and blocklist flows will be disabled.

## Testing steps

### For testing when the blocklist flows are disabled(That are by default) :
```
1. Create a payment
2. Confirm it
After a successful confirm the `fingerprint` entry in the response should be null.
```

### For testing when the blocklist flows are enabled :
```
1. Set/Create the entry `guard_blocklist_for_{merchant_id}` in configs table and set it to true.
```
After this all further testing steps can be followed from the parent [issue](https://github.com/juspay/hyperswitch/issues/3344)

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
This will allow us to enable and disable the blocklist feature based on each merchant's requirements.
The steps to test out this feature can be found in the mentioned issue.

### 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)?
-->


## 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`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable


Testing:

Patch:
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index c81145c5de7..eba32ca0a53 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -719,156 +719,175 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
         let m_db = state.clone().store;
 
         // Validate Blocklist
+        let mut fingerprint_id = None;
+        let mut is_pm_blocklisted = false;
         let merchant_id = payment_data.payment_attempt.merchant_id;
-        let merchant_fingerprint_secret =
-            blocklist_utils::get_merchant_fingerprint_secret(state, &merchant_id).await?;
-
-        // Hashed Fingerprint to check whether or not this payment should be blocked.
-        let card_number_fingerprint = payment_data
-            .payment_method_data
-            .as_ref()
-            .and_then(|pm_data| match pm_data {
-                api_models::payments::PaymentMethodData::Card(card) => {
-                    crypto::HmacSha512::sign_message(
-                        &crypto::HmacSha512,
-                        merchant_fingerprint_secret.as_bytes(),
-                        card.card_number.clone().get_card_no().as_bytes(),
-                    )
-                    .attach_printable("error in pm fingerprint creation")
-                    .map_or_else(
-                        |err| {
-                            logger::error!(error=?err);
-                            None
-                        },
-                        Some,
-                    )
-                }
-                _ => None,
-            })
-            .map(hex::encode);
+        let blocklist_enabled_key = format!("guard_blocklist_for_{merchant_id}");
+        let blocklist_guard_enabled = state
+            .store
+            .find_config_by_key_unwrap_or(&blocklist_enabled_key, Some("false".to_string()))
+            .await;
 
-        // Hashed Cardbin to check whether or not this payment should be blocked.
-        let card_bin_fingerprint = payment_data
-            .payment_method_data
-            .as_ref()
-            .and_then(|pm_data| match pm_data {
-                api_models::payments::PaymentMethodData::Card(card) => {
-                    crypto::HmacSha512::sign_message(
-                        &crypto::HmacSha512,
-                        merchant_fingerprint_secret.as_bytes(),
-                        card.card_number.clone().get_card_isin().as_bytes(),
-                    )
-                    .attach_printable("error in card bin hash creation")
-                    .map_or_else(
-                        |err| {
-                            logger::error!(error=?err);
-                            None
-                        },
-                        Some,
-                    )
-                }
-                _ => None,
-            })
-            .map(hex::encode);
+        let blocklist_guard_enabled: bool = match blocklist_guard_enabled {
+            Ok(config) => serde_json::from_str(&config.config).unwrap_or(false),
 
-        // Hashed Extended Cardbin to check whether or not this payment should be blocked.
-        let extended_card_bin_fingerprint = payment_data
-            .payment_method_data
-            .as_ref()
-            .and_then(|pm_data| match pm_data {
-                api_models::payments::PaymentMethodData::Card(card) => {
-                    crypto::HmacSha512::sign_message(
-                        &crypto::HmacSha512,
-                        merchant_fingerprint_secret.as_bytes(),
-                        card.card_number.clone().get_extended_card_bin().as_bytes(),
-                    )
-                    .attach_printable("error in extended card bin hash creation")
-                    .map_or_else(
-                        |err| {
-                            logger::error!(error=?err);
-                            None
-                        },
-                        Some,
-                    )
+            // If it is not present in db we are defaulting it to false
+            Err(inner) => {
+                if !inner.current_context().is_db_not_found() {
+                    logger::error!("Error fetching guard blocklist enabled config {:?}", inner);
                 }
-                _ => None,
-            })
-            .map(hex::encode);
-
-        let mut fingerprint_id = None;
-
-        //validating the payment method.
-        let mut is_pm_blocklisted = false;
+                false
+            }
+        };
 
-        let mut blocklist_futures = Vec::new();
-        if let Some(card_number_fingerprint) = card_number_fingerprint.as_ref() {
-            blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
-                &merchant_id,
-                card_number_fingerprint,
-            ));
-        }
+        if blocklist_guard_enabled {
+            let merchant_fingerprint_secret =
+                blocklist_utils::get_merchant_fingerprint_secret(state, &merchant_id).await?;
+            // Hashed Fingerprint to check whether or not this payment should be blocked.
+            let card_number_fingerprint = payment_data
+                .payment_method_data
+                .as_ref()
+                .and_then(|pm_data| match pm_data {
+                    api_models::payments::PaymentMethodData::Card(card) => {
+                        crypto::HmacSha512::sign_message(
+                            &crypto::HmacSha512,
+                            merchant_fingerprint_secret.as_bytes(),
+                            card.card_number.clone().get_card_no().as_bytes(),
+                        )
+                        .attach_printable("error in pm fingerprint creation")
+                        .map_or_else(
+                            |err| {
+                                logger::error!(error=?err);
+                                None
+                            },
+                            Some,
+                        )
+                    }
+                    _ => None,
+                })
+                .map(hex::encode);
+
+            // Hashed Cardbin to check whether or not this payment should be blocked.
+            let card_bin_fingerprint = payment_data
+                .payment_method_data
+                .as_ref()
+                .and_then(|pm_data| match pm_data {
+                    api_models::payments::PaymentMethodData::Card(card) => {
+                        crypto::HmacSha512::sign_message(
+                            &crypto::HmacSha512,
+                            merchant_fingerprint_secret.as_bytes(),
+                            card.card_number.clone().get_card_isin().as_bytes(),
+                        )
+                        .attach_printable("error in card bin hash creation")
+                        .map_or_else(
+                            |err| {
+                                logger::error!(error=?err);
+                                None
+                            },
+                            Some,
+                        )
+                    }
+                    _ => None,
+                })
+                .map(hex::encode);
+
+            // Hashed Extended Cardbin to check whether or not this payment should be blocked.
+            let extended_card_bin_fingerprint = payment_data
+                .payment_method_data
+                .as_ref()
+                .and_then(|pm_data| match pm_data {
+                    api_models::payments::PaymentMethodData::Card(card) => {
+                        crypto::HmacSha512::sign_message(
+                            &crypto::HmacSha512,
+                            merchant_fingerprint_secret.as_bytes(),
+                            card.card_number.clone().get_extended_card_bin().as_bytes(),
+                        )
+                        .attach_printable("error in extended card bin hash creation")
+                        .map_or_else(
+                            |err| {
+                                logger::error!(error=?err);
+                                None
+                            },
+                            Some,
+                        )
+                    }
+                    _ => None,
+                })
+                .map(hex::encode);
+
+            //validating the payment method.
+            let mut blocklist_futures = Vec::new();
+            if let Some(card_number_fingerprint) = card_number_fingerprint.as_ref() {
+                blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
+                    &merchant_id,
+                    card_number_fingerprint,
+                ));
+            }
 
-        if let Some(card_bin_fingerprint) = card_bin_fingerprint.as_ref() {
-            blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
-                &merchant_id,
-                card_bin_fingerprint,
-            ));
-        }
+            if let Some(card_bin_fingerprint) = card_bin_fingerprint.as_ref() {
+                blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
+                    &merchant_id,
+                    card_bin_fingerprint,
+                ));
+            }
 
-        if let Some(extended_card_bin_fingerprint) = extended_card_bin_fingerprint.as_ref() {
-            blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
-                &merchant_id,
-                extended_card_bin_fingerprint,
-            ));
-        }
+            if let Some(extended_card_bin_fingerprint) = extended_card_bin_fingerprint.as_ref() {
+                blocklist_futures.push(db.find_blocklist_lookup_entry_by_merchant_id_fingerprint(
+                    &merchant_id,
+                    extended_card_bin_fingerprint,
+                ));
+            }
 
-        let blocklist_lookups = futures::future::join_all(blocklist_futures).await;
+            let blocklist_lookups = futures::future::join_all(blocklist_futures).await;
 
-        if blocklist_lookups.iter().any(|x| x.is_ok()) {
-            intent_status = storage_enums::IntentStatus::Failed;
-            attempt_status = storage_enums::AttemptStatus::Failure;
-            is_pm_blocklisted = true;
-        }
+            if blocklist_lookups.iter().any(|x| x.is_ok()) {
+                intent_status = storage_enums::IntentStatus::Failed;
+                attempt_status = storage_enums::AttemptStatus::Failure;
+                is_pm_blocklisted = true;
+            }
 
-        if let Some(encoded_hash) = card_number_fingerprint {
-            #[cfg(feature = "kms")]
-            let encrypted_fingerprint = kms::get_kms_client(&state.conf.kms)
-                .await
-                .encrypt(encoded_hash)
-                .await
-                .map_or_else(
-                    |e| {
-                        logger::error!(error=?e, "failed kms encryption of card fingerprint");
-                        None
-                    },
-                    Some,
-                );
-
-            #[cfg(not(feature = "kms"))]
-            let encrypted_fingerprint = Some(encoded_hash);
-
-            if let Some(encrypted_fingerprint) = encrypted_fingerprint {
-                fingerprint_id = db
-                    .insert_blocklist_fingerprint_entry(
-                        diesel_models::blocklist_fingerprint::BlocklistFingerprintNew {
-                            merchant_id,
-                            fingerprint_id: utils::generate_id(consts::ID_LENGTH, "fingerprint"),
-                            encrypted_fingerprint,
-                            data_kind: common_enums::BlocklistDataKind::PaymentMethod,
-                            created_at: common_utils::date_time::now(),
-                        },
-                    )
+            if let Some(encoded_hash) = card_number_fingerprint {
+                #[cfg(feature = "kms")]
+                let encrypted_fingerprint = kms::get_kms_client(&state.conf.kms)
+                    .await
+                    .encrypt(encoded_hash)
                     .await
                     .map_or_else(
                         |e| {
-                            logger::error!(error=?e, "failed storing card fingerprint in db");
+                            logger::error!(error=?e, "failed kms encryption of card fingerprint");
                             None
                         },
-                        |fp| Some(fp.fingerprint_id),
+                        Some,
                     );
+
+                #[cfg(not(feature = "kms"))]
+                let encrypted_fingerprint = Some(encoded_hash);
+
+                if let Some(encrypted_fingerprint) = encrypted_fingerprint {
+                    fingerprint_id = db
+                        .insert_blocklist_fingerprint_entry(
+                            diesel_models::blocklist_fingerprint::BlocklistFingerprintNew {
+                                merchant_id,
+                                fingerprint_id: utils::generate_id(
+                                    consts::ID_LENGTH,
+                                    "fingerprint",
+                                ),
+                                encrypted_fingerprint,
+                                data_kind: common_enums::BlocklistDataKind::PaymentMethod,
+                                created_at: common_utils::date_time::now(),
+                            },
+                        )
+                        .await
+                        .map_or_else(
+                            |e| {
+                                logger::error!(error=?e, "failed storing card fingerprint in db");
+                                None
+                            },
+                            |fp| Some(fp.fingerprint_id),
+                        );
+                }
             }
         }
-
         let surcharge_amount = payment_data
             .surcharge_details
             .as_ref()