Bug: Add support for Samsung pay app token flow



Samsung pay provide token in different format for web and app. Hence both of the formates needs to be handled in confirm call.
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 44ac1d3e08d..13d0cc87ccf 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -18929,6 +18929,61 @@
           "FORMAT_TOTAL_ESTIMATED_AMOUNT"
         ]
       },
+      "SamsungPayAppWalletData": {
+        "type": "object",
+        "required": [
+          "3_d_s",
+          "payment_card_brand",
+          "payment_currency_type",
+          "payment_last4_fpan"
+        ],
+        "properties": {
+          "3_d_s": {
+            "$ref": "#/components/schemas/SamsungPayTokenData"
+          },
+          "payment_card_brand": {
+            "$ref": "#/components/schemas/SamsungPayCardBrand"
+          },
+          "payment_currency_type": {
+            "type": "string",
+            "description": "Currency type of the payment"
+          },
+          "payment_last4_dpan": {
+            "type": "string",
+            "description": "Last 4 digits of the device specific card number",
+            "nullable": true
+          },
+          "payment_last4_fpan": {
+            "type": "string",
+            "description": "Last 4 digits of the card number"
+          },
+          "merchant_ref": {
+            "type": "string",
+            "description": "Merchant reference id that was passed in the session call request",
+            "nullable": true
+          },
+          "method": {
+            "type": "string",
+            "description": "Specifies authentication method used",
+            "nullable": true
+          },
+          "recurring_payment": {
+            "type": "boolean",
+            "description": "Value if credential is enabled for recurring payment",
+            "nullable": true
+          }
+        }
+      },
+      "SamsungPayCardBrand": {
+        "type": "string",
+        "enum": [
+          "visa",
+          "mastercard",
+          "amex",
+          "discover",
+          "unknown"
+        ]
+      },
       "SamsungPayMerchantPaymentInformation": {
         "type": "object",
         "required": [
@@ -19021,6 +19076,27 @@
         }
       },
       "SamsungPayWalletCredentials": {
+        "oneOf": [
+          {
+            "$ref": "#/components/schemas/SamsungPayWebWalletData"
+          },
+          {
+            "$ref": "#/components/schemas/SamsungPayAppWalletData"
+          }
+        ]
+      },
+      "SamsungPayWalletData": {
+        "type": "object",
+        "required": [
+          "payment_credential"
+        ],
+        "properties": {
+          "payment_credential": {
+            "$ref": "#/components/schemas/SamsungPayWalletCredentials"
+          }
+        }
+      },
+      "SamsungPayWebWalletData": {
         "type": "object",
         "required": [
           "card_brand",
@@ -19039,8 +19115,7 @@
             "nullable": true
           },
           "card_brand": {
-            "type": "string",
-            "description": "Brand of the payment card"
+            "$ref": "#/components/schemas/SamsungPayCardBrand"
           },
           "card_last4digits": {
             "type": "string",
@@ -19051,17 +19126,6 @@
           }
         }
       },
-      "SamsungPayWalletData": {
-        "type": "object",
-        "required": [
-          "payment_credential"
-        ],
-        "properties": {
-          "payment_credential": {
-            "$ref": "#/components/schemas/SamsungPayWalletCredentials"
-          }
-        }
-      },
       "SdkInformation": {
         "type": "object",
         "description": "SDK Information if request is from SDK",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index a758d457858..0acbdd50a89 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2908,15 +2908,56 @@ pub struct SamsungPayWalletData {
     pub payment_credential: SamsungPayWalletCredentials,
 }
 
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(rename_all = "snake_case", untagged)]
+pub enum SamsungPayWalletCredentials {
+    SamsungPayWalletDataForWeb(SamsungPayWebWalletData),
+    SamsungPayWalletDataForApp(SamsungPayAppWalletData),
+}
+
+impl From<SamsungPayCardBrand> for common_enums::SamsungPayCardBrand {
+    fn from(samsung_pay_card_brand: SamsungPayCardBrand) -> Self {
+        match samsung_pay_card_brand {
+            SamsungPayCardBrand::Visa => Self::Visa,
+            SamsungPayCardBrand::MasterCard => Self::MasterCard,
+            SamsungPayCardBrand::Amex => Self::Amex,
+            SamsungPayCardBrand::Discover => Self::Discover,
+            SamsungPayCardBrand::Unknown => Self::Unknown,
+        }
+    }
+}
+
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
+pub struct SamsungPayAppWalletData {
+    /// Samsung Pay token data
+    #[serde(rename = "3_d_s")]
+    pub token_data: SamsungPayTokenData,
+    /// Brand of the payment card
+    pub payment_card_brand: SamsungPayCardBrand,
+    /// Currency type of the payment
+    pub payment_currency_type: String,
+    /// Last 4 digits of the device specific card number
+    pub payment_last4_dpan: Option<String>,
+    /// Last 4 digits of the card number
+    pub payment_last4_fpan: String,
+    /// Merchant reference id that was passed in the session call request
+    pub merchant_ref: Option<String>,
+    /// Specifies authentication method used
+    pub method: Option<String>,
+    /// Value if credential is enabled for recurring payment
+    pub recurring_payment: Option<bool>,
+}
+
 #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
 #[serde(rename_all = "snake_case")]
