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): accept business profile in core functions for payments, refund, payout and disputes (#5498)

Hrithikeshfb32b61edfa2
diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index c9881647ed..4acace4b18 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -63,6 +63,7 @@ pub async fn payment_intents_create(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentCreate,
req,
@@ -123,6 +124,7 @@ pub async fn payment_intents_retrieve(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentStatus,
payload,
@@ -193,6 +195,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentStatus,
req,
@@ -259,6 +262,7 @@ pub async fn payment_intents_update(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentUpdate,
req,
@@ -331,6 +335,7 @@ pub async fn payment_intents_confirm(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentConfirm,
req,
@@ -392,6 +397,7 @@ pub async fn payment_intents_capture(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentCapture,
payload,
@@ -457,6 +463,7 @@ pub async fn payment_intents_cancel(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentCancel,
req,
@@ -499,7 +506,7 @@ pub async fn payment_intent_list(
&req,
payload,
|state, auth, req, _| {
- payments::list_payments(state, auth.merchant_account, auth.key_store, req)
+ payments::list_payments(state, auth.merchant_account, None, auth.key_store, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
diff --git a/crates/router/src/compatibility/stripe/refunds.rs b/crates/router/src/compatibility/stripe/refunds.rs
index 071fdd839e..565cec5855 100644
--- a/crates/router/src/compatibility/stripe/refunds.rs
+++ b/crates/router/src/compatibility/stripe/refunds.rs
@@ -50,7 +50,7 @@ pub async fn refund_create(
&req,
create_refund_req,
|state, auth, req, _| {
- refunds::refund_create_core(state, auth.merchant_account, auth.key_store, req)
+ refunds::refund_create_core(state, auth.merchant_account, None, auth.key_store, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
@@ -97,6 +97,7 @@ pub async fn refund_retrieve_with_gateway_creds(
refunds::refund_response_wrapper(
state,
auth.merchant_account,
+ None,
auth.key_store,
refund_request,
refunds::refund_retrieve_core,
@@ -139,6 +140,7 @@ pub async fn refund_retrieve(
refunds::refund_response_wrapper(
state,
auth.merchant_account,
+ None,
auth.key_store,
refund_request,
refunds::refund_retrieve_core,
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index 28933e74bf..cfe0958d7d 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -64,6 +64,7 @@ pub async fn setup_intents_create(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentCreate,
req,
@@ -124,6 +125,7 @@ pub async fn setup_intents_retrieve(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentStatus,
payload,
@@ -196,6 +198,7 @@ pub async fn setup_intents_update(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentUpdate,
req,
@@ -269,6 +272,7 @@ pub async fn setup_intents_confirm(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentConfirm,
req,
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index 0584851e60..37f6d111de 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -26,6 +26,7 @@ use crate::{
pub async fn retrieve_dispute(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
req: disputes::DisputeId,
) -> RouterResponse<api_models::disputes::DisputeResponse> {
let dispute = state
@@ -43,6 +44,7 @@ pub async fn retrieve_dispute(
pub async fn retrieve_disputes_list(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
constraints: api_models::disputes::DisputeListConstraints,
) -> RouterResponse<Vec<api_models::disputes::DisputeResponse>> {
let disputes = state
@@ -62,6 +64,7 @@ pub async fn retrieve_disputes_list(
pub async fn accept_dispute(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
req: disputes::DisputeId,
) -> RouterResponse<dispute_models::DisputeResponse> {
@@ -164,6 +167,7 @@ pub async fn accept_dispute(
pub async fn submit_evidence(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
req: dispute_models::SubmitEvidenceRequest,
) -> RouterResponse<dispute_models::DisputeResponse> {
@@ -329,6 +333,7 @@ pub async fn submit_evidence(
pub async fn attach_evidence(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
attach_evidence_request: api::AttachEvidenceRequest,
) -> RouterResponse<files_api_models::CreateFileResponse> {
@@ -406,6 +411,7 @@ pub async fn attach_evidence(
pub async fn retrieve_dispute_evidence(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
req: disputes::DisputeId,
) -> RouterResponse<Vec<api_models::disputes::DisputeEvidenceBlock>> {
let dispute = state
diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
index ca7f110e89..41e4d25d37 100644
--- a/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
+++ b/crates/router/src/core/fraud_check/operation/fraud_check_post.rs
@@ -215,6 +215,7 @@ impl<F: Send + Clone> Domain<F> for FraudCheckPost {
state.clone(),
req_state.clone(),
merchant_account.clone(),
+ None,
key_store.clone(),
payments::PaymentCancel,
cancel_req,
@@ -270,6 +271,7 @@ impl<F: Send + Clone> Domain<F> for FraudCheckPost {
state.clone(),
req_state.clone(),
merchant_account.clone(),
+ None,
key_store.clone(),
payments::PaymentCapture,
capture_request,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index f1dce992d1..e2593ddd23 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -788,6 +788,7 @@ pub async fn payments_core<F, Res, Req, Op, FData>(
state: SessionState,
req_state: ReqState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
operation: Op,
req: Req,
@@ -998,6 +999,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
state.clone(),
req_state,
merchant_account,
+ None,
merchant_key_store,
payment_complete_authorize::CompleteAuthorize,
payment_confirm_req,
@@ -1129,6 +1131,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync {
state.clone(),
req_state,
merchant_account,
+ None,
merchant_key_store,
PaymentStatus,
payment_sync_req,
@@ -1286,6 +1289,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
state.clone(),
req_state,
merchant_account,
+ None,
merchant_key_store,
PaymentConfirm,
payment_confirm_req,
@@ -1316,6 +1320,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize {
state.clone(),
req_state,
merchant_account.clone(),
+ None,
merchant_key_store,
PaymentStatus,
payment_sync_req,
@@ -2866,6 +2871,7 @@ pub fn is_operation_complete_authorize<Op: Debug>(operation: &Op) -> bool {
pub async fn list_payments(
state: SessionState,
merchant: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
key_store: domain::MerchantKeyStore,
constraints: api::PaymentListConstraints,
) -> RouterResponse<api::PaymentListResponse> {
@@ -2938,6 +2944,7 @@ pub async fn list_payments(
pub async fn apply_filters_on_payments(
state: SessionState,
merchant: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
merchant_key_store: domain::MerchantKeyStore,
constraints: api::PaymentListFilterConstraints,
) -> RouterResponse<api::PaymentListResponseV2> {
@@ -3035,6 +3042,7 @@ pub async fn get_filters_for_payments(
pub async fn get_payment_filters(
state: SessionState,
merchant: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
) -> RouterResponse<api::PaymentListFiltersV2> {
let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) =
super::admin::list_payment_connectors(state, merchant.get_id().to_owned()).await?
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 3f6cfd1174..75756a9639 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -482,6 +482,7 @@ pub async fn payouts_update_core(
pub async fn payouts_retrieve_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
req: payouts::PayoutRetrieveRequest,
) -> RouterResponse<payouts::PayoutCreateResponse> {
@@ -707,6 +708,7 @@ pub async fn payouts_fulfill_core(
pub async fn payouts_list_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
key_store: domain::MerchantKeyStore,
constraints: payouts::PayoutListConstraints,
) -> RouterResponse<payouts::PayoutListResponse> {
@@ -805,6 +807,7 @@ pub async fn payouts_list_core(
pub async fn payouts_filtered_list_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
key_store: domain::MerchantKeyStore,
filters: payouts::PayoutListFilterConstraints,
) -> RouterResponse<payouts::PayoutListResponse> {
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index a6591c640d..5868b06217 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -47,6 +47,7 @@ use crate::{
pub async fn refund_create_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
req: refunds::RefundRequest,
) -> RouterResponse<refunds::RefundResponse> {
@@ -373,17 +374,24 @@ where
pub async fn refund_response_wrapper<'a, F, Fut, T, Req>(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
request: Req,
f: F,
) -> RouterResponse<refunds::RefundResponse>
where
- F: Fn(SessionState, domain::MerchantAccount, domain::MerchantKeyStore, Req) -> Fut,
+ F: Fn(
+ SessionState,
+ domain::MerchantAccount,
+ Option<String>,
+ domain::MerchantKeyStore,
+ Req,
+ ) -> Fut,
Fut: futures::Future<Output = RouterResult<T>>,
T: ForeignInto<refunds::RefundResponse>,
{
Ok(services::ApplicationResponse::Json(
- f(state, merchant_account, key_store, request)
+ f(state, merchant_account, profile_id, key_store, request)
.await?
.foreign_into(),
))
@@ -393,6 +401,7 @@ where
pub async fn refund_retrieve_core(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id: Option<String>,
key_store: domain::MerchantKeyStore,
request: refunds::RefundsRetrieveRequest,
) -> RouterResult<storage::Refund> {
@@ -856,6 +865,7 @@ pub async fn validate_and_create_refund(
pub async fn refund_list(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
req: api_models::refunds::RefundListRequest,
) -> RouterResponse<api_models::refunds::RefundListResponse> {
let db = state.store;
@@ -977,6 +987,7 @@ pub async fn refund_manual_update(
pub async fn get_filters_for_refunds(
state: SessionState,
merchant_account: domain::MerchantAccount,
+ _profile_id_list: Option<Vec<String>>,
) -> RouterResponse<api_models::refunds::RefundListFilters> {
let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) =
super::admin::list_payment_connectors(state, merchant_account.get_id().to_owned()).await?
@@ -1157,6 +1168,7 @@ pub async fn sync_refund_with_gateway_workflow(
let response = Box::pin(refund_retrieve_core(
state.clone(),
merchant_account,
+ None,
key_store,
refunds::RefundsRetrieveRequest {
refund_id: refund_core.refund_internal_reference_id,
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 86ac8d49d6..22d295b116 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -544,6 +544,7 @@ async fn payments_incoming_webhook_flow(
state.clone(),
req_state,
merchant_account.clone(),
+ None,
key_store.clone(),
payments::operations::PaymentStatus,
api::PaymentsRetrieveRequest {
@@ -824,6 +825,7 @@ async fn refunds_incoming_webhook_flow(
Box::pin(refunds::refund_retrieve_core(
state.clone(),
merchant_account.clone(),
+ None,
key_store.clone(),
api_models::refunds::RefundsRetrieveRequest {
refund_id: refund_id.to_owned(),
@@ -1075,6 +1077,7 @@ async fn external_authentication_incoming_webhook_flow(
state.clone(),
req_state,
merchant_account.clone(),
+ None,
key_store.clone(),
payments::PaymentConfirm,
payment_confirm_req,
@@ -1268,6 +1271,7 @@ async fn frm_incoming_webhook_flow(
state.clone(),
req_state,
merchant_account.clone(),
+ None,
key_store.clone(),
payments::PaymentApprove,
api::PaymentsCaptureRequest {
@@ -1293,6 +1297,7 @@ async fn frm_incoming_webhook_flow(
state.clone(),
req_state,
merchant_account.clone(),
+ None,
key_store.clone(),
payments::PaymentReject,
api::PaymentsCancelRequest {
@@ -1459,6 +1464,7 @@ async fn bank_transfer_webhook_flow(
state.clone(),
req_state,
merchant_account.to_owned(),
+ None,
key_store.clone(),
payments::PaymentConfirm,
request,
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index 1c2377952a..3eed0591db 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -43,7 +43,7 @@ pub async fn retrieve_dispute(
state,
&req,
dispute_id,
- |state, auth, req, _| disputes::retrieve_dispute(state, auth.merchant_account, req),
+ |state, auth, req, _| disputes::retrieve_dispute(state, auth.merchant_account, None, req),
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::DisputeRead),
@@ -90,7 +90,9 @@ pub async fn retrieve_disputes_list(
state,
&req,
payload,
- |state, auth, req, _| disputes::retrieve_disputes_list(state, auth.merchant_account, req),
+ |state, auth, req, _| {
+ disputes::retrieve_disputes_list(state, auth.merchant_account, None, req)
+ },
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::DisputeRead),
@@ -131,7 +133,7 @@ pub async fn accept_dispute(
&req,
dispute_id,
|state, auth, req, _| {
- disputes::accept_dispute(state, auth.merchant_account, auth.key_store, req)
+ disputes::accept_dispute(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -168,7 +170,7 @@ pub async fn submit_dispute_evidence(
&req,
json_payload.into_inner(),
|state, auth, req, _| {
- disputes::submit_evidence(state, auth.merchant_account, auth.key_store, req)
+ disputes::submit_evidence(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -213,7 +215,7 @@ pub async fn attach_dispute_evidence(
&req,
attach_evidence_request,
|state, auth, req, _| {
- disputes::attach_evidence(state, auth.merchant_account, auth.key_store, req)
+ disputes::attach_evidence(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -256,7 +258,7 @@ pub async fn retrieve_dispute_evidence(
&req,
dispute_id,
|state, auth, req, _| {
- disputes::retrieve_dispute_evidence(state, auth.merchant_account, req)
+ disputes::retrieve_dispute_evidence(state, auth.merchant_account, None, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 9f6c35cacd..58d331d0fe 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -200,6 +200,7 @@ pub async fn payments_start(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::operations::PaymentStart,
req,
@@ -275,6 +276,7 @@ pub async fn payments_retrieve(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentStatus,
req,
@@ -348,6 +350,7 @@ pub async fn payments_retrieve_with_gateway_creds(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentStatus,
req,
@@ -555,6 +558,7 @@ pub async fn payments_capture(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentCapture,
payload,
@@ -624,6 +628,7 @@ pub async fn payments_connector_session(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentSession,
payload,
@@ -856,6 +861,7 @@ pub async fn payments_complete_authorize(
state.clone(),
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::operations::payment_complete_authorize::CompleteAuthorize,
payment_confirm_req.clone(),
@@ -915,6 +921,7 @@ pub async fn payments_cancel(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentCancel,
req,
@@ -969,7 +976,7 @@ pub async fn payments_list(
&req,
payload,
|state, auth, req, _| {
- payments::list_payments(state, auth.merchant_account, auth.key_store, req)
+ payments::list_payments(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -995,7 +1002,13 @@ pub async fn payments_list_by_filter(
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
- payments::apply_filters_on_payments(state, auth.merchant_account, auth.key_store, req)
+ payments::apply_filters_on_payments(
+ state,
+ auth.merchant_account,
+ None,
+ auth.key_store,
+ req,
+ )
},
&auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
@@ -1038,7 +1051,7 @@ pub async fn get_payment_filters(
&req,
(),
|state, auth: auth::AuthenticationData, _, _| {
- payments::get_payment_filters(state, auth.merchant_account)
+ payments::get_payment_filters(state, auth.merchant_account, None)
},
&auth::JWTAuth(Permission::PaymentRead),
api_locking::LockAction::NotApplicable,
@@ -1075,6 +1088,7 @@ pub async fn payments_approve(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentApprove,
payment_types::PaymentsCaptureRequest {
@@ -1129,6 +1143,7 @@ pub async fn payments_reject(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentReject,
payment_types::PaymentsCancelRequest {
@@ -1196,6 +1211,7 @@ where
state,
req_state,
merchant_account,
+ None,
key_store,
operation,
req,
@@ -1216,6 +1232,7 @@ where
state,
req_state,
merchant_account,
+ None,
key_store,
operation,
req,
@@ -1278,6 +1295,7 @@ pub async fn payments_incremental_authorization(
state,
req_state,
auth.merchant_account,
+ None,
auth.key_store,
payments::PaymentIncrementalAuthorization,
req,
diff --git a/crates/router/src/routes/payouts.rs b/crates/router/src/routes/payouts.rs
index d32aa0da3e..18ba815551 100644
--- a/crates/router/src/routes/payouts.rs
+++ b/crates/router/src/routes/payouts.rs
@@ -80,7 +80,7 @@ pub async fn payouts_retrieve(
&req,
payout_retrieve_request,
|state, auth, req, _| {
- payouts_retrieve_core(state, auth.merchant_account, auth.key_store, req)
+ payouts_retrieve_core(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
@@ -272,7 +272,9 @@ pub async fn payouts_list(
state,
&req,
payload,
- |state, auth, req, _| payouts_list_core(state, auth.merchant_account, auth.key_store, req),
+ |state, auth, req, _| {
+ payouts_list_core(state, auth.merchant_account, None, auth.key_store, req)
+ },
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::PayoutRead),
@@ -311,7 +313,7 @@ pub async fn payouts_list_by_filter(
&req,
payload,
|state, auth, req, _| {
- payouts_filtered_list_core(state, auth.merchant_account, auth.key_store, req)
+ payouts_filtered_list_core(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index 013ed06497..e0b1e0786f 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -36,7 +36,9 @@ pub async fn refunds_create(
state,
&req,
json_payload.into_inner(),
- |state, auth, req, _| refund_create_core(state, auth.merchant_account, auth.key_store, req),
+ |state, auth, req, _| {
+ refund_create_core(state, auth.merchant_account, None, auth.key_store, req)
+ },
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::RefundWrite),
@@ -92,6 +94,7 @@ pub async fn refunds_retrieve(
refund_response_wrapper(
state,
auth.merchant_account,
+ None,
auth.key_store,
refund_request,
refund_retrieve_core,
@@ -143,6 +146,7 @@ pub async fn refunds_retrieve_with_body(
refund_response_wrapper(
state,
auth.merchant_account,
+ None,
auth.key_store,
req,
refund_retrieve_core,
@@ -220,7 +224,7 @@ pub async fn refunds_list(
state,
&req,
payload.into_inner(),
- |state, auth, req, _| refund_list(state, auth.merchant_account, req),
+ |state, auth, req, _| refund_list(state, auth.merchant_account, None, req),
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::RefundRead),
@@ -291,7 +295,7 @@ pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -
state,
&req,
(),
- |state, auth, _, _| get_filters_for_refunds(state, auth.merchant_account),
+ |state, auth, _, _| get_filters_for_refunds(state, auth.merchant_account, None),
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth(Permission::RefundRead),
diff --git a/crates/router/src/workflows/outgoing_webhook_retry.rs b/crates/router/src/workflows/outgoing_webhook_retry.rs
index 5334e4e93a..df9f00a2e0 100644
--- a/crates/router/src/workflows/outgoing_webhook_retry.rs
+++ b/crates/router/src/workflows/outgoing_webhook_retry.rs
@@ -371,6 +371,7 @@ async fn get_outgoing_webhook_content_and_event_type(
state,
req_state,
merchant_account,
+ None,
key_store,
PaymentStatus,
request,
@@ -417,6 +418,7 @@ async fn get_outgoing_webhook_content_and_event_type(
let refund = Box::pin(refund_retrieve_core(
state,
merchant_account,
+ None,
key_store,
request,
))
@@ -436,7 +438,7 @@ async fn get_outgoing_webhook_content_and_event_type(
let request = DisputeId { dispute_id };
let dispute_response =
- match retrieve_dispute(state, merchant_account, request).await? {
+ match retrieve_dispute(state, merchant_account, None, request).await? {
ApplicationResponse::Json(dispute_response)
| ApplicationResponse::JsonWithHeaders((dispute_response, _)) => {
Ok(dispute_response)
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index 8a5235a536..0f5dbf286a 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -385,6 +385,7 @@ async fn payments_create_core() {
state.clone(),
state.get_req_state(),
merchant_account,
+ None,
key_store,
payments::PaymentCreate,
req,
@@ -571,6 +572,7 @@ async fn payments_create_core_adyen_no_redirect() {
state.clone(),
state.get_req_state(),
merchant_account,
+ None,
key_store,
payments::PaymentCreate,
req,
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index aa984b9a0e..f5497b4293 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -145,6 +145,7 @@ async fn payments_create_core() {
state.clone(),
state.get_req_state(),
merchant_account,
+ None,
key_store,
payments::PaymentCreate,
req,
@@ -339,6 +340,7 @@ async fn payments_create_core_adyen_no_redirect() {
state.clone(),
state.get_req_state(),
merchant_account,
+ None,
key_store,
payments::PaymentCreate,
req,