Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(platform): pass processor context for connector functions in payments core (#11002)

Sandeep Kumar6f07d7af18f7
diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs
index 14edf75f0d..3f6e46b367 100644
--- a/crates/router/src/core/authentication.rs
+++ b/crates/router/src/core/authentication.rs
@@ -114,7 +114,7 @@ pub async fn perform_authentication(
pub async fn perform_post_authentication(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
business_profile: domain::Profile,
authentication_id: common_utils::id_type::AuthenticationId,
payment_id: &common_utils::id_type::PaymentId,
@@ -124,7 +124,7 @@ pub async fn perform_post_authentication(
> {
let key_state = &state.into();
let (authentication_connector, three_ds_connector_account) =
- utils::get_authentication_connector_data(state, key_store, &business_profile, None).await?;
+ utils::get_authentication_connector_data(state, processor, &business_profile, None).await?;
let is_pull_mechanism_enabled =
check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata(
three_ds_connector_account
@@ -136,7 +136,7 @@ pub async fn perform_post_authentication(
.find_authentication_by_merchant_id_authentication_id(
&business_profile.merchant_id,
&authentication_id,
- key_store,
+ processor.get_key_store(),
key_state,
)
.await
@@ -180,7 +180,7 @@ pub async fn perform_post_authentication(
router_data,
authentication,
None,
- key_store,
+ processor.get_key_store(),
authentication_info,
)
.await?
@@ -194,7 +194,7 @@ pub async fn perform_post_authentication(
state,
authentication_id.get_string_repr(),
false,
- key_store.key.get_inner(),
+ processor.get_key_store().key.get_inner(),
)
.await
.inspect_err(|err| router_env::logger::error!(tokenized_data_result=?err))
@@ -213,7 +213,7 @@ pub async fn perform_post_authentication(
#[allow(clippy::too_many_arguments)]
pub async fn perform_pre_authentication(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
card: hyperswitch_domain_models::payment_method_data::Card,
token: String,
business_profile: &domain::Profile,
@@ -229,7 +229,7 @@ pub async fn perform_pre_authentication(
ApiErrorResponse,
> {
let (authentication_connector, three_ds_connector_account) =
- utils::get_authentication_connector_data(state, key_store, business_profile, None).await?;
+ utils::get_authentication_connector_data(state, processor, business_profile, None).await?;
let authentication_connector_name = authentication_connector.to_string();
let authentication = utils::create_new_authentication(
state,
@@ -245,7 +245,7 @@ pub async fn perform_pre_authentication(
organization_id,
force_3ds_challenge,
psd2_sca_exemption_type,
- key_store,
+ processor.get_key_store(),
)
.await?;
@@ -282,7 +282,7 @@ pub async fn perform_pre_authentication(
router_data,
authentication,
acquirer_details.clone(),
- key_store,
+ processor.get_key_store(),
authentication_info,
)
.await?;
@@ -327,7 +327,7 @@ pub async fn perform_pre_authentication(
router_data,
authentication,
acquirer_details,
- key_store,
+ processor.get_key_store(),
authentication_info,
)
.await?;
diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs
index fa62f9247f..ed83d7db93 100644
--- a/crates/router/src/core/authentication/utils.rs
+++ b/crates/router/src/core/authentication/utils.rs
@@ -510,7 +510,7 @@ where
pub async fn get_authentication_connector_data(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
authentication_connector: Option<String>,
) -> RouterResult<(
@@ -555,9 +555,8 @@ pub async fn get_authentication_connector_data(
let profile_id = business_profile.get_id();
let authentication_connector_mca = payments::helpers::get_merchant_connector_account(
state,
- &business_profile.merchant_id,
+ processor,
None,
- key_store,
profile_id,
authentication_connector.to_string().as_str(),
None,
diff --git a/crates/router/src/core/blocklist/utils.rs b/crates/router/src/core/blocklist/utils.rs
index 4c3103895e..631bd1ba0c 100644
--- a/crates/router/src/core/blocklist/utils.rs
+++ b/crates/router/src/core/blocklist/utils.rs
@@ -292,11 +292,11 @@ async fn delete_card_bin_blocklist_entry(
pub async fn should_payment_be_blocked(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
payment_method_data: &Option<domain::PaymentMethodData>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
let db = &state.store;
- let merchant_id = platform.get_processor().get_account().get_id();
+ let merchant_id = processor.get_account().get_id();
let merchant_fingerprint_secret = get_merchant_fingerprint_secret(state, merchant_id).await?;
// Hashed Fingerprint to check whether or not this payment should be blocked.
@@ -383,7 +383,7 @@ pub async fn should_payment_be_blocked(
pub async fn validate_data_for_blocklist<F>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse>
where
@@ -391,7 +391,7 @@ where
{
let db = &state.store;
let should_payment_be_blocked =
- should_payment_be_blocked(state, platform, &payment_data.payment_method_data).await?;
+ should_payment_be_blocked(state, processor, &payment_data.payment_method_data).await?;
if should_payment_be_blocked {
// Update db for attempt and intent status.
db.update_payment_intent(
@@ -399,14 +399,10 @@ where
storage::PaymentIntentUpdate::RejectUpdate {
status: common_enums::IntentStatus::Failed,
merchant_decision: Some(MerchantDecision::Rejected.to_string()),
- updated_by: platform
- .get_processor()
- .get_account()
- .storage_scheme
- .to_string(),
+ updated_by: processor.get_account().storage_scheme.to_string(),
},
- platform.get_processor().get_key_store(),
- platform.get_processor().get_account().storage_scheme,
+ processor.get_key_store(),
+ processor.get_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
@@ -419,17 +415,13 @@ where
status: common_enums::AttemptStatus::Failure,
error_code: Some(Some("HE-03".to_string())),
error_message: Some(Some("This payment method is blocked".to_string())),
- updated_by: platform
- .get_processor()
- .get_account()
- .storage_scheme
- .to_string(),
+ updated_by: processor.get_account().storage_scheme.to_string(),
};
db.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt.clone(),
attempt_update,
- platform.get_processor().get_account().storage_scheme,
- platform.get_processor().get_key_store(),
+ processor.get_account().storage_scheme,
+ processor.get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index 11c6eeeae6..fa1ac7080f 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -94,7 +94,7 @@ where
{
let merchant_connector_account = payments::construct_profile_id_and_get_mca(
state,
- platform,
+ platform.get_processor(),
payment_data,
&frm_data.connector_details.connector_name,
None,
diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
index 3242807d50..39542a898b 100644
--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
@@ -50,9 +50,8 @@ pub async fn construct_fulfillment_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- processor.get_account().get_id(),
+ processor,
None,
- processor.get_key_store(),
&profile_id,
&connector,
None,
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index dc22ddf254..1685d4259c 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -82,9 +82,8 @@ pub async fn revoke_mandate(
let merchant_connector_account = payment_helper::get_merchant_connector_account(
&state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
&mandate.connector.clone(),
mandate.merchant_connector_id.as_ref(),
diff --git a/crates/router/src/core/payment_method_balance.rs b/crates/router/src/core/payment_method_balance.rs
index 40c48c01d5..f72218960f 100644
--- a/crates/router/src/core/payment_method_balance.rs
+++ b/crates/router/src/core/payment_method_balance.rs
@@ -78,7 +78,7 @@ pub async fn payments_check_gift_card_balance_core(
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
Some(&gift_card_connector_id),
)
.await
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 8b47e436a2..2c8c5173e4 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -3092,7 +3092,7 @@ pub async fn vault_payment_method(
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
payments_core::helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
Some(&external_vault_source),
)
.await
diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs
index 21eb1ec82c..1102881228 100644
--- a/crates/router/src/core/payment_methods/vault.rs
+++ b/crates/router/src/core/payment_methods/vault.rs
@@ -1974,7 +1974,7 @@ pub async fn retrieve_payment_method_from_vault(
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
payments_core::helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
external_vault_source,
)
.await
@@ -2164,7 +2164,7 @@ pub async fn delete_payment_method_data_from_vault(
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
payments_core::helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
external_vault_source,
)
.await
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 9b381d0e3a..71e5da8f0a 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -538,7 +538,7 @@ where
.populate_payment_data(
state,
&mut payment_data,
- &platform,
+ platform.get_processor(),
profile,
&connector_data,
)
@@ -810,7 +810,7 @@ where
&mut should_continue_transaction,
&connector_details,
&business_profile,
- platform.get_processor().get_key_store(),
+ platform,
mandate_type,
)
.await?;
@@ -827,7 +827,7 @@ where
&mut should_continue_transaction,
&connector_details,
&business_profile,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
mandate_type,
)
.await?;
@@ -1229,7 +1229,7 @@ where
.await?;
Box::pin(call_multiple_connectors_service(
state,
- platform,
+ platform.get_processor(),
connectors,
&operation,
payment_data,
@@ -1748,7 +1748,7 @@ where
let router_data = call_unified_connector_service_for_external_proxy(
state,
req_state.clone(),
- &platform,
+ platform.get_processor(),
connector_data.connector_data.clone(),
&operation,
&mut payment_data,
@@ -3825,13 +3825,11 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
connector: String,
payment_id: id_type::PaymentId,
) -> RouterResult<Self::PaymentFlowResponse> {
- let merchant_id = platform.get_processor().get_account().get_id().clone();
-
let payment_intent = state
.store
.find_payment_intent_by_payment_id_merchant_id(
&payment_id,
- &merchant_id,
+ platform.get_processor().get_account().get_id(),
platform.get_processor().get_key_store(),
platform.get_processor().get_account().storage_scheme,
)
@@ -3841,7 +3839,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
.store
.find_payment_attempt_by_attempt_id_merchant_id(
&payment_intent.active_attempt.get_id(),
- &merchant_id,
+ platform.get_processor().get_account().get_id(),
platform.get_processor().get_account().storage_scheme,
platform.get_processor().get_key_store(),
)
@@ -3855,7 +3853,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
let authentication = state
.store
.find_authentication_by_merchant_id_authentication_id(
- &merchant_id,
+ platform.get_processor().get_account().get_id(),
&authentication_id,
platform.get_processor().get_key_store(),
key_manager_state,
@@ -3867,9 +3865,8 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
// Fetching merchant_connector_account to check if pull_mechanism is enabled for 3ds connector
let authentication_merchant_connector_account = helpers::get_merchant_connector_account(
state,
- &merchant_id,
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&payment_intent
.profile_id
.ok_or(errors::ApiErrorResponse::InternalServerError)
@@ -3971,7 +3968,10 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
// When intent status is RequiresCustomerAction, Set poll_id in redis to allow the fetch status of poll through retrieve_poll_status api from client
if payments_response.status == common_enums::IntentStatus::RequiresCustomerAction {
let req_poll_id = core_utils::get_external_authentication_request_poll_id(&payment_id);
- let poll_id = core_utils::get_poll_id(&merchant_id, req_poll_id.clone());
+ let poll_id = core_utils::get_poll_id(
+ platform.get_processor().get_account().get_id(),
+ req_poll_id.clone(),
+ );
let redis_conn = state
.store
.get_redis_conn()
@@ -4155,7 +4155,7 @@ where
construct_profile_id_and_get_mca(
state,
- platform,
+ platform.get_processor(),
payment_data,
&connector_routing_data
.connector_data
@@ -4500,7 +4500,7 @@ where
{
let merchant_connector_account = construct_profile_id_and_get_mca(
state,
- platform,
+ platform.get_processor(),
payment_data,
&connector.connector_name.to_string(),
connector.merchant_connector_id.as_ref(),
@@ -4566,7 +4566,13 @@ where
operation
.to_domain()?
- .populate_payment_data(state, payment_data, platform, business_profile, &connector)
+ .populate_payment_data(
+ state,
+ payment_data,
+ platform.get_processor(),
+ business_profile,
+ &connector,
+ )
.await?;
let (pd, tokenization_action) = get_connector_tokenization_action_when_confirm_true(
@@ -4587,10 +4593,15 @@ where
routing_decision.map(|decision| decision.apply_routing_decision(payment_data));
// Validating the blocklist guard and generate the fingerprint
- blocklist_guard(state, platform, operation, payment_data).await?;
+ blocklist_guard(state, platform.get_processor(), operation, payment_data).await?;
let merchant_recipient_data = payment_data
- .get_merchant_recipient_data(state, platform, &merchant_connector_account, &connector)
+ .get_merchant_recipient_data(
+ state,
+ platform.get_processor(),
+ &merchant_connector_account,
+ &connector,
+ )
.await?;
let router_data = payment_data
@@ -4960,7 +4971,7 @@ where
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
connector.merchant_connector_id.as_ref(),
)
.await?,
@@ -4968,7 +4979,13 @@ where
operation
.to_domain()?
- .populate_payment_data(state, payment_data, platform, business_profile, &connector)
+ .populate_payment_data(
+ state,
+ payment_data,
+ platform.get_processor(),
+ business_profile,
+ &connector,
+ )
.await?;
let updated_customer = call_create_connector_customer_if_required(
@@ -5060,7 +5077,7 @@ where
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
Some(&external_vault_source),
)
.await?,
@@ -5136,7 +5153,13 @@ where
operation
.to_domain()?
- .populate_payment_data(state, payment_data, platform, business_profile, &connector)
+ .populate_payment_data(
+ state,
+ payment_data,
+ platform.get_processor(),
+ business_profile,
+ &connector,
+ )
.await?;
let router_data = payment_data
@@ -5390,7 +5413,7 @@ where
pub async fn call_unified_connector_service_for_external_proxy<F, RouterDReq, ApiRequest, D>(
state: &SessionState,
req_state: ReqState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
_connector: api::ConnectorData,
operation: &BoxedOperation<'_, F, ApiRequest, D>,
payment_data: &mut D,
@@ -5426,7 +5449,7 @@ where
.update_trackers(
state,
req_state,
- platform.get_processor(),
+ processor,
payment_data.clone(),
customer.clone(),
frm_suggestion,
@@ -5452,7 +5475,7 @@ where
lineage_ids,
merchant_connector_account_type_details.clone(),
external_vault_merchant_connector_account_type_details.clone(),
- platform.get_processor(),
+ processor,
ExecutionMode::Primary, //UCS is called in primary mode
merchant_order_reference_id,
)
@@ -5502,7 +5525,7 @@ where
let merchant_connector_account = construct_profile_id_and_get_mca(
state,
- platform,
+ platform.get_processor(),
payment_data,
&connector.connector_name.to_string(),
connector.merchant_connector_id.as_ref(),
@@ -5701,7 +5724,7 @@ where
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
connector.merchant_connector_id.as_ref(),
)
.await?,
@@ -5716,7 +5739,13 @@ where
);
operation
.to_domain()?
- .populate_payment_data(state, payment_data, platform, business_profile, &connector)
+ .populate_payment_data(
+ state,
+ payment_data,
+ platform.get_processor(),
+ business_profile,
+ &connector,
+ )
.await?;
let mut router_data = payment_data
@@ -5829,14 +5858,20 @@ where
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
connector.merchant_connector_id.as_ref(),
)
.await?,
));
operation
.to_domain()?
- .populate_payment_data(state, payment_data, platform, business_profile, &connector)
+ .populate_payment_data(
+ state,
+ payment_data,
+ platform.get_processor(),
+ business_profile,
+ &connector,
+ )
.await?;
let mut router_data = payment_data
@@ -6296,7 +6331,7 @@ impl DecideWalletFlow {
pub async fn get_merchant_bank_data_for_open_banking_connectors(
merchant_connector_account: &helpers::MerchantConnectorAccountType,
- platform: &domain::Platform,
+ processor: &domain::Processor,
connector: &api::ConnectorData,
state: &SessionState,
) -> RouterResult<Option<router_types::MerchantRecipientData>> {
@@ -6322,8 +6357,7 @@ pub async fn get_merchant_bank_data_for_open_banking_connectors(
let final_recipient_data = if let Some(id) = recipient_id {
if contains {
// Customer Id for OpenBanking connectors will be merchant_id as the account data stored at locker belongs to the merchant
- let merchant_id_str = platform
- .get_processor()
+ let merchant_id_str = processor
.get_account()
.get_id()
.get_string_repr()
@@ -6333,9 +6367,9 @@ pub async fn get_merchant_bank_data_for_open_banking_connectors(
.attach_printable("Failed to convert to CustomerId")?;
let locker_resp = cards::get_encrypted_data_from_vault(
state,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
&cust_id,
- platform.get_processor().get_account().get_id(),
+ processor.get_account().get_id(),
id.as_str(),
)
.await
@@ -6362,7 +6396,7 @@ pub async fn get_merchant_bank_data_for_open_banking_connectors(
async fn blocklist_guard<F, ApiRequest, D>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
operation: &BoxedOperation<'_, F, ApiRequest, D>,
payment_data: &mut D,
) -> CustomResult<bool, errors::ApiErrorResponse>
@@ -6370,7 +6404,7 @@ where
F: Send + Clone + Sync,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
- let merchant_id = platform.get_processor().get_account().get_id();
+ let merchant_id = processor.get_account().get_id();
let blocklist_enabled_key = merchant_id.get_blocklist_guard_key();
let blocklist_guard_enabled = state
.store
@@ -6392,7 +6426,7 @@ where
if blocklist_guard_enabled {
Ok(operation
.to_domain()?
- .guard_payment_against_blocklist(state, platform, payment_data)
+ .guard_payment_against_blocklist(state, processor, payment_data)
.await?)
} else {
Ok(false)
@@ -6403,7 +6437,7 @@ where
#[allow(clippy::too_many_arguments)]
pub async fn call_multiple_connectors_service<F, Op, Req, D>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
connectors: api::SessionConnectorDatas,
_operation: &Op,
mut payment_data: D,
@@ -6433,7 +6467,7 @@ where
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ processor,
session_connector_data
.connector
.merchant_connector_id
@@ -6447,7 +6481,7 @@ where
.construct_router_data(
state,
connector_id,
- platform.get_processor(),
+ processor,
customer,
&merchant_connector_account,
None,
@@ -6455,7 +6489,7 @@ where
)
.await?;
let gateway_context = gateway_context::RouterGatewayContext::direct(
- platform.get_processor().clone(),
+ processor.clone(),
merchant_connector_account.clone(),
business_profile.merchant_id.clone(),
business_profile.get_id().clone(),
@@ -6522,7 +6556,7 @@ where
#[allow(clippy::too_many_arguments)]
pub async fn call_multiple_connectors_service<F, Op, Req, D>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
connectors: api::SessionConnectorDatas,
_operation: &Op,
mut payment_data: D,
@@ -6553,7 +6587,7 @@ where
let merchant_connector_account = construct_profile_id_and_get_mca(
state,
- platform,
+ processor,
&payment_data,
&session_connector_data.connector.connector_name.to_string(),
session_connector_data
@@ -6578,7 +6612,7 @@ where
.construct_router_data(
state,
connector_id,
- platform.get_processor(),
+ processor,
customer,
&merchant_connector_account,
None,
@@ -6591,7 +6625,7 @@ where
let res = decide_unified_connector_service_call_for_multiple_connectors_service(
state,
&session_connector_data.connector,
- platform,
+ processor,
CallConnectorAction::Trigger,
business_profile,
header_payload.clone(),
@@ -6643,8 +6677,7 @@ where
if let Some(value) = business_profile.authentication_product_ids.clone() {
let session_token = get_session_token_for_click_to_pay(
state,
- platform.get_processor().get_account().get_id(),
- platform,
+ processor,
value,
payment_data.get_payment_intent(),
business_profile.get_id(),
@@ -6667,7 +6700,7 @@ where
pub async fn decide_unified_connector_service_call_for_multiple_connectors_service<F, RouterDReq>(
state: &SessionState,
connector: &api::ConnectorData,
- platform: &domain::Platform,
+ processor: &domain::Processor,
call_connector_action: CallConnectorAction,
business_profile: &domain::Profile,
header_payload: HeaderPayload,
@@ -6686,7 +6719,7 @@ where
{
let (execution_path, updated_state) = should_call_unified_connector_service(
state,
- platform.get_processor(),
+ processor,
&router_data,
None, // No previous gateway information required for session flow
call_connector_action.clone(),
@@ -6708,7 +6741,7 @@ where
let gateway_context = gateway_context::RouterGatewayContext {
creds_identifier,
- processor: platform.get_processor().clone(),
+ processor: processor.clone(),
header_payload: header_payload.clone(),
lineage_ids,
merchant_connector_account: merchant_connector_account.clone(),
@@ -6733,8 +6766,7 @@ where
#[cfg(feature = "v1")]
pub async fn get_session_token_for_click_to_pay(
state: &SessionState,
- merchant_id: &id_type::MerchantId,
- platform: &domain::Platform,
+ processor: &domain::Processor,
authentication_product_ids: common_types::payments::AuthenticationConnectorAccountMap,
payment_intent: &payments::PaymentIntent,
profile_id: &id_type::ProfileId,
@@ -6747,9 +6779,9 @@ pub async fn get_session_token_for_click_to_pay(
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
- merchant_id,
+ processor.get_account().get_id(),
&click_to_pay_mca_id,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
@@ -6789,12 +6821,9 @@ pub async fn get_session_token_for_click_to_pay(
_ => None,
};
- let card_brands = get_card_brands_based_on_active_merchant_connector_account(
- state,
- profile_id,
- platform.get_processor().get_key_store(),
- )
- .await?;
+ let card_brands =
+ get_card_brands_based_on_active_merchant_connector_account(state, profile_id, processor)
+ .await?;
Ok(api_models::payments::SessionToken::ClickToPay(Box::new(
api_models::payments::ClickToPaySessionResponse {
@@ -6821,13 +6850,13 @@ pub async fn get_session_token_for_click_to_pay(
async fn get_card_brands_based_on_active_merchant_connector_account(
state: &SessionState,
profile_id: &id_type::ProfileId,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
) -> RouterResult<HashSet<enums::CardNetwork>> {
let merchant_configured_payment_connectors = state
.store
.list_enabled_connector_accounts_by_profile_id(
profile_id,
- key_store,
+ processor.get_key_store(),
common_enums::ConnectorType::PaymentProcessor,
)
.await
@@ -7245,7 +7274,7 @@ pub fn is_preprocessing_required_for_wallets(connector_name: String) -> bool {
#[instrument(skip_all)]
pub async fn construct_profile_id_and_get_mca<'a, F, D>(
state: &'a SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
payment_data: &D,
connector_name: &str,
merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
@@ -7269,9 +7298,8 @@ where
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ processor,
payment_data.get_creds_identifier(),
- platform.get_processor().get_key_store(),
&profile_id,
connector_name,
merchant_connector_id,
@@ -10748,9 +10776,8 @@ pub async fn payment_external_authentication<F: Clone + Sync>(
.attach_printable("authentication_connector not found in payment_attempt")?;
let merchant_connector_account = helpers::get_merchant_connector_account(
&state,
- merchant_id,
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
profile_id,
authentication_connector.as_str(),
None,
@@ -11259,7 +11286,7 @@ impl EligibilityCheck for BlockListCheck {
) -> CustomResult<CheckResult, errors::ApiErrorResponse> {
let should_payment_be_blocked = blocklist_utils::should_payment_be_blocked(
state,
- platform,
+ platform.get_processor(),
&payment_elgibility_data.payment_method_data,
)
.await?;
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index d55fd2c72e..d797c3e2c9 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -72,7 +72,7 @@ pub trait ConstructFlowSpecificData<F, Req, Res> {
async fn get_merchant_recipient_data<'a>(
&self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_merchant_connector_account: &helpers::MerchantConnectorAccountType,
_connector: &api::ConnectorData,
) -> RouterResult<Option<types::MerchantRecipientData>> {
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index 8718c55ae0..7d629e5b6d 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -95,7 +95,7 @@ impl
async fn get_merchant_recipient_data<'a>(
&self,
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
connector: &api::ConnectorData,
) -> RouterResult<Option<types::MerchantRecipientData>> {
@@ -108,7 +108,7 @@ impl
if *is_open_banking {
payments::get_merchant_bank_data_for_open_banking_connectors(
merchant_connector_account,
- platform,
+ processor,
connector,
state,
)
@@ -167,7 +167,7 @@ impl
async fn get_merchant_recipient_data<'a>(
&self,
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
connector: &api::ConnectorData,
) -> RouterResult<Option<types::MerchantRecipientData>> {
@@ -183,7 +183,7 @@ impl
Ok(if *is_open_banking {
payments::get_merchant_bank_data_for_open_banking_connectors(
merchant_connector_account,
- platform,
+ processor,
connector,
state,
)
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index e83ae44c1e..aae3d665dd 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4490,9 +4490,8 @@ pub async fn insert_merchant_connector_creds_to_config(
#[instrument(skip_all)]
pub async fn get_merchant_connector_account(
state: &SessionState,
- merchant_id: &id_type::MerchantId,
+ processor: &domain::Processor,
creds_identifier: Option<&str>,
- key_store: &domain::MerchantKeyStore,
profile_id: &id_type::ProfileId,
connector_name: &str,
merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
@@ -4500,7 +4499,10 @@ pub async fn get_merchant_connector_account(
let db = &*state.store;
match creds_identifier {
Some(creds_identifier) => {
- let key = merchant_id.get_creds_identifier_key(creds_identifier);
+ let key = processor
+ .get_account()
+ .get_id()
+ .get_creds_identifier_key(creds_identifier);
let cloned_key = key.clone();
let redis_fetch = || async {
db.get_redis_conn()
@@ -4576,9 +4578,9 @@ pub async fn get_merchant_connector_account(
#[cfg(feature = "v1")]
{
db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
- merchant_id,
+ processor.get_account().get_id(),
merchant_connector_id,
- key_store,
+ processor.get_key_store(),
)
.await
.to_not_found_response(
@@ -4589,13 +4591,16 @@ pub async fn get_merchant_connector_account(
}
#[cfg(feature = "v2")]
{
- db.find_merchant_connector_account_by_id(merchant_connector_id, key_store)
- .await
- .to_not_found_response(
- errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
- id: merchant_connector_id.get_string_repr().to_string(),
- },
- )
+ db.find_merchant_connector_account_by_id(
+ merchant_connector_id,
+ processor.get_key_store(),
+ )
+ .await
+ .to_not_found_response(
+ errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
+ id: merchant_connector_id.get_string_repr().to_string(),
+ },
+ )
}
} else {
#[cfg(feature = "v1")]
@@ -4603,7 +4608,7 @@ pub async fn get_merchant_connector_account(
db.find_merchant_connector_account_by_profile_id_connector_name(
profile_id,
connector_name,
- key_store,
+ processor.get_key_store(),
)
.await
.to_not_found_response(
@@ -6074,9 +6079,8 @@ where
let merchant_connector_account_type = get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
payment_data.get_creds_identifier(),
- platform.get_processor().get_key_store(),
profile_id,
&pre_decided_connector_data_first
.connector_data
@@ -7582,7 +7586,7 @@ pub enum UnifiedAuthenticationServiceFlow {
#[cfg(feature = "v1")]
pub async fn decide_action_for_unified_authentication_service<F: Clone>(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut PaymentData<F>,
connector_call_type: &api::ConnectorCallType,
@@ -7590,7 +7594,7 @@ pub async fn decide_action_for_unified_authentication_service<F: Clone>(
) -> RouterResult<Option<UnifiedAuthenticationServiceFlow>> {
let external_authentication_flow = get_payment_external_authentication_flow_during_confirm(
state,
- key_store,
+ processor,
business_profile,
payment_data,
connector_call_type,
@@ -7652,7 +7656,7 @@ pub enum PaymentExternalAuthenticationFlow {
#[cfg(feature = "v1")]
pub async fn get_payment_external_authentication_flow_during_confirm<F: Clone>(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut PaymentData<F>,
connector_call_type: &api::ConnectorCallType,
@@ -7707,9 +7711,8 @@ pub async fn get_payment_external_authentication_flow_during_confirm<F: Clone>(
)?;
let payment_connector_mca = get_merchant_connector_account(
state,
- &business_profile.merchant_id,
+ processor,
None,
- key_store,
business_profile.get_id(),
connector_data.connector_name.to_string().as_str(),
connector_data.merchant_connector_id.as_ref(),
@@ -8291,13 +8294,13 @@ pub async fn allow_payment_update_enabled_for_client_auth(
#[instrument(skip_all)]
pub async fn get_merchant_connector_account_v2(
state: &SessionState,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
) -> RouterResult<domain::MerchantConnectorAccount> {
let db = &*state.store;
match merchant_connector_id {
Some(merchant_connector_id) => db
- .find_merchant_connector_account_by_id(merchant_connector_id, key_store)
+ .find_merchant_connector_account_by_id(merchant_connector_id, processor.get_key_store())
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: merchant_connector_id.get_string_repr().to_string(),
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index f7f3b5539d..75f81db109 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -371,7 +371,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
&'a self,
_state: &SessionState,
_payment_data: &mut D,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_business_profile: &domain::Profile,
_connector_data: &api::ConnectorData,
) -> CustomResult<(), errors::ApiErrorResponse> {
@@ -386,7 +386,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
_should_continue_confirm_transaction: &mut bool,
_connector_call_type: &ConnectorCallType,
_business_profile: &domain::Profile,
- _key_store: &domain::MerchantKeyStore,
+ _processor: &domain::Processor,
_mandate_type: Option<api_models::payments::MandateTransactionType>,
) -> CustomResult<(), errors::ApiErrorResponse> {
Ok(())
@@ -400,7 +400,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
_should_continue_confirm_transaction: &mut bool,
_connector_call_type: &ConnectorCallType,
_business_profile: &domain::Profile,
- _key_store: &domain::MerchantKeyStore,
+ _platform: &domain::Platform,
_mandate_type: Option<api_models::payments::MandateTransactionType>,
) -> CustomResult<(), errors::ApiErrorResponse> {
Ok(())
@@ -422,7 +422,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut D,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
@@ -683,7 +683,7 @@ where
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut D,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
@@ -798,7 +798,7 @@ where
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut D,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
@@ -913,7 +913,7 @@ where
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut D,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
@@ -1006,7 +1006,7 @@ where
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut D,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
index 12cb46033e..ad53e724da 100644
--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
+++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
@@ -445,7 +445,7 @@ impl<F: Clone + Send + Sync> Domain<F, ExternalVaultProxyPaymentsRequest, Paymen
&'a self,
_state: &SessionState,
payment_data: &mut PaymentConfirmData<F>,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_business_profile: &domain::Profile,
connector_data: &api::ConnectorData,
) -> CustomResult<(), errors::ApiErrorResponse> {
diff --git a/crates/router/src/core/payments/operations/payment_attempt_list.rs b/crates/router/src/core/payments/operations/payment_attempt_list.rs
index 262ad86303..151327f544 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_list.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_list.rs
@@ -212,7 +212,7 @@ impl<F: Clone + Send + Sync>
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut payments::PaymentAttemptListData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
index 14d2716032..bf870a9e96 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
@@ -275,7 +275,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsCancelPostCaptureRequest, Pa
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 5d03094fff..a29db6ba66 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -503,7 +503,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 39c22865b7..41d1f9a421 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -1059,7 +1059,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
&'a self,
state: &SessionState,
payment_data: &mut PaymentData<F>,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
business_profile: &domain::Profile,
connector_data: &api::ConnectorData,
) -> CustomResult<(), errors::ApiErrorResponse> {
@@ -1090,13 +1090,13 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
should_continue_confirm_transaction: &mut bool,
connector_call_type: &ConnectorCallType,
business_profile: &domain::Profile,
- key_store: &domain::MerchantKeyStore,
+ processor: &domain::Processor,
mandate_type: Option<api_models::payments::MandateTransactionType>,
) -> CustomResult<(), errors::ApiErrorResponse> {
let external_authentication_flow =
helpers::get_payment_external_authentication_flow_during_confirm(
state,
- key_store,
+ processor,
business_profile,
payment_data,
connector_call_type,
@@ -1113,7 +1113,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
let shipping = payment_data.address.get_shipping().cloned();
let authentication_store = Box::pin(authentication::perform_pre_authentication(
state,
- key_store,
+ processor,
*card,
token,
business_profile,
@@ -1174,7 +1174,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
}) => {
let authentication_store = Box::pin(authentication::perform_post_authentication(
state,
- key_store,
+ processor,
business_profile.clone(),
authentication_id.clone(),
&payment_data.payment_intent.payment_id,
@@ -1363,13 +1363,13 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
should_continue_confirm_transaction: &mut bool,
connector_call_type: &ConnectorCallType,
business_profile: &domain::Profile,
- key_store: &domain::MerchantKeyStore,
+ platform: &domain::Platform,
mandate_type: Option<api_models::payments::MandateTransactionType>,
) -> CustomResult<(), errors::ApiErrorResponse> {
let unified_authentication_service_flow =
helpers::decide_action_for_unified_authentication_service(
state,
- key_store,
+ platform.get_processor(),
business_profile,
payment_data,
connector_call_type,
@@ -1399,7 +1399,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
merchant_id,
&click_to_pay_mca_id,
- key_store,
+ platform.get_processor().get_key_store(),
)
.await
.to_not_found_response(
@@ -1510,7 +1510,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
None,
None,
None,
- key_store
+ platform.get_processor().get_key_store()
)
.await?;
let authentication_store = hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore {
@@ -1524,7 +1524,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
..
} => {
let (authentication_connector, three_ds_connector_account) =
- authentication::utils::get_authentication_connector_data(state, key_store, business_profile, None).await?;
+ authentication::utils::get_authentication_connector_data(state, platform.get_processor(), business_profile, None).await?;
let authentication_connector_name = authentication_connector.to_string();
let authentication_id =
common_utils::id_type::AuthenticationId::generate_authentication_id(consts::AUTHENTICATION_ID_PREFIX);
@@ -1562,7 +1562,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
None,
None,
None,
- key_store
+ platform.get_processor().get_key_store()
)
.await?;
let acquirer_configs = authentication
@@ -1668,7 +1668,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
pre_auth_response,
authentication.clone(),
acquirer_details,
- key_store,
+ platform.get_processor().get_key_store(),
domain_address.cloned(),
shipping.cloned(),
email,
@@ -1719,7 +1719,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
},
helpers::UnifiedAuthenticationServiceFlow::ExternalAuthenticationPostAuthenticate {authentication_id} => {
let (authentication_connector, three_ds_connector_account) =
- authentication::utils::get_authentication_connector_data(state, key_store, business_profile, None).await?;
+ authentication::utils::get_authentication_connector_data(state, platform.get_processor(), business_profile, None).await?;
let is_pull_mechanism_enabled =
utils::check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata(
three_ds_connector_account
@@ -1731,7 +1731,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
.find_authentication_by_merchant_id_authentication_id(
&business_profile.merchant_id,
&authentication_id,
- key_store,
+ platform.get_processor().get_key_store(),
key_manager_state,
)
.await
@@ -1767,7 +1767,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
post_auth_response,
authentication,
None,
- key_store,
+ platform.get_processor().get_key_store(),
None,
None,
None,
@@ -1781,7 +1781,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
};
let tokenized_data = if updated_authentication.authentication_status.is_success() {
- Some(crate::core::payment_methods::vault::get_tokenized_data(state, authentication_id.get_string_repr(), false, key_store.key.get_inner()).await?)
+ Some(crate::core::payment_methods::vault::get_tokenized_data(state, authentication_id.get_string_repr(), false, platform.get_provider().get_key_store().key.get_inner()).await?)
} else {
None
};
@@ -1809,10 +1809,10 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn guard_payment_against_blocklist<'a>(
&'a self,
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
- blocklist_utils::validate_data_for_blocklist(state, platform, payment_data).await
+ blocklist_utils::validate_data_for_blocklist(state, processor, payment_data).await
}
#[instrument(skip_all)]
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 925f383c0b..14fa02d068 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -526,7 +526,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsConfirmIntentRequest, PaymentConf
&'a self,
state: &SessionState,
payment_data: &mut PaymentConfirmData<F>,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
business_profile: &domain::Profile,
connector_data: &api::ConnectorData,
) -> CustomResult<(), errors::ApiErrorResponse> {
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index d3b39ebf1b..762695384b 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -836,7 +836,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index ea00cf3c2d..74f83d29ad 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -293,7 +293,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsCreateIntentRequest, payments::Pa
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index ba0c75b47b..a2683acce9 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -214,7 +214,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsGetIntentRequest, payments::Payme
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index 633bf03c53..cb5006ca7c 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -252,7 +252,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsPostSessionTokensRequest, Pa
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index b6aadbb1dd..5ba79011a9 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -529,7 +529,7 @@ where
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index c83ca71f74..1e0ca8911d 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -370,7 +370,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsSessionRequest, payments::Payment
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index a0205a3ea4..90e635e7cb 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -395,7 +395,7 @@ where
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index e91964901d..35fdf112d2 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -164,7 +164,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 05e89fb15e..74908ce785 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -776,7 +776,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index 949b981991..010b67bb5a 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -486,7 +486,7 @@ impl<F: Clone + Send> Domain<F, PaymentsUpdateIntentRequest, payments::PaymentIn
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rs
index 7c57f2529a..d23ec5171d 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -238,7 +238,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsUpdateMetadataRequest, Payme
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
index 37e025fc4b..7c3331ae8e 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -280,7 +280,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsExtendAuthorizationRequest,
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index fa9031d6db..19045fbbbd 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -383,7 +383,7 @@ impl<F: Clone + Send + Sync>
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut payments::PaymentData<F>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
index 5c576429a3..e1fbc067b7 100644
--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -316,7 +316,7 @@ impl<F: Clone + Send + Sync> Domain<F, ProxyPaymentsRequest, PaymentConfirmData<
&'a self,
_state: &SessionState,
payment_data: &mut PaymentConfirmData<F>,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_business_profile: &domain::Profile,
connector_data: &api::ConnectorData,
) -> CustomResult<(), errors::ApiErrorResponse> {
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index fb3936118d..8728382e7c 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -371,7 +371,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsDynamicTaxCalculationRequest
async fn guard_payment_against_blocklist<'a>(
&'a self,
_state: &SessionState,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
diff --git a/crates/router/src/core/payments/session_operation.rs b/crates/router/src/core/payments/session_operation.rs
index 864029bc1b..36e84aa94e 100644
--- a/crates/router/src/core/payments/session_operation.rs
+++ b/crates/router/src/core/payments/session_operation.rs
@@ -197,7 +197,7 @@ where
// todo: call surcharge manager for session token call.
Box::pin(call_multiple_connectors_service(
state,
- &platform,
+ platform.get_processor(),
connectors,
&operation,
payment_data,
diff --git a/crates/router/src/core/payments/vault_session.rs b/crates/router/src/core/payments/vault_session.rs
index c03510d0a0..376c3c177f 100644
--- a/crates/router/src/core/payments/vault_session.rs
+++ b/crates/router/src/core/payments/vault_session.rs
@@ -81,7 +81,7 @@ where
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
external_vault_source,
)
.await?,
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 0cf5998196..09744ee2da 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -3142,9 +3142,8 @@ pub async fn make_payout_data(
Some(
payment_helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
connector_name.as_str(),
payout_attempt.merchant_connector_id.as_ref(),
@@ -3428,9 +3427,8 @@ pub async fn get_mca_from_profile_id(
) -> RouterResult<payment_helpers::MerchantConnectorAccountType> {
let merchant_connector_account = payment_helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
profile_id,
connector_name,
merchant_connector_id,
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index fd4f0b7fcc..dafccfa824 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -194,9 +194,8 @@ pub async fn trigger_refund_to_gateway(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
creds_identifier.as_deref(),
- platform.get_processor().get_key_store(),
profile_id,
&routed_through,
payment_attempt.merchant_connector_id.as_ref(),
@@ -840,9 +839,8 @@ pub async fn sync_refund_with_gateway(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
creds_identifier.as_deref(),
- platform.get_processor().get_key_store(),
profile_id,
&connector_id,
payment_attempt.merchant_connector_id.as_ref(),
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index f6a38e03a6..ec1dea2675 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -1090,7 +1090,7 @@ pub async fn authentication_eligibility_core(
let (authentication_connector, three_ds_connector_account) =
auth_utils::get_authentication_connector_data(
&state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
&business_profile,
authentication.authentication_connector.clone(),
)
@@ -1298,7 +1298,7 @@ pub async fn authentication_authenticate_core(
let (authentication_connector, three_ds_connector_account) =
auth_utils::get_authentication_connector_data(
&state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
&business_profile,
authentication.authentication_connector.clone(),
)
@@ -1759,7 +1759,7 @@ pub async fn authentication_sync_core(
let (authentication_connector, three_ds_connector_account) =
auth_utils::get_authentication_connector_data(
&state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
&business_profile,
authentication.authentication_connector.clone(),
)
@@ -2102,7 +2102,7 @@ pub async fn authentication_post_sync_core(
let (authentication_connector, three_ds_connector_account) =
auth_utils::get_authentication_connector_data(
&state,
- platform.get_processor().get_key_store(),
+ platform.get_processor(),
&business_profile,
authentication.authentication_connector.clone(),
)
@@ -2235,8 +2235,7 @@ pub async fn authentication_session_core(
if let Some(value) = business_profile.authentication_product_ids.clone() {
let session_token = get_session_token_for_click_to_pay(
&state,
- platform.get_processor().get_account().get_id(),
- &platform,
+ platform.get_processor(),
value,
&authentication,
)
@@ -2258,8 +2257,7 @@ pub async fn authentication_session_core(
#[cfg(feature = "v1")]
pub async fn get_session_token_for_click_to_pay(
state: &SessionState,
- merchant_id: &common_utils::id_type::MerchantId,
- platform: &domain::Platform,
+ processor: &domain::Processor,
authentication_product_ids: common_types::payments::AuthenticationConnectorAccountMap,
authentication: &hyperswitch_domain_models::authentication::Authentication,
) -> RouterResult<api_models::authentication::AuthenticationSessionToken> {
@@ -2273,9 +2271,9 @@ pub async fn get_session_token_for_click_to_pay(
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
- merchant_id,
+ processor.get_account().get_id(),
&click_to_pay_mca_id,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
)
.await
.to_not_found_response(ApiErrorResponse::MerchantConnectorAccountNotFound {
@@ -2313,9 +2311,9 @@ pub async fn get_session_token_for_click_to_pay(
common_utils::type_name!(Authentication),
domain::types::CryptoOperation::DecryptOptional(inner),
common_utils::types::keymanager::Identifier::Merchant(
- platform.get_processor().get_key_store().merchant_id.clone(),
+ processor.get_key_store().merchant_id.clone(),
),
- platform.get_processor().get_key_store().key.peek(),
+ processor.get_key_store().key.peek(),
)
.await
.and_then(|val| val.try_into_optionaloperation())
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 63eaf0737a..fb601f5347 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -967,9 +967,8 @@ pub async fn construct_accept_dispute_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
&dispute.connector,
payment_attempt.merchant_connector_id.as_ref(),
@@ -1078,9 +1077,8 @@ pub async fn construct_submit_evidence_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
connector_id,
payment_attempt.merchant_connector_id.as_ref(),
@@ -1187,9 +1185,8 @@ pub async fn construct_upload_file_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
connector_id,
payment_attempt.merchant_connector_id.as_ref(),
@@ -1376,9 +1373,8 @@ pub async fn construct_dispute_sync_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
connector_id,
payment_attempt.merchant_connector_id.as_ref(),
@@ -1617,9 +1613,8 @@ pub async fn construct_defend_dispute_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
&profile_id,
connector_id,
payment_attempt.merchant_connector_id.as_ref(),
@@ -1725,9 +1720,8 @@ pub async fn construct_retrieve_file_router_data<'a>(
let merchant_connector_account = helpers::get_merchant_connector_account(
state,
- platform.get_processor().get_account().get_id(),
+ platform.get_processor(),
None,
- platform.get_processor().get_key_store(),
profile_id,
connector_id,
file_metadata.merchant_connector_id.as_ref(),