mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
refactor(connector): [Braintree] Mask PII data (#3759)
This commit is contained in:
@ -54,7 +54,7 @@ impl<T>
|
|||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PaymentInput {
|
pub struct PaymentInput {
|
||||||
payment_method_id: String,
|
payment_method_id: Secret<String>,
|
||||||
transaction: TransactionBody,
|
transaction: TransactionBody,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -899,7 +899,7 @@ impl TryFrom<&types::TokenizationRouterData> for BraintreeTokenRequest {
|
|||||||
|
|
||||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct TokenizePaymentMethodData {
|
pub struct TokenizePaymentMethodData {
|
||||||
id: String,
|
id: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||||
@ -969,6 +969,7 @@ impl<F, T>
|
|||||||
.tokenize_credit_card
|
.tokenize_credit_card
|
||||||
.payment_method
|
.payment_method
|
||||||
.id
|
.id
|
||||||
|
.expose()
|
||||||
.clone(),
|
.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1277,7 +1278,7 @@ impl<F, T>
|
|||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BraintreeThreeDsResponse {
|
pub struct BraintreeThreeDsResponse {
|
||||||
pub nonce: String,
|
pub nonce: Secret<String>,
|
||||||
pub liability_shifted: bool,
|
pub liability_shifted: bool,
|
||||||
pub liability_shift_possible: bool,
|
pub liability_shift_possible: bool,
|
||||||
}
|
}
|
||||||
@ -1332,7 +1333,7 @@ impl
|
|||||||
variables: VariablePaymentInput {
|
variables: VariablePaymentInput {
|
||||||
input: PaymentInput {
|
input: PaymentInput {
|
||||||
payment_method_id: match item.router_data.get_payment_method_token()? {
|
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(_) => {
|
types::PaymentMethodToken::ApplePayDecrypt(_) => {
|
||||||
Err(errors::ConnectorError::InvalidWalletToken)?
|
Err(errors::ConnectorError::InvalidWalletToken)?
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use api_models::payments;
|
use api_models::payments;
|
||||||
use base64::Engine;
|
use base64::Engine;
|
||||||
use masking::{PeekInterface, Secret};
|
use masking::{ExposeInterface, PeekInterface, Secret};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -77,7 +77,7 @@ pub enum PaymentMethodType {
|
|||||||
|
|
||||||
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
|
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
|
||||||
pub struct Nonce {
|
pub struct Nonce {
|
||||||
payment_method_nonce: String,
|
payment_method_nonce: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
|
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
|
||||||
@ -130,7 +130,8 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
|
|||||||
Ok(wallet_data.token.to_owned())
|
Ok(wallet_data.token.to_owned())
|
||||||
}
|
}
|
||||||
_ => Err(errors::ConnectorError::InvalidWallet),
|
_ => Err(errors::ConnectorError::InvalidWallet),
|
||||||
}?,
|
}?
|
||||||
|
.into(),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
_ => Err(errors::ConnectorError::NotImplemented(format!(
|
_ => Err(errors::ConnectorError::NotImplemented(format!(
|
||||||
@ -263,7 +264,7 @@ impl<F, T>
|
|||||||
response: Ok(types::PaymentsResponseData::SessionResponse {
|
response: Ok(types::PaymentsResponseData::SessionResponse {
|
||||||
session_token: types::api::SessionToken::Paypal(Box::new(
|
session_token: types::api::SessionToken::Paypal(Box::new(
|
||||||
payments::PaypalSessionTokenResponse {
|
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)]
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ClientToken {
|
pub struct ClientToken {
|
||||||
pub value: String,
|
pub value: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||||
|
|||||||
Reference in New Issue
Block a user