Bug: [FEATURE] [Authorizedotnet]: Add metadata information to connector request



### Feature Description

[Authorizedotnet]: Add metadata information to connector request

### Possible Implementation

[Authorizedotnet]: Add metadata information to connector request

### 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/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index d2b212e3ea0..8e0af603a3d 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -1,3 +1,5 @@
+use std::collections::BTreeMap;
+
 use common_utils::{
     errors::CustomResult,
     ext_traits::{Encode, ValueExt},
@@ -6,6 +8,7 @@ use error_stack::ResultExt;
 use masking::{ExposeInterface, PeekInterface, Secret, StrongSecret};
 use rand::distributions::{Alphanumeric, DistString};
 use serde::{Deserialize, Serialize};
+use serde_json::Value;
 
 use crate::{
     connector::utils::{
@@ -143,12 +146,27 @@ struct TransactionRequest {
     #[serde(skip_serializing_if = "Option::is_none")]
     bill_to: Option<BillTo>,
     #[serde(skip_serializing_if = "Option::is_none")]
+    user_fields: Option<UserFields>,
+    #[serde(skip_serializing_if = "Option::is_none")]
     processing_options: Option<ProcessingOptions>,
     #[serde(skip_serializing_if = "Option::is_none")]
     subsequent_auth_information: Option<SubsequentAuthInformation>,
     authorization_indicator_type: Option<AuthorizationIndicator>,
 }
 
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UserFields {
+    user_field: Vec<UserField>,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct UserField {
+    name: String,
+    value: String,
+}
+
 #[derive(Serialize, Deserialize, Debug)]
 #[serde(untagged)]
 enum ProfileDetails {
@@ -299,6 +317,25 @@ pub enum ValidationMode {
     LiveMode,
 }
 
+impl ForeignTryFrom<Value> for Vec<UserField> {
+    type Error = error_stack::Report<errors::ConnectorError>;
+    fn foreign_try_from(metadata: Value) -> Result<Self, Self::Error> {
+        let hashmap: BTreeMap<String, Value> = serde_json::from_str(&metadata.to_string())
+            .change_context(errors::ConnectorError::RequestEncodingFailedWithReason(
+                "Failed to serialize request metadata".to_owned(),
+            ))
+            .attach_printable("")?;
+        let mut vector: Self = Self::new();
+        for (key, value) in hashmap {
+            vector.push(UserField {
+                name: key,
+                value: value.to_string(),
+            });
+        }
+        Ok(vector)
+    }
+}
+
 impl TryFrom<&types::SetupMandateRouterData> for CreateCustomerProfileRequest {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(item: &types::SetupMandateRouterData) -> Result<Self, Self::Error> {
@@ -622,6 +659,12 @@ impl
                     zip: address.zip.clone(),
                     country: address.country,
                 }),
+            user_fields: match item.router_data.request.metadata.clone() {
+                Some(metadata) => Some(UserFields {
+                    user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+                }),
+                None => None,
+            },
             processing_options: Some(ProcessingOptions {
                 is_subsequent_auth: true,
             }),
@@ -675,6 +718,12 @@ impl
             },
             customer: None,
             bill_to: None,
+            user_fields: match item.router_data.request.metadata.clone() {
+                Some(metadata) => Some(UserFields {
+                    user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+                }),
+                None => None,
+            },
             processing_options: Some(ProcessingOptions {
                 is_subsequent_auth: true,
             }),
@@ -764,6 +813,12 @@ impl
                     zip: address.zip.clone(),
                     country: address.country,
                 }),
+            user_fields: match item.router_data.request.metadata.clone() {
+                Some(metadata) => Some(UserFields {
+                    user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+                }),
+                None => None,
+            },
             processing_options: None,
             subsequent_auth_information: None,
             authorization_indicator_type: match item.router_data.request.capture_method {
@@ -815,6 +870,12 @@ impl
                     zip: address.zip.clone(),
                     country: address.country,
                 }),
+            user_fields: match item.router_data.request.metadata.clone() {
+                Some(metadata) => Some(UserFields {
+                    user_field: Vec::<UserField>::foreign_try_from(metadata)?,
+                }),
+                None => None,
+            },
             processing_options: None,
             subsequent_auth_information: None,
             authorization_indicator_type: match item.router_data.request.capture_method {

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

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

## Description
<!-- Describe your changes in detail -->

This PR is for code changes which sends the metadata passed in payment intent create to authorizedotnet as request payload, as per merchant requirements.  

The merchant receives a receipt of the transaction through email, which contains the metadata passed by the merchant in payment intent create request.

![image](https://github.com/user-attachments/assets/84fa9591-bf64-473c-aaba-c95b9cf78dcb)

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

All flows have been tested as per the authorizedotnet developer docs:
https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card

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

**Postman Tests**

**1. Authorize (Manual)**

 - Request
 
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer1",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "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": "likhin",
            "last_name": "bopanna"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "likhin",
            "last_name": "bopanna"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    }
}'
```
- Response

```
{
    "payment_id": "pay_aMR57wTed0e8hKIvqEXk",
    "merchant_id": "postman_merchant_GHAction_4bc8cb40-6e2b-4474-a4ba-662cce1e8224",
    "status": "requires_capture",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 6540,
    "amount_received": null,
    "connector": "authorizedotnet",
    "client_secret": "pay_aMR57wTed0e8hKIvqEXk_secret_7ClGeHihtfOkLr17zmY6",
    "created": "2025-01-08T12:18:38.236Z",
    "currency": "USD",
    "customer_id": "StripeCustomer1",
    "customer": {
        "id": "StripeCustomer1",
        "name": "John Doe",
        "email": "guest@example.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": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "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": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "likhin",
            "last_name": "bopanna"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "likhin",
            "last_name": "bopanna"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": "StripeCustomer1",
        "created_at": 1736338718,
        "expires": 1736342318,
        "secret": "epk_a3fa4b96efa94fbe817dd39b634b4b10"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "80033079979",
    "frm_message": null,
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80033079979",
    "payment_link": null,
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-08T12:33:38.236Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-08T12:18:40.884Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
```

**2. Capture (Manual)**

 - Request
 
```
curl --location 'http://localhost:8080/payments/pay_aMR57wTed0e8hKIvqEXk/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu' \
--data '{
    "amount_to_capture": 6540,
    "statement_descriptor_name": "Joseph",
    "statement_descriptor_suffix": "JS"
}'
```

- Response 

```
{
    "payment_id": "pay_aMR57wTed0e8hKIvqEXk",
    "merchant_id": "postman_merchant_GHAction_4bc8cb40-6e2b-4474-a4ba-662cce1e8224",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "authorizedotnet",
    "client_secret": "pay_aMR57wTed0e8hKIvqEXk_secret_7ClGeHihtfOkLr17zmY6",
    "created": "2025-01-08T12:18:38.236Z",
    "currency": "USD",
    "customer_id": "StripeCustomer1",
    "customer": {
        "id": "StripeCustomer1",
        "name": "John Doe",
        "email": "guest@example.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": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "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": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "likhin",
            "last_name": "bopanna"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "likhin",
            "last_name": "bopanna"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "80033079979",
    "frm_message": null,
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80033079979",
    "payment_link": null,
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-08T12:33:38.236Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-08T12:20:16.395Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
```

**3. Authorize + Capture**

 - Request

```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu' \
--data-raw '{
    "amount": 6550,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6550,
    "customer_id": "StripeCustomer1",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_type": "debit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "01",
            "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": "sundari",
            "last_name": "sundari"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "sundari",
            "last_name": "sundari"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    }
}'
```

- Response

```
{
    "payment_id": "pay_EbFXhSWxwVQ0996FxZdt",
    "merchant_id": "postman_merchant_GHAction_4bc8cb40-6e2b-4474-a4ba-662cce1e8224",
    "status": "succeeded",
    "amount": 6550,
    "net_amount": 6550,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6550,
    "connector": "authorizedotnet",
    "client_secret": "pay_EbFXhSWxwVQ0996FxZdt_secret_3J0fmk53qE22LeKiGIGx",
    "created": "2025-01-08T12:21:59.998Z",
    "currency": "USD",
    "customer_id": "StripeCustomer1",
    "customer": {
        "id": "StripeCustomer1",
        "name": "John Doe",
        "email": "guest@example.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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": "sundari"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": "sundari"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "debit",
    "connector_label": "authorizedotnet_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer1",
        "created_at": 1736338919,
        "expires": 1736342519,
        "secret": "epk_a1b2ad7e39a14673a4e01692f76e5193"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "80033080191",
    "frm_message": null,
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80033080191",
    "payment_link": null,
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-08T12:36:59.998Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-08T12:22:02.624Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
```

**4. PSync**

 - Request

```
curl --location 'http://localhost:8080/payments/pay_EbFXhSWxwVQ0996FxZdt?force_sync=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu'
```

- Response

```
{
    "payment_id": "pay_EbFXhSWxwVQ0996FxZdt",
    "merchant_id": "postman_merchant_GHAction_4bc8cb40-6e2b-4474-a4ba-662cce1e8224",
    "status": "succeeded",
    "amount": 6550,
    "net_amount": 6550,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6550,
    "connector": "authorizedotnet",
    "client_secret": "pay_EbFXhSWxwVQ0996FxZdt_secret_3J0fmk53qE22LeKiGIGx",
    "created": "2025-01-08T12:21:59.998Z",
    "currency": "USD",
    "customer_id": "StripeCustomer1",
    "customer": {
        "id": "StripeCustomer1",
        "name": "John Doe",
        "email": "guest@example.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": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "01",
            "card_exp_year": "25",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": "sundari"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "sundari",
            "last_name": "sundari"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "debit",
    "connector_label": "authorizedotnet_US_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "80033080191",
    "frm_message": null,
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80033080191",
    "payment_link": null,
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-08T12:36:59.998Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-08T12:22:02.624Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
```

**5. Refund**

 - Request

```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu' \
--data '{
    "payment_id": "pay_LdFELbsSHWr31UxLX51l",
    "amount": 5000,
    "reason": "Customer returned product",
    "refund_type": "scheduled",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```

- Response

```
{
    "refund_id": "ref_ht8iD8smYnJl5sDF0BEn",
    "payment_id": "pay_LdFELbsSHWr31UxLX51l",
    "amount": 5000,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-01-08T12:31:33.642Z",
    "updated_at": "2025-01-08T12:31:33.642Z",
    "connector": "authorizedotnet",
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "split_refunds": null
}
```

**6. RSync**

 - Request

```
curl --location 'http://localhost:8080/refunds/ref_ht8iD8smYnJl5sDF0BEn' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu'
```

- Response

```
{
    "refund_id": "ref_ht8iD8smYnJl5sDF0BEn",
    "payment_id": "pay_LdFELbsSHWr31UxLX51l",
    "amount": 5000,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-01-08T12:31:33.642Z",
    "updated_at": "2025-01-08T12:31:33.642Z",
    "connector": "authorizedotnet",
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "split_refunds": null
}
```

**7. Cancel/Void**

 - Request

```
curl --location 'http://localhost:8080/payments/pay_LdFELbsSHWr31UxLX51l/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0vV4HvaBn68pmZTvXLzU9V7hR79lgEjiarEG2IDxveccjZ6ypKjpPaRrdeQRHhKu' \
--data '{"cancellation_reason":"requested_by_customer"}'
```

- Response

```
{
    "payment_id": "pay_wM2Pf7TjLVabcAj41aDz",
    "merchant_id": "postman_merchant_GHAction_4bc8cb40-6e2b-4474-a4ba-662cce1e8224",
    "status": "cancelled",
    "amount": 5000,
    "net_amount": 5000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "authorizedotnet",
    "client_secret": "pay_wM2Pf7TjLVabcAj41aDz_secret_vjFJJKmyoVaNqOmQ0Bge",
    "created": "2025-01-08T12:29:07.232Z",
    "currency": "USD",
    "customer_id": "StripeCustomer1",
    "customer": {
        "id": "StripeCustomer1",
        "name": "John Doe",
        "email": "guest@example.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": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "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": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "likhin",
            "last_name": "bopanna"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "likhin",
            "last_name": "bopanna"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": "requested_by_customer",
    "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": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "80033080543",
    "frm_message": null,
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590045"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80033080543",
    "payment_link": null,
    "profile_id": "pro_54auzGTSaZOQ9xIUOEn8",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_tFxUMA2vfBlte3s7jSw7",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-08T12:44:07.232Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-08T12:29:28.533Z",
    "split_payments": 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`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
