refactor(connector): [Braintree] Mask PII data (#3759)

This commit is contained in:
AkshayaFoiger
2024-02-27 16:20:03 +05:30
committed by GitHub
parent bd890b0715
commit 3e87d44681
2 changed files with 11 additions and 9 deletions

View File

@ -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)?
}

View File

@ -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)]