From 5ec4618dedd4fb695a7cf7b67e9b4520e6702fbf Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 19 Mar 2026 17:17:13 +0000 Subject: [PATCH 01/30] DTSCCI-3902: Update COSC Generation Rules to use a Calendar Month Instead of 30 Days --- .../JudgmentPaidInFullOnlineMapper.java | 8 +++++--- .../judgmentsonline/JudgmentsOnlineHelper.java | 8 ++++---- .../JudgmentsOnlineHelperTest.java | 18 +++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentPaidInFullOnlineMapper.java b/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentPaidInFullOnlineMapper.java index 1c40d1eb2731..5cd78848dd54 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentPaidInFullOnlineMapper.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentPaidInFullOnlineMapper.java @@ -48,11 +48,13 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) { } protected JudgmentState getJudgmentState(CaseData caseData, LocalDate paymentDate) { - boolean paidAfter31Days = JudgmentsOnlineHelper.checkIfDateDifferenceIsGreaterThan31Days( - caseData.getActiveJudgment().getIssueDate(), + LocalDate issueDate = caseData.getActiveJudgment().getIssueDate(); + log.info("Getting Judgment State based on issueDate date: {}, eligible days: {}", issueDate, issueDate.lengthOfMonth()); + boolean paidAfterEligibleDays = JudgmentsOnlineHelper.checkIfDateDifferenceIsGreaterThanDaysInMonth( + issueDate, nonNull(paymentDate) ? paymentDate : caseData.getJoJudgmentPaidInFull().getDateOfFullPaymentMade() ); - return paidAfter31Days ? JudgmentState.SATISFIED : JudgmentState.CANCELLED; + return paidAfterEligibleDays ? JudgmentState.SATISFIED : JudgmentState.CANCELLED; } protected JudgmentState getJudgmentState(CaseData caseData) { diff --git a/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelper.java b/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelper.java index 3996a55da532..9e8408123c27 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelper.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelper.java @@ -29,7 +29,7 @@ public class JudgmentsOnlineHelper { private static final String ERROR_MESSAGE_DATE_FIRST_INSTALMENT_MUST_BE_IN_FUTURE = "Date of first instalment must be in the future"; private static final String ERROR_MESSAGE_DATE_ORDER_MUST_BE_IN_PAST = "Date judge made the order must be in the past"; - private static final String regex = "[ˆ`´¨]"; + private static final String REGEX = "[ˆ`´¨]"; private JudgmentsOnlineHelper() { } @@ -39,8 +39,8 @@ public static boolean validateIfFutureDate(LocalDate date) { return date.isAfter(today); } - public static boolean checkIfDateDifferenceIsGreaterThan31Days(LocalDate firstDate, LocalDate secondDate) { - return ChronoUnit.DAYS.between(firstDate, secondDate) > 31; + public static boolean checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate firstDate, LocalDate secondDate) { + return ChronoUnit.DAYS.between(firstDate, secondDate) > firstDate.lengthOfMonth(); } public static List validateMidCallbackData(CaseData caseData) { @@ -295,7 +295,7 @@ public static JudgmentAddress getJudgmentAddress(Address address, RoboticsAddres } public static String removeWelshCharacters(String input) { - return input != null ? input.replaceAll(regex, "") : input; + return input != null ? input.replaceAll(REGEX, "") : input; } private static String trimDownTo35(String input) { diff --git a/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java b/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java index 4dd67b263601..f57254145ccb 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java @@ -7,6 +7,9 @@ import uk.gov.hmcts.reform.civil.model.common.DynamicList; import uk.gov.hmcts.reform.civil.model.common.DynamicListElement; import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentAddress; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentPaymentPlan; +import uk.gov.hmcts.reform.civil.model.judgmentonline.PaymentPlanSelection; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.sampledata.PartyBuilder; import uk.gov.hmcts.reform.civil.service.robotics.mapper.AddressLinesMapper; @@ -17,17 +20,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; -import uk.gov.hmcts.reform.civil.model.judgmentonline.PaymentPlanSelection; -import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; -import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentPaymentPlan; -import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.checkIfDateDifferenceIsGreaterThan31Days; -import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.getFixedCostsOfJudgmentForDJ; +import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary; +import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.calculateRepaymentBreakdownSummaryWithoutClaimInterest; +import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.checkIfDateDifferenceIsGreaterThanDaysInMonth; import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.getClaimFeeOfJudgmentForDJ; +import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.getFixedCostsOfJudgmentForDJ; import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.getMoneyValue; import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.getPartialPayment; import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.isNonDivergentForDJ; -import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary; -import static uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper.calculateRepaymentBreakdownSummaryWithoutClaimInterest; public class JudgmentsOnlineHelperTest { @@ -48,8 +48,8 @@ void test_validateIfFutureDate() { @Test void shouldCheckIfDateDifferenceIsGreaterThan31Days() { - assertThat(checkIfDateDifferenceIsGreaterThan31Days(LocalDate.now(), LocalDate.now().plusDays(31))).isFalse(); - assertThat(checkIfDateDifferenceIsGreaterThan31Days(LocalDate.now(), LocalDate.now().plusDays(32))).isTrue(); + assertThat(checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate.now(), LocalDate.now().plusDays(31))).isFalse(); + assertThat(checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate.now(), LocalDate.now().plusDays(32))).isTrue(); } @Test From fefa4adfb47544662970c0e85e9506d4a420616b Mon Sep 17 00:00:00 2001 From: rishisharma Date: Mon, 23 Mar 2026 12:23:58 +0000 Subject: [PATCH 02/30] DTSCCI-3902: Update COSC Generation logic --- .../tasks/EndBusinessProcessTaskHandler.java | 7 +++++ .../EndBusinessProcessTaskHandlerTest.java | 26 +++++++++++++++++++ .../civil/sampledata/CaseDataBuilder.java | 13 ++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java index e70384b8e147..10d81b94bde5 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java @@ -8,6 +8,7 @@ import uk.gov.hmcts.reform.ccd.client.model.CaseDataContent; import uk.gov.hmcts.reform.ccd.client.model.Event; import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.exceptions.NotRetryableException; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.BusinessProcess; @@ -18,7 +19,9 @@ import java.util.Map; +import static java.util.Objects.nonNull; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.END_BUSINESS_PROCESS; +import static uk.gov.hmcts.reform.civil.callback.CaseEvent.PROCESS_COSC_APPLICATION; @Slf4j @Component @@ -45,6 +48,10 @@ public ExternalTaskData handleTask(ExternalTask externalTask) { } else { coreCaseDataService.submitUpdate(caseId, caseDataContent(startEventResponse, businessProcess)); } + if (CoscApplicationStatus.ACTIVE.equals(data.getCoSCApplicationStatus()) && nonNull(data.getCoscSchedulerDeadline())) { + log.info("Invoking process cosc application flow for case {}", caseId); + data.setBusinessProcess(BusinessProcess.ready(PROCESS_COSC_APPLICATION)); + } return new ExternalTaskData(); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java index 445905d5d8b8..68e75e67f768 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java @@ -13,6 +13,7 @@ import uk.gov.hmcts.reform.ccd.client.model.Event; import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse; import uk.gov.hmcts.reform.civil.enums.BusinessProcessStatus; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.BusinessProcess; import uk.gov.hmcts.reform.civil.model.CaseData; @@ -20,8 +21,10 @@ import uk.gov.hmcts.reform.civil.sampledata.CaseDetailsBuilder; import uk.gov.hmcts.reform.civil.service.CoreCaseDataService; +import java.time.LocalDate; import java.util.Map; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -115,6 +118,29 @@ void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFini verify(externalTaskService).complete(mockExternalTask, null); } + @Test + void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFinished_whenCalledV1() { + CaseData caseData = new CaseDataBuilder() + .atStateClaimDraft() + .coscSchedulerDeadline(LocalDate.now().plusDays(30)) + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) + .businessProcess(new BusinessProcess().setStatus(BusinessProcessStatus.READY)) + .build(); + + CaseDetails caseDetails = new CaseDetailsBuilder().data(caseData).build(); + StartEventResponse startEventResponse = startEventResponse(caseDetails); + + when(coreCaseDataService.startUpdate(CASE_ID, END_BUSINESS_PROCESS)).thenReturn(startEventResponse); + when(coreCaseDataService.submitUpdate(eq(CASE_ID), any(CaseDataContent.class))).thenReturn(caseData); + + handler.execute(mockExternalTask, externalTaskService); + + assertEquals(BusinessProcessStatus.READY, caseData.getBusinessProcess().getStatus()); + verify(coreCaseDataService).startUpdate(CASE_ID, END_BUSINESS_PROCESS); + verify(coreCaseDataService).submitUpdate(CASE_ID, getCaseDataContent(caseDetails, startEventResponse)); + verify(externalTaskService).complete(mockExternalTask, null); + } + private StartEventResponse startEventResponse(CaseDetails caseDetails) { return StartEventResponse.builder() .token("1234") diff --git a/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java b/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java index 8349edfea084..4142313e94cf 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java @@ -33,6 +33,7 @@ import uk.gov.hmcts.reform.civil.enums.ResponseIntention; import uk.gov.hmcts.reform.civil.enums.TimelineUploadTypeSpec; import uk.gov.hmcts.reform.civil.enums.YesOrNo; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.enums.dj.DisposalHearingBundleType; import uk.gov.hmcts.reform.civil.enums.dj.DisposalHearingFinalDisposalHearingTimeEstimate; import uk.gov.hmcts.reform.civil.enums.dj.DisposalHearingMethodDJ; @@ -712,6 +713,18 @@ public class CaseDataBuilder { private LocalDate nextDeadline; private CaseQueriesCollection queries; + private LocalDate coscSchedulerDeadline; + private CoscApplicationStatus coSCApplicationStatus; + + public CaseDataBuilder coscSchedulerDeadline(LocalDate coscSchedulerDeadline) { + this.coscSchedulerDeadline = coscSchedulerDeadline; + return this; + } + + public CaseDataBuilder coSCApplicationStatus(CoscApplicationStatus coSCApplicationStatus) { + this.coSCApplicationStatus = coSCApplicationStatus; + return this; + } public CaseDataBuilder claimantBilingualLanguagePreference(String claimantBilingualLanguagePreference) { this.claimantBilingualLanguagePreference = claimantBilingualLanguagePreference; From daa7555149e599512148c0fea093f8d0eae01dac Mon Sep 17 00:00:00 2001 From: rishisharma Date: Mon, 23 Mar 2026 12:39:49 +0000 Subject: [PATCH 03/30] DTSCCI-3902: Update COSC Generation logic --- .../civil/handler/tasks/EndBusinessProcessTaskHandler.java | 2 +- .../handler/tasks/EndBusinessProcessTaskHandlerTest.java | 3 +-- .../gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java | 6 ------ 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java index 10d81b94bde5..a8d72f47d213 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java @@ -48,7 +48,7 @@ public ExternalTaskData handleTask(ExternalTask externalTask) { } else { coreCaseDataService.submitUpdate(caseId, caseDataContent(startEventResponse, businessProcess)); } - if (CoscApplicationStatus.ACTIVE.equals(data.getCoSCApplicationStatus()) && nonNull(data.getCoscSchedulerDeadline())) { + if (CoscApplicationStatus.ACTIVE.equals(data.getCoSCApplicationStatus())) { log.info("Invoking process cosc application flow for case {}", caseId); data.setBusinessProcess(BusinessProcess.ready(PROCESS_COSC_APPLICATION)); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java index 68e75e67f768..37a334586796 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java @@ -21,7 +21,6 @@ import uk.gov.hmcts.reform.civil.sampledata.CaseDetailsBuilder; import uk.gov.hmcts.reform.civil.service.CoreCaseDataService; -import java.time.LocalDate; import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -102,6 +101,7 @@ void shouldNotTriggerEndBusinessProcessCCDEvent_whenCalledMoreThanOnceInSequence void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFinished_whenCalled() { CaseData caseData = new CaseDataBuilder() .atStateClaimDraft() + .coSCApplicationStatus(CoscApplicationStatus.PROCESSED) .businessProcess(new BusinessProcess().setStatus(BusinessProcessStatus.READY)) .build(); @@ -122,7 +122,6 @@ void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFini void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFinished_whenCalledV1() { CaseData caseData = new CaseDataBuilder() .atStateClaimDraft() - .coscSchedulerDeadline(LocalDate.now().plusDays(30)) .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) .businessProcess(new BusinessProcess().setStatus(BusinessProcessStatus.READY)) .build(); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java b/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java index 4142313e94cf..f2b84ce2e4b6 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java @@ -713,14 +713,8 @@ public class CaseDataBuilder { private LocalDate nextDeadline; private CaseQueriesCollection queries; - private LocalDate coscSchedulerDeadline; private CoscApplicationStatus coSCApplicationStatus; - public CaseDataBuilder coscSchedulerDeadline(LocalDate coscSchedulerDeadline) { - this.coscSchedulerDeadline = coscSchedulerDeadline; - return this; - } - public CaseDataBuilder coSCApplicationStatus(CoscApplicationStatus coSCApplicationStatus) { this.coSCApplicationStatus = coSCApplicationStatus; return this; From 47ed8f514b295c7affe2fdbada706fc3e11067c8 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Mon, 23 Mar 2026 12:51:15 +0000 Subject: [PATCH 04/30] DTSCCI-3902: Update COSC Generation logic --- .../civil/handler/tasks/EndBusinessProcessTaskHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java index a8d72f47d213..89a49482676a 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java @@ -19,7 +19,6 @@ import java.util.Map; -import static java.util.Objects.nonNull; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.END_BUSINESS_PROCESS; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.PROCESS_COSC_APPLICATION; From fc0a63533be99cecc440f901f09f004fb43adecc Mon Sep 17 00:00:00 2001 From: rishisharma Date: Mon, 23 Mar 2026 15:12:14 +0000 Subject: [PATCH 05/30] DTSCCI-3902: Update COSC Generation logic --- .../tasks/EndBusinessProcessTaskHandler.java | 6 ----- .../EndBusinessProcessTaskHandlerTest.java | 25 ------------------- .../civil/sampledata/CaseDataBuilder.java | 7 ------ 3 files changed, 38 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java index 89a49482676a..e70384b8e147 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandler.java @@ -8,7 +8,6 @@ import uk.gov.hmcts.reform.ccd.client.model.CaseDataContent; import uk.gov.hmcts.reform.ccd.client.model.Event; import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse; -import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.exceptions.NotRetryableException; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.BusinessProcess; @@ -20,7 +19,6 @@ import java.util.Map; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.END_BUSINESS_PROCESS; -import static uk.gov.hmcts.reform.civil.callback.CaseEvent.PROCESS_COSC_APPLICATION; @Slf4j @Component @@ -47,10 +45,6 @@ public ExternalTaskData handleTask(ExternalTask externalTask) { } else { coreCaseDataService.submitUpdate(caseId, caseDataContent(startEventResponse, businessProcess)); } - if (CoscApplicationStatus.ACTIVE.equals(data.getCoSCApplicationStatus())) { - log.info("Invoking process cosc application flow for case {}", caseId); - data.setBusinessProcess(BusinessProcess.ready(PROCESS_COSC_APPLICATION)); - } return new ExternalTaskData(); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java index 37a334586796..445905d5d8b8 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/EndBusinessProcessTaskHandlerTest.java @@ -13,7 +13,6 @@ import uk.gov.hmcts.reform.ccd.client.model.Event; import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse; import uk.gov.hmcts.reform.civil.enums.BusinessProcessStatus; -import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.BusinessProcess; import uk.gov.hmcts.reform.civil.model.CaseData; @@ -23,7 +22,6 @@ import java.util.Map; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -101,7 +99,6 @@ void shouldNotTriggerEndBusinessProcessCCDEvent_whenCalledMoreThanOnceInSequence void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFinished_whenCalled() { CaseData caseData = new CaseDataBuilder() .atStateClaimDraft() - .coSCApplicationStatus(CoscApplicationStatus.PROCESSED) .businessProcess(new BusinessProcess().setStatus(BusinessProcessStatus.READY)) .build(); @@ -118,28 +115,6 @@ void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFini verify(externalTaskService).complete(mockExternalTask, null); } - @Test - void shouldTriggerEndBusinessProcessCCDEventAndUpdateBusinessProcessStatusToFinished_whenCalledV1() { - CaseData caseData = new CaseDataBuilder() - .atStateClaimDraft() - .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) - .businessProcess(new BusinessProcess().setStatus(BusinessProcessStatus.READY)) - .build(); - - CaseDetails caseDetails = new CaseDetailsBuilder().data(caseData).build(); - StartEventResponse startEventResponse = startEventResponse(caseDetails); - - when(coreCaseDataService.startUpdate(CASE_ID, END_BUSINESS_PROCESS)).thenReturn(startEventResponse); - when(coreCaseDataService.submitUpdate(eq(CASE_ID), any(CaseDataContent.class))).thenReturn(caseData); - - handler.execute(mockExternalTask, externalTaskService); - - assertEquals(BusinessProcessStatus.READY, caseData.getBusinessProcess().getStatus()); - verify(coreCaseDataService).startUpdate(CASE_ID, END_BUSINESS_PROCESS); - verify(coreCaseDataService).submitUpdate(CASE_ID, getCaseDataContent(caseDetails, startEventResponse)); - verify(externalTaskService).complete(mockExternalTask, null); - } - private StartEventResponse startEventResponse(CaseDetails caseDetails) { return StartEventResponse.builder() .token("1234") diff --git a/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java b/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java index f2b84ce2e4b6..8349edfea084 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/sampledata/CaseDataBuilder.java @@ -33,7 +33,6 @@ import uk.gov.hmcts.reform.civil.enums.ResponseIntention; import uk.gov.hmcts.reform.civil.enums.TimelineUploadTypeSpec; import uk.gov.hmcts.reform.civil.enums.YesOrNo; -import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.enums.dj.DisposalHearingBundleType; import uk.gov.hmcts.reform.civil.enums.dj.DisposalHearingFinalDisposalHearingTimeEstimate; import uk.gov.hmcts.reform.civil.enums.dj.DisposalHearingMethodDJ; @@ -713,12 +712,6 @@ public class CaseDataBuilder { private LocalDate nextDeadline; private CaseQueriesCollection queries; - private CoscApplicationStatus coSCApplicationStatus; - - public CaseDataBuilder coSCApplicationStatus(CoscApplicationStatus coSCApplicationStatus) { - this.coSCApplicationStatus = coSCApplicationStatus; - return this; - } public CaseDataBuilder claimantBilingualLanguagePreference(String claimantBilingualLanguagePreference) { this.claimantBilingualLanguagePreference = claimantBilingualLanguagePreference; From 22656d410e7c6af0b9a466d0caad8a13882ea605 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Mon, 23 Mar 2026 18:26:40 +0000 Subject: [PATCH 06/30] DTSCCI-3902: Update COSC Generation logic --- .../civil/handler/tasks/CaseEventTaskHandler.java | 5 +++++ .../handler/tasks/CaseEventTaskHandlerTest.java | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java index 7690880d75e0..957b48a29f8a 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java @@ -91,9 +91,14 @@ public VariableMap getVariableMap(ExternalTaskData externalTaskData) { var stateFlow = stateFlowEngine.getStateFlow(data); variables.putValue(FLOW_STATE, stateFlow.getState().getName()); variables.putValue(FLOW_FLAGS, stateFlow.getFlags()); + variables.putValue("isJudgmentMarkedPaidInFull", checkMarkPaidInFull(data)); return variables; } + private boolean checkMarkPaidInFull(CaseData data) { + return (Objects.nonNull(data.getActiveJudgment()) && data.getActiveJudgment().getFullyPaymentMadeDate() != null); + } + private CaseDataContent caseDataContent(StartEventResponse startEventResponse, BusinessProcess businessProcess, String flowState, diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java index c3179f11ff15..81e402bddc6f 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java @@ -106,6 +106,7 @@ class CaseEventTaskHandlerTest { ArgumentCaptor caseDataContentArgumentCaptor; @InjectMocks private CaseEventTaskHandler caseEventTaskHandler; + private static final String IS_JUDGMENT_MARKED_PAID_IN_FULL = "isJudgmentMarkedPaidInFull"; @Nested class NotifyRespondent { @@ -134,6 +135,7 @@ void shouldTriggerCCDEvent_whenHandlerIsExecuted() { VariableMap variables = Variables.createVariables(); variables.putValue(FLOW_STATE, "MAIN.DRAFT"); variables.putValue(FLOW_FLAGS, Map.of()); + variables.putValue(IS_JUDGMENT_MARKED_PAID_IN_FULL, false); CaseDetails caseDetails = new CaseDetailsBuilder().data(caseData).build(); @@ -253,7 +255,10 @@ void shouldTriggerCCDEvent_whenClaimIsPendingUnRepresented(FlowState.Main state) FLOW_FLAGS, flags ); - + variables.putValue( + IS_JUDGMENT_MARKED_PAID_IN_FULL, + false + ); when(mockTask.getVariable(FLOW_STATE)).thenReturn(state.fullName()); when(mockTask.getTopicName()).thenReturn("test"); when(mockTask.getActivityId()).thenReturn("activityId"); @@ -276,7 +281,7 @@ void shouldTriggerCCDEvent_whenClaimIsPendingUnRepresented(FlowState.Main state) verify(coreCaseDataService).startUpdate(CASE_ID, PROCEEDS_IN_HERITAGE_SYSTEM); verify(coreCaseDataService).submitUpdate(eq(CASE_ID), any(CaseDataContent.class)); - verify(externalTaskService).complete(mockTask, Map.of( + verify(externalTaskService).complete(mockTask, Map.of(IS_JUDGMENT_MARKED_PAID_IN_FULL, false, FLOW_FLAGS, flags, FLOW_STATE, state.fullName() )); @@ -312,6 +317,10 @@ void shouldTriggerCCDEventWithDescription_whenClaimIsHandedOffline(ReasonForProc FLOW_FLAGS, getFlowFlags(TAKEN_OFFLINE_BY_STAFF) ); + variables.putValue( + IS_JUDGMENT_MARKED_PAID_IN_FULL, + false + ); when(mockTask.getVariable(FLOW_STATE)).thenReturn(TAKEN_OFFLINE_BY_STAFF.fullName()); when(mockTask.getTopicName()).thenReturn("test"); @@ -337,7 +346,7 @@ void shouldTriggerCCDEventWithDescription_whenClaimIsHandedOffline(ReasonForProc verify(coreCaseDataService).startUpdate(CASE_ID, PROCEEDS_IN_HERITAGE_SYSTEM); verify(coreCaseDataService).submitUpdate(eq(CASE_ID), any(CaseDataContent.class)); - verify(externalTaskService).complete(mockTask, Map.of( + verify(externalTaskService).complete(mockTask, Map.of(IS_JUDGMENT_MARKED_PAID_IN_FULL, false, FLOW_FLAGS, getFlowFlags(TAKEN_OFFLINE_BY_STAFF), FLOW_STATE, TAKEN_OFFLINE_BY_STAFF.fullName() )); From 6a4eb33436e92c754e121b2805b5c091c195faf8 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Tue, 24 Mar 2026 15:11:00 +0000 Subject: [PATCH 07/30] DTSCCI-3902: Update COSC Generation logic --- .../java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java b/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java index fc50b0b8ebc5..fda21730b51e 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/callback/CaseEvent.java @@ -642,7 +642,8 @@ public enum CaseEvent { UPLOAD_TRANSLATED_DOCUMENT_HEARING_SCHEDULED(CAMUNDA), ADD_APPLICATION_TO_TRANSLATION_COLLECTION(CAMUNDA), UPLOAD_TRANSLATED_DOCUMENT_FOR_FREE_FEE_APPLICATION(CAMUNDA), - UPLOAD_TRANSLATED_DOCUMENT_FINAL_ORDER(CAMUNDA); + UPLOAD_TRANSLATED_DOCUMENT_FINAL_ORDER(CAMUNDA), + UPDATE_COSC_VARIABLE(CAMUNDA); private final UserType userType; From cf22637599b3e74aebe0dd07bc02ea5177ea7fb5 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Tue, 24 Mar 2026 18:27:40 +0000 Subject: [PATCH 08/30] DTSCCI-3902: Update COSC Generation logic --- ...lamant_and_defendant_mark_paid_in_full_notifications.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql diff --git a/src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql new file mode 100644 index 000000000000..4574558dd079 --- /dev/null +++ b/src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql @@ -0,0 +1,6 @@ +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant"}' +WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Claimant'; + +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant"}', + notifications_to_create = '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}' +WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant'; From d0307d585540298a1e6a6f570a579803a797cbf0 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 07:16:13 +0000 Subject: [PATCH 09/30] DTSCCI-3902: Update COSC Generation logic --- ...lamant_and_defendant_mark_paid_in_full_notifications.sql | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql diff --git a/src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql deleted file mode 100644 index 4574558dd079..000000000000 --- a/src/main/resources/db/migration/V2026_03_24_1622__create_cosc_clamant_and_defendant_mark_paid_in_full_notifications.sql +++ /dev/null @@ -1,6 +0,0 @@ -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant"}' -WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Claimant'; - -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant"}', - notifications_to_create = '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}' -WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant'; From 34785fc4af832b533a6f509f20793d26a82efe32 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 11:53:00 +0000 Subject: [PATCH 10/30] DTSCCI-3902: Update COSC Generation logic --- ..._03_25_11118__update_mark_paid_in_full_notifications.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/resources/db/migration/V2026_03_25_11118__update_mark_paid_in_full_notifications.sql diff --git a/src/main/resources/db/migration/V2026_03_25_11118__update_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_25_11118__update_mark_paid_in_full_notifications.sql new file mode 100644 index 000000000000..4574558dd079 --- /dev/null +++ b/src/main/resources/db/migration/V2026_03_25_11118__update_mark_paid_in_full_notifications.sql @@ -0,0 +1,6 @@ +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant"}' +WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Claimant'; + +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant"}', + notifications_to_create = '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}' +WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant'; From 0a5da44bcacc050de48da839d94771cd2dc63655 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 11:56:46 +0000 Subject: [PATCH 11/30] DTSCCI-3902: Update COSC Generation logic --- ... V2026_03_25_1118__update_mark_paid_in_full_notifications.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{V2026_03_25_11118__update_mark_paid_in_full_notifications.sql => V2026_03_25_1118__update_mark_paid_in_full_notifications.sql} (100%) diff --git a/src/main/resources/db/migration/V2026_03_25_11118__update_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql similarity index 100% rename from src/main/resources/db/migration/V2026_03_25_11118__update_mark_paid_in_full_notifications.sql rename to src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql From ce32398132b096fbaa07bf610d2b7d382074045b Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 12:48:36 +0000 Subject: [PATCH 12/30] DTSCCI-3902: Update COSC Generation logic --- ...25_1118__update_mark_paid_in_full_notifications.sql | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql index 4574558dd079..3a284a348564 100644 --- a/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql +++ b/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql @@ -1,6 +1,10 @@ -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant"}' +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant","Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant"}' WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Claimant'; -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant"}', - notifications_to_create = '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}' +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant", "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Defendant"}' WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant'; + +INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) +VALUES ('Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant', + '{}', + '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}'); From 2ba45e36eec9a48f2f527a2813b83a30da0974b0 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 13:46:02 +0000 Subject: [PATCH 13/30] DTSCCI-3902: Update COSC Generation logic --- ...03_25_1118__update_mark_paid_in_full_notifications.sql | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql index 3a284a348564..c3026bdc9781 100644 --- a/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql +++ b/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql @@ -1,10 +1,6 @@ UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant","Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant"}' WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Claimant'; -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant", "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Defendant"}' +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant", "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Defendant"}', + notifications_to_create = '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}' WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant'; - -INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) -VALUES ('Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant', - '{}', - '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}'); From 153ef1f621438533fe29d676874bf0316af4b5b6 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 15:36:20 +0000 Subject: [PATCH 14/30] DTSCCI-3902: Update COSC Generation logic --- .../civil/handler/tasks/CaseEventTaskHandler.java | 13 ++++++++----- ...1118__update_mark_paid_in_full_notifications.sql | 6 ------ 2 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java index 957b48a29f8a..2953eb5a5789 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java @@ -1,8 +1,5 @@ package uk.gov.hmcts.reform.civil.handler.tasks; -import java.util.Map; -import java.util.Objects; - import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; @@ -17,9 +14,9 @@ import uk.gov.hmcts.reform.civil.callback.CaseEvent; import uk.gov.hmcts.reform.civil.exceptions.InvalidCaseDataException; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; -import uk.gov.hmcts.reform.civil.model.ExternalTaskData; import uk.gov.hmcts.reform.civil.model.BusinessProcess; import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.model.ExternalTaskData; import uk.gov.hmcts.reform.civil.service.CoreCaseDataService; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; import uk.gov.hmcts.reform.civil.service.data.ExternalTaskInput; @@ -27,6 +24,9 @@ import uk.gov.hmcts.reform.civil.service.flowstate.IStateFlowEngine; import uk.gov.hmcts.reform.civil.service.robotics.support.RoboticsEventTextFormatter; +import java.util.Map; +import java.util.Objects; + import static java.lang.String.format; import static java.util.Optional.ofNullable; import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM; @@ -96,7 +96,10 @@ public VariableMap getVariableMap(ExternalTaskData externalTaskData) { } private boolean checkMarkPaidInFull(CaseData data) { - return (Objects.nonNull(data.getActiveJudgment()) && data.getActiveJudgment().getFullyPaymentMadeDate() != null); + return (Objects.nonNull(data.getActiveJudgment()) + && data.getActiveJudgment().getFullyPaymentMadeDate() != null + && Objects.nonNull(data.getCertOfSC()) + && data.getCertOfSC().getDefendantFinalPaymentDate() != null); } private CaseDataContent caseDataContent(StartEventResponse startEventResponse, diff --git a/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql deleted file mode 100644 index c3026bdc9781..000000000000 --- a/src/main/resources/db/migration/V2026_03_25_1118__update_mark_paid_in_full_notifications.sql +++ /dev/null @@ -1,6 +0,0 @@ -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Claimant","Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant"}' -WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Claimant'; - -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.ProofofDebtPayment.Application.Defendant", "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Defendant"}', - notifications_to_create = '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}' -WHERE name = 'Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant'; From 0b83764e938878468cb9be96efb4be8a90c168b4 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Wed, 25 Mar 2026 17:29:00 +0000 Subject: [PATCH 15/30] DTSCCI-3902: Update COSC Generation logic --- .../tasks/CaseEventTaskHandlerTest.java | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java index 81e402bddc6f..78a3f6b78dff 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java @@ -35,6 +35,8 @@ import uk.gov.hmcts.reform.civil.model.BusinessProcess; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.StateFlowDTO; +import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.sampledata.CaseDetailsBuilder; import uk.gov.hmcts.reform.civil.service.CoreCaseDataService; @@ -49,6 +51,7 @@ import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -135,7 +138,7 @@ void shouldTriggerCCDEvent_whenHandlerIsExecuted() { VariableMap variables = Variables.createVariables(); variables.putValue(FLOW_STATE, "MAIN.DRAFT"); variables.putValue(FLOW_FLAGS, Map.of()); - variables.putValue(IS_JUDGMENT_MARKED_PAID_IN_FULL, false); + variables.putValue(IS_JUDGMENT_MARKED_PAID_IN_FULL, checkMarkPaidInFull(caseData)); CaseDetails caseDetails = new CaseDetailsBuilder().data(caseData).build(); @@ -153,6 +156,80 @@ void shouldTriggerCCDEvent_whenHandlerIsExecuted() { verify(coreCaseDataService).submitUpdate(eq(CASE_ID), any(CaseDataContent.class)); verify(externalTaskService).complete(mockTask, variables); } + + @Test + void shouldTriggerCCDEvent_whenHandlerIsExecutedV1() { + CaseData caseData1 = new CaseDataBuilder().atStateClaimDraft() + .businessProcess(new BusinessProcess() + .setStatus(BusinessProcessStatus.READY) + .setProcessInstanceId("processInstanceId")) + .build(); + CaseData.CaseDataBuilder caseData2 = caseData1.toBuilder(); + caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); + caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + CaseData caseData = caseData2.build(); + + VariableMap variables = Variables.createVariables(); + variables.putValue(FLOW_STATE, "MAIN.DRAFT"); + variables.putValue(FLOW_FLAGS, Map.of()); + variables.putValue(IS_JUDGMENT_MARKED_PAID_IN_FULL, checkMarkPaidInFull(caseData)); + + CaseDetails caseDetails = new CaseDetailsBuilder().data(caseData).build(); + + when(coreCaseDataService.startUpdate(CASE_ID, NOTIFY_EVENT)) + .thenReturn(StartEventResponse.builder().caseDetails(caseDetails).build()); + + when(coreCaseDataService.submitUpdate(eq(CASE_ID), any(CaseDataContent.class))).thenReturn(caseData); + + when(stateFlowEngine.getStateFlow(any(CaseData.class))) + .thenReturn(new StateFlowDTO().setState(State.from("MAIN.DRAFT")).setFlags(Map.of())); + + caseEventTaskHandler.execute(mockTask, externalTaskService); + + verify(coreCaseDataService).startUpdate(CASE_ID, NOTIFY_EVENT); + verify(coreCaseDataService).submitUpdate(eq(CASE_ID), any(CaseDataContent.class)); + verify(externalTaskService).complete(mockTask, variables); + } + + @Test + void shouldTriggerCCDEvent_whenHandlerIsExecutedV3() { + CaseData caseData1 = new CaseDataBuilder().atStateClaimDraft() + .businessProcess(new BusinessProcess() + .setStatus(BusinessProcessStatus.READY) + .setProcessInstanceId("processInstanceId")) + .build(); + CaseData.CaseDataBuilder caseData2 = caseData1.toBuilder(); + caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); + CaseData caseData = caseData2.build(); + + VariableMap variables = Variables.createVariables(); + variables.putValue(FLOW_STATE, "MAIN.DRAFT"); + variables.putValue(FLOW_FLAGS, Map.of()); + variables.putValue(IS_JUDGMENT_MARKED_PAID_IN_FULL, checkMarkPaidInFull(caseData)); + + CaseDetails caseDetails = new CaseDetailsBuilder().data(caseData).build(); + + when(coreCaseDataService.startUpdate(CASE_ID, NOTIFY_EVENT)) + .thenReturn(StartEventResponse.builder().caseDetails(caseDetails).build()); + + when(coreCaseDataService.submitUpdate(eq(CASE_ID), any(CaseDataContent.class))).thenReturn(caseData); + + when(stateFlowEngine.getStateFlow(any(CaseData.class))) + .thenReturn(new StateFlowDTO().setState(State.from("MAIN.DRAFT")).setFlags(Map.of())); + + caseEventTaskHandler.execute(mockTask, externalTaskService); + + verify(coreCaseDataService).startUpdate(CASE_ID, NOTIFY_EVENT); + verify(coreCaseDataService).submitUpdate(eq(CASE_ID), any(CaseDataContent.class)); + verify(externalTaskService).complete(mockTask, variables); + } + + private boolean checkMarkPaidInFull(CaseData data) { + return (Objects.nonNull(data.getActiveJudgment()) + && data.getActiveJudgment().getFullyPaymentMadeDate() != null + && Objects.nonNull(data.getCertOfSC()) + && data.getCertOfSC().getDefendantFinalPaymentDate() != null); + } } @Nested From 25db6fecf6c2d44ff9f00e0374cf9632e9487b8a Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 26 Mar 2026 10:22:42 +0000 Subject: [PATCH 16/30] DTSCCI-3902: Update COSC Generation logic --- .../DashboardScenarios.java | 3 + ...dgmentPaidClaimantNotificationHandler.java | 5 ++ ...gmentPaidDefendantNotificationHandler.java | 5 ++ .../handler/tasks/CaseEventTaskHandler.java | 8 +-- .../civil/utils/MarkPaidInFullUtil.java | 19 ++++++ ...endant_mark_paid_in_full_notifications.sql | 27 ++++++++ ...ntPaidClaimantNotificationHandlerTest.java | 35 +++++++++++ ...tPaidDefendantNotificationHandlerTest.java | 36 +++++++++++ .../civil/utils/MarkPaidInFullUtilTest.java | 62 +++++++++++++++++++ 9 files changed, 193 insertions(+), 7 deletions(-) create mode 100644 src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java create mode 100644 src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql create mode 100644 src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java index efc1c90f216c..72563b59bcf7 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java @@ -258,6 +258,9 @@ public enum DashboardScenarios { SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT("Scenario.AAA6.ProofOfDebtPayment.Confirmation.Defendant"), SCENARIO_AAA6_DEFENDANT_NOTICE_OF_CHANGE_JBA_CLAIM_MOVES_OFFLINE_CLAIMANT("Scenario.AAA6.DefendantNoticeOfChange.JudgmentByAdmissionClaimMovesOffline.Claimant"), + SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT("Scenario.AAA6.MarkPaidInFull.Confirmation.Claimant"), + SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT("Scenario.AAA6.MarkPaidInFull.Confirmation.Defendant"), + //General Application SCENARIO_AAA6_GENERAL_APPLICATION_SUBMITTED_NONURGENT_RESPONDENT("Scenario.AAA6.GeneralApps.NonUrgentApplicationMade.Respondent"), SCENARIO_AAA6_GENERAL_APPLICATION_SUBMITTED_URGENT_RESPONDENT("Scenario.AAA6.GeneralApps.UrgentApplicationMade.Respondent"), diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java index 3baa3cdf6493..9835e0e1844f 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java @@ -14,6 +14,8 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_CLAIMANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; @Service public class JudgmentPaidClaimantNotificationHandler extends DashboardCallbackHandler { @@ -39,6 +41,9 @@ public List handledEvents() { @Override public String getScenario(CaseData caseData) { + if (checkMarkPaidInFull(caseData)) { + return SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(); + } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT.getScenario(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java index 8731bd85c475..280d7434a1cd 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java @@ -14,6 +14,8 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_DEFENDANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; @Service public class JudgmentPaidDefendantNotificationHandler extends DashboardCallbackHandler { @@ -39,6 +41,9 @@ public List handledEvents() { @Override public String getScenario(CaseData caseData) { + if (checkMarkPaidInFull(caseData)) { + return SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(); + } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT.getScenario(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java index 2953eb5a5789..8553d6290c85 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandler.java @@ -40,6 +40,7 @@ import static uk.gov.hmcts.reform.civil.enums.UnrepresentedOrUnregisteredScenario.UNREPRESENTED; import static uk.gov.hmcts.reform.civil.enums.UnrepresentedOrUnregisteredScenario.getDefendantNames; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; @RequiredArgsConstructor @Component @@ -95,13 +96,6 @@ public VariableMap getVariableMap(ExternalTaskData externalTaskData) { return variables; } - private boolean checkMarkPaidInFull(CaseData data) { - return (Objects.nonNull(data.getActiveJudgment()) - && data.getActiveJudgment().getFullyPaymentMadeDate() != null - && Objects.nonNull(data.getCertOfSC()) - && data.getCertOfSC().getDefendantFinalPaymentDate() != null); - } - private CaseDataContent caseDataContent(StartEventResponse startEventResponse, BusinessProcess businessProcess, String flowState, diff --git a/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java b/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java new file mode 100644 index 000000000000..c0dff5d64ab7 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java @@ -0,0 +1,19 @@ +package uk.gov.hmcts.reform.civil.utils; + +import uk.gov.hmcts.reform.civil.model.CaseData; + +import java.util.Objects; + +public class MarkPaidInFullUtil { + + private MarkPaidInFullUtil() { + //no op + } + + public static boolean checkMarkPaidInFull(CaseData data) { + return (Objects.nonNull(data.getActiveJudgment()) + && data.getActiveJudgment().getFullyPaymentMadeDate() != null + && Objects.nonNull(data.getCertOfSC()) + && data.getCertOfSC().getDefendantFinalPaymentDate() != null); + } +} diff --git a/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql new file mode 100644 index 000000000000..6dcee1dff014 --- /dev/null +++ b/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql @@ -0,0 +1,27 @@ +/** + * Add scenario to delete claimant notification + */ +INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) +VALUES ('Scenario.AAA6.MarkPaidInFull.Confirmation.Claimant', + '{ + "Notice.AAA6.ProofofDebtPayment.Application.Claimant", + "Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant", + "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant", + "Notice.AAA6.JudgmentsOnline.PaidInFull.Claimant" + }', + '{"Notice.AAA6.JudgmentsOnline.PaidInFull.Claimant": []}'); + +/** + * Add scenario to delete defendant notification + */ + +INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) +VALUES ('Scenario.AAA6.MarkPaidInFull.Confirmation.Defendant', + '{ + "Notice.AAA6.ProofofDebtPayment.Application.Defendant", + "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Defendant", + "Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Defendant" + }', + '{"Notice.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant": []}'); + + diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java index af9f5b13b74b..b1d81f7a8a96 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java @@ -12,6 +12,8 @@ import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP; +import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @@ -31,6 +33,7 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_CLAIMANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; @ExtendWith(MockitoExtension.class) public class JudgmentPaidClaimantNotificationHandlerTest extends BaseCallbackHandlerTest { @@ -114,5 +117,37 @@ void shouldRecordScenario_whenInvoked_whenClaimantRepresented() { new ScenarioRequestParams(scenarioParams) ); } + + @Test + void shouldRecordScenario_whenInvoked_whenClaimantRepresented_And_MarkedPaid_And_Def_Mark_Paid_In_Full() { + CaseDataLiP caseDataLiP = new CaseDataLiP(); + caseDataLiP.setApplicant1SettleClaim(YesOrNo.YES); + caseDataLiP.setApplicant1ClaimSettledDate(LocalDate.now()); + CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim() + .caseDataLip(caseDataLiP) + .applicant1Represented(YesOrNo.NO).build(); + caseData.setCaseDocumentUploadDate(LocalDateTime.now()); + + CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); + caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); + caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + + HashMap scenarioParams = new HashMap<>(); + when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams); + + CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData2.build()).request( + CallbackRequest.builder().eventId(UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_CLAIMANT.name()).build() + ).build(); + + when(featureToggleService.isLipVLipEnabled()).thenReturn(true); + + handler.handle(params); + verify(dashboardScenariosService).recordScenarios( + "BEARER_TOKEN", + SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(), + caseData.getCcdCaseReference().toString(), + new ScenarioRequestParams(scenarioParams) + ); + } } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java index 19db27ca8b66..45c38b6bdb40 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java @@ -12,6 +12,8 @@ import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP; +import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @@ -31,6 +33,7 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_DEFENDANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; @ExtendWith(MockitoExtension.class) public class JudgmentPaidDefendantNotificationHandlerTest extends BaseCallbackHandlerTest { @@ -116,5 +119,38 @@ void shouldRecordScenario_whenInvoked_whenDefendantRepresented() { new ScenarioRequestParams(scenarioParams) ); } + + @Test + void shouldRecordScenario_whenInvoked_whenDefendantRepresented_And_MarkedPaid_And_Def_Mark_Paid_In_Full() { + CaseDataLiP caseDataLiP = new CaseDataLiP(); + caseDataLiP.setApplicant1SettleClaim(YesOrNo.YES); + caseDataLiP.setApplicant1ClaimSettledDate(LocalDate.now()); + + CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim() + .caseDataLip(caseDataLiP) + .respondent1Represented(YesOrNo.NO).build(); + caseData.setCaseDocumentUploadDate(LocalDateTime.now()); + + CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); + caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); + caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + + HashMap scenarioParams = new HashMap<>(); + when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams); + + CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData2.build()).request( + CallbackRequest.builder().eventId(UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_DEFENDANT.name()).build() + ).build(); + + when(featureToggleService.isLipVLipEnabled()).thenReturn(true); + + handler.handle(params); + verify(dashboardScenariosService).recordScenarios( + "BEARER_TOKEN", + SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(), + caseData.getCcdCaseReference().toString(), + new ScenarioRequestParams(scenarioParams) + ); + } } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java b/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java new file mode 100644 index 000000000000..5b0d2c69f168 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java @@ -0,0 +1,62 @@ +package uk.gov.hmcts.reform.civil.utils; + +import org.junit.jupiter.api.Test; +import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; + +import java.time.LocalDate; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class MarkPaidInFullUtilTest { + + @Test + void shouldReturnTrue_whenAllConditionsAreMet() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())) + .build(); + + assertTrue(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } + + @Test + void shouldReturnFalse_whenActiveJudgmentIsNull() { + CaseData caseData = CaseData.builder() + .certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } + + @Test + void shouldReturnFalse_whenFullyPaymentMadeDateIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails()) + .certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } + + @Test + void shouldReturnFalse_whenCertOfSCIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } + + @Test + void shouldReturnFalse_whenDefendantFinalPaymentDateIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .certOfSC(new CertOfSC()) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } +} From 3187ac32a8f6206c09a041f8c15a8483442b8d47 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 26 Mar 2026 11:06:54 +0000 Subject: [PATCH 17/30] DTSCCI-3902: Update COSC Generation logic --- ...clamant_and_defendant_mark_paid_in_full_notifications.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql index 6dcee1dff014..3e46d2a23de1 100644 --- a/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql +++ b/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql @@ -6,10 +6,9 @@ VALUES ('Scenario.AAA6.MarkPaidInFull.Confirmation.Claimant', '{ "Notice.AAA6.ProofofDebtPayment.Application.Claimant", "Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant", - "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant", - "Notice.AAA6.JudgmentsOnline.PaidInFull.Claimant" + "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant" }', - '{"Notice.AAA6.JudgmentsOnline.PaidInFull.Claimant": []}'); + '{}'); /** * Add scenario to delete defendant notification From f5fc14283ea265d20e2379937aaa5788df719686 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 26 Mar 2026 12:00:03 +0000 Subject: [PATCH 18/30] DTSCCI-3902: Update COSC Generation logic --- ...ew_clamant_and_defendant_mark_paid_in_full_notifications.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql b/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql index 3e46d2a23de1..ce9369c253a4 100644 --- a/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql +++ b/src/main/resources/db/migration/V2026_03_26_0921__create_new_clamant_and_defendant_mark_paid_in_full_notifications.sql @@ -8,7 +8,7 @@ VALUES ('Scenario.AAA6.MarkPaidInFull.Confirmation.Claimant', "Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant", "Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant" }', - '{}'); + '{"Notice.AAA6.JudgmentsOnline.PaidInFull.Claimant": []}'); /** * Add scenario to delete defendant notification From 2ec3175c50a212d523b93a93ec58952276ab0d95 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Tue, 7 Apr 2026 14:01:47 +0100 Subject: [PATCH 19/30] DTSCCI-3902: cosc document --- .../helpers/judgmentsonline/JudgmentsOnlineHelperTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java b/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java index f57254145ccb..6614f956d587 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/helpers/judgmentsonline/JudgmentsOnlineHelperTest.java @@ -48,8 +48,8 @@ void test_validateIfFutureDate() { @Test void shouldCheckIfDateDifferenceIsGreaterThan31Days() { - assertThat(checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate.now(), LocalDate.now().plusDays(31))).isFalse(); - assertThat(checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate.now(), LocalDate.now().plusDays(32))).isTrue(); + assertThat(checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate.of(2026, 4, 5), LocalDate.of(2026, 4, 7))).isFalse(); + assertThat(checkIfDateDifferenceIsGreaterThanDaysInMonth(LocalDate.of(2026, 3, 5), LocalDate.of(2026, 4, 7))).isTrue(); } @Test From 1d2385a7d59b3c9fec93d5b5b5fb3b158fed37c7 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 9 Apr 2026 13:16:31 +0100 Subject: [PATCH 20/30] DTSCCI-3242: update mark paid in full process --- .../JudgmentPaidClaimantDashboardService.java | 5 ++++ ...JudgmentPaidDefendantDashboardService.java | 5 ++++ ...gmentPaidClaimantDashboardServiceTest.java | 24 +++++++++++++++++++ ...mentPaidDefendantDashboardServiceTest.java | 23 ++++++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java index 98df2a88645e..7d0a70ed18d3 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java @@ -1,6 +1,8 @@ package uk.gov.hmcts.reform.civil.service.dashboardnotifications.judgementpaidinfull; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; @@ -24,6 +26,9 @@ public void notifyJudgmentPaidInFull(CaseData caseData, String authToken) { @Override public String getScenario(CaseData caseData) { + if (checkMarkPaidInFull(caseData)) { + return SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(); + } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT.getScenario(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java index eda31f41739c..b73be3323f18 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java @@ -1,6 +1,8 @@ package uk.gov.hmcts.reform.civil.service.dashboardnotifications.judgementpaidinfull; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; @@ -24,6 +26,9 @@ public void notifyJudgmentPaidInFull(CaseData caseData, String authToken) { @Override public String getScenario(CaseData caseData) { + if (checkMarkPaidInFull(caseData)) { + return SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(); + } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT.getScenario(); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java index 24db53e6b18a..487272774391 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java @@ -5,14 +5,18 @@ import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; import uk.gov.hmcts.reform.dashboard.data.ScenarioRequestParams; import uk.gov.hmcts.reform.dashboard.services.DashboardScenariosService; +import java.time.LocalDate; import java.util.HashMap; import org.junit.jupiter.api.BeforeEach; @@ -56,6 +60,26 @@ void shouldRecordScenarioForJudgmentPaidClaimant() { ); } + @Test + void shouldRecordScenario_whenInvoked_whenClaimantRepresented_And_MarkedPaid_And_Def_Mark_Paid_In_Full() { + CaseData caseData = CaseDataBuilder.builder().build(); + caseData.setApplicant1Represented(YesOrNo.NO); + caseData.setCcdCaseReference(1234L); + + CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); + caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); + caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + + service.notifyJudgmentPaidInFull(caseData2.build(), AUTH_TOKEN); + + verify(dashboardScenariosService).recordScenarios( + AUTH_TOKEN, + SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(), + "1234", + new ScenarioRequestParams(new HashMap<>()) + ); + } + @Test void shouldNotRecordScenarioForJudgmentPaidClaimant() { CaseData caseData = CaseDataBuilder.builder().build(); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java index f1cd144eb1bb..361b6cff6a4e 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java @@ -5,14 +5,18 @@ import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; +import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; import uk.gov.hmcts.reform.dashboard.data.ScenarioRequestParams; import uk.gov.hmcts.reform.dashboard.services.DashboardScenariosService; +import java.time.LocalDate; import java.util.HashMap; import org.junit.jupiter.api.BeforeEach; @@ -56,6 +60,25 @@ void shouldRecordScenarioForJudgmentPaidDefendant() { ); } + @Test + void shouldRecordScenario_whenInvoked_whenDefendantRepresented_And_MarkedPaid_And_Def_Mark_Paid_In_Full() { + CaseData caseData = CaseDataBuilder.builder().build(); + caseData.setRespondent1Represented(YesOrNo.NO); + caseData.setCcdCaseReference(1234L); + CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); + caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); + caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + + service.notifyJudgmentPaidInFull(caseData2.build(), AUTH_TOKEN); + + verify(dashboardScenariosService).recordScenarios( + AUTH_TOKEN, + SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(), + "1234", + new ScenarioRequestParams(new HashMap<>()) + ); + } + @Test void shouldNotRecordScenarioForJudgmentPaidDefendant() { CaseData caseData = CaseDataBuilder.builder().build(); From 56e1122a996044fed02eb76227a4d4bd04575c0a Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 9 Apr 2026 15:37:22 +0100 Subject: [PATCH 21/30] DTSCCI-3242: update mark paid in full process --- .../JudgmentPaidClaimantDashboardService.java | 3 +++ .../JudgmentPaidDefendantDashboardService.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java index 7d0a70ed18d3..63a6ff3f8143 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java @@ -4,6 +4,7 @@ import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; +import lombok.extern.slf4j.Slf4j; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; @@ -12,6 +13,7 @@ import org.springframework.stereotype.Service; +@Slf4j @Service public class JudgmentPaidClaimantDashboardService extends DashboardScenarioService { @@ -27,6 +29,7 @@ public void notifyJudgmentPaidInFull(CaseData caseData, String authToken) { @Override public String getScenario(CaseData caseData) { if (checkMarkPaidInFull(caseData)) { + log.info("JudgmentPaidDefendantDashboardService is called {}", caseData.getCcdCaseReference()); return SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(); } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT.getScenario(); diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java index b73be3323f18..1790d5c20be4 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java @@ -4,6 +4,7 @@ import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; +import lombok.extern.slf4j.Slf4j; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; @@ -12,6 +13,7 @@ import org.springframework.stereotype.Service; +@Slf4j @Service public class JudgmentPaidDefendantDashboardService extends DashboardScenarioService { @@ -27,6 +29,7 @@ public void notifyJudgmentPaidInFull(CaseData caseData, String authToken) { @Override public String getScenario(CaseData caseData) { if (checkMarkPaidInFull(caseData)) { + log.info("JudgmentPaidDefendantDashboardService is called {}", caseData.getCcdCaseReference()); return SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(); } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT.getScenario(); From b9ae3f7f0c093bb65681a27aeec2b59235cd5503 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Fri, 10 Apr 2026 16:20:18 +0100 Subject: [PATCH 22/30] DTSCCI-3242: update mark paid in full process --- ...dgmentPaidClaimantNotificationHandler.java | 5 --- ...gmentPaidDefendantNotificationHandler.java | 5 --- ...ntPaidClaimantNotificationHandlerTest.java | 35 ------------------ ...tPaidDefendantNotificationHandlerTest.java | 36 ------------------- 4 files changed, 81 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java index 9835e0e1844f..3baa3cdf6493 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandler.java @@ -14,8 +14,6 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_CLAIMANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; -import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; @Service public class JudgmentPaidClaimantNotificationHandler extends DashboardCallbackHandler { @@ -41,9 +39,6 @@ public List handledEvents() { @Override public String getScenario(CaseData caseData) { - if (checkMarkPaidInFull(caseData)) { - return SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(); - } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT.getScenario(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java index 280d7434a1cd..8731bd85c475 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandler.java @@ -14,8 +14,6 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_DEFENDANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; -import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; @Service public class JudgmentPaidDefendantNotificationHandler extends DashboardCallbackHandler { @@ -41,9 +39,6 @@ public List handledEvents() { @Override public String getScenario(CaseData caseData) { - if (checkMarkPaidInFull(caseData)) { - return SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(); - } return SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT.getScenario(); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java index b1d81f7a8a96..af9f5b13b74b 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgmentPaidClaimantNotificationHandlerTest.java @@ -12,8 +12,6 @@ import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP; -import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; -import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @@ -33,7 +31,6 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_CLAIMANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; @ExtendWith(MockitoExtension.class) public class JudgmentPaidClaimantNotificationHandlerTest extends BaseCallbackHandlerTest { @@ -117,37 +114,5 @@ void shouldRecordScenario_whenInvoked_whenClaimantRepresented() { new ScenarioRequestParams(scenarioParams) ); } - - @Test - void shouldRecordScenario_whenInvoked_whenClaimantRepresented_And_MarkedPaid_And_Def_Mark_Paid_In_Full() { - CaseDataLiP caseDataLiP = new CaseDataLiP(); - caseDataLiP.setApplicant1SettleClaim(YesOrNo.YES); - caseDataLiP.setApplicant1ClaimSettledDate(LocalDate.now()); - CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim() - .caseDataLip(caseDataLiP) - .applicant1Represented(YesOrNo.NO).build(); - caseData.setCaseDocumentUploadDate(LocalDateTime.now()); - - CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); - caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); - - HashMap scenarioParams = new HashMap<>(); - when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams); - - CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData2.build()).request( - CallbackRequest.builder().eventId(UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_CLAIMANT.name()).build() - ).build(); - - when(featureToggleService.isLipVLipEnabled()).thenReturn(true); - - handler.handle(params); - verify(dashboardScenariosService).recordScenarios( - "BEARER_TOKEN", - SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(), - caseData.getCcdCaseReference().toString(), - new ScenarioRequestParams(scenarioParams) - ); - } } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java index 45c38b6bdb40..19db27ca8b66 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/JudgmentPaidDefendantNotificationHandlerTest.java @@ -12,8 +12,6 @@ import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP; -import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; -import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @@ -33,7 +31,6 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_DEFENDANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; @ExtendWith(MockitoExtension.class) public class JudgmentPaidDefendantNotificationHandlerTest extends BaseCallbackHandlerTest { @@ -119,38 +116,5 @@ void shouldRecordScenario_whenInvoked_whenDefendantRepresented() { new ScenarioRequestParams(scenarioParams) ); } - - @Test - void shouldRecordScenario_whenInvoked_whenDefendantRepresented_And_MarkedPaid_And_Def_Mark_Paid_In_Full() { - CaseDataLiP caseDataLiP = new CaseDataLiP(); - caseDataLiP.setApplicant1SettleClaim(YesOrNo.YES); - caseDataLiP.setApplicant1ClaimSettledDate(LocalDate.now()); - - CaseData caseData = CaseDataBuilder.builder().atStateClaimSubmittedSmallClaim() - .caseDataLip(caseDataLiP) - .respondent1Represented(YesOrNo.NO).build(); - caseData.setCaseDocumentUploadDate(LocalDateTime.now()); - - CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); - caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); - - HashMap scenarioParams = new HashMap<>(); - when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams); - - CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData2.build()).request( - CallbackRequest.builder().eventId(UPDATE_DASHBOARD_NOTIFICATIONS_JUDGMENT_PAID_DEFENDANT.name()).build() - ).build(); - - when(featureToggleService.isLipVLipEnabled()).thenReturn(true); - - handler.handle(params); - verify(dashboardScenariosService).recordScenarios( - "BEARER_TOKEN", - SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(), - caseData.getCcdCaseReference().toString(), - new ScenarioRequestParams(scenarioParams) - ); - } } } From 82d7508b442fc8cda95ae17d7cfb6bd03418cb3d Mon Sep 17 00:00:00 2001 From: rishisharma Date: Tue, 14 Apr 2026 13:23:03 +0100 Subject: [PATCH 23/30] DTSCCI-3242: update mark paid in full process --- .../civil/utils/MarkPaidInFullUtil.java | 6 ++-- .../tasks/CaseEventTaskHandlerTest.java | 13 ++------- ...gmentPaidClaimantDashboardServiceTest.java | 29 +++++++++---------- ...mentPaidDefendantDashboardServiceTest.java | 29 +++++++++---------- .../civil/utils/MarkPaidInFullUtilTest.java | 7 +++-- 5 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java b/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java index c0dff5d64ab7..456c60ccb2ee 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java @@ -4,6 +4,8 @@ import java.util.Objects; +import static uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus.ACTIVE; + public class MarkPaidInFullUtil { private MarkPaidInFullUtil() { @@ -13,7 +15,7 @@ private MarkPaidInFullUtil() { public static boolean checkMarkPaidInFull(CaseData data) { return (Objects.nonNull(data.getActiveJudgment()) && data.getActiveJudgment().getFullyPaymentMadeDate() != null - && Objects.nonNull(data.getCertOfSC()) - && data.getCertOfSC().getDefendantFinalPaymentDate() != null); + && Objects.nonNull(data.getCoSCApplicationStatus()) + && ACTIVE.equals(data.getCoSCApplicationStatus())); } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java index 78a3f6b78dff..504857961666 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/tasks/CaseEventTaskHandlerTest.java @@ -31,11 +31,11 @@ import uk.gov.hmcts.reform.civil.enums.BusinessProcessStatus; import uk.gov.hmcts.reform.civil.enums.MultiPartyScenario; import uk.gov.hmcts.reform.civil.enums.ReasonForProceedingOnPaper; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.BusinessProcess; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.StateFlowDTO; -import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.sampledata.CaseDetailsBuilder; @@ -51,7 +51,6 @@ import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; -import java.util.Objects; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -83,6 +82,7 @@ import static uk.gov.hmcts.reform.civil.service.flowstate.FlowState.Main.TAKEN_OFFLINE_AFTER_CLAIM_DETAILS_NOTIFIED; import static uk.gov.hmcts.reform.civil.service.flowstate.FlowState.Main.TAKEN_OFFLINE_AFTER_CLAIM_NOTIFIED; import static uk.gov.hmcts.reform.civil.service.flowstate.FlowState.Main.TAKEN_OFFLINE_BY_STAFF; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; @ExtendWith(MockitoExtension.class) class CaseEventTaskHandlerTest { @@ -166,7 +166,7 @@ void shouldTriggerCCDEvent_whenHandlerIsExecutedV1() { .build(); CaseData.CaseDataBuilder caseData2 = caseData1.toBuilder(); caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + caseData2.coSCApplicationStatus(CoscApplicationStatus.ACTIVE); CaseData caseData = caseData2.build(); VariableMap variables = Variables.createVariables(); @@ -223,13 +223,6 @@ void shouldTriggerCCDEvent_whenHandlerIsExecutedV3() { verify(coreCaseDataService).submitUpdate(eq(CASE_ID), any(CaseDataContent.class)); verify(externalTaskService).complete(mockTask, variables); } - - private boolean checkMarkPaidInFull(CaseData data) { - return (Objects.nonNull(data.getActiveJudgment()) - && data.getActiveJudgment().getFullyPaymentMadeDate() != null - && Objects.nonNull(data.getCertOfSC()) - && data.getCertOfSC().getDefendantFinalPaymentDate() != null); - } } @Nested diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java index 487272774391..3df0a000deb0 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java @@ -1,15 +1,14 @@ package uk.gov.hmcts.reform.civil.service.dashboardnotifications.judgementpaidinfull; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; - +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.reform.civil.enums.YesOrNo; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.model.CaseData; -import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; @@ -19,12 +18,12 @@ import java.time.LocalDate; import java.util.HashMap; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; @ExtendWith(MockitoExtension.class) class JudgmentPaidClaimantDashboardServiceTest { @@ -68,7 +67,7 @@ void shouldRecordScenario_whenInvoked_whenClaimantRepresented_And_MarkedPaid_And CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + caseData2.coSCApplicationStatus(CoscApplicationStatus.ACTIVE); service.notifyJudgmentPaidInFull(caseData2.build(), AUTH_TOKEN); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java index 361b6cff6a4e..1172b1229ff0 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java @@ -1,15 +1,14 @@ package uk.gov.hmcts.reform.civil.service.dashboardnotifications.judgementpaidinfull; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; - +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import uk.gov.hmcts.reform.civil.enums.YesOrNo; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.model.CaseData; -import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; @@ -19,12 +18,12 @@ import java.time.LocalDate; import java.util.HashMap; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; @ExtendWith(MockitoExtension.class) class JudgmentPaidDefendantDashboardServiceTest { @@ -67,7 +66,7 @@ void shouldRecordScenario_whenInvoked_whenDefendantRepresented_And_MarkedPaid_An caseData.setCcdCaseReference(1234L); CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())); + caseData2.coSCApplicationStatus(CoscApplicationStatus.ACTIVE); service.notifyJudgmentPaidInFull(caseData2.build(), AUTH_TOKEN); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java b/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java index 5b0d2c69f168..eab586b3d20b 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.reform.civil.utils; import org.junit.jupiter.api.Test; +import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; @@ -16,7 +17,7 @@ class MarkPaidInFullUtilTest { void shouldReturnTrue_whenAllConditionsAreMet() { CaseData caseData = CaseData.builder() .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) - .certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())) + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) .build(); assertTrue(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); @@ -35,7 +36,7 @@ void shouldReturnFalse_whenActiveJudgmentIsNull() { void shouldReturnFalse_whenFullyPaymentMadeDateIsNull() { CaseData caseData = CaseData.builder() .activeJudgment(new JudgmentDetails()) - .certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())) + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) .build(); assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); @@ -54,7 +55,7 @@ void shouldReturnFalse_whenCertOfSCIsNull() { void shouldReturnFalse_whenDefendantFinalPaymentDateIsNull() { CaseData caseData = CaseData.builder() .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) - .certOfSC(new CertOfSC()) + .coSCApplicationStatus(CoscApplicationStatus.INACTIVE) .build(); assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); From 14a1731ab4035befa85c929eca7863fa3e84eb0c Mon Sep 17 00:00:00 2001 From: rishisharma Date: Tue, 14 Apr 2026 15:10:42 +0100 Subject: [PATCH 24/30] DTSCCI-3242: update mark paid in full process --- .../camunda/docmosis/GenerateCoscDocumentHandler.java | 5 ++++- .../camunda/docmosis/GenerateCoscDocumentHandlerTest.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandler.java index 0d35584ceac0..54b472696e3e 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandler.java @@ -19,6 +19,7 @@ import uk.gov.hmcts.reform.civil.service.docmosis.cosc.CertificateOfDebtGenerator; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -56,7 +57,9 @@ private CallbackResponse generateCoscDocument(CallbackParams callbackParams) { CaseData caseDataInfo = callbackParams.getCaseData(); buildCoscDocument(callbackParams); caseDataInfo.setCoSCApplicationStatus(PROCESSED); - + if (caseDataInfo.getJoDefendantMarkedPaidInFullIssueDate() == null) { + caseDataInfo.setJoDefendantMarkedPaidInFullIssueDate(LocalDateTime.now()); + } return AboutToStartOrSubmitCallbackResponse.builder() .data(caseDataInfo.toMap(objectMapper)) .build(); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandlerTest.java index a54af6bb068b..b5994cdbed86 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/docmosis/GenerateCoscDocumentHandlerTest.java @@ -140,6 +140,9 @@ void shouldGenerate_cosc_bilingualdoc() { assertThat(response.getData()) .extracting("coSCApplicationStatus") .isEqualTo("PROCESSED"); + assertThat(response.getData()) + .extracting("joDefendantMarkedPaidInFullIssueDate") + .isNotNull(); List documentsList = (List) response.getData().get("systemGeneratedCaseDocuments"); assertThat(documentsList) .extracting("value") From 7facddca7f53e2ab00cd4b4ac4b111d1472379db Mon Sep 17 00:00:00 2001 From: rishisharma Date: Tue, 14 Apr 2026 16:51:53 +0100 Subject: [PATCH 25/30] DTSCCI-3242: update mark paid in full process --- .../JudgmentPaidClaimantDashboardService.java | 11 +- ...JudgmentPaidDefendantDashboardService.java | 11 +- .../civil/utils/MarkPaidInFullUtil.java | 8 ++ ...gmentPaidClaimantDashboardServiceTest.java | 2 +- ...mentPaidDefendantDashboardServiceTest.java | 2 +- .../civil/utils/MarkPaidInFullUtilTest.java | 128 +++++++++++++----- 6 files changed, 111 insertions(+), 51 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java index 63a6ff3f8143..695651e4f62e 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardService.java @@ -1,17 +1,16 @@ package uk.gov.hmcts.reform.civil.service.dashboardnotifications.judgementpaidinfull; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; -import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; - import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardScenarioService; import uk.gov.hmcts.reform.dashboard.services.DashboardScenariosService; -import org.springframework.stereotype.Service; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication; @Slf4j @Service @@ -28,7 +27,7 @@ public void notifyJudgmentPaidInFull(CaseData caseData, String authToken) { @Override public String getScenario(CaseData caseData) { - if (checkMarkPaidInFull(caseData)) { + if (checkMarkPaidInFullAndPaidForApplication(caseData)) { log.info("JudgmentPaidDefendantDashboardService is called {}", caseData.getCcdCaseReference()); return SCENARIO_AAA6_MARK_PAID_IN_FULL_CLAIMANT.getScenario(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java index 1790d5c20be4..9182b10329a7 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardService.java @@ -1,17 +1,16 @@ package uk.gov.hmcts.reform.civil.service.dashboardnotifications.judgementpaidinfull; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; -import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; -import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFull; - import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; import uk.gov.hmcts.reform.civil.enums.YesOrNo; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardNotificationsParamsMapper; import uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardScenarioService; import uk.gov.hmcts.reform.dashboard.services.DashboardScenariosService; -import org.springframework.stereotype.Service; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_CONFIRMATION_JUDGMENT_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT; +import static uk.gov.hmcts.reform.civil.utils.MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication; @Slf4j @Service @@ -28,7 +27,7 @@ public void notifyJudgmentPaidInFull(CaseData caseData, String authToken) { @Override public String getScenario(CaseData caseData) { - if (checkMarkPaidInFull(caseData)) { + if (checkMarkPaidInFullAndPaidForApplication(caseData)) { log.info("JudgmentPaidDefendantDashboardService is called {}", caseData.getCcdCaseReference()); return SCENARIO_AAA6_MARK_PAID_IN_FULL_DEFENDANT.getScenario(); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java b/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java index 456c60ccb2ee..33c211838e6d 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtil.java @@ -5,6 +5,7 @@ import java.util.Objects; import static uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus.ACTIVE; +import static uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus.PROCESSED; public class MarkPaidInFullUtil { @@ -18,4 +19,11 @@ public static boolean checkMarkPaidInFull(CaseData data) { && Objects.nonNull(data.getCoSCApplicationStatus()) && ACTIVE.equals(data.getCoSCApplicationStatus())); } + + public static boolean checkMarkPaidInFullAndPaidForApplication(CaseData data) { + return (Objects.nonNull(data.getActiveJudgment()) + && data.getActiveJudgment().getFullyPaymentMadeDate() != null + && Objects.nonNull(data.getCoSCApplicationStatus()) + && PROCESSED.equals(data.getCoSCApplicationStatus())); + } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java index 3df0a000deb0..6e179bc5687e 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidClaimantDashboardServiceTest.java @@ -67,7 +67,7 @@ void shouldRecordScenario_whenInvoked_whenClaimantRepresented_And_MarkedPaid_And CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.coSCApplicationStatus(CoscApplicationStatus.ACTIVE); + caseData2.coSCApplicationStatus(CoscApplicationStatus.PROCESSED); service.notifyJudgmentPaidInFull(caseData2.build(), AUTH_TOKEN); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java index 1172b1229ff0..0a420f400186 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/judgementpaidinfull/JudgmentPaidDefendantDashboardServiceTest.java @@ -66,7 +66,7 @@ void shouldRecordScenario_whenInvoked_whenDefendantRepresented_And_MarkedPaid_An caseData.setCcdCaseReference(1234L); CaseData.CaseDataBuilder caseData2 = caseData.toBuilder(); caseData2.activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())); - caseData2.coSCApplicationStatus(CoscApplicationStatus.ACTIVE); + caseData2.coSCApplicationStatus(CoscApplicationStatus.PROCESSED); service.notifyJudgmentPaidInFull(caseData2.build(), AUTH_TOKEN); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java b/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java index eab586b3d20b..b014f0e86bb6 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/utils/MarkPaidInFullUtilTest.java @@ -1,9 +1,9 @@ package uk.gov.hmcts.reform.civil.utils; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import uk.gov.hmcts.reform.civil.enums.cosc.CoscApplicationStatus; import uk.gov.hmcts.reform.civil.model.CaseData; -import uk.gov.hmcts.reform.civil.model.citizenui.CertOfSC; import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails; import java.time.LocalDate; @@ -13,51 +13,105 @@ class MarkPaidInFullUtilTest { - @Test - void shouldReturnTrue_whenAllConditionsAreMet() { - CaseData caseData = CaseData.builder() - .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) - .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) - .build(); + @Nested + class CheckMarkPaidInFull { + @Test + void shouldReturnTrue_whenAllConditionsAreMet() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) + .build(); - assertTrue(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); - } + assertTrue(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } - @Test - void shouldReturnFalse_whenActiveJudgmentIsNull() { - CaseData caseData = CaseData.builder() - .certOfSC(new CertOfSC().setDefendantFinalPaymentDate(LocalDate.now())) - .build(); + @Test + void shouldReturnFalse_whenActiveJudgmentIsNull() { + CaseData caseData = CaseData.builder() + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) + .build(); - assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); - } + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } - @Test - void shouldReturnFalse_whenFullyPaymentMadeDateIsNull() { - CaseData caseData = CaseData.builder() - .activeJudgment(new JudgmentDetails()) - .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) - .build(); + @Test + void shouldReturnFalse_whenFullyPaymentMadeDateIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails()) + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) + .build(); - assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); - } + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } + + @Test + void shouldReturnFalse_whenCoSCApplicationStatusIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .build(); - @Test - void shouldReturnFalse_whenCertOfSCIsNull() { - CaseData caseData = CaseData.builder() - .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) - .build(); + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } - assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + @Test + void shouldReturnFalse_whenCoSCApplicationStatusIsNotActive() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .coSCApplicationStatus(CoscApplicationStatus.PROCESSED) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + } } - @Test - void shouldReturnFalse_whenDefendantFinalPaymentDateIsNull() { - CaseData caseData = CaseData.builder() - .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) - .coSCApplicationStatus(CoscApplicationStatus.INACTIVE) - .build(); + @Nested + class CheckMarkPaidInFullAndPaidForApplication { + @Test + void shouldReturnTrue_whenAllConditionsAreMet() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .coSCApplicationStatus(CoscApplicationStatus.PROCESSED) + .build(); + + assertTrue(MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication(caseData)); + } + + @Test + void shouldReturnFalse_whenActiveJudgmentIsNull() { + CaseData caseData = CaseData.builder() + .coSCApplicationStatus(CoscApplicationStatus.PROCESSED) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication(caseData)); + } + + @Test + void shouldReturnFalse_whenFullyPaymentMadeDateIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails()) + .coSCApplicationStatus(CoscApplicationStatus.PROCESSED) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication(caseData)); + } + + @Test + void shouldReturnFalse_whenCoSCApplicationStatusIsNull() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .build(); + + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication(caseData)); + } + + @Test + void shouldReturnFalse_whenCoSCApplicationStatusIsNotProcessed() { + CaseData caseData = CaseData.builder() + .activeJudgment(new JudgmentDetails().setFullyPaymentMadeDate(LocalDate.now())) + .coSCApplicationStatus(CoscApplicationStatus.ACTIVE) + .build(); - assertFalse(MarkPaidInFullUtil.checkMarkPaidInFull(caseData)); + assertFalse(MarkPaidInFullUtil.checkMarkPaidInFullAndPaidForApplication(caseData)); + } } } From c3bbcd3bee5de67db7b2f133f981a8fdd9300ac3 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 16 Apr 2026 16:14:38 +0100 Subject: [PATCH 26/30] DTSCCI-3902: Cosc application --- .../V2026_04_16_1612__update_claimant_notifications.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql diff --git a/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql b/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql new file mode 100644 index 000000000000..42eebc8f40be --- /dev/null +++ b/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql @@ -0,0 +1,3 @@ +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant"}', + notifications_to_create = '{}' +WHERE name = 'Notice.AAA6.ProofofDebtPayment.Application.Claimant'; From dc3675fd5b2535862a2c5de6e7776603c2b5a1eb Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 16 Apr 2026 16:44:13 +0100 Subject: [PATCH 27/30] DTSCCI-3902: Cosc application --- .../V2026_04_16_1612__update_claimant_notifications.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql b/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql index 42eebc8f40be..6eaa17b75e32 100644 --- a/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql +++ b/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql @@ -1,3 +1,3 @@ UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant"}', notifications_to_create = '{}' -WHERE name = 'Notice.AAA6.ProofofDebtPayment.Application.Claimant'; +WHERE name = 'Scenario.AAA6.ProofofDebtPayment.Application.Claimant'; From 0984cbcaabae16ff25e97196b250df9008c9dc7b Mon Sep 17 00:00:00 2001 From: rishisharma Date: Thu, 16 Apr 2026 18:43:26 +0100 Subject: [PATCH 28/30] DTSCCI-3902: Cosc application --- .../V2026_04_16_1612__update_claimant_notifications.sql | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql diff --git a/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql b/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql deleted file mode 100644 index 6eaa17b75e32..000000000000 --- a/src/main/resources/db/migration/V2026_04_16_1612__update_claimant_notifications.sql +++ /dev/null @@ -1,3 +0,0 @@ -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant"}', - notifications_to_create = '{}' -WHERE name = 'Scenario.AAA6.ProofofDebtPayment.Application.Claimant'; From 03204ca010a03ed5e6213506847255998c5d43b7 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Fri, 17 Apr 2026 10:52:23 +0100 Subject: [PATCH 29/30] DTSCCI-3902: Cosc application --- ...V2026_04_17_1050__remove_old_mark_paid_notifications.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql diff --git a/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql b/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql new file mode 100644 index 000000000000..7c883a69a840 --- /dev/null +++ b/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql @@ -0,0 +1,6 @@ +/** + * Notifications to be deleted after DJ journey until Claimant confirms payment. + */ + +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant"}' +WHERE name = 'Scenario.AAA6.ProofofDebtPayment.Application.Claimant'; From 778a61ae2ab727b2ef3943ed9f52bbadae54d2a1 Mon Sep 17 00:00:00 2001 From: rishisharma Date: Fri, 17 Apr 2026 11:52:16 +0100 Subject: [PATCH 30/30] DTSCCI-3902: Cosc application --- .../V2026_04_17_1050__remove_old_mark_paid_notifications.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql b/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql index 7c883a69a840..781d8ba5fcdd 100644 --- a/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql +++ b/src/main/resources/db/migration/V2026_04_17_1050__remove_old_mark_paid_notifications.sql @@ -2,5 +2,5 @@ * Notifications to be deleted after DJ journey until Claimant confirms payment. */ -UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant"}' +UPDATE dbs.scenario SET notifications_to_delete = '{"Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant","Notice.AAA6.JudgmentsOnline.DefaultJudgmentIssued.Claimant"}' WHERE name = 'Scenario.AAA6.ProofofDebtPayment.Application.Claimant';