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

@ -18,7 +18,7 @@ use crate::{
routes::AppState,
services,
types::{
api,
api, domain,
storage::{self, enums},
transformers::{ForeignInto, ForeignTryInto},
},
@ -30,7 +30,7 @@ const OUTGOING_WEBHOOK_TIMEOUT_SECS: u64 = 5;
#[instrument(skip_all)]
pub async fn payments_incoming_webhook_flow<W: api::OutgoingWebhookType>(
state: AppState,
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
) -> CustomResult<(), errors::ApiErrorResponse> {
@ -106,7 +106,7 @@ pub async fn payments_incoming_webhook_flow<W: api::OutgoingWebhookType>(
#[instrument(skip_all)]
pub async fn refunds_incoming_webhook_flow<W: api::OutgoingWebhookType>(
state: AppState,
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
webhook_details: api::IncomingWebhookDetails,
connector_name: &str,
source_verified: bool,
@ -211,7 +211,7 @@ pub async fn refunds_incoming_webhook_flow<W: api::OutgoingWebhookType>(
pub async fn get_payment_attempt_from_object_reference_id(
state: &AppState,
object_reference_id: api_models::webhooks::ObjectReferenceId,
merchant_account: &storage::MerchantAccount,
merchant_account: &domain::MerchantAccount,
) -> CustomResult<storage_models::payment_attempt::PaymentAttempt, errors::ApiErrorResponse> {
let db = &*state.store;
match object_reference_id {
@ -323,7 +323,7 @@ pub async fn get_or_update_dispute_object(
#[instrument(skip_all)]
pub async fn disputes_incoming_webhook_flow<W: api::OutgoingWebhookType>(
state: AppState,
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
connector: &(dyn api::Connector + Sync),
@ -386,7 +386,7 @@ pub async fn disputes_incoming_webhook_flow<W: api::OutgoingWebhookType>(
async fn bank_transfer_webhook_flow<W: api::OutgoingWebhookType>(
state: AppState,
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
webhook_details: api::IncomingWebhookDetails,
source_verified: bool,
) -> CustomResult<(), errors::ApiErrorResponse> {
@ -461,7 +461,7 @@ async fn bank_transfer_webhook_flow<W: api::OutgoingWebhookType>(
#[instrument(skip_all)]
pub async fn create_event_and_trigger_outgoing_webhook<W: api::OutgoingWebhookType>(
state: AppState,
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
event_type: enums::EventType,
event_class: enums::EventClass,
intent_reference_id: Option<String>,
@ -539,7 +539,7 @@ pub async fn create_event_and_trigger_outgoing_webhook<W: api::OutgoingWebhookTy
}
pub async fn trigger_webhook_to_merchant<W: api::OutgoingWebhookType>(
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
webhook: api::OutgoingWebhook,
outgoing_webhooks_signature: Option<String>,
state: &AppState,
@ -620,7 +620,7 @@ pub async fn trigger_webhook_to_merchant<W: api::OutgoingWebhookType>(
pub async fn webhooks_core<W: api::OutgoingWebhookType>(
state: &AppState,
req: &actix_web::HttpRequest,
merchant_account: storage::MerchantAccount,
merchant_account: domain::MerchantAccount,
connector_name: &str,
body: actix_web::web::Bytes,
) -> RouterResponse<serde_json::Value> {