Skip to content

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

refactor(connector): [Payme][Payeezy] Mask PII data (#3926)

AkshayaFoigerffcb2bcf2b7a
diff --git a/crates/router/src/connector/payeezy/transformers.rs b/crates/router/src/connector/payeezy/transformers.rs
index 90b4b0b0bb..6d5d6db9dc 100644
--- a/crates/router/src/connector/payeezy/transformers.rs
+++ b/crates/router/src/connector/payeezy/transformers.rs
@@ -1,7 +1,7 @@
use cards::CardNumber;
use common_utils::ext_traits::Encode;
use error_stack::ResultExt;
-use masking::Secret;
+use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
@@ -108,7 +108,7 @@ pub struct StoredCredentials {
pub sequence: Sequence,
pub initiator: Initiator,
pub is_scheduled: bool,
- pub cardbrand_original_transaction_id: Option<String>,
+ pub cardbrand_original_transaction_id: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -203,7 +203,7 @@ fn get_transaction_type_and_stored_creds(
},
is_scheduled: true,
// In case of first mandate payment connector_mandate_id would be None, otherwise holds some value
- cardbrand_original_transaction_id: connector_mandate_id,
+ cardbrand_original_transaction_id: connector_mandate_id.map(Secret::new),
}),
)
} else {
@@ -329,7 +329,7 @@ pub struct PayeezyPaymentsResponse {
#[derive(Debug, Deserialize, Serialize)]
pub struct PaymentsStoredCredentials {
- cardbrand_original_transaction_id: String,
+ cardbrand_original_transaction_id: Secret<String>,
}
#[derive(Debug, Serialize)]
@@ -416,7 +416,7 @@ impl<F, T>
.stored_credentials
.map(|credentials| credentials.cardbrand_original_transaction_id)
.map(|id| types::MandateReference {
- connector_mandate_id: Some(id),
+ connector_mandate_id: Some(id.expose()),
payment_method_id: None,
});
let status = enums::AttemptStatus::foreign_from((
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index ee0d52bae5..fd638f5b60 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -84,7 +84,7 @@ pub struct Pay3dsRequest {
buyer_email: pii::Email,
buyer_key: String,
payme_sale_id: String,
- meta_data_jwt: String,
+ meta_data_jwt: Secret<String>,
}
#[derive(Debug, Serialize)]
@@ -122,7 +122,7 @@ pub struct CaptureBuyerRequest {
#[derive(Debug, Deserialize, Serialize)]
pub struct CaptureBuyerResponse {
- buyer_key: String,
+ buyer_key: Secret<String>,
}
#[derive(Debug, Serialize)]
@@ -719,7 +719,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest {
buyer_key,
buyer_name,
payme_sale_id,
- meta_data_jwt: jwt_data.meta_data,
+ meta_data_jwt: Secret::new(jwt_data.meta_data),
})
}
Some(api::PaymentMethodData::CardRedirect(_))
@@ -902,10 +902,10 @@ impl<F, T>
) -> Result<Self, Self::Error> {
Ok(Self {
payment_method_token: Some(types::PaymentMethodToken::Token(
- item.response.buyer_key.clone(),
+ item.response.buyer_key.clone().expose(),
)),
response: Ok(types::PaymentsResponseData::TokenizationResponse {
- token: item.response.buyer_key,
+ token: item.response.buyer_key.expose(),
}),
..item.data
})