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

refactor(platform): implement processor context to remaining payment functions (#11353)

Ankit Kumar Guptabd8c6b2efe25
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 68c0ce9e0e..61ec8ed00a 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -556,7 +556,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -612,7 +612,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -674,7 +674,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -726,7 +726,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -782,7 +782,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -844,7 +844,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -1181,7 +1181,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -1231,7 +1231,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -1277,7 +1277,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -1344,7 +1344,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -1381,7 +1381,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -1423,7 +1423,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -3759,7 +3759,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -3799,7 +3799,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -3835,7 +3835,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -3879,7 +3879,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -3929,7 +3929,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -3975,7 +3975,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -4010,7 +4010,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::MerchantAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -4160,7 +4160,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::OrganizationAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -4203,7 +4203,7 @@ pub mod routes {
},
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
diff --git a/crates/router/src/core/debit_routing.rs b/crates/router/src/core/debit_routing.rs
index 513b1a0a19..c1b9730dee 100644
--- a/crates/router/src/core/debit_routing.rs
+++ b/crates/router/src/core/debit_routing.rs
@@ -286,7 +286,10 @@ where
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let db = state.store.as_ref();
- let merchant_id = payment_data.get_payment_attempt().merchant_id.clone();
+ let processor_merchant_id = payment_data
+ .get_payment_attempt()
+ .processor_merchant_id
+ .clone();
let profile_id = payment_data.get_payment_attempt().profile_id.clone();
if debit_routing_supported_connectors.contains(&connector_data.connector_data.connector_name) {
@@ -302,7 +305,7 @@ where
let key_store = db
.get_merchant_key_store_by_merchant_id(
- &merchant_id,
+ &processor_merchant_id,
&db.get_master_key().to_vec().into(),
)
.await
@@ -552,7 +555,10 @@ where
{
let db = state.store.as_ref();
let profile_id = payment_data.get_payment_attempt().profile_id.clone();
- let merchant_id = payment_data.get_payment_attempt().merchant_id.clone();
+ let processor_merchant_id = payment_data
+ .get_payment_attempt()
+ .processor_merchant_id
+ .clone();
let is_any_debit_routing_connector_supported =
connector_data_list.iter().any(|connector_data| {
debit_routing_supported_connectors
@@ -564,7 +570,7 @@ where
get_debit_routing_output::<F, D>(state, payment_data, acquirer_country).await?;
let key_store = db
.get_merchant_key_store_by_merchant_id(
- &merchant_id,
+ &processor_merchant_id,
&db.get_master_key().to_vec().into(),
)
.await
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index c1adc48332..965293f55d 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -734,8 +734,13 @@ where
.as_ref()
.and_then(|customer| customer.connector_customer.as_ref());
- let authentication_type =
- call_decision_manager(state, platform, &business_profile, &payment_data).await?;
+ let authentication_type = call_decision_manager(
+ state,
+ platform.get_processor(),
+ &business_profile,
+ &payment_data,
+ )
+ .await?;
payment_data.set_authentication_type_in_attempt(authentication_type);
@@ -748,7 +753,7 @@ where
&operation,
state,
&req,
- platform,
+ platform.get_processor(),
&business_profile,
&mut payment_data,
eligible_connectors,
@@ -1536,7 +1541,7 @@ where
let connector_choice = operation
.to_domain()?
.get_connector(
- &platform,
+ platform.get_processor(),
&state.clone(),
&req,
payment_data.get_payment_intent(),
@@ -2054,7 +2059,7 @@ where
#[cfg(feature = "v1")]
pub async fn call_decision_manager<F, D>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
_business_profile: &domain::Profile,
payment_data: &D,
) -> RouterResult<Option<enums::AuthenticationType>>
@@ -2073,8 +2078,7 @@ where
payment_data.get_recurring_details(),
payment_data.get_currency(),
);
- let algorithm_ref: api::routing::RoutingAlgorithmRef = platform
- .get_processor()
+ let algorithm_ref: api::routing::RoutingAlgorithmRef = processor
.get_account()
.routing_algorithm
.clone()
@@ -2087,7 +2091,7 @@ where
let output = perform_decision_management(
state,
algorithm_ref,
- platform.get_processor().get_account().get_id(),
+ processor.get_account().get_id(),
&payment_dsl_data,
)
.await
@@ -9233,7 +9237,7 @@ pub async fn choose_connector<F, Req, D>(
operation: &BoxedOperation<'_, F, Req, D>,
state: &SessionState,
req: &Req,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut D,
eligible_connectors: Option<Vec<enums::RoutableConnectors>>,
@@ -9246,7 +9250,7 @@ where
let connector_choice = operation
.to_domain()?
.get_connector(
- platform,
+ processor,
&state.clone(),
req,
payment_data.get_payment_intent(),
@@ -9286,7 +9290,7 @@ where
api::ConnectorChoice::SessionMultiple(connectors) => {
let routing_output = perform_session_token_routing(
state.clone(),
- platform,
+ processor,
business_profile,
payment_data,
connectors,
@@ -9301,7 +9305,7 @@ where
api::ConnectorChoice::StraightThrough(straight_through) => {
perform_routing_for_connector_selection(
state,
- platform,
+ processor,
business_profile,
payment_data,
Some(straight_through),
@@ -9316,7 +9320,7 @@ where
api::ConnectorChoice::Decide => {
perform_routing_for_connector_selection(
state,
- platform,
+ processor,
business_profile,
payment_data,
None,
@@ -9514,7 +9518,7 @@ where
#[allow(clippy::too_many_arguments)]
pub async fn perform_routing_for_connector_selection<F, D>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut D,
request_straight_through: Option<serde_json::Value>,
@@ -9559,7 +9563,7 @@ where
let decided_connector = decide_connector(
state.clone(),
- platform,
+ processor,
business_profile,
payment_data,
request_straight_through,
@@ -9751,7 +9755,7 @@ pub async fn decide_connector(
#[cfg(feature = "v1")]
pub async fn decide_connector<F, D>(
state: SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut D,
request_straight_through: Option<api::routing::StraightThroughAlgorithm>,
@@ -9786,7 +9790,7 @@ where
// Check if pre_routing connector is present
routing::try_pre_routing_connectors::<F, D>(
&state,
- platform,
+ processor,
business_profile,
payment_data,
routing_data,
@@ -9902,7 +9906,7 @@ where
let final_connectors = if requires_eligibility {
routing::perform_eligibility_analysis_with_fallback(
&state,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
connectors.clone(),
&txn,
eligible_connectors.clone(),
@@ -10568,7 +10572,7 @@ pub fn should_add_task_to_process_tracker<F: Clone, D: OperationSessionGetters<F
#[allow(clippy::too_many_arguments)]
pub async fn perform_session_token_routing<F, D>(
state: SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut D,
connectors: api::SessionConnectorDatas,
@@ -10582,18 +10586,17 @@ where
{
let chosen = connectors.apply_filter_for_session_routing();
- let active_mca_ids =
- routing::get_active_mca_ids(&state, platform.get_processor().get_key_store())
- .await
- .change_context(errors::ApiErrorResponse::GenericNotFoundError {
- message: "Active mca_ids not found".to_string(),
- })?;
+ let active_mca_ids = routing::get_active_mca_ids(&state, processor.get_key_store())
+ .await
+ .change_context(errors::ApiErrorResponse::GenericNotFoundError {
+ message: "Active mca_ids not found".to_string(),
+ })?;
let session_input = routing::SessionRoutingInput {
state: &state,
business_profile,
- key_store: platform.get_processor().get_key_store(),
- merchant_account: platform.get_processor().get_account(),
+ key_store: processor.get_key_store(),
+ merchant_account: processor.get_account(),
transaction_type: &transaction_type,
chosen: &chosen,
active_mca_ids: &active_mca_ids,
@@ -10779,7 +10782,7 @@ pub async fn static_dynamic_routing_v1_for_payments(
#[allow(clippy::too_many_arguments)]
pub async fn route_connector_v1_for_payouts(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
transaction_data: &payouts::PayoutData,
routing_data: &mut storage::RoutingData,
@@ -10793,7 +10796,7 @@ pub async fn route_connector_v1_for_payouts(
#[allow(clippy::too_many_arguments)]
pub async fn route_connector_v1_for_payouts(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
transaction_data: &payouts::PayoutData,
routing_data: &mut storage::RoutingData,
@@ -10813,7 +10816,7 @@ pub async fn route_connector_v1_for_payouts(
let (connectors, _) = routing::perform_static_routing_v1(
state,
- platform.get_processor().get_account().get_id(),
+ processor.get_account().get_id(),
routing_algorithm_id.as_ref(),
business_profile,
&TransactionData::Payout(transaction_data),
@@ -10822,7 +10825,7 @@ pub async fn route_connector_v1_for_payouts(
.change_context(errors::ApiErrorResponse::InternalServerError)?;
let connectors = routing::perform_eligibility_analysis_with_fallback(
&state.clone(),
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
connectors,
&TransactionData::Payout(transaction_data),
eligible_connectors,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 3e4272251a..e272b3608a 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -6288,7 +6288,7 @@ pub fn get_debit_routing_savings_amount(
#[cfg(all(feature = "retry", feature = "v1"))]
pub async fn get_apple_pay_retryable_connectors(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
creds_identifier: Option<&str>,
pre_routing_connector_data_list: &[api::ConnectorRoutingData],
merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
@@ -6302,7 +6302,7 @@ pub async fn get_apple_pay_retryable_connectors(
let merchant_connector_account_type = get_merchant_connector_account(
state,
- platform.get_processor(),
+ processor,
creds_identifier,
profile_id,
&pre_decided_connector_data_first
@@ -6322,9 +6322,9 @@ pub async fn get_apple_pay_retryable_connectors(
let merchant_connector_account_list = state
.store
.find_merchant_connector_account_by_merchant_id_and_disabled_list(
- platform.get_processor().get_account().get_id(),
+ processor.get_account().get_id(),
false,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 9085268e06..3c965a2c0d 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -361,7 +361,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
#[cfg(feature = "v1")]
async fn get_connector<'a>(
&'a self,
- platform: &domain::Platform,
+ processor: &domain::Processor,
state: &SessionState,
request: &R,
payment_intent: &storage::PaymentIntent,
@@ -683,7 +683,7 @@ where
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsRetrieveRequest,
_payment_intent: &storage::PaymentIntent,
@@ -788,7 +788,7 @@ where
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsCaptureRequest,
_payment_intent: &storage::PaymentIntent,
@@ -877,7 +877,7 @@ where
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsCancelRequest,
_payment_intent: &storage::PaymentIntent,
@@ -960,7 +960,7 @@ where
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsRejectRequest,
_payment_intent: &storage::PaymentIntent,
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 0f08e1a59e..455a8e2fa1 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
@@ -277,7 +277,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsCancelPostCaptureRequest, Pa
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsCancelPostCaptureRequest,
_payment_intent: &storage::PaymentIntent,
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 ab7311834b..5f2eebec6d 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -482,7 +482,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
request: &api::PaymentsRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index c14f1209f2..7b8e1b96f3 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -1311,7 +1311,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
request: &api::PaymentsRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index d289c3b8e9..b7d23b1f4e 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -941,7 +941,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
request: &api::PaymentsRequest,
_payment_intent: &storage::PaymentIntent,
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 ec0a170779..b4f6796208 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
@@ -237,7 +237,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsPostSessionTokensRequest, Pa
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsPostSessionTokensRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index fc5c826756..132d2977c7 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -395,7 +395,7 @@ where
/// or from separate implementation ( for googlepay - from metadata and applepay - from metadata and call connector)
async fn get_connector<'a>(
&'a self,
- platform: &domain::Platform,
+ processor: &domain::Processor,
state: &SessionState,
request: &api::PaymentsSessionRequest,
payment_intent: &storage::PaymentIntent,
@@ -404,9 +404,9 @@ where
let all_connector_accounts = db
.find_merchant_connector_account_by_merchant_id_and_disabled_list(
- platform.get_processor().get_account().get_id(),
+ processor.get_account().get_id(),
false,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 3ccb4a1424..46e632029e 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -352,7 +352,7 @@ where
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsStartRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 9fc9238994..eca77dafd0 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -139,7 +139,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
request: &api::PaymentsRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 548a5a0801..af33f0ab80 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -772,7 +772,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
request: &api::PaymentsRequest,
_payment_intent: &storage::PaymentIntent,
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 f40256a793..34163c27c5 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -243,7 +243,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsUpdateMetadataRequest, Payme
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsUpdateMetadataRequest,
_payment_intent: &storage::PaymentIntent,
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 a506c4308e..572ae4b49b 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -259,7 +259,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsExtendAuthorizationRequest,
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsExtendAuthorizationRequest,
_payment_intent: &storage::PaymentIntent,
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 5fbed65ef2..4d7281373c 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -373,7 +373,7 @@ impl<F: Clone + Send + Sync>
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &PaymentsIncrementalAuthorizationRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 45c7f2ce7e..78a64f2bdf 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -356,7 +356,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsDynamicTaxCalculationRequest
async fn get_connector<'a>(
&'a self,
- _platform: &domain::Platform,
+ _processor: &domain::Processor,
state: &SessionState,
_request: &api::PaymentsDynamicTaxCalculationRequest,
_payment_intent: &storage::PaymentIntent,
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index c8b8b5cad2..ddc737e2a9 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -1149,7 +1149,7 @@ pub struct PreRoutingInput<'a> {
&'a Option<HashMap<api_enums::PaymentMethodType, PreRoutingConnectorChoice>>,
pub payment_method_type: &'a storage_enums::PaymentMethodType,
pub connectors: &'a hyperswitch_interfaces::configs::Connectors,
- pub platform: &'a domain::Platform,
+ pub processor: &'a domain::Processor,
pub business_profile: &'a domain::Profile,
pub creds_identifier: Option<&'a str>,
}
@@ -1280,7 +1280,7 @@ where
#[cfg(feature = "v1")]
pub async fn try_pre_routing_connectors<F, D>(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
business_profile: &domain::Profile,
payment_data: &mut D,
routing_data: &mut RoutingData,
@@ -1303,7 +1303,7 @@ where
pre_routing_results: &routing_data.routing_info.pre_routing_results,
payment_method_type,
connectors: &state.conf.connectors,
- platform,
+ processor,
business_profile,
creds_identifier: payment_data.get_creds_identifier(),
};
@@ -1317,7 +1317,7 @@ where
{
let should_do_retry = crate::core::payments::retry::config_should_call_gsm(
&*state.store,
- platform.get_processor().get_account().get_id(),
+ processor.get_account().get_id(),
business_profile,
)
.await;
@@ -1329,7 +1329,7 @@ where
let retryable_connector_data =
crate::core::payments::helpers::get_apple_pay_retryable_connectors(
state,
- platform,
+ processor,
payment_data.get_creds_identifier(),
&connectors.clone(),
first_connector
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 11b2b47f57..28ea005bf5 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -98,7 +98,7 @@ pub fn get_next_connector(
#[cfg(all(feature = "payouts", feature = "v1"))]
pub async fn get_connector_choice(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
connector: Option<String>,
routing_algorithm: Option<serde_json::Value>,
payout_data: &mut PayoutData,
@@ -135,7 +135,7 @@ pub async fn get_connector_choice(
};
helpers::decide_payout_connector(
state,
- platform,
+ processor,
Some(request_straight_through),
&mut routing_data,
payout_data,
@@ -156,7 +156,7 @@ pub async fn get_connector_choice(
};
helpers::decide_payout_connector(
state,
- platform,
+ processor,
None,
&mut routing_data,
payout_data,
@@ -279,7 +279,7 @@ pub async fn payouts_core(
// Form connector data
let connector_call_type = get_connector_choice(
state,
- platform,
+ platform.get_processor(),
payout_attempt.connector.clone(),
routing_algorithm,
payout_data,
@@ -527,7 +527,7 @@ pub async fn payouts_retrieve_core(
// Form connector data
let connector_call_type = get_connector_choice(
&state,
- &platform,
+ platform.get_processor(),
payout_attempt.connector.clone(),
None,
&mut payout_data,
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 66f13e1648..80c1eaad4f 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -937,7 +937,7 @@ pub(super) async fn get_or_create_customer_details(
#[cfg(all(feature = "payouts", feature = "v1"))]
pub async fn decide_payout_connector(
state: &SessionState,
- platform: &domain::Platform,
+ processor: &domain::Processor,
request_straight_through: Option<api::routing::StraightThroughAlgorithm>,
routing_data: &mut storage::RoutingData,
payout_data: &mut PayoutData,
@@ -963,7 +963,7 @@ pub async fn decide_payout_connector(
// Validate and get the business_profile from payout_attempt
let business_profile = core_utils::validate_and_get_business_profile(
state.store.as_ref(),
- platform.get_processor(),
+ processor,
Some(&payout_attempt.profile_id),
)
.await?
@@ -979,7 +979,7 @@ pub async fn decide_payout_connector(
if check_eligibility {
connectors = routing::perform_eligibility_analysis_with_fallback(
state,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
connectors,
&TransactionData::Payout(payout_data),
eligible_connectors,
@@ -1028,7 +1028,7 @@ pub async fn decide_payout_connector(
if check_eligibility {
connectors = routing::perform_eligibility_analysis_with_fallback(
state,
- platform.get_processor().get_key_store(),
+ processor.get_key_store(),
connectors,
&TransactionData::Payout(payout_data),
eligible_connectors,
@@ -1071,7 +1071,7 @@ pub async fn decide_payout_connector(
// 4. Route connector
route_connector_v1_for_payouts(
state,
- platform,
+ processor,
&payout_data.business_profile,
payout_data,
routing_data,
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index cdafbb0228..ed47eca33d 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -758,7 +758,7 @@ pub async fn retrieve_surcharge_decision_manager_config(
}),
&auth::JWTAuth {
permission: Permission::MerchantSurchargeDecisionManagerRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -766,7 +766,7 @@ pub async fn retrieve_surcharge_decision_manager_config(
#[cfg(feature = "release")]
&auth::JWTAuth {
permission: Permission::MerchantSurchargeDecisionManagerRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,
@@ -966,7 +966,7 @@ pub async fn retrieve_decision_manager_config(
}),
&auth::JWTAuth {
permission: Permission::MerchantThreeDsDecisionManagerRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
req.headers(),
@@ -974,7 +974,7 @@ pub async fn retrieve_decision_manager_config(
#[cfg(feature = "release")]
&auth::JWTAuth {
permission: Permission::MerchantThreeDsDecisionManagerRead,
- allow_connected: false,
+ allow_connected: true,
allow_platform: false,
},
api_locking::LockAction::NotApplicable,