Skip to content

Commit

Permalink
add reference param
Browse files Browse the repository at this point in the history
  • Loading branch information
jenbutongit committed Aug 23, 2023
1 parent 4ba68a0 commit 1016f20
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export async function sendAnnualReviewProviderEmail(
country: string,
contactName: string,
deletionDate: string,
changeLink: string
changeLink: string,
reference = "" // the annual review reference, so we can look up all emails relating to this reference.
): Promise<{ result?: SendEmailResponse | {}; error?: Error }> {
try {
if (config.isSmokeTest) {
Expand All @@ -34,7 +35,7 @@ export async function sendAnnualReviewProviderEmail(
);
const result = await getNotifyClient().sendEmail(annualReviewNotices.providerStart, emailAddress, {
personalisation,
reference: "",
reference,
});

return { result };
Expand Down Expand Up @@ -77,7 +78,7 @@ export async function sendAnnualReviewPostEmail(
typePluralCapitalised: typePlural.toUpperCase(),
};
logger.info(
`template - ${reminderType} - ${notifyTemplate}, emailAddress - ${emailAddress}, personalisation - ${JSON.stringify(
`sendAnnualReviewPostEmail: template - ${reminderType} - ${notifyTemplate}, emailAddress - ${emailAddress}, personalisation - ${JSON.stringify(
personalisation
)}`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ async function sendAnnualReviewStartEmail(list: List, listItem: ListItemWithHist
const annualReviewProviderUrl = createAnnualReviewProviderUrl(listItem);
const unpublishDate = new Date(list.jsonData.currentAnnualReview?.keyDates.unpublished.UNPUBLISH ?? "");
const unpublishDateString = formatDate(unpublishDate);
const reference = list.jsonData.currentAnnualReview?.reference;

const providerEmailResult = await sendAnnualReviewProviderEmail(
(listItem.jsonData as BaseDeserialisedWebhookData).emailAddress,
lowerCase(startCase(listItem.type)),
list?.country?.name ?? "",
(listItem.jsonData as BaseDeserialisedWebhookData).contactName,
unpublishDateString,
annualReviewProviderUrl
annualReviewProviderUrl,
reference
);
return providerEmailResult;
}
Expand Down
1 change: 0 additions & 1 deletion src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type * as PrismaClient from "@prisma/client";
import type * as ServerTypes from "server/models/types";
import type { ListItemJsonData } from "server/models/listItem/providers/deserialisers/types";
import type { EventJsonData } from "server/models/listItem/types";
import type { AnnualReviewPostEmailType } from "@prisma/client";

export enum ServiceType {
"lawyers" = "lawyers",
Expand Down

0 comments on commit 1016f20

Please sign in to comment.