From dcbda2825e2c4d25c7c2e065e0f809116ce306e4 Mon Sep 17 00:00:00 2001 From: Aadil Ahmed Date: Wed, 18 Dec 2024 09:27:39 +0000 Subject: [PATCH] Email case team only when there's no external reference --- .../middlewares/services/SubmitService/SubmitService.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/src/middlewares/services/SubmitService/SubmitService.ts b/api/src/middlewares/services/SubmitService/SubmitService.ts index a113c3c6..8d172083 100644 --- a/api/src/middlewares/services/SubmitService/SubmitService.ts +++ b/api/src/middlewares/services/SubmitService/SubmitService.ts @@ -61,8 +61,12 @@ export class SubmitService { type, metadata, }); - const caseProcessJob = await caseService.sendToProcessQueue(processQueueData); - this.logger.info({ reference, caseProcessJob }, `SES_PROCESS job queued successfully for ${reference}`); + + // only email case team when there is no external reference (i.e. from Orbit) indicating a submission failure there + if (!metadata?.externalReference) { + const caseProcessJob = await caseService.sendToProcessQueue(processQueueData); + this.logger.info({reference, caseProcessJob}, `SES_PROCESS job queued successfully for ${reference}`); + } const userProcessJob = await this.userService.sendToProcessQueue(answers, { reference, payment: metadata.pay, type, postal: metadata.postal });