diff --git a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/domain/caseworker/EnterGenAppRequest.java b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/domain/caseworker/EnterGenAppRequest.java index 09339ccb68..2adf39d78a 100644 --- a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/domain/caseworker/EnterGenAppRequest.java +++ b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/domain/caseworker/EnterGenAppRequest.java @@ -60,6 +60,12 @@ public class EnterGenAppRequest { ) private String hwfReference; + @CCD(label = "Do all parties consent to this application?") + private VerticalYesNo allPartiesAgree; + + @CCD(label = "Has the applicant asked for this application to be made without notice?") + private VerticalYesNo withoutNotice; + @CCD( label = "Add document", hint = "Upload a document to the system", diff --git a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/event/caseworker/entergenapp/EnterGenApp.java b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/event/caseworker/entergenapp/EnterGenApp.java index a6fcdadbcb..23c3e714b2 100644 --- a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/event/caseworker/entergenapp/EnterGenApp.java +++ b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/event/caseworker/entergenapp/EnterGenApp.java @@ -54,6 +54,7 @@ public void configureDecentralised(DecentralisedConfigBuilder -
-

- Placeholder -

-
- - """; +public class ConsentAndNotice implements CcdPageConfiguration { @Override public void addTo(PageBuilder pageBuilder) { @@ -22,7 +16,11 @@ public void addTo(PageBuilder pageBuilder) { .page("consentAndNotice") .pageLabel("Application consent and notice") .label("consentAndNotice-lineSeparator", "---") - .label("consentAndNotice-placeholder", PLACEHOLDER_BANNER); + .complex(PCSCase::getEnterGenAppRequest) + .mandatory(EnterGenAppRequest::getAllPartiesAgree) + .mandatory(EnterGenAppRequest::getWithoutNotice, + fieldEquals("enter_genapp_AllPartiesAgree", VerticalYesNo.NO)) + .done(); } } diff --git a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/page/caseworker/entergenapp/ReferApplicationToJudge.java b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/page/caseworker/entergenapp/ReferApplicationToJudge.java index decd902637..96a31b9c76 100644 --- a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/page/caseworker/entergenapp/ReferApplicationToJudge.java +++ b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/page/caseworker/entergenapp/ReferApplicationToJudge.java @@ -1,19 +1,16 @@ package uk.gov.hmcts.reform.pcs.ccd.page.caseworker.entergenapp; +import uk.gov.hmcts.reform.pcs.ccd.ShowConditions; import uk.gov.hmcts.reform.pcs.ccd.common.CcdPageConfiguration; import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder; +import uk.gov.hmcts.reform.pcs.ccd.domain.VerticalYesNo; + +import static uk.gov.hmcts.reform.pcs.ccd.ShowConditions.fieldEquals; public class ReferApplicationToJudge implements CcdPageConfiguration { - private static final String PLACEHOLDER_BANNER = """ -
-
-

- Placeholder -

-
-
+ private static final String MESSAGE_TEXT = """ +

You must refer this application to a judge.

"""; @Override @@ -21,8 +18,12 @@ public void addTo(PageBuilder pageBuilder) { pageBuilder .page("referApplicationToJudge") .pageLabel("Refer without notice application to judge") + .showCondition(ShowConditions.and( + fieldEquals("enter_genapp_AllPartiesAgree", VerticalYesNo.NO), + fieldEquals("enter_genapp_WithoutNotice", VerticalYesNo.YES)) + ) .label("referApplicationToJudge-lineSeparator", "---") - .label("referApplicationToJudge-placeholder", PLACEHOLDER_BANNER); + .label("referApplicationToJudge-message", MESSAGE_TEXT); } } diff --git a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppService.java b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppService.java index 6584f323b4..f906e60cc2 100644 --- a/src/main/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppService.java +++ b/src/main/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppService.java @@ -144,6 +144,7 @@ public void createGenAppEntity(PCSCase caseData, .state(initialState) .feeAmountReceived(enterGenAppRequest.getFeeAmountReceived()) .appliedForHwf(enterGenAppRequest.getAppliedForHwf()) + .otherPartiesAgreed(enterGenAppRequest.getAllPartiesAgree()) .build(); if (enterGenAppRequest.getApplicationTypeOption() == EnterGenAppType.SOMETHING_ELSE) { @@ -160,6 +161,10 @@ public void createGenAppEntity(PCSCase caseData, genAppEntity.setHelpWithFeesEntity(helpWithFeesEntity); } + if (enterGenAppRequest.getAllPartiesAgree() == VerticalYesNo.NO) { + genAppEntity.setWithoutNotice(enterGenAppRequest.getWithoutNotice()); + } + Document uploadedGenApp = caseData.getUploadSingleDocument(); DocumentEntity submissionDocument = createSubmissionDocumentEntity( uploadedGenApp, pcsCaseEntity, genAppEntity, applicantParty.getId() diff --git a/src/test/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppServiceTest.java b/src/test/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppServiceTest.java index 79e0ac2483..d28a32b068 100644 --- a/src/test/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/pcs/ccd/service/genapp/GenAppServiceTest.java @@ -880,6 +880,71 @@ void shouldSetHwfFlagButNotReferenceWhenNo() { assertThat(genAppEntity.getHelpWithFeesEntity()).isNull(); } + @ParameterizedTest + @EnumSource(VerticalYesNo.class) + void shouldSetAllPartiesAgreeFlag(VerticalYesNo allPartiesAgree) { + // Given + EnterGenAppRequest enterGenAppRequest = EnterGenAppRequest.builder() + .applicationTypeOption(EnterGenAppType.SOMETHING_ELSE) + .allPartiesAgree(allPartiesAgree) + .build(); + + PCSCase caseData = PCSCase.builder() + .enterGenAppRequest(enterGenAppRequest) + .build(); + + // When + underTest.createGenAppEntity(caseData, pcsCaseEntity, applicantParty, GEN_APP_ISSUED); + + // Then + GenAppEntity genAppEntity = getSavedGenAppEntity(); + assertThat(genAppEntity.getOtherPartiesAgreed()).isEqualTo(allPartiesAgree); + } + + @ParameterizedTest + @EnumSource(VerticalYesNo.class) + void shouldSetWithoutNoticeFlagWhenNotAllPartiesAgree(VerticalYesNo withoutNotice) { + // Given + EnterGenAppRequest enterGenAppRequest = EnterGenAppRequest.builder() + .applicationTypeOption(EnterGenAppType.SOMETHING_ELSE) + .allPartiesAgree(VerticalYesNo.NO) + .withoutNotice(withoutNotice) + .build(); + + PCSCase caseData = PCSCase.builder() + .enterGenAppRequest(enterGenAppRequest) + .build(); + + // When + underTest.createGenAppEntity(caseData, pcsCaseEntity, applicantParty, GEN_APP_ISSUED); + + // Then + GenAppEntity genAppEntity = getSavedGenAppEntity(); + assertThat(genAppEntity.getWithoutNotice()).isEqualTo(withoutNotice); + } + + @ParameterizedTest + @EnumSource(VerticalYesNo.class) + void shouldNotSetWithoutNoticeFlagWhenAllPartiesAgree(VerticalYesNo withoutNotice) { + // Given + EnterGenAppRequest enterGenAppRequest = EnterGenAppRequest.builder() + .applicationTypeOption(EnterGenAppType.SOMETHING_ELSE) + .allPartiesAgree(VerticalYesNo.YES) + .withoutNotice(withoutNotice) + .build(); + + PCSCase caseData = PCSCase.builder() + .enterGenAppRequest(enterGenAppRequest) + .build(); + + // When + underTest.createGenAppEntity(caseData, pcsCaseEntity, applicantParty, GEN_APP_ISSUED); + + // Then + GenAppEntity genAppEntity = getSavedGenAppEntity(); + assertThat(genAppEntity.getWithoutNotice()).isNull(); + } + @Test void shouldSaveUploadedGenAppAsSubmissionDocument() { // Given