mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
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:
@ -38,8 +38,7 @@ use crate::{
|
||||
scheduler::utils as pt_utils,
|
||||
services::{self, api::Authenticate},
|
||||
types::{
|
||||
self,
|
||||
api::{self},
|
||||
self, api, domain,
|
||||
storage::{self, enums as storage_enums},
|
||||
},
|
||||
utils::{Encode, OptionExt, ValueExt},
|
||||
@ -48,11 +47,11 @@ use crate::{
|
||||
#[instrument(skip_all, fields(payment_id, merchant_id))]
|
||||
pub async fn payments_operation_core<F, Req, Op, FData>(
|
||||
state: &AppState,
|
||||
merchant_account: storage::MerchantAccount,
|
||||
merchant_account: domain::MerchantAccount,
|
||||
operation: Op,
|
||||
req: Req,
|
||||
call_connector_action: CallConnectorAction,
|
||||
) -> RouterResult<(PaymentData<F>, Req, Option<storage::Customer>)>
|
||||
) -> RouterResult<(PaymentData<F>, Req, Option<domain::Customer>)>
|
||||
where
|
||||
F: Send + Clone + Sync,
|
||||
Req: Authenticate,
|
||||
@ -201,7 +200,7 @@ where
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn payments_core<F, Res, Req, Op, FData>(
|
||||
state: &AppState,
|
||||
merchant_account: storage::MerchantAccount,
|
||||
merchant_account: domain::MerchantAccount,
|
||||
operation: Op,
|
||||
req: Req,
|
||||
auth_flow: services::AuthFlow,
|
||||
@ -263,7 +262,7 @@ pub trait PaymentRedirectFlow: Sync {
|
||||
async fn call_payment_flow(
|
||||
&self,
|
||||
state: &AppState,
|
||||
merchant_account: storage::MerchantAccount,
|
||||
merchant_account: domain::MerchantAccount,
|
||||
req: PaymentsRedirectResponseData,
|
||||
connector_action: CallConnectorAction,
|
||||
) -> RouterResponse<api::PaymentsResponse>;
|
||||
@ -273,7 +272,7 @@ pub trait PaymentRedirectFlow: Sync {
|
||||
fn generate_response(
|
||||
&self,
|
||||
payments_response: api_models::payments::PaymentsResponse,
|
||||
merchant_account: storage_models::merchant_account::MerchantAccount,
|
||||
merchant_account: types::domain::MerchantAccount,
|
||||
payment_id: String,
|
||||
connector: String,
|
||||
) -> RouterResult<api::RedirectionResponse>;
|
||||
@ -282,7 +281,7 @@ pub trait PaymentRedirectFlow: Sync {
|
||||
async fn handle_payments_redirect_response(
|
||||
&self,
|
||||
state: &AppState,
|
||||
merchant_account: storage::MerchantAccount,
|
||||
merchant_account: domain::MerchantAccount,
|
||||
req: PaymentsRedirectResponseData,
|
||||
) -> RouterResponse<api::RedirectionResponse> {
|
||||
metrics::REDIRECTION_TRIGGERED.add(
|
||||
@ -350,7 +349,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
|
||||
async fn call_payment_flow(
|
||||
&self,
|
||||
state: &AppState,
|
||||
merchant_account: storage::MerchantAccount,
|
||||
merchant_account: domain::MerchantAccount,
|
||||
req: PaymentsRedirectResponseData,
|
||||
connector_action: CallConnectorAction,
|
||||
) -> RouterResponse<api::PaymentsResponse> {
|
||||
@ -387,7 +386,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
|
||||
fn generate_response(
|
||||
&self,
|
||||
payments_response: api_models::payments::PaymentsResponse,
|
||||
merchant_account: storage_models::merchant_account::MerchantAccount,
|
||||
merchant_account: types::domain::MerchantAccount,
|
||||
payment_id: String,
|
||||
connector: String,
|
||||
) -> RouterResult<api::RedirectionResponse> {
|
||||
@ -437,7 +436,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
|
||||
async fn call_payment_flow(
|
||||
&self,
|
||||
state: &AppState,
|
||||
merchant_account: storage::MerchantAccount,
|
||||
merchant_account: domain::MerchantAccount,
|
||||
req: PaymentsRedirectResponseData,
|
||||
connector_action: CallConnectorAction,
|
||||
) -> RouterResponse<api::PaymentsResponse> {
|
||||
@ -468,7 +467,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
|
||||
fn generate_response(
|
||||
&self,
|
||||
payments_response: api_models::payments::PaymentsResponse,
|
||||
merchant_account: storage_models::merchant_account::MerchantAccount,
|
||||
merchant_account: types::domain::MerchantAccount,
|
||||
payment_id: String,
|
||||
connector: String,
|
||||
) -> RouterResult<api::RedirectionResponse> {
|
||||
@ -488,11 +487,11 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn call_connector_service<F, Op, Req>(
|
||||
state: &AppState,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
merchant_account: &domain::MerchantAccount,
|
||||
connector: api::ConnectorData,
|
||||
_operation: &Op,
|
||||
payment_data: &PaymentData<F>,
|
||||
customer: &Option<storage::Customer>,
|
||||
customer: &Option<domain::Customer>,
|
||||
call_connector_action: CallConnectorAction,
|
||||
tokenization_action: TokenizationAction,
|
||||
) -> RouterResult<types::RouterData<F, Req, types::PaymentsResponseData>>
|
||||
@ -567,11 +566,11 @@ where
|
||||
|
||||
pub async fn call_multiple_connectors_service<F, Op, Req>(
|
||||
state: &AppState,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
merchant_account: &domain::MerchantAccount,
|
||||
connectors: Vec<api::SessionConnectorData>,
|
||||
_operation: &Op,
|
||||
mut payment_data: PaymentData<F>,
|
||||
customer: &Option<storage::Customer>,
|
||||
customer: &Option<domain::Customer>,
|
||||
) -> RouterResult<PaymentData<F>>
|
||||
where
|
||||
Op: Debug,
|
||||
@ -641,8 +640,8 @@ where
|
||||
pub async fn call_create_connector_customer_if_required<F, Req>(
|
||||
state: &AppState,
|
||||
connector_name: &Option<String>,
|
||||
customer: &Option<storage::Customer>,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
customer: &Option<domain::Customer>,
|
||||
merchant_account: &domain::MerchantAccount,
|
||||
payment_data: &mut PaymentData<F>,
|
||||
) -> RouterResult<Option<storage::CustomerUpdate>>
|
||||
where
|
||||
@ -1059,7 +1058,7 @@ pub fn is_operation_confirm<Op: Debug>(operation: &Op) -> bool {
|
||||
#[cfg(feature = "olap")]
|
||||
pub async fn list_payments(
|
||||
db: &dyn StorageInterface,
|
||||
merchant: storage::MerchantAccount,
|
||||
merchant: domain::MerchantAccount,
|
||||
constraints: api::PaymentListConstraints,
|
||||
) -> RouterResponse<api::PaymentListResponse> {
|
||||
use futures::stream::StreamExt;
|
||||
@ -1153,7 +1152,7 @@ pub async fn get_connector_choice<F, Req>(
|
||||
operation: &BoxedOperation<'_, F, Req>,
|
||||
state: &AppState,
|
||||
req: &Req,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
merchant_account: &domain::MerchantAccount,
|
||||
payment_data: &mut PaymentData<F>,
|
||||
) -> RouterResult<Option<api::ConnectorCallType>>
|
||||
where
|
||||
@ -1195,7 +1194,7 @@ where
|
||||
|
||||
pub fn connector_selection<F>(
|
||||
state: &AppState,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
merchant_account: &domain::MerchantAccount,
|
||||
payment_data: &mut PaymentData<F>,
|
||||
request_straight_through: Option<serde_json::Value>,
|
||||
) -> RouterResult<api::ConnectorCallType>
|
||||
@ -1254,7 +1253,7 @@ where
|
||||
|
||||
pub fn decide_connector(
|
||||
state: &AppState,
|
||||
merchant_account: &storage::MerchantAccount,
|
||||
merchant_account: &domain::MerchantAccount,
|
||||
request_straight_through: Option<api::StraightThroughAlgorithm>,
|
||||
routing_data: &mut storage::RoutingData,
|
||||
) -> RouterResult<api::ConnectorCallType> {
|
||||
|
||||
Reference in New Issue
Block a user