Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/actions/acceptance-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ runs:
TEST_TYPE: ${{ inputs.testType }}
ENVIRONMENT: ${{ inputs.targetEnvironment }}
PLAYWRIGHT_SHARD: ${{ inputs.shard }}
- name: Sanitise shard for artifact name
id: shard_label
if: ${{ inputs.testType == 'integration' && inputs.shard != '' }}
shell: bash
run: echo "value=${SHARD//\// of }" >> $GITHUB_OUTPUT
env:
SHARD: ${{ inputs.shard }}
- name: Archive integration test results
if: ${{ inputs.testType == 'integration' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: Integration test report
name: Integration test report${{ inputs.shard != '' && format(' ({0})', steps.shard_label.outputs.value) || '' }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken for now from Ian's review to give the artifacts different name.

path: "tests/playwright/playwright-report"
2 changes: 1 addition & 1 deletion .github/workflows/stage-3-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ jobs:
- name: "Checkout code"
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: "Build docs"
uses: NHSDigital/nhs-notify-shared-modules/.github/actions/build-docs@3.0.0
uses: NHSDigital/nhs-notify-shared-modules/.github/actions/build-docs@3.1.6
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken version that includes the build documentation fix from NHSDigital/nhs-notify-shared-modules#195.

with:
version: "${{ inputs.version }}"
4 changes: 3 additions & 1 deletion README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ WITH vars AS (
OR e.type LIKE '%.queue.digital.letter.read.%'
OR e.type LIKE '%.pdm.resource.submission.rejected.%'
OR e.type LIKE '%.pdm.resource.retries.exceeded.%'
OR e.type LIKE '%.messages.request.rejected.%' THEN 'Digital'
OR e.type LIKE '%.messages.request.rejected.%'
OR e.type LIKE '%.queue.digital.letter.unsuccessful.%' THEN 'Digital'
WHEN e.type LIKE '%.print.letter.transitioned.%'
OR e.type LIKE '%.print.file.quarantined.%'
OR e.type LIKE '%.print.invalid.attachment.received.%' THEN 'Print' ELSE NULL
Expand All @@ -23,14 +24,17 @@ WITH vars AS (
WHEN e.type LIKE '%.messages.request.rejected.%' THEN 'Failed'
WHEN e.type LIKE '%.print.file.quarantined.%' THEN 'Failed'
WHEN e.type LIKE '%.print.invalid.attachment.received.%' THEN 'Failed'
WHEN e.type LIKE '%.queue.digital.letter.unsuccessful.%' THEN 'Failed'
WHEN e.letterstatus = 'RETURNED' THEN 'Returned'
WHEN e.letterstatus = 'FAILED' THEN 'Failed'
WHEN e.letterstatus = 'DELIVERED' THEN 'Delivered'
WHEN e.letterstatus = 'REJECTED' THEN 'Rejected' ELSE NULL
END as status,
e.reasoncode,
COALESCE(
CASE WHEN e.type LIKE '%.messages.request.rejected.%' THEN e.reasontext END,
CASE
WHEN e.type LIKE '%.messages.request.rejected.%'
OR e.type LIKE '%.queue.digital.letter.unsuccessful.%' THEN e.reasontext END,
fcl.description,
e.reasontext,
e.reasoncode
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"@aws-sdk/client-eventbridge": "^3.914.0",
"@nhsdigital/nhs-notify-event-schemas-status-published": "^1.0.1",
"@nhsdigital/nhs-notify-event-schemas-status-published": "^1.0.2",
"@nhsdigital/nhs-notify-event-schemas-supplier-api": "^1.0.18",
"csv-parse": "^6.1.0",
"tsx": "^4.20.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ properties:
$ref: ../defs/requests.schema.yaml#/properties/messageReference
senderId:
$ref: ../defs/requests.schema.yaml#/properties/senderId
failureCode:
$ref: ../defs/core.schema.yaml#/properties/failureCode
failureReason:
$ref: ../defs/core.schema.yaml#/properties/failureReason
reasonCode:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taken from #339

$ref: ../defs/print.schema.yaml#/properties/reasonCode
reasonText:
$ref: ../defs/print.schema.yaml#/properties/reasonText
required:
- messageReference
- senderId
- failureCode
- failureReason
- reasonCode
- reasonText
21 changes: 15 additions & 6 deletions src/cloudevents/readme-index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To regenerate, run: make update-readme
# To customize labels and purposes, edit: readme-metadata.yaml

generated: '2026-04-09T13:48:22.150Z'
generated: '2026-05-11T09:16:35.071Z'
common: null
domains:
- name: digital-letters
Expand Down Expand Up @@ -112,6 +112,11 @@ domains:
source: src/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-read-data.schema.yaml
published: schemas/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-read-data.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-read-data.schema.md
- type: Digital Letters Queue Digital Letter Unsuccessful Data
category: data
source: src/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.yaml
published: schemas/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.md
- type: Digital Letters Queue Item Dequeued Data
category: data
source: src/digital-letters/2025-10-draft/data/digital-letters-queue-item-dequeued-data.schema.yaml
Expand Down Expand Up @@ -327,6 +332,11 @@ domains:
source: src/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1.schema.yaml
published: schemas/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1.schema.md
- type: uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1
category: events
source: src/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1.schema.yaml
published: schemas/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1.schema.md
- type: uk.nhs.notify.digital.letters.queue.item.dequeued.v1
category: events
source: src/digital-letters/2025-10-draft/events/uk.nhs.notify.digital.letters.queue.item.dequeued.v1.schema.yaml
Expand Down Expand Up @@ -357,11 +367,6 @@ domains:
source: src/digital-letters/2025-10-draft/nhs-notify-document-reference.schema.yaml
published: schemas/digital-letters/2025-10-draft/nhs-notify-document-reference.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/nhs-notify-document-reference.schema.md
- type: Profile
category: profile
source: src/digital-letters/2025-10-draft/supplierapi-profile.schema.yaml
published: schemas/digital-letters/2025-10-draft/supplierapi-profile.schema.json
docs: ../../docs/cloudevents/digital-letters/2025-10-draft/supplierapi-profile.schema.md
exampleEvents:
- name: Uk.nhs.notify.digital.letters.letter.available.v1
filename: uk.nhs.notify.digital.letters.letter.available.v1-event
Expand Down Expand Up @@ -439,6 +444,10 @@ domains:
filename: uk.nhs.notify.digital.letters.queue.digital.letter.read.v1-event
json: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1-event.json
markdown: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.read.v1-event.md
- name: Uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1
filename: uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1-event
json: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1-event.json
markdown: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1-event.md
- name: Uk.nhs.notify.digital.letters.queue.item.dequeued.v1
filename: uk.nhs.notify.digital.letters.queue.item.dequeued.v1-event
json: ../../docs/cloudevents/digital-letters/2025-10-draft/example-events/uk.nhs.notify.digital.letters.queue.item.dequeued.v1-event.json
Expand Down
2 changes: 1 addition & 1 deletion tests/pact-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"@nhsdigital/nhs-notify-event-schemas-status-published": "^1.0.1",
"@nhsdigital/nhs-notify-event-schemas-status-published": "^1.0.2",
"@nhsdigital/nhs-notify-event-schemas-supplier-api": "^1.0.18",
"@pact-foundation/pact": "^16.3.0",
"@types/jest": "^29.5.14",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ const scenarios = [
'Unread',
senderId,
),
new ReportScenario(
'component-test-digitalLetterUnsuccessful',
CommunicationType.Digital,
[EventStatus.DigitalLetterNhsAppUnsuccessful],
'Failed',
senderId,
'DL_INTE_001',
'Failed enrichment',
),
new ReportScenario(
'component-test-itemDequeued-digitalLetterUnsuccessful',
CommunicationType.Digital,
[EventStatus.Unread, EventStatus.DigitalLetterNhsAppUnsuccessful],
'Failed',
senderId,
'DL_INTE_001',
'Failed enrichment',
),
new ReportScenario(
'component-test-itemDequeued-digitalLetterRead',
CommunicationType.Digital,
Expand Down
23 changes: 23 additions & 0 deletions tests/playwright/helpers/event-builders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
DigitalLetterRead,
DigitalLetterUnsuccessful,
FileQuarantined,
InvalidAttachmentReceived,
ItemDequeued,
Expand Down Expand Up @@ -163,6 +164,28 @@ export function buildMessageRequestRejectedEvent(
} as MessageRequestRejected;
}

export function buildDigitalLetterUnsuccessfulEvent(
eventId: string,
time: string,
messageReference: string,
senderId: string,
): DigitalLetterUnsuccessful {
const baseEvent = buildBaseEvent('queue', time);
return {
...baseEvent,
id: eventId,
type: 'uk.nhs.notify.digital.letters.queue.digital.letter.unsuccessful.v1',
dataschema:
'https://notify.nhs.uk/cloudevents/schemas/digital-letters/2025-10-draft/data/digital-letters-queue-digital-letter-unsuccessful-data.schema.json',
data: {
messageReference,
senderId,
reasonCode: 'DL_INTE_001',
reasonText: 'Failed enrichment',
},
} as DigitalLetterUnsuccessful;
}

export function buildFileQuarantinedEvent(
eventId: string,
time: string,
Expand Down
18 changes: 18 additions & 0 deletions tests/playwright/helpers/report-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { v4 as uuidv4 } from 'uuid';

import {
DigitalLetterRead,
DigitalLetterUnsuccessful,
FileQuarantined,
GenerateReport,
InvalidAttachmentReceived,
Expand All @@ -21,6 +22,7 @@ import {
PDMResourceSubmissionRejected,
PrintLetterTransitioned,
validateDigitalLetterRead,
validateDigitalLetterUnsuccessful,
validateFileQuarantined,
validateGenerateReport,
validateInvalidAttachmentReceived,
Expand All @@ -41,6 +43,7 @@ import eventPublisher from 'helpers/event-bus-helpers';
import expectToPassEventually from 'helpers/expectations';
import {
buildDigitalLetterReadEvent,
buildDigitalLetterUnsuccessfulEvent,
buildFileQuarantinedEvent,
buildInvalidAttachmentReceivedEvent,
buildItemDequeuedEvent,
Expand Down Expand Up @@ -72,6 +75,7 @@ export enum EventStatus {
DigitalMessageRequestRejected = 'MessageRequestRejected',
PrintFileQuarantined = 'FileQuarantined',
PrintInvalidAttachmentReceived = 'InvalidAttachmentReceived',
DigitalLetterNhsAppUnsuccessful = 'DigitalLetterNhsAppUnsuccessful',
}
/**
* Utility class to proof the SQL logic to determine which status should be reported for a given message reference,
Expand Down Expand Up @@ -207,6 +211,20 @@ export function publishEventForScenario(scenario: ReportScenario) {
);
break;
}
case EventStatus.DigitalLetterNhsAppUnsuccessful: {
eventPublisher.sendEvents<DigitalLetterUnsuccessful>(
[
buildDigitalLetterUnsuccessfulEvent(
uuidv4(),
scenario.time,
scenario.messageReference,
scenario.senderId,
),
],
validateDigitalLetterUnsuccessful,
);
break;
}
default:
}
break;
Expand Down
Loading