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

fix(routing): handle validation for profile_id (#9809)

Ankit Kumar Guptabfa06b2108bb
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 768e215809..729881a831 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -1871,9 +1871,10 @@ pub async fn validate_and_get_business_profile(
) -> RouterResult<Option<domain::Profile>> {
profile_id
.async_map(|profile_id| async {
- db.find_business_profile_by_profile_id(
+ db.find_business_profile_by_merchant_id_profile_id(
key_manager_state,
merchant_key_store,
+ merchant_id,
profile_id,
)
.await
@@ -1882,18 +1883,6 @@ pub async fn validate_and_get_business_profile(
})
})
.await
- .transpose()?
- .map(|business_profile| {
- // Check if the merchant_id of business profile is same as the current merchant_id
- if business_profile.merchant_id.ne(merchant_id) {
- Err(errors::ApiErrorResponse::AccessForbidden {
- resource: business_profile.get_id().get_string_repr().to_owned(),
- }
- .into())
- } else {
- Ok(business_profile)
- }
- })
.transpose()
}