Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(email): Add auth_id in email types and send auth_id in email URLs #5120

Merged
merged 7 commits into from
Jun 26, 2024

Conversation

ThisIsMani
Copy link
Contributor

@ThisIsMani ThisIsMani commented Jun 25, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR will introduce auth_id field in email types and also email APIs.

When an email is triggered from a API which gets auth_id, then that will be used to construct the email URL as well.

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 #5119.

How did you test it?

All the following APIs will accept a query param called auth_id.

  1. /user/connect_account
  2. /user/forgot_password
  3. /user/user/invite_multiple
  4. /user/resend_invite
  5. /user/verify_email_request

Example:

curl --location 'http://localhost:8080/user/connect_account?auth_id=2d784c51-c6ba-4adf-8d9f-407049ddacd2' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "email"
}'

In the email received from the API, the url in the email will also have the same auth_id query param which is the same value as above.

auth_id param is optional, and if it is not sent, the email link also will not have any parameter.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@ThisIsMani ThisIsMani self-assigned this Jun 25, 2024
@ThisIsMani ThisIsMani requested a review from a team as a code owner June 25, 2024 14:33
Comment on lines +447 to +448
token_only_query_param: web::Query<user_api::TokenOnlyQueryParam>,
auth_id_query_param: web::Query<user_api::AuthIdQueryParam>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how we are differentiating between two in request?

@ThisIsMani ThisIsMani requested a review from a team as a code owner June 26, 2024 07:48
@ThisIsMani ThisIsMani added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor A-users Area: Users M-configuration-changes Metadata: This PR involves configuration changes labels Jun 26, 2024
Comment on lines 51 to +53
req_payload.clone(),
|state, _, req_body, _| user_core::signup_with_merchant_id(state, req_body),
|state, _, req_body, _| {
user_core::signup_with_merchant_id(state, req_body, auth_id.clone())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clone() not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will pickup in upcoming PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to do this, as the ApiMetricEvent should be implemented for payload. That means, if I use a tuple like (req, auth_id), then I have to implement ApiMetricEvent for (ReqType, String)

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 26, 2024
Merged via the queue into main with commit 4ccd25d Jun 26, 2024
19 checks passed
@Gnanasundari24 Gnanasundari24 deleted the email-link-sso branch June 26, 2024 10:03
pixincreate added a commit that referenced this pull request Jun 28, 2024
…ay/hyperswitch into iatapay-through-hyperswitch-cypress

* 'iatapay-through-hyperswitch-cypress' of github.com:juspay/hyperswitch:
  feat(router): skip apple pay session call if the browser is not Safari (#5136)
  fix(opensearch): show search results only if user has access permission to the index  (#5097)
  chore(version): 2024.06.27.0
  feat(users): add endpoint for terminate auth select (#5135)
  feat(users): implemented openidconnect (#5124)
  feat(router): add payments manual-update api (#5045)
  fix(docs): open-api fix for payment response (#5103)
  refactor(connector): [AdyenPlatform]Throw 4xx instead of 5xx for source_balance_account (#4990)
  feat: realtime user analytics (#5098)
  refactor(connector): added amount conversion framework for cashtocode (#4857)
  feat(email): Add `auth_id` in email types and send `auth_id` in email URLs (#5120)
  refactor(connector): add amount framework to payme & Trustpay with googlePay, ApplePay for bluesnap, Noon & Trustpay (#4833)
  fix(connector): [BOA/CYBS] make risk information message optional (#5107)
  chore(version): 2024.06.25.1
  fix(router): skip serialize if none for assurance_details_required in googlepay session response (#5118)
  refactor: separate DB queries and HTML creation for payout links (#4967)
  feat(router): updated `last_used_at` field for apple pay and google pay for CITs (#5087)
  fix(payment_methods): use existing field value of `nick_name` in db if not sent during request (#5105)
  chore(version): 2024.06.25.0
pixincreate added a commit that referenced this pull request Jun 28, 2024
…ay/hyperswitch into refactor-error-handling-in-cypress

* 'iatapay-through-hyperswitch-cypress' of github.com:juspay/hyperswitch:
  chore: clean up
  feat(router): skip apple pay session call if the browser is not Safari (#5136)
  fix(opensearch): show search results only if user has access permission to the index  (#5097)
  chore(version): 2024.06.27.0
  feat(users): add endpoint for terminate auth select (#5135)
  feat(users): implemented openidconnect (#5124)
  feat(router): add payments manual-update api (#5045)
  fix(docs): open-api fix for payment response (#5103)
  refactor(connector): [AdyenPlatform]Throw 4xx instead of 5xx for source_balance_account (#4990)
  feat: realtime user analytics (#5098)
  refactor(connector): added amount conversion framework for cashtocode (#4857)
  feat(email): Add `auth_id` in email types and send `auth_id` in email URLs (#5120)
  refactor(connector): add amount framework to payme & Trustpay with googlePay, ApplePay for bluesnap, Noon & Trustpay (#4833)
  fix(connector): [BOA/CYBS] make risk information message optional (#5107)
  chore(version): 2024.06.25.1
  fix(router): skip serialize if none for assurance_details_required in googlepay session response (#5118)
  refactor: separate DB queries and HTML creation for payout links (#4967)
  feat(router): updated `last_used_at` field for apple pay and google pay for CITs (#5087)
  fix(payment_methods): use existing field value of `nick_name` in db if not sent during request (#5105)
  chore(version): 2024.06.25.0
@ThisIsMani ThisIsMani removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-users Area: Users C-feature Category: Feature request or enhancement C-refactor Category: Refactor M-configuration-changes Metadata: This PR involves configuration changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(email): Send auth_id in email URLs
5 participants