Skip to content

Commit d235ee5

Browse files
Sandbox examples for letters endpoint
1 parent 3b7b924 commit d235ee5

File tree

56 files changed

+822
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+822
-83
lines changed

infrastructure/terraform/components/api/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ No requirements.
3131
|------|--------|---------|
3232
| <a name="module_authorizer_lambda"></a> [authorizer\_lambda](#module\_authorizer\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-lambda.zip | n/a |
3333
| <a name="module_domain_truststore"></a> [domain\_truststore](#module\_domain\_truststore) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.17 |
34-
| <a name="module_get_letters"></a> [get\_letters](#module\_get\_letters) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/lambda | v2.0.10 |
35-
| <a name="module_kms"></a> [kms](#module\_kms) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/kms | v2.0.10 |
3634
| <a name="module_get_letters"></a> [get\_letters](#module\_get\_letters) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-lambda.zip | n/a |
3735
| <a name="module_kms"></a> [kms](#module\_kms) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-kms.zip | n/a |
3836
| <a name="module_logging_bucket"></a> [logging\_bucket](#module\_logging\_bucket) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.17 |

sandbox/api/openapi.yaml

Lines changed: 116 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ info:
99
version: next
1010
servers:
1111
- description: Local development server
12-
url: http://127.0.0.1:3000
12+
url: http://127.0.0.1:9000
1313
- description: Public sandbox
1414
url: https://sandbox-server.nhs.uk/nhs-notify-supplier-api
1515
tags:
@@ -64,6 +64,7 @@ paths:
6464
value:
6565
data:
6666
- attributes:
67+
groupId: abc123
6768
specificationId: 2WL5eYSWGzCHlGmzNxuqVusPxDg
6869
status: PENDING
6970
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
@@ -159,7 +160,6 @@ paths:
159160
- attributes:
160161
reasonCode: 100
161162
reasonText: failed validation
162-
specificationId: 2WL5eYSWGzCHlGmzNxuqVusPxDg
163163
status: REJECTED
164164
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
165165
type: Letter
@@ -175,6 +175,7 @@ paths:
175175
value:
176176
data:
177177
- attributes:
178+
groupId: abc123
178179
reasonCode: 100
179180
reasonText: failed validation
180181
specificationId: 2WL5eYSWGzCHlGmzNxuqVusPxDg
@@ -270,7 +271,6 @@ paths:
270271
name: id
271272
required: true
272273
schema:
273-
example: 24L5eYSWGzCHlGmzNxuqVusPxDg
274274
type: string
275275
style: simple
276276
responses:
@@ -282,6 +282,7 @@ paths:
282282
value:
283283
data:
284284
attributes:
285+
groupId: abc123
285286
reasonCode: 100
286287
reasonText: failed validation
287288
specificationId: 2WL5eYSWGzCHlGmzNxuqVusPxDg
@@ -377,23 +378,122 @@ paths:
377378
name: id
378379
required: true
379380
schema:
380-
example: 24L5eYSWGzCHlGmzNxuqVusPxDg
381381
type: string
382382
style: simple
383383
requestBody:
384384
content:
385385
application/vnd.api+json:
386386
examples:
387-
patch-letter-request:
387+
patch-letter-request-default:
388+
summary: Request for default (PENDING) update
389+
value:
390+
data:
391+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
392+
type: Letter
393+
patch-letter-request-pending:
394+
summary: Request for PENDING update
395+
value:
396+
data:
397+
attributes:
398+
status: PENDING
399+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
400+
type: Letter
401+
patch-letter-request-accepted:
402+
summary: Request for ACCEPTED update
403+
value:
404+
data:
405+
attributes:
406+
status: ACCEPTED
407+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
408+
type: Letter
409+
patch-letter-request-rejected:
410+
summary: Request for REJECTED update
388411
value:
389412
data:
390413
attributes:
391414
reasonCode: 100
392415
reasonText: failed validation
393-
specificationId: 2WL5eYSWGzCHlGmzNxuqVusPxDg
394416
status: REJECTED
395417
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
396418
type: Letter
419+
patch-letter-request-printed:
420+
summary: Request for PRINTED update
421+
value:
422+
data:
423+
attributes:
424+
status: PRINTED
425+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
426+
type: Letter
427+
patch-letter-request-enclosed:
428+
summary: Request for ENCLOSED update
429+
value:
430+
data:
431+
attributes:
432+
status: ENCLOSED
433+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
434+
type: Letter
435+
patch-letter-request-cancelled:
436+
summary: Request for CANCELLED update
437+
value:
438+
data:
439+
attributes:
440+
reasonCode: 100
441+
reasonText: failed validation
442+
status: CANCELLED
443+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
444+
type: Letter
445+
patch-letter-request-dispatched:
446+
summary: Request for DISPATCHED update
447+
value:
448+
data:
449+
attributes:
450+
status: DISPATCHED
451+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
452+
type: Letter
453+
patch-letter-request-delivered:
454+
summary: Request for DELIVERED update
455+
value:
456+
data:
457+
attributes:
458+
status: DELIVERED
459+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
460+
type: Letter
461+
patch-letter-request-failed:
462+
summary: Request for FAILED update
463+
value:
464+
data:
465+
attributes:
466+
reasonCode: 100
467+
reasonText: failed validation
468+
status: FAILED
469+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
470+
type: Letter
471+
patch-letter-request-returned:
472+
summary: Request for RETURNED update
473+
value:
474+
data:
475+
attributes:
476+
reasonCode: 100
477+
reasonText: failed validation
478+
status: REJECTED
479+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
480+
type: Letter
481+
patch-letter-request-invalid:
482+
summary: Request for an invalid update
483+
value:
484+
data:
485+
attributes:
486+
status: INVALID_STATUS
487+
id: 2WL5eYSWGzCHlGmzNxuqVusPxDg
488+
type: Letter
489+
patch-letter-request-not-found:
490+
summary: Request for a non existant letter
491+
value:
492+
data:
493+
attributes:
494+
status: ACCEPTED
495+
id: "123654789"
496+
type: Letter
397497
schema:
398498
$ref: "#/components/schemas/patchLetters_request"
399499
required: true
@@ -406,6 +506,7 @@ paths:
406506
value:
407507
data:
408508
attributes:
509+
groupId: abc123
409510
reasonCode: 100
410511
reasonText: failed validation
411512
specificationId: 2WL5eYSWGzCHlGmzNxuqVusPxDg
@@ -497,7 +598,6 @@ paths:
497598
name: id
498599
required: true
499600
schema:
500-
example: 24L5eYSWGzCHlGmzNxuqVusPxDg
501601
type: string
502602
style: simple
503603
- description: "Unique request identifier, in the format of a GUID"
@@ -595,7 +695,6 @@ paths:
595695
name: id
596696
required: true
597697
schema:
598-
example: 24L5eYSWGzCHlGmzNxuqVusPxDg
599698
type: string
600699
style: simple
601700
- description: "Unique request identifier, in the format of a GUID"
@@ -658,6 +757,7 @@ paths:
658757
data:
659758
attributes:
660759
cost: 10.25
760+
groupId: abc123
661761
lineItem: Letter
662762
quantity: 22
663763
specificationId: da0b1495-c7cb-468c-9d81-07dee089d728
@@ -677,6 +777,7 @@ paths:
677777
data:
678778
attributes:
679779
cost: 10.25
780+
groupId: abc123
680781
lineItem: Letter
681782
quantity: 22
682783
specificationId: da0b1495-c7cb-468c-9d81-07dee089d728
@@ -767,6 +868,9 @@ components:
767868
specificationId:
768869
example: 2WL5eYSWGzCHlGmzNxuqVusPxDg
769870
type: string
871+
groupId:
872+
example: abc123
873+
type: string
770874
status:
771875
default: PENDING
772876
description: The supplier status of an individual letter
@@ -807,30 +911,6 @@ components:
807911
data:
808912
$ref: "#/components/schemas/postLetters_request_data_inner"
809913
type: object
810-
createMI_201_response_data_attributes:
811-
properties:
812-
messageReference:
813-
example: da0b1495-c7cb-468c-9d81-07dee089d728
814-
type: string
815-
timestamp:
816-
example: 2023-11-17T14:27:51.413Z
817-
format: date-time
818-
type: string
819-
lineItem:
820-
example: Letter
821-
type: string
822-
quantity:
823-
example: 22
824-
type: number
825-
cost:
826-
description: Total Amount
827-
example: 10.25
828-
type: number
829-
stockRemaining:
830-
description: Stock remaining for this line item
831-
example: 20000
832-
type: number
833-
type: object
834914
listLetters_404_response_data:
835915
properties:
836916
errors:
@@ -863,9 +943,6 @@ components:
863943
type: object
864944
postLetters_request_data_inner_attributes:
865945
properties:
866-
specificationId:
867-
example: 2WL5eYSWGzCHlGmzNxuqVusPxDg
868-
type: string
869946
status:
870947
default: PENDING
871948
description: The supplier status of an individual letter
@@ -939,7 +1016,7 @@ components:
9391016
example: 2WL5eYSWGzCHlGmzNxuqVusPxDg
9401017
type: string
9411018
attributes:
942-
$ref: "#/components/schemas/createMI_201_response_data_attributes"
1019+
$ref: "#/components/schemas/createMI_request_data_attributes"
9431020
type: object
9441021
listLetters_404_response_data_errors_inner:
9451022
properties:
@@ -965,6 +1042,9 @@ components:
9651042
specificationId:
9661043
example: da0b1495-c7cb-468c-9d81-07dee089d728
9671044
type: string
1045+
groupId:
1046+
example: abc123
1047+
type: string
9681048
timestamp:
9691049
example: 2023-11-17T14:27:51.413Z
9701050
format: date-time

sandbox/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22

33
const config = {
44
ROOT_DIR: __dirname,
5-
URL_PORT: 3000,
5+
URL_PORT: 9000,
66
URL_PATH: 'http://127.0.0.1',
77
BASE_VERSION: '',
88
CONTROLLER_DIRECTORY: path.join(__dirname, 'controllers'),

sandbox/controllers/Controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ class Controller {
105105

106106
static async handleRequest(request, response, serviceOperation) {
107107
try {
108-
const serviceResponse = await serviceOperation(this.collectRequestParams(request));
108+
const requestParams = this.collectRequestParams(request);
109+
const serviceResponse = await serviceOperation(requestParams);
109110
Controller.sendResponse(response, serviceResponse);
110111
} catch (error) {
111112
Controller.sendError(response, error);

sandbox/data/examples/getLetter/responses/getLetter-24L5eYSWGzCHlGmzNxuqVusPxDg.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
"data": {
33
"attributes": {
4-
"reasonCode": 100,
5-
"reasonText": "failed validation",
64
"specificationId": "2WL5eYSWGzCHlGmzNxuqVusPxDg",
75
"status": "PENDING"
86
},
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"data": {
3+
"attributes": {
4+
"specificationId": "2WL5eYSWGzCHlGmzNxuqVusPxDg",
5+
"status": "ACCEPTED"
6+
},
7+
"id": "2AL5eYSWGzCHlGmzNxuqVusPxDg",
8+
"type": "Letter"
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"data": {
3+
"attributes": {
4+
"specificationId": "2WL5eYSWGzCHlGmzNxuqVusPxDg",
5+
"status": "PRINTED"
6+
},
7+
"id": "2BL5eYSWGzCHlGmzNxuqVusPxDg",
8+
"type": "Letter"
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"data": {
3+
"attributes": {
4+
"specificationId": "2WL5eYSWGzCHlGmzNxuqVusPxDg",
5+
"status": "ENCLOSED"
6+
},
7+
"id": "2CL5eYSWGzCHlGmzNxuqVusPxDg",
8+
"type": "Letter"
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"data": {
3+
"attributes": {
4+
"specificationId": "2WL5eYSWGzCHlGmzNxuqVusPxDg",
5+
"status": "DISPATCHED"
6+
},
7+
"id": "2DL5eYSWGzCHlGmzNxuqVusPxDg",
8+
"type": "Letter"
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"data": {
3+
"attributes": {
4+
"specificationId": "2WL5eYSWGzCHlGmzNxuqVusPxDg",
5+
"status": "DELIVERED"
6+
},
7+
"id": "2EL5eYSWGzCHlGmzNxuqVusPxDg",
8+
"type": "Letter"
9+
}
10+
}

0 commit comments

Comments
 (0)