Bug:  [FEATURE] : [Worldline][Worldpay][Zen]  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/masking/src/serde.rs b/crates/masking/src/serde.rs
index a96a87f05c8..94c60eba3cf 100644
--- a/crates/masking/src/serde.rs
+++ b/crates/masking/src/serde.rs
@@ -27,6 +27,7 @@ pub trait SerializableSecret: Serialize {}
 impl SerializableSecret for Value {}
 impl SerializableSecret for u8 {}
 impl SerializableSecret for u16 {}
+impl SerializableSecret for i8 {}
 impl SerializableSecret for i32 {}
 
 impl<'de, T, I> Deserialize<'de> for Secret<T, I>
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 996e06adfc4..1765bb3eeae 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -813,6 +813,8 @@ pub trait CardData {
     fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String>;
     fn get_expiry_year_4_digit(&self) -> Secret<String>;
     fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ConnectorError>;
+    fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error>;
+    fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error>;
 }
 
 impl CardData for api::Card {
@@ -870,6 +872,24 @@ impl CardData for api::Card {
         let month = self.card_exp_month.clone().expose();
         Ok(Secret::new(format!("{year}{month}")))
     }
+    fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> {
+        self.card_exp_month
+            .peek()
+            .clone()
+            .parse::<i8>()
+            .into_report()
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)
+            .map(Secret::new)
+    }
+    fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> {
+        self.card_exp_year
+            .peek()
+            .clone()
+            .parse::<i32>()
+            .into_report()
+            .change_context(errors::ConnectorError::ResponseDeserializationFailed)
+            .map(Secret::new)
+    }
 }
 
 #[track_caller]
diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs
index 1eb22fc52d2..7a9a43eedc6 100644
--- a/crates/router/src/connector/worldline/transformers.rs
+++ b/crates/router/src/connector/worldline/transformers.rs
@@ -95,11 +95,11 @@ pub struct Name {
 pub struct Shipping {
     pub city: Option<String>,
     pub country_code: Option<api_enums::CountryAlpha2>,
-    pub house_number: Option<String>,
+    pub house_number: Option<Secret<String>>,
     pub name: Option<Name>,
     pub state: Option<Secret<String>>,
     pub state_code: Option<String>,
-    pub street: Option<String>,
+    pub street: Option<Secret<String>>,
     pub zip: Option<Secret<String>>,
 }
 
diff --git a/crates/router/src/connector/worldpay/requests.rs b/crates/router/src/connector/worldpay/requests.rs
index 5d6fdeb5106..5fb5d75d940 100644
--- a/crates/router/src/connector/worldpay/requests.rs
+++ b/crates/router/src/connector/worldpay/requests.rs
@@ -6,15 +6,15 @@ pub struct BillingAddress {
     #[serde(skip_serializing_if = "Option::is_none")]
     pub city: Option<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub address2: Option<String>,
-    pub postal_code: String,
+    pub address2: Option<Secret<String>>,
+    pub postal_code: Secret<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub state: Option<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub address3: Option<String>,
-    pub country_code: String,
+    pub address3: Option<Secret<String>>,
+    pub country_code: common_enums::CountryAlpha2,
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub address1: Option<String>,
+    pub address1: Option<Secret<String>>,
 }
 
 #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
@@ -57,7 +57,7 @@ pub enum CustomerAuthentication {
 #[serde(rename_all = "camelCase")]
 pub struct ThreeDS {
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub authentication_value: Option<String>,
+    pub authentication_value: Option<Secret<String>>,
     pub version: ThreeDSVersion,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub transaction_id: Option<String>,
@@ -93,7 +93,7 @@ pub enum CustomerAuthType {
 pub struct NetworkToken {
     #[serde(rename = "type")]
     pub auth_type: CustomerAuthType,
-    pub authentication_value: String,
+    pub authentication_value: Secret<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub eci: Option<String>,
 }
@@ -146,7 +146,7 @@ pub struct CardPayment {
     #[serde(skip_serializing_if = "Option::is_none")]
     pub billing_address: Option<BillingAddress>,
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub card_holder_name: Option<String>,
+    pub card_holder_name: Option<Secret<String>>,
     pub card_expiry_date: CardExpiryDate,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub cvc: Option<Secret<String>>,
@@ -168,15 +168,15 @@ pub struct CardToken {
 pub struct WalletPayment {
     #[serde(rename = "type")]
     pub payment_type: PaymentType,
-    pub wallet_token: String,
+    pub wallet_token: Secret<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub billing_address: Option<BillingAddress>,
 }
 
 #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
 pub struct CardExpiryDate {
-    pub month: i8,
-    pub year: i32,
+    pub month: Secret<i8>,
+    pub year: Secret<i32>,
 }
 
 #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
@@ -198,9 +198,9 @@ pub struct Merchant {
 #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct PaymentFacilitator {
-    pub pf_id: String,
+    pub pf_id: Secret<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub iso_id: Option<String>,
+    pub iso_id: Option<Secret<String>>,
     pub sub_merchant: SubMerchant,
 }
 
@@ -208,13 +208,13 @@ pub struct PaymentFacilitator {
 #[serde(rename_all = "camelCase")]
 pub struct SubMerchant {
     pub city: String,
-    pub name: String,
+    pub name: Secret<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub state: Option<String>,
-    pub postal_code: String,
-    pub merchant_id: String,
+    pub postal_code: Secret<String>,
+    pub merchant_id: Secret<String>,
     pub country_code: String,
-    pub street: String,
+    pub street: Secret<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
     pub tax_id: Option<String>,
 }
diff --git a/crates/router/src/connector/worldpay/response.rs b/crates/router/src/connector/worldpay/response.rs
index e51b716acf6..0a50885d28e 100644
--- a/crates/router/src/connector/worldpay/response.rs
+++ b/crates/router/src/connector/worldpay/response.rs
@@ -1,3 +1,4 @@
+use masking::Secret;
 use serde::{Deserialize, Serialize};
 
 use crate::{core::errors, types};
@@ -124,12 +125,14 @@ impl Exemption {
 #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct Issuer {
-    pub authorization_code: String,
+    pub authorization_code: Secret<String>,
 }
 
 impl Issuer {
-    pub fn new(authorization_code: String) -> Self {
-        Self { authorization_code }
+    pub fn new(code: String) -> Self {
+        Self {
+            authorization_code: Secret::new(code),
+        }
     }
 }
 
@@ -187,9 +190,9 @@ impl PaymentInstrumentCard {
 #[serde(rename_all = "camelCase")]
 pub struct PaymentInstrumentCardExpiryDate {
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub month: Option<i32>,
+    pub month: Option<Secret<i32>>,
     #[serde(skip_serializing_if = "Option::is_none")]
-    pub year: Option<i32>,
+    pub year: Option<Secret<i32>>,
 }
 
 impl PaymentInstrumentCardExpiryDate {
diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs
index 6979502842f..dd92984eb99 100644
--- a/crates/router/src/connector/worldpay/transformers.rs
+++ b/crates/router/src/connector/worldpay/transformers.rs
@@ -1,7 +1,6 @@
 use base64::Engine;
 use common_utils::errors::CustomResult;
 use diesel_models::enums;
-use error_stack::{IntoReport, ResultExt};
 use masking::{PeekInterface, Secret};
 use serde::Serialize;
 
@@ -47,20 +46,8 @@ fn fetch_payment_instrument(
     match payment_method {
         api::PaymentMethodData::Card(card) => Ok(PaymentInstrument::Card(CardPayment {
             card_expiry_date: CardExpiryDate {
-                month: card
-                    .card_exp_month
-                    .peek()
-                    .clone()
-                    .parse::<i8>()
-                    .into_report()
-                    .change_context(errors::ConnectorError::ResponseDeserializationFailed)?,
-                year: card
-                    .card_exp_year
-                    .peek()
-                    .clone()
-                    .parse::<i32>()
-                    .into_report()
-                    .change_context(errors::ConnectorError::ResponseDeserializationFailed)?,
+                month: utils::CardData::get_expiry_month_as_i8(&card)?,
+                year: utils::CardData::get_expiry_year_as_i32(&card)?,
             },
             card_number: card.card_number,
             ..CardPayment::default()
@@ -69,14 +56,14 @@ fn fetch_payment_instrument(
             api_models::payments::WalletData::GooglePay(data) => {
                 Ok(PaymentInstrument::Googlepay(WalletPayment {
                     payment_type: PaymentType::Googlepay,
-                    wallet_token: data.tokenization_data.token,
+                    wallet_token: Secret::new(data.tokenization_data.token),
                     ..WalletPayment::default()
                 }))
             }
             api_models::payments::WalletData::ApplePay(data) => {
                 Ok(PaymentInstrument::Applepay(WalletPayment {
                     payment_type: PaymentType::Applepay,
-                    wallet_token: data.payment_data,
+                    wallet_token: Secret::new(data.payment_data),
                     ..WalletPayment::default()
                 }))
             }
diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs
index ebea61304a1..b01b3f027a0 100644
--- a/crates/router/src/connector/zen/transformers.rs
+++ b/crates/router/src/connector/zen/transformers.rs
@@ -2,7 +2,7 @@ use api_models::payments::Card;
 use cards::CardNumber;
 use common_utils::{ext_traits::ValueExt, pii};
 use error_stack::ResultExt;
-use masking::{PeekInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
 use ring::digest;
 use serde::{Deserialize, Serialize};
 use strum::Display;
@@ -200,8 +200,8 @@ pub struct SessionObject {
 
 #[derive(Debug, Serialize, Deserialize)]
 pub struct WalletSessionData {
-    pub terminal_uuid: Option<String>,
-    pub pay_wall_secret: Option<String>,
+    pub terminal_uuid: Option<Secret<String>>,
+    pub pay_wall_secret: Option<Secret<String>>,
 }
 
 impl TryFrom<(&ZenRouterData<&types::PaymentsAuthorizeRouterData>, &Card)> for ZenPaymentsRequest {
@@ -513,7 +513,8 @@ impl
         let terminal_uuid = session_data
             .terminal_uuid
             .clone()
-            .ok_or(errors::ConnectorError::RequestEncodingFailed)?;
+            .ok_or(errors::ConnectorError::RequestEncodingFailed)?
+            .expose();
         let mut checkout_request = CheckoutRequest {
             merchant_transaction_id: item.router_data.connector_request_reference_id.clone(),
             specified_payment_channel,
@@ -540,7 +541,7 @@ fn get_checkout_signature(
         .clone()
         .ok_or(errors::ConnectorError::RequestEncodingFailed)?;
     let mut signature_data = get_signature_data(checkout_request)?;
-    signature_data.push_str(&pay_wall_secret);
+    signature_data.push_str(&pay_wall_secret.expose());
     let payload_digest = digest::digest(&digest::SHA256, signature_data.as_bytes());
     let mut signature = hex::encode(payload_digest);
     signature.push_str(";sha256");

## 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 Worldline, Worldpay and zen.


## Test Case
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
_Note: Zen Googlepay and Worldpay can't be tested in sandbox_

1. Create a card payment with worldpay

2. 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 
```
request\":\"{\\\"cardPaymentMethodSpecificInput\\\":{\\\"card\\\":{\\\"cardNumber\\\":\\\"456735**********\\\",\\\"cardholderName\\\":\\\"*** alloc::string::String ***\\\",\\\"cvv\\\":\\\"*** alloc::string::String ***\\\",\\\"expiryDate\\\":\\\"*** alloc::string::String ***\\\"},\\\"requiresApproval\\\":false,\\\"paymentProductId\\\":1},\\\"order\\\":{\\\"amountOfMoney\\\":{\\\"amount\\\":20000,\\\"currencyCode\\\":\\\"PLN\\\"},\\\"customer\\\":{\\\"billingAddress\\\":{\\\"city\\\":\\\"San Fransico\\\",\\\"countryCode\\\":\\\"US\\\",\\\"houseNumber\\\":null,\\\"state\\\":\\\"*** alloc::string::String ***\\\",\\\"stateCode\\\":null,\\\"street\\\":null,\\\"zip\\\":\\\"*** alloc::string::String ***\\\"},\\\"contactDetails\\\":{\\\"emailAddress\\\":\\\"*********@gmail.com\\\",\\\"mobilePhoneNumber\\\":null}},\\\"references\\\":{\\\"merchantReference\\\":\\\"pay_Cm4XoGAkTeXdAaAx3OUo_1\\\"}},\\\"shipping\\\":{\\\"city\\\":\\\"San Fransico\\\",\\\"countryCode\\\":\\\"US\\\",\\\"houseNumber\\\":null,\\\"name\\\":{\\\"firstName\\\":\\\"*** alloc::string::String ***\\\",\\\"surname\\\":\\\"*** alloc::string::String ***\\\",\\\"surnamePrefix\\\":null,\\\"title\\\":null},\\\"state\\\":\\\"*** alloc::string::String ***\\\",\\\"stateCode\\\":null,\\\"street\\\":null,\\\"zip\\\":\\\"*** alloc::string::String ***\\\"}}\",\"masked_response\":\"{\\\"payment\\\":{\\\"id\\\":\\\"000000113200000139460000100001\\\",\\\"status\\\":\\\"CAPTURE_REQUESTED\\\",\\\"capture_method\\\":\\\"automatic\\\"},
```

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