refactor(masking): PII improvements (#77)

This commit is contained in:
kos-for-juspay
2022-12-13 08:50:21 +01:00
committed by GitHub
parent b3fefeb2aa
commit 124048ce75
16 changed files with 188 additions and 162 deletions

View File

@ -2,7 +2,7 @@ use std::borrow::Cow;
// TODO : Evaluate all the helper functions ()
use error_stack::{report, IntoReport, ResultExt};
use masking::{PeekInterface, PeekOptionInterface};
use masking::{ExposeOptionInterface, PeekInterface};
use router_env::{instrument, tracing};
use uuid::Uuid;
@ -633,7 +633,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
let new_customer = storage::CustomerNew {
customer_id: customer_id.to_string(),
merchant_id: merchant_id.to_string(),
name: req.name.peek_cloning(),
name: req.name.expose_option(),
email: req.email.clone(),
phone: req.phone.clone(),
phone_country_code: req.phone_country_code.clone(),
@ -725,17 +725,17 @@ impl Vault {
let card = resp.card;
let card_number = card
.card_number
.peek_cloning()
.expose_option()
.get_required_value("card_number")?;
let card_exp_month = card
.card_exp_month
.peek_cloning()
.expose_option()
.get_required_value("expiry_month")?;
let card_exp_year = card
.card_exp_year
.peek_cloning()
.expose_option()
.get_required_value("expiry_year")?;
let card_holder_name = card.name_on_card.peek_cloning().unwrap_or_default();
let card_holder_name = card.name_on_card.expose_option().unwrap_or_default();
let card = api::PaymentMethod::Card(api::CCard {
card_number: card_number.into(),
card_exp_month: card_exp_month.into(),