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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(core): accept profile_id in merchant_account, connectors and customers core functions (#5505)
Hrithikesha3e01bb4ae58
diff --git a/crates/router/src/compatibility/stripe/customers.rs b/crates/router/src/compatibility/stripe/customers.rsindex eeb09b1104..39616e007b 100644--- a/crates/router/src/compatibility/stripe/customers.rs+++ b/crates/router/src/compatibility/stripe/customers.rs@@ -85,7 +85,7 @@ pub async fn customer_retrieve(&req,payload,|state, auth, req, _| {- customers::retrieve_customer(state, auth.merchant_account, auth.key_store, req)+ customers::retrieve_customer(state, auth.merchant_account, None, auth.key_store, req)},&auth::HeaderAuth(auth::ApiKeyAuth),api_locking::LockAction::NotApplicable,diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rsindex 5df24b5c94..a85cb1f8fa 100644--- a/crates/router/src/core/admin.rs+++ b/crates/router/src/core/admin.rs@@ -737,6 +737,7 @@ pub async fn list_merchant_account(pub async fn get_merchant_account(state: SessionState,req: api::MerchantId,+ _profile_id: Option<String>,) -> RouterResponse<api::MerchantAccountResponse> {let db = state.store.as_ref();let key_manager_state = &(&state).into();@@ -904,6 +905,7 @@ pub async fn update_business_profile_cascade(pub async fn merchant_account_update(state: SessionState,merchant_id: &id_type::MerchantId,+ _profile_id: Option<String>,req: api::MerchantAccountUpdate,) -> RouterResponse<api::MerchantAccountResponse> {let db = state.store.as_ref();@@ -2759,6 +2761,7 @@ async fn validate_pm_auth(pub async fn retrieve_payment_connector(state: SessionState,merchant_id: id_type::MerchantId,+ _profile_id: Option<String>,merchant_connector_id: String,) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {let store = state.store.as_ref();@@ -2807,6 +2810,7 @@ pub async fn retrieve_payment_connector(pub async fn list_payment_connectors(state: SessionState,merchant_id: id_type::MerchantId,+ _profile_id_list: Option<Vec<String>>,) -> RouterResponse<Vec<api_models::admin::MerchantConnectorListResponse>> {let store = state.store.as_ref();let key_manager_state = &(&state).into();@@ -2847,6 +2851,7 @@ pub async fn list_payment_connectors(pub async fn update_payment_connector(state: SessionState,merchant_id: &id_type::MerchantId,+ _profile_id: Option<String>,merchant_connector_id: &str,req: api_models::admin::MerchantConnectorUpdate,) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {diff --git a/crates/router/src/core/connector_onboarding/paypal.rs b/crates/router/src/core/connector_onboarding/paypal.rsindex 176789b4bb..b285f6d2af 100644--- a/crates/router/src/core/connector_onboarding/paypal.rs+++ b/crates/router/src/core/connector_onboarding/paypal.rs@@ -180,7 +180,7 @@ pub async fn update_mca(merchant_id: merchant_id.clone(),};let mca_response =- admin::update_payment_connector(state.clone(), &merchant_id, &connector_id, request)+ admin::update_payment_connector(state.clone(), &merchant_id, None, &connector_id, request).await?;match mca_response {diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rsindex a2081abddc..c14b7e1e25 100644--- a/crates/router/src/core/customers.rs+++ b/crates/router/src/core/customers.rs@@ -366,6 +366,7 @@ impl<'a> MerchantReferenceIdForCustomer<'a> {pub async fn retrieve_customer(state: SessionState,merchant_account: domain::MerchantAccount,+ _profile_id: Option<String>,key_store: domain::MerchantKeyStore,req: customers::CustomerId,) -> errors::CustomerResponse<customers::CustomerResponse> {@@ -399,6 +400,7 @@ pub async fn retrieve_customer(pub async fn list_customers(state: SessionState,merchant_id: id_type::MerchantId,+ _profile_id_list: Option<Vec<String>>,key_store: domain::MerchantKeyStore,) -> errors::CustomerResponse<Vec<customers::CustomerResponse>> {let db = state.store.as_ref();diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex e2593ddd23..78d0d8fd79 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -3045,7 +3045,7 @@ pub async fn get_payment_filters(_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?+ super::admin::list_payment_connectors(state, merchant.get_id().to_owned(), None).await?{data} else {diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rsindex 5868b06217..9f8fc2e30a 100644--- a/crates/router/src/core/refunds.rs+++ b/crates/router/src/core/refunds.rs@@ -990,7 +990,8 @@ pub async fn get_filters_for_refunds(_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?+ super::admin::list_payment_connectors(state, merchant_account.get_id().to_owned(), None)+ .await?{data} else {diff --git a/crates/router/src/core/verify_connector.rs b/crates/router/src/core/verify_connector.rsindex 4dce96ec9f..b6f03c27ab 100644--- a/crates/router/src/core/verify_connector.rs+++ b/crates/router/src/core/verify_connector.rs@@ -19,6 +19,7 @@ use crate::{pub async fn verify_connector_credentials(state: SessionState,req: VerifyConnectorRequest,+ _profile_id: Option<String>,) -> errors::RouterResponse<()> {let boxed_connector = api::ConnectorData::get_connector_by_name(&state.conf.connectors,diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rsindex 0bebf1e39b..f66ec94d9f 100644--- a/crates/router/src/routes/admin.rs+++ b/crates/router/src/routes/admin.rs@@ -124,7 +124,7 @@ pub async fn retrieve_merchant_account(state,&req,payload,- |state, _, req, _| get_merchant_account(state, req),+ |state, _, req, _| get_merchant_account(state, req, None),auth::auth_type(&auth::AdminApiAuth,&auth::JWTAuthMerchantFromRoute {@@ -189,7 +189,7 @@ pub async fn update_merchant_account(state,&req,json_payload.into_inner(),- |state, _, req, _| merchant_account_update(state, &merchant_id, req),+ |state, _, req, _| merchant_account_update(state, &merchant_id, None, req),auth::auth_type(&auth::AdminApiAuth,&auth::JWTAuthMerchantFromRoute {@@ -369,7 +369,7 @@ pub async fn payment_connector_retrieve(&req,payload,|state, _, req, _| {- retrieve_payment_connector(state, req.merchant_id, req.merchant_connector_id)+ retrieve_payment_connector(state, req.merchant_id, None, req.merchant_connector_id)},auth::auth_type(&auth::AdminApiAuth,@@ -415,7 +415,7 @@ pub async fn payment_connector_list(state,&req,merchant_id.to_owned(),- |state, _, merchant_id, _| list_payment_connectors(state, merchant_id),+ |state, _, merchant_id, _| list_payment_connectors(state, merchant_id, None),auth::auth_type(&auth::AdminApiAuth,&auth::JWTAuthMerchantFromRoute {@@ -468,7 +468,7 @@ pub async fn payment_connector_update(&req,json_payload.into_inner(),|state, _, req, _| {- update_payment_connector(state, &merchant_id, &merchant_connector_id, req)+ update_payment_connector(state, &merchant_id, None, &merchant_connector_id, req)},auth::auth_type(&auth::AdminApiAuth,diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rsindex fe9408dc13..182f5cc237 100644--- a/crates/router/src/routes/customers.rs+++ b/crates/router/src/routes/customers.rs@@ -63,7 +63,9 @@ pub async fn customers_retrieve(state,&req,payload,- |state, auth, req, _| retrieve_customer(state, auth.merchant_account, auth.key_store, req),+ |state, auth, req, _| {+ retrieve_customer(state, auth.merchant_account, None, auth.key_store, req)+ },&*auth,api_locking::LockAction::NotApplicable,))@@ -84,6 +86,7 @@ pub async fn customers_list(state: web::Data<AppState>, req: HttpRequest) -> Httlist_customers(state,auth.merchant_account.get_id().to_owned(),+ None,auth.key_store,)},diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rsindex e226f3f07a..4c5af4acd5 100644--- a/crates/router/src/routes/payments.rs+++ b/crates/router/src/routes/payments.rs@@ -130,6 +130,7 @@ pub async fn payments_create(state,req_state,auth.merchant_account,+ None,auth.key_store,HeaderPayload::default(),req,@@ -422,6 +423,7 @@ pub async fn payments_update(state,req_state,auth.merchant_account,+ None,auth.key_store,HeaderPayload::default(),req,@@ -500,6 +502,7 @@ pub async fn payments_confirm(state,req_state,auth.merchant_account,+ None,auth.key_store,header_payload.clone(),req,@@ -1176,6 +1179,7 @@ async fn authorize_verify_select<Op>(state: app::SessionState,req_state: ReqState,merchant_account: domain::MerchantAccount,+ profile_id: Option<String>,key_store: domain::MerchantKeyStore,header_payload: HeaderPayload,req: api_models::payments::PaymentsRequest,@@ -1211,7 +1215,7 @@ wherestate,req_state,merchant_account,- None,+ profile_id,key_store,operation,req,@@ -1232,7 +1236,7 @@ wherestate,req_state,merchant_account,- None,+ profile_id,key_store,operation,req,diff --git a/crates/router/src/routes/verify_connector.rs b/crates/router/src/routes/verify_connector.rsindex c045b3a8e6..74b115e620 100644--- a/crates/router/src/routes/verify_connector.rs+++ b/crates/router/src/routes/verify_connector.rs@@ -20,7 +20,7 @@ pub async fn payment_connector_verify(state,&req,json_payload.into_inner(),- |state, _: (), req, _| verify_connector::verify_connector_credentials(state, req),+ |state, _: (), req, _| verify_connector::verify_connector_credentials(state, req, None),&auth::JWTAuth(Permission::MerchantConnectorAccountWrite),api_locking::LockAction::NotApplicable,))