Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@
import lombok.Getter;
import uk.gov.hmcts.ccd.sdk.api.HasLabel;

import java.util.Arrays;

@AllArgsConstructor
@Getter
public enum AdditionalDocumentType implements HasLabel {

WITNESS_STATEMENT("Witness statement"),
RENT_STATEMENT("Rent statement"),

// England specific types
TENANCY_AGREEMENT("Tenancy agreement"),

// Wales specific types
OCCUPATION_LICENCE("Occupation contract or licence"),
ENERGY_PERFORMANCE_CERTIFICATE("Energy performance certificate"),
GAS_SAFETY_CERTIFICATE("Gas safety certificate"),
EICR_REPORT("Electrical Installation Condition Report (EICR)"),

CERTIFICATE_OF_SERVICE("Certificate of service"),
CORRESPONDENCE_FROM_DEFENDANT("Correspondence from defendant"),
CORRESPONDENCE_FROM_CLAIMANT("Correspondence from claimant"),
Expand All @@ -24,4 +35,19 @@ public enum AdditionalDocumentType implements HasLabel {

private final String label;

public static AdditionalDocumentType getValueFromLabel(String label) {
return Arrays.stream(values()).filter(v -> v.getLabel().equals(label)).findFirst()
.orElseThrow(() -> new IllegalArgumentException("No AdditionalDocumentType with label: " + label));
}

public static boolean isEnglandSpecific(AdditionalDocumentType val) {
return val == TENANCY_AGREEMENT;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a more elegant way to achieve this is for the enum constructor to take a Set of the legislative countries for which it applies. See ClaimantType for an example.

It also makes it easier to build up the dynamic list to show based on the legislative country.


public static boolean isWalesSpecific(AdditionalDocumentType val) {
return val == OCCUPATION_LICENCE
|| val == ENERGY_PERFORMANCE_CERTIFICATE
|| val == GAS_SAFETY_CERTIFICATE
|| val == EICR_REPORT;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package uk.gov.hmcts.reform.pcs.ccd.domain;


import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import uk.gov.hmcts.ccd.sdk.api.CCD;
import uk.gov.hmcts.ccd.sdk.type.Document;
import uk.gov.hmcts.ccd.sdk.type.DynamicList;
import uk.gov.hmcts.ccd.sdk.type.FieldType;
import uk.gov.hmcts.reform.pcs.ccd.accesscontrol.CitizenAccess;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AdditionalDocuments {

@CCD(
label = "Type of document",
access = {CitizenAccess.class}
)
private DynamicList documentTypeList;

@CCD(label = "Document", access = {CitizenAccess.class})
private Document document;

@CCD(label = "Short description",
typeOverride = FieldType.TextArea,
access = {CitizenAccess.class}
)
private String description;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
public enum DocumentType implements HasLabel {

RENT_STATEMENT("Rent statement"),
OCCUPATION_LICENCE("Occupation licence"),
OCCUPATION_LICENCE("Occupation contract or licence"),
ENERGY_PERFORMANCE_CERTIFICATE("Energy performance certificate"),
GAS_SAFETY_CERTIFICATE("Gas safety certificate"),
EICR_REPORT("Electrical Installation Condition Report (EICR)"),
TENANCY_LICENCE("Tenancy licence"),
NOTICE_SERVED("Notice served"),
WITNESS_STATEMENT("Witness statement"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,19 @@ public class PCSCase {
)
private VerticalYesNo wantToUploadDocuments;

@Deprecated(since = "05-19-2026", forRemoval = true)
@CCD(
label = "Add document",
hint = "Upload a document to the system"
)
private List<ListValue<AdditionalDocument>> additionalDocuments;

@CCD(
label = "Add document",
hint = "Upload a document to the system"
)
private List<ListValue<AdditionalDocuments>> additionalDocs;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel very clean to have another field which has a similar name to the one above. I presume you're only doing it to prevent an issue with the ES index but I think at this stage it would be better to make the change properly and be ready to drop the ES index since we're not in Prod yet.

Also it would be better to re-use the existing AdditionalDocument class, rather than making an AdditionalDocuments class with an 's', even though it still only contains one document 🙂


@CCD(
label = "Are you planning to make an application at the same time as your claim?",
hint = "After you’ve submitted your claim, there will be instructions on how to make an application"
Expand Down Expand Up @@ -547,6 +554,7 @@ public class PCSCase {
private ComponentLauncher caseFileView;

@CCD(searchable = false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor vertical spacing?

private String formattedDefendantNames;
private String formattedPropertyAddress;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.pcs.ccd.event;

import com.github.kagkarlsson.scheduler.SchedulerClient;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder;
Expand Down Expand Up @@ -61,11 +60,6 @@
import uk.gov.hmcts.reform.pcs.ccd.page.resumepossessionclaim.wales.ProhibitedConductWales;
import uk.gov.hmcts.reform.pcs.ccd.page.resumepossessionclaim.wales.ReasonsForPossessionWales;
import uk.gov.hmcts.reform.pcs.ccd.page.resumepossessionclaim.wales.SecureContractGroundsForPossessionWalesPage;
import uk.gov.hmcts.reform.pcs.ccd.service.DraftCaseDataService;
import uk.gov.hmcts.reform.pcs.ccd.util.AddressFormatter;
import uk.gov.hmcts.reform.pcs.ccd.util.MoneyFormatter;
import uk.gov.hmcts.reform.pcs.feesandpay.service.FeeService;
import uk.gov.hmcts.reform.pcs.reference.service.OrganisationService;

@Component
@AllArgsConstructor
Expand All @@ -91,29 +85,24 @@ public class ResumePossessionClaimConfigurer implements PageConfigurer {
private final SuspensionOfRightToBuyOrderReason suspensionOfRightToBuyOrderReason;
private final StatementOfExpressTerms statementOfExpressTerms;
private final DemotionOfTenancyOrderReason demotionOfTenancyOrderReason;
private final OrganisationService organisationService;
private final ClaimantInformationPage claimantInformationPage;
private final ExemptLandlord exemptLandlord;
private final ProhibitedConductWales prohibitedConductWalesPage;
private final SchedulerClient schedulerClient;
private final DraftCaseDataService draftCaseDataService;
private final OccupationLicenceDetailsWalesPage occupationLicenceDetailsWalesPage;
private final GroundsForPossessionWalesPage groundsForPossessionWales;
private final SecureContractGroundsForPossessionWalesPage secureContractGroundsForPossessionWales;
private final ReasonsForPossessionWales reasonsForPossessionWales;
private final AddressFormatter addressFormatter;
private final RentArrearsGroundsForPossessionPage rentArrearsGroundsForPossessionPage;
private final RentArrearsGroundForPossessionAdditionalGrounds rentArrearsGroundForPossessionAdditionalGrounds;
private final AssuredNoArrearsGroundsForPossessionPage noRentArrearsGroundsForPossessionOptions;
private final CheckingNotice checkingNotice;
private final WalesCheckingNotice walesCheckingNotice;
private final ASBQuestionsWales asbQuestionsWales;
private final UnderlesseeOrMortgageeDetailsPage underlesseeOrMortgageeDetailsPage;
private final FeeService feeService;
private final MoneyFormatter moneyFormatter;
private final RentDetailsPage rentDetailsPage;
private final RentArrears rentArrears;
private final PreActionProtocol preActionProtocol;
private final WantToUploadDocuments wantToUploadDocuments;

@Override
public void configurePages(PageBuilder pageBuilder) {
Expand Down Expand Up @@ -169,7 +158,7 @@ public void configurePages(PageBuilder pageBuilder) {
.add(new UnderlesseeOrMortgageeEntitledToClaimRelief())
.add(underlesseeOrMortgageeDetailsPage)
//TO DO will be routed later on correctly using tech debt ticket
.add(new WantToUploadDocuments())
.add(wantToUploadDocuments)
.add(uploadAdditionalDocumentsDetails)
.add(new GeneralApplication())
.add(new LanguageUsed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import uk.gov.hmcts.ccd.sdk.type.ListValue;
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.AdditionalDocument;
import uk.gov.hmcts.reform.pcs.ccd.domain.AdditionalDocuments;
import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase;
import uk.gov.hmcts.reform.pcs.ccd.domain.State;
import uk.gov.hmcts.reform.pcs.ccd.page.CommonPageContent;
Expand Down Expand Up @@ -46,16 +46,15 @@ public void addTo(PageBuilder pageBuilder) {
<p class="govuk-body govuk-!-font-size-19">Give your document a name that explains what it is.</p>
"""
)

.mandatory(PCSCase::getAdditionalDocuments)
.mandatory(PCSCase::getAdditionalDocs)
.label("uploadAdditionalDocuments-saveAndReturn", CommonPageContent.SAVE_AND_RETURN);
}

private AboutToStartOrSubmitResponse<PCSCase, State> midEvent(CaseDetails<PCSCase, State> details,
CaseDetails<PCSCase, State> detailsBefore) {
PCSCase caseData = details.getData();

List<String> errors = validateDocumentDescription(caseData.getAdditionalDocuments(), DESCRIPTION_LABEL);
List<String> errors = validateDocumentDescription(caseData.getAdditionalDocs(), DESCRIPTION_LABEL);

return AboutToStartOrSubmitResponse.<PCSCase, State>builder()
.errorMessageOverride(StringUtils.joinIfNotEmpty("\n", errors))
Expand All @@ -64,7 +63,7 @@ private AboutToStartOrSubmitResponse<PCSCase, State> midEvent(CaseDetails<PCSCas
}

public List<String> validateDocumentDescription(
List<ListValue<AdditionalDocument>> additionalDocs,
List<ListValue<AdditionalDocuments>> additionalDocs,
String sectionLabel) {

List<String> validationErrors = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,76 @@
package uk.gov.hmcts.reform.pcs.ccd.page.resumepossessionclaim;

import org.springframework.stereotype.Component;
import uk.gov.hmcts.ccd.sdk.api.CaseDetails;
import uk.gov.hmcts.ccd.sdk.api.callback.AboutToStartOrSubmitResponse;
import uk.gov.hmcts.ccd.sdk.type.DynamicList;
import uk.gov.hmcts.ccd.sdk.type.DynamicListElement;
import uk.gov.hmcts.ccd.sdk.type.ListValue;
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.AdditionalDocumentType;
import uk.gov.hmcts.reform.pcs.ccd.domain.AdditionalDocuments;
import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase;
import uk.gov.hmcts.reform.pcs.ccd.domain.State;
import uk.gov.hmcts.reform.pcs.ccd.domain.VerticalYesNo;
import uk.gov.hmcts.reform.pcs.ccd.page.CommonPageContent;
import uk.gov.hmcts.reform.pcs.postcodecourt.model.LegislativeCountry;

import java.util.ArrayList;
import java.util.UUID;

@Component
public class WantToUploadDocuments implements CcdPageConfiguration {

@Override
public void addTo(PageBuilder pageBuilder) {
pageBuilder
.page("wantToUploadDocuments")
.page("wantToUploadDocuments", this::midEvent)
.pageLabel("Upload additional documents")
.label("wantToUploadDocuments-separator", "---")
.mandatory(PCSCase::getWantToUploadDocuments)
.label("wantToUploadDocuments-saveAndReturn", CommonPageContent.SAVE_AND_RETURN);
}

private AboutToStartOrSubmitResponse<PCSCase, State> midEvent(CaseDetails<PCSCase, State> details,
CaseDetails<PCSCase, State> detailsBefore) {
PCSCase caseData = details.getData();

if (caseData.getWantToUploadDocuments().equals(VerticalYesNo.YES)) {
AdditionalDocuments additionalDocuments = new AdditionalDocuments();
LegislativeCountry legislativeCountry = caseData.getLegislativeCountry();

additionalDocuments.setDocumentTypeList(createAdditionalDocumentList(legislativeCountry));
caseData.setAdditionalDocs(new ArrayList<>());
caseData.getAdditionalDocs().add(ListValue.<AdditionalDocuments>builder()
.value(additionalDocuments)
.build());
}

return AboutToStartOrSubmitResponse.<PCSCase, State>builder()
.data(caseData)
.build();
}

private DynamicList createAdditionalDocumentList(LegislativeCountry legislativeCountry) {

DynamicList documentTypeList = new DynamicList(null, new ArrayList<>());

for (AdditionalDocumentType dt : AdditionalDocumentType.values()) {
if (canAddDocumentType(dt, legislativeCountry)) {
DynamicListElement element = new DynamicListElement(UUID.randomUUID(), dt.getLabel());
documentTypeList.getListItems().add(element);
}
}

return documentTypeList;
}

private boolean canAddDocumentType(AdditionalDocumentType dt, LegislativeCountry country) {
if (country.equals(LegislativeCountry.ENGLAND)) {
return AdditionalDocumentType.isEnglandSpecific(dt) || !AdditionalDocumentType.isWalesSpecific(dt);
} else {
return AdditionalDocumentType.isWalesSpecific(dt) || !AdditionalDocumentType.isEnglandSpecific(dt);
}
}
}
Loading
Loading