diff --git a/src/main/java/uk/gov/hmcts/probate/controller/DocumentController.java b/src/main/java/uk/gov/hmcts/probate/controller/DocumentController.java index 5726b8c3e8..07793f074e 100644 --- a/src/main/java/uk/gov/hmcts/probate/controller/DocumentController.java +++ b/src/main/java/uk/gov/hmcts/probate/controller/DocumentController.java @@ -198,9 +198,6 @@ public ResponseEntity generateGrant( documents.add(digitalGrantDocument); documents.add(coverSheet); Optional caseworkerInfo = userInfoService.getCaseworkerInfo(); - if (caseData.getOutsideUKGrantCopies() != null && caseData.getOutsideUKGrantCopies() > 0) { - documents.add(notificationService.sendSealedAndCertifiedEmail(caseDetails)); - } if (caseData.isGrantIssuedEmailNotificationRequested()) { callbackResponse = eventValidationService.validateEmailRequest(callbackRequest, emailAddressNotifyValidationRules); @@ -208,14 +205,16 @@ public ResponseEntity generateGrant( Document grantIssuedSentEmail = notificationService.sendEmail(grantState.apply(caseData.getCaseType()), caseDetails); documents.add(grantIssuedSentEmail); - callbackResponse = - callbackResponseTransformer - .addDocuments(callbackRequest, documents, letterId, pdfSize, caseworkerInfo); + } else { + return ResponseEntity.ok(callbackResponse); } - } else { - callbackResponse = callbackResponseTransformer.addDocuments(callbackRequest, documents, letterId, pdfSize, - caseworkerInfo); + + } + if (caseData.getOutsideUKGrantCopies() != null && caseData.getOutsideUKGrantCopies() > 0) { + documents.add(notificationService.sendSealedAndCertifiedEmail(caseDetails)); } + callbackResponse = callbackResponseTransformer + .addDocuments(callbackRequest, documents, letterId, pdfSize, caseworkerInfo); return ResponseEntity.ok(callbackResponse); } diff --git a/src/main/java/uk/gov/hmcts/probate/service/NotificationService.java b/src/main/java/uk/gov/hmcts/probate/service/NotificationService.java index d295322999..306c5f6d81 100644 --- a/src/main/java/uk/gov/hmcts/probate/service/NotificationService.java +++ b/src/main/java/uk/gov/hmcts/probate/service/NotificationService.java @@ -183,12 +183,12 @@ public Document sendSealedAndCertifiedEmail(CaseDetails caseDetails) throws Noti deceasedName); doCommonNotificationServiceHandling(personalisation, caseDetails.getId()); - log.info("Sealed And Certified Personlisation complete now get the email response"); + log.info("Sealed And Certified get the email response for case {}", caseDetails.getId()); SendEmailResponse response = notificationClientService.sendEmail(templateId, emailAddresses.getSealedAndCertifiedEmail(), personalisation, reference); - log.info("Send Sealed And Certified completed."); + log.info("Send Sealed And Certified completed for case {}", caseDetails.getId()); return getGeneratedSentEmailDocument(response, emailAddresses.getSealedAndCertifiedEmail(), SENT_EMAIL); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b5fd7c2b29..14fcac8960 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -314,7 +314,6 @@ notifications: caveatWithdrawn: "c63bc430-9868-4f10-924b-408c7ac3cbd8" grantDelayed: "7045b381-a087-44fe-8bb5-e5a591cb8473" grantAwaitingDocumentation: "cc4aa69b-10fb-4a9c-9e0e-1851dfaa69e9" - sealedAndCertified: "16c9a4ce-162f-4ed1-8d70-be79616685ac" solicitor: applicationReceived: "2f282002-6799-47d0-92dd-726960b91c98" applicationReceivedNoDocs: "60eab724-adec-4d5d-a0a1-aef73ed7da4d" @@ -339,7 +338,6 @@ notifications: grantDelayed: "7045b381-a087-44fe-8bb5-e5a591cb8473" grantAwaitingDocumentation: "638395bf-805f-48a7-97b1-d26ea9e9334e" noticeOfChangeReceived: "6af59aa3-b379-406f-9be4-331b8411c6d9" - sealedAndCertified: "16c9a4ce-162f-4ed1-8d70-be79616685ac" documents: templates: