Skip to content

Commit

Permalink
CIV-13889 status change when with sdo (#4818)
Browse files Browse the repository at this point in the history
* add missing part of tasklist

* fix issue when both parties upload documents

* add unit tests

* add unit tests

* fixing checkstyle

* fixing integration test
  • Loading branch information
LeonardoPalmeiro authored Jun 7, 2024
1 parent 023f400 commit 45b087f
Show file tree
Hide file tree
Showing 11 changed files with 287 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ public static List<TaskList> getUploadMediationTaskListMock(String role, String
return List.of(
TaskList.builder()
.reference(reference)
.taskNameCy("<a href={UPLOAD_MEDIATION_DOCUMENTS} class=\"govuk-link\">Upload mediation documents</a>")
.taskNameCy("<a href={UPLOAD_MEDIATION_DOCUMENTS} class=\"govuk-link\">Uwchlwytho dogfennau cyfryngu</a>")
.taskNameEn("<a href={UPLOAD_MEDIATION_DOCUMENTS} class=\"govuk-link\">Upload mediation documents</a>")
.categoryCy("Mediation")
.categoryCy("Cyfryngu")
.categoryEn("Mediation")
.role(role)
.currentStatusEn(TaskStatus.IN_PROGRESS.getName())
Expand All @@ -217,9 +217,9 @@ public static List<TaskList> getUploadMediationTaskListMock(String role, String
.build(),
TaskList.builder()
.reference(reference)
.taskNameCy("<a href={VIEW_MEDIATION_DOCUMENTS} class=\"govuk-link\">View mediation documents</a>")
.taskNameCy("<a href={VIEW_MEDIATION_DOCUMENTS} class=\"govuk-link\">Gweld dogfennau cyfryngu</a>")
.taskNameEn("<a href={VIEW_MEDIATION_DOCUMENTS} class=\"govuk-link\">View mediation documents</a>")
.categoryCy("Mediation")
.categoryCy("Cyfryngu")
.categoryEn("Mediation")
.role(role)
.currentStatusEn(TaskStatus.AVAILABLE.getName())
Expand Down Expand Up @@ -328,9 +328,9 @@ public static List<TaskList> getUploadMediationTaskListViewMediationAvailableMoc
return List.of(
TaskList.builder()
.reference(reference)
.taskNameCy("<a href={VIEW_MEDIATION_DOCUMENTS} class=\"govuk-link\">View mediation documents</a>")
.taskNameCy("<a href={VIEW_MEDIATION_DOCUMENTS} class=\"govuk-link\">Gweld dogfennau cyfryngu</a>")
.taskNameEn("<a href={VIEW_MEDIATION_DOCUMENTS} class=\"govuk-link\">View mediation documents</a>")
.categoryCy("Mediation")
.categoryCy("Cyfryngu")
.categoryEn("Mediation")
.role(role)
.currentStatusEn(TaskStatus.AVAILABLE.getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ public enum DashboardScenarios {
SCENARIO_AAA6_BUNDLE_CREATED_CLAIMANT("Scenario.AAA6.CP.Bundle.Ready.Claimant"),
SCENARIO_AAA6_BUNDLE_CREATED_DEFENDANT("Scenario.AAA6.CP.Bundle.Ready.Defendant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM("Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Claimant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_WITHOUT_UPLOAD_FILES_CARM("Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_CARM("Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Defendant"),
SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_WITHOUT_UPLOAD_FILES_CARM("Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Defendant"),
SCENARIO_AAA6_HEARING_FEE_PAID_CLAIMANT("Scenario.AAA6.CP.HearingFee.Paid.Claimant"),
SCENARIO_AAA6_HEARING_FEE_HWF_INVALID_REF("Scenario.AAA6.CP.HearingFee.HWF.InvalidRef"),
SCENARIO_AAA6_HEARING_FEE_HWF_INFO_REQUIRED("Scenario.AAA6.CP.HearingFee.HWF.InfoRequired"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN;
import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_DJ_SDO_CLAIMANT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_SDO_CLAIMANT;
Expand All @@ -28,6 +29,7 @@
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_ORDER_MADE_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_SDO_MADE_BY_LA_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_WITHOUT_UPLOAD_FILES_CARM;
import static uk.gov.hmcts.reform.civil.utils.MediationUtils.findMediationUnsuccessfulReason;

@Service
Expand Down Expand Up @@ -96,14 +98,27 @@ && isEligibleForReconsideration(caseData)) {
&& isMediationUnsuccessfulReasonEqualToNotContactableClaimantOne(caseData)
&& isSDOEvent(callbackParams)
&& hasTrackChanged(caseData)) {
return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM.getScenario();

if (hasUploadDocuments(caseData)) {
return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM.getScenario();
} else {
return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_WITHOUT_UPLOAD_FILES_CARM.getScenario();
}

}
if (isSDODrawnPreCPRelease()) {
return SCENARIO_AAA6_CLAIMANT_SDO_DRAWN_PRE_CASE_PROGRESSION.getScenario();
}
return SCENARIO_AAA6_CP_ORDER_MADE_CLAIMANT.getScenario();
}

private boolean hasUploadDocuments(CaseData caseData) {
return !(isNull(caseData.getApp1MediationDocumentsReferred())
&& isNull(caseData.getApp1MediationNonAttendanceDocs())
&& isNull(caseData.getRes1MediationDocumentsReferred())
&& isNull(caseData.getRes1MediationNonAttendanceDocs()));
}

@Override
public boolean shouldRecordScenario(CaseData caseData) {
return caseData.isApplicant1NotRepresented();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN;
import static java.util.Objects.isNull;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_DJ_SDO_DEFENDANT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_DEFENDANT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_SDO_DEFENDANT;
Expand All @@ -28,6 +29,7 @@
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_SDO_MADE_BY_LA_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_SDO_DRAWN_PRE_CASE_PROGRESSION;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_CARM;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_WITHOUT_UPLOAD_FILES_CARM;
import static uk.gov.hmcts.reform.civil.utils.MediationUtils.findMediationUnsuccessfulReason;

@Service
Expand Down Expand Up @@ -95,14 +97,26 @@ && isEligibleForReconsideration(caseData)) {
&& isMediationUnsuccessfulReasonEqualToNotContactableDefendantOne(caseData)
&& isSDOEvent(callbackParams)
&& hasTrackChanged(caseData)) {
return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_CARM.getScenario();

if (hasUploadDocuments(caseData)) {
return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_CARM.getScenario();
} else {
return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_WITHOUT_UPLOAD_FILES_CARM.getScenario();
}
}
if (isSDODrawnPreCPRelease()) {
return SCENARIO_AAA6_DEFENDANT_SDO_DRAWN_PRE_CASE_PROGRESSION.getScenario();
}
return SCENARIO_AAA6_CP_ORDER_MADE_DEFENDANT.getScenario();
}

private boolean hasUploadDocuments(CaseData caseData) {
return !(isNull(caseData.getRes1MediationDocumentsReferred())
&& isNull(caseData.getRes1MediationNonAttendanceDocs())
&& isNull(caseData.getApp1MediationDocumentsReferred())
&& isNull(caseData.getApp1MediationNonAttendanceDocs()));
}

@Override
public boolean shouldRecordScenario(CaseData caseData) {
return caseData.isRespondent1NotRepresented();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Add scenario for claimant
*/
INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
VALUES ('Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant',
'{"Notice.AAA6.MediationUnsuccessful.Claimant1NonAttendance.CARM.Claimant"}',
'{"Notice.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant": []}');

/**
* Add notification template for claimant
*/
INSERT INTO dbs.dashboard_notifications_templates ( template_name, title_En, title_Cy, description_En, description_Cy
, notification_role)
VALUES ('Notice.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant',
'You are no longer required to submit documents relating to mediation non-attendance',
'Nid yw''n ofynnol bellach i chi gyflwyno dogfennau sy''n ymwneud â pheidio â mynychu cyfryngu',
'<p class="govuk-body">A judge has reviewed your case and you are no longer required to submit documents relating to non-attendance of a mediation appointment. There will be no penalties issued for your non-attendance.</p>',
'<p class="govuk-body">Mae barnwr wedi adolygu eich achos ac nid yw''n ofynnol i chi gyflwyno dogfennau bellach yn ymwneud â pheidio â mynychu apwyntiad cyfryngu. Ni fydd unrhyw gosbau yn cael eu gosod am eich diffyg presenoldeb.</p>',
'CLAIMANT');

/**
* Add task list items claimant
*/
INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, category_cy, template_name,
scenario_name, task_status_sequence, role, task_order)
values ('<a>Upload mediation documents</a>',
'Mediation',
'<a>Uwchlwytho dogfennau cyfryngu</a>',
'Cyfryngu', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant', '{2, 2}', 'CLAIMANT', 6),
('<a>View mediation documents</a>',
'Mediation',
'<a>Gweld dogfennau cyfryngu</a>',
'Cyfryngu', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Claimant', '{2, 2}', 'CLAIMANT', 7);

/**
* Add scenario for defendant
*/
INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
VALUES ('Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Defendant',
'{"Notice.AAA6.MediationUnsuccessful.Defendant1NonAttendance.CARM.Defendant"}',
'{"Notice.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Defendant": []}');

/**
* Add notification template from defendant
*/
INSERT INTO dbs.dashboard_notifications_templates ( template_name, title_En, title_Cy, description_En, description_Cy
, notification_role)
VALUES ('Notice.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Defendant',
'You are no longer required to submit documents relating to mediation non-attendance',
'Nid yw''n ofynnol bellach i chi gyflwyno dogfennau sy''n ymwneud â pheidio â mynychu cyfryngu',
'<p class="govuk-body">A judge has reviewed your case and you are no longer required to submit documents relating to non-attendance of a mediation appointment. There will be no penalties issued for your non-attendance.</p>',
'<p class="govuk-body">Mae barnwr wedi adolygu eich achos ac nid yw''n ofynnol i chi gyflwyno dogfennau bellach yn ymwneud â pheidio â mynychu apwyntiad cyfryngu. Ni fydd unrhyw gosbau yn cael eu gosod am eich diffyg presenoldeb.</p>',
'DEFENDANT');

/**
* Add task list items defendant
*/
INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, category_cy, template_name,
scenario_name, task_status_sequence, role, task_order)
values ('<a>Upload mediation documents</a>',
'Mediation',
'<a>Uwchlwytho dogfennau cyfryngu</a>',
'Cyfryngu', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Defendant', '{2, 2}', 'DEFENDANT', 6),
('<a>View mediation documents</a>',
'Mediation',
'<a>Gweld dogfennau cyfryngu</a>',
'Cyfryngu', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessfulWithoutUploadDocuments.TrackChange.CARM.Defendant', '{2, 2}', 'DEFENDANT', 7);


Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ VALUES ('Notice.AAA6.MediationUnsuccessful.TrackChange.CARM.Claimant',
*/
INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, category_cy, template_name,
scenario_name, task_status_sequence, role, task_order)
values ('<a>View mediation documents</a>',
values ('<a>Upload mediation documents</a>',
'Mediation',
'<a>View mediation documents</a>',
'Mediation', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Claimant', '{2, 2}', 'CLAIMANT', 7);
'<a>Uwchlwytho dogfennau cyfryngu</a>',
'Cyfryngu', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Claimant', '{2, 2}', 'CLAIMANT', 6);


/**
* Add scenario for defendant
Expand All @@ -49,13 +50,12 @@ VALUES ('Notice.AAA6.MediationUnsuccessful.TrackChange.CARM.Defendant',
'DEFENDANT');

/**
* Add task list items claimant
* Add task list items defendant
*/
INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, category_cy, template_name,
scenario_name, task_status_sequence, role, task_order)
values ('<a>View mediation documents</a>',
values ('<a>Upload mediation documents</a>',
'Mediation',
'<a>View mediation documents</a>',
'Mediation', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Defendant', '{2, 2}', 'DEFENDANT', 7);

'<a>Uwchlwytho dogfennau cyfryngu</a>',
'Cyfryngu', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUnsuccessful.TrackChange.CARM.Defendant', '{2, 2}', 'DEFENDANT', 6);

Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, cat

values ('<a href={UPLOAD_MEDIATION_DOCUMENTS} class="govuk-link">Upload mediation documents</a>',
'Mediation',
'<a href={UPLOAD_MEDIATION_DOCUMENTS} class="govuk-link">Upload mediation documents</a>',
'Mediation', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Claimant', '{6, 6}', 'CLAIMANT', 6),
'<a href={UPLOAD_MEDIATION_DOCUMENTS} class="govuk-link">Uwchlwytho dogfennau cyfryngu</a>',
'Cyfryngu', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Claimant', '{6, 6}', 'CLAIMANT', 6),

('<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation',
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Claimant', '{3, 3}', 'CLAIMANT', 7);
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">Gweld dogfennau cyfryngu</a>',
'Cyfryngu', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Claimant', '{3, 3}', 'CLAIMANT', 7);


/**
Expand All @@ -40,11 +40,11 @@ INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, cat

values ('<a href={UPLOAD_MEDIATION_DOCUMENTS} class="govuk-link">Upload mediation documents</a>',
'Mediation',
'<a href={UPLOAD_MEDIATION_DOCUMENTS} class="govuk-link">Upload mediation documents</a>',
'Mediation', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Defendant', '{6, 6}', 'DEFENDANT', 6),
'<a href={UPLOAD_MEDIATION_DOCUMENTS} class="govuk-link">Uwchlwytho dogfennau cyfryngu</a>',
'Cyfryngu', 'Upload.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Defendant', '{6, 6}', 'DEFENDANT', 6),

('<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation',
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Defendant', '{3, 3}', 'DEFENDANT', 7);
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">Gweld dogfennau cyfryngu</a>',
'Cyfryngu', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.CARM.Defendant', '{3, 3}', 'DEFENDANT', 7);

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, cat

values ('<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation',
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.ViewMediationAvailable.CARM.Claimant', '{3, 3}', 'CLAIMANT', 7);
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">Gweld dogfennau cyfryngu</a>',
'Cyfryngu', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.ViewMediationAvailable.CARM.Claimant', '{3, 3}', 'CLAIMANT', 7);

/**
* Add scenario for claimant
Expand All @@ -33,5 +33,5 @@ INSERT INTO dbs.task_item_template (task_name_en, category_en, task_name_cy, cat

values ('<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation',
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">View mediation documents</a>',
'Mediation', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.ViewMediationAvailable.CARM.Defendant', '{3, 3}', 'DEFENDANT', 7);
'<a href={VIEW_MEDIATION_DOCUMENTS} class="govuk-link">Gweld dogfennau cyfryngu</a>',
'Cyfryngu', 'View.Mediation.Documents', 'Scenario.AAA6.MediationUploadDocuments.ViewMediationAvailable.CARM.Defendant', '{3, 3}', 'DEFENDANT', 7);
Loading

0 comments on commit 45b087f

Please sign in to comment.