Bug: [FEATURE] [SHIFT4] Pass metadata to connector



### Feature Description

Pass metadata to connector Shift4

### Possible Implementation

Pass metadata to connector Shift4

### 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/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index eeaf340e103..98793e691ff 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -43,6 +43,7 @@ trait Shift4AuthorizePreprocessingCommon {
     fn get_email_optional(&self) -> Option<pii::Email>;
     fn get_complete_authorize_url(&self) -> Option<String>;
     fn get_currency_required(&self) -> Result<enums::Currency, Error>;
+    fn get_metadata(&self) -> Result<Option<serde_json::Value>, Error>;
     fn get_payment_method_data_required(&self) -> Result<PaymentMethodData, Error>;
 }
 
@@ -88,6 +89,12 @@ impl Shift4AuthorizePreprocessingCommon for PaymentsAuthorizeData {
     fn get_router_return_url(&self) -> Option<String> {
         self.router_return_url.clone()
     }
+
+    fn get_metadata(
+        &self,
+    ) -> Result<Option<serde_json::Value>, error_stack::Report<errors::ConnectorError>> {
+        Ok(self.metadata.clone())
+    }
 }
 
 impl Shift4AuthorizePreprocessingCommon for PaymentsPreProcessingData {
@@ -117,12 +124,18 @@ impl Shift4AuthorizePreprocessingCommon for PaymentsPreProcessingData {
     fn get_router_return_url(&self) -> Option<String> {
         self.router_return_url.clone()
     }
+    fn get_metadata(
+        &self,
+    ) -> Result<Option<serde_json::Value>, error_stack::Report<errors::ConnectorError>> {
+        Ok(None)
+    }
 }
 #[derive(Debug, Serialize)]
 pub struct Shift4PaymentsRequest {
     amount: MinorUnit,
     currency: enums::Currency,
     captured: bool,
+    metadata: Option<serde_json::Value>,
     #[serde(flatten)]
     payment_method: Shift4PaymentMethod,
 }
@@ -275,11 +288,13 @@ where
         let submit_for_settlement = item.router_data.request.is_automatic_capture()?;
         let amount = item.amount.to_owned();
         let currency = item.router_data.request.get_currency_required()?;
+        let metadata = item.router_data.request.get_metadata()?;
         let payment_method = Shift4PaymentMethod::try_from(item.router_data)?;
         Ok(Self {
             amount,
             currency,
             captured: submit_for_settlement,
+            metadata,
             payment_method,
         })
     }
@@ -641,9 +656,11 @@ impl<T> TryFrom<&Shift4RouterData<&RouterData<T, CompleteAuthorizeData, Payments
             Some(PaymentMethodData::Card(_)) => {
                 let card_token: Shift4CardToken =
                     to_connector_meta(item.router_data.request.connector_meta.clone())?;
+                let metadata = item.router_data.request.metadata.clone();
                 Ok(Self {
                     amount: item.amount.to_owned(),
                     currency: item.router_data.request.currency,
+                    metadata,
                     payment_method: Shift4PaymentMethod::CardsNon3DSRequest(Box::new(
                         CardsNon3DSRequest {
                             card: CardPayment::CardToken(card_token.id),

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

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

## Description
<!-- Describe your changes in detail -->
Pass metadata to connector Shift4.

### 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).
-->
https://github.com/juspay/hyperswitch/issues/9255

## 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)?
-->
Payment Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_eJHaeshBvRK6V5mOAoloL5aRczu82zuQt41YvafbbOxn5nDxMNIHOWsJ5TDCT8dJ' \
--data-raw '{
    "amount": 5556,
    "currency": "USD",
    "confirm": true,
    "profile_id": "pro_mId6vzqmEh4dUmJyLRSI", 
    "authentication_type": "no_three_ds",
    "customer": {
        "id": "deepanshu",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4012001800000016",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "card_cvc": "123"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.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": "128.0.0.1"
    },
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    }
}'
```

Payment Response:
```
{
    "payment_id": "pay_Xb9hjoMzOeSqH14S1HXy",
    "merchant_id": "merchant_1756889332",
    "status": "succeeded",
    "amount": 5556,
    "net_amount": 5556,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 5556,
    "connector": "shift4",
    "client_secret": "pay_Xb9hjoMzOeSqH14S1HXy_secret_EYxCuRxvHkZu7WyJW1Hh",
    "created": "2025-09-03T09:34:00.407Z",
    "currency": "USD",
    "customer_id": "deepanshu",
    "customer": {
        "id": "deepanshu",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0016",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "401200",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_whphrdy66T0EROtSP61h",
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe",
            "origin_zip": null
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": null,
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "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": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "deepanshu",
        "created_at": 1756892040,
        "expires": 1756895640,
        "secret": "epk_00a0b91c83104def83f9758c18ee9034"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "char_pBsemSHNsodexllVdUWYvyUi",
    "frm_message": null,
    "metadata": {
        "order_id": "ORD-12345",
        "customer_segment": "premium",
        "purchase_platform": "web_store"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "char_pBsemSHNsodexllVdUWYvyUi",
    "payment_link": null,
    "profile_id": "pro_mId6vzqmEh4dUmJyLRSI",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lLEdkj8jX102T4hpRpLE",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-09-03T09:49:00.407Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "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",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-09-03T09:34:01.500Z",
    "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": null,
    "card_discovery": "manual",
    "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
}
```

Shift4 Dashboard:
<img width="1955" height="217" alt="image" src="https://github.com/user-attachments/assets/47fb3ce8-0687-41f1-990b-2d8c30e8b65f" />

Cypress:
<img width="822" height="1071" alt="image" src="https://github.com/user-attachments/assets/af192e95-66a5-49d6-a0f7-7960b8e1e76a" />



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