-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): send notification email for route DELETE /api/users/me
- Loading branch information
1 parent
5245b78
commit 9c4a02e
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
api/src/identity-access-management/domain/emails/create-self-delete-user-account.email.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { urlBuilder } from '../../../shared/infrastructure/utils/url-builder.js'; | ||
import { EmailFactory } from '../../../shared/mail/domain/models/EmailFactory.js'; | ||
import { mailer } from '../../../shared/mail/infrastructure/services/mailer.js'; | ||
|
||
export function createSelfDeleteUserAccountEmail({ locale, email, firstName, token, redirectionUrl }) { | ||
const factory = new EmailFactory({ app: 'pix-app', locale }); | ||
|
||
const { i18n, defaultVariables } = factory; | ||
|
||
const redirectUrl = redirectionUrl || defaultVariables.pixAppConnectionUrl; | ||
|
||
return factory.buildEmail({ | ||
template: mailer.accountCreationTemplateId, | ||
subject: i18n.__('pix-account-creation-email.subject'), | ||
to: email, | ||
variables: { | ||
homeName: defaultVariables.homeName, | ||
homeUrl: defaultVariables.homeUrl, | ||
helpdeskUrl: defaultVariables.helpdeskUrl, | ||
displayNationalLogo: defaultVariables.displayNationalLogo, | ||
askForHelp: i18n.__('pix-account-creation-email.params.askForHelp'), | ||
disclaimer: i18n.__('pix-account-creation-email.params.disclaimer'), | ||
doNotAnswer: i18n.__('pix-account-creation-email.params.doNotAnswer'), | ||
goToPix: i18n.__('pix-account-creation-email.params.goToPix'), | ||
helpdeskLinkLabel: i18n.__('pix-account-creation-email.params.helpdeskLinkLabel'), | ||
moreOn: i18n.__('pix-account-creation-email.params.moreOn'), | ||
pixPresentation: i18n.__('pix-account-creation-email.params.pixPresentation'), | ||
subtitle: i18n.__('pix-account-creation-email.params.subtitle'), | ||
subtitleDescription: i18n.__('pix-account-creation-email.params.subtitleDescription'), | ||
title: i18n.__('pix-account-creation-email.params.title', { firstName }), | ||
redirectionUrl: urlBuilder.getEmailValidationUrl({ locale, redirectUrl, token }), | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters