Bug:  [FEATURE] : [Globalpay] 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/globalpay/requests.rs b/crates/router/src/connector/globalpay/requests.rs
index ee62e8c2c2c..1e5413bc838 100644
--- a/crates/router/src/connector/globalpay/requests.rs
+++ b/crates/router/src/connector/globalpay/requests.rs
@@ -41,7 +41,7 @@ pub struct GlobalpayPaymentsRequest {
     /// Indicates whether the Merchant or the Payer initiated the creation of a transaction.
     pub initiator: Option<Initiator>,
     /// Indicates the source IP Address of the system used to create the transaction.
-    pub ip_address: Option<String>,
+    pub ip_address: Option<Secret<String, common_utils::pii::IpAddress>>,
     /// Indicates the language the transaction was executed in. In the format ISO-639-1 (alpha-2)
     /// or ISO-639-1 (alpha-2)_ISO-3166(alpha-2)
     pub language: Option<Language>,
@@ -80,8 +80,8 @@ pub struct GlobalpayPaymentsRequest {
 #[derive(Debug, Serialize)]
 pub struct GlobalpayRefreshTokenRequest {
     pub app_id: Secret<String>,
-    pub nonce: String,
-    pub secret: String,
+    pub nonce: Secret<String>,
+    pub secret: Secret<String>,
     pub grant_type: String,
 }
 
@@ -106,10 +106,10 @@ pub struct Device {
     /// Describes the receipts a device prints when processing a transaction.
     pub print_receipt_mode: Option<PrintReceiptMode>,
     /// The sequence number from the device used to align with processing platform.
-    pub sequence_number: Option<String>,
+    pub sequence_number: Option<Secret<String>>,
     /// A unique identifier for the physical device. This value persists with the device even if
     /// it is repurposed.
-    pub serial_number: Option<String>,
+    pub serial_number: Option<Secret<String>>,
     /// The time from the device in ISO8601 format
     pub time: Option<String>,
 }
@@ -209,15 +209,15 @@ pub struct PaymentMethod {
     /// Indicates whether to execute the fingerprint signature functionality.
     pub fingerprint_mode: Option<FingerprintMode>,
     /// Specify the first name of the owner of the payment method.
-    pub first_name: Option<String>,
+    pub first_name: Option<Secret<String>>,
     /// Unique Global Payments generated id used to reference a stored payment method on the
     /// Global Payments system. Often referred to as the payment method token. This value can be
     /// used instead of payment method details such as a card number and expiry date.
-    pub id: Option<String>,
+    pub id: Option<Secret<String>>,
     /// Specify the surname of the owner of the payment method.
-    pub last_name: Option<String>,
+    pub last_name: Option<Secret<String>>,
     /// The full name of the owner of the payment method.
-    pub name: Option<String>,
+    pub name: Option<Secret<String>>,
     /// Contains the value a merchant wishes to appear on the payer's payment method statement
     /// for this transaction
     pub narrative: Option<String>,
@@ -274,11 +274,11 @@ pub struct ThreeDs {
 
 pub struct BankTransfer {
     /// The number or reference for the payer's bank account.
-    pub account_number: Option<String>,
+    pub account_number: Option<Secret<String>>,
 
     pub bank: Option<Bank>,
     /// The number or reference for the check
-    pub check_reference: Option<String>,
+    pub check_reference: Option<Secret<String>>,
     /// The type of bank account associated with the payer's bank account.
     pub number_type: Option<NumberType>,
     /// Indicates how the transaction was authorized by the merchant.
@@ -289,7 +289,7 @@ pub struct BankTransfer {
 pub struct Bank {
     pub address: Option<Address>,
     /// The local identifier code for the bank.
-    pub code: Option<String>,
+    pub code: Option<Secret<String>>,
     /// The name of the bank.
     pub name: Option<String>,
 }
@@ -297,17 +297,17 @@ pub struct Bank {
 #[derive(Debug, Serialize, Deserialize)]
 pub struct Address {
     /// Merchant defined field common to all transactions that are part of the same order.
-    pub city: Option<String>,
+    pub city: Option<Secret<String>>,
     /// The country in ISO-3166-1(alpha-2 code) format.
     pub country: Option<String>,
     /// First line of the address.
-    pub line_1: Option<String>,
+    pub line_1: Option<Secret<String>>,
     /// Second line of the address.
-    pub line_2: Option<String>,
+    pub line_2: Option<Secret<String>>,
     /// Third  line of the address.
-    pub line_3: Option<String>,
+    pub line_3: Option<Secret<String>>,
     /// The city or town of the address.
-    pub postal_code: Option<String>,
+    pub postal_code: Option<Secret<String>>,
     /// The state or region of the address. ISO 3166-2 minus the country code itself. For
     /// example, US Illinois = IL, or in the case of GB counties Wiltshire = WI or Aberdeenshire
     /// = ABD
@@ -319,7 +319,7 @@ pub struct Card {
     /// The card providers description of their card product.
     pub account_type: Option<String>,
     /// Code generated when the card is successfully authorized.
-    pub authcode: Option<String>,
+    pub authcode: Option<Secret<String>>,
     /// First line of the address associated with the card.
     pub avs_address: Option<String>,
     /// Postal code of the address associated with the card.
@@ -340,11 +340,11 @@ pub struct Card {
     /// The the card account number used to authorize the transaction. Also known as PAN.
     pub number: cards::CardNumber,
     /// Contains the pin block info, relating to the pin code the Payer entered.
-    pub pin_block: Option<String>,
+    pub pin_block: Option<Secret<String>>,
     /// The full card tag data for an EMV/chip card transaction.
-    pub tag: Option<String>,
+    pub tag: Option<Secret<String>>,
     /// Data from magnetic stripe of a card
-    pub track: Option<String>,
+    pub track: Option<Secret<String>>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -358,7 +358,7 @@ pub struct DigitalWallet {
 #[derive(Debug, Serialize, Deserialize)]
 pub struct Encryption {
     /// The encryption info used when sending encrypted card data to Global Payments.
-    pub info: Option<String>,
+    pub info: Option<Secret<String>>,
     /// The encryption method used when sending encrypted card data to Global Payments.
     pub method: Option<Method>,
     /// The version of encryption being used.
diff --git a/crates/router/src/connector/globalpay/response.rs b/crates/router/src/connector/globalpay/response.rs
index 201297c399e..7d5efadaff8 100644
--- a/crates/router/src/connector/globalpay/response.rs
+++ b/crates/router/src/connector/globalpay/response.rs
@@ -6,9 +6,9 @@ use super::requests;
 #[derive(Debug, Serialize, Deserialize)]
 pub struct GlobalpayPaymentsResponse {
     /// A unique identifier for the merchant account set by Global Payments.
-    pub account_id: Option<String>,
+    pub account_id: Option<Secret<String>>,
     /// A meaningful label for the merchant account set by Global Payments.
-    pub account_name: Option<String>,
+    pub account_name: Option<Secret<String>>,
     /// Information about the Action executed.
     pub action: Option<Action>,
     /// The amount to transfer between Payer and Merchant for a SALE or a REFUND. It is always
@@ -37,7 +37,7 @@ pub struct GlobalpayPaymentsResponse {
     /// A unique identifier for the merchant set by Global Payments.
     pub merchant_id: Option<String>,
     /// A meaningful label for the merchant set by Global Payments.
-    pub merchant_name: Option<String>,
+    pub merchant_name: Option<Secret<String>>,
     pub payment_method: Option<PaymentMethod>,
     /// Merchant defined field to reference the transaction.
     pub reference: Option<String>,
@@ -55,12 +55,12 @@ pub struct GlobalpayPaymentsResponse {
 #[derive(Debug, Serialize, Deserialize)]
 pub struct Action {
     /// The id of the app that was used to create the token.
-    pub app_id: Option<String>,
+    pub app_id: Option<Secret<String>>,
     /// The name of the app the user gave to the application.
-    pub app_name: Option<String>,
+    pub app_name: Option<Secret<String>>,
     /// A unique identifier for the object created by Global Payments. The first 3 characters
     /// identifies the resource an id relates to.
-    pub id: Option<String>,
+    pub id: Option<Secret<String>>,
     /// The result of the action executed.
     pub result_code: Option<ResultCode>,
     /// Global Payments time indicating when the object was created in ISO-8601 format.
@@ -117,7 +117,7 @@ pub struct PaymentMethod {
     /// for that merchant. If the payment method is seen again this same value is generated. For
     /// cards the primary account number is checked only. The expiry date or the CVV is not used
     /// for this check.
-    pub fingerprint: Option<String>,
+    pub fingerprint: Option<Secret<String>>,
     /// If enabled, this field indicates whether the payment method has been seen before or is
     /// new.
     /// * EXISTS -  Indicates that the payment method was seen on the platform before by this
@@ -128,7 +128,7 @@ pub struct PaymentMethod {
     /// Unique Global Payments generated id used to reference a stored payment method on the
     /// Global Payments system. Often referred to as the payment method token. This value can be
     /// used instead of payment method details such as a card number and expiry date.
-    pub id: Option<String>,
+    pub id: Option<Secret<String>>,
     /// Result message from the payment method provider corresponding to the result code.
     pub message: Option<String>,
     /// Result code from the payment method provider.
@@ -148,7 +148,7 @@ pub struct Apm {
     /// transaction.
     pub provider: Option<ApmProvider>,
     /// A name of the payer from the payment method system.
-    pub provider_payer_name: Option<String>,
+    pub provider_payer_name: Option<Secret<String>>,
     /// The time the payment method provider created the transaction at on their system.
     pub provider_time_created: Option<String>,
     /// The reference the payment method provider created for the transaction.
@@ -162,28 +162,28 @@ pub struct Apm {
     pub redirect_url: Option<String>,
     /// A string generated by the payment method to represent the session created on the payment
     /// method's platform to facilitate the creation of a transaction.
-    pub session_token: Option<String>,
+    pub session_token: Option<Secret<String>>,
     pub payment_description: Option<String>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
 pub struct Bank {
     /// The local identifier of the bank account.
-    pub account_number: Option<String>,
+    pub account_number: Option<Secret<String>>,
     /// The local identifier of the bank.
-    pub code: Option<String>,
+    pub code: Option<Secret<String>>,
     /// The international identifier of the bank account.
-    pub iban: Option<String>,
+    pub iban: Option<Secret<String>>,
     /// The international identifier code for the bank.
-    pub identifier_code: Option<String>,
+    pub identifier_code: Option<Secret<String>>,
     /// The name associated with the bank account
-    pub name: Option<String>,
+    pub name: Option<Secret<String>>,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
 pub struct Mandate {
     /// The reference to identify the mandate.
-    pub code: Option<String>,
+    pub code: Option<Secret<String>>,
 }
 
 /// Information outlining the degree of authentication executed related to a transaction.
@@ -205,7 +205,7 @@ pub struct BankTransfer {
     /// The last 4 characters of the local reference for a bank account number.
     pub masked_number_last4: Option<String>,
     /// The name of the bank.
-    pub name: Option<String>,
+    pub name: Option<Secret<String>>,
     /// The type of bank account associated with the payer's bank account.
     pub number_type: Option<NumberType>,
 }
@@ -213,7 +213,7 @@ pub struct BankTransfer {
 #[derive(Debug, Serialize, Deserialize)]
 pub struct Card {
     /// Code generated when the card is successfully authorized.
-    pub authcode: Option<String>,
+    pub authcode: Option<Secret<String>>,
     /// The recommended AVS action to be taken by the agent processing the card transaction.
     pub avs_action: Option<String>,
     /// The result of the AVS address check.
@@ -223,7 +223,7 @@ pub struct Card {
     /// Indicates the card brand that issued the card.
     pub brand: Option<Brand>,
     /// The unique reference created by the brands/schemes to uniquely identify the transaction.
-    pub brand_reference: Option<String>,
+    pub brand_reference: Option<Secret<String>>,
     /// The time returned by the card brand indicating when the transaction was processed on
     /// their system.
     pub brand_time_reference: Option<String>,
@@ -235,7 +235,7 @@ pub struct Card {
     pub provider: Option<ProviderClass>,
     /// The card EMV tag response data from the card issuer for a contactless or chip card
     /// transaction.
-    pub tag_response: Option<String>,
+    pub tag_response: Option<Secret<String>>,
 }
 
 /// The result codes directly from the card issuer.
diff --git a/crates/router/src/connector/globalpay/transformers.rs b/crates/router/src/connector/globalpay/transformers.rs
index 3124501bd6e..1e410946251 100644
--- a/crates/router/src/connector/globalpay/transformers.rs
+++ b/crates/router/src/connector/globalpay/transformers.rs
@@ -1,6 +1,6 @@
 use common_utils::crypto::{self, GenerateDigest};
 use error_stack::{IntoReport, ResultExt};
-use masking::{PeekInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
 use rand::distributions::DistString;
 use serde::{Deserialize, Serialize};
 use url::Url;
@@ -164,8 +164,8 @@ impl TryFrom<&types::RefreshTokenRouterData> for GlobalpayRefreshTokenRequest {
 
         Ok(Self {
             app_id: globalpay_auth.app_id,
-            nonce,
-            secret,
+            nonce: Secret::new(nonce),
+            secret: Secret::new(secret),
             grant_type: "client_credentials".to_string(),
         })
     }
@@ -215,7 +215,7 @@ fn get_payment_response(
             .as_ref()
             .and_then(|card| card.brand_reference.to_owned())
             .map(|id| types::MandateReference {
-                connector_mandate_id: Some(id),
+                connector_mandate_id: Some(id.expose()),
                 payment_method_id: None,
             })
     });

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


## Test Case

1.a. Card Mandate Payment Create
```
{
  "amount": 10000,
  "currency": "USD",
  "confirm": true,
  "capture_method": "automatic",
  "capture_on": "2022-09-10T10:11:12Z",
  "customer_id": "StripeCustomer",
  "email": "abcdef123@gmail.com",
  "name": "John Doe",
  "phone": "999999999",
  "phone_country_code": "+65",
  "description": "Its my first payment request",
  "authentication_type": "no_three_ds",
  "return_url": "https://hs-payments-test.netlify.app/payments",
  "billing": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US"
    }
  },
  "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": "127.0.0.1"
  },
  "shipping": {
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US",
      "first_name": "John",
      "last_name": "Doe"
    }
  },
  "statement_descriptor_name": "joseph",
  "statement_descriptor_suffix": "JS",
  "metadata": {
    "udf1": "value1",
    "new_customer": "true",
    "login_date": "2019-09-10T10:11:12Z"
  },
  "payment_method": "card",
  "payment_method_data": {
    "card": {
      "card_number": "4917 6100 0000 0000",
      "card_exp_month": "03",
      "card_exp_year": "2030",
      "card_holder_name": "Joseph Doe",
      "card_cvc": "737"
    }
  },
  "setup_future_usage": "off_session",
  "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": 799,
         "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"'
```


Response - Card Mandate Payment 
```
"{\\\"account_id\\\":\\\"*** alloc::string::String ***\\\",\\\"account_name\\\":\\\"*** alloc::string::String ***\\\",\\\"action\\\":{\\\"app_id\\\":\\\"*** alloc::string::String ***\\\",\\\"app_name\\\":\\\"*** alloc::string::String ***\\\",\\\"id\\\":\\\"*** alloc::string::String ***\\\",\\\"result_code\\\":\\\"SUCCESS\\\",\\\"time_created\\\":\\\"2024-02-27T08:01:06.335Z\\\",\\\"type\\\":\\\"AUTHORIZE\\\"},\\\"amount\\\":\\\"10000\\\",\\\"authorization_mode\\\":null,\\\"batch_id\\\":\\\"BAT_1361216\\\",\\\"capture_mode\\\":\\\"AUTO\\\",\\\"channel\\\":\\\"CNP\\\",\\\"country\\\":\\\"US\\\",\\\"currency\\\":\\\"USD\\\",\\\"currency_conversion\\\":{\\\"id\\\":null},\\\"id\\\":\\\"TRN_QkEUmx4RVM2KJuIh1w97WKMkIQVOpg_44PMyDl6oy_1\\\",\\\"merchant_id\\\":\\\"MER_7e3e2c7df34f42819b3edee31022ee3f\\\",\\\"merchant_name\\\":\\\"*** alloc::string::String ***\\\",\\\"payment_method\\\":{\\\"apm\\\":null,\\\"authentication\\\":{\\\"three_ds\\\":null},\\\"bank_transfer\\\":null,\\\"card\\\":{\\\"authcode\\\":\\\"*** alloc::string::String ***\\\",\\\"avs_action\\\":\\\"\\\",\\\"avs_address_result\\\":\\\"NOT_CHECKED\\\",\\\"avs_postal_code_result\\\":\\\"NOT_CHECKED\\\",\\\"brand\\\":\\\"VISA\\\",\\\"brand_reference\\\":\\\"*** alloc::string::String ***\\\",\\\"brand_time_reference\\\":null,\\\"cvv_result\\\":\\\"NOT_CHECKED\\\",\\\"masked_number_last4\\\":\\\"*** alloc::string::String ***\\\",\\\"provider\\\":{\\\"card.provider.avs_address_result\\\":null,\\\"card.provider.avs_postal_code_result\\\":null,\\\"card.provider.avs_result\\\":null,\\\"card.provider.cvv_result\\\":null,\\\"card.provider.result\\\":null},\\\"tag_response\\\":\\\"*** alloc::string::String ***\\\"},\\\"digital_wallet\\\":null,\\\"entry_mode\\\":\\\"ECOM\\\",\\\"fingerprint\\\":null,\\\"fingerprint_presence_indicator\\\":null,\\\"id\\\":null,\\\"message\\\":\\\"[ test system ] Authorised\\\",\\\"result\\\":\\\"00\\\"},\\\"reference\\\":\\\"pay_zaVdoNy0DL44PMyDl6oy_1\\\",\\\"status\\\":\\\"CAPTURED\\\",\\\"time_created\\\":\\\"2024-02-27T08:01:06.335Z\\\",\\\"type\\\":\\\"SALE\\\"}
```

_Note: A know bug in recurring mandate payments_ 




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