From 51b77937b646aa7e80d572d98cd5a78178e5863e Mon Sep 17 00:00:00 2001
From: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com>
Date: Wed, 29 May 2024 17:20:19 +0100
Subject: [PATCH] CIV-13484 - Dashboard notification - SDO drawn (claimant +
defendant) (#4719)
* draft changes.
* fixed integration test.
* fixed checkstyle and unit tests.
* fixed functional tests.
* Update DashboardScenarios.java
---------
Co-authored-by: Raja Mani
Please follow instructions in the order and comply with the deadlines. " + + "Please send any documents to the court named in the order if required. " + + "The claim will now proceed offline, you will receive further updates by post.
"), + jsonPath("$[0].titleCy").value("Mae gorchymyn wedi’i gyhoeddi gan y llys."), + jsonPath("$[0].descriptionCy").value( + "Dilynwch y cyfarwyddiadau sydd yn y gorchymyn a chydymffurfiwch " + + "â’r dyddiadau terfyn. Anfonwch unrhyw ddogfennau i’r llys a enwir yn y gorchymyn os oes angen. " + + "Bydd yr hawliad nawr yn parhau all-lein a byddwch yn cael unrhyw ddiweddariadau pellach drwy’r post.
") + ); + } + private static CallbackParams callbackParamsTest(CaseData caseData) { return CallbackParamsBuilder.builder() .of(ABOUT_TO_SUBMIT, caseData) diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/UploadHearingDocumentsClaimantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/UploadHearingDocumentsClaimantScenarioTest.java index 8bf7d2a7946..5809202cf85 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/UploadHearingDocumentsClaimantScenarioTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/UploadHearingDocumentsClaimantScenarioTest.java @@ -12,6 +12,7 @@ import java.math.BigDecimal; +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; @@ -24,6 +25,7 @@ public class UploadHearingDocumentsClaimantScenarioTest extends DashboardBaseInt void shouldCreateUploadDocumentCaseProgresionScenario() throws Exception { String caseId = "12345188432991"; + when(featureToggleService.isCaseProgressionEnabled()).thenReturn(true); CaseData caseData = CaseDataBuilder.builder().atStateRespondentFullAdmissionSpec().build() .toBuilder() diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/OrderMadeDefendantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/OrderMadeDefendantScenarioTest.java index 6b3af0c8cd6..639283d4769 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/OrderMadeDefendantScenarioTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/OrderMadeDefendantScenarioTest.java @@ -49,6 +49,7 @@ void should_create_order_made_defendant_scenario() throws Exception { CaseDocument.builder().documentLink(Document.builder().documentBinaryUrl("url").build()).build()))) .build(); + when(featureToggleService.isCaseProgressionEnabled()).thenReturn(true); handler.handle(callbackParamsTest(caseData)); //Verify Notification is created @@ -107,6 +108,41 @@ void should_create_order_made_defendant_scenario_mediation_unsuccessful_sdo_carm "ymwneud â pheidio â mynychu apwyntiad cyfryngu. Ni fydd unrhyw gosbau yn cael eu gosod am eich diffyg presenoldeb.")); } + @Test + void should_create_order_made_claimant_scenario_pre_cp_release() throws Exception { + + String caseId = "72014545416"; + + CaseData caseData = CaseDataBuilder.builder().atStateRespondentPartAdmissionSpec().build() + .toBuilder() + .legacyCaseReference("reference") + .ccdCaseReference(Long.valueOf(caseId)) + .respondent1Represented(YesOrNo.NO) + .finalOrderDocumentCollection(List.of(ElementUtils.element( + CaseDocument.builder().documentLink(Document.builder().documentBinaryUrl("url").build()).build()))) + .build(); + + when(featureToggleService.isCaseProgressionEnabled()).thenReturn(false); + handler.handle(callbackParamsTest(caseData)); + + //Verify Notification is created + doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "DEFENDANT") + .andExpect(status().isOk()) + .andExpectAll( + status().is(HttpStatus.OK.value()), + jsonPath("$[0].titleEn").value("An order has been issued by the court."), + jsonPath("$[0].descriptionEn").value( + "Please follow instructions in the order and comply with the deadlines. " + + "Please send any documents to the court named in the order if required. " + + "The claim will now proceed offline, you will receive further updates by post.
"), + jsonPath("$[0].titleCy").value("Mae gorchymyn wedi’i gyhoeddi gan y llys."), + jsonPath("$[0].descriptionCy").value( + "Dilynwch y cyfarwyddiadau sydd yn y gorchymyn a chydymffurfiwch " + + "â’r dyddiadau terfyn. Anfonwch unrhyw ddogfennau i’r llys a enwir yn y gorchymyn os oes angen. " + + "Bydd yr hawliad nawr yn parhau all-lein a byddwch yn cael unrhyw ddiweddariadau pellach drwy’r post.
") + ); + } + private static CallbackParams callbackParamsTest(CaseData caseData) { return CallbackParamsBuilder.builder() .of(ABOUT_TO_SUBMIT, caseData) diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/UploadHearingDocumentsDefendantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/UploadHearingDocumentsDefendantScenarioTest.java index 5590e59b157..85d66ff20d6 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/UploadHearingDocumentsDefendantScenarioTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/defendant/UploadHearingDocumentsDefendantScenarioTest.java @@ -12,6 +12,7 @@ import java.math.BigDecimal; +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; @@ -25,6 +26,7 @@ void shouldCreateUploadDocumentCaseProgresionScenario() throws Exception { String caseId = "1234518843299"; + when(featureToggleService.isCaseProgressionEnabled()).thenReturn(true); CaseData caseData = CaseDataBuilder.builder().atStateRespondentFullAdmissionSpec().build() .toBuilder() .legacyCaseReference("reference") 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 4b3eaed0470..5b682bf1c1a 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 @@ -139,6 +139,8 @@ public enum DashboardScenarios { SCENARIO_AAA6_CP_CLAIM_ISSUE_FAST_TRACK_DEFENDANT("Scenario.AAA6.ClaimIssue.Defendant.FastTrack"), SCENARIO_AAA6_CLAIMANT_MEDIATION_WHEN_DEFENDANT_NOT_CONTACTABLE("Scenario.AAA6.MediationUnsuccessful.WhenDefendantNotContactable.CARM.Claimant"), SCENARIO_AAA6_DEFENDANT_MEDIATION_WHEN_CLAIMANT_NOT_CONTACTABLE("Scenario.AAA6.MediationUnsuccessful.WhenClaimantNotContactable.CARM.Defendant"), + SCENARIO_AAA6_CLAIMANT_SDO_DRAWN_PRE_CASE_PROGRESSION("Scenario.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Claimant"), + SCENARIO_AAA6_DEFENDANT_SDO_DRAWN_PRE_CASE_PROGRESSION("Scenario.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Defendant"), SCENARIO_AAA6_DEFENDANT_RESPONSE_BILINGUAL_CLAIMANT("Scenario.AAA6.DefResponse.BilingualFlagSet.Claimant"), SCENARIO_AAA6_CASE_PROCEED_IN_CASE_MAN_CLAIMANT("Scenario.AAA6.CaseProceedsInCaseman.Claimant"), SCENARIO_AAA6_CASE_PROCEED_IN_CASE_MAN_DEFENDANT("Scenario.AAA6.CaseProceedsInCaseman.Defendant"), diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java index 1f63dce59aa..a89edac5943 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java @@ -17,6 +17,7 @@ import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_SDO_CLAIMANT; import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.SMALL_CLAIM; import static uk.gov.hmcts.reform.civil.enums.mediation.MediationUnsuccessfulReason.NOT_CONTACTABLE_CLAIMANT_ONE; +import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_SDO_DRAWN_PRE_CASE_PROGRESSION; 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_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM; import static uk.gov.hmcts.reform.civil.utils.MediationUtils.findMediationUnsuccessfulReason; @@ -53,6 +54,9 @@ && isSDOEvent(callbackParams) && hasTrackChanged(caseData)) { return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_CLAIMANT_CARM.getScenario(); } + if (isSDODrawnPreCPRelease()) { + return SCENARIO_AAA6_CLAIMANT_SDO_DRAWN_PRE_CASE_PROGRESSION.getScenario(); + } return SCENARIO_AAA6_CP_ORDER_MADE_CLAIMANT.getScenario(); } @@ -66,6 +70,10 @@ private boolean isCarmApplicableCase(CaseData caseData) { && SMALL_CLAIM.equals(getPreviousAllocatedTrack(caseData)); } + private boolean isSDODrawnPreCPRelease() { + return !getFeatureToggleService().isCaseProgressionEnabled(); + } + private boolean isMediationUnsuccessfulReasonEqualToNotContactableClaimantOne(CaseData caseData) { return findMediationUnsuccessfulReason(caseData, List.of(NOT_CONTACTABLE_CLAIMANT_ONE)); } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/UploadHearingDocumentsClaimantHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/UploadHearingDocumentsClaimantHandler.java index 7520490732e..a1a3ac688d6 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/UploadHearingDocumentsClaimantHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/UploadHearingDocumentsClaimantHandler.java @@ -44,6 +44,8 @@ protected String getScenario(CaseData caseData) { @Override public boolean shouldRecordScenario(CaseData caseData) { // TODO check for Small Claims is because Small Claims does not use a known date - return caseData.isApplicantNotRepresented() && !SdoHelper.isSmallClaimsTrack(caseData); + return caseData.isApplicantNotRepresented() + && !SdoHelper.isSmallClaimsTrack(caseData) + && featureToggleService.isCaseProgressionEnabled(); } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java index 18e78230221..8c786075b6d 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java @@ -18,6 +18,7 @@ import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.SMALL_CLAIM; import static uk.gov.hmcts.reform.civil.enums.mediation.MediationUnsuccessfulReason.NOT_CONTACTABLE_DEFENDANT_ONE; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_ORDER_MADE_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.utils.MediationUtils.findMediationUnsuccessfulReason; @@ -53,6 +54,9 @@ && isSDOEvent(callbackParams) && hasTrackChanged(caseData)) { return SCENARIO_AAA6_MEDIATION_UNSUCCESSFUL_TRACK_CHANGE_DEFENDANT_CARM.getScenario(); } + if (isSDODrawnPreCPRelease()) { + return SCENARIO_AAA6_DEFENDANT_SDO_DRAWN_PRE_CASE_PROGRESSION.getScenario(); + } return SCENARIO_AAA6_CP_ORDER_MADE_DEFENDANT.getScenario(); } @@ -75,6 +79,10 @@ private boolean isSDOEvent(CallbackParams callbackParams) { .equals(CaseEvent.valueOf(callbackParams.getRequest().getEventId())); } + private boolean isSDODrawnPreCPRelease() { + return !getFeatureToggleService().isCaseProgressionEnabled(); + } + private boolean hasTrackChanged(CaseData caseData) { return SMALL_CLAIM.equals(getPreviousAllocatedTrack(caseData)) && !caseData.isSmallClaim(); diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/UploadHearingDocumentsDefendantHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/UploadHearingDocumentsDefendantHandler.java index adaab9908e7..2d637e3f0fd 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/UploadHearingDocumentsDefendantHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/UploadHearingDocumentsDefendantHandler.java @@ -44,6 +44,8 @@ protected String getScenario(CaseData caseData) { @Override public boolean shouldRecordScenario(CaseData caseData) { // TODO check for Small Claims is because Small Claims does not use a known date - return caseData.isRespondent1NotRepresented() && !SdoHelper.isSmallClaimsTrack(caseData); + return caseData.isRespondent1NotRepresented() + && !SdoHelper.isSmallClaimsTrack(caseData) + && featureToggleService.isCaseProgressionEnabled(); } } diff --git a/src/main/resources/db/migration/V2024_05_13_1415__CIV-13484_sdo_drawn_pre_caseProgression_claimant_scenario.sql b/src/main/resources/db/migration/V2024_05_13_1415__CIV-13484_sdo_drawn_pre_caseProgression_claimant_scenario.sql new file mode 100644 index 00000000000..890a1402cf1 --- /dev/null +++ b/src/main/resources/db/migration/V2024_05_13_1415__CIV-13484_sdo_drawn_pre_caseProgression_claimant_scenario.sql @@ -0,0 +1,17 @@ +/** + * Add scenario + */ +INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) +VALUES ('Scenario.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Claimant', + '{ "Notice.AAA6.ClaimantIntent.GoToHearing.Claimant", + "Notice.AAA6.ClaimantIntent.MediationUnsuccessful.Claimant"}', '{"Notice.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Claimant" : []}'); + +/** + * Add notification template + */ +INSERT INTO dbs.dashboard_notifications_templates (template_name, title_En, title_Cy, description_En, description_Cy + ,notification_role) +VALUES ('Notice.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Claimant', 'An order has been issued by the court.', 'Mae gorchymyn wedi’i gyhoeddi gan y llys.', + 'Please follow instructions in the order and comply with the deadlines. Please send any documents to the court named in the order if required. The claim will now proceed offline, you will receive further updates by post.
', + 'Dilynwch y cyfarwyddiadau sydd yn y gorchymyn a chydymffurfiwch â’r dyddiadau terfyn. Anfonwch unrhyw ddogfennau i’r llys a enwir yn y gorchymyn os oes angen. Bydd yr hawliad nawr yn parhau all-lein a byddwch yn cael unrhyw ddiweddariadau pellach drwy’r post.
', + 'CLAIMANT'); diff --git a/src/main/resources/db/migration/V2024_05_13_1430__CIV-13484_sdo_drawn_pre_caseProgression_defendant_scenario.sql b/src/main/resources/db/migration/V2024_05_13_1430__CIV-13484_sdo_drawn_pre_caseProgression_defendant_scenario.sql new file mode 100644 index 00000000000..460bd450cf9 --- /dev/null +++ b/src/main/resources/db/migration/V2024_05_13_1430__CIV-13484_sdo_drawn_pre_caseProgression_defendant_scenario.sql @@ -0,0 +1,21 @@ +/** + * Add scenario + */ +INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create) +VALUES ('Scenario.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Defendant', + '{"Notice.AAA6.ClaimantIntent.GoToHearing.DefPartAdmit.Defendant", + "Notice.AAA6.ClaimantIntent.GoToHearing.DefPartAdmit.FullDefence.StatesPaid.ClaimantConfirms.Defendant", + "Notice.AAA6.ClaimantIntent.GoToHearing.DefPartAdmit.FullDefence.StatesPaid.PartOrFull.ClaimantDisputes.Defendant", + "Notice.AAA6.ClaimantIntent.GoToHearing.DefFullDefence.ClaimantDisputes.Defendant", + "Notice.AAA6.ClaimantIntent.GoToHearing.DefFullDefence.ClaimantDisputes.NoMediation.Defendant", + "Notice.AAA6.ClaimantIntent.MediationUnsuccessful.Defendant"}', '{"Notice.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Defendant" : []}'); + +/** + * Add notification template + */ +INSERT INTO dbs.dashboard_notifications_templates (template_name, title_En, title_Cy, description_En, description_Cy + ,notification_role) +VALUES ('Notice.AAA6.ClaimantIntent.SDODrawn.PreCaseProgression.Defendant', 'An order has been issued by the court.', 'Mae gorchymyn wedi’i gyhoeddi gan y llys.', + 'Please follow instructions in the order and comply with the deadlines. Please send any documents to the court named in the order if required. The claim will now proceed offline, you will receive further updates by post.
', + 'Dilynwch y cyfarwyddiadau sydd yn y gorchymyn a chydymffurfiwch â’r dyddiadau terfyn. Anfonwch unrhyw ddogfennau i’r llys a enwir yn y gorchymyn os oes angen. Bydd yr hawliad nawr yn parhau all-lein a byddwch yn cael unrhyw ddiweddariadau pellach drwy’r post.
', + 'DEFENDANT'); diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java index a2b426dc262..965fe03d0aa 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java @@ -88,14 +88,15 @@ void shouldRecordScenario_whenInvoked() { CaseData caseData = CaseDataBuilder.builder().atStateTrialReadyCheck().build().toBuilder() .finalOrderDocumentCollection(List.of(ElementUtils.element(CaseDocument.builder().documentLink(Document.builder().documentBinaryUrl("url").build()).build()))) .applicant1Represented(YesOrNo.NO).build(); - CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request( - CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT.name()).build() - ).build(); HashMap