Skip to content

Commit

Permalink
CIV-8903 dashboard settlement agreement (#3787)
Browse files Browse the repository at this point in the history
* Based on full and part admit repayment plan settlement agreement signed

* reverted the change

* build issue resolved

* CIV-8903 Set settlement agreement response deadline and statuses

* CIV-8147 Merge in dependency

* CIV-8903 Add statuses for AC3 and AC4

* CIV-8903 Fix checkstyle

* CIV-8903 Fix checkstyle

* CIV-8903 Add tests for settlement agreement deadline

* CIV-8903 Implement claim statuses for CmcClaim

* CIV-8903 Run against required ccd and camunda branches

* CIV-11571 Fix court location if no specific court (#3569)

* CIV-11571: Add null checking

* CIV-11571: Add unit test

---------

Co-authored-by: jarekPierchala <[email protected]>

* 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 <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>

* 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 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>

* 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 <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>

* 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 <[email protected]>
Co-authored-by: MMNycz <[email protected]>

* 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 <[email protected]>

* testing master build (#3650)

Co-authored-by: sankhajuria <[email protected]>

---------

Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>

* CIV-8903 Implement missing methods

* CIV-8903 Revert ccd and camunda branches

* CIV-8903 Change SEND to SIGNED

* CIV-8903 Move new common implementations to superclass

* CIV-8903 Remove unused imports

* CIV-8903 Fix checkstyle

* CIV-8903 temporary changes to check response of OCMC claims in preview

* CIV-8903 temporary changes to check response of OCMC claims in preview

* CIV-8903 Removed dateformat from desearilization of cmc claim localdatetime

* CIV-8903 Revert unwanted change in DATE_TIME_FORMAT_CMC

* Update FeatureToggleService.java

* Update FeatureToggleServiceTest.java

* CIV-8903 Temporary System out for debugging OCMC claims

* Update ClaimStoreService.java

Temporary changes for debugging OCMC claims

* CIV-8903 Changes for settlement agreement dashboard status

* CIV-8903 Reverting FeatureToggleService temp changes

* CIV-8903 Updated functionality to show OCMC status with correct status

* CIV-8903 Updated functionality to show OCMC status with correct status

---------

Co-authored-by: kalachandrasekar1 <[email protected]>
Co-authored-by: kalachandrasekar1 <[email protected]>
Co-authored-by: paul-pearson <[email protected]>
Co-authored-by: Paul Pearson <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>
Co-authored-by: kenneth-hmcts <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: Gareth Lancaster <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>
Co-authored-by: jeswanth-hmcts <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>
Co-authored-by: marianadpereira <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
  • Loading branch information
26 people authored Jan 10, 2024
1 parent 2051a36 commit f1c52ba
Show file tree
Hide file tree
Showing 20 changed files with 432 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CCJPaymentDetails;
import uk.gov.hmcts.reform.civil.model.citizenui.ClaimantLiPResponse;
import uk.gov.hmcts.reform.civil.service.DeadlinesCalculator;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import uk.gov.hmcts.reform.civil.service.JudgementService;
import uk.gov.hmcts.reform.civil.model.CaseData;
Expand Down Expand Up @@ -49,6 +50,7 @@ public class ClaimantResponseCuiCallbackHandler extends CallbackHandler {
private final ObjectMapper objectMapper;
private final Time time;
private final UpdateCaseManagementDetailsService updateCaseManagementLocationDetailsService;
private final DeadlinesCalculator deadlinesCalculator;

@Override
protected Map<String, Callback> callbacks() {
Expand Down Expand Up @@ -76,10 +78,12 @@ private CallbackResponse populateCaseData(CallbackParams callbackParams) {

private CallbackResponse aboutToSubmit(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
LocalDateTime applicant1ResponseDate = LocalDateTime.now();

CaseData.CaseDataBuilder<?, ?> builder = caseData.toBuilder()
.applicant1ResponseDate(LocalDateTime.now())
.businessProcess(BusinessProcess.ready(CLAIMANT_RESPONSE_CUI));
.applicant1ResponseDate(applicant1ResponseDate)
.businessProcess(BusinessProcess.ready(CLAIMANT_RESPONSE_CUI))
.respondent1RespondToSettlementAgreementDeadline(getRespondToSettlementAgreementDeadline(caseData, applicant1ResponseDate));

updateCaseManagementLocationDetailsService.updateCaseManagementDetails(builder, callbackParams);

Expand All @@ -98,6 +102,11 @@ private CallbackResponse aboutToSubmit(CallbackParams callbackParams) {
return response.build();
}

private LocalDateTime getRespondToSettlementAgreementDeadline(CaseData caseData, LocalDateTime responseDate) {
return caseData.hasApplicant1SignedSettlementAgreement()
? deadlinesCalculator.getRespondToSettlementAgreementDeadline(responseDate) : null;
}

private boolean isProceedsInHeritageSystemAllowed(CaseData caseData) {
ClaimantLiPResponse applicant1Response = Optional.ofNullable(caseData.getCaseDataLiP())
.map(CaseDataLiP::getApplicant1LiPResponse)
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/uk/gov/hmcts/reform/civil/model/CaseData.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ public boolean hasNoOngoingBusinessProcess() {
private final String claimAmountBreakupSummaryObject;
private final LocalDateTime respondent1LitigationFriendDate;
private final LocalDateTime respondent2LitigationFriendDate;
private final LocalDateTime respondent1RespondToSettlementAgreementDeadline;
private final String paymentTypePBA;
private final String paymentTypePBASpec;
private final String whenToBePaidText;
Expand Down Expand Up @@ -1137,6 +1138,16 @@ public String getRespondent1Email() {
return null;
}

@JsonIgnore
public boolean isRespondentRespondedToSettlementAgreement() {
return getCaseDataLiP() != null && getCaseDataLiP().getRespondentSignSettlementAgreement() != null;
}

@JsonIgnore
public boolean isRespondentSignedSettlementAgreement() {
return getCaseDataLiP() != null && YesOrNo.YES.equals(getCaseDataLiP().getRespondentSignSettlementAgreement());
}

@JsonIgnore
public List<ClaimAmountBreakupDetails> getClaimAmountBreakupDetails() {
return Optional.ofNullable(getClaimAmountBreakup())
Expand Down Expand Up @@ -1166,8 +1177,9 @@ public boolean hasApplicant1SignedSettlementAgreement() {
}

@JsonIgnore
public boolean isRespondentSignSettlementAgreement() {
return getCaseDataLiP() != null && getCaseDataLiP().getRespondentSignSettlementAgreement() != null;
public boolean isSettlementAgreementDeadlineExpired() {
return nonNull(respondent1RespondToSettlementAgreementDeadline)
&& LocalDateTime.now().isAfter(respondent1RespondToSettlementAgreementDeadline);
}

@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package uk.gov.hmcts.reform.civil.model.citizenui;

import lombok.AllArgsConstructor;
import uk.gov.hmcts.reform.civil.model.CaseData;

import java.util.Objects;

@AllArgsConstructor
public class CcdDashboardClaimMatcher {

protected CaseData caseData;

public boolean hasClaimantAndDefendantSignedSettlementAgreement() {
return caseData.hasApplicant1SignedSettlementAgreement() && caseData.isRespondentSignedSettlementAgreement() && !isSettled();
}

public boolean hasDefendantRejectedSettlementAgreement() {
return caseData.hasApplicant1SignedSettlementAgreement() && caseData.isRespondentRespondedToSettlementAgreement()
&& !caseData.isRespondentSignedSettlementAgreement() && !isSettled();
}

public boolean hasClaimantSignedSettlementAgreement() {
return caseData.hasApplicant1SignedSettlementAgreement() && !caseData.isSettlementAgreementDeadlineExpired() && !isSettled();
}

public boolean hasClaimantSignedSettlementAgreementAndDeadlineExpired() {
return caseData.hasApplicant1SignedSettlementAgreement() && caseData.isSettlementAgreementDeadlineExpired() && !isSettled();
}

public boolean isSettled() {
return !caseData.isRespondentResponseFullDefence()
&& (caseData.respondent1PaidInFull()
|| caseData.isResponseAcceptedByClaimant())
&& Objects.isNull(caseData.getCcjPaymentDetails())
&& !caseData.hasApplicantRejectedRepaymentPlan()
|| caseData.isPartAdmitClaimSettled();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.civil.model.citizenui;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import uk.gov.hmcts.reform.civil.enums.CaseState;
import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
Expand All @@ -17,13 +16,16 @@
import java.util.Optional;

@Slf4j
@AllArgsConstructor
public class CcdDashboardClaimantClaimMatcher implements Claim {
public class CcdDashboardClaimantClaimMatcher extends CcdDashboardClaimMatcher implements Claim {

private static final LocalTime FOUR_PM = LocalTime.of(16, 1, 0);
private CaseData caseData;
private FeatureToggleService featureToggleService;

public CcdDashboardClaimantClaimMatcher(CaseData caseData, FeatureToggleService featureToggleService) {
super(caseData);
this.featureToggleService = featureToggleService;
}

@Override
public boolean hasResponsePending() {
return caseData.getRespondent1ResponseDate() == null && !isPaperResponse();
Expand Down Expand Up @@ -86,16 +88,6 @@ public boolean claimantConfirmedDefendantPaid() {
return caseData.getRespondent1CourtOrderPayment() != null && caseData.respondent1PaidInFull();
}

@Override
public boolean isSettled() {
return !caseData.isRespondentResponseFullDefence()
&& (caseData.respondent1PaidInFull()
|| caseData.isResponseAcceptedByClaimant())
&& Objects.isNull(caseData.getCcjPaymentDetails())
&& !caseData.hasApplicantRejectedRepaymentPlan()
|| caseData.isPartAdmitClaimSettled();
}

@Override
public boolean isSentToCourt() {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.gov.hmcts.reform.civil.model.citizenui;

import lombok.AllArgsConstructor;
import java.time.LocalDate;
import java.time.LocalTime;
import lombok.extern.slf4j.Slf4j;
import uk.gov.hmcts.reform.civil.enums.CaseState;
import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
Expand All @@ -11,17 +12,18 @@
import uk.gov.hmcts.reform.civil.model.sdo.SmallClaimsHearing;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Objects;
import java.util.Optional;

@Slf4j
@AllArgsConstructor
public class CcdDashboardDefendantClaimMatcher implements Claim {
public class CcdDashboardDefendantClaimMatcher extends CcdDashboardClaimMatcher implements Claim {

public CcdDashboardDefendantClaimMatcher(CaseData caseData, FeatureToggleService featureToggleService) {
super(caseData);
this.featureToggleService = featureToggleService;
}

private static final LocalTime FOUR_PM = LocalTime.of(16, 1, 0);
private CaseData caseData;
private FeatureToggleService featureToggleService;

@Override
Expand Down Expand Up @@ -86,16 +88,6 @@ public boolean claimantConfirmedDefendantPaid() {
return caseData.getRespondent1CourtOrderPayment() != null && caseData.respondent1PaidInFull();
}

@Override
public boolean isSettled() {
return !caseData.isRespondentResponseFullDefence()
&& (caseData.respondent1PaidInFull()
|| caseData.isResponseAcceptedByClaimant())
&& Objects.isNull(caseData.getCcjPaymentDetails())
&& !caseData.hasApplicantRejectedRepaymentPlan()
|| caseData.isPartAdmitClaimSettled();
}

@Override
public boolean isSentToCourt() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public interface Claim {

boolean hasClaimantAskedToSignSettlementAgreement();

boolean hasClaimantAndDefendantSignedSettlementAgreement();

boolean hasDefendantRejectedSettlementAgreement();

boolean hasClaimantSignedSettlementAgreement();

boolean hasClaimantSignedSettlementAgreementAndDeadlineExpired();

boolean hasClaimantAcceptedPartialAdmissionAmount();

boolean haveBothPartiesSignedSettlementAgreement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ public enum DashboardClaimStatus {
TRANSFERRED(
Claim::isSentToCourt
),
CLAIMANT_AND_DEFENDANT_SIGNED_SETTLEMENT_AGREEMENT(
Claim::hasClaimantAndDefendantSignedSettlementAgreement
),
DEFENDANT_REJECTED_SETTLEMENT_AGREEMENT(
Claim::hasDefendantRejectedSettlementAgreement
),
CLAIMANT_SIGNED_SETTLEMENT_AGREEMENT_DEADLINE_EXPIRED(
Claim::hasClaimantSignedSettlementAgreementAndDeadlineExpired
),
CLAIMANT_SIGNED_SETTLEMENT_AGREEMENT(
Claim::hasClaimantSignedSettlementAgreement
),
SETTLED(
Claim::isSettled
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,8 @@ public LocalDate calculateWhenToBePaid(LocalDateTime responseDate) {
dateTime = dateTime.plusDays(daysToAdd);
return dateTime.toLocalDate();
}

public LocalDateTime getRespondToSettlementAgreementDeadline(LocalDateTime fromDateTime) {
return plusWorkingDays(fromDateTime.toLocalDate(), 7).atTime(END_OF_BUSINESS_DAY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ private FlowLipPredicate() {
CaseData::isCcjRequestJudgmentByAdmission;

public static final Predicate<CaseData> isRespondentSignSettlementAgreement =
CaseData::isRespondentSignSettlementAgreement;
CaseData::isRespondentRespondedToSettlementAgreement;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

import static java.util.Collections.emptyList;
import static java.util.Map.entry;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.DEFENDANT_SIGN_SETTLEMENT_AGREEMENT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.LIFT_BREATHING_SPACE_LIP;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.asyncStitchingComplete;
import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.ACKNOWLEDGEMENT_OF_SERVICE;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.ACKNOWLEDGE_CLAIM;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.ADD_CASE_NOTE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class ClaimantResponse {
private String paymentReceived;
private String settleForAmount;
private CourtDetermination courtDetermination;
private FormaliseOption formaliseOption;

@JsonIgnore
public boolean hasCourtDetermination() {
Expand Down
66 changes: 64 additions & 2 deletions src/main/java/uk/gov/hmcts/reform/cmc/model/CmcClaim.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import net.minidev.json.annotate.JsonIgnore;
import org.apache.commons.collections4.CollectionUtils;
import uk.gov.hmcts.reform.civil.model.citizenui.Claim;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

import static uk.gov.hmcts.reform.civil.model.citizenui.DtoFieldFormat.DATE_TIME_FORMAT;
import static uk.gov.hmcts.reform.civil.model.citizenui.DtoFieldFormat.DATE_FORMAT;

@Data
Expand Down Expand Up @@ -67,7 +70,7 @@ public class CmcClaim implements Claim {
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime createdAt;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_TIME_FORMAT)
@JsonFormat(shape = JsonFormat.Shape.STRING)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime reDeterminationRequestedAt;
Expand All @@ -76,10 +79,17 @@ public class CmcClaim implements Claim {
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate admissionPayImmediatelyPastPaymentDate;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_FORMAT)
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
private LocalDate intentionToProceedDeadline;

@JsonFormat(shape = JsonFormat.Shape.STRING)
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime claimantRespondedAt;

private ClaimantResponse claimantResponse;
private ClaimState state;
private ProceedOfflineReasonType proceedOfflineReason;
Expand Down Expand Up @@ -226,6 +236,41 @@ public boolean hasClaimantAskedToSignSettlementAgreement() {
return hasResponse() && settlement != null && settlement.isAcceptedByClaimant();
}

@Override
public boolean hasClaimantSignedSettlementAgreement() {
return hasClaimantSignedSettlementAgreementOfferAccepted() || hasClaimantSignedSettlementAgreementChosenByCourt();
}

private boolean hasClaimantSignedSettlementAgreementOfferAccepted() {
return Objects.nonNull(settlement) && settlement.isOfferAccepted() && isThroughAdmissions(settlement)
&& Objects.nonNull(claimantResponse) && !claimantResponse.hasCourtDetermination();
}

private boolean hasClaimantSignedSettlementAgreementChosenByCourt() {
return Objects.nonNull(settlement) && settlement.isOfferAccepted() && !settlement.isRejectedByDefendant() && isThroughAdmissions(settlement)
&& Objects.nonNull(claimantResponse) && claimantResponse.hasCourtDetermination();
}

@Override
public boolean hasClaimantSignedSettlementAgreementAndDeadlineExpired() {
return Objects.nonNull(settlement) && settlement.isOfferAccepted() && isThroughAdmissions(settlement)
&& Objects.nonNull(claimantRespondedAt) && claimantRespondedAt.plusDays(7).isBefore(LocalDateTime.now());
}

@Override
public boolean hasClaimantAndDefendantSignedSettlementAgreement() {
return Objects.nonNull(settlement) && !settlement.isRejectedByDefendant() && settlement.isSettled() && isThroughAdmissions(settlement);
}

@Override
public boolean hasDefendantRejectedSettlementAgreement() {
if (!Objects.nonNull(claimantResponse) || !ClaimantResponseType.ACCEPTATION.equals(claimantResponse.getType())) {
return false;
}
return claimantResponse.getFormaliseOption() == FormaliseOption.SETTLEMENT
&& Objects.nonNull(settlement) && settlement.isOfferRejected();
}

@Override
@JsonIgnore
public boolean hasClaimantAcceptedPartialAdmissionAmount() {
Expand Down Expand Up @@ -399,4 +444,21 @@ public boolean isPartialAdmissionRejected() {
public boolean isClaimantDefaultJudgement() {
return false;
}

private boolean isThroughAdmissions(Settlement settlement) {
List<PartyStatement> partyStatements = new ArrayList<>(settlement.getPartyStatements());
if (CollectionUtils.isEmpty(partyStatements) || !settlement.hasOffer()) {
return false;
}

//get the last offer
Collections.reverse(partyStatements);

return partyStatements.stream()
.filter(PartyStatement::hasOffer)
.findFirst()
.map(PartyStatement::getOffer)
.map(Offer::getPaymentIntention)
.isPresent();
}
}
Loading

0 comments on commit f1c52ba

Please sign in to comment.