From 6214b241b121f78b9a4c70ec1c94e9e1047b97ca Mon Sep 17 00:00:00 2001 From: Greg Tyler Date: Tue, 7 Nov 2023 14:13:54 +0000 Subject: [PATCH] Rename `fee-approved` -> `reduced-fee-approved` (#826) To match [specification](https://ministryofjustice.github.io/opg-event-store/domains/POAS/events/reduced-fee-approved/). --- Makefile | 4 ++-- cmd/event-received/handlers_test.go | 6 +++--- cmd/event-received/main.go | 2 +- .../environment/region/modules/event_received/lambda.tf | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9fb2552911..b8401b97f9 100644 --- a/Makefile +++ b/Makefile @@ -99,8 +99,8 @@ get-documents: ##@app dumps all documents in the lpas dynamodb table that are r emit-evidence-received: ##@app emits an evidence-received event with the given UID e.g. emit-evidence-received uid=abc-123 curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"version":"0","id":"63eb7e5f-1f10-4744-bba9-e16d327c3b98","detail-type":"evidence-received","source":"opg.poas.sirius","account":"653761790766","time":"2023-08-30T13:40:30Z","region":"eu-west-1","resources":[],"detail":{"UID":"$(uid)"}}' -emit-fee-approved: ##@app emits a fee-approved event with the given UID e.g. emit-fee-approved uid=abc-123 - curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"version":"0","id":"63eb7e5f-1f10-4744-bba9-e16d327c3b98","detail-type":"fee-approved","source":"opg.poas.sirius","account":"653761790766","time":"2023-08-30T13:40:30Z","region":"eu-west-1","resources":[],"detail":{"UID":"$(uid)"}}' +emit-reduced-fee-approved: ##@app emits a reduced-fee-approved event with the given UID e.g. emit-reduced-fee-approved uid=abc-123 + curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"version":"0","id":"63eb7e5f-1f10-4744-bba9-e16d327c3b98","detail-type":"reduced-fee-approved","source":"opg.poas.sirius","account":"653761790766","time":"2023-08-30T13:40:30Z","region":"eu-west-1","resources":[],"detail":{"UID":"$(uid)"}}' emit-fee-denied: ##@app emits a fee-denied event with the given UID e.g. emit-fee-denied uid=abc-123 curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"version":"0","id":"63eb7e5f-1f10-4744-bba9-e16d327c3b98","detail-type":"fee-denied","source":"opg.poas.sirius","account":"653761790766","time":"2023-08-30T13:40:30Z","region":"eu-west-1","resources":[],"detail":{"UID":"$(uid)"}}' diff --git a/cmd/event-received/handlers_test.go b/cmd/event-received/handlers_test.go index f1be4ccce5..4955dd409a 100644 --- a/cmd/event-received/handlers_test.go +++ b/cmd/event-received/handlers_test.go @@ -172,7 +172,7 @@ func TestHandleEvidenceReceivedWhenClientPutError(t *testing.T) { func TestHandleFeeApproved(t *testing.T) { event := events.CloudWatchEvent{ - DetailType: "fee-approved", + DetailType: "reduced-fee-approved", Detail: json.RawMessage(`{"uid":"M-1111-2222-3333"}`), } @@ -208,7 +208,7 @@ func TestHandleFeeApproved(t *testing.T) { func TestHandleFeeApprovedWhenDynamoClientPutError(t *testing.T) { event := events.CloudWatchEvent{ - DetailType: "fee-approved", + DetailType: "reduced-fee-approved", Detail: json.RawMessage(`{"uid":"M-1111-2222-3333"}`), } @@ -239,7 +239,7 @@ func TestHandleFeeApprovedWhenDynamoClientPutError(t *testing.T) { func TestHandleFeeApprovedWhenShareCodeSenderError(t *testing.T) { event := events.CloudWatchEvent{ - DetailType: "fee-approved", + DetailType: "reduced-fee-approved", Detail: json.RawMessage(`{"uid":"M-1111-2222-3333"}`), } diff --git a/cmd/event-received/main.go b/cmd/event-received/main.go index c125a8babe..d21156a2e8 100644 --- a/cmd/event-received/main.go +++ b/cmd/event-received/main.go @@ -138,7 +138,7 @@ func handler(ctx context.Context, event Event) error { case "evidence-received": err = handleEvidenceReceived(ctx, dynamoClient, event.CloudWatchEvent) - case "fee-approved": + case "reduced-fee-approved": bundle := localize.NewBundle("./lang/en.json", "./lang/cy.json") //TODO do this in handleFeeApproved when/if we save lang preference in LPA diff --git a/terraform/environment/region/modules/event_received/lambda.tf b/terraform/environment/region/modules/event_received/lambda.tf index 00b10bbcfe..4023c42e7f 100644 --- a/terraform/environment/region/modules/event_received/lambda.tf +++ b/terraform/environment/region/modules/event_received/lambda.tf @@ -39,7 +39,7 @@ resource "aws_cloudwatch_event_rule" "receive_events_sirius" { event_pattern = jsonencode({ source = ["opg.poas.sirius"], - detail-type = ["evidence-received", "fee-approved", "more-evidence-required"], + detail-type = ["evidence-received", "reduced-fee-approved", "more-evidence-required"], }) provider = aws.region }