diff --git a/ccdImports/configFiles/CCD_Probate_Backoffice/CaseEvent.json b/ccdImports/configFiles/CCD_Probate_Backoffice/CaseEvent.json index 259c4cf173..45a4464377 100644 --- a/ccdImports/configFiles/CCD_Probate_Backoffice/CaseEvent.json +++ b/ccdImports/configFiles/CCD_Probate_Backoffice/CaseEvent.json @@ -36,7 +36,7 @@ {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "boAmendCaseDetailsGrantRegistrarEscalation", "Name": "Amend case details", "Description": "Amend case details", "DisplayOrder": 35, "PreConditionState(s)": "BOGrantIssuedRegistrarEscalation", "PostConditionState": "BOGrantIssuedRegistrarEscalation", "CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/case/validateCaseDetails", "SecurityClassification": "Public", "ShowSummary": "Y", "ShowEventNotes": "Y"}, {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "boAmendCaseDetailsPostGrantRegistrarEscalation", "Name": "Amend case details", "Description": "Amend case details", "DisplayOrder": 36, "PreConditionState(s)": "BOPostGrantIssuedRegistrarEscalation", "PostConditionState": "BOPostGrantIssuedRegistrarEscalation", "CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/case/validateCaseDetails", "SecurityClassification": "Public", "ShowSummary": "Y", "ShowEventNotes": "Y"}, {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "boAmendCaseDetailsForImport", "Name": "Amend case details for import", "Description": "Amend case details for import", "DisplayOrder": 37, "PreConditionState(s)": "BOCaseImported", "PostConditionState": "CaseCreated", "CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/case/validateCaseDetails", "SecurityClassification": "Public", "ShowSummary": "N", "ShowEventNotes": "Y"}, - {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "boAmendLegalStatement", "Name": "Amend legal statement", "Description": "Upload an amended legal statement", "DisplayOrder": 38, "PreConditionState(s)": "*", "PostConditionState": "*", "CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/document/amendLegalStatement", "SecurityClassification": "Public", "ShowSummary": "Y", "ShowEventNotes": "Y"}, + {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "boAmendLegalStatement", "Name": "Amend legal statement", "Description": "Upload an amended legal statement", "DisplayOrder": 38, "PreConditionState(s)": "*", "PostConditionState": "*", "CallBackURLAboutToStartEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/document/startAmendLegalStatement", CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/document/amendLegalStatement", "SecurityClassification": "Public", "ShowSummary": "Y", "ShowEventNotes": "Y"}, {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "solicitorCreateApplication", "Name": "Apply for probate", "Description": "Solicitor begins a new application with firm and case details", "DisplayOrder": 39, "PostConditionState": "SolAppCreatedDeceasedDtls", "CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/case/sols-created", "CallBackURLSubmittedEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/case/sols-access?caseTypeId=GrantOfRepresentation", "SecurityClassification": "Public", "ShowSummary": "Y", "CanSaveDraft": "y", "EndButtonLabel": "Save and continue", "ShowEventNotes": "Y"}, {"LiveFrom": "01/01/2021", "CaseTypeID": "GrantOfRepresentation", "ID": "applyNocDecision", "Name": "Apply NoC Decision", "Description": "Apply Notice of Change Request", "DisplayOrder": 40, "PreConditionState(s)": "CasePrinted;BOCaseStoppedAwaitRedec;BOCaseImported;BOCaseMatchingIssueGrant;BOCaseQA;BOCaseStopped;BOCaveatPermenant;BOSotGenerated;BOReadyToIssue;BORedecNotificationSent;BOCaseWorkerEscalation;Dormant;BORegistrarEscalation;", "PostConditionState": "*", "CallBackURLAboutToStartEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/noc/apply-decision", "CallBackURLSubmittedEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/notify/noc-notification", "SecurityClassification": "Public", "ShowSummary": "Y", "ShowEventNotes": "Y"}, {"LiveFrom": "01/01/2017", "CaseTypeID": "GrantOfRepresentation", "ID": "assembleLetter", "Name": "Assemble a letter", "Description": "Assemble a letter", "DisplayOrder": 41, "PreConditionState(s)": "BOCaseStopped", "PostConditionState": "BOCaseStopped", "CallBackURLAboutToSubmitEvent": "http://${CCD_DEF_CASE_SERVICE_BASE_URL}/document/generateLetter", "SecurityClassification": "Public", "ShowSummary": "N", "ShowEventNotes": "Y"}, 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 aadb86312d..4048b433de 100644 --- a/src/main/java/uk/gov/hmcts/probate/controller/DocumentController.java +++ b/src/main/java/uk/gov/hmcts/probate/controller/DocumentController.java @@ -455,6 +455,20 @@ public ResponseEntity permanentlyDeleteRemovedWil return ResponseEntity.ok(willLodgementCallbackResponseTransformer.transform(callbackRequest)); } + @PostMapping(path = "/startAmendLegalStatement", consumes = APPLICATION_JSON_VALUE) + public ResponseEntity startAmendLegalStatement( + @RequestBody final CallbackRequest callbackRequest) { + final CaseDetails caseDetails = callbackRequest.getCaseDetails(); + final long caseId = caseDetails.getId(); + + log.info("Starting amend legal statement for case: {}", caseId); + + redeclarationSoTValidationRule.validate(caseDetails); + + CallbackResponse response = callbackResponseTransformer.transformCase(callbackRequest, Optional.empty()); + return ResponseEntity.ok(response); + } + @PostMapping(path = "/validateAmendLegalStatement", consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity validateAmendLegalStatement( @RequestBody final CallbackRequest callbackRequest) { diff --git a/src/test/java/uk/gov/hmcts/probate/controller/DocumentControllerUnitTest.java b/src/test/java/uk/gov/hmcts/probate/controller/DocumentControllerUnitTest.java index 0e8f736ccf..4b95280115 100644 --- a/src/test/java/uk/gov/hmcts/probate/controller/DocumentControllerUnitTest.java +++ b/src/test/java/uk/gov/hmcts/probate/controller/DocumentControllerUnitTest.java @@ -328,4 +328,16 @@ void shouldTransformForCitizenHubResponse() { verify(callbackResponseTransformer, times(1)).transformCitizenHubResponse(callbackRequest); assertThat(response.getStatusCode(), is(HttpStatus.OK)); } + + @Test + void shouldCallValidateSotForStartAmendLegalStatement() { + CallbackRequest callbackRequest = mock(CallbackRequest.class); + CaseDetails caseDetailsMock = mock(CaseDetails.class); + when(callbackRequest.getCaseDetails()).thenReturn(caseDetailsMock); + + ResponseEntity response = documentController.startAmendLegalStatement(callbackRequest); + + verify(redeclarationSoTValidationRule, times(1)).validate(caseDetailsMock); + assertThat(response.getStatusCode(), is(HttpStatus.OK)); + } }