hyperswitch
hyperswitch copied to clipboard
refactor(user_role): Remove V1 insertion for `user_roles` and allow Invites for `org_admins`
Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Currently we are inserting user_roles in v1 version and v2 version. Since we have completely moved the APIs to support v2, we don't have to insert v1 anymore.
Allow inviting, updating and deleting org_admins.
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
Closes #6184 Closes #6186
How did you test it?
All the following APIs will insert only v2 user_roles from now on.
curl --location 'https://integ-api.hyperswitch.io/user/signup' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "new email",
"password": "password"
}'
curl --location 'https://integ-api.hyperswitch.io/user/signup?token_only=true' \
--header 'Content-Type: application/json' \
--data '{
"email": "new email",
"password": "password"
}'
curl --location 'https://integ-api.hyperswitch.io/user/connect_account' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "new email"
}'
curl --location 'https://integ-api.hyperswitch.io/user/internal_signup' \
--header 'api-key: test_admin' \
--header 'Content-Type: application/json' \
--data '{
"name" : "name",
"email" : "new email",
"password": "password"
}'
curl --location 'https://integ-api.hyperswitch.io/user/user/invite_multiple' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"email": "email",
"name": "name",
"role_id": "merchant_view_only"
},
{
"email": "email 2",
"name": "name",
"role_id": "merchant_admin"
}
]'
curl --location 'https://integ-api.hyperswitch.io/user/create_merchant' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{
"company_name": "Juspay"
}'
You will now be able to invite org_admin
curl --location 'https://integ-api.hyperswitch.io/user/user/invite_multiple?token_only=true' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data-raw '[
{
"email": "email",
"name": "name",
"role_id": "org_admin"
}
]'
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible