feat: add profile_id authentication for business profile update and list#5673
Conversation
|
Review changes with SemanticDiff. Analyzed 7 of 7 files. Overall, the semantic diff is 5% smaller than the GitHub diff.
|
| |state, auth, merchant_id, _| { | ||
| list_business_profile( | ||
| state, | ||
| merchant_id, | ||
| auth.profile_id.map(|profile_id| vec![profile_id]), | ||
| ) | ||
| }, |
There was a problem hiding this comment.
We shouldn't filter on profile_id in this route.
There should be a new route which filters on profile level.
There was a problem hiding this comment.
list business profile endpoint looks like this currently. {base_url}/account/${merchantId}/business_profile
Should the new endpoint be {base_url}/account/${merchantId}/business_profile/profile
There was a problem hiding this comment.
{base_url}/account/${merchantId}/profile
We should use this route to list profiles since in resource is named as profiles.
In the list we can do the filter too by the access
| MerchantJwtWithProfileId { | ||
| merchant_id: id_type::MerchantId, | ||
| profile_id: Option<id_type::ProfileId>, | ||
| user_id: Option<String>, |
There was a problem hiding this comment.
I don't think Option is needed here.
There was a problem hiding this comment.
This ProfileId should come from JWT token right?
ProfileId is optional in JWT.
There was a problem hiding this comment.
I was referring to user_id. Sorry for the confusion.
…n-for-business-profile-endpoints
crates/router/src/core/utils.rs
Outdated
| #[derive(Debug)] | ||
| pub struct ProfileIdWrapper(pub common_utils::id_type::ProfileId); | ||
| impl GetProfileId for ProfileIdWrapper { | ||
| fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> { | ||
| Some(&self.0) | ||
| } | ||
| } |
There was a problem hiding this comment.
Can you remove this, if this is not being used.
crates/router/src/routes/app.rs
Outdated
| .route(web::get().to(business_profile_retrieve)) | ||
| .route(web::post().to(business_profile_update)) | ||
| .route(web::delete().to(business_profile_delete)), | ||
| web::scope("/account/{merchant_id}").service( |
There was a problem hiding this comment.
Can you check this again. This is wrong. Merchant id will be there 2 times in the path.
| web::scope("/account/{account_id}/profile") | ||
| .app_data(web::Data::new(state)) | ||
| .service( |
There was a problem hiding this comment.
We can combine this with the original BusinessProfile routes right.
There was a problem hiding this comment.
No. I tried doing that, {base_url}/account/{merchant_id}/connectors was returning 404 not found.
06e0306
…config-fix * 'main' of github.com:juspay/hyperswitch: feat: add profile_id authentication for business profile update and list (#5673) chore(version): 2024.09.03.0 feat(user): implement invitations api (#5769) feat(connector): [Adyenplatform] add webhooks for payout (#5749) refactor(v2_migrations): re-organize v2 migrations (#5760) chore: add wasm support for connector additional details (#5712) refactor(connector): Move globepay, powertranz, tsys, worldline to hyperswitch_connectors (#5758) fix(cypress): fix cypress throwing error when `connectorId` is not passed and miscellaneous fixes (#5746) chore: fix typos (#5766) refactor(business_profile): change id for business profile (#5748)
Type of Change
Description
Add profile_id validation for business profile update and list apis.
Additional Changes
Motivation and Context
How did you test it?
Response:
Response:
Checklist
cargo +nightly fmt --allcargo clippy