Skip to content

Commit 5bddd7a

Browse files
authored
Merge pull request #825 from govuk-one-login/OLH-4100
OLH-4100: dedicated Notify service for AMC
2 parents 8a60a9f + 972600f commit 5bddd7a

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

solutions/app-infra/template.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ Mappings:
8181
notifyStubUrl: https://stubs.manage.dev.account.gov.uk/notify
8282
notifyTemplateIds: |
8383
{
84-
"CREATE_PASSKEY_WITH_PASSKEY_NAME": "aa8697b6-23e6-4317-9aff-5a274142e7f2",
85-
"CREATE_PASSKEY_WITHOUT_PASSKEY_NAME": "369a29fd-1e7b-4c1f-bd92-a08a51c99b2e"
84+
"CREATE_PASSKEY_WITH_DISPLAY_NAME": "fb385d74-ac28-466d-8695-3d8a732a4cf8",
85+
"CREATE_PASSKEY_WITHOUT_DISPLAY_NAME": "d20ccbec-3eac-4669-993c-d3f892ecc0f6"
8686
}
8787
notificationsVisibilityTimeout: 120
8888
notificationsMaxReceiveCount: 5
@@ -115,8 +115,8 @@ Mappings:
115115
notifyStubUrl: https://stubs.manage.build.account.gov.uk/notify
116116
notifyTemplateIds: |
117117
{
118-
"CREATE_PASSKEY_WITH_PASSKEY_NAME": "aa8697b6-23e6-4317-9aff-5a274142e7f2",
119-
"CREATE_PASSKEY_WITHOUT_PASSKEY_NAME": "369a29fd-1e7b-4c1f-bd92-a08a51c99b2e"
118+
"CREATE_PASSKEY_WITH_DISPLAY_NAME": "fb385d74-ac28-466d-8695-3d8a732a4cf8",
119+
"CREATE_PASSKEY_WITHOUT_DISPLAY_NAME": "d20ccbec-3eac-4669-993c-d3f892ecc0f6"
120120
}
121121
notificationsVisibilityTimeout: 120
122122
notificationsMaxReceiveCount: 5
@@ -151,8 +151,8 @@ Mappings:
151151
notifyStubUrl: ""
152152
notifyTemplateIds: |
153153
{
154-
"CREATE_PASSKEY_WITH_PASSKEY_NAME": "aa8697b6-23e6-4317-9aff-5a274142e7f2",
155-
"CREATE_PASSKEY_WITHOUT_PASSKEY_NAME": "369a29fd-1e7b-4c1f-bd92-a08a51c99b2e"
154+
"CREATE_PASSKEY_WITH_DISPLAY_NAME": "fb385d74-ac28-466d-8695-3d8a732a4cf8",
155+
"CREATE_PASSKEY_WITHOUT_DISPLAY_NAME": "d20ccbec-3eac-4669-993c-d3f892ecc0f6"
156156
}
157157
notificationsVisibilityTimeout: 120
158158
notificationsMaxReceiveCount: 5
@@ -187,8 +187,8 @@ Mappings:
187187
notifyStubUrl: ""
188188
notifyTemplateIds: |
189189
{
190-
"CREATE_PASSKEY_WITH_PASSKEY_NAME": "07fc5ed8-4775-4f03-b6cf-08a273458849",
191-
"CREATE_PASSKEY_WITHOUT_PASSKEY_NAME": "b6cec4ce-a23e-4132-87d8-952697c58851"
190+
"CREATE_PASSKEY_WITH_DISPLAY_NAME": "aa8697b6-23e6-4317-9aff-5a274142e7f2",
191+
"CREATE_PASSKEY_WITHOUT_DISPLAY_NAME": "369a29fd-1e7b-4c1f-bd92-a08a51c99b2e"
192192
}
193193
notificationsVisibilityTimeout: 300
194194
notificationsMaxReceiveCount: 36
@@ -223,8 +223,8 @@ Mappings:
223223
notifyStubUrl: ""
224224
notifyTemplateIds: |
225225
{
226-
"CREATE_PASSKEY_WITH_PASSKEY_NAME": "07fc5ed8-4775-4f03-b6cf-08a273458849",
227-
"CREATE_PASSKEY_WITHOUT_PASSKEY_NAME": "b6cec4ce-a23e-4132-87d8-952697c58851"
226+
"CREATE_PASSKEY_WITH_DISPLAY_NAME": "07fc5ed8-4775-4f03-b6cf-08a273458849",
227+
"CREATE_PASSKEY_WITHOUT_DISPLAY_NAME": "b6cec4ce-a23e-4132-87d8-952697c58851"
228228
}
229229
notificationsVisibilityTimeout: 300
230230
notificationsMaxReceiveCount: 36

solutions/commons/utils/notifications/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("sendNotification", () => {
2626
it("should send message to SQS queue", async () => {
2727
const message = {
2828
emailAddress: "test@example.com",
29-
notificationType: NotificationType.CREATE_PASSKEY_WITHOUT_PASSKEY_NAME,
29+
notificationType: NotificationType.CREATE_PASSKEY_WITHOUT_DISPLAY_NAME,
3030
} as const;
3131

3232
await sendNotification(message);
@@ -42,7 +42,7 @@ describe("sendNotification", () => {
4242

4343
const message = {
4444
emailAddress: "test@example.com",
45-
notificationType: NotificationType.CREATE_PASSKEY_WITHOUT_PASSKEY_NAME,
45+
notificationType: NotificationType.CREATE_PASSKEY_WITHOUT_DISPLAY_NAME,
4646
} as const;
4747

4848
await expect(sendNotification(message)).rejects.toThrow();

solutions/commons/utils/notifications/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { getSqsClient } from "../awsClient/sqsClient/index.js";
33
import assert from "node:assert";
44

55
export enum NotificationType {
6-
CREATE_PASSKEY_WITH_PASSKEY_NAME = "CREATE_PASSKEY_WITH_PASSKEY_NAME",
7-
CREATE_PASSKEY_WITHOUT_PASSKEY_NAME = "CREATE_PASSKEY_WITHOUT_PASSKEY_NAME",
6+
CREATE_PASSKEY_WITH_DISPLAY_NAME = "CREATE_PASSKEY_WITH_DISPLAY_NAME",
7+
CREATE_PASSKEY_WITHOUT_DISPLAY_NAME = "CREATE_PASSKEY_WITHOUT_DISPLAY_NAME",
88
}
99

1010
export const notifyTemplateIDsSchema = v.pipe(
@@ -17,7 +17,7 @@ export const messageSchema = v.variant("notificationType", [
1717
v.pipe(
1818
v.object({
1919
notificationType: v.literal(
20-
NotificationType.CREATE_PASSKEY_WITH_PASSKEY_NAME,
20+
NotificationType.CREATE_PASSKEY_WITH_DISPLAY_NAME,
2121
),
2222
emailAddress: v.pipe(v.string(), v.email()),
2323
passkeyName: v.string(),
@@ -36,7 +36,7 @@ export const messageSchema = v.variant("notificationType", [
3636
v.pipe(
3737
v.object({
3838
notificationType: v.literal(
39-
NotificationType.CREATE_PASSKEY_WITHOUT_PASSKEY_NAME,
39+
NotificationType.CREATE_PASSKEY_WITHOUT_DISPLAY_NAME,
4040
),
4141
emailAddress: v.pipe(v.string(), v.email()),
4242
}),

solutions/frontend/src/journeys/passkey-create/handlers/create.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ describe("passkey-create handlers", () => {
631631
"aaguid-123",
632632
);
633633
expect(mockSendNotification).toHaveBeenCalledWith({
634-
notificationType: "CREATE_PASSKEY_WITH_PASSKEY_NAME",
634+
notificationType: "CREATE_PASSKEY_WITH_DISPLAY_NAME",
635635
emailAddress: "test@example.com",
636636
passkeyName: "iCloud Keychain",
637637
});
@@ -651,7 +651,7 @@ describe("passkey-create handlers", () => {
651651
"aaguid-123",
652652
);
653653
expect(mockSendNotification).toHaveBeenCalledWith({
654-
notificationType: "CREATE_PASSKEY_WITHOUT_PASSKEY_NAME",
654+
notificationType: "CREATE_PASSKEY_WITHOUT_DISPLAY_NAME",
655655
emailAddress: "test@example.com",
656656
});
657657
});

solutions/frontend/src/journeys/passkey-create/handlers/create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ export async function postHandler(
335335
await sendNotification(
336336
passkeyConvenienceMetadata
337337
? {
338-
notificationType: NotificationType.CREATE_PASSKEY_WITH_PASSKEY_NAME,
338+
notificationType: NotificationType.CREATE_PASSKEY_WITH_DISPLAY_NAME,
339339
emailAddress: request.session.claims.email,
340340
passkeyName: passkeyConvenienceMetadata.name,
341341
}
342342
: {
343343
notificationType:
344-
NotificationType.CREATE_PASSKEY_WITHOUT_PASSKEY_NAME,
344+
NotificationType.CREATE_PASSKEY_WITHOUT_DISPLAY_NAME,
345345
emailAddress: request.session.claims.email,
346346
},
347347
);

solutions/stubs/src/notify/handlers/sendEmail.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
44
vi.mock(import("../../../../commons/utils/logger/index.js"));
55

66
const mockTemplateIds = {
7-
CREATE_PASSKEY_WITH_PASSKEY_NAME: "template-id-1",
8-
CREATE_PASSKEY_WITHOUT_PASSKEY_NAME: "template-id-2",
7+
CREATE_PASSKEY_WITH_DISPLAY_NAME: "template-id-1",
8+
CREATE_PASSKEY_WITHOUT_DISPLAY_NAME: "template-id-2",
99
};
1010

1111
describe("sendEmailPostHandler", () => {
@@ -47,7 +47,7 @@ describe("sendEmailPostHandler", () => {
4747
expect(logger.info).toHaveBeenCalledWith("NotifySendEmailCalled", {
4848
reference: "test-reference",
4949
templateId: "template-id-1",
50-
template: "CREATE_PASSKEY_WITH_PASSKEY_NAME",
50+
template: "CREATE_PASSKEY_WITH_DISPLAY_NAME",
5151
});
5252
expect(mockReply.send).toHaveBeenCalledWith({
5353
data: {
@@ -68,7 +68,7 @@ describe("sendEmailPostHandler", () => {
6868
expect(logger.info).toHaveBeenCalledWith("NotifySendEmailCalled", {
6969
reference: undefined,
7070
templateId: "template-id-2",
71-
template: "CREATE_PASSKEY_WITHOUT_PASSKEY_NAME",
71+
template: "CREATE_PASSKEY_WITHOUT_DISPLAY_NAME",
7272
});
7373
expect(mockReply.send).toHaveBeenCalledWith({
7474
data: {

0 commit comments

Comments
 (0)