Skip to content

Commit 9e6eec5

Browse files
add to cloudevents
1 parent 6a54252 commit 9e6eec5

11 files changed

Lines changed: 18 additions & 2 deletions

internal/events/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
"typecheck": "tsc --noEmit"
3838
},
3939
"types": "dist/index.d.ts",
40-
"version": "1.0.13"
40+
"version": "1.0.14"
4141
}

internal/events/src/domain/letter.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ The identifier will be included as the origin domain in the subject of any corre
8383
examples: ["1y3q9v1zzzz"],
8484
}),
8585

86+
specificationBillingId: z.string().meta({
87+
title: "Specification Billing ID",
88+
description:
89+
"The billing ID from the letter specification which was used to produce a letter pack for this request.",
90+
examples: ["1y3q9v1zzzz"],
91+
}),
92+
8693
supplierId: z.string().meta({
8794
title: "Supplier ID",
8895
description: "Supplier ID allocated to the letter during creation.",

internal/events/src/events/__tests__/letter-mapper.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("letter-mapper", () => {
1616
updatedAt: "2025-11-24T15:55:18.000Z",
1717
source: "letter-rendering/source/test",
1818
subject: "letter-rendering/source/letter/letter-id",
19+
specificationBillingId: "billing123",
1920
} as Letter;
2021
const source = "/data-plane/supplier-api/nhs-supplier-api-dev/main/letters";
2122
const event = mapLetterToCloudEvent(letter, source);
@@ -35,6 +36,7 @@ describe("letter-mapper", () => {
3536
status: "PRINTED",
3637
specificationId: "spec1",
3738
billingRef: "spec1",
39+
specificationBillingId: "billing123",
3840
supplierId: "supplier1",
3941
groupId: "group1",
4042
reasonCode: "R02",

internal/events/src/events/__tests__/letter-status-change-events.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe("LetterStatus event validations", () => {
4040
billingRef: "1y3q9v1zzzz",
4141
groupId: "client_template",
4242
status,
43+
specificationBillingId: "billing123",
4344
}),
4445
}),
4546
);

internal/events/src/events/__tests__/testData/letter.ACCEPTED-with-invalid-major-version.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"source": "/data-plane/letter-rendering/prod/render-pdf",
1010
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
1111
},
12+
"specificationBillingId": "billing123",
1213
"specificationId": "1y3q9v1zzzz",
1314
"status": "ACCEPTED",
1415
"supplierId": "supplier1"

internal/events/src/events/__tests__/testData/letter.ACCEPTED-with-missing-fields.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
99
"source": "/data-plane/letter-rendering/prod/render-pdf"
1010
},
11+
"specificationBillingId": "billing123",
1112
"specificationId": "1y3q9v1zzzz",
1213
"status": "ACCEPTED",
1314
"supplierId": "supplier1"

internal/events/src/events/__tests__/testData/letter.ACCEPTED.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"source": "/data-plane/letter-rendering/prod/render-pdf",
1010
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
1111
},
12+
"specificationBillingId": "billing123",
1213
"specificationId": "1y3q9v1zzzz",
1314
"status": "ACCEPTED",
1415
"supplierId": "supplier1"

internal/events/src/events/__tests__/testData/letter.FORWARDED.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"reasonCode": "RNIB",
1313
"reasonText": "RNIB",
14+
"specificationBillingId": "billing123",
1415
"specificationId": "1y3q9v1zzzz",
1516
"status": "FORWARDED",
1617
"supplierId": "supplier1"

internal/events/src/events/__tests__/testData/letter.RETURNED.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"reasonCode": "R07",
1313
"reasonText": "No such address",
14+
"specificationBillingId": "billing123",
1415
"specificationId": "1y3q9v1zzzz",
1516
"status": "RETURNED",
1617
"supplierId": "supplier1"

internal/events/src/events/letter-mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function mapLetterToCloudEvent(
2525
status: letter.status,
2626
specificationId: letter.specificationId,
2727
billingRef: letter.billingRef,
28+
specificationBillingId: letter.specificationBillingId,
2829
supplierId: letter.supplierId,
2930
groupId: letter.groupId,
3031
reasonCode: letter.reasonCode,

0 commit comments

Comments
 (0)