Bug: [FEATURE] : [Paypal][Payu][Placetopay][PowerTranz] 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/payu/transformers.rs b/crates/router/src/connector/payu/transformers.rs
index e3ad6f8b426..e8699a1a0ed 100644
--- a/crates/router/src/connector/payu/transformers.rs
+++ b/crates/router/src/connector/payu/transformers.rs
@@ -1,4 +1,5 @@
 use base64::Engine;
+use common_utils::pii::{Email, IpAddress};
 use error_stack::{IntoReport, ResultExt};
 use serde::{Deserialize, Serialize};
 
@@ -15,7 +16,7 @@ const WALLET_IDENTIFIER: &str = "PBL";
 #[derive(Debug, Serialize, Eq, PartialEq)]
 #[serde(rename_all = "camelCase")]
 pub struct PayuPaymentsRequest {
-    customer_ip: std::net::IpAddr,
+    customer_ip: Secret<String, IpAddress>,
     merchant_pos_id: Secret<String>,
     total_amount: i64,
     currency_code: enums::Currency,
@@ -55,7 +56,7 @@ pub struct PayuWallet {
     pub value: PayuWalletCode,
     #[serde(rename = "type")]
     pub wallet_type: String,
-    pub authorization_code: String,
+    pub authorization_code: Secret<String>,
 }
 #[derive(Debug, Eq, PartialEq, Serialize)]
 #[serde(rename_all = "lowercase")]
@@ -83,8 +84,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest {
                         PayuWallet {
                             value: PayuWalletCode::Ap,
                             wallet_type: WALLET_IDENTIFIER.to_string(),
-                            authorization_code: consts::BASE64_ENGINE
-                                .encode(data.tokenization_data.token),
+                            authorization_code: Secret::new(
+                                consts::BASE64_ENGINE.encode(data.tokenization_data.token),
+                            ),
                         }
                     }),
                 }),
@@ -93,7 +95,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest {
                         PayuWallet {
                             value: PayuWalletCode::Jp,
                             wallet_type: WALLET_IDENTIFIER.to_string(),
-                            authorization_code: data.payment_data,
+                            authorization_code: Secret::new(data.payment_data),
                         }
                     }),
                 }),
