diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/StayLiftedClaimantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/StayLiftedClaimantScenarioTest.java index 68d2d6318f1..b8c76ceaa5d 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/StayLiftedClaimantScenarioTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/StayLiftedClaimantScenarioTest.java @@ -11,6 +11,8 @@ import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.dashboard.data.TaskStatus; +import java.time.LocalDateTime; + import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -30,6 +32,7 @@ void should_create_stay_lifted_claimant_scenario() throws Exception { .ccdCaseReference(Long.valueOf(caseId)) .ccdState(CaseState.CASE_PROGRESSION) .preStayState(CaseState.HEARING_READINESS.toString()) + .caseDocumentUploadDate(LocalDateTime.now()) .applicant1Represented(YesOrNo.NO) .build(); @@ -64,15 +67,25 @@ void should_create_stay_lifted_claimant_scenario() throws Exception { jsonPath("$[1].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), jsonPath("$[1].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()), jsonPath("$[2].reference").value(caseId), - jsonPath("$[2].taskNameEn").value("Add the trial arrangements"), - jsonPath("$[2].taskNameCy").value("Ychwanegu trefniadau'r treial"), - jsonPath("$[2].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), - jsonPath("$[2].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()), + jsonPath("$[2].taskNameEn").value("Upload hearing documents"), + jsonPath("$[2].taskNameCy").value("Llwytho dogfennau'r gwrandawiad"), + jsonPath("$[2].currentStatusEn").value(TaskStatus.IN_PROGRESS.getName()), + jsonPath("$[2].currentStatusCy").value(TaskStatus.IN_PROGRESS.getWelshName()), jsonPath("$[3].reference").value(caseId), - jsonPath("$[3].taskNameEn").value("View the bundle"), - jsonPath("$[3].taskNameCy").value("Gweld y bwndel"), - jsonPath("$[3].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), - jsonPath("$[3].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()) + jsonPath("$[3].taskNameEn").value("View documents"), + jsonPath("$[3].taskNameCy").value("Gweld y dogfennau"), + jsonPath("$[3].currentStatusEn").value(TaskStatus.AVAILABLE.getName()), + jsonPath("$[3].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName()), + jsonPath("$[4].reference").value(caseId), + jsonPath("$[4].taskNameEn").value("Add the trial arrangements"), + jsonPath("$[4].taskNameCy").value("Ychwanegu trefniadau'r treial"), + jsonPath("$[4].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), + jsonPath("$[4].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()), + jsonPath("$[5].reference").value(caseId), + jsonPath("$[5].taskNameEn").value("View the bundle"), + jsonPath("$[5].taskNameCy").value("Gweld y bwndel"), + jsonPath("$[5].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), + jsonPath("$[5].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()) ); } } diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/StayLiftedDefendantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/StayLiftedDefendantScenarioTest.java index 25559540af2..b2367824a2e 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/StayLiftedDefendantScenarioTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/StayLiftedDefendantScenarioTest.java @@ -11,6 +11,8 @@ import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; import uk.gov.hmcts.reform.dashboard.data.TaskStatus; +import java.time.LocalDateTime; + import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -21,7 +23,7 @@ public class StayLiftedDefendantScenarioTest extends DashboardBaseIntegrationTes private StayLiftedDefendantNotificationHandler handler; @Test - void should_create_stay_lifted_claimant_scenario() throws Exception { + void should_create_stay_lifted_defendant_scenario() throws Exception { String caseId = "7123454456455465"; @@ -31,6 +33,7 @@ void should_create_stay_lifted_claimant_scenario() throws Exception { .ccdState(CaseState.CASE_PROGRESSION) .preStayState(CaseState.HEARING_READINESS.toString()) .respondent1Represented(YesOrNo.NO) + .caseDocumentUploadDateRes(LocalDateTime.now()) .build(); when(featureToggleService.isLipVLipEnabled()).thenReturn(true); @@ -59,15 +62,26 @@ void should_create_stay_lifted_claimant_scenario() throws Exception { jsonPath("$[0].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), jsonPath("$[0].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()), jsonPath("$[1].reference").value(caseId), - jsonPath("$[1].taskNameEn").value("Add the trial arrangements"), - jsonPath("$[1].taskNameCy").value("Ychwanegu trefniadau'r treial"), - jsonPath("$[1].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), - jsonPath("$[1].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()), + jsonPath("$[1].taskNameEn").value("Upload hearing documents"), + jsonPath("$[1].taskNameCy").value("Llwytho dogfennau'r gwrandawiad"), + jsonPath("$[1].currentStatusEn").value(TaskStatus.IN_PROGRESS.getName()), + jsonPath("$[1].currentStatusCy").value(TaskStatus.IN_PROGRESS.getWelshName()), + jsonPath("$[2].reference").value(caseId), jsonPath("$[2].reference").value(caseId), - jsonPath("$[2].taskNameEn").value("View the bundle"), - jsonPath("$[2].taskNameCy").value("Gweld y bwndel"), - jsonPath("$[2].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), - jsonPath("$[2].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()) + jsonPath("$[2].taskNameEn").value("View documents"), + jsonPath("$[2].taskNameCy").value("Gweld y dogfennau"), + jsonPath("$[2].currentStatusEn").value(TaskStatus.AVAILABLE.getName()), + jsonPath("$[2].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName()), + jsonPath("$[3].reference").value(caseId), + jsonPath("$[3].taskNameEn").value("Add the trial arrangements"), + jsonPath("$[3].taskNameCy").value("Ychwanegu trefniadau'r treial"), + jsonPath("$[3].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), + jsonPath("$[3].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()), + jsonPath("$[4].reference").value(caseId), + jsonPath("$[4].taskNameEn").value("View the bundle"), + jsonPath("$[4].taskNameCy").value("Gweld y bwndel"), + jsonPath("$[4].currentStatusEn").value(TaskStatus.NOT_AVAILABLE_YET.getName()), + jsonPath("$[4].currentStatusCy").value(TaskStatus.NOT_AVAILABLE_YET.getWelshName()) ); } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java index bb7b50ef252..0bb85adc970 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/DashboardScenarios.java @@ -210,6 +210,10 @@ public enum DashboardScenarios { SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK("Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Fee.Paid.Task"), SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant"), SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant"), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Claimant"), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Claimant"), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Defendant"), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Defendant"), SCENARIO_AAA6_UPDATE_CASE_PROCEED_IN_CASE_MAN_DEFENDANT("Scenario.AAA6.Update.CaseProceedsInCaseman.Defendant"), SCENARIO_AAA6_UPDATE_CASE_PROCEED_IN_CASE_MAN_DEFENDANT_FAST_TRACK("Scenario.AAA6.Update.CaseProceedsInCaseman.Defendant.FastTrack"); diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandler.java index 2685d4a0d8d..85eccbddb91 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandler.java @@ -6,6 +6,7 @@ import uk.gov.hmcts.reform.civil.callback.CaseEventsDashboardCallbackHandler; import uk.gov.hmcts.reform.civil.client.DashboardApiClient; import uk.gov.hmcts.reform.civil.enums.CaseState; +import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @@ -14,12 +15,15 @@ import java.util.List; import java.util.Map; +import static java.util.Objects.nonNull; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_STAY_LIFTED_CLAIMANT; import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS; import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT; @Service public class StayLiftedClaimantNotificationHandler extends CaseEventsDashboardCallbackHandler { @@ -55,7 +59,8 @@ public Map getScenarios(CaseData caseData) { return Map.of( SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), true, SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario(), hadHearingScheduled(caseData), - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), hadHearingScheduled(caseData) && !caseData.isHearingFeePaid() + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), hadHearingScheduled(caseData) && !caseData.isHearingFeePaid(), + getViewDocumentsScenario(caseData).getScenario(), true ); } @@ -69,4 +74,10 @@ private boolean hadHearingScheduled(CaseData caseData) { ).contains(CaseState.valueOf(caseData.getPreStayState())); } + private DashboardScenarios getViewDocumentsScenario(CaseData caseData) { + return nonNull(caseData.getCaseDocumentUploadDate()) + ? SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT + : SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT; + } + } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandler.java index 8fa2a165052..3cb7c737806 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandler.java @@ -6,6 +6,7 @@ import uk.gov.hmcts.reform.civil.callback.CaseEventsDashboardCallbackHandler; import uk.gov.hmcts.reform.civil.client.DashboardApiClient; import uk.gov.hmcts.reform.civil.enums.CaseState; +import uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios; import uk.gov.hmcts.reform.civil.model.CaseData; import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper; import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @@ -14,11 +15,14 @@ import java.util.List; import java.util.Map; +import static java.util.Objects.nonNull; import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_STAY_LIFTED_DEFENDANT; import static uk.gov.hmcts.reform.civil.enums.CaseState.HEARING_READINESS; import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT; @Service public class StayLiftedDefendantNotificationHandler extends CaseEventsDashboardCallbackHandler { @@ -53,7 +57,9 @@ public Map getScenarios(CaseData caseData) { if (caseData.isRespondent1NotRepresented()) { return Map.of( SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), true, - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), hadHearingScheduled(caseData)); + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), hadHearingScheduled(caseData), + getViewDocumentsScenario(caseData).getScenario(), true + ); } return new HashMap<>(); @@ -65,4 +71,11 @@ private boolean hadHearingScheduled(CaseData caseData) { PREPARE_FOR_HEARING_CONDUCT_HEARING ).contains(CaseState.valueOf(caseData.getPreStayState())); } + + private DashboardScenarios getViewDocumentsScenario(CaseData caseData) { + return nonNull(caseData.getCaseDocumentUploadDateRes()) + ? SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT + : SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT; + } + } diff --git a/src/main/resources/db/migration/V2024_11_08_1240__CIV-15551_stay_lifted_hearing_reset_tasks.sql b/src/main/resources/db/migration/V2024_11_08_1240__CIV-15551_stay_lifted_hearing_reset_tasks.sql deleted file mode 100644 index a467afeee13..00000000000 --- a/src/main/resources/db/migration/V2024_11_08_1240__CIV-15551_stay_lifted_hearing_reset_tasks.sql +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Add scenarios - */ -INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) -VALUES ('Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Fee.Paid.Task', '{}', '{}'), - ('Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{}', '{}'), - ('Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.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 ('View the hearing', 'Hearing', 'Gweld y gwrandawiad', - 'Gwrandawiad', 'Hearing.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{1, 1}', 'CLAIMANT', 8), - ('Pay the hearing fee', 'Hearing', 'Talu ffi''r gwrandawiad', - 'Gwrandawiad', 'Hearing.Fee.Pay', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Fee.Paid.Task', '{1, 1}', 'CLAIMANT', 9), - ('Add the trial arrangements', 'Hearing', 'Ychwanegu trefniadau''r treial', - 'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{1, 1}', 'CLAIMANT', 12), - ('View the bundle', 'Hearing', 'Gweld y bwndel', - 'Gwrandawiad', 'Hearing.Bundle.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{1, 1}', 'CLAIMANT', 13), - ('View the hearing', 'Hearing', 'Gweld y gwrandawiad', - 'Gwrandawiad', 'Hearing.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{1, 1}', 'DEFENDANT', 8), - ('Add the trial arrangements', 'Hearing', 'Ychwanegu trefniadau''r treial', - 'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{1, 1}', 'DEFENDANT', 12), - ('View the bundle', 'Hearing', 'Gweld y bwndel', - 'Gwrandawiad', 'Hearing.Bundle.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{1, 1}', 'DEFENDANT', 13); diff --git a/src/main/resources/db/migration/V2024_11_14_1341__CIV-15551_stay_lifted_hearing_reset_tasks.sql b/src/main/resources/db/migration/V2024_11_14_1341__CIV-15551_stay_lifted_hearing_reset_tasks.sql new file mode 100644 index 00000000000..0ac31973fbd --- /dev/null +++ b/src/main/resources/db/migration/V2024_11_14_1341__CIV-15551_stay_lifted_hearing_reset_tasks.sql @@ -0,0 +1,52 @@ +/** + * Add scenarios + */ +INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) +VALUES ('Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Fee.Paid.Task', '{}', '{}'), + ('Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{}', '{}'), + ('Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{}', '{}'), + ('Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Claimant', '{}', '{}'), + ('Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Claimant', '{}', '{}'), + ('Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Defendant', '{}', '{}'), + ('Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.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 ('View the hearing', 'Hearing', 'Gweld y gwrandawiad', + 'Gwrandawiad', 'Hearing.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{1, 1}', 'CLAIMANT', 8), + ('Pay the hearing fee', 'Hearing', 'Talu ffi''r gwrandawiad', + 'Gwrandawiad', 'Hearing.Fee.Pay', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Fee.Paid.Task', '{1, 1}', 'CLAIMANT', 9), + ('Upload hearing documents', 'Hearing', + 'Llwytho dogfennau''r gwrandawiad', 'Gwrandawiad', + 'Hearing.Document.Upload', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Claimant', + '{6, 6}', 'CLAIMANT', 10), + ('View documents', 'Hearing' ,'Gweld y dogfennau', + 'Gwrandawiad', 'Hearing.Document.View', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Claimant','{3, 3}', 'CLAIMANT', 11), + ('Upload hearing documents', 'Hearing', + 'Llwytho dogfennau''r gwrandawiad', 'Gwrandawiad', + 'Hearing.Document.Upload', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Claimant', + '{5, 6}', 'CLAIMANT', 10), + ('View documents', 'Hearing' ,'Gweld y dogfennau', 'Gwrandawiad', + 'Hearing.Document.View', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Claimant','{1, 1}', 'CLAIMANT', 11), + ('Add the trial arrangements', 'Hearing', 'Ychwanegu trefniadau''r treial', + 'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{1, 1}', 'CLAIMANT', 12), + ('View the bundle', 'Hearing', 'Gweld y bwndel', + 'Gwrandawiad', 'Hearing.Bundle.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Claimant', '{1, 1}', 'CLAIMANT', 13), + ('View the hearing', 'Hearing', 'Gweld y gwrandawiad', + 'Gwrandawiad', 'Hearing.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{1, 1}', 'DEFENDANT', 8), + ('Upload hearing documents', 'Hearing', + 'Llwytho dogfennau''r gwrandawiad', 'Gwrandawiad', + 'Hearing.Document.Upload', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Defendant', + '{6, 6}', 'DEFENDANT', 10), + ('View documents', 'Hearing' ,'Gweld y dogfennau', + 'Gwrandawiad', 'Hearing.Document.View', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Available.Defendant','{3, 3}', 'DEFENDANT', 11), + ('Upload hearing documents', 'Hearing', + 'Llwytho dogfennau''r gwrandawiad', 'Gwrandawiad', + 'Hearing.Document.Upload', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Defendant', + '{5, 6}', 'DEFENDANT', 10), + ('View documents', 'Hearing' ,'Gweld y dogfennau', 'Gwrandawiad', + 'Hearing.Document.View', 'Scenario.AAA6.CP.Stay.Lifted.View.Documents.Task.Not.Available.Defendant','{1, 1}', 'DEFENDANT', 11), + ('Add the trial arrangements', 'Hearing', 'Ychwanegu trefniadau''r treial', + 'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{1, 1}', 'DEFENDANT', 12), + ('View the bundle', 'Hearing', 'Gweld y bwndel', + 'Gwrandawiad', 'Hearing.Bundle.View', 'Scenario.AAA6.CP.Stay.Lifted.Reset.Hearing.Tasks.Defendant', '{1, 1}', 'DEFENDANT', 13); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandlerTest.java index dab223b8153..00fc93622ff 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/StayLiftedClaimantNotificationHandlerTest.java @@ -20,6 +20,7 @@ import uk.gov.hmcts.reform.civil.service.FeatureToggleService; import uk.gov.hmcts.reform.dashboard.data.ScenarioRequestParams; +import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; @@ -41,6 +42,8 @@ import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT; @ExtendWith(MockitoExtension.class) public class StayLiftedClaimantNotificationHandlerTest extends BaseCallbackHandlerTest { @@ -125,7 +128,8 @@ void shouldRecordExpectedScenarios_whenPreStateInMediation() { handler.handle(callbackParams); verifyRecordedScenarios(List.of( - SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario() + SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT.getScenario() )); } @@ -147,8 +151,9 @@ void shouldRecordExpectedScenarios_whenPreStateJudicialReferral() { handler.handle(callbackParams); verifyRecordedScenarios(List.of( - SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario() - )); + SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT.getScenario()) + ); } @Test @@ -169,8 +174,9 @@ void shouldRecordExpectedScenarios_whenPreStateCaseProgression() { handler.handle(callbackParams); verifyRecordedScenarios(List.of( - SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario() - )); + SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT.getScenario()) + ); } @Test @@ -193,8 +199,9 @@ void shouldRecordExpectedScenarios_whenPreStateHearingReadiness() { verifyRecordedScenarios(List.of( SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario(), - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario() - )); + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT.getScenario()) + ); } @Test @@ -217,7 +224,8 @@ void shouldRecordExpectedScenarios_whenPreStatePfHcH_withFeePaid() { verifyRecordedScenarios(List.of( SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario()) + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT.getScenario()) ); } @@ -241,7 +249,35 @@ void shouldRecordExpectedScenarios_whenPreStatePfHcH_withFeeNotRequired() { verifyRecordedScenarios(List.of( SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario()) + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_CLAIMANT.getScenario()) + ); + } + + @Test + void shouldRecordExpectedScenarios_whenEvidenceUploaded() { + when(dashboardNotificationsParamsMapper.mapCaseDataToParams(any())).thenReturn(params); + when(featureToggleService.isCaseEventsEnabled()).thenReturn(true); + + CaseData caseData = CaseDataBuilder.builder().atStateClaimIssued().build() + .toBuilder() + .applicant1Represented(YesOrNo.NO) + .preStayState(PREPARE_FOR_HEARING_CONDUCT_HEARING.toString()) + .caseDocumentUploadDate(LocalDateTime.now()) + .build(); + + CallbackParams callbackParams = CallbackParamsBuilder.builder() + .of(ABOUT_TO_SUBMIT, caseData) + .build(); + + handler.handle(callbackParams); + + verifyRecordedScenarios(List.of( + SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_FEE_PAID_TASK.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_CLAIMANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_CLAIMANT.getScenario() + ) ); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandlerTest.java index 4e06f9dc374..ca9e6054250 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/StayLiftedDefendantNotificationHandlerTest.java @@ -19,6 +19,7 @@ import uk.gov.hmcts.reform.civil.service.FeatureToggleService; import uk.gov.hmcts.reform.dashboard.data.ScenarioRequestParams; +import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; @@ -38,6 +39,8 @@ import static uk.gov.hmcts.reform.civil.enums.CaseState.PREPARE_FOR_HEARING_CONDUCT_HEARING; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT; @ExtendWith(MockitoExtension.class) public class StayLiftedDefendantNotificationHandlerTest extends BaseCallbackHandlerTest { @@ -122,7 +125,8 @@ void shouldRecordExpectedScenarios_whenPreStateInMediation() { handler.handle(callbackParams); verifyRecordedScenarios(List.of( - SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario() + SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT.getScenario() )); } @@ -144,7 +148,8 @@ void shouldRecordExpectedScenarios_whenPreStateJudicialReferral() { handler.handle(callbackParams); verifyRecordedScenarios(List.of( - SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario() + SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT.getScenario() )); } @@ -166,7 +171,8 @@ void shouldRecordExpectedScenarios_whenPreStateCaseProgression() { handler.handle(callbackParams); verifyRecordedScenarios(List.of( - SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario() + SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT.getScenario() )); } @@ -189,7 +195,8 @@ void shouldRecordExpectedScenarios_whenPreStateHearingReadiness() { verifyRecordedScenarios(List.of( SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario() + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT.getScenario() )); } @@ -212,7 +219,33 @@ void shouldRecordExpectedScenarios_whenPreStatePfHcH() { verifyRecordedScenarios(List.of( SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), - SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario()) + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_NOT_AVAILABLE_DEFENDANT.getScenario()) + ); + } + + @Test + void shouldRecordExpectedScenarios_whenEvidenceUploaded() { + when(dashboardNotificationsParamsMapper.mapCaseDataToParams(any())).thenReturn(params); + when(featureToggleService.isCaseEventsEnabled()).thenReturn(true); + + CaseData caseData = CaseDataBuilder.builder().atStateClaimIssued().build() + .toBuilder() + .respondent1Represented(YesOrNo.NO) + .preStayState(PREPARE_FOR_HEARING_CONDUCT_HEARING.toString()) + .caseDocumentUploadDateRes(LocalDateTime.now()) + .build(); + + CallbackParams callbackParams = CallbackParamsBuilder.builder() + .of(ABOUT_TO_SUBMIT, caseData) + .build(); + + handler.handle(callbackParams); + + verifyRecordedScenarios(List.of( + SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_RESET_HEARING_TASKS_DEFENDANT.getScenario(), + SCENARIO_AAA6_CP_STAY_LIFTED_VIEW_DOCUMENTS_TASK_AVAILABLE_DEFENDANT.getScenario()) ); }