juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.02k stars 1.19k forks source link

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

Closed ThisIsMani closed 1 week ago

ThisIsMani commented 1 week ago

Type of Change

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

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