@@ -111,11 +113,14 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest {
             },
         )?;
         Ok(Self {
-            customer_ip: browser_info.ip_address.ok_or(
-                errors::ConnectorError::MissingRequiredField {
-                    field_name: "browser_info.ip_address",
-                },
-            )?,
+            customer_ip: Secret::new(
+                browser_info
+                    .ip_address
+                    .ok_or(errors::ConnectorError::MissingRequiredField {
+                        field_name: "browser_info.ip_address",
+                    })?
+                    .to_string(),
+            ),
             merchant_pos_id: auth_type.merchant_pos_id,
             total_amount: item.request.amount,
             currency_code: item.request.currency,
@@ -401,8 +406,8 @@ pub struct PayuOrderResponseData {
     ext_order_id: Option<String>,
     order_create_date: String,
     notify_url: Option<String>,
-    customer_ip: std::net::IpAddr,
-    merchant_pos_id: String,
+    customer_ip: Secret<String, IpAddress>,
+    merchant_pos_id: Secret<String>,
     description: String,
     validity_time: Option<String>,
     currency_code: enums::Currency,
@@ -417,12 +422,12 @@ pub struct PayuOrderResponseData {
 #[serde(rename_all = "camelCase")]
 pub struct PayuOrderResponseBuyerData {
     ext_customer_id: Option<String>,
-    email: Option<String>,
-    phone: Option<String>,
-    first_name: Option<String>,
-    last_name: Option<String>,
+    email: Option<Email>,
+    phone: Option<Secret<String>>,
+    first_name: Option<Secret<String>>,
+    last_name: Option<Secret<String>>,
     #[serde(rename = "nin")]
-    national_identification_number: Option<String>,
+    national_identification_number: Option<Secret<String>>,
     language: Option<String>,
     delivery: Option<String>,
     customer_id: Option<String>,
diff --git a/crates/router/src/connector/placetopay/transformers.rs b/crates/router/src/connector/placetopay/transformers.rs
index e5dedf6ded0..1c3b46fdb60 100644
--- a/crates/router/src/connector/placetopay/transformers.rs
+++ b/crates/router/src/connector/placetopay/transformers.rs
@@ -73,7 +73,7 @@ pub struct PlacetopayAuthType {
 pub struct PlacetopayAuth {
     login: Secret<String>,
     tran_key: Secret<String>,
-    nonce: String,
+    nonce: Secret<String>,
     seed: String,
 }
 
@@ -179,7 +179,7 @@ impl TryFrom<&types::ConnectorAuthType> for PlacetopayAuth {
         context.update(seed.as_bytes());
         context.update(placetopay_auth.tran_key.peek().as_bytes());
         let encoded_digest = base64::Engine::encode(&consts::BASE64_ENGINE, context.finish());
-        let nonce = base64::Engine::encode(&consts::BASE64_ENGINE, &nonce_bytes);
+        let nonce = Secret::new(base64::Engine::encode(&consts::BASE64_ENGINE, &nonce_bytes));
         Ok(Self {
             login: placetopay_auth.login,
             tran_key: encoded_digest.into(),
diff --git a/crates/router/src/connector/powertranz.rs b/crates/router/src/connector/powertranz.rs
index 53f6a02d5b4..a26886384c0 100644
--- a/crates/router/src/connector/powertranz.rs
+++ b/crates/router/src/connector/powertranz.rs
@@ -309,7 +309,7 @@ impl
             .get_redirect_response_payload()?
             .parse_value("PowerTranz RedirectResponsePayload")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-        let spi_token = format!(r#""{}""#, redirect_payload.spi_token);
+        let spi_token = format!(r#""{}""#, redirect_payload.spi_token.expose());
         Ok(RequestContent::Json(Box::new(spi_token)))
     }
 
diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rs
index 54849f8bf1d..0af5dde6d00 100644
--- a/crates/router/src/connector/powertranz/transformers.rs
+++ b/crates/router/src/connector/powertranz/transformers.rs
@@ -1,8 +1,8 @@
 use api_models::payments::Card;
-use common_utils::pii::Email;
+use common_utils::pii::{Email, IpAddress};
 use diesel_models::enums::RefundStatus;
 use error_stack::IntoReport;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
 use serde::{Deserialize, Serialize};
 use uuid::Uuid;
 
@@ -51,7 +51,7 @@ pub struct BrowserInfo {
     screen_width: Option<String>,
     time_zone: Option<String>,
     user_agent: Option<String>,
-    i_p: Option<std::net::IpAddr>,
+    i_p: Option<Secret<String, IpAddress>>,
     color_depth: Option<String>,
 }
 
@@ -94,7 +94,7 @@ pub struct PowertranzAddressDetails {
 #[derive(Debug, Deserialize)]
 #[serde(rename_all = "PascalCase")]
 pub struct RedirectResponsePayload {
-    pub spi_token: String,
+    pub spi_token: Secret<String>,
 }
 
 impl TryFrom<&types::PaymentsAuthorizeRouterData> for PowertranzPaymentsRequest {
@@ -173,7 +173,9 @@ impl TryFrom<&types::BrowserInformation> for BrowserInfo {
             screen_width: item.screen_width.map(|width| width.to_string()),
             time_zone: item.time_zone.map(|zone| zone.to_string()),
             user_agent: item.user_agent.clone(),
-            i_p: item.ip_address,
+            i_p: item
+                .ip_address
+                .map(|ip_address| Secret::new(ip_address.to_string())),
             color_depth: item.color_depth.map(|depth| depth.to_string()),
         })
     }
@@ -256,7 +258,7 @@ pub struct PowertranzBaseResponse {
     original_trxn_identifier: Option<String>,
     errors: Option<Vec<Error>>,
     iso_response_code: String,
-    redirect_data: Option<String>,
+    redirect_data: Option<Secret<String>>,
     response_message: String,
     order_identifier: String,
 }
@@ -322,7 +324,7 @@ impl<F, T>
             item.response
                 .redirect_data
                 .map(|redirect_data| services::RedirectForm::Html {
-                    html_data: redirect_data,
+                    html_data: redirect_data.expose(),
                 });
         let response = error_response.map_or(
             Ok(types::PaymentsResponseData::TransactionResponse {

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

- [ ] Bugfix
- [x] New feature
- [x] Enhancement
- [ ] 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 Payu, Placetopay, PowerTranz and Prophetpay.

## 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)?
-->
1. Create a Payu Google pay payment
Generate token from  : https://jsfiddle.net/1agu74ve/1/
```
  "gateway": "payu"
  "gatewayMerchantId": "YOUR_GATEWAY_MERCHANT_ID"
```

```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{}' \
--data-raw '{
    "amount": 1800,
    "currency": "PLN",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "CustomerX",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "description": "Visa •••• 1111",
                "info": {
                    "card_network": "VISA",
                    "card_details": "1111"
                },
                "tokenization_data": {
                    "type": "PAYMENT_GATEWAY",
                    "token": "{{token}}"
                }
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "Dubai",
            "zip": "94122",
            "country": "AE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+97"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "AE",
            "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": "127.0.0.1"
    },
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590043"
    }
}'
```

2. PlaceToPay Card payment
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{{api_key}}' \
--data '{
    "amount":320320,
    "currency": "COP",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "deepanshu",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4110770010002837",
            "card_exp_month": "02",
            "card_exp_year": "26",
            "card_holder_name": "joseph",
            "card_cvc": "837"
        }
    },
    "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",
        "ip_address": "127.2.2.0"
    }
}'
```

3. PowerTranz
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{{api_key}}' \
--data-raw '{
    "amount": 20000,
    "currency": "PLN",
    "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": "three_ds",
    "return_url": "https://google.com",
    
    "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"
        }
    },
    "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": "4000027891380961",
            "card_exp_month": "10",
            "card_exp_year": "25",
            "card_holder_name": "Joseph Doe",
            "card_cvc": "123"
        }
    }
}'
```

4. 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"'
```
1. Payme Googlepay Response
```
"masked_response\":\"{\\\"status\\\":{\\\"statusCode\\\":\\\"WARNING_CONTINUE_3DS\\\",\\\"severity\\\":\\\"WARNING\\\",\\\"statusDesc\\\":null},\\\"redirectUri\\\":\\\"https://merch-prod.snd.payu.com/front/threeds/?authenticationId=d7b6aa7f-5aa8-467d-adcf-8a8ec9bee28a&refReqId=18c06b1d191d1cf26b93997134d7174d\\\",\\\"iframeAllowed\\\":true,\\\"threeDsProtocolVersion\\\":\\\"3DS2\\\",\\\"orderId\\\":\\\"T9L16ZMRD3240305GUEST000P01\\\",\\\"extOrderId\\\":null}
```
2. Placetopay Card payment
```
payment request\\\",\\\"amount\\\":{\\\"currency\\\":\\\"COP\\\",\\\"total\\\":320320}},\\\"instrument\\\":{\\\"card\\\":{\\\"number\\\":\\\"411077**********\\\",\\\"expiration\\\":\\\"*** alloc::string::String ***\\\",\\\"cvv\\\":\\\"*** alloc::string::String ***\\\"}},\\\"ipAddress\\\":\\\"127.**.**.**\\\",\\\"userAgent\\\":\\\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\\\"}\",\"masked_response\":\"{\\\"status\\\":{\\\"status\\\":\\\"APPROVED\\\"}
```

3. PowerTranz Card Payment 
```
masked_response\":\"{\\\"TransactionType\\\":2,\\\"Approved\\\":false,\\\"TransactionIdentifier\\\":\\\"49da3e97-4f34-4a20-bbfd-204450646191\\\",\\\"OriginalTrxnIdentifier\\\":null,\\\"Errors\\\":null,\\\"IsoResponseCode\\\":\\\"SP4\\\",\\\"RedirectData\\\":\\\"*** alloc::string::String ***\\\",\\\"ResponseMessage\\\":\\\"SPI Preprocessing complete\\\",\\\"OrderIdentifier\\\":\\\"pay_C0D9yBw4FIxAiYSRMGJ2_1\\\"}
```

## Impacted Area
> Payme:  Applepay and Googlepay
> Placetopay: Card Payment
> PowerTranz: Card Payment

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