Skip to content

Commit

Permalink
CIV-477 Update Claimant & Defendant appropriately when Claimant disag…
Browse files Browse the repository at this point in the history
…rees Mediation (#2773)

* add ocon9X response util

* add comment for paper response

* add bulk print changes

* add defendant notification service

* document ready to print changes

* add docmosis template

* add template

* paper form responded at update

* add paper form issue to claim mapper

* code clean up

* fix tests

* code clean up

* remove enableManagers

* fix checkstyle

* fix tests

* update service and fix checkstyle

* add more tests

* fix checkstyle

* fix tests and checkstyle

* fix conflict

Feat/civ 4541 (#2661)

* update ccd with page increment and cron exp.

* fix params and import

* update yml file

* update Resource reader

* add tests for CoreCaseDataService

* checkstyle

* non-null contraints

* enhance null checks

* remove un-used imports

* more null checks

* update null checks

update ccd with page increment and cron exp.

fix params and import

update yml file

update Resource reader

add tests for CoreCaseDataService

checkstyle

non-null contraints

enhance null checks

remove un-used imports

* amend constraint

* fix page increment

* fix cron exp.

* rebase branch

* add supression

* update schedule

* update charts

* add larger page process capacity

* add larger page process capacity

* update chart

* add supression

* Update suppressions.xml

* update master and add necessary changes

* update cron exp

---------

Co-authored-by: mounikahmcts <43175082+mounikahmcts@users.noreply.github.com>
Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com>
Co-authored-by: kdaHMCTS <128375235+kdaHMCTS@users.noreply.github.com>

add more tests

sonar

bypass launch darkly for testing

Update Renovate Config (#2775)

Feat/civ 4541 (#2661)

* update ccd with page increment and cron exp.

* fix params and import

* update yml file

* update Resource reader

* add tests for CoreCaseDataService

* checkstyle

* non-null contraints

* enhance null checks

* remove un-used imports

* more null checks

* update null checks

update ccd with page increment and cron exp.

fix params and import

update yml file

update Resource reader

add tests for CoreCaseDataService

checkstyle

non-null contraints

enhance null checks

remove un-used imports

* amend constraint

* fix page increment

* fix cron exp.

* rebase branch

* add supression

* update schedule

* update charts

* add larger page process capacity

* add larger page process capacity

* update chart

* add supression

* Update suppressions.xml

* update master and add necessary changes

* update cron exp

---------

Co-authored-by: mounikahmcts <43175082+mounikahmcts@users.noreply.github.com>
Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com>
Co-authored-by: kdaHMCTS <128375235+kdaHMCTS@users.noreply.github.com>

revert back

* udpate claimant response

---------

Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com>
  • Loading branch information
zikrurR and mfallonhmcts authored Oct 16, 2023
1 parent ab012d4 commit 535f3a5
Show file tree
Hide file tree
Showing 25 changed files with 621 additions and 20 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ sonarqube {
"**/ValidExpenseConstraintValidator.java",
"**/ValidResidenceConstraintValidator.java",
"**/PaperResponseFullDefenceCallbackHandler.java",
"**/OCON9xResponseUtil.java",
"**/ResponseUtils.java",
"**/cmc/claimstore/services/ccd/callbacks/roboticssupport/RoboticsNotificationServiceImpl.java"
].join(",")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
import static uk.gov.hmcts.cmc.ccd.assertion.Assertions.assertThat;
import static uk.gov.hmcts.cmc.ccd.domain.CCDYesNoOption.NO;
import static uk.gov.hmcts.cmc.ccd.domain.CCDYesNoOption.YES;
import static uk.gov.hmcts.cmc.ccd.domain.claimantresponse.CCDFormaliseOption.CCJ;

Expand Down Expand Up @@ -174,7 +173,7 @@ public void shouldThrowExceptionWhenAttemptingToMapNullClaimantResponse() {

@Test
public void shouldMapCCDResponseRejectionToResponseRejection() {
CCDResponseRejection ccdResponse = SampleData.getResponseRejection();
CCDResponseRejection ccdResponse = SampleData.getResponseRejectionWithPaymentReceived();
Claim.ClaimBuilder claimBuilder = Claim.builder();

mapper.from(ccdResponse, claimBuilder);
Expand Down Expand Up @@ -222,11 +221,7 @@ public void shouldMapCCDResponseAcceptationForSettlePreJudgementToResponseAccept

@Test
public void shouldMapCCDResponseRejectionForRejectSettlePreJudgementToResponseRejection() {
CCDResponseRejection ccdResponse = CCDResponseRejection.builder()
.settleForAmount(NO)
.paymentReceived(YES)
.submittedOn(now())
.build();
CCDResponseRejection ccdResponse = SampleData.getResponseRejectionWithPaymentReceived();
Claim.ClaimBuilder claimBuilder = Claim.builder();

mapper.from(ccdResponse, claimBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ public static CCDResponseRejection getResponseRejection() {
.build();
}

public static CCDResponseRejection getResponseRejectionWithPaymentReceived() {
return CCDResponseRejection.builder()
.amountPaid(AMOUNT)
.paymentReceived(YES)
.submittedOn(LocalDateTimeFactory.nowInLocalZone())
.freeMediationOption(YES)
.mediationPhoneNumber(CCDTelephone.builder().telephoneNumber("07999999999").build())
.mediationContactPerson("Mediation Contact Person")
.noMediationReason("Not interested")
.reason("Rejection Reason")
.build();
}

public static CCDCourtDetermination getCCDCourtDetermination() {
return CCDCourtDetermination.builder()
.rejectionReason("Rejection reason")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class Claim {
private LocalDateTime lastModified;
private String lastEventTriggeredForHwfCase;
private LocalDate paperFormServedDate;
private LocalDate paperFormIssueDate;
private final LocalDate paperFormIssueDate;

@SuppressWarnings("squid:S00107") // Not sure there's a lot fo be done about removing parameters here
@Builder(toBuilder = true)
Expand Down Expand Up @@ -127,7 +127,7 @@ public Claim(
ClaimDocumentCollection claimDocumentCollection,
LocalDate claimantResponseDeadline,
ClaimState state,
ClaimSubmissionOperationIndicators claimSubmissionOperationIndicators,
ClaimSubmissionOperationIndicators claimSubmissionOperationIndicators,
Long ccdCaseId,
ReviewOrder reviewOrder,
DirectionOrder directionOrder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum ClaimDocumentType {
PAPER_RESPONSE_COUNTER_CLAIM,
GENERAL_LETTER,
OTHER,
CORRESPONDENCE;
CORRESPONDENCE,
CLAIMANT_MEDIATION_REFUSED;

private final List<String> values;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public enum PrintRequestType {
LEGAL_ORDER,
GENERAL_LETTER,
BULK_PRINT_TRANSFER,
PAPER_DEFENCE_TYPE
PAPER_DEFENCE_TYPE,
CLAIMANT_MEDIATION_REFUSED
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public abstract class ClaimantResponse {

protected final YesNoOption paymentReceived;

protected final YesNoOption freeMediation;

protected final YesNoOption settleForAmount;

public Optional<BigDecimal> getAmountPaid() {
Expand All @@ -46,6 +48,10 @@ public Optional<YesNoOption> getSettleForAmount() {
return Optional.ofNullable(settleForAmount);
}

public Optional<YesNoOption> getFreeMediation() {
return Optional.ofNullable(freeMediation);
}

@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ourStyle());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ public class ResponseAcceptation extends ClaimantResponse {
public ResponseAcceptation(
BigDecimal amountPaid,
YesNoOption paymentReceived,
YesNoOption freeMediation,
YesNoOption settleForAmount,
CourtDetermination courtDetermination,
PaymentIntention claimantPaymentIntention,
FormaliseOption formaliseOption
) {
super(ClaimantResponseType.ACCEPTATION, amountPaid, paymentReceived, settleForAmount);
super(ClaimantResponseType.ACCEPTATION, amountPaid, paymentReceived, freeMediation, settleForAmount);
this.courtDetermination = courtDetermination;
this.claimantPaymentIntention = claimantPaymentIntention;
this.formaliseOption = formaliseOption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class ResponseRejection extends ClaimantResponse {
@Size(max = 99000)
private final String reason;

private ClaimantResponseType claimantResponseType;

@Valid
private final DirectionsQuestionnaire directionsQuestionnaire;

Expand All @@ -47,15 +49,17 @@ public ResponseRejection(
String mediationContactPerson,
String noMediationReason,
String reason,
DirectionsQuestionnaire directionsQuestionnaire
DirectionsQuestionnaire directionsQuestionnaire,
ClaimantResponseType claimantResponseType
) {
super(ClaimantResponseType.REJECTION, amountPaid, paymentReceived, settleForAmount);
super(ClaimantResponseType.REJECTION, amountPaid, freeMediation, paymentReceived, settleForAmount);
this.freeMediation = freeMediation;
this.mediationPhoneNumber = mediationPhoneNumber;
this.mediationContactPerson = mediationContactPerson;
this.noMediationReason = noMediationReason;
this.reason = reason;
this.directionsQuestionnaire = directionsQuestionnaire;
this.claimantResponseType = claimantResponseType;
}

public Optional<YesNoOption> getFreeMediation() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package uk.gov.hmcts.cmc.domain.utils;

import uk.gov.hmcts.cmc.domain.models.Claim;
import uk.gov.hmcts.cmc.domain.models.claimantresponse.ClaimantResponse;
import uk.gov.hmcts.cmc.domain.models.claimantresponse.ClaimantResponseType;
import uk.gov.hmcts.cmc.domain.models.response.Response;
import uk.gov.hmcts.cmc.domain.models.response.ResponseType;
import uk.gov.hmcts.cmc.domain.models.response.YesNoOption;

import java.util.function.Predicate;

public class OCON9xResponseUtil {

private OCON9xResponseUtil(){
// NO-OP
}

private static final Predicate<Claim> FULL_DEFENCE_RESPONSE = claim -> claim.getResponse()
.map(Response::getResponseType)
.filter(ResponseType.FULL_DEFENCE::equals)
.isPresent();

private static final Predicate<Claim> DEFENDANT_MEDIATION = claim -> claim.getResponse()
.flatMap(Response::getFreeMediation)
.filter(YesNoOption.YES::equals)
.isPresent();

private static final Predicate<Claim> CLAIMANT_REJECTION = claim -> claim.getClaimantResponse()
.map(ClaimantResponse::getType)
.filter(ClaimantResponseType.REJECTION::equals)
.isPresent();

private static final Predicate<Claim> CLAIMANT_MEDIATION_REJECTION = claim -> claim.getClaimantResponse()
.flatMap(ClaimantResponse::getFreeMediation)
.filter(YesNoOption.NO::equals)
.isPresent();

private static final Predicate<Claim> IS_PAPER_DEFENCE_FORM_ISSUED = claim -> claim.getPaperFormIssueDate() != null;

public static boolean defendantFullDefenceMediationOCON9x(Claim claim) {

return
FULL_DEFENCE_RESPONSE.test(claim)
&& DEFENDANT_MEDIATION.test(claim)
&& CLAIMANT_REJECTION.test(claim)
&& CLAIMANT_MEDIATION_REJECTION.test(claim)
&& IS_PAPER_DEFENCE_FORM_ISSUED.test(claim);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public static boolean isFullDefenceDisputeAndNoMediation(Response response) {
.getDefenceType().equals(DefenceType.DISPUTE);
}

public static boolean isFullDefenceDisputeAndWithMediation(Response response) {
return hasDefendantOptedForMediation(response) && ((FullDefenceResponse) response)
.getDefenceType().equals(DefenceType.DISPUTE);
}

public static boolean isFullDefenceAndNoMediation(Response response) {
return isFullDefence(response) && !hasDefendantOptedForMediation(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public final class SampleClaim {
public static final String EXTERNAL_ID = RAND_UUID.toString();
public static final boolean NOT_REQUESTED_FOR_MORE_TIME = false;
public static final LocalDateTime NOT_RESPONDED = null;
public static final LocalDate CURRENT_TIME = LocalDate.now();
public static final String SUBMITTER_EMAIL = "claimant@mail.com";
public static final String DEFENDANT_EMAIL = SampleTheirDetails.DEFENDANT_EMAIL;
public static final String DEFENDANT_EMAIL_VERIFIED = "defendant@mail.com";
Expand All @@ -95,6 +96,7 @@ public final class SampleClaim {
private String submitterEmail = SUBMITTER_EMAIL;
private LocalDateTime createdAt = NOW_IN_LOCAL_ZONE;
private LocalDateTime respondedAt = NOT_RESPONDED;
private LocalDate paperFormIssueDate = CURRENT_TIME;
private LocalDate issuedOn = ISSUE_DATE;
private LocalDate serviceDate = ISSUE_DATE;
private CountyCourtJudgment countyCourtJudgment = null;
Expand Down Expand Up @@ -681,6 +683,33 @@ public static Claim getWithCCJRequestDocument() {
.build();
}

public static Claim getSampleClaimantMediationRefusal() {
var test = builder()
.withClaimData(SampleClaimData.submittedByClaimantBuilder().withExternalId(RAND_UUID).build())
.withCountyCourtJudgment(
SampleCountyCourtJudgment.builder()
.ccjType(CountyCourtJudgmentType.ADMISSIONS)
.paymentOption(IMMEDIATELY)
.build()
).withResponse(SampleResponse.FullDefence
.builder()
.withDefenceType(DefenceType.DISPUTE)
.withMediation(YES)
.build()
).withClaimantResponse(SampleClaimantResponse
.validClaimantRejectionWithDefendantHasOCON9x()
)
.withRespondedAt(LocalDateTime.now())
.withIssuedPaperFormIssueDate(LocalDate.now())
.withDefendantEmail(DEFENDANT_EMAIL)
.withClaimantRespondedAt(LocalDateTime.now())
.withClaimantResponse(SampleClaimantResponse.validDefaultRejection())
.withState(ClaimState.OPEN)
.build();

return test;
}

public static Claim getWithSettlementAgreementDocument() {
return builder().withSettlement(
SampleSettlement.validDefaults())
Expand Down Expand Up @@ -750,7 +779,7 @@ public Claim build() {
LocalDateTime.now(),
lastEventTriggeredForHwfCase,
null,
null
paperFormIssueDate
);
}

Expand Down Expand Up @@ -844,6 +873,11 @@ public SampleClaim withRespondedAt(LocalDateTime respondedAt) {
return this;
}

public SampleClaim withIssuedPaperFormIssueDate(LocalDate paperFormIssueDate) {
this.paperFormIssueDate = paperFormIssueDate;
return this;
}

public SampleClaim withResponse(Response response) {
this.response = response;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.gov.hmcts.cmc.domain.models.sampledata;

import uk.gov.hmcts.cmc.domain.models.claimantresponse.ClaimantResponse;
import uk.gov.hmcts.cmc.domain.models.claimantresponse.ClaimantResponseType;
import uk.gov.hmcts.cmc.domain.models.claimantresponse.FormaliseOption;
import uk.gov.hmcts.cmc.domain.models.claimantresponse.ResponseAcceptation;
import uk.gov.hmcts.cmc.domain.models.claimantresponse.ResponseRejection;
Expand Down Expand Up @@ -36,6 +37,14 @@ public static ResponseRejection validRejectionWithDirectionsQuestionnaire() {
return ClaimantResponseRejection.builder().buildRejectionWithDirectionsQuestionnaire();
}

public static ResponseRejection validClaimantRejectionWithDefendantHasOCON9x() {
return ClaimantResponseRejection.builder().buildRejectionWithByClaimantAndDefendantHasFormIssued();
}

public static ResponseRejection validRejectionWithRejectedFreeMediationOCON9x() {
return ClaimantResponseRejection.builder().buildRejectionWithFreeMediationRejectionOCON9x();
}

public static class ClaimantResponseAcceptation extends SampleClaimantResponse {

private BigDecimal amountPaid = TEN;
Expand Down Expand Up @@ -179,6 +188,13 @@ public ResponseRejection buildRejectionWithFreeMediation() {
.build();
}

public ResponseRejection buildRejectionWithFreeMediationRejectionOCON9x() {
return ResponseRejection.builder()
.freeMediation(NO)
.claimantResponseType(ClaimantResponseType.REJECTION)
.build();
}

public ResponseRejection buildRejectionWithDirectionsQuestionnaire() {
return ResponseRejection.builder()
.amountPaid(TEN)
Expand All @@ -192,6 +208,13 @@ public ResponseRejection buildRejectionWithDirectionsQuestionnaire() {
.build())
.build();
}

public ResponseRejection buildRejectionWithByClaimantAndDefendantHasFormIssued() {
return ResponseRejection.builder()
.amountPaid(TEN)
.freeMediation(NO)
.build();
}
}

public abstract ClaimantResponse build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@

import static java.util.Objects.requireNonNull;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildCoverSheetFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildDefendantLetterClaimantMediationRefusedFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildDefendantLetterFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildDirectionsOrderFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildLetterFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildOcon9FormFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildOconFormFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildPaperDefenceCoverLetterFileBaseName;
import static uk.gov.hmcts.cmc.claimstore.utils.DocumentNameUtils.buildSealedClaimFileBaseName;
import static uk.gov.hmcts.cmc.domain.utils.OCON9xResponseUtil.defendantFullDefenceMediationOCON9x;

@Component
@ConditionalOnProperty(prefix = "send-letter", name = "url")
Expand Down Expand Up @@ -81,6 +83,26 @@ public BulkPrintDetails print(DocumentReadyToPrintEvent event) {
return bulkPrintDetails;
}

public BulkPrintDetails printClaimantMediationRefusedLetter(Claim claim, String authorisation, Document document) {
requireNonNull(authorisation);
requireNonNull(claim);
requireNonNull(document);

BulkPrintDetails bulkPrintDetails = null;
if (defendantFullDefenceMediationOCON9x(claim)) {
bulkPrintDetails = bulkPrintService.printPdf(claim, List.of(
new PrintablePdf(
document,
buildDefendantLetterClaimantMediationRefusedFileBaseName(
claim.getReferenceNumber()))
),
BulkPrintRequestType.CLAIMANT_MEDIATION_REFUSED_TYPE,
authorisation,
CaseDataExtractorUtils.getDefendant(claim));
}
return bulkPrintDetails;
}

public BulkPrintDetails printDirectionOrder(Claim claim, Document coverSheet,
Document directionsOrder, String authorisation) {
requireNonNull(claim);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public enum BulkPrintRequestType {
PrintRequestType.BULK_PRINT_TRANSFER),
PAPER_DEFENCE_TYPE("paper-defence-pack",
"paper-defence-pack letter {} created for letter type {} claim reference {}",
PrintRequestType.PAPER_DEFENCE_TYPE);
PrintRequestType.PAPER_DEFENCE_TYPE),
CLAIMANT_MEDIATION_REFUSED_TYPE("mediation-refused-pack",
"mediation-refused-pack letter {} created for letter type {} claim reference {}",
PrintRequestType.CLAIMANT_MEDIATION_REFUSED);

String value;
String logInfo;
Expand Down
Loading

0 comments on commit 535f3a5

Please sign in to comment.