Skip to content

Commit

Permalink
Replicate behaviour for redeclare legal statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-saunders-cts committed Jan 10, 2025
1 parent a2cf8f0 commit 08ed5fb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,20 @@ public ResponseEntity<WillLodgementCallbackResponse> permanentlyDeleteRemovedWil
return ResponseEntity.ok(willLodgementCallbackResponseTransformer.transform(callbackRequest));
}

@PostMapping(path = "/startAmendLegalStatement", consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<CallbackResponse> 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<CallbackResponse> validateAmendLegalStatement(
@RequestBody final CallbackRequest callbackRequest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CallbackResponse> response = documentController.startAmendLegalStatement(callbackRequest);

verify(redeclarationSoTValidationRule, times(1)).validate(caseDetailsMock);
assertThat(response.getStatusCode(), is(HttpStatus.OK));
}
}

0 comments on commit 08ed5fb

Please sign in to comment.