-pub struct SamsungPayWalletCredentials {
+pub struct SamsungPayWebWalletData {
     /// Specifies authentication method used
     pub method: Option<String>,
     /// Value if credential is enabled for recurring payment
     pub recurring_payment: Option<bool>,
     /// Brand of the payment card
-    pub card_brand: String,
+    pub card_brand: SamsungPayCardBrand,
     /// Last 4 digits of the card number
     #[serde(rename = "card_last4digits")]
     pub card_last_four_digits: String,
@@ -2938,6 +2979,21 @@ pub struct SamsungPayTokenData {
     pub data: Secret<String>,
 }
 
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(rename_all = "lowercase")]
+pub enum SamsungPayCardBrand {
+    #[serde(alias = "VI")]
+    Visa,
+    #[serde(alias = "MC")]
+    MasterCard,
+    #[serde(alias = "AX")]
+    Amex,
+    #[serde(alias = "DC")]
+    Discover,
+    #[serde(other)]
+    Unknown,
+}
+
 #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
 #[serde(rename_all = "snake_case")]
 pub enum OpenBankingData {
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 5ab05c9a688..4601a818fb3 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1509,6 +1509,16 @@ pub enum PaymentExperience {
     DisplayWaitScreen,
 }
 
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display)]
+#[serde(rename_all = "lowercase")]
+pub enum SamsungPayCardBrand {
+    Visa,
+    MasterCard,
+    Amex,
+    Discover,
+    Unknown,
+}
+
 /// Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.
 #[derive(
     Clone,
diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs
index 3ccfabf021c..165e9fdd1c7 100644
--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs
+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs
@@ -152,7 +152,8 @@ pub struct SamsungPayWalletData {
 pub struct SamsungPayWalletCredentials {
     pub method: Option<String>,
     pub recurring_payment: Option<bool>,
-    pub card_brand: String,
+    pub card_brand: common_enums::SamsungPayCardBrand,
+    pub dpan_last_four_digits: Option<String>,
     #[serde(rename = "card_last4digits")]
     pub card_last_four_digits: String,
     #[serde(rename = "3_d_s")]
@@ -764,6 +765,16 @@ impl From<api_models::payments::ApplePayWalletData> for ApplePayWalletData {
     }
 }
 
+impl From<api_models::payments::SamsungPayTokenData> for SamsungPayTokenData {
+    fn from(samsung_pay_token_data: api_models::payments::SamsungPayTokenData) -> Self {
+        Self {
+            three_ds_type: samsung_pay_token_data.three_ds_type,
+            version: samsung_pay_token_data.version,
+            data: samsung_pay_token_data.data,
+        }
+    }
+}
+
 impl From<api_models::payments::PazeWalletData> for PazeWalletData {
     fn from(value: api_models::payments::PazeWalletData) -> Self {
         Self {
@@ -774,16 +785,29 @@ impl From<api_models::payments::PazeWalletData> for PazeWalletData {
 
 impl From<Box<api_models::payments::SamsungPayWalletData>> for SamsungPayWalletData {
     fn from(value: Box<api_models::payments::SamsungPayWalletData>) -> Self {
-        Self {
-            payment_credential: SamsungPayWalletCredentials {
-                method: value.payment_credential.method,
-                recurring_payment: value.payment_credential.recurring_payment,
-                card_brand: value.payment_credential.card_brand,
-                card_last_four_digits: value.payment_credential.card_last_four_digits,
-                token_data: SamsungPayTokenData {
-                    three_ds_type: value.payment_credential.token_data.three_ds_type,
-                    version: value.payment_credential.token_data.version,
-                    data: value.payment_credential.token_data.data,
+        match value.payment_credential {
+            api_models::payments::SamsungPayWalletCredentials::SamsungPayWalletDataForApp(
+                samsung_pay_app_wallet_data,
+            ) => Self {
+                payment_credential: SamsungPayWalletCredentials {
+                    method: samsung_pay_app_wallet_data.method,
+                    recurring_payment: samsung_pay_app_wallet_data.recurring_payment,
+                    card_brand: samsung_pay_app_wallet_data.payment_card_brand.into(),
+                    dpan_last_four_digits: samsung_pay_app_wallet_data.payment_last4_dpan,
+                    card_last_four_digits: samsung_pay_app_wallet_data.payment_last4_fpan,
+                    token_data: samsung_pay_app_wallet_data.token_data.into(),
+                },
+            },
+            api_models::payments::SamsungPayWalletCredentials::SamsungPayWalletDataForWeb(
+                samsung_pay_web_wallet_data,
+            ) => Self {
+                payment_credential: SamsungPayWalletCredentials {
+                    method: samsung_pay_web_wallet_data.method,
+                    recurring_payment: samsung_pay_web_wallet_data.recurring_payment,
+                    card_brand: samsung_pay_web_wallet_data.card_brand.into(),
+                    dpan_last_four_digits: None,
+                    card_last_four_digits: samsung_pay_web_wallet_data.card_last_four_digits,
+                    token_data: samsung_pay_web_wallet_data.token_data.into(),
                 },
             },
         }
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 24fbadc0a59..a818e393f26 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -424,6 +424,9 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::payments::GooglePayPaymentMethodInfo,
         api_models::payments::ApplePayWalletData,
         api_models::payments::SamsungPayWalletCredentials,
+        api_models::payments::SamsungPayWebWalletData,
+        api_models::payments::SamsungPayAppWalletData,
+        api_models::payments::SamsungPayCardBrand,
         api_models::payments::SamsungPayTokenData,
         api_models::payments::ApplepayPaymentMethod,
         api_models::payments::PaymentsCancelRequest,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index bc44068030b..dbd19e39212 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -366,6 +366,9 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::payments::SamsungPayAmountFormat,
         api_models::payments::SamsungPayProtocolType,
         api_models::payments::SamsungPayWalletCredentials,
+        api_models::payments::SamsungPayWebWalletData,
+        api_models::payments::SamsungPayAppWalletData,
+        api_models::payments::SamsungPayCardBrand,
         api_models::payments::SamsungPayTokenData,
         api_models::payments::PaymentsCancelRequest,
         api_models::payments::PaymentListConstraints,
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 8a6c3c075ff..d3eb6544157 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -1666,7 +1666,7 @@ impl
         let processing_information = ProcessingInformation::try_from((
             item,
             Some(PaymentSolution::SamsungPay),
-            Some(samsung_pay_data.payment_credential.card_brand),
+            Some(samsung_pay_data.payment_credential.card_brand.to_string()),
         ))?;
         let client_reference_information = ClientReferenceInformation::from(item);
         let merchant_defined_information = item

## 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 -->
Samsung pay provide token in different format for web and app. Hence both of the formates needs to be handled in confirm call.

### Additional Changes

- [x] 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)?
-->
-> Create merchant connector account with samsung pay enabled
-> Create a payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data '{
  "amount": 100000,
  "currency": "USD",
  "capture_method": "automatic",
  "authentication_type": "no_three_ds",
  "confirm": false,
  "customer_id": "cu_1727978246"
}'
```
```
{
    "payment_id": "pay_Zl8NvZrYRBm9cAwOJrJE",
    "merchant_id": "merchant_1728361524",
    "status": "requires_payment_method",
    "amount": 100000,
    "net_amount": 100000,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_Zl8NvZrYRBm9cAwOJrJE_secret_R0cSTWF8DWj2yDhqdGKF",
    "created": "2024-10-08T04:25:38.101Z",
    "currency": "USD",
    "customer_id": "cu_1727978246",
    "customer": {
        "id": "cu_1727978246",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "description": null,
    "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": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1727978246",
        "created_at": 1728361538,
        "expires": 1728365138,
        "secret": "epk_0654d9d63e3f4b8587a3a5d6c00973cb"
    },
    "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_O42vzFfJB6dDqb4XUPrZ",
    "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": "2024-10-08T04:40:38.101Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-08T04:25:38.146Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
```

-> Sessions call
```
curl --location 'http://localhost:8080/payments/session_tokens' \
--header 'Content-Type: application/json' \
--header 'x-browser-name: Chrome' \
--header 'x-client-platform: web' \
--header 'x-merchant-domain: sdk-test-app.netlify.app' \
--header 'api-key: pk_dev_486c819214dc4b96a6b09c73bc784c99' \
--data '{
    "payment_id": "pay_Zl8NvZrYRBm9cAwOJrJE",
    "wallets": [],
    "client_secret": "pay_Zl8NvZrYRBm9cAwOJrJE_secret_R0cSTWF8DWj2yDhqdGKF"
}'
```
```
{
    "payment_id": "pay_Zl8NvZrYRBm9cAwOJrJE",
    "client_secret": "pay_Zl8NvZrYRBm9cAwOJrJE_secret_R0cSTWF8DWj2yDhqdGKF",
    "session_token": [
        {
            "wallet_name": "google_pay",
            "merchant_info": {
                "merchant_name": "Stripe"
            },
            "shipping_address_required": false,
            "email_required": false,
            "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": false
                    },
                    "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": "1000.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_Zl8NvZrYRBm9cAwOJrJE",
            "merchant": {
                "name": "Hyperswitch",
                "url": "sdk-test-app.netlify.app",
                "country_code": "IN"
            },
            "amount": {
                "option": "FORMAT_TOTAL_PRICE_ONLY",
                "currency_code": "USD",
                "total": "1000.00"
            },
            "protocol": "PROTOCOL3DS",
            "allowed_brands": [
                "visa",
                "masterCard",
                "amex",
                "discover"
            ]
        },
        {
            "wallet_name": "apple_pay",
            "payment_request_data": {
                "country_code": "US",
                "currency_code": "USD",
                "total": {
                    "label": "applepay",
                    "type": "final",
                    "amount": "1000.00"
                },
                "merchant_capabilities": [
                    "supports3DS"
                ],
                "supported_networks": [
                    "visa",
                    "masterCard",
                    "amex",
                    "discover"
                ],
                "merchant_identifier": "merchant.com.hyperswitch.checkout"
            },
            "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
        }
    ]
}
```

-> Confirm call with samsung pay app token format
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data-raw '{
    "amount": 1,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 1,
    "customer_id": "cu_1727978246",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "return_url": "https://google.com",
    "email": "samsungpay@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",
    "payment_method": "wallet",
    "payment_method_type": "samsung_pay",
    "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_method_data": {
        "wallet": {
            "samsung_pay": {
                "payment_credential": {
                    "payment_card_brand": "VI",
                    "payment_currency_type": "USD",
                    "payment_last4_dpan": "****",
                    "payment_last4_fpan": "****",
                    "merchant_ref": "123456",
                    "method": "3DS",
                    "recurring_payment": false,
                    "3_d_s": {
                        "type": "S",
                        "version": "100",
                        "data": ""
                    }
                }
            }
        }
    }
}'
```
```
{
    "payment_id": "pay_FWyeZ5cJuUOhNT2kbtMl",
    "merchant_id": "merchant_1728361524",
    "status": "processing",
    "amount": 1,
    "net_amount": 1,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_FWyeZ5cJuUOhNT2kbtMl_secret_ADiw54HEfb3oJPBpwFkG",
    "created": "2024-10-08T04:28:56.781Z",
    "currency": "USD",
    "customer_id": "cu_1727978246",
    "customer": {
        "id": "cu_1727978246",
        "name": "Joseph Doe",
        "email": "samsungpay@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": "wallet",
    "payment_method_data": {
        "wallet": {},
        "billing": 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": "samsungpay@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "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": "samsung_pay",
    "connector_label": "cybersource_US_default_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1727978246",
        "created_at": 1728361736,
        "expires": 1728365336,
        "secret": "epk_a770a46dcbab4ca6be412ed08cad53d1"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7283617370316400703954",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7283617370316400703954",
    "payment_link": null,
    "profile_id": "pro_O42vzFfJB6dDqb4XUPrZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_nHYXJ9CkuPebtCA98Hjo",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-08T04:43:56.781Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-08T04:28:57.546Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
```

-> Confirm call with samsung pay web token format
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data-raw '{
    "amount": 1,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 1,
    "customer_id": "custhype123",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "return_url": "https://google.com",
    "email": "samsungpay@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",
    "payment_method": "wallet",
    "payment_method_type": "samsung_pay",
    "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_method_data": {
        "wallet": {
            "samsung_pay": {
                "payment_credential": {
                    "card_brand": "visa",
                    "recurring_payment": false,
                    "card_last4digits": "****",
                    "method": "3DS",
                    "3_d_s": {
                        "type": "S",
                        "version": "100",
                        "data": ""
                    }
                }
            }
        }
    }
}'
```
```
{
    "payment_id": "pay_k83FAY7jSP8kaH9kbNZR",
    "merchant_id": "merchant_1728361524",
    "status": "processing",
    "amount": 1,
    "net_amount": 1,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_k83FAY7jSP8kaH9kbNZR_secret_oMJTGbW4JsErHi0k3xrD",
    "created": "2024-10-08T04:30:55.281Z",
    "currency": "USD",
    "customer_id": "custhype123",
    "customer": {
        "id": "custhype123",
        "name": "Joseph Doe",
        "email": "samsungpay@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": "wallet",
    "payment_method_data": {
        "wallet": {},
        "billing": 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": "samsungpay@gmail.com",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "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": "samsung_pay",
    "connector_label": "cybersource_US_default_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "custhype123",
        "created_at": 1728361855,
        "expires": 1728365455,
        "secret": "epk_7fabe834ddc043f6a636672918db7230"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7283618563836006703955",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7283618563836006703955",
    "payment_link": null,
    "profile_id": "pro_O42vzFfJB6dDqb4XUPrZ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_nHYXJ9CkuPebtCA98Hjo",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-10-08T04:45:55.281Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-10-08T04:30:56.767Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_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
