Bug: [BUG] MIT for migrated wallet tokens does not go through



### Bug Description

Creating MIT transactions for migrated wallets leads to unexpected behavior -

<img width="1282" height="513" alt="Image" src="https://github.com/user-attachments/assets/cc889293-3916-4f0f-b2a8-8f034a373fee" />

Transaction is incorrectly marked as payment_method_type - debit leading to failed routing

### Expected Behavior

Transaction should be routed as expected.

### Actual Behavior

Migrated wallet MIT transaction is incorrectly marked with incorrect payment_method_type based on the card BIN.

### Steps To Reproduce

1. Migrate wallets (PSP tokens + additional card info - card expiry + last4 + card BIN)
2. Perform MIT transaction 

### Context For The Bug

-

### Environment

Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.

If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``


### Have you spent some time checking if this bug 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/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 0e343a437b6..bcd71636f05 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -662,6 +662,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
         let payment_method_type = Option::<api_models::enums::PaymentMethodType>::foreign_from((
             payment_method_type,
             additional_pm_data.as_ref(),
+            payment_method,
         ));
 
         payment_attempt.payment_method_type = payment_method_type
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 79bfbebf499..1f54b1b72a1 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1266,6 +1266,7 @@ impl PaymentCreate {
         let payment_method_type = Option::<enums::PaymentMethodType>::foreign_from((
             payment_method_type,
             additional_pm_data.as_ref(),
+            payment_method,
         ));
 
         // TODO: remove once https://github.com/juspay/hyperswitch/issues/7421 is fixed
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 66de9b4ee60..484a3ec757e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -5961,38 +5961,67 @@ impl ForeignFrom<diesel_models::ConnectorTokenDetails>
     }
 }
 
