Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(headers): add optional header masking feature to outbound request (#1320)
Nishant Joshifc6acd04cb28
diff --git a/Cargo.lock b/Cargo.lockindex 3690b93799..fd55c2dc31 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3058,7 +3058,7 @@ dependencies = [[[package]]name = "opentelemetry"version = "0.18.0"-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"dependencies = ["opentelemetry_api","opentelemetry_sdk",@@ -3067,7 +3067,7 @@ dependencies = [[[package]]name = "opentelemetry-otlp"version = "0.11.0"-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"dependencies = ["async-trait","futures",@@ -3084,7 +3084,7 @@ dependencies = [[[package]]name = "opentelemetry-proto"version = "0.1.0"-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"dependencies = ["futures","futures-util",@@ -3096,7 +3096,7 @@ dependencies = [[[package]]name = "opentelemetry_api"version = "0.18.0"-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"dependencies = ["fnv","futures-channel",@@ -3111,7 +3111,7 @@ dependencies = [[[package]]name = "opentelemetry_sdk"version = "0.18.0"-source = "git+https://github.com/open-telemetry/opentelemetry-rust?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"+source = "git+https://github.com/open-telemetry/opentelemetry-rust/?rev=44b90202fd744598db8b0ace5b8f0bad7ec45658#44b90202fd744598db8b0ace5b8f0bad7ec45658"dependencies = ["async-trait","crossbeam-channel",diff --git a/connector-template/mod.rs b/connector-template/mod.rsindex f7653f1618..2f0fa3c827 100644--- a/connector-template/mod.rs+++ b/connector-template/mod.rs@@ -9,7 +9,7 @@ use crate::{core::{errors::{self, CustomResult},},- headers, services::{self, ConnectorIntegration},+ headers, services::{self, ConnectorIntegration, request::{self, Mask}},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -53,10 +53,10 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self).to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -77,10 +77,10 @@ impl ConnectorCommon for {{project-name | downcase | pascal_case}} {connectors.{{project-name}}.base_url.as_ref()}- fn get_auth_header(&self, auth_type:&types::ConnectorAuthType)-> CustomResult<Vec<(String,String)>,errors::ConnectorError> {+ fn get_auth_header(&self, auth_type:&types::ConnectorAuthType)-> CustomResult<Vec<(String,request::Maskable<String>)>,errors::ConnectorError> {let auth = {{project-name | downcase}}::{{project-name | downcase | pascal_case}}AuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key.into_masked())])}fn build_error_response(@@ -131,7 +131,7 @@ impltypes::PaymentsAuthorizeData,types::PaymentsResponseData,> for {{project-name | downcase | pascal_case}} {- fn get_headers(&self, req: &types::PaymentsAuthorizeRouterData, connectors: &settings::Connectors,) -> CustomResult<Vec<(String, String)>,errors::ConnectorError> {+ fn get_headers(&self, req: &types::PaymentsAuthorizeRouterData, connectors: &settings::Connectors,) -> CustomResult<Vec<(String, request::Maskable<String>)>,errors::ConnectorError> {self.build_headers(req, connectors)}@@ -200,7 +200,7 @@ impl&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -267,7 +267,7 @@ impl&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -347,7 +347,7 @@ impltypes::RefundsData,types::RefundsResponseData,> for {{project-name | downcase | pascal_case}} {- fn get_headers(&self, req: &types::RefundsRouterData<api::Execute>, connectors: &settings::Connectors,) -> CustomResult<Vec<(String,String)>,errors::ConnectorError> {+ fn get_headers(&self, req: &types::RefundsRouterData<api::Execute>, connectors: &settings::Connectors,) -> CustomResult<Vec<(String,request::Maskable<String>)>,errors::ConnectorError> {self.build_headers(req, connectors)}@@ -401,7 +401,7 @@ implimplConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for {{project-name | downcase | pascal_case}} {- fn get_headers(&self, req: &types::RefundSyncRouterData,connectors: &settings::Connectors,) -> CustomResult<Vec<(String, String)>,errors::ConnectorError> {+ fn get_headers(&self, req: &types::RefundSyncRouterData,connectors: &settings::Connectors,) -> CustomResult<Vec<(String, request::Maskable<String>)>,errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/aci.rs b/crates/router/src/connector/aci.rsindex 0d2202b792..ca0d621242 100644--- a/crates/router/src/connector/aci.rs+++ b/crates/router/src/connector/aci.rs@@ -8,7 +8,11 @@ use transformers as aci;use crate::{configs::settings,core::errors::{self, CustomResult},- headers, services,+ headers,+ services::{+ self,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon},@@ -35,11 +39,14 @@ impl ConnectorCommon for Aci {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: aci::AciAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}}@@ -113,10 +120,12 @@ impl&self,req: &types::PaymentsSyncRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsSyncType::get_content_type(self).to_string(),+ types::PaymentsSyncType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -218,10 +227,12 @@ impl&self,req: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -326,10 +337,12 @@ impl&self,req: &types::PaymentsCancelRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -425,10 +438,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref&self,req: &types::RefundsRouterData<api::Execute>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::RefundExecuteType::get_content_type(self).to_string(),+ types::RefundExecuteType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rsindex 149beb97c6..f4396e1b03 100644--- a/crates/router/src/connector/adyen.rs+++ b/crates/router/src/connector/adyen.rs@@ -15,7 +15,11 @@ use crate::{consts,core::errors::{self, CustomResult},db::StorageInterface,- headers, logger, services,+ headers, logger,+ services::{+ self,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon},@@ -35,10 +39,13 @@ impl ConnectorCommon for Adyen {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = adyen::AdyenAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::X_API_KEY.to_string(), auth.api_key)])+ Ok(vec![(+ headers::X_API_KEY.to_string(),+ auth.api_key.into_masked(),+ )])}fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {@@ -86,10 +93,12 @@ impl&self,req: &types::VerifyRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsVerifyType::get_content_type(self).to_string(),+ types::PaymentsVerifyType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -202,10 +211,10 @@ impl&self,req: &types::PaymentsCaptureRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- self.common_get_content_type().to_string(),+ self.common_get_content_type().to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -296,10 +305,12 @@ impl&self,req: &types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsSyncType::get_content_type(self).to_string(),+ types::PaymentsSyncType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -438,7 +449,7 @@ impl&self,req: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError>+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError>whereSelf: services::ConnectorIntegration<api::Authorize,@@ -448,7 +459,9 @@ impl{let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -545,10 +558,12 @@ impl&self,req: &types::PaymentsCancelRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -640,10 +655,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref&self,req: &types::RefundsRouterData<api::Execute>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::RefundExecuteType::get_content_type(self).to_string(),+ types::RefundExecuteType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_header = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_header);diff --git a/crates/router/src/connector/airwallex.rs b/crates/router/src/connector/airwallex.rsindex b508424d19..2c4915c40c 100644--- a/crates/router/src/connector/airwallex.rs+++ b/crates/router/src/connector/airwallex.rs@@ -16,7 +16,11 @@ use crate::{},db::StorageInterface,headers, logger, routes,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -36,10 +40,10 @@ where&self,req: &RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];let access_token = req.access_token@@ -48,7 +52,7 @@ wherelet auth_header = (headers::AUTHORIZATION.to_string(),- format!("Bearer {}", access_token.token),+ format!("Bearer {}", access_token.token).into_masked(),);headers.push(auth_header);@@ -129,11 +133,17 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,req: &types::RefreshTokenRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let headers = vec![- (headers::X_API_KEY.to_string(), req.request.app_id.clone()),- ("Content-Length".to_string(), "0".to_string()),- ("x-client-id".to_string(), req.get_request_id()?),+ (+ headers::X_API_KEY.to_string(),+ req.request.app_id.clone().into_masked(),+ ),+ ("Content-Length".to_string(), "0".to_string().into()),+ (+ "x-client-id".to_string(),+ req.get_request_id()?.into_masked(),+ ),];Ok(headers)}@@ -195,7 +205,7 @@ impl&self,req: &types::PaymentsInitRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -308,7 +318,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -397,7 +407,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -475,7 +485,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}fn get_content_type(&self) -> &'static str {@@ -561,7 +571,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -658,7 +668,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -745,7 +755,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -826,7 +836,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rsindex 419cee8f26..f954553049 100644--- a/crates/router/src/connector/authorizedotnet.rs+++ b/crates/router/src/connector/authorizedotnet.rs@@ -14,7 +14,7 @@ use crate::{core::errors::{self, CustomResult},db::StorageInterface,headers,- services::{self, ConnectorIntegration},+ services::{self, request, ConnectorIntegration},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -33,10 +33,11 @@ where&self,_req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, services::request::Maskable<String>)>, errors::ConnectorError>+ {Ok(vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)])}}@@ -101,7 +102,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -186,7 +187,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {// This connector does not require an auth header, the authentication details are sent in the request bodyself.build_headers(req, connectors)}@@ -270,7 +271,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {// This connector does not require an auth header, the authentication details are sent in the request bodyself.build_headers(req, connectors)}@@ -362,7 +363,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -449,7 +450,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {// This connector does not require an auth header, the authentication details are sent in the request bodyself.build_headers(req, connectors)}@@ -535,7 +536,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundsRouterData<api::RSync>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {// This connector does not require an auth header, the authentication details are sent in the request bodyself.build_headers(req, connectors)}diff --git a/crates/router/src/connector/bambora.rs b/crates/router/src/connector/bambora.rsindex 984134f46b..e3f620826a 100644--- a/crates/router/src/connector/bambora.rs+++ b/crates/router/src/connector/bambora.rs@@ -14,7 +14,11 @@ use crate::{payments,},headers, logger,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -34,10 +38,12 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -61,11 +67,14 @@ impl ConnectorCommon for Bambora {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: bambora::BamboraAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -115,7 +124,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -207,7 +216,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -284,7 +293,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -380,7 +389,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -467,7 +476,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -546,7 +555,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -666,7 +675,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/bitpay.rs b/crates/router/src/connector/bitpay.rsindex 703302399f..8bc21b49a5 100644--- a/crates/router/src/connector/bitpay.rs+++ b/crates/router/src/connector/bitpay.rs@@ -11,7 +11,11 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -54,13 +58,18 @@ where&self,_req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),+ ),+ (+ headers::X_ACCEPT_VERSION.to_string(),+ "2.0.0".to_string().into(),),- (headers::X_ACCEPT_VERSION.to_string(), "2.0.0".to_string()),];Ok(header)}@@ -82,10 +91,13 @@ impl ConnectorCommon for Bitpay {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = bitpay::BitpayAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -127,7 +139,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -205,7 +217,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -279,7 +291,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -353,7 +365,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -426,7 +438,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/bluesnap.rs b/crates/router/src/connector/bluesnap.rsindex a24b24a190..7a23fcae65 100644--- a/crates/router/src/connector/bluesnap.rs+++ b/crates/router/src/connector/bluesnap.rs@@ -23,7 +23,11 @@ use crate::{},db::StorageInterface,headers, logger,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -44,11 +48,11 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = self.get_auth_header(&req.connector_auth_type)?;header.push((headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),));Ok(header)}@@ -70,7 +74,7 @@ impl ConnectorCommon for Bluesnap {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: bluesnap::BluesnapAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;@@ -78,7 +82,7 @@ impl ConnectorCommon for Bluesnap {consts::BASE64_ENGINE.encode(format!("{}:{}", auth.key1, auth.api_key));Ok(vec![(headers::AUTHORIZATION.to_string(),- format!("Basic {encoded_api_key}"),+ format!("Basic {encoded_api_key}").into_masked(),)])}@@ -151,7 +155,7 @@ impl&self,req: &types::ConnectorCustomerRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -240,7 +244,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -328,7 +332,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -403,7 +407,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -499,7 +503,7 @@ impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::Payme&self,req: &types::PaymentsSessionRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -583,7 +587,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -706,7 +710,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}fn get_content_type(&self) -> &'static str {@@ -791,7 +795,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -873,7 +877,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rsindex d7f8335f25..42fc714c4c 100644--- a/crates/router/src/connector/braintree.rs+++ b/crates/router/src/connector/braintree.rs@@ -9,7 +9,11 @@ use crate::{configs::settings,consts,core::errors::{self, CustomResult},- headers, services,+ headers,+ services::{+ self,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon},@@ -32,11 +36,14 @@ impl ConnectorCommon for Braintree {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: braintree::BraintreeAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.auth_header)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.auth_header.into_masked(),+ )])}}@@ -71,14 +78,19 @@ impl&self,req: &types::PaymentsSessionRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsSessionType::get_content_type(self).to_string(),+ types::PaymentsSessionType::get_content_type(self)+ .to_string()+ .into(),+ ),+ (headers::X_API_VERSION.to_string(), "6".to_string().into()),+ (+ headers::ACCEPT.to_string(),+ "application/json".to_string().into(),),- (headers::X_API_VERSION.to_string(), "6".to_string()),- (headers::ACCEPT.to_string(), "application/json".to_string()),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;headers.append(&mut api_key);@@ -213,14 +225,19 @@ impl&self,req: &types::PaymentsSyncRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsSyncType::get_content_type(self).to_string(),+ types::PaymentsSyncType::get_content_type(self)+ .to_string()+ .into(),+ ),+ (headers::X_API_VERSION.to_string(), "6".to_string().into()),+ (+ headers::ACCEPT.to_string(),+ "application/json".to_string().into(),),- (headers::X_API_VERSION.to_string(), "6".to_string()),- (headers::ACCEPT.to_string(), "application/json".to_string()),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;headers.append(&mut api_key);@@ -320,14 +337,19 @@ impl&self,req: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),+ ),+ (headers::X_API_VERSION.to_string(), "6".to_string().into()),+ (+ headers::ACCEPT.to_string(),+ "application/json".to_string().into(),),- (headers::X_API_VERSION.to_string(), "6".to_string()),- (headers::ACCEPT.to_string(), "application/json".to_string()),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;headers.append(&mut api_key);@@ -425,14 +447,19 @@ impl&self,req: &types::PaymentsCancelRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),+ ),+ (headers::X_API_VERSION.to_string(), "6".to_string().into()),+ (+ headers::ACCEPT.to_string(),+ "application/json".to_string().into(),),- (headers::X_API_VERSION.to_string(), "6".to_string()),- (headers::ACCEPT.to_string(), "application/json".to_string()),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;headers.append(&mut api_key);@@ -527,14 +554,19 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref&self,req: &types::RefundsRouterData<api::Execute>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- types::RefundExecuteType::get_content_type(self).to_string(),+ types::RefundExecuteType::get_content_type(self)+ .to_string()+ .into(),+ ),+ (headers::X_API_VERSION.to_string(), "6".to_string().into()),+ (+ headers::ACCEPT.to_string(),+ "application/json".to_string().into(),),- (headers::X_API_VERSION.to_string(), "6".to_string()),- (headers::ACCEPT.to_string(), "application/json".to_string()),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;headers.append(&mut api_key);@@ -622,7 +654,7 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun&self,_req: &types::RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Err(errors::ConnectorError::NotImplemented("braintree".to_string()).into())}diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rsindex 74c2a32b27..888467f44d 100644--- a/crates/router/src/connector/checkout.rs+++ b/crates/router/src/connector/checkout.rs@@ -18,7 +18,11 @@ use crate::{},db::StorageInterface,headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -37,10 +41,12 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -60,13 +66,13 @@ impl ConnectorCommon for Checkout {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: checkout::CheckoutAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;Ok(vec![(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", auth.api_secret),+ format!("Bearer {}", auth.api_secret).into_masked(),)])}@@ -137,16 +143,16 @@ impl&self,req: &types::TokenizationRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- self.common_get_content_type().to_string(),+ self.common_get_content_type().to_string().into(),)];let api_key = checkout::CheckoutAuthType::try_from(&req.connector_auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;let mut auth = vec![(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", api_key.api_key),+ format!("Bearer {}", api_key.api_key).into_masked(),)];header.append(&mut auth);Ok(header)@@ -247,7 +253,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -326,7 +332,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -399,7 +405,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -477,7 +483,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -556,7 +562,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -640,7 +646,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundsRouterData<api::RSync>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -714,10 +720,12 @@ impl&self,req: &types::AcceptDisputeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::AcceptDisputeType::get_content_type(self).to_string(),+ types::AcceptDisputeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -825,7 +833,7 @@ impl ConnectorIntegration<api::Upload, types::UploadFileRequestData, types::Uplotypes::UploadFileResponse,>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.get_auth_header(&req.connector_auth_type)}@@ -907,10 +915,12 @@ impl&self,req: &types::SubmitEvidenceRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::SubmitEvidenceType::get_content_type(self).to_string(),+ types::SubmitEvidenceType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -987,10 +997,12 @@ impl&self,req: &types::DefendDisputeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::DefendDisputeType::get_content_type(self).to_string(),+ types::DefendDisputeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);diff --git a/crates/router/src/connector/coinbase.rs b/crates/router/src/connector/coinbase.rsindex 0fe23c244a..2b275034dd 100644--- a/crates/router/src/connector/coinbase.rs+++ b/crates/router/src/connector/coinbase.rs@@ -12,7 +12,11 @@ use crate::{configs::settings,core::errors::{self, CustomResult},db, headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -45,13 +49,17 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, services::request::Maskable<String>)>, errors::ConnectorError>+ {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- self.common_get_content_type().to_string(),+ self.common_get_content_type().to_string().into(),+ ),+ (+ headers::X_CC_VERSION.to_string(),+ "2018-03-22".to_string().into(),),- (headers::X_CC_VERSION.to_string(), "2018-03-22".to_string()),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -75,10 +83,13 @@ impl ConnectorCommon for Coinbase {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: coinbase::CoinbaseAuthType = coinbase::CoinbaseAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::X_CC_API_KEY.to_string(), auth.api_key)])+ Ok(vec![(+ headers::X_CC_API_KEY.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -132,7 +143,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -210,7 +221,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -281,7 +292,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -357,7 +368,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -430,7 +441,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rsindex 829c6e13b7..d294438f0c 100644--- a/crates/router/src/connector/cybersource.rs+++ b/crates/router/src/connector/cybersource.rs@@ -15,7 +15,11 @@ use crate::{consts,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -129,7 +133,8 @@ where&self,req: &types::RouterData<Flow, Request, Response>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, services::request::Maskable<String>)>, errors::ConnectorError>+ {let date = OffsetDateTime::now_utc();let cybersource_req = self.get_request_body(req)?;let auth = cybersource::CybersourceAuthType::try_from(&req.connector_auth_type)?;@@ -161,19 +166,25 @@ wherelet mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),),(headers::ACCEPT.to_string(),- "application/hal+json;charset=utf-8".to_string(),+ "application/hal+json;charset=utf-8".to_string().into(),+ ),+ (+ "v-c-merchant-id".to_string(),+ merchant_account.into_masked(),),- ("v-c-merchant-id".to_string(), merchant_account),- ("Date".to_string(), date.to_string()),- ("Host".to_string(), host.to_string()),- ("Signature".to_string(), signature),+ ("Date".to_string(), date.to_string().into()),+ ("Host".to_string(), host.to_string().into()),+ ("Signature".to_string(), signature.into_masked()),];if matches!(http_method, services::Method::Post | services::Method::Put) {- headers.push(("Digest".to_string(), format!("SHA-256={sha256}")));+ headers.push((+ "Digest".to_string(),+ format!("SHA-256={sha256}").into_masked(),+ ));}Ok(headers)}@@ -223,7 +234,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -310,7 +321,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, services::request::Maskable<String>)>, errors::ConnectorError>+ {self.build_headers(req, connectors)}@@ -395,7 +407,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -484,7 +496,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -568,7 +580,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundExecuteRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -650,7 +662,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}fn get_content_type(&self) -> &'static str {diff --git a/crates/router/src/connector/dlocal.rs b/crates/router/src/connector/dlocal.rsindex 5baaee530d..d01e3431af 100644--- a/crates/router/src/connector/dlocal.rs+++ b/crates/router/src/connector/dlocal.rs@@ -14,7 +14,11 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers, logger,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -47,7 +51,8 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, services::request::Maskable<String>)>, errors::ConnectorError>+ {let dlocal_req = match self.get_request_body(req)? {Some(val) => val,None => "".to_string(),@@ -68,14 +73,20 @@ where.attach_printable("Failed to sign the message")?;let auth_string: String = format!("V2-HMAC-SHA256, Signature: {}", encode(authz));let headers = vec![- (headers::AUTHORIZATION.to_string(), auth_string),- (headers::X_LOGIN.to_string(), auth.x_login),- (headers::X_TRANS_KEY.to_string(), auth.x_trans_key),- (headers::X_VERSION.to_string(), "2.1".to_string()),- (headers::X_DATE.to_string(), date),+ (+ headers::AUTHORIZATION.to_string(),+ auth_string.into_masked(),+ ),+ (headers::X_LOGIN.to_string(), auth.x_login.into_masked()),+ (+ headers::X_TRANS_KEY.to_string(),+ auth.x_trans_key.into_masked(),+ ),+ (headers::X_VERSION.to_string(), "2.1".to_string().into()),+ (headers::X_DATE.to_string(), date.into()),(headers::CONTENT_TYPE.to_string(),- Self.get_content_type().to_string(),+ Self.get_content_type().to_string().into(),),];Ok(headers)@@ -146,7 +157,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -225,7 +236,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -294,7 +305,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -372,7 +383,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -440,7 +451,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -514,7 +525,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rsindex 74cca4db98..0b7fd803d2 100644--- a/crates/router/src/connector/dummyconnector.rs+++ b/crates/router/src/connector/dummyconnector.rs@@ -11,7 +11,11 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -55,10 +59,12 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -87,10 +93,13 @@ impl<const T: u8> ConnectorCommon for DummyConnector<T> {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = dummyconnector::DummyConnectorAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -138,7 +147,7 @@ impl<const T: u8>&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -227,7 +236,7 @@ impl<const T: u8>&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -304,7 +313,7 @@ impl<const T: u8>&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -382,7 +391,7 @@ impl<const T: u8> ConnectorIntegration<api::Execute, types::RefundsData, types::&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -464,7 +473,7 @@ impl<const T: u8> ConnectorIntegration<api::RSync, types::RefundsData, types::Re&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/fiserv.rs b/crates/router/src/connector/fiserv.rsindex 463f37d0a8..af0401c798 100644--- a/crates/router/src/connector/fiserv.rs+++ b/crates/router/src/connector/fiserv.rs@@ -14,7 +14,11 @@ use crate::{consts,core::errors::{self, CustomResult},headers, logger,- services::{self, api::ConnectorIntegration},+ services::{+ self,+ api::ConnectorIntegration,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -55,7 +59,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let timestamp = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000;let auth: fiserv::FiservAuthType =fiserv::FiservAuthType::try_from(&req.connector_auth_type)?;@@ -72,12 +76,14 @@ wherelet mut headers = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),),- ("Client-Request-Id".to_string(), client_request_id),- ("Auth-Token-Type".to_string(), "HMAC".to_string()),- (headers::TIMESTAMP.to_string(), timestamp.to_string()),- (headers::AUTHORIZATION.to_string(), hmac),+ ("Client-Request-Id".to_string(), client_request_id.into()),+ ("Auth-Token-Type".to_string(), "HMAC".to_string().into()),+ (headers::TIMESTAMP.to_string(), timestamp.to_string().into()),+ (headers::AUTHORIZATION.to_string(), hmac.into_masked()),];headers.append(&mut auth_header);Ok(headers)@@ -99,11 +105,14 @@ impl ConnectorCommon for Fiserv {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: fiserv::FiservAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::API_KEY.to_string(), auth.api_key)])+ Ok(vec![(+ headers::API_KEY.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(&self,@@ -180,7 +189,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -265,7 +274,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -347,7 +356,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -439,7 +448,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -528,7 +537,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}fn get_content_type(&self) -> &'static str {@@ -603,7 +612,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/forte.rs b/crates/router/src/connector/forte.rsindex c42044d543..f2f1a1ed76 100644--- a/crates/router/src/connector/forte.rs+++ b/crates/router/src/connector/forte.rs@@ -12,7 +12,11 @@ use crate::{consts,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -55,10 +59,13 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let content_type = ConnectorCommon::common_get_content_type(self);let mut common_headers = self.get_auth_header(&req.connector_auth_type)?;- common_headers.push((headers::CONTENT_TYPE.to_string(), content_type.to_string()));+ common_headers.push((+ headers::CONTENT_TYPE.to_string(),+ content_type.to_string().into(),+ ));Ok(common_headers)}}@@ -79,15 +86,21 @@ impl ConnectorCommon for Forte {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: forte::ForteAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;let raw_basic_token = format!("{}:{}", auth.api_access_id, auth.api_secret_key);let basic_token = format!("Basic {}", consts::BASE64_ENGINE.encode(raw_basic_token));Ok(vec![- (headers::AUTHORIZATION.to_string(), basic_token),- (AUTH_ORG_ID_HEADER.to_string(), auth.organization_id),+ (+ headers::AUTHORIZATION.to_string(),+ basic_token.into_masked(),+ ),+ (+ AUTH_ORG_ID_HEADER.to_string(),+ auth.organization_id.into_masked(),+ ),])}fn build_error_response(@@ -134,7 +147,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -218,7 +231,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -288,7 +301,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -369,7 +382,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -447,7 +460,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -526,7 +539,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rsindex 2986123952..0491e8d998 100644--- a/crates/router/src/connector/globalpay.rs+++ b/crates/router/src/connector/globalpay.rs@@ -23,7 +23,11 @@ use crate::{payments,},db, headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt, PaymentsCompleteAuthorize},@@ -43,7 +47,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let access_token = req.access_token.clone()@@ -52,12 +56,12 @@ whereOk(vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),),- ("X-GP-Version".to_string(), "2021-03-22".to_string()),+ ("X-GP-Version".to_string(), "2021-03-22".to_string().into()),(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", access_token.token),+ format!("Bearer {}", access_token.token).into_masked(),),])}@@ -79,7 +83,7 @@ impl ConnectorCommon for Globalpay {fn get_auth_header(&self,_auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![])}@@ -114,7 +118,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -201,13 +205,15 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,_req: &types::RefreshTokenRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::RefreshTokenType::get_content_type(self).to_string(),+ types::RefreshTokenType::get_content_type(self)+ .to_string()+ .into(),),- ("X-GP-Version".to_string(), "2021-03-22".to_string()),+ ("X-GP-Version".to_string(), "2021-03-22".to_string().into()),])}@@ -316,7 +322,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -397,7 +403,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -468,7 +474,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -559,7 +565,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -643,7 +649,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -725,7 +731,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/iatapay.rs b/crates/router/src/connector/iatapay.rsindex 271e37e1f6..149e895506 100644--- a/crates/router/src/connector/iatapay.rs+++ b/crates/router/src/connector/iatapay.rs@@ -14,7 +14,11 @@ use crate::{consts,core::errors::{self, CustomResult},db, headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -57,10 +61,10 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];let access_token = req.access_token@@ -69,7 +73,7 @@ wherelet auth_header = (headers::AUTHORIZATION.to_string(),- format!("Bearer {}", access_token.token),+ format!("Bearer {}", access_token.token).into_masked(),);headers.push(auth_header);Ok(headers)@@ -92,10 +96,13 @@ impl ConnectorCommon for Iatapay {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = iatapay::IatapayAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.client_id)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.client_id.into_masked(),+ )])}fn build_error_response(@@ -141,7 +148,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,req: &types::RefreshTokenRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: iatapay::IatapayAuthType =iatapay::IatapayAuthType::try_from(&req.connector_auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;@@ -152,9 +159,11 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tOk(vec![(headers::CONTENT_TYPE.to_string(),- types::RefreshTokenType::get_content_type(self).to_string(),+ types::RefreshTokenType::get_content_type(self)+ .to_string()+ .into(),),- (headers::AUTHORIZATION.to_string(), auth_val),+ (headers::AUTHORIZATION.to_string(), auth_val.into_masked()),])}@@ -234,7 +243,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -313,7 +322,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -385,7 +394,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -453,7 +462,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -533,7 +542,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rsindex 4ed92d73d0..7dd95ff39f 100644--- a/crates/router/src/connector/klarna.rs+++ b/crates/router/src/connector/klarna.rs@@ -10,7 +10,10 @@ use crate::{connector::utils as connector_utils,core::errors::{self, CustomResult},headers,- services::{self},+ services::{+ self,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon},@@ -38,11 +41,14 @@ impl ConnectorCommon for Klarna {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: klarna::KlarnaAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.basic_token)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.basic_token.into_masked(),+ )])}}@@ -87,10 +93,12 @@ impl&self,req: &types::PaymentsSessionRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -217,10 +225,12 @@ impl&self,req: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);diff --git a/crates/router/src/connector/mollie.rs b/crates/router/src/connector/mollie.rsindex 1518eefcd9..5f54a698d0 100644--- a/crates/router/src/connector/mollie.rs+++ b/crates/router/src/connector/mollie.rs@@ -13,7 +13,11 @@ use crate::{payments,},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -47,7 +51,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.get_auth_header(&req.connector_auth_type)}}@@ -64,13 +68,13 @@ impl ConnectorCommon for Mollie {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: mollie::MollieAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;Ok(vec![(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", auth.api_key),+ format!("Bearer {}", auth.api_key).into_masked(),)])}@@ -125,7 +129,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -208,7 +212,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -303,7 +307,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -380,7 +384,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/multisafepay.rs b/crates/router/src/connector/multisafepay.rsindex 6242a49cfe..d571ea8a33 100644--- a/crates/router/src/connector/multisafepay.rs+++ b/crates/router/src/connector/multisafepay.rs@@ -9,7 +9,11 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -29,7 +33,7 @@ where&self,_req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![])}}@@ -50,11 +54,14 @@ impl ConnectorCommon for Multisafepay {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: multisafepay::MultisafepayAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -116,7 +123,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -200,7 +207,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -290,7 +297,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -373,7 +380,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/nexinets.rs b/crates/router/src/connector/nexinets.rsindex 7a7aa719f6..b70e9aa361 100644--- a/crates/router/src/connector/nexinets.rs+++ b/crates/router/src/connector/nexinets.rs@@ -10,7 +10,11 @@ use crate::{connector::utils::{to_connector_meta, PaymentsSyncRequestData},core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -53,10 +57,10 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -80,10 +84,13 @@ impl ConnectorCommon for Nexinets {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = nexinets::NexinetsAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -146,7 +153,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -229,7 +236,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -304,7 +311,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -389,7 +396,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -471,7 +478,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -551,7 +558,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rsindex be7be39500..8ff41c583a 100644--- a/crates/router/src/connector/nmi.rs+++ b/crates/router/src/connector/nmi.rs@@ -10,7 +10,7 @@ use self::transformers::NmiCaptureRequest;use crate::{configs::settings,core::errors::{self, CustomResult},- services::{self, ConnectorIntegration},+ services::{self, request, ConnectorIntegration},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -43,10 +43,10 @@ where&self,_req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![("Content-Type".to_string(),- "application/x-www-form-urlencoded".to_string(),+ "application/x-www-form-urlencoded".to_string().into(),)])}}@@ -103,7 +103,7 @@ impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::Payments&self,req: &types::VerifyRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -172,7 +172,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -243,7 +243,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -307,7 +307,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -376,7 +376,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -441,7 +441,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -508,7 +508,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundsRouterData<api::RSync>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rsindex 06dde9243b..80927b3f5f 100644--- a/crates/router/src/connector/noon.rs+++ b/crates/router/src/connector/noon.rs@@ -15,7 +15,11 @@ use crate::{payments,},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -58,10 +62,12 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -85,7 +91,7 @@ impl ConnectorCommon for Noon {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = noon::NoonAuthType::try_from(auth_type)?;let encoded_api_key = consts::BASE64_ENGINE.encode(format!(@@ -94,7 +100,7 @@ impl ConnectorCommon for Noon {));Ok(vec![(headers::AUTHORIZATION.to_string(),- format!("Key_Test {encoded_api_key}"),+ format!("Key_Test {encoded_api_key}").into_masked(),)])}@@ -139,7 +145,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -217,7 +223,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -283,7 +289,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -359,7 +365,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -431,7 +437,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -504,7 +510,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rsindex 43b6f6dc41..29b67899e4 100644--- a/crates/router/src/connector/nuvei.rs+++ b/crates/router/src/connector/nuvei.rs@@ -19,7 +19,7 @@ use crate::{},db::StorageInterface,headers,- services::{self, ConnectorIntegration},+ services::{self, request, ConnectorIntegration},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt, InitPayment},@@ -40,10 +40,10 @@ where&self,_req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];Ok(headers)}@@ -65,7 +65,7 @@ impl ConnectorCommon for Nuvei {fn get_auth_header(&self,_auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![])}}@@ -112,7 +112,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}fn get_content_type(&self) -> &'static str {@@ -193,7 +193,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -276,7 +276,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -354,7 +354,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -441,7 +441,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -595,7 +595,7 @@ impl&self,req: &types::PaymentsAuthorizeSessionTokenRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -676,7 +676,7 @@ impl ConnectorIntegration<InitPayment, types::PaymentsAuthorizeData, types::Paym&self,req: &types::PaymentsInitRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -753,7 +753,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/opennode.rs b/crates/router/src/connector/opennode.rsindex 09bcf15b87..8cedb32fd3 100644--- a/crates/router/src/connector/opennode.rs+++ b/crates/router/src/connector/opennode.rs@@ -12,7 +12,11 @@ use crate::{connector::utils as conn_utils,core::errors::{self, CustomResult},db, headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -46,15 +50,15 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- self.common_get_content_type().to_string(),+ self.common_get_content_type().to_string().into(),),(headers::ACCEPT.to_string(),- self.common_get_content_type().to_string(),+ self.common_get_content_type().to_string().into(),),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;@@ -79,10 +83,13 @@ impl ConnectorCommon for Opennode {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = opennode::OpennodeAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -136,7 +143,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -214,7 +221,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -285,7 +292,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -361,7 +368,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -434,7 +441,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/payeezy.rs b/crates/router/src/connector/payeezy.rsindex d515bd6a8a..60456dc64f 100644--- a/crates/router/src/connector/payeezy.rs+++ b/crates/router/src/connector/payeezy.rs@@ -13,7 +13,11 @@ use crate::{consts,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -33,7 +37,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = payeezy::PayeezyAuthType::try_from(&req.connector_auth_type)?;let option_request_payload = self.get_request_body(req)?;let request_payload = option_request_payload.map_or("{}".to_string(), |s| s);@@ -55,13 +59,19 @@ whereOk(vec![(headers::CONTENT_TYPE.to_string(),- Self.get_content_type().to_string(),+ Self.get_content_type().to_string().into(),+ ),+ (headers::APIKEY.to_string(), auth.api_key.into_masked()),+ (+ headers::TOKEN.to_string(),+ auth.merchant_token.into_masked(),+ ),+ (+ headers::AUTHORIZATION.to_string(),+ signature_value.into_masked(),),- (headers::APIKEY.to_string(), auth.api_key),- (headers::TOKEN.to_string(), auth.merchant_token),- (headers::AUTHORIZATION.to_string(), signature_value),- (headers::NONCE.to_string(), nonce),- (headers::TIMESTAMP.to_string(), timestamp),+ (headers::NONCE.to_string(), nonce.into_masked()),+ (headers::TIMESTAMP.to_string(), timestamp.into()),])}}@@ -133,7 +143,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -239,7 +249,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -332,7 +342,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -416,7 +426,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rsindex 95ffb69bb8..f671f71342 100644--- a/crates/router/src/connector/paypal.rs+++ b/crates/router/src/connector/paypal.rs@@ -15,7 +15,11 @@ use crate::{payments,},headers,- services::{self, ConnectorIntegration, PaymentAction},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration, PaymentAction,+ },types::{self,api::{self, CompleteAuthorize, ConnectorCommon, ConnectorCommonExt},@@ -109,7 +113,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let access_token = req.access_token.clone()@@ -119,14 +123,20 @@ whereOk(vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),),(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", access_token.token),+ format!("Bearer {}", access_token.token).into_masked(),+ ),+ (+ "Prefer".to_string(),+ "return=representation".to_string().into(),+ ),+ (+ "PayPal-Request-Id".to_string(),+ key.to_string().into_masked(),),- ("Prefer".to_string(), "return=representation".to_string()),- ("PayPal-Request-Id".to_string(), key.to_string()),])}}@@ -147,11 +157,14 @@ impl ConnectorCommon for Paypal {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: paypal::PaypalAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -210,7 +223,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,req: &types::RefreshTokenRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: paypal::PaypalAuthType = (&req.connector_auth_type).try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;@@ -221,9 +234,11 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tOk(vec![(headers::CONTENT_TYPE.to_string(),- types::RefreshTokenType::get_content_type(self).to_string(),+ types::RefreshTokenType::get_content_type(self)+ .to_string()+ .into(),),- (headers::AUTHORIZATION.to_string(), auth_val),+ (headers::AUTHORIZATION.to_string(), auth_val.into_masked()),])}fn get_request_body(@@ -301,7 +316,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -397,7 +412,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -470,7 +485,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -570,7 +585,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -656,7 +671,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -724,7 +739,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -802,7 +817,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/payu.rs b/crates/router/src/connector/payu.rsindex 9de751e1b1..9b53debfa4 100644--- a/crates/router/src/connector/payu.rs+++ b/crates/router/src/connector/payu.rs@@ -9,7 +9,11 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -29,10 +33,10 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];let access_token = req.access_token@@ -41,7 +45,7 @@ wherelet auth_header = (headers::AUTHORIZATION.to_string(),- format!("Bearer {}", access_token.token),+ format!("Bearer {}", access_token.token).into_masked(),);headers.push(auth_header);@@ -65,11 +69,14 @@ impl ConnectorCommon for Payu {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: payu::PayuAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -119,7 +126,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -202,10 +209,12 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,_req: &types::RefreshTokenRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::RefreshTokenType::get_content_type(self).to_string(),+ types::RefreshTokenType::get_content_type(self)+ .to_string()+ .into(),)])}@@ -281,7 +290,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -356,7 +365,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -451,7 +460,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -541,7 +550,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -622,7 +631,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/rapyd.rs b/crates/router/src/connector/rapyd.rsindex 65c131b71f..2a437bace9 100644--- a/crates/router/src/connector/rapyd.rs+++ b/crates/router/src/connector/rapyd.rs@@ -14,7 +14,11 @@ use crate::{consts,core::errors::{self, CustomResult},db::StorageInterface,- headers, services,+ headers,+ services::{+ self,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon},@@ -66,7 +70,7 @@ impl ConnectorCommon for Rapyd {fn get_auth_header(&self,_auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![])}@@ -123,10 +127,12 @@ impl&self,_req: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)])}@@ -161,10 +167,10 @@ impllet signature =self.generate_signature(&auth, "post", "/v1/payments", &rapyd_req, ×tamp, &salt)?;let headers = vec![- ("access_key".to_string(), auth.access_key),- ("salt".to_string(), salt),- ("timestamp".to_string(), timestamp.to_string()),- ("signature".to_string(), signature),+ ("access_key".to_string(), auth.access_key.into_masked()),+ ("salt".to_string(), salt.into_masked()),+ ("timestamp".to_string(), timestamp.to_string().into()),+ ("signature".to_string(), signature.into_masked()),];let request = services::RequestBuilder::new().method(services::Method::Post)@@ -241,10 +247,12 @@ impl&self,_req: &types::PaymentsCancelRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsVoidType::get_content_type(self).to_string(),+ types::PaymentsVoidType::get_content_type(self)+ .to_string()+ .into(),)])}@@ -278,10 +286,10 @@ implself.generate_signature(&auth, "delete", &url_path, "", ×tamp, &salt)?;let headers = vec![- ("access_key".to_string(), auth.access_key),- ("salt".to_string(), salt),- ("timestamp".to_string(), timestamp.to_string()),- ("signature".to_string(), signature),+ ("access_key".to_string(), auth.access_key.into_masked()),+ ("salt".to_string(), salt.into_masked()),+ ("timestamp".to_string(), timestamp.to_string().into()),+ ("signature".to_string(), signature.into_masked()),];let request = services::RequestBuilder::new().method(services::Method::Delete)@@ -328,10 +336,12 @@ impl&self,_req: &types::PaymentsSyncRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsSyncType::get_content_type(self).to_string(),+ types::PaymentsSyncType::get_content_type(self)+ .to_string()+ .into(),)])}@@ -372,10 +382,10 @@ impllet signature = self.generate_signature(&auth, "get", &url_path, "", ×tamp, &salt)?;let headers = vec![- ("access_key".to_string(), auth.access_key),- ("salt".to_string(), salt),- ("timestamp".to_string(), timestamp.to_string()),- ("signature".to_string(), signature),+ ("access_key".to_string(), auth.access_key.into_masked()),+ ("salt".to_string(), salt.into_masked()),+ ("timestamp".to_string(), timestamp.to_string().into()),+ ("signature".to_string(), signature.into_masked()),];let request = services::RequestBuilder::new().method(services::Method::Get)@@ -425,10 +435,12 @@ impl&self,_req: &types::PaymentsCaptureRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsCaptureType::get_content_type(self).to_string(),+ types::PaymentsCaptureType::get_content_type(self)+ .to_string()+ .into(),)])}@@ -464,10 +476,10 @@ impllet signature =self.generate_signature(&auth, "post", &url_path, &rapyd_req, ×tamp, &salt)?;let headers = vec![- ("access_key".to_string(), auth.access_key),- ("salt".to_string(), salt),- ("timestamp".to_string(), timestamp.to_string()),- ("signature".to_string(), signature),+ ("access_key".to_string(), auth.access_key.into_masked()),+ ("salt".to_string(), salt.into_masked()),+ ("timestamp".to_string(), timestamp.to_string().into()),+ ("signature".to_string(), signature.into_masked()),];let request = services::RequestBuilder::new().method(services::Method::Post)@@ -543,10 +555,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref&self,_req: &types::RefundsRouterData<api::Execute>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![(headers::CONTENT_TYPE.to_string(),- types::RefundExecuteType::get_content_type(self).to_string(),+ types::RefundExecuteType::get_content_type(self)+ .to_string()+ .into(),)])}@@ -586,10 +600,10 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Reflet signature =self.generate_signature(&auth, "post", "/v1/refunds", &rapyd_req, ×tamp, &salt)?;let headers = vec![- ("access_key".to_string(), auth.access_key),- ("salt".to_string(), salt),- ("timestamp".to_string(), timestamp.to_string()),- ("signature".to_string(), signature),+ ("access_key".to_string(), auth.access_key.into_masked()),+ ("salt".to_string(), salt.into_masked()),+ ("timestamp".to_string(), timestamp.to_string().into()),+ ("signature".to_string(), signature.into_masked()),];let request = services::RequestBuilder::new().method(services::Method::Post)@@ -634,7 +648,7 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun&self,_req: &types::RefundSyncRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![])}diff --git a/crates/router/src/connector/shift4.rs b/crates/router/src/connector/shift4.rsindex c189535d37..08201cb019 100644--- a/crates/router/src/connector/shift4.rs+++ b/crates/router/src/connector/shift4.rs@@ -15,7 +15,11 @@ use crate::{payments,},headers, routes,- services::{self, request, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -35,15 +39,15 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),),(headers::ACCEPT.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;@@ -67,11 +71,14 @@ impl ConnectorCommon for Shift4 {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: shift4::Shift4AuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -139,7 +146,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -260,7 +267,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -332,7 +339,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -413,15 +420,15 @@ impl&self,req: &types::PaymentsInitRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- "application/x-www-form-urlencoded".to_string(),+ "application/x-www-form-urlencoded".to_string().into(),),(headers::ACCEPT.to_string(),- self.common_get_content_type().to_string(),+ self.common_get_content_type().to_string().into(),),];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;@@ -505,7 +512,7 @@ impl&self,req: &types::PaymentsCompleteAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -583,7 +590,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -656,7 +663,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rsindex ff0005088d..cedc51cbfa 100644--- a/crates/router/src/connector/stripe.rs+++ b/crates/router/src/connector/stripe.rs@@ -17,7 +17,11 @@ use crate::{payments,},db::StorageInterface,- headers, services,+ headers,+ services::{+ self,+ request::{self, Mask},+ },types::{self,api::{self, ConnectorCommon},@@ -45,13 +49,13 @@ impl ConnectorCommon for Stripe {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: stripe::StripeAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;Ok(vec![(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", auth.api_key),+ format!("Bearer {}", auth.api_key).into_masked(),)])}}@@ -98,10 +102,12 @@ impl&self,req: &types::PaymentsPreProcessingRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsPreProcessingType::get_content_type(self).to_string(),+ types::PaymentsPreProcessingType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -208,10 +214,12 @@ impl&self,req: &types::ConnectorCustomerRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::ConnectorCustomerType::get_content_type(self).to_string(),+ types::ConnectorCustomerType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -319,10 +327,12 @@ impl&self,req: &types::TokenizationRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::TokenizationType::get_content_type(self).to_string(),+ types::TokenizationType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -426,10 +436,10 @@ impl&self,req: &types::PaymentsCaptureRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- Self::common_get_content_type(self).to_string(),+ Self::common_get_content_type(self).to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -536,10 +546,12 @@ impl&self,req: &types::PaymentsSyncRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsSyncType::get_content_type(self).to_string(),+ types::PaymentsSyncType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -665,10 +677,12 @@ impl&self,req: &types::PaymentsAuthorizeRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsAuthorizeType::get_content_type(self).to_string(),+ types::PaymentsAuthorizeType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -801,10 +815,12 @@ impl&self,req: &types::PaymentsCancelRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::PaymentsVoidType::get_content_type(self).to_string(),+ types::PaymentsVoidType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -908,10 +924,10 @@ impl&self,req: &types::RouterData<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- Verify::get_content_type(self).to_string(),+ Verify::get_content_type(self).to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -1027,10 +1043,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref&self,req: &types::RefundsRouterData<api::Execute>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::RefundExecuteType::get_content_type(self).to_string(),+ types::RefundExecuteType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -1123,10 +1141,12 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun&self,req: &types::RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::RefundSyncType::get_content_type(self).to_string(),+ types::RefundSyncType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -1251,7 +1271,7 @@ impltypes::UploadFileResponse,>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.get_auth_header(&req.connector_auth_type)}@@ -1356,7 +1376,7 @@ impltypes::RetrieveFileResponse,>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.get_auth_header(&req.connector_auth_type)}@@ -1444,10 +1464,12 @@ impl&self,req: &types::SubmitEvidenceRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- types::SubmitEvidenceType::get_content_type(self).to_string(),+ types::SubmitEvidenceType::get_content_type(self)+ .to_string()+ .into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rsindex ce61f5620b..a215145330 100644--- a/crates/router/src/connector/trustpay.rs+++ b/crates/router/src/connector/trustpay.rs@@ -17,7 +17,11 @@ use crate::{payments,},headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -37,7 +41,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {match req.payment_method {storage_models::enums::PaymentMethod::BankRedirect => {let token = req@@ -47,18 +51,18 @@ whereOk(vec![(headers::CONTENT_TYPE.to_string(),- "application/json".to_owned(),+ "application/json".to_owned().into(),),(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", token.token),+ format!("Bearer {}", token.token).into_masked(),),])}_ => {let mut header = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;header.append(&mut api_key);@@ -84,10 +88,13 @@ impl ConnectorCommon for Trustpay {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = trustpay::TrustpayAuthType::try_from(auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::X_API_KEY.to_string(), auth.api_key)])+ Ok(vec![(+ headers::X_API_KEY.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -162,7 +169,7 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, t&self,req: &types::RefreshTokenRouterData,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = trustpay::TrustpayAuthType::try_from(&req.connector_auth_type).change_context(errors::ConnectorError::FailedToObtainAuthType)?;let auth_value = format!(@@ -172,9 +179,11 @@ impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, tOk(vec![(headers::CONTENT_TYPE.to_string(),- types::RefreshTokenType::get_content_type(self).to_string(),+ types::RefreshTokenType::get_content_type(self)+ .to_string()+ .into(),),- (headers::AUTHORIZATION.to_string(), auth_value),+ (headers::AUTHORIZATION.to_string(), auth_value.into_masked()),])}@@ -247,7 +256,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -341,7 +350,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -441,7 +450,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -531,7 +540,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/worldline.rs b/crates/router/src/connector/worldline.rsindex b5568bf22e..106246471e 100644--- a/crates/router/src/connector/worldline.rs+++ b/crates/router/src/connector/worldline.rs@@ -18,7 +18,11 @@ use crate::{core::errors::{self, CustomResult},db::StorageInterface,headers, logger,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -78,7 +82,7 @@ where&self,req: &types::RouterData<Flow, Request, Response>,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let base_url = self.base_url(connectors);let url = Self::get_url(self, req, connectors)?;let endpoint = url.replace(base_url, "");@@ -90,9 +94,15 @@ whereself.generate_authorization_token(auth, &http_method, content_type, &date, &endpoint)?;Ok(vec![- (headers::DATE.to_string(), date),- (headers::AUTHORIZATION.to_string(), signed_data),- (headers::CONTENT_TYPE.to_string(), content_type.to_string()),+ (headers::DATE.to_string(), date.into()),+ (+ headers::AUTHORIZATION.to_string(),+ signed_data.into_masked(),+ ),+ (+ headers::CONTENT_TYPE.to_string(),+ content_type.to_string().into(),+ ),])}}@@ -164,7 +174,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::RouterData<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -239,7 +249,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::RouterData<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -315,7 +325,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Paymetypes::PaymentsResponseData,>,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -434,7 +444,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::Ptypes::PaymentsResponseData,>,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -522,7 +532,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -612,7 +622,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/worldpay.rs b/crates/router/src/connector/worldpay.rsindex 4469142c5c..9945f1c52b 100644--- a/crates/router/src/connector/worldpay.rs+++ b/crates/router/src/connector/worldpay.rs@@ -16,7 +16,11 @@ use crate::{core::errors::{self, CustomResult},db::StorageInterface,headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -36,10 +40,10 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),)];let mut api_key = self.get_auth_header(&req.connector_auth_type)?;headers.append(&mut api_key);@@ -63,11 +67,14 @@ impl ConnectorCommon for Worldpay {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth: worldpay::WorldpayAuthType = auth_type.try_into().change_context(errors::ConnectorError::FailedToObtainAuthType)?;- Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])+ Ok(vec![(+ headers::AUTHORIZATION.to_string(),+ auth.api_key.into_masked(),+ )])}fn build_error_response(@@ -116,7 +123,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR&self,req: &types::PaymentsCancelRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -207,7 +214,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -287,7 +294,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme&self,req: &types::PaymentsCaptureRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -376,7 +383,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -462,7 +469,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -547,7 +554,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/connector/zen.rs b/crates/router/src/connector/zen.rsindex 9e80f55654..1c4a02484c 100644--- a/crates/router/src/connector/zen.rs+++ b/crates/router/src/connector/zen.rs@@ -18,7 +18,11 @@ use crate::{},db::StorageInterface,headers,- services::{self, ConnectorIntegration},+ services::{+ self,+ request::{self, Mask},+ ConnectorIntegration,+ },types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -51,13 +55,13 @@ where&self,req: &types::RouterData<Flow, Request, Response>,_connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let mut headers = vec![(headers::CONTENT_TYPE.to_string(),- self.get_content_type().to_string(),+ self.get_content_type().to_string().into(),),- ("request-id".to_string(), Uuid::new_v4().to_string()),+ ("request-id".to_string(), Uuid::new_v4().to_string().into()),];let mut auth_header = self.get_auth_header(&req.connector_auth_type)?;@@ -83,11 +87,11 @@ impl ConnectorCommon for Zen {fn get_auth_header(&self,auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {let auth = zen::ZenAuthType::try_from(auth_type)?;Ok(vec![(headers::AUTHORIZATION.to_string(),- format!("Bearer {}", auth.api_key),+ format!("Bearer {}", auth.api_key).into_masked(),)])}@@ -142,7 +146,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P&self,req: &types::PaymentsAuthorizeRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -219,7 +223,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe&self,req: &types::PaymentsSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -298,7 +302,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon&self,req: &types::RefundsRouterData<api::Execute>,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}@@ -373,7 +377,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse&self,req: &types::RefundSyncRouterData,connectors: &settings::Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {self.build_headers(req, connectors)}diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rsindex 4f672b1ec4..e65ee980c0 100644--- a/crates/router/src/core/payment_methods/transformers.rs+++ b/crates/router/src/core/payment_methods/transformers.rs@@ -280,7 +280,7 @@ pub async fn mk_add_card_request_hs(let mut url = locker.host.to_owned();url.push_str("/cards/add");let mut request = services::Request::new(services::Method::Post, &url);- request.add_header(headers::CONTENT_TYPE, "application/json");+ request.add_header(headers::CONTENT_TYPE, "application/json".into());request.set_body(body.to_string());Ok(request)}@@ -382,7 +382,10 @@ pub fn mk_add_card_request(let mut url = locker.host.to_owned();url.push_str("/card/addCard");let mut request = services::Request::new(services::Method::Post, &url);- request.add_header(headers::CONTENT_TYPE, "application/x-www-form-urlencoded");+ request.add_header(+ headers::CONTENT_TYPE,+ "application/x-www-form-urlencoded".into(),+ );request.set_body(body);Ok(request)}@@ -425,7 +428,7 @@ pub async fn mk_get_card_request_hs(let mut url = locker.host.to_owned();url.push_str("/cards/retrieve");let mut request = services::Request::new(services::Method::Post, &url);- request.add_header(headers::CONTENT_TYPE, "application/json");+ request.add_header(headers::CONTENT_TYPE, "application/json".into());request.set_body(body.to_string());Ok(request)}@@ -445,7 +448,10 @@ pub fn mk_get_card_request<'a>(let mut url = locker.host.to_owned();url.push_str("/card/getCard");let mut request = services::Request::new(services::Method::Post, &url);- request.add_header(headers::CONTENT_TYPE, "application/x-www-form-urlencoded");+ request.add_header(+ headers::CONTENT_TYPE,+ "application/x-www-form-urlencoded".into(),+ );request.set_body(body);Ok(request)}@@ -506,7 +512,7 @@ pub async fn mk_delete_card_request_hs(let mut url = locker.host.to_owned();url.push_str("/cards/delete");let mut request = services::Request::new(services::Method::Post, &url);- request.add_header(headers::CONTENT_TYPE, "application/json");+ request.add_header(headers::CONTENT_TYPE, "application/json".into());request.set_body(body.to_string());Ok(request)}@@ -526,7 +532,10 @@ pub fn mk_delete_card_request<'a>(url.push_str("/card/deleteCard");let mut request = services::Request::new(services::Method::Post, &url);request.add_default_headers();- request.add_header(headers::CONTENT_TYPE, "application/x-www-form-urlencoded");+ request.add_header(+ headers::CONTENT_TYPE,+ "application/x-www-form-urlencoded".into(),+ );request.set_body(body);Ok(request)@@ -574,7 +583,7 @@ pub fn mk_crud_locker_request(url.push_str(path);let mut request = services::Request::new(services::Method::Post, &url);request.add_default_headers();- request.add_header(headers::CONTENT_TYPE, "application/json");+ request.add_header(headers::CONTENT_TYPE, "application/json".into());request.set_body(body.to_string());Ok(request)}diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rsindex 5a4e65f350..1e0c15f360 100644--- a/crates/router/src/core/payments/flows/session_flow.rs+++ b/crates/router/src/core/payments/flows/session_flow.rs@@ -123,7 +123,7 @@ fn mk_applepay_session_request(.attach_default_headers().headers(vec![(headers::CONTENT_TYPE.to_string(),- "application/json".to_string(),+ "application/json".to_string().into(),)]).body(Some(applepay_session_request)).add_certificate(Some(diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rsindex cf328ba213..e0c7854cc1 100644--- a/crates/router/src/core/webhooks.rs+++ b/crates/router/src/core/webhooks.rs@@ -575,7 +575,7 @@ pub async fn trigger_webhook_to_merchant<W: api::OutgoingWebhookType>()];if let Some(signature) = outgoing_webhooks_signature {- header.push((headers::X_WEBHOOK_SIGNATURE.to_string(), signature))+ header.push((headers::X_WEBHOOK_SIGNATURE.to_string(), signature.into()))}let request = services::RequestBuilder::new()diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex 2e60a07d82..967a60691d 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -53,7 +53,7 @@ pub trait ConnectorIntegration<T, Req, Resp>: ConnectorIntegrationAny<T, Req, Re&self,_req: &types::RouterData<T, Req, Resp>,_connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(vec![])}diff --git a/crates/router/src/services/api/request.rs b/crates/router/src/services/api/request.rsindex 468d89e500..59dd3f0e4c 100644--- a/crates/router/src/services/api/request.rs+++ b/crates/router/src/services/api/request.rs@@ -1,16 +1,79 @@use std::{collections, str::FromStr};use error_stack::{IntoReport, ResultExt};-use masking::Secret;+use masking::{ExposeInterface, Secret};use router_env::{instrument, tracing};use serde::{Deserialize, Serialize};-use crate::{- core::errors::{self, CustomResult},- logger,-};+use crate::core::errors::{self, CustomResult};-pub(crate) type Headers = collections::HashSet<(String, String)>;+pub(crate) type Headers = collections::HashSet<(String, Maskable<String>)>;++///+/// An Enum that allows us to optionally mask data, based on which enum variant that data is stored+/// in.+///+#[derive(Clone, Eq, PartialEq)]+pub enum Maskable<T: Eq + PartialEq + Clone> {+ Masked(Secret<T>),+ Normal(T),+}++impl<T: std::fmt::Debug + Clone + Eq + PartialEq> std::fmt::Debug for Maskable<T> {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ match self {+ Self::Masked(secret_value) => std::fmt::Debug::fmt(secret_value, f),+ Self::Normal(value) => std::fmt::Debug::fmt(value, f),+ }+ }+}++impl<T: Eq + PartialEq + Clone + std::hash::Hash> std::hash::Hash for Maskable<T> {+ fn hash<H: std::hash::Hasher>(&self, state: &mut H) {+ match self {+ Self::Masked(value) => masking::PeekInterface::peek(value).hash(state),+ Self::Normal(value) => value.hash(state),+ }+ }+}++impl<T: Eq + PartialEq + Clone> Maskable<T> {+ pub fn into_inner(self) -> T {+ match self {+ Self::Masked(inner_secret) => inner_secret.expose(),+ Self::Normal(inner) => inner,+ }+ }++ pub fn new_masked(item: Secret<T>) -> Self {+ Self::Masked(item)+ }+ pub fn new_normal(item: T) -> Self {+ Self::Normal(item)+ }+}++pub trait Mask: Eq + Clone + PartialEq {+ fn into_masked(self) -> Maskable<Self>;+}++impl<T: std::fmt::Debug + Clone + Eq + PartialEq> Mask for T {+ fn into_masked(self) -> Maskable<Self> {+ Maskable::new_masked(self.into())+ }+}++impl<T: Eq + PartialEq + Clone> From<T> for Maskable<T> {+ fn from(value: T) -> Self {+ Self::new_normal(value)+ }+}++impl From<&str> for Maskable<String> {+ fn from(value: &str) -> Self {+ Self::new_normal(value.to_string())+ }+}#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize, strum::Display, strum::EnumString,@@ -31,10 +94,10 @@ pub enum ContentType {FormData,}-fn default_request_headers() -> [(String, String); 1] {+fn default_request_headers() -> [(String, Maskable<String>); 1] {use http::header;- [(header::VIA.to_string(), "HyperSwitch".into())]+ [(header::VIA.to_string(), "HyperSwitch".to_string().into())]}#[derive(Debug)]@@ -71,9 +134,8 @@ impl Request {self.headers.extend(default_request_headers());}- pub fn add_header(&mut self, header: &str, value: &str) {- self.headers- .insert((String::from(header), String::from(value)));+ pub fn add_header(&mut self, header: &str, value: Maskable<String>) {+ self.headers.insert((String::from(header), value));}pub fn add_content_type(&mut self, content_type: ContentType) {@@ -138,7 +200,7 @@ impl RequestBuilder {self}- pub fn headers(mut self, headers: Vec<(String, String)>) -> Self {+ pub fn headers(mut self, headers: Vec<(String, Maskable<String>)>) -> Self {let mut h = headers.into_iter().map(|(h, v)| (h, v));self.headers.extend(&mut h);self@@ -201,13 +263,14 @@ impl HeaderExt for Headers {) -> CustomResult<reqwest::header::HeaderMap, errors::ApiClientError> {use reqwest::header::{HeaderMap, HeaderName, HeaderValue};- self.iter().fold(+ self.into_iter().fold(Ok(HeaderMap::new()),|mut header_map, (header_name, header_value)| {- let header_name = HeaderName::from_str(header_name)+ let header_name = HeaderName::from_str(&header_name).into_report().change_context(errors::ApiClientError::HeaderMapConstructionFailed)?;- let header_value = HeaderValue::from_str(header_value)+ let header_value = header_value.into_inner();+ let header_value = HeaderValue::from_str(&header_value).into_report().change_context(errors::ApiClientError::HeaderMapConstructionFailed)?;if let Ok(map) = header_map.as_mut() {@@ -227,7 +290,6 @@ impl RequestBuilderExt for reqwest::RequestBuilder {#[instrument(skip_all)]fn add_headers(mut self, headers: reqwest::header::HeaderMap) -> Self {self = self.headers(headers);- logger::debug!(request_builder=?self);self}}diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rsindex 0b14654743..670ef0e42c 100644--- a/crates/router/src/types/api.rs+++ b/crates/router/src/types/api.rs@@ -25,7 +25,7 @@ use crate::{configs::settings::Connectors,connector, consts,core::errors::{self, CustomResult},- services::{ConnectorIntegration, ConnectorRedirectResponse},+ services::{request, ConnectorIntegration, ConnectorRedirectResponse},types::{self, api::enums as api_enums},};@@ -54,7 +54,7 @@ pub trait ConnectorCommon {fn get_auth_header(&self,_auth_type: &types::ConnectorAuthType,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(Vec::new())}@@ -93,7 +93,7 @@ pub trait ConnectorCommonExt<Flow, Req, Resp>:&self,_req: &types::RouterData<Flow, Req, Resp>,_connectors: &Connectors,- ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {Ok(Vec::new())}}