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): [Braintree] Mask PII data (#3759)

AkshayaFoiger3e87d4468193
diff --git a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
index 436cd8dfa3..190cd27657 100644
--- a/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
+++ b/crates/router/src/connector/braintree/braintree_graphql_transformers.rs
@@ -54,7 +54,7 @@ impl<T>
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaymentInput {
- payment_method_id: String,
+ payment_method_id: Secret<String>,
transaction: TransactionBody,
}
@@ -899,7 +899,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest {
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct TokenizePaymentMethodData {
- id: String,
+ id: Secret<String>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
@@ -969,6 +969,7 @@ impl<F, T>
.tokenize_credit_card
.payment_method
.id
+ .expose()
.clone(),
})
}
@@ -1277,7 +1278,7 @@ impl<F, T>
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BraintreeThreeDsResponse {
- pub nonce: String,
+ pub nonce: Secret<String>,
pub liability_shifted: bool,
pub liability_shift_possible: bool,
}
@@ -1332,7 +1333,7 @@ impl
variables: VariablePaymentInput {
input: PaymentInput {
payment_method_id: match item.router_data.get_payment_method_token()? {
- types::PaymentMethodToken::Token(token) => token,
+ types::PaymentMethodToken::Token(token) => token.into(),
types::PaymentMethodToken::ApplePayDecrypt(_) => {
Err(errors::ConnectorError::InvalidWalletToken)?
}
diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs
index 8846753117..9201bc9e4c 100644
--- a/crates/router/src/connector/braintree/transformers.rs
+++ b/crates/router/src/connector/braintree/transformers.rs
@@ -1,6 +1,6 @@
use api_models::payments;
use base64::Engine;
-use masking::{PeekInterface, Secret};
+use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
@@ -77,7 +77,7 @@ pub enum PaymentMethodType {
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
pub struct Nonce {
- payment_method_nonce: String,
+ payment_method_nonce: Secret<String>,
}
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
@@ -130,7 +130,8 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
Ok(wallet_data.token.to_owned())
}
_ => Err(errors::ConnectorError::InvalidWallet),
- }?,
+ }?
+ .into(),
}))
}
_ => Err(errors::ConnectorError::NotImplemented(format!(
@@ -263,7 +264,7 @@ impl<F, T>
response: Ok(types::PaymentsResponseData::SessionResponse {
session_token: types::api::SessionToken::Paypal(Box::new(
payments::PaypalSessionTokenResponse {
- session_token: item.response.client_token.value,
+ session_token: item.response.client_token.value.expose(),
},
)),
}),
@@ -281,7 +282,7 @@ pub struct BraintreePaymentsResponse {
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ClientToken {
- pub value: String,
+ pub value: Secret<String>,
}
#[derive(Default, Debug, Clone, Deserialize, Serialize)]