Bug:  [FEATURE] : [Cybersource] mask pii information in connector request and response



### Feature Description

Mask pii information passed and received in the connector request and response

### Possible Implementation

Refactor all sensitive response and request fields secret

### 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/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 4bb28439b7f..14f8b2a7f99 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -2,7 +2,7 @@ use api_models::payments;
 use base64::Engine;
 use common_utils::{ext_traits::ValueExt, pii};
 use error_stack::{IntoReport, ResultExt};
-use masking::{PeekInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
 use serde::{Deserialize, Serialize};
 use serde_json::Value;
 
@@ -259,9 +259,9 @@ pub struct ProcessingInformation {
 pub struct CybersourceConsumerAuthInformation {
     ucaf_collection_indicator: Option<String>,
     cavv: Option<String>,
-    ucaf_authentication_data: Option<String>,
+    ucaf_authentication_data: Option<Secret<String>>,
     xid: Option<String>,
-    directory_server_transaction_id: Option<String>,
+    directory_server_transaction_id: Option<Secret<String>>,
     specification_version: Option<String>,
 }
 #[derive(Debug, Serialize)]
@@ -385,7 +385,7 @@ pub enum PaymentInformation {
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct CybersoucrePaymentInstrument {
-    id: String,
+    id: Secret<String>,
 }
 #[derive(Debug, Serialize)]
 #[serde(rename_all = "camelCase")]
@@ -1071,7 +1071,7 @@ impl
     ) -> Result<Self, Self::Error> {
         let processing_information = ProcessingInformation::try_from((item, None, None))?;
         let payment_instrument = CybersoucrePaymentInstrument {
-            id: connector_mandate_id,
+            id: connector_mandate_id.into(),
         };
         let email = item.router_data.request.get_email()?;
         let bill_to = build_bill_to(item.router_data.get_billing()?, email)?;
@@ -1491,7 +1491,7 @@ pub struct ClientRiskInformation {
 
 #[derive(Debug, Clone, Deserialize, Serialize)]
 pub struct ClientRiskInformationRules {
-    name: String,
+    name: Secret<String>,
 }
 
 #[derive(Debug, Clone, Deserialize, Serialize)]
@@ -1592,7 +1592,7 @@ fn get_payment_response(
                     .token_information
                     .clone()
                     .map(|token_info| types::MandateReference {
-                        connector_mandate_id: Some(token_info.payment_instrument.id),
+                        connector_mandate_id: Some(token_info.payment_instrument.id.expose()),
                         payment_method_id: None,
                     });
             Ok(types::PaymentsResponseData::TransactionResponse {
@@ -1941,10 +1941,10 @@ pub enum CybersourceAuthEnrollmentStatus {
 pub struct CybersourceConsumerAuthValidateResponse {
     ucaf_collection_indicator: Option<String>,
     cavv: Option<String>,
-    ucaf_authentication_data: Option<String>,
+    ucaf_authentication_data: Option<Secret<String>>,
     xid: Option<String>,
     specification_version: Option<String>,
-    directory_server_transaction_id: Option<String>,
+    directory_server_transaction_id: Option<Secret<String>>,
     indicator: Option<String>,
 }
 
@@ -1956,7 +1956,7 @@ pub struct CybersourceThreeDSMetadata {
 #[derive(Debug, Deserialize, Serialize)]
 #[serde(rename_all = "camelCase")]
 pub struct CybersourceConsumerAuthInformationEnrollmentResponse {
-    access_token: Option<String>,
+    access_token: Option<Secret<String>>,
     step_up_url: Option<String>,
     //Added to segregate the three_ds_data in a separate struct
     #[serde(flatten)]
@@ -2044,9 +2044,9 @@ impl<F>
                             .consumer_authentication_information
                             .step_up_url,
                     ) {
-                        (Some(access_token), Some(step_up_url)) => {
+                        (Some(token), Some(step_up_url)) => {
                             Some(services::RedirectForm::CybersourceConsumerAuth {
-                                access_token,
+                                access_token: token.expose(),
                                 step_up_url,
                             })
                         }
@@ -2241,7 +2241,7 @@ impl<F, T>
             CybersourceSetupMandatesResponse::ClientReferenceInformation(info_response) => {
                 let mandate_reference = info_response.token_information.clone().map(|token_info| {
                     types::MandateReference {
-                        connector_mandate_id: Some(token_info.payment_instrument.id),
+                        connector_mandate_id: Some(token_info.payment_instrument.id.expose()),
                         payment_method_id: None,
                     }
                 });
@@ -2655,7 +2655,7 @@ impl
                 client_risk_information.rules.map(|rules| {
                     rules
                         .iter()
-                        .map(|risk_info| format!(" , {}", risk_info.name))
+                        .map(|risk_info| format!(" , {}", risk_info.name.clone().expose()))
                         .collect::<Vec<String>>()
                         .join("")
                 })

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

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

## Description
<!-- Describe your changes in detail -->
Mask pii information passed and received in the connector request and response for Cybersource.

## Test Case
1.a. Create a 3DS payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_sJlLjo5AQkfrDpPH0IEmB0gKzEgOLRr4CnI0PeHyePVJmCEoww6B9bkUjcVFyIFF' \
--data-raw '{
    "amount": 0,
    "currency": "PLN",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    
    "capture_method": "automatic",
    "customer_id": "abc",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "three_ds",
    "return_url": "https://hs-payments-test.netlify.app/payments",
    "email": "arjun.karthik@juspay.in",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "setup_future_usage": "off_session",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_type": "setup_mandate",
    "payment_method_data": {
        "card": {
            
            "card_number": "4622943127013705",
            "card_exp_month": "12",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "838"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "CA",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "New York",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "metadata": {
        "order_details": {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 3200,
            "account_name": "transaction_processing"
        }
    },
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "13.232.74.226",
                "user_agent": "amet irure esse"
            }
        }
        , "mandate_type": {
            "multi_use": {
                "amount": 700,
                "currency": "USD"
            }
        }
        
    }
}'
```

1.b. Check if all the sensitive data in the `masked_response` is masked

```
curl --location '{{base_url}}/analytics/v1/connector_event_logs?type=Payment&payment_id={{payment_id}}' \
--header 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'authorization: Bearer JWT_token' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json' \
--header 'Referer: https://integ.hyperswitch.io/' \
--header 'api-key: {{api-key}}' \
--header 'sec-ch-ua-platform: "macOS"'
```

masked_response should be 
```
{\\\"id\\\":\\\"7089429038836063404953\\\",\\\"status\\\":\\\"AUTHORIZED\\\",\\\"clientReferenceInformation\\\":{\\\"code\\\":\\\"pay_BxnKPq7bjemAWr97xyk3_1\\\"},\\\"processorInformation\\\":{\\\"avs\\\":{\\\"code\\\":\\\"Y\\\",\\\"codeRaw\\\":\\\"Y\\\"}},\\\"riskInformation\\\":{\\\"rules\\\":null},\\\"tokenInformation\\\":{\\\"paymentInstrument\\\":{\\\"id\\\":\\\"*** alloc::string::String ***\\\"}}
```
2.a. Check if sensitive data is masked - MIT

```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{{api-key}}' \
--data '{
  "amount": 700,
  "currency": "USD",
  "off_session": true,
  "confirm": true,
  "capture_method": "automatic",
  "description": "Initiated by merchant",
  "mandate_id": "{{mandate_id}}",
  "customer_id": "abc",
  "billing": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name": "John",
      "last_name": "Doe"
    }
  }
}'
```

2.b. Check if all the sensitive data in the `masked_response` is masked

```
curl --location '{{base_url}}/analytics/v1/connector_event_logs?type=Payment&payment_id={{payment_id}}' \
--header 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'authorization: Bearer JWT_token' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
--header 'Content-Type: application/json' \
--header 'Referer: https://integ.hyperswitch.io/' \
--header 'api-key: {{api-key}}' \
--header 'sec-ch-ua-platform: "macOS"'
```

Response should be 
```
"masked_response\":\"{\\\"id\\\":\\\"7089431984486510104951\\\",\\\"status\\\":\\\"AUTHORIZED\\\",\\\"clientReferenceInformation\\\":{\\\"code\\\":\\\"pay_TL8q8JuBwqoQ94bQBYY5_1\\\"},\\\"processorInformation\\\":{\\\"avs\\\":{\\\"code\\\":\\\"Y\\\",\\\"codeRaw\\\":\\\"Y\\\"}}
```


Impact Area
> Cybersource 3ds mandate payment flow
> Cybersource MIT flow


## 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
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable
