mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(routing): handle validation for profile_id (#9809)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b42fbdb50f
commit
bfa06b2108
@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user