-impl ForeignFrom<(Self, Option<&api_models::payments::AdditionalPaymentData>)>
-    for Option<enums::PaymentMethodType>
+impl
+    ForeignFrom<(
+        Self,
+        Option<&api_models::payments::AdditionalPaymentData>,
+        Option<enums::PaymentMethod>,
+    )> for Option<enums::PaymentMethodType>
 {
-    fn foreign_from(req: (Self, Option<&api_models::payments::AdditionalPaymentData>)) -> Self {
-        let (payment_method_type, additional_pm_data) = req;
-        additional_pm_data
-            .and_then(|pm_data| {
-                if let api_models::payments::AdditionalPaymentData::Card(card_info) = pm_data {
-                    card_info.card_type.as_ref().and_then(|card_type_str| {
-                        api_models::enums::PaymentMethodType::from_str(&card_type_str.to_lowercase()).map_err(|err| {
-                            crate::logger::error!(
-                                "Err - {:?}\nInvalid card_type value found in BIN DB - {:?}",
-                                err,
-                                card_type_str,
-                            );
-                        }).ok()
-                    })
-                } else {
-                    None
-                }
-            })
-            .map_or(payment_method_type, |card_type_in_bin_store| {
-                if let Some(card_type_in_req) = payment_method_type {
-                    if card_type_in_req != card_type_in_bin_store {
+    fn foreign_from(
+        req: (
+            Self,
+            Option<&api_models::payments::AdditionalPaymentData>,
+            Option<enums::PaymentMethod>,
+        ),
+    ) -> Self {
+        let (payment_method_type, additional_pm_data, payment_method) = req;
+
+        match (additional_pm_data, payment_method, payment_method_type) {
+            (
+                Some(api_models::payments::AdditionalPaymentData::Card(card_info)),
+                Some(enums::PaymentMethod::Card),
+                original_type,
+            ) => {
+                let bin_card_type = card_info.card_type.as_ref().and_then(|card_type_str| {
+                    let normalized_type = card_type_str.trim().to_lowercase();
+                    if normalized_type.is_empty() {
+                        return None;
+                    }
+                    api_models::enums::PaymentMethodType::from_str(&normalized_type)
+                        .map_err(|_| {
+                            crate::logger::warn!("Invalid BIN card_type: '{}'", card_type_str);
+                        })
+                        .ok()
+                });
+
+                match (original_type, bin_card_type) {
+                    // Override when there's a mismatch
+                    (
+                        Some(
+                            original @ (enums::PaymentMethodType::Debit
+                            | enums::PaymentMethodType::Credit),
+                        ),
+                        Some(bin_type),
+                    ) if original != bin_type => {
+                        crate::logger::info!("BIN lookup override: {} -> {}", original, bin_type);
+                        bin_card_type
+                    }
+                    // Use BIN lookup if no original type exists
+                    (None, Some(bin_type)) => {
                         crate::logger::info!(
-                            "Mismatch in card_type\nAPI request - {}; BIN lookup - {}\nOverriding with {}",
-                            card_type_in_req, card_type_in_bin_store, card_type_in_bin_store,
+                            "BIN lookup override: No original payment method type, using BIN result={}",
+                            bin_type
                         );
+                        Some(bin_type)
                     }
+                    // Default
+                    _ => original_type,
                 }
-                Some(card_type_in_bin_store)
-            })
+            }
+            // Skip BIN lookup for non-card payments
+            _ => payment_method_type,
+        }
     }
 }
 

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

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

## Description
<!-- Describe your changes in detail -->
This PR updates the BIN lookup override logic in payment transformers.rs to ensure payment_method_type is overridden only for Card payment methods.

### Additional Changes

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

## Motivation and Context
This allows performing MIT wallet transactions for migrated wallet tokens.

## How did you test it?

Locally

<details>
    <summary>Run wallet migration</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payment_methods/migrate-batch' \
        --header 'api-key: test_admin' \
        --form 'merchant_id="merchant_1756795715"' \
        --form 'merchant_connector_ids="mca_6wrjYYbE1zrrFSmbB0CJ"' \
        --form 'file=@"wallet-migration.csv"'

Response

    [
        {
            "line_number": 1,
            "payment_method_id": "pm_edmFuErgTu8rvVwUtdTg",
            "payment_method": "wallet",
            "payment_method_type": "google_pay",
            "customer_id": "e4c4a19c2f92c9b61a65d1b1d31bdab9",
            "migration_status": "Success",
            "card_number_masked": "555555XXXXXX4444",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 2,
            "payment_method_id": "pm_KC3l2F4HNRFiwVs8Xjaw",
            "payment_method": "wallet",
            "payment_method_type": "google_pay",
            "customer_id": "03ba537453a18466e42b2f9a92b70599",
            "migration_status": "Success",
            "card_number_masked": "411111XXXXXX1111",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 3,
            "payment_method_id": "pm_zGxLnsiI4Eos0SPsY91Y",
            "payment_method": "wallet",
            "payment_method_type": "apple_pay",
            "customer_id": "c4ff0659d5e8775e9197092247355e8a",
            "migration_status": "Success",
            "card_number_masked": "520424XXXXXX7180",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        },
        {
            "line_number": 4,
            "payment_method_id": "pm_6MueQrSZoca7NDcR5Ui9",
            "payment_method": "wallet",
            "payment_method_type": "apple_pay",
            "customer_id": "4b1f7771d465639a4856e0c246de8a50",
            "migration_status": "Success",
            "card_number_masked": "520424XXXXXX7180",
            "card_migrated": null,
            "network_token_migrated": true,
            "connector_mandate_details_migrated": true,
            "network_transaction_id_migrated": true
        }
    ]

</details>

<details>
    <summary>Perform wallet MIT using migrated token</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_3x1wBsCK5Er6sMaYvQFVxQdzpVi8wfDXgVm6stQ5yZAZfnU4MM5rGXHGjhVaZAIt' \
        --data '{"amount":1000,"currency":"EUR","confirm":true,"capture_on":"2022-09-10T10:11:12Z","customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","profile_id":"pro_SQD3Im1aEzJIm2o6xobw","description":"Its my first payment request","return_url":"https://hyperswitch.io","off_session":true,"recurring_details":{"type":"payment_method_id","data":"pm_edmFuErgTu8rvVwUtdTg"}}'

Response

    {"payment_id":"pay_B9cZsoExS75t62J5G5Gl","merchant_id":"merchant_1756795715","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":null,"connector":"adyen","client_secret":"pay_B9cZsoExS75t62J5G5Gl_secret_1SKcL0XjWp8Rv0upzo7H","created":"2025-09-02T08:45:49.872Z","currency":"EUR","customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","customer":{"id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","name":null,"email":"rsuolf2z6xlke@googlemail.com","phone":null,"phone_country_code":null},"description":"Its my first payment request","refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":true,"capture_on":null,"capture_method":null,"payment_method":"wallet","payment_method_data":{"card":{"last4":"4444","card_type":"CREDIT","card_network":"Mastercard","card_issuer":"MASTERCARD INTERNATIONAL","card_issuing_country":"BRAZIL","card_isin":"555555","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"2027","card_holder_name":null,"payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"rsuolf2z6xlke@googlemail.com","name":null,"phone":null,"return_url":"https://hyperswitch.io/","authentication_type":"no_three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":"UE_9000","unified_message":"Something went wrong","payment_experience":null,"payment_method_type":"google_pay","connector_label":null,"business_country":null,"business_label":"default","business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":{"customer_id":"e4c4a19c2f92c9b61a65d1b1d31bdab9","created_at":1756802749,"expires":1756806349,"secret":"epk_9c30790bc68a4fd997d53b17e9087a9f"},"manual_retry_allowed":true,"connector_transaction_id":"DZFZZDRD5HSN6KV5","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":{"redirect_response":null,"search_tags":null,"apple_pay_recurring_details":null,"gateway_system":"direct"},"reference_id":null,"payment_link":null,"profile_id":"pro_SQD3Im1aEzJIm2o6xobw","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_6wrjYYbE1zrrFSmbB0CJ","incremental_authorization_allowed":false,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-09-02T09:00:49.872Z","fingerprint":null,"browser_info":null,"payment_channel":null,"payment_method_id":"pm_edmFuErgTu8rvVwUtdTg","network_transaction_id":null,"payment_method_status":"active","updated":"2025-09-02T08:45:51.392Z","split_payments":null,"frm_metadata":null,"extended_authorization_applied":null,"capture_before":null,"merchant_order_reference_id":null,"order_tax_amount":null,"connector_mandate_id":"VVBV24y20uF-D20uVHTVD-12m14oZHDBZ20uRXT14oJ22w06g20u20u000232251","card_discovery":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null,"is_iframe_redirection_enabled":null,"whole_connector_response":null,"enable_partial_authorization":null}

</details>


## 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 (logging enhancement - tests not applicable)