Bug: [BUG] Network token data is being fetched in CIT repeat irrespective of connector



Currently, Network token data is being fetched in CIT repeat irrespective of connector decided by routing. this would to lead to failure of payments with "payment method not implemented".

New Implementation - 
connector decide should be validated whether it is present in network_token_connector_list. if present, network token data should be fetched else card details should be fetched from card vault to make a transaction
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 599d696ec06..39889bf7577 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -588,6 +588,7 @@ pub async fn retrieve_payment_method_with_token(
                 mandate_id,
                 payment_method_info,
                 business_profile,
+                payment_attempt.connector.clone(),
             )
             .await
             .map(|card| Some((card, enums::PaymentMethod::Card)))?
@@ -622,6 +623,7 @@ pub async fn retrieve_payment_method_with_token(
                 mandate_id,
                 payment_method_info,
                 business_profile,
+                payment_attempt.connector.clone(),
             )
             .await
             .map(|card| Some((card, enums::PaymentMethod::Card)))?
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e7de03804d1..f061977e28a 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1915,6 +1915,7 @@ pub async fn retrieve_card_with_permanent_token(
     mandate_id: Option<api_models::payments::MandateIds>,
     payment_method_info: Option<domain::PaymentMethod>,
     business_profile: &domain::Profile,
+    connector: Option<String>,
 ) -> RouterResult<domain::PaymentMethodData> {
     let customer_id = payment_intent
         .customer_id
@@ -1985,7 +1986,28 @@ pub async fn retrieve_card_with_permanent_token(
                 .attach_printable("Payment method data is not present"),
             (Some(ref pm_data), None) => {
                 // Regular (non-mandate) Payment flow
-                if let Some(token_ref) = pm_data.network_token_requestor_reference_id.clone() {
+                let network_tokenization_supported_connectors = &state
+                    .conf
+                    .network_tokenization_supported_connectors
+                    .connector_list;
+                let connector_variant = connector
+                    .as_ref()
+                    .map(|conn| {
+                        api_enums::Connector::from_str(conn.as_str())
+                            .change_context(errors::ApiErrorResponse::InvalidDataValue {
+                                field_name: "connector",
+                            })
+                            .attach_printable_lazy(|| {
+                                format!("unable to parse connector name {connector:?}")
+                            })
+                    })
+                    .transpose()?;
+                if let (Some(_conn), Some(token_ref)) = (
+                    connector_variant
+                        .filter(|conn| network_tokenization_supported_connectors.contains(conn)),
+                    pm_data.network_token_requestor_reference_id.clone(),
+                ) {
+                    logger::info!("Fetching network token data from tokenization service");
                     match network_tokenization::get_token_from_tokenization_service(
                         state, token_ref, pm_data,
                     )
@@ -2015,6 +2037,8 @@ pub async fn retrieve_card_with_permanent_token(
                         }
                     }
                 } else {
+                    logger::info!("Either the connector is not in the NT supported list or token requestor reference ID is absent");
+                    logger::info!("Falling back to fetch card details from locker");
                     fetch_card_details_from_locker(
                         state,
                         customer_id,
@@ -5776,6 +5800,7 @@ pub async fn get_payment_method_details_from_payment_token(
             None,
             None,
             business_profile,
+            payment_attempt.connector.clone(),
         )
         .await
         .map(|card| Some((card, enums::PaymentMethod::Card))),
@@ -5794,6 +5819,7 @@ pub async fn get_payment_method_details_from_payment_token(
             None,
             None,
             business_profile,
+            payment_attempt.connector.clone(),
         )
         .await
         .map(|card| Some((card, enums::PaymentMethod::Card))),

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

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

## Description
<!-- Describe your changes in detail -->
Currently we always fetch network token for the connector that does not support network tokenization.

Fix: we ll only fetch network token if the connector supports network tokenization else fetch card details to make CIT repeat.

### 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)?
-->
test cases - 
Create two MCA ex - Cybersource(network tokenization supported conn), Adyen 
enable network tokenization for business profile
Make saved card flow transaction.
when routable connector list - [Cybersource, Adyen] -> payment should happen with Network token + cryptogram
when routable connector list - [ Adyen, Cybersource] -> payment should happen with card+cvc

CIT -
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
    "amount": 10,
    "amount_to_capture": 10,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "customer1733733309",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "off_session",
    "return_url": "http://127.0.0.1:4040/",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "in sit",
            "user_agent": "amet irure esse"
        }
    },
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "card_number",
            "card_exp_month": "card_exp_month",
            "card_exp_year": "card_exp_year",
            "card_holder_name": "joseph Doe",
            "card_cvc": "947"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        },
        "email": "soppa@gmail.com"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```



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