Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-15766 Set Aside Judgment RPA #5889

Merged
merged 27 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
18fe619
CIV-15997 changes
kalachandrasekar1 Dec 2, 2024
4f8e130
Merge branch 'master' into feat/CIV-15997
kalachandrasekar1 Dec 2, 2024
be67c5d
CIV-15997-changes
kalachandrasekar1 Dec 2, 2024
2305a57
CIV-15997 changes
kalachandrasekar1 Dec 2, 2024
50a67a9
Merge branch 'master' into feat/CIV-15997
kalachandrasekar1 Dec 3, 2024
48f24b5
CIV-15997 validation message updated
kalachandrasekar1 Dec 3, 2024
a76aa50
Merge remote-tracking branch 'origin/feat/CIV-15997' into feat/CIV-15766
ShwetaTandel-hmcts Dec 4, 2024
d33a851
Initial Checkin
ShwetaTandel-hmcts Dec 10, 2024
97c36ef
Merge branch 'master' into feat/CIV-15766
ShwetaTandel-hmcts Dec 10, 2024
f881700
Merge branch 'master' into feat/CIV-15766
ShwetaTandel-hmcts Dec 10, 2024
7d895ca
changes
ShwetaTandel-hmcts Dec 10, 2024
fe820ec
Merge branch 'feat/CIV-15766' of https://github.com/hmcts/civil-servi…
ShwetaTandel-hmcts Dec 10, 2024
359b8f1
update
ShwetaTandel-hmcts Dec 10, 2024
1041622
Intermediate commit
ShwetaTandel-hmcts Dec 10, 2024
23ce423
fixes
ShwetaTandel-hmcts Dec 10, 2024
7133fc8
Merge branch 'master' into feat/CIV-15766
ShwetaTandel-hmcts Dec 10, 2024
e68735c
fix check style
ShwetaTandel-hmcts Dec 10, 2024
19d500c
Merge branch 'feat/CIV-15766' of https://github.com/hmcts/civil-servi…
ShwetaTandel-hmcts Dec 10, 2024
e195b01
changed test
ShwetaTandel-hmcts Dec 11, 2024
8940219
Merge branch 'master' into feat/CIV-15766
ShwetaTandel-hmcts Dec 11, 2024
ed1a9a1
Merge branch 'master' into feat/CIV-15766
ShwetaTandel-hmcts Dec 12, 2024
4d0ef31
fix
ShwetaTandel-hmcts Dec 12, 2024
841c82f
Merge branch 'master' into feat/CIV-15766
krishnanuthalapati Dec 13, 2024
81edc86
Merge branch 'master' into feat/CIV-15766
krishnanuthalapati Dec 16, 2024
c221129
Merge branch 'master' into feat/CIV-15766
Azam-Hmcts Dec 17, 2024
ef5f4a5
Merge branch 'master' into feat/CIV-15766
Azam-Hmcts Dec 17, 2024
0a61fff
Merge branch 'master' into feat/CIV-15766
Azam-Hmcts Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@
import uk.gov.hmcts.reform.civil.callback.CallbackHandler;
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.callback.CaseEvent;
import uk.gov.hmcts.reform.civil.enums.CaseState;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper;
import uk.gov.hmcts.reform.civil.helpers.judgmentsonline.SetAsideJudgmentOnlineMapper;
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentSetAsideOrderType;
import uk.gov.hmcts.reform.civil.service.DeadlinesCalculator;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_START;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
Expand All @@ -45,7 +43,6 @@ public class SetAsideJudgmentCallbackHandler extends CallbackHandler {
"Application date to set aside judgment must be on or before the date of the order setting aside judgment";
private static final String ERROR_MESSAGE_DEFENCE_DATE =
"Date the defence was received must be on or before the date of the order setting aside judgment";
private final DeadlinesCalculator deadlinesCalculator;

@Override
protected Map<String, Callback> callbacks() {
Expand Down Expand Up @@ -99,20 +96,11 @@ private CallbackResponse saveJudgmentDetails(CallbackParams callbackParams) {
setAsideJudgmentOnlineMapper.moveToHistoricJudgment(caseData);

CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();
caseDataBuilder.businessProcess(BusinessProcess.ready(SET_ASIDE_JUDGMENT));
String nextState;
if (Objects.nonNull(caseData.getJoSetAsideOrderType()) && caseData.getJoSetAsideOrderType().equals(
JudgmentSetAsideOrderType.ORDER_AFTER_APPLICATION)) {
nextState = CaseState.AWAITING_RESPONDENT_ACKNOWLEDGEMENT.name();
caseDataBuilder.respondent1ResponseDeadline(deadlinesCalculator.plus28DaysAt4pmDeadline(
caseData.getJoSetAsideOrderDate().atTime(0, 0)));
} else {
nextState = caseData.getCcdState().name();
}
caseDataBuilder.businessProcess(BusinessProcess.ready(SET_ASIDE_JUDGMENT))
.joSetAsideCreatedDate(LocalDateTime.now());

return AboutToStartOrSubmitCallbackResponse.builder()
.data(caseDataBuilder.build().toMap(objectMapper))
.state(nextState)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ public boolean hasNoOngoingBusinessProcess() {
private YesOrNo joShowRegisteredWithRTLOption;
private JudgmentDetails activeJudgment;
private List<Element<JudgmentDetails>> historicJudgment;
private LocalDateTime joSetAsideCreatedDate;

private String joDefendantName1;
private String joDefendantName2;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uk.gov.hmcts.reform.civil.model.judgmentonline;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum SetAsideApplicantTypeForRPA {
PROPER_OFFICER("PROPER OFFICER"),
PARTY_AGAINST("PARTY AGAINST");

private final String value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package uk.gov.hmcts.reform.civil.model.judgmentonline;

public enum SetAsideResultTypeForRPA {
GRANTED
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ public class EventDetails {
private LocalDateTime dateOfJudgment;
private Boolean jointJudgment;
private Boolean judgmentToBeRegistered;
//Set Aside Judgment
private String result;
private String applicant;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate applicationDate;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate resultDate;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate datePaidInFull;
private String status;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate notificationReceiptDate;

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class EventHistory {
private List<Event> interlocutoryJudgment;
@Singular("defaultJudgment")
private List<Event> defaultJudgment;
@Singular("setAsideJudgment")
private List<Event> setAsideJudgment;
@Singular("statesPaid")
private List<Event> statesPaid;
@Singular("judgmentByAdmission")
Expand Down Expand Up @@ -73,6 +75,7 @@ public List<Event> flatEvents() {
breathingSpaceMentalHealthLifted,
interlocutoryJudgment,
defaultJudgment,
setAsideJudgment,
statesPaid,
judgmentByAdmission,
generalFormOfApplication,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public enum EventType {
INTENTION_TO_PROCEED_STATES_PAID("67"),
INTERLOCUTORY_JUDGMENT_GRANTED("252"),
DEFAULT_JUDGMENT_GRANTED("230"),
SET_ASIDE_JUDGMENT("170"),
JUDGEMENT_BY_ADMISSION("240"),
GENERAL_FORM_OF_APPLICATION("136"),
DEFENCE_STRUCK_OUT("57"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
import uk.gov.hmcts.reform.civil.model.dq.Respondent2DQ;
import uk.gov.hmcts.reform.civil.model.genapplication.GeneralApplication;
import uk.gov.hmcts.reform.civil.model.genapplication.GeneralApplicationsDetails;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentSetAsideOrderType;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentSetAsideReason;
import uk.gov.hmcts.reform.civil.model.judgmentonline.SetAsideApplicantTypeForRPA;
import uk.gov.hmcts.reform.civil.model.judgmentonline.SetAsideResultTypeForRPA;
import uk.gov.hmcts.reform.civil.model.robotics.Event;
import uk.gov.hmcts.reform.civil.model.robotics.EventDetails;
import uk.gov.hmcts.reform.civil.model.robotics.EventHistory;
Expand Down Expand Up @@ -95,6 +99,7 @@
import static uk.gov.hmcts.reform.civil.model.robotics.EventType.MISCELLANEOUS;
import static uk.gov.hmcts.reform.civil.model.robotics.EventType.RECEIPT_OF_ADMISSION;
import static uk.gov.hmcts.reform.civil.model.robotics.EventType.RECEIPT_OF_PART_ADMISSION;
import static uk.gov.hmcts.reform.civil.model.robotics.EventType.SET_ASIDE_JUDGMENT;
import static uk.gov.hmcts.reform.civil.model.robotics.EventType.STATES_PAID;
import static uk.gov.hmcts.reform.civil.service.robotics.utils.RoboticsDataUtil.APPLICANT2_ID;
import static uk.gov.hmcts.reform.civil.service.robotics.utils.RoboticsDataUtil.APPLICANT_ID;
Expand Down Expand Up @@ -286,6 +291,7 @@ public EventHistory buildEvents(CaseData caseData, String authToken) {
buildInformAgreedExtensionDateForSpec(builder, caseData);
buildClaimTakenOfflineAfterDJ(builder, caseData);
buildCcjEvent(builder, caseData);
buildSetAsideJudgment(builder, caseData);
buildCoscEvent(builder, caseData);
return eventHistorySequencer.sortEvents(builder.build());
}
Expand Down Expand Up @@ -547,6 +553,52 @@ private void buildCcjEvent(EventHistory.EventHistoryBuilder builder, CaseData ca
}
}

private void buildSetAsideJudgment(EventHistory.EventHistoryBuilder builder, CaseData caseData) {
if (featureToggleService.isJOLiveFeedActive() && caseData.getJoSetAsideReason() != null) {
List<Event> events = new ArrayList<>();
events.add(buildSetAsideJudgmentEvent(builder, caseData, RESPONDENT_ID));
if (null != caseData.getRespondent2()) {
events.add(buildSetAsideJudgmentEvent(builder, caseData, RESPONDENT2_ID));
}
builder.setAsideJudgment(events);
}
}

private Event buildSetAsideJudgmentEvent(EventHistory.EventHistoryBuilder builder, CaseData caseData, String litigiousPartyID) {
return Event.builder()
.eventSequence(prepareEventSequence(builder.build()))
.litigiousPartyID(litigiousPartyID)
.eventCode(SET_ASIDE_JUDGMENT.getCode())
.dateReceived(caseData.getJoSetAsideCreatedDate())
.eventDetails(getSetAsideEventDetails(caseData))
.eventDetailsText("")
.build();
}

private EventDetails getSetAsideEventDetails(CaseData caseData) {
String applicant = null;
LocalDate appDate = null;
LocalDate resultDate = null;
if (JudgmentSetAsideReason.JUDGE_ORDER.equals(caseData.getJoSetAsideReason())) {
if (JudgmentSetAsideOrderType.ORDER_AFTER_APPLICATION.equals(caseData.getJoSetAsideOrderType())) {
appDate = caseData.getJoSetAsideApplicationDate();
} else if (JudgmentSetAsideOrderType.ORDER_AFTER_DEFENCE.equals(caseData.getJoSetAsideOrderType())) {
appDate = caseData.getJoSetAsideDefenceReceivedDate();
}
applicant = SetAsideApplicantTypeForRPA.PARTY_AGAINST.getValue();
resultDate = caseData.getJoSetAsideOrderDate();

} else if (JudgmentSetAsideReason.JUDGMENT_ERROR.equals(caseData.getJoSetAsideReason())) {
applicant = SetAsideApplicantTypeForRPA.PROPER_OFFICER.getValue();
}
return EventDetails.builder()
.result(SetAsideResultTypeForRPA.GRANTED.name())
.applicant(applicant)
.applicationDate(appDate)
.resultDate(resultDate)
.build();
}

private void buildJudgmentByAdmissionEventDetails(EventHistory.EventHistoryBuilder builder, CaseData caseData) {
boolean isResponsePayByInstallment = caseData.isPayByInstallment();
Optional<RepaymentPlanLRspec> repaymentPlan = Optional.ofNullable(caseData.getRespondent1RepaymentPlan());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ private EventHistory prepareEventHistory(List<Event> events) {
case DEFENCE_STRUCK_OUT:
builder.defenceStruckOut(event);
break;
case SET_ASIDE_JUDGMENT:
builder.setAsideJudgment(event);
break;
case CERTIFICATE_OF_SATISFACTION_OR_CANCELLATION:
builder.certificateOfSatisfactionOrCancellation(event);
break;

default:
throw new IllegalStateException("Unexpected event type: " + eventType);
}
Expand Down Expand Up @@ -165,6 +167,9 @@ private EventHistory prepareEventHistory(List<Event> events) {
if (isEmpty(builder.build().getDefenceStruckOut())) {
builder.defenceStruckOut(List.of(Event.builder().build()));
}
if (isEmpty(builder.build().getSetAsideJudgment())) {
builder.setAsideJudgment(List.of(Event.builder().build()));
}
if (isEmpty(builder.build().getCertificateOfSatisfactionOrCancellation())) {
builder.certificateOfSatisfactionOrCancellation(List.of(Event.builder().build()));
}
Expand Down Expand Up @@ -201,6 +206,7 @@ private List<Event> flatEvents(EventHistory eventHistory) {
eventHistory.getBreathingSpaceMentalHealthLifted(),
eventHistory.getInterlocutoryJudgment(),
eventHistory.getDefaultJudgment(),
eventHistory.getSetAsideJudgment(),
eventHistory.getJudgmentByAdmission(),
eventHistory.getGeneralFormOfApplication(),
eventHistory.getDefenceStruckOut(),
Expand Down
106 changes: 106 additions & 0 deletions src/main/resources/schema/rpa-json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
"breathingSpaceMentalHealthLifted",
"interlocutoryJudgment",
"defaultJudgment",
"setAsideJudgment",
"judgmentByAdmission",
"generalFormOfApplication",
"defenceStruckOut",
Expand Down Expand Up @@ -547,6 +548,18 @@
],
"description": ""
},
"setAsideJudgment": {
"$id": "#/properties/events/properties/setAsideJudgment",
"anyOf": [
{
"$ref": "#/definitions/setAsideJudgmentEventType"
},
{
"$ref": "#/definitions/nullEventType"
}
],
"description": ""
},
"judgmentByAdmission": {
"$id": "#/properties/events/properties/judgmentByAdmission",
"anyOf": [
Expand Down Expand Up @@ -2017,6 +2030,99 @@
"additionalProperties": false
}
},
"setAsideJudgmentEventType": {
"$id": "#/definitions/setAsideJudgmentEventType",
"type": "array",
"additionalItems": false,
"items": {
"$id": "#/definitions/setAsideJudgmentEventType/items",
"type": "object",
"required": [
"eventSequence",
"eventCode",
"litigiousPartyID",
"dateReceived",
"eventDetails",
"eventDetailsText"
],
"properties": {
"eventSequence": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventSequence",
"$ref": "#/definitions/eventSequenceType"
},
"eventCode": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventCode",
"type": "string",
"const": "170",
"description": "The CASEMAN code for the setAsideJudgmentEventType event."
},
"dateReceived": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/dateReceived",
"$ref": "#/definitions/formatDate",
"description": ""
},
"litigiousPartyID": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/litigiousPartyID",
"$ref": "#/definitions/litigiousPartyIDType",
"description": ""
},
"eventDetails": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetails",
"type": [
"object",
"null"
],
"properties": {
"applicant": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetails/properties/applicant",
"type": [
"string",
"null"
],
"maxLength": 250,
"description": ""
},
"result": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetails/properties/result",
"type": [
"string",
"null"
],
"maxLength": 250,
"description": ""
},
"resultDate": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetails/properties/resultDate",
"$ref": "#/definitions/formatDateOrNull",
"description": ""
},
"applicationDate": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetails/properties/applicationDate",
"$ref": "#/definitions/formatDateOrNull",
"description": ""
},
"miscText": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetails/properties/miscText",
"type": "string",
"maxLength": 250,
"description": "The text for the miscellaneous event can contain any supporting explanatory text."
}
},
"additionalProperties": false
},
"eventDetailsText": {
"$id": "#/definitions/setAsideJudgmentEventType/items/properties/eventDetailsText",
"type": [
"string",
"null"
],
"maxLength": 250,
"description": ""
}
},
"additionalProperties": false
}
},
"judgmentByAdmissionEventType": {
"$id": "#/definitions/judgmentByAdmissionEventType",
"type": "array",
Expand Down
Loading
Loading