feat: encrypt PII fields before saving it in the database (#1043)

Co-authored-by: Nishant Joshi <nishant.joshi@juspay.in>
This commit is contained in:
Kartikeya Hegde
2023-05-30 13:43:17 +05:30
committed by GitHub
parent 77e60c82fa
commit fa392c40a8
107 changed files with 3818 additions and 1267 deletions

View File

@ -1,4 +1,7 @@
use common_utils::pii;
use common_utils::{
crypto::{Encryptable, OptionalEncryptableName},
pii,
};
use masking::Secret;
use serde::{Deserialize, Serialize};
use url;
@ -15,8 +18,8 @@ pub struct MerchantAccountCreate {
pub merchant_id: String,
/// Name of the Merchant Account
#[schema(example = "NewAge Retailer")]
pub merchant_name: Option<String>,
#[schema(value_type= Option<String>,example = "NewAge Retailer")]
pub merchant_name: Option<Secret<String>>,
/// Merchant related details
pub merchant_details: Option<MerchantDetails>,
@ -157,8 +160,8 @@ pub struct MerchantAccountResponse {
pub merchant_id: String,
/// Name of the Merchant Account
#[schema(example = "NewAge Retailer")]
pub merchant_name: Option<String>,
#[schema(value_type = Option<String>,example = "NewAge Retailer")]
pub merchant_name: OptionalEncryptableName,
/// The URL to redirect after the completion of the operation
#[schema(max_length = 255, example = "https://www.example.com/success")]
@ -178,7 +181,7 @@ pub struct MerchantAccountResponse {
/// Merchant related details
#[schema(value_type = Option<MerchantDetails>)]
pub merchant_details: Option<serde_json::Value>,
pub merchant_details: Option<Encryptable<pii::SecretSerdeValue>>,
/// Webhook related details
#[schema(value_type = Option<WebhookDetails>)]