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(connectors): [BOA] PII data masking (#3702)

AkshayaFoiger49c71d093e7e
diff --git a/crates/router/src/connector/bankofamerica.rs b/crates/router/src/connector/bankofamerica.rs
index 706532c5d1..fefc80f806 100644
--- a/crates/router/src/connector/bankofamerica.rs
+++ b/crates/router/src/connector/bankofamerica.rs
@@ -1079,8 +1079,10 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
.response
.parse_struct("bankofamerica RefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
+
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index b2a9f14ccc..235321f1ac 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -2,7 +2,7 @@ use api_models::payments;
use base64::Engine;
use common_utils::{ext_traits::ValueExt, pii};
use error_stack::{IntoReport, ResultExt};
-use masking::{PeekInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -113,9 +113,9 @@ pub struct MerchantDefinedInformation {
pub struct BankOfAmericaConsumerAuthInformation {
ucaf_collection_indicator: Option<String>,
cavv: Option<String>,
- ucaf_authentication_data: Option<String>,
+ ucaf_authentication_data: Option<Secret<String>>,
xid: Option<String>,
- directory_server_transaction_id: Option<String>,
+ directory_server_transaction_id: Option<Secret<String>>,
specification_version: Option<String>,
}
@@ -213,7 +213,7 @@ pub struct BillTo {
first_name: Secret<String>,
last_name: Secret<String>,
address1: Secret<String>,
- locality: String,
+ locality: Secret<String>,
administrative_area: Secret<String>,
postal_code: Secret<String>,
country: api_enums::CountryAlpha2,
@@ -235,7 +235,7 @@ fn build_bill_to(
first_name: address.get_first_name()?.to_owned(),
last_name: address.get_last_name()?.to_owned(),
address1: address.get_line1()?.to_owned(),
- locality: address.get_city()?.to_owned(),
+ locality: Secret::new(address.get_city()?.to_owned()),
administrative_area: Secret::from(state),
postal_code: address.get_zip()?.to_owned(),
country: address.get_country()?.to_owned(),
@@ -435,7 +435,7 @@ pub struct ClientRiskInformation {
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ClientRiskInformationRules {
- name: String,
+ name: Secret<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -889,8 +889,8 @@ impl ForeignFrom<(BankofamericaPaymentStatus, bool)> for enums::AttemptStatus {
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BankOfAmericaConsumerAuthInformationResponse {
- access_token: String,
- device_data_collection_url: String,
+ access_token: Secret<String>,
+ device_data_collection_url: Secret<String>,
reference_id: String,
}
@@ -1066,10 +1066,12 @@ impl<F>
redirection_data: Some(services::RedirectForm::CybersourceAuthSetup {
access_token: info_response
.consumer_authentication_information
- .access_token,
+ .access_token
+ .expose(),
ddc_url: info_response
.consumer_authentication_information
- .device_data_collection_url,
+ .device_data_collection_url
+ .expose(),
reference_id: info_response
.consumer_authentication_information
.reference_id,
@@ -1322,10 +1324,10 @@ pub enum BankOfAmericaAuthEnrollmentStatus {
pub struct BankOfAmericaConsumerAuthValidateResponse {
ucaf_collection_indicator: Option<String>,
cavv: Option<String>,
- ucaf_authentication_data: Option<String>,
+ ucaf_authentication_data: Option<Secret<String>>,
xid: Option<String>,
specification_version: Option<String>,
- directory_server_transaction_id: Option<String>,
+ directory_server_transaction_id: Option<Secret<String>>,
indicator: Option<String>,
}
@@ -1337,7 +1339,7 @@ pub struct BankOfAmericaThreeDSMetadata {
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BankOfAmericaConsumerAuthInformationEnrollmentResponse {
- access_token: Option<String>,
+ access_token: Option<Secret<String>>,
step_up_url: Option<String>,
//Added to segregate the three_ds_data in a separate struct
#[serde(flatten)]
@@ -1420,7 +1422,8 @@ impl<F>
let redirection_data = match (
info_response
.consumer_authentication_information
- .access_token,
+ .access_token
+ .map(|access_token| access_token.expose()),
info_response
.consumer_authentication_information
.step_up_url,
@@ -2023,7 +2026,7 @@ impl
client_risk_information.rules.map(|rules| {
rules
.iter()
- .map(|risk_info| format!(" , {}", risk_info.name))
+ .map(|risk_info| format!(" , {}", risk_info.name.clone().expose()))
.collect::<Vec<String>>()
.join("")
})