Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f85c09a
initial commit of Summary page changes
Mar 10, 2026
5e5a643
Added Summary tab markup. Also Changed confirm eviction details page …
Mar 12, 2026
2051b40
I've added date formatters. Also have a current issue where i cannot…
Mar 16, 2026
f6229ee
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 16, 2026
464d212
[#4312] Update flyway version numbering.
tvr-solirius Mar 16, 2026
102f9d6
We can now toggle on the summary page
Mar 16, 2026
bcd77ad
Merge remote-tracking branch 'refs/remotes/origin/HDPI-4312-confirm-e…
Mar 16, 2026
dd08a0f
Added logs to see if we get pcs case objective for show condition
Mar 17, 2026
3d56407
Refactor confirm eviction event and related logic: rename the event t…
tvr-solirius Mar 20, 2026
5eb187a
Reverting local change
tvr-solirius Mar 20, 2026
25648ea
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 20, 2026
1d105e2
Move enforcement‑order handling into a dedicated mediator, removing t…
tvr-solirius Mar 20, 2026
3e6165b
Cleanup ConfirmEviction event and helpers: drop unused start method a…
tvr-solirius Mar 20, 2026
afbd098
Merge branch 'master' into HDPI-4312-confirm-eviction-summary
srinijg Mar 24, 2026
e294cb0
Merge branch 'master' into HDPI-4312-confirm-eviction-summary
srinijg Mar 24, 2026
2db4061
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 26, 2026
a5e7fb6
Flyway version update.
tvr-solirius Mar 26, 2026
8595499
Change of version in the flyway to the correct script this time :)
tvr-solirius Mar 26, 2026
3bcc795
Merge remote-tracking branch 'origin/master' into HDPI-4312-confirm-e…
tvr-solirius Mar 26, 2026
d68f6e1
flyway version update.
tvr-solirius Mar 26, 2026
1d6f98f
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 27, 2026
21df5f8
Refactor eviction summary formatting: extract date formatting to Date…
tvr-solirius Mar 27, 2026
cd9b42c
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 27, 2026
4541fd4
Flyway version update and fix of test
tvr-solirius Mar 27, 2026
1b81801
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius Mar 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/uk/gov/hmcts/reform/pcs/ccd/CaseType.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void configure(final ConfigBuilder<PCSCase, State, UserRole> builder) {
.field("nextStepsMarkdown", NEVER_SHOW);

builder.tab("summary", "Summary")
.showCondition(ShowConditions.stateNotEquals(AWAITING_SUBMISSION_TO_HMCTS))
.label("confirmEvictionSummaryMarkupLabel", null, "${confirmEvictionSummaryMarkup}")
.field("confirmEvictionSummaryMarkup", NEVER_SHOW)
.field(PCSCase::getPropertyAddress);

builder.tab("CaseHistory", "History")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package uk.gov.hmcts.reform.pcs.ccd;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.ccd.sdk.type.YesOrNo;
import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase;
import uk.gov.hmcts.reform.pcs.ccd.entity.ClaimEntity;
import uk.gov.hmcts.reform.pcs.ccd.entity.PcsCaseEntity;
import uk.gov.hmcts.reform.pcs.ccd.entity.enforcetheorder.EnforcementOrderEntity;
import uk.gov.hmcts.reform.pcs.ccd.repository.PcsCaseRepository;
import uk.gov.hmcts.reform.pcs.ccd.repository.enforcetheorder.EnforcementOrderRepository;
import uk.gov.hmcts.reform.pcs.ccd.util.DateUtil;
import uk.gov.hmcts.reform.pcs.exception.CaseNotFoundException;

import java.time.Instant;
import java.util.List;
import java.util.Optional;

import static uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction.MarkupContent.CONFIRM_EVICTION_SUMMARY_NO_DATES;
import static uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction.MarkupContent.CONFIRM_EVICTION_SUMMARY_WITH_DATES;

@Component
@Slf4j
@AllArgsConstructor
public class EnforcementOrderMediator {

private final PcsCaseRepository pcsCaseRepository;
private final EnforcementOrderRepository enforcementOrderRepository;
private final DateUtil dateUtil;

public void handleEnforcementRequirements(long caseReference, PCSCase pcsCase) {
if (caseReference > 0 && pcsCase != null) {
Optional<EnforcementOrderEntity> optionalEnforcementOrder = getEnforcementOrder(caseReference);
if (optionalEnforcementOrder.isPresent()) {
EnforcementOrderEntity enforcementOrderEntity = optionalEnforcementOrder.get();
if (enforcementOrderEntity.getBailiffDate() != null) {
hasBailiffDate(pcsCase, enforcementOrderEntity.getBailiffDate());
} else {
noBailiffDate(pcsCase);
}
}
}
}

Optional<EnforcementOrderEntity> getEnforcementOrder(long caseReference) {
PcsCaseEntity pcsCaseEntity = pcsCaseRepository.findByCaseReference(caseReference)
Copy link
Copy Markdown
Contributor

@guygrewal77 guygrewal77 Mar 27, 2026

Choose a reason for hiding this comment

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

Could use EnforcementOrderService.retrieveEnforcementOrder() to retrieve by case_reference and enforcement type as the eviction would follow from Warrant of Possession.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As with the other comment this is where the sticking point is at the moment. This is coded up to the current 'knowledge' and there are changes on route.

I can not use that method suggested as it requires the SelectEnforcementType. If I overload the method within there ... then I am doing the same as what I am doing here in the EnforcementOrderMediator. The EnforcementOrderMediator purpose is from this point in the journey.

The sticking point is we do not know which the Confirm Eviction is against.

There can be multiple Eviction Orders against an Claim and from that multiple types of Evictions. In reality it will probably not be many but currently there is no link from the Confirm to the specific eviction the confirm is against.

With the de-prioritising of Enforcement and the unknown elements this is as close as we can get at the moment.

.orElseThrow(() -> new CaseNotFoundException(caseReference));
List<ClaimEntity> claims = pcsCaseEntity.getClaims();
if (claims != null && !claims.isEmpty()) {
return enforcementOrderRepository.findByClaimId(claims.getFirst().getId());
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.

Do we know which type of enforcement case should be retrieved as there could be different ones linked to the same enf_case ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yer this is a pain point and had me stuck. Have had conversations with Nafees on this a few times.

It may just link to the latest ... which at the time ... I did not have HDPI-4220 which has adds the "created" field. However, again, the latest of which?

It is possible we may need the enforcement type to be applied to the enf_case table for this type of scenario but all of this is unknown at the moment.

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.

You can find the enf_case associated with the warrant of possession if you use enforcementOrderService. retrieveEnforcementOrder.

Copy link
Copy Markdown
Contributor Author

@tvr-hmcts tvr-hmcts Mar 30, 2026

Choose a reason for hiding this comment

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

The Confirm Eviction may not have come from that though.

}
return Optional.empty();
}

private void hasBailiffDate(PCSCase pcsCase, Instant instant) {
Copy link
Copy Markdown
Contributor

@guygrewal77 guygrewal77 Mar 25, 2026

Choose a reason for hiding this comment

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

Can this method also be made static or this and the method below changed to non-static ?

pcsCase.setShowConfirmEvictionJourney(YesOrNo.YES);
pcsCase.setConfirmEvictionSummaryMarkup(String.format(
CONFIRM_EVICTION_SUMMARY_WITH_DATES,
dateUtil.formatDate(instant),
dateUtil.minusHoursFormatted(instant, 72)));
}

private static void noBailiffDate(PCSCase pcsCase) {
pcsCase.setShowConfirmEvictionJourney(YesOrNo.NO);
pcsCase.setConfirmEvictionSummaryMarkup(CONFIRM_EVICTION_SUMMARY_NO_DATES);
}

}
4 changes: 2 additions & 2 deletions src/main/java/uk/gov/hmcts/reform/pcs/ccd/PCSCaseView.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class PCSCaseView implements CaseView<PCSCase, State> {
private final NoticeOfPossessionView noticeOfPossessionView;
private final StatementOfTruthView statementOfTruthView;
private final CaseNameHmctsFormatter caseNameHmctsFormatter;

private final EnforcementOrderMediator enforcementOrderMediator;

/**
* Invoked by CCD to load PCS cases by reference.
Expand All @@ -80,12 +80,12 @@ public PCSCase getCase(CaseViewRequest<State> request) {
long caseReference = request.caseRef();
State state = request.state();
PCSCase pcsCase = getSubmittedCase(caseReference);

boolean hasUnsubmittedCaseData = caseHasUnsubmittedData(caseReference, state);

caseNameHmctsFormatter.setCaseNameHmctsField(pcsCase);

setMarkdownFields(pcsCase, hasUnsubmittedCaseData);
enforcementOrderMediator.handleEnforcementRequirements(caseReference, pcsCase);

//allows indexing for Global Search
pcsCase.setSearchCriteria(new SearchCriteria());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,10 @@ public class PCSCase {
)
private String caseNamePublic;

@CCD(searchable = false)
private String confirmEvictionSummaryMarkup;

@CCD(searchable = false, access = {ClaimantAccess.class})
private YesOrNo showConfirmEvictionJourney;

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import uk.gov.hmcts.reform.pcs.ccd.domain.enforcetheorder.EnforcementOrder;
import uk.gov.hmcts.reform.pcs.ccd.entity.ClaimEntity;

import java.time.Instant;
import java.util.UUID;

import static jakarta.persistence.FetchType.LAZY;
Expand All @@ -25,6 +28,8 @@
@Table(name = "enf_case")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class EnforcementOrderEntity {

@Id
Expand All @@ -43,4 +48,7 @@ public class EnforcementOrderEntity {
@OneToOne(mappedBy = "enforcementOrder", fetch = LAZY)
private WarrantEntity warrantDetails;

@Column(name = "bailiff_date")
private Instant bailiffDate;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ public enum EventId {
enforceTheOrder,
respondPossessionClaim,
submitDefendantResponse,
createTestCase
createTestCase,
confirmEviction
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package uk.gov.hmcts.reform.pcs.ccd.event.confirmeviction;

import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.ccd.sdk.api.CCDConfig;
import uk.gov.hmcts.ccd.sdk.api.DecentralisedConfigBuilder;
import uk.gov.hmcts.ccd.sdk.api.Event;
import uk.gov.hmcts.ccd.sdk.api.EventPayload;
import uk.gov.hmcts.ccd.sdk.api.Permission;
import uk.gov.hmcts.ccd.sdk.api.callback.SubmitResponse;
import uk.gov.hmcts.reform.pcs.ccd.accesscontrol.UserRole;
import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder;
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.enforcetheorder.confirmeviction.ConfirmEvictionConfigurer;

import static uk.gov.hmcts.reform.pcs.ccd.event.EventId.confirmEviction;

@Component
@AllArgsConstructor
public class ConfirmEviction implements CCDConfig<PCSCase, State, UserRole> {

private final ConfirmEvictionConfigurer confirmEvictionConfigurer;

@Override
public void configureDecentralised(DecentralisedConfigBuilder<PCSCase, State, UserRole> configBuilder) {
Event.EventBuilder<PCSCase, UserRole, State> eventBuilder =
configBuilder
.decentralisedEvent(confirmEviction.name(), this::submit)
.forAllStates()
.name("Confirm the eviction details")
.grant(Permission.CRUD, UserRole.PCS_SOLICITOR)
.showSummary();
confirmEvictionConfigurer.configurePages(new PageBuilder(eventBuilder));
}

private SubmitResponse<State> submit(EventPayload<PCSCase, State> eventPayload) {
return SubmitResponse.defaultResponse();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction;

import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder;
import uk.gov.hmcts.reform.pcs.ccd.common.PageConfigurer;

@Component
@AllArgsConstructor
public class ConfirmEvictionConfigurer implements PageConfigurer {

@Override
public void configurePages(PageBuilder pageBuilder) {
pageBuilder
.add(new ConfirmEvictionDetailsPage())
.add(new EvictionDatePage());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction;

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.page.CcdPage;

public class ConfirmEvictionDetailsPage implements CcdPageConfiguration, CcdPage {

public static final String CONFIRM_EVICTION_DETAILS_CONTENT = """
<p class="govuk-body">
The bailiff has arranged a date for the eviction and they need you to confirm if you are
available.
</p>
<p class="govuk-body">
They will also ask you to confirm if the person being evicted poses any risk.
</p>
<p class="govuk-body">
The bailiff needs this information to carry out the eviction safely. If you do not provide it,
they may not be able to complete the eviction.
</p>
<p class="govuk-body govuk-!-font-weight-bold govuk-!-font-size-24">What you’ll need
</p>
<p class="govuk-body govuk-!-margin-bottom-0">You’ll need to know:</p>
<ul class="govuk-list govuk-list--bullet">
<li class="govuk-!-font-size-19">who will attend the eviction (you, or someone else)</li>
<li class="govuk-!-font-size-19">if you (or they) can attend the eviction on the date suggested
by the bailiff</li>
</ul>
<p class="govuk-body govuk-!-margin-bottom-0">We will also ask you to:</p>
<ul class="govuk-list govuk-list--bullet">
<li class="govuk-!-font-size-19">describe the person who will be evicted</li>
<li class="govuk-!-font-size-19">tell us how to access the property</li>
<li class="govuk-!-font-size-19">book a locksmith (this is to make sure that the person being
evicted cannot return to the property)</li>
</ul>
<p class="govuk-body">
Once you have confirmed the eviction date, we’ll send you an email reminding you to book a
locksmith.
</p>
""";

@Override
public void addTo(PageBuilder pageBuilder) {
String pageKey = getPageKey();
pageBuilder
.page(pageKey)
.pageLabel("Confirm the eviction details")
.label(pageKey + "-line-separator", "---")
.label(pageKey + "-content", CONFIRM_EVICTION_DETAILS_CONTENT);
}

@Override
public String getPageKey() {
return CcdPage.derivePageKey(this.getClass());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction;

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.page.CcdPage;

public class EvictionDatePage implements CcdPageConfiguration, CcdPage {

@Override
public void addTo(PageBuilder pageBuilder) {
String pageKey = getPageKey();
pageBuilder
.page(pageKey)
.pageLabel("The eviction date")
.label(pageKey + "-line-separator", "---");
}

@Override
public String getPageKey() {
return CcdPage.derivePageKey(this.getClass());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class MarkupContent {

public static String CONFIRM_EVICTION_SUMMARY_WITH_DATES =
"""
<h2 class="govuk-heading-m govuk-!-padding-top-1">Confirm the eviction date</h2>
<p class="govuk-body govuk-!-padding-bottom-2">
The bailiff has given you an eviction date of %s.
They need you to confirm if you are available on this date.
</p>
<p class="govuk-body govuk-!-padding-bottom-2">
You must confirm the eviction details before %s.
If you try to confirm the eviction after this
date, the bailiff will cancel your eviction.
They will also ask you to confirm if the defendants
(the person or people being evicted) pose any risk to the
bailiff.
The bailiff needs this information to carry out the eviction
safely.
</p>
<p class="govuk-body">
To confirm the eviction date, select ‘Confirm the eviction
date’ from the dropdown menu.
</p>
""";

public static String CONFIRM_EVICTION_SUMMARY_NO_DATES =
"""
<h2 class="govuk-heading-m govuk-!-padding-top-1">You cannot enforce the order at the moment</h2>
<p class="govuk-body govuk-!-padding-bottom-2">
You cannot enforce the order at the moment (use a bailiff to evict someone).
</p>
<p class="govuk-body govuk-!-font-weight-bold govuk-!-padding-bottom-2"> How to find out why you cannot
enforce the order
</p>
<p class="govuk-body govuk-!-margin-bottom-0">To find out why you cannot enforce the order, you can:</p>
<ul class="govuk-list govuk-list--bullet">
<li class="govuk-!-font-size-19">check the tab: ‘Case file view’ (you should see an order from the court,
explaining why you cannot enforce), or</li>
<li class="govuk-!-font-size-19">
<a href="https://www.gov.uk/find-court-tribunal"
rel="noreferrer noopener"
target="_blank" class="govuk-link">
contact your local court.</a> You will need to tell them your case number
(you can find this at the top of this page). If you do not know the name of your local court, select the
‘Money’ category and then the ‘Housing’ category to find it.</li>
</ul>
""";

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import org.springframework.data.jpa.repository.JpaRepository;
import uk.gov.hmcts.reform.pcs.ccd.entity.enforcetheorder.EnforcementOrderEntity;

import java.util.Optional;
import java.util.UUID;

public interface EnforcementOrderRepository extends JpaRepository<EnforcementOrderEntity, UUID> {

Optional<EnforcementOrderEntity> findByClaimId(UUID claimId);
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.

Won't need this if EnforcementOrderService is used to retrieve the Enforcement order.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah actually it is used earlier in the process.

}
23 changes: 23 additions & 0 deletions src/main/java/uk/gov/hmcts/reform/pcs/ccd/util/DateUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package uk.gov.hmcts.reform.pcs.ccd.util;

import org.springframework.stereotype.Component;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Locale;

@Component
public class DateUtil {

public String formatDate(Instant instant) {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("EEEE, d MMMM yyyy", Locale.UK);
return instant.atZone(ZoneId.of("UTC")).format(outputFormatter);
}

public String minusHoursFormatted(Instant instant, int hours) {
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("d MMMM yyyy", Locale.UK);
return instant.atZone(ZoneId.of("UTC")).minusHours(hours).format(outputFormatter);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE enf_case
ADD COLUMN bailiff_date timestamp with time zone;
Loading
Loading