mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor(connector): [Payme][Payeezy] Mask PII data (#3926)
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
use cards::CardNumber;
|
use cards::CardNumber;
|
||||||
use common_utils::ext_traits::Encode;
|
use common_utils::ext_traits::Encode;
|
||||||
use error_stack::ResultExt;
|
use error_stack::ResultExt;
|
||||||
use masking::Secret;
|
use masking::{ExposeInterface, Secret};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -108,7 +108,7 @@ pub struct StoredCredentials {
|
|||||||
pub sequence: Sequence,
|
pub sequence: Sequence,
|
||||||
pub initiator: Initiator,
|
pub initiator: Initiator,
|
||||||
pub is_scheduled: bool,
|
pub is_scheduled: bool,
|
||||||
pub cardbrand_original_transaction_id: Option<String>,
|
pub cardbrand_original_transaction_id: Option<Secret<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
@ -203,7 +203,7 @@ fn get_transaction_type_and_stored_creds(
|
|||||||
},
|
},
|
||||||
is_scheduled: true,
|
is_scheduled: true,
|
||||||
// In case of first mandate payment connector_mandate_id would be None, otherwise holds some value
|
// 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 {
|
} else {
|
||||||
@ -329,7 +329,7 @@ pub struct PayeezyPaymentsResponse {
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct PaymentsStoredCredentials {
|
pub struct PaymentsStoredCredentials {
|
||||||
cardbrand_original_transaction_id: String,
|
cardbrand_original_transaction_id: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@ -416,7 +416,7 @@ impl<F, T>
|
|||||||
.stored_credentials
|
.stored_credentials
|
||||||
.map(|credentials| credentials.cardbrand_original_transaction_id)
|
.map(|credentials| credentials.cardbrand_original_transaction_id)
|
||||||
.map(|id| types::MandateReference {
|
.map(|id| types::MandateReference {
|
||||||
connector_mandate_id: Some(id),
|
connector_mandate_id: Some(id.expose()),
|
||||||
payment_method_id: None,
|
payment_method_id: None,
|
||||||
});
|
});
|
||||||
let status = enums::AttemptStatus::foreign_from((
|
let status = enums::AttemptStatus::foreign_from((
|
||||||
|
|||||||
@ -84,7 +84,7 @@ pub struct Pay3dsRequest {
|
|||||||
buyer_email: pii::Email,
|
buyer_email: pii::Email,
|
||||||
buyer_key: String,
|
buyer_key: String,
|
||||||
payme_sale_id: String,
|
payme_sale_id: String,
|
||||||
meta_data_jwt: String,
|
meta_data_jwt: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@ -122,7 +122,7 @@ pub struct CaptureBuyerRequest {
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub struct CaptureBuyerResponse {
|
pub struct CaptureBuyerResponse {
|
||||||
buyer_key: String,
|
buyer_key: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@ -719,7 +719,7 @@ impl TryFrom<&types::PaymentsCompleteAuthorizeRouterData> for Pay3dsRequest {
|
|||||||
buyer_key,
|
buyer_key,
|
||||||
buyer_name,
|
buyer_name,
|
||||||
payme_sale_id,
|
payme_sale_id,
|
||||||
meta_data_jwt: jwt_data.meta_data,
|
meta_data_jwt: Secret::new(jwt_data.meta_data),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Some(api::PaymentMethodData::CardRedirect(_))
|
Some(api::PaymentMethodData::CardRedirect(_))
|
||||||
@ -902,10 +902,10 @@ impl<F, T>
|
|||||||
) -> Result<Self, Self::Error> {
|
) -> Result<Self, Self::Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
payment_method_token: Some(types::PaymentMethodToken::Token(
|
payment_method_token: Some(types::PaymentMethodToken::Token(
|
||||||
item.response.buyer_key.clone(),
|
item.response.buyer_key.clone().expose(),
|
||||||
)),
|
)),
|
||||||
response: Ok(types::PaymentsResponseData::TokenizationResponse {
|
response: Ok(types::PaymentsResponseData::TokenizationResponse {
|
||||||
token: item.response.buyer_key,
|
token: item.response.buyer_key.expose(),
|
||||||
}),
|
}),
|
||||||
..item.data
|
..item.data
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user