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(core): pass `profile_id` to core from auth layer (#5532)

Hrithikesh95e9c8523544
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 17745517b6..1017391440 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -4686,6 +4686,7 @@ where
pub async fn list_countries_currencies_for_connector_payment_method(
state: routes::SessionState,
req: ListCountriesCurrenciesRequest,
+ _profile_id: Option<String>,
) -> errors::RouterResponse<ListCountriesCurrenciesResponse> {
Ok(services::ApplicationResponse::Json(
list_countries_currencies_for_connector_payment_method_util(
diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index c5bb43f12c..9294b8f83e 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -12,6 +12,7 @@ pub async fn verify_merchant_creds_for_applepay(
state: SessionState,
body: verifications::ApplepayMerchantVerificationRequest,
merchant_id: common_utils::id_type::MerchantId,
+ _profile_id: Option<String>,
) -> CustomResult<services::ApplicationResponse<ApplepayMerchantResponse>, errors::ApiErrorResponse>
{
let applepay_merchant_configs = state.conf.applepay_merchant_configs.get_inner();
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index 182f5cc237..bb72112c88 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -64,7 +64,13 @@ pub async fn customers_retrieve(
&req,
payload,
|state, auth, req, _| {
- retrieve_customer(state, auth.merchant_account, None, auth.key_store, req)
+ retrieve_customer(
+ state,
+ auth.merchant_account,
+ auth.profile_id,
+ auth.key_store,
+ req,
+ )
},
&*auth,
api_locking::LockAction::NotApplicable,
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index f55f6c80e7..f11e5e4c55 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -510,8 +510,12 @@ pub async fn list_countries_currencies_for_connector_payment_method(
state,
&req,
payload,
- |state, _auth: auth::AuthenticationData, req, _| {
- cards::list_countries_currencies_for_connector_payment_method(state, req)
+ |state, auth: auth::AuthenticationData, req, _| {
+ cards::list_countries_currencies_for_connector_payment_method(
+ state,
+ req,
+ auth.profile_id,
+ )
},
#[cfg(not(feature = "release"))]
auth::auth_type(
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 4c5af4acd5..a4db90f28b 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -130,7 +130,7 @@ pub async fn payments_create(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
HeaderPayload::default(),
req,
@@ -423,7 +423,7 @@ pub async fn payments_update(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
HeaderPayload::default(),
req,
@@ -502,7 +502,7 @@ pub async fn payments_confirm(
state,
req_state,
auth.merchant_account,
- None,
+ auth.profile_id,
auth.key_store,
header_payload.clone(),
req,
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index 4199340879..d064da0517 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -22,11 +22,12 @@ pub async fn apple_pay_merchant_registration(
state,
&req,
json_payload.into_inner(),
- |state, _, body, _| {
+ |state, auth, body, _| {
verification::verify_merchant_creds_for_applepay(
state.clone(),
body,
merchant_id.clone(),
+ auth.profile_id,
)
},
auth::auth_type(
diff --git a/crates/router/src/routes/verify_connector.rs b/crates/router/src/routes/verify_connector.rs
index 74b115e620..b510ba2963 100644
--- a/crates/router/src/routes/verify_connector.rs
+++ b/crates/router/src/routes/verify_connector.rs
@@ -20,7 +20,9 @@ pub async fn payment_connector_verify(
state,
&req,
json_payload.into_inner(),
- |state, _: (), req, _| verify_connector::verify_connector_credentials(state, req, None),
+ |state, auth: auth::AuthenticationData, req, _| {
+ verify_connector::verify_connector_credentials(state, req, auth.profile_id)
+ },
&auth::JWTAuth(Permission::MerchantConnectorAccountWrite),
api_locking::LockAction::NotApplicable,
))