From e353c9f1f9e0472e38e4094b0bb8041d2c15f407 Mon Sep 17 00:00:00 2001 From: kenneth-hmcts <91327278+kenneth-hmcts@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:22:49 +0000 Subject: [PATCH] CIV-11603 Fast Track Claimant Intent (#3720) * CIV-11571 Fix court location if no specific court (#3569) * CIV-11571: Add null checking * CIV-11571: Add unit test --------- Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-8241 Manual Determination - Lip Notifications (#3529) * added changes for claimant response cui event. * CIV-8291 : Functional code - Need to refactor * CIV-8291 : Refactor duplicated methods to a common service * CIV-8291 : Handler Test * CIV-8291 : Fix checkStyle * CIV-8291 : Fix checkStyle * CIV-8291 : Adding mocks * CIV-8291 : Adding mocks * CIV-8291 : Adding mocks * CIV-8291 : Change final state to PROCEEDS_IN_HERITAGE_SYSTEM * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification Test * CIV-8241: Set Up Notification Test * CIV-8241: Roll back one line * CIV-8241: Change method name * Update build.gradle * Update build.gradle --------- Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-10727 Assisted order uplift (#3550) * CIV-11158 Save hearing location in case data * Added setting assisted order courtLocation to hearingLocation or caseManagementLocation is hearingLocation is not defined * Fixed not filtering courtLocations by caseTypeId --------- Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice * CIV-11695 - Update ClaimantResponseCuiCallbackHandler.java (#3616) * Update ClaimantResponseCuiCallbackHandler.java * fix for judicial referral * fixed claim state issue and unit tests. --------- Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: Pablo Ortiz Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> * CIV-8905 Claimant Dashboard Status "Mediation E2E, Manual Determination (org), ITP failed" (#3564) * CIV-8905 Added functionality for dashboard status * CIV-8905 Added functionality for dashboard status * CIV-8905 Fixed AC 4 * CIV-11363 add trigger event (#3633) * CIV-11363 add trigger event * CIV-8905 Merged with bulk_tasks --------- Co-authored-by: Pablo Ortiz Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> * CIV-8454 Trigger service request after CCD case creation (#3597) * CIV-8454 Trigger service request after CCD case creation * CIV-8454 Move Service Request creation to Camunda * CIV-8454 Undo flow state change - not required * CIV-8454 Remove empty lines * CIV-8454 Add test for service request handler CUI * CIV-8454 Only create service request when no help with fees * CIV-8454 Change event name * CIV-11144 updated witness summary to add date (#3623) * updated witness summary to add date * Update Jenkinsfile_CNP point at CCD * Update Jenkinsfile_CNP * CIV-11363 add caseId to caseIdForRetrigger.txt (#3646) * CIV-11363 add caseId to caseIdForRetrigger.txt * adding not suitable for sdo too * update caseIdForRetriger --------- Co-authored-by: Astha Malviya * testing master build (#3650) Co-authored-by: sankhajuria --------- Co-authored-by: Raja Mani Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: sankhajuria Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-11603 Set Up Case State * CIV-11603 Set Up Translation * CIV-11603 Update Mediation Check * CIV-11603 Remove unused import * CIV-11603 Update Unit Test * CIV-11603 Adding more unit test * CIV-11603 Update from review * CIV-11603 Merged with master --------- Co-authored-by: jarekPierchala Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: Gareth Lancaster <90632240+Gareth40343@users.noreply.github.com> Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice Co-authored-by: jeswanth-hmcts <134285996+jeswanth-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> Co-authored-by: marianadpereira Co-authored-by: Manish Garg Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Paul Pearson <46532983+paul-pearson@users.noreply.github.com> Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: Harry H <33700332+HarryH96@users.noreply.github.com> Co-authored-by: marianadpereira <71711509+marianadpereira@users.noreply.github.com> --- .../ClaimantResponseCuiCallbackHandler.java | 51 +++++++++++-------- .../RespondToClaimCuiCallbackHandler.java | 1 + .../reform/civil/model/CaseDataParent.java | 10 +++- ...laimantResponseCuiCallbackHandlerTest.java | 46 +++++++++++++++++ .../RespondToClaimCuiCallbackHandlerTest.java | 3 ++ 5 files changed, 89 insertions(+), 22 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandler.java index c1039dbb757..7b0a5787a9c 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandler.java @@ -93,25 +93,11 @@ private CallbackResponse aboutToSubmit(CallbackParams callbackParams) { AboutToStartOrSubmitCallbackResponse.builder() .data(updatedData.toMap(objectMapper)); - updateClaimStateJudicialReferral(response, updatedData); updateClaimEndState(response, updatedData); return response.build(); } - private void updateClaimStateJudicialReferral( - AboutToStartOrSubmitCallbackResponse.AboutToStartOrSubmitCallbackResponseBuilder response, - CaseData caseData) { - if (isJudicialReferralAllowed(caseData)) { - response.state(CaseState.JUDICIAL_REFERRAL.name()); - } - } - - private boolean isJudicialReferralAllowed(CaseData caseData) { - return (caseData.isClaimantNotSettlePartAdmitClaim() || caseData.isFullDefence()) - && (Objects.nonNull(caseData.getCaseDataLiP()) && caseData.getCaseDataLiP().hasClaimantNotAgreedToFreeMediation()); - } - private boolean isProceedsInHeritageSystemAllowed(CaseData caseData) { ClaimantLiPResponse applicant1Response = Optional.ofNullable(caseData.getCaseDataLiP()) .map(CaseDataLiP::getApplicant1LiPResponse) @@ -134,17 +120,21 @@ private boolean isProceedsInHeritageSystemAllowed(CaseData caseData) { || isCourtDecisionRejected; } - private void updateClaimEndState(AboutToStartOrSubmitCallbackResponse.AboutToStartOrSubmitCallbackResponseBuilder response, CaseData updatedData) { - if (updatedData.hasDefendantAgreedToFreeMediation() && updatedData.hasClaimantAgreedToFreeMediation()) { - response.state(CaseState.IN_MEDIATION.name()); + private String setUpCaseState(AboutToStartOrSubmitCallbackResponse.AboutToStartOrSubmitCallbackResponseBuilder response, CaseData updatedData) { + if (isJudicialReferralAllowed(updatedData)) { + return CaseState.JUDICIAL_REFERRAL.name(); + } else if (updatedData.hasDefendantAgreedToFreeMediation() && updatedData.hasClaimantAgreedToFreeMediation()) { + return CaseState.IN_MEDIATION.name(); } else if (updatedData.hasApplicant1SignedSettlementAgreement() && updatedData.hasApplicantAcceptedRepaymentPlan()) { - response.state(CaseState.All_FINAL_ORDERS_ISSUED.name()); + return CaseState.All_FINAL_ORDERS_ISSUED.name(); } else if (Objects.nonNull(updatedData.getApplicant1PartAdmitIntentionToSettleClaimSpec()) && updatedData.isClaimantIntentionSettlePartAdmit()) { - response.state(CaseState.CASE_SETTLED.name()); + return CaseState.CASE_SETTLED.name(); } else if (updatedData.hasApplicantNotProceededWithClaim()) { - response.state(CaseState.CASE_DISMISSED.name()); + return CaseState.CASE_DISMISSED.name(); } else if (isProceedsInHeritageSystemAllowed(updatedData)) { - response.state(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name()); + return CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name(); + } else { + return response.build().getState(); } } @@ -159,4 +149,23 @@ private boolean hasCcjRequest(CaseData caseData) { return (caseData.isLipvLipOneVOne() && featureToggleService.isLipVLipEnabled() && caseData.hasApplicant1AcceptedCcj() && caseData.isCcjRequestJudgmentByAdmission()); } + + private boolean isJudicialReferralAllowed(CaseData caseData) { + return isProceedOrNotSettleClaim(caseData) + && (isClaimantOrDefendantRejectMediation(caseData) + || caseData.isFastTrackClaim()); + } + + private boolean isProceedOrNotSettleClaim(CaseData caseData) { + return caseData.isClaimantNotSettlePartAdmitClaim() || caseData.isFullDefence() || caseData.isFullDefenceNotPaid(); + } + + private boolean isClaimantOrDefendantRejectMediation(CaseData caseData) { + return (Objects.nonNull(caseData.getCaseDataLiP()) && caseData.getCaseDataLiP().hasClaimantNotAgreedToFreeMediation()) + || caseData.hasDefendantNotAgreedToFreeMediation(); + } + + private void updateClaimEndState(AboutToStartOrSubmitCallbackResponse.AboutToStartOrSubmitCallbackResponseBuilder response, CaseData updatedData) { + response.state(setUpCaseState(response, updatedData)); + } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandler.java index b4ce2c6b1b2..5e458fcd274 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandler.java @@ -77,6 +77,7 @@ private CaseData getUpdatedCaseData(CallbackParams callbackParams) { .respondent1ResponseDate(responseDate) .respondent1GeneratedResponseDocument(dummyDocument) .respondent1ClaimResponseDocumentSpec(dummyDocument) + .responseClaimTrack(AllocatedTrack.getAllocatedTrack(caseData.getTotalClaimAmount(), null).name()) .applicant1ResponseDeadline(deadlinesCalculator.calculateApplicantResponseDeadline( responseDate, allocatedTrack diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java b/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java index b8672919bc4..ac39eb41955 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java @@ -160,6 +160,7 @@ import static java.math.BigDecimal.ZERO; import static java.util.Optional.ofNullable; +import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; @Jacksonized @@ -411,6 +412,7 @@ public class CaseDataParent implements MappableObject { */ private final ResponseOneVOneShowTag showResponseOneVOneFlag; private final YesOrNo applicant1AcceptAdmitAmountPaidSpec; + private final YesOrNo applicant1FullDefenceConfirmAmountPaidSpec; private final YesOrNo applicant1PartAdmitConfirmAmountPaidSpec; private final YesOrNo applicant1PartAdmitIntentionToSettleClaimSpec; private final YesOrNo applicant1AcceptFullAdmitPaymentPlanSpec; @@ -435,7 +437,7 @@ public class CaseDataParent implements MappableObject { @JsonIgnore public boolean isApplicantNotRepresented() { - return this.applicant1Represented == YesOrNo.NO; + return this.applicant1Represented == NO; } /** @@ -810,4 +812,10 @@ public String getHearingLocationText() { .map(DynamicListElement::getLabel) .orElse(null); } + + @JsonIgnore + public boolean isFullDefenceNotPaid() { + return NO.equals(getApplicant1FullDefenceConfirmAmountPaidSpec()); + } + } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandlerTest.java index b58c1b4ddb3..1f69df2ee88 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/ClaimantResponseCuiCallbackHandlerTest.java @@ -55,6 +55,7 @@ import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_START; import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CLAIMANT_RESPONSE_CUI; +import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.FAST_CLAIM; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO; import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; import static uk.gov.hmcts.reform.civil.model.Party.Type.COMPANY; @@ -253,6 +254,21 @@ void shouldUpdateCaseStateToJudicialReferral_WhenFullDefence_NotPaid_NoMediation } + @Test + void shouldUpdateCaseStateToJudicialReferral_WhenFullDefence_NotPaid_FastTrack() { + + CaseData caseData = + CaseDataBuilder.builder().applicant1PartAdmitIntentionToSettleClaimSpec(NO) + .responseClaimTrack(FAST_CLAIM.name()) + .atStateClaimIssued() + .build(); + CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); + + var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); + assertEquals(CaseState.JUDICIAL_REFERRAL.name(), response.getState()); + + } + @Test void shouldUpdateCaseStateToJudicialReferral_WhenFullDefence() { CaseDataLiP caseDataLiP = CaseDataLiP.builder() @@ -269,6 +285,21 @@ void shouldUpdateCaseStateToJudicialReferral_WhenFullDefence() { assertEquals(CaseState.JUDICIAL_REFERRAL.name(), response.getState()); } + @Test + void shouldUpdateCaseStateToCaseDismissed_WhenFullDefence_FastTrack() { + + CaseData caseData = + CaseDataBuilder.builder().applicant1ProceedWithClaim(NO) + .responseClaimTrack(FAST_CLAIM.name()) + .atStateClaimIssued() + .build(); + CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); + + var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); + assertEquals(CaseState.CASE_DISMISSED.name(), response.getState()); + + } + @Test void shouldOnlyUpdateClaimStatus_whenPartAdmitNotSettled_NoMediation_NoBaseCourt() { Applicant1DQ applicant1DQ = @@ -608,6 +639,21 @@ void shouldUpdateCCJRequestPaymentDetails() { private CaseData getCaseData(AboutToStartOrSubmitCallbackResponse response) { return mapper.convertValue(response.getData(), CaseData.class); } + + @Test + void shouldChangeCaseState_whenApplicantAgreeClaimSettlement() { + CaseData caseData = CaseDataBuilder.builder() + .atStateClaimIssued() + .applicant1PartAdmitIntentionToSettleClaimSpec(YES) + .applicant1PartAdmitConfirmAmountPaidSpec(YES) + .build().toBuilder() + .responseClaimMediationSpecRequired(YES).build(); + + CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT); + var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params); + + assertThat(response.getState()).isEqualTo(CaseState.CASE_SETTLED.name()); + } } @Test diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandlerTest.java index 9f95795eb66..211ff8116e7 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/RespondToClaimCuiCallbackHandlerTest.java @@ -21,6 +21,7 @@ import uk.gov.hmcts.reform.civil.service.DeadlinesCalculator; import uk.gov.hmcts.reform.civil.service.Time; +import java.math.BigDecimal; import java.time.LocalDateTime; import static org.assertj.core.api.Assertions.assertThat; @@ -83,6 +84,7 @@ void setup() { void shouldUpdateBusinessProcessAndClaimStatus_whenDefendantResponseLangIsEnglish() { CaseData caseData = CaseDataBuilder.builder() .atStateClaimIssued() + .totalClaimAmount(BigDecimal.valueOf(5000)) .caseDataLip(CaseDataLiP.builder().respondent1LiPResponse(RespondentLiPResponse.builder().respondent1ResponseLanguage("ENGLISH").build()).build()) .build(); @@ -105,6 +107,7 @@ void shouldUpdateBusinessProcessAndClaimStatus_whenDefendantResponseLangIsEnglis void shouldOnlyUpdateClaimStatus_whenDefendantResponseLangIsBilingual() { CaseData caseData = CaseDataBuilder.builder() .atStateClaimIssued() + .totalClaimAmount(BigDecimal.valueOf(5000)) .caseDataLip(CaseDataLiP.builder().respondent1LiPResponse(RespondentLiPResponse.builder().respondent1ResponseLanguage("BOTH").build()).build()) .build(); CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT);