Bug: add support to collect customer address details form Samsung Pay based on business profile config and connector required fields



add support to collect customer address details form Samsung Pay based on business profile config and connector required fields
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index c91810a9902..5616da620bd 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -19766,7 +19766,9 @@
           "merchant",
           "amount",
           "protocol",
-          "allowed_brands"
+          "allowed_brands",
+          "billing_address_required",
+          "shipping_address_required"
         ],
         "properties": {
           "version": {
@@ -19796,6 +19798,14 @@
               "type": "string"
             },
             "description": "List of supported card brands"
+          },
+          "billing_address_required": {
+            "type": "boolean",
+            "description": "Is billing address required to be collected from wallet"
+          },
+          "shipping_address_required": {
+            "type": "boolean",
+            "description": "Is shipping address required to be collected from wallet"
           }
         }
       },
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 7b1ba943ee7..b107c2d6b96 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -6570,6 +6570,10 @@ pub struct SamsungPaySessionTokenResponse {
     pub protocol: SamsungPayProtocolType,
     /// List of supported card brands
     pub allowed_brands: Vec<String>,
+    /// Is billing address required to be collected from wallet
+    pub billing_address_required: bool,
+    /// Is shipping address required to be collected from wallet
+    pub shipping_address_required: bool,
 }
 
 #[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index f6e5d1e7f05..662453c4a3e 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -610,8 +610,11 @@ fn create_paze_session_token(
 }
 
 fn create_samsung_pay_session_token(
+    state: &routes::SessionState,
     router_data: &types::PaymentsSessionRouterData,
     header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+    connector: &api::ConnectorData,
+    business_profile: &domain::Profile,
 ) -> RouterResult<types::PaymentsSessionRouterData> {
     let samsung_pay_session_token_data = router_data
         .connector_wallets_details
@@ -657,6 +660,20 @@ fn create_samsung_pay_session_token(
 
     let formatted_payment_id = router_data.payment_id.replace("_", "-");
 
+    let billing_address_required = is_billing_address_required_to_be_collected_from_wallet(
+        state,
+        connector,
+        business_profile,
+        enums::PaymentMethodType::SamsungPay,
+    );
+
+    let shipping_address_required = is_shipping_address_required_to_be_collected_form_wallet(
+        state,
+        connector,
+        business_profile,
+        enums::PaymentMethodType::SamsungPay,
+    );
+
     Ok(types::PaymentsSessionRouterData {
         response: Ok(types::PaymentsResponseData::SessionResponse {
             session_token: payment_types::SessionToken::SamsungPay(Box::new(
@@ -677,6 +694,8 @@ fn create_samsung_pay_session_token(
                     },
                     protocol: payment_types::SamsungPayProtocolType::Protocol3ds,
                     allowed_brands: samsung_pay_wallet_details.allowed_brands,
+                    billing_address_required,
+                    shipping_address_required,
                 },
             )),
         }),
@@ -684,6 +703,86 @@ fn create_samsung_pay_session_token(
     })
 }
 
+/// Function to determine whether the billing address is required to be collected from the wallet,
+/// based on business profile settings, the payment method type, and the connector's required fields
+/// for the specific payment method.
+///
+/// If `always_collect_billing_details_from_wallet_connector` is enabled, it indicates that the
+/// billing address is always required to be collected from the wallet.
+///
+/// If only `collect_billing_details_from_wallet_connector` is enabled, the billing address will be
+/// collected only if the connector required fields for the specific payment method type contain
+/// the billing fields.
+fn is_billing_address_required_to_be_collected_from_wallet(
+    state: &routes::SessionState,
+    connector: &api::ConnectorData,
+    business_profile: &domain::Profile,
+    payment_method_type: enums::PaymentMethodType,
+) -> bool {
+    let always_collect_billing_details_from_wallet_connector = business_profile
+        .always_collect_billing_details_from_wallet_connector
+        .unwrap_or(false);
+
+    if always_collect_billing_details_from_wallet_connector {
+        always_collect_billing_details_from_wallet_connector
+    } else if business_profile
+        .collect_billing_details_from_wallet_connector
+        .unwrap_or(false)
+    {
+        let billing_variants = enums::FieldType::get_billing_variants();
+
+        is_dynamic_fields_required(
+            &state.conf.required_fields,
+            enums::PaymentMethod::Wallet,
+            payment_method_type,
+            connector.connector_name,
+            billing_variants,
+        )
+    } else {
+        false
+    }
+}
+
+/// Function to determine whether the shipping address is required to be collected from the wallet,
+/// based on business profile settings, the payment method type, and the connector required fields
+/// for the specific payment method type.
+///
+/// If `always_collect_shipping_details_from_wallet_connector` is enabled, it indicates that the
+/// shipping address is always required to be collected from the wallet.
+///
+/// If only `collect_shipping_details_from_wallet_connector` is enabled, the shipping address will be
+/// collected only if the connector required fields for the specific payment method type contain
+/// the shipping fields.
+fn is_shipping_address_required_to_be_collected_form_wallet(
+    state: &routes::SessionState,
+    connector: &api::ConnectorData,
+    business_profile: &domain::Profile,
+    payment_method_type: enums::PaymentMethodType,
+) -> bool {
+    let always_collect_shipping_details_from_wallet_connector = business_profile
+        .always_collect_shipping_details_from_wallet_connector
+        .unwrap_or(false);
+
+    if always_collect_shipping_details_from_wallet_connector {
+        always_collect_shipping_details_from_wallet_connector
+    } else if business_profile
+        .collect_shipping_details_from_wallet_connector
+        .unwrap_or(false)
+    {
+        let shipping_variants = enums::FieldType::get_shipping_variants();
+
+        is_dynamic_fields_required(
+            &state.conf.required_fields,
+            enums::PaymentMethod::Wallet,
+            payment_method_type,
+            connector.connector_name,
+            shipping_variants,
+        )
+    } else {
+        false
+    }
+}
+
 fn get_session_request_for_simplified_apple_pay(
     apple_pay_merchant_identifier: String,
     session_token_data: payment_types::SessionTokenForSimplifiedApplePay,
@@ -865,27 +964,12 @@ fn create_gpay_session_token(
             ..router_data.clone()
         })
     } else {
-        let always_collect_billing_details_from_wallet_connector = business_profile
-            .always_collect_billing_details_from_wallet_connector
-            .unwrap_or(false);
-
-        let is_billing_details_required = if always_collect_billing_details_from_wallet_connector {
-            always_collect_billing_details_from_wallet_connector
-        } else if business_profile
-            .collect_billing_details_from_wallet_connector
-            .unwrap_or(false)
-        {
-            let billing_variants = enums::FieldType::get_billing_variants();
-            is_dynamic_fields_required(
-                &state.conf.required_fields,
-                enums::PaymentMethod::Wallet,
-                enums::PaymentMethodType::GooglePay,
-                connector.connector_name,
-                billing_variants,
-            )
-        } else {
-            false
-        };
+        let is_billing_details_required = is_billing_address_required_to_be_collected_from_wallet(
+            state,
+            connector,
+            business_profile,
+            enums::PaymentMethodType::GooglePay,
+        );
 
         let required_amount_type = StringMajorUnitForConnector;
         let google_pay_amount = required_amount_type
@@ -904,29 +988,13 @@ fn create_gpay_session_token(
             total_price: google_pay_amount,
         };
 
-        let always_collect_shipping_details_from_wallet_connector = business_profile
-            .always_collect_shipping_details_from_wallet_connector
-            .unwrap_or(false);
-
         let required_shipping_contact_fields =
-            if always_collect_shipping_details_from_wallet_connector {
-                true
-            } else if business_profile
-                .collect_shipping_details_from_wallet_connector
-                .unwrap_or(false)
-            {
-                let shipping_variants = enums::FieldType::get_shipping_variants();
-
-                is_dynamic_fields_required(
-                    &state.conf.required_fields,
-                    enums::PaymentMethod::Wallet,
-                    enums::PaymentMethodType::GooglePay,
-                    connector.connector_name,
-                    shipping_variants,
-                )
-            } else {
-                false
-            };
+            is_shipping_address_required_to_be_collected_form_wallet(
+                state,
+                connector,
+                business_profile,
+                enums::PaymentMethodType::GooglePay,
+            );
 
         if connector_wallets_details.google_pay.is_some() {
             let gpay_data = router_data
@@ -1199,9 +1267,13 @@ impl RouterDataSession for types::PaymentsSessionRouterData {
             api::GetToken::GpayMetadata => {
                 create_gpay_session_token(state, self, connector, business_profile)
             }
-            api::GetToken::SamsungPayMetadata => {
-                create_samsung_pay_session_token(self, header_payload)
-            }
+            api::GetToken::SamsungPayMetadata => create_samsung_pay_session_token(
+                state,
+                self,
+                header_payload,
+                connector,
+                business_profile,
+            ),
             api::GetToken::ApplePayMetadata => {
                 create_applepay_session_token(
                     state,

## 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 -->
This pull request includes changes to enhance the handling of billing and shipping address requirements for Samsung Pay and Google Pay session tokens. The most important changes include adding new fields to the `SamsungPaySessionTokenResponse` struct, updating the `create_samsung_pay_session_token` function to include these new fields, and refactoring the code to use helper functions for determining address requirements.

Enhancements to session token handling:

* Added `billing_address_required` and `shipping_address_required` fields to the `SamsungPaySessionTokenResponse` struct.

* Updated the `create_samsung_pay_session_token` function to include the new address requirement fields and refactored the logic to use helper functions for determining if billing and shipping addresses are required.

Refactoring for address requirement determination:

* Introduced the `is_billing_address_required_to_be_collected_from_wallet` and `is_shipping_address_required_to_be_collected_form_wallet` functions to encapsulate the logic for determining address requirements based on business profile settings and connector fields.

* Refactored the `create_gpay_session_token` function to use the new helper functions for determining billing and shipping address requirements.

### 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).
-->
Collect the customer's address details from Samsung Pay during payment to enhance the customer experience

## 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)?
-->
-> Create a merchant connector account with the samsung pay enabled for it
-> Create a payment with confirm false
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
    "amount": 6100,
    "currency": "USD",
    "confirm": false,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 6100,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "return_url": "https://google.com",
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "customer_id": "1739970997",
    
    "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"
        }
    }
}'
```
```
{
    "payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
    "merchant_id": "merchant_1739965434",
    "status": "requires_payment_method",
    "amount": 6100,
    "net_amount": 6100,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL",
    "created": "2025-02-19T13:16:04.153Z",
    "currency": "USD",
    "customer_id": "1739970964",
    "customer": {
        "id": "1739970964",
        "name": "Joseph Doe",
        "email": "something@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "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": "automatic",
    "payment_method": null,
    "payment_method_data": null,
    "payment_token": null,
    "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"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "something@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": null,
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "1739970964",
        "created_at": 1739970964,
        "expires": 1739974564,
        "secret": "epk_40529c632d7946338b7ad09430a613e6"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_2STAgRa16ISVgMLO11F2",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-19T13:31:04.153Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-02-19T13:16:04.173Z",
    "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": null
}
```
-> Set the below profile configuration
```
curl --location 'http://localhost:8080/account/merchant_1739965434/business_profile/pro_2STAgRa16ISVgMLO11F2' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
    "collect_billing_details_from_wallet_connector": false,
    "collect_shipping_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": true,
    "always_collect_billing_details_from_wallet_connector": true,
}'
```
```
{
    "merchant_id": "merchant_1739965434",
    "profile_id": "pro_2STAgRa16ISVgMLO11F2",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "0txdls9EorK9Gzx1OYRGV0X9xS87pn5sUxfFHFlfq9endVIs7S1iqV5TnCsZUYD7",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": null,
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": false,
    "collect_billing_details_from_wallet_connector": false,
    "always_collect_shipping_details_from_wallet_connector": true,
    "always_collect_billing_details_from_wallet_connector": true,
    "is_connector_agnostic_mit_enabled": true,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null
}
```
-> For this profile configuration the `shipping_address_required` and `billing_address_required` be true in the session resposne
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: api-key' \
--data '{
    "payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
    "wallets": [],
    "client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL"
}'
```
```
{
    "payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
    "client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL",
    "session_token": [
        {
            "wallet_name": "google_pay",
            "merchant_info": {
                "merchant_name": "Stripe"
            },
            "shipping_address_required": true,
            "email_required": true,
            "shipping_address_parameters": {
                "phone_number_required": true
            },
            "allowed_payment_methods": [
                {
                    "type": "CARD",
                    "parameters": {
                        "allowed_auth_methods": [
                            "PAN_ONLY",
                            "CRYPTOGRAM_3DS"
                        ],
                        "allowed_card_networks": [
                            "AMEX",
                            "DISCOVER",
                            "INTERAC",
                            "JCB",
                            "MASTERCARD",
                            "VISA"
                        ],
                        "billing_address_required": true,
                        "billing_address_parameters": {
                            "phone_number_required": true,
                            "format": "FULL"
                        }
                    },
                    "tokenization_specification": {
                        "type": "PAYMENT_GATEWAY",
                        "parameters": {
                            "gateway": "stripe",
                            "stripe:version": "2018-10-31",
                            "stripe:publishableKey": "pk_test_51Msk2GAGHc77EJXX78h549SX2uaOnEkUYqBfjcoD05PIpAnDkYxMn8nQ4d19im85NQuX4Z6WDyHaUw2fFTPBWsIY00Wa7oNerO"
                        }
                    }
                }
            ],
            "transaction_info": {
                "country_code": "US",
                "currency_code": "USD",
                "total_price_status": "Final",
                "total_price": "61.00"
            },
            "delayed_session_token": false,
            "connector": "cybersource",
            "sdk_next_action": {
                "next_action": "confirm"
            },
            "secrets": null
        },
        {
            "wallet_name": "samsung_pay",
            "version": "2",
            "service_id": "49400558c67f4a97b3925f",
            "order_number": "pay-2B9WMNGYhzpVoUHGxvpS",
            "merchant": {
                "name": "Hyperswitch",
                "url": null,
                "country_code": "IN"
            },
            "amount": {
                "option": "FORMAT_TOTAL_PRICE_ONLY",
                "currency_code": "USD",
                "total": "61.00"
            },
            "protocol": "PROTOCOL3DS",
            "allowed_brands": [
                "visa",
                "masterCard",
                "amex",
                "discover"
            ],
            "billing_address_required": true,
            "shipping_address_required": true
        },
        {
            "wallet_name": "apple_pay",
            "session_token_data": {},
            "payment_request_data": {
                "country_code": "AU",
                "currency_code": "USD",
                "total": {
                    "label": "applepay",
                    "type": "final",
                    "amount": "61.00"
                },
                "merchant_capabilities": [
                    "supports3DS"
                ],
                "supported_networks": [
                    "visa",
                    "masterCard",
                    "amex",
                    "discover"
                ],
                "merchant_identifier": "merchant.sandbox.hyperswitch",
                "required_billing_contact_fields": [
                    "postalAddress"
                ],
                "required_shipping_contact_fields": [
                    "postalAddress",
                    "phone",
                    "email"
                ]
            },
            "connector": "cybersource",
            "delayed_session_token": false,
            "sdk_next_action": {
                "next_action": "confirm"
            },
            "connector_reference_id": null,
            "connector_sdk_public_key": null,
            "connector_merchant_id": null
        }
    ]
}
```
-> Set the below profile  configuration
```
curl --location 'http://localhost:8080/account/merchant_1739965434/business_profile/pro_2STAgRa16ISVgMLO11F2' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
    "collect_billing_details_from_wallet_connector": true,
    "collect_shipping_details_from_wallet_connector": true,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": true

}'
```
```
{
    "merchant_id": "merchant_1739965434",
    "profile_id": "pro_2STAgRa16ISVgMLO11F2",
    "profile_name": "US_default",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "0txdls9EorK9Gzx1OYRGV0X9xS87pn5sUxfFHFlfq9endVIs7S1iqV5TnCsZUYD7",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": null,
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "routing_algorithm": null,
    "intent_fulfillment_time": 900,
    "frm_routing_algorithm": null,
    "payout_routing_algorithm": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector": true,
    "collect_billing_details_from_wallet_connector": true,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": true,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "is_auto_retries_enabled": false,
    "max_auto_retries_enabled": null,
    "always_request_extended_authorization": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null
}
```
-> As per the above profile configuration the the `billing_address_required` will be `true` as the cybersource requires billing derails to be passed and `shipping_address_required` will be `false` as shipping details are not required by cybserourec.
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'api-key: api-key' \
--data '{
    "payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
    "wallets": [],
    "client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL"
}'
```
```
{
    "payment_id": "pay_2B9WMNGYhzpVoUHGxvpS",
    "client_secret": "pay_2B9WMNGYhzpVoUHGxvpS_secret_vQZZ2vDYnZJOUi8JDVdL",
    "session_token": [
        {
            "wallet_name": "google_pay",
            "merchant_info": {
                "merchant_name": "Stripe"
            },
            "shipping_address_required": false,
            "email_required": true,
            "shipping_address_parameters": {
                "phone_number_required": false
            },
            "allowed_payment_methods": [
                {
                    "type": "CARD",
                    "parameters": {
                        "allowed_auth_methods": [
                            "PAN_ONLY",
                            "CRYPTOGRAM_3DS"
                        ],
                        "allowed_card_networks": [
                            "AMEX",
                            "DISCOVER",
                            "INTERAC",
                            "JCB",
                            "MASTERCARD",
                            "VISA"
                        ],
                        "billing_address_required": true,
                        "billing_address_parameters": {
                            "phone_number_required": true,
                            "format": "FULL"
                        }
                    },
                    "tokenization_specification": {
                        "type": "PAYMENT_GATEWAY",
                        "parameters": {
                            "gateway": "stripe",
                            "stripe:version": "2018-10-31",
                            "stripe:publishableKey": "pk_test_51Msk2GAGHc77EJXX78h549SX2uaOnEkUYqBfjcoD05PIpAnDkYxMn8nQ4d19im85NQuX4Z6WDyHaUw2fFTPBWsIY00Wa7oNerO"
                        }
                    }
                }
            ],
            "transaction_info": {
                "country_code": "US",
                "currency_code": "USD",
                "total_price_status": "Final",
                "total_price": "61.00"
            },
            "delayed_session_token": false,
            "connector": "cybersource",
            "sdk_next_action": {
                "next_action": "confirm"
            },
            "secrets": null
        },
        {
            "wallet_name": "samsung_pay",
            "version": "2",
            "service_id": "49400558c67f4a97b3925f",
            "order_number": "pay-2B9WMNGYhzpVoUHGxvpS",
            "merchant": {
                "name": "Hyperswitch",
                "url": null,
                "country_code": "IN"
            },
            "amount": {
                "option": "FORMAT_TOTAL_PRICE_ONLY",
                "currency_code": "USD",
                "total": "61.00"
            },
            "protocol": "PROTOCOL3DS",
            "allowed_brands": [
                "visa",
                "masterCard",
                "amex",
                "discover"
            ],
            "billing_address_required": true,
            "shipping_address_required": false
        },
        {
            "wallet_name": "apple_pay",
            "session_token_data": {},
            "payment_request_data": {
                "country_code": "AU",
                "currency_code": "USD",
                "total": {
                    "label": "applepay",
                    "type": "final",
                    "amount": "61.00"
                },
                "merchant_capabilities": [
                    "supports3DS"
                ],
                "supported_networks": [
                    "visa",
                    "masterCard",
                    "amex",
                    "discover"
                ],
                "merchant_identifier": "merchant.sandbox.hyperswitch",
                "required_billing_contact_fields": [
                    "postalAddress"
                ],
                "required_shipping_contact_fields": [
                    "phone",
                    "email"
                ]
            },
            "connector": "cybersource",
            "delayed_session_token": false,
            "sdk_next_action": {
                "next_action": "confirm"
            },
            "connector_reference_id": null,
            "connector_sdk_public_key": null,
            "connector_merchant_id": null
        }
    ]
}
```

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