From 16547540cc9107d2ab630cd37735b29d06daca38 Mon Sep 17 00:00:00 2001
From: kalachandrasekar1 <114995593+kalachandrasekar1@users.noreply.github.com>
Date: Thu, 14 Nov 2024 09:36:37 +0000
Subject: [PATCH] CIV-15692 JBA CoSc link visible (#5772)
* CIV-15682 changes
* CIV-15692 db script name update
---------
Co-authored-by: krishnanuthalapati <32389208+krishnanuthalapati@users.noreply.github.com>
Co-authored-by: sherlynkhaw
---
...ByAdmissionIssuedClaimantScenarioTest.java | 99 ++++++++++++++-----
.../DashboardScenarios.java | 1 +
...dClaimantDashboardNotificationHandler.java | 4 +-
..._judgment_by_admission_issued_claimant.sql | 37 +++++++
...imantDashboardNotificationHandlerTest.java | 8 +-
5 files changed, 121 insertions(+), 28 deletions(-)
create mode 100644 src/main/resources/db/migration/V2024_11_11_1040__CIV-15682_update_judgment_by_admission_issued_claimant.sql
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/JudgementByAdmissionIssuedClaimantScenarioTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/JudgementByAdmissionIssuedClaimantScenarioTest.java
index c6037a71286..8d84cb2ac76 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/JudgementByAdmissionIssuedClaimantScenarioTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/dashboard/scenarios/claimant/JudgementByAdmissionIssuedClaimantScenarioTest.java
@@ -14,6 +14,7 @@
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentState;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentType;
import uk.gov.hmcts.reform.civil.sampledata.PartyBuilder;
+import uk.gov.hmcts.reform.dashboard.data.TaskStatus;
import java.time.LocalDate;
@@ -32,29 +33,9 @@ public class JudgementByAdmissionIssuedClaimantScenarioTest extends DashboardBa
void should_create_scenario_jo_notification_for_claimant() throws Exception {
String caseId = "6532987";
- CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build()
- .toBuilder()
- .legacyCaseReference("reference")
- .ccdCaseReference(Long.valueOf(caseId))
- .applicant1Represented(YesOrNo.NO)
- .respondent1Represented(YesOrNo.NO)
- .applicant1AcceptPartAdmitPaymentPlanSpec(YesOrNo.YES)
- .defendantDetailsSpec(DynamicList.builder()
- .value(DynamicListElement.builder()
- .label("John Doe")
- .build())
- .build())
- .respondent1(PartyBuilder.builder().organisation().build())
- .activeJudgment(JudgmentDetails.builder().issueDate(LocalDate.now())
- .state(JudgmentState.ISSUED)
- .type(JudgmentType.JUDGMENT_BY_ADMISSION)
- .build())
- .build();
-
+ CaseData caseData = getCaseData(caseId);
when(featureToggleService.isJudgmentOnlineLive()).thenReturn(true);
-
handler.handle(callbackParams(caseData));
-
//Verify Notification is created
doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, CLAIMANT)
.andExpect(status().isOk())
@@ -75,6 +56,80 @@ void should_create_scenario_jo_notification_for_claimant() throws Exception {
"
Unwaith y byddant yn gwneud hynny, dylech gadarnhau eu " +
"bod wedi talu’r swm llawn sy’n ddyledus i chi.
Os na fyddant yn eich talu erbyn y dyddiad ar y dyfarniad, gallwch " +
"ofyn am gymryd camau gorfodi yn eu herbyn.
Os oes arnoch angen newid y telerau talu o fewn y dyfarniad, " +
- "fel y rhandaliadau roeddech wedi cytuno arnynt yn flaenorol, gallwch wneud cais i amrywio’r dyfarniad.
"));
+ "fel y rhandaliadau roeddech wedi cytuno arnynt yn flaenorol, gallwch wneud cais i amrywio’r dyfarniad.")
+ );
+ }
+
+ @Test
+ void shouldUpdateJudgmentByAdmissionTaskList() throws Exception {
+
+ String caseId = "720165773";
+ CaseData caseData = getCaseData(caseId);
+ when(featureToggleService.isJudgmentOnlineLive()).thenReturn(true);
+ handler.handle(callbackParams(caseData));
+ handler.handle(callbackParams(caseData));
+ //Verify task Item is created
+ doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "CLAIMANT")
+ .andExpectAll(
+ status().is(HttpStatus.OK.value()),
+ jsonPath("$[0].reference").value(caseId.toString()),
+ jsonPath("$[0].taskNameEn").value("View the hearing"),
+ jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[0].taskNameCy").value("Gweld y gwrandawiad"),
+ jsonPath("$[0].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
+ jsonPath("$[1].reference").value(caseId.toString()),
+ jsonPath("$[1].taskNameEn").value("Upload hearing documents"),
+ jsonPath("$[1].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[1].taskNameCy").value("Llwytho dogfennau'r gwrandawiad"),
+ jsonPath("$[1].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
+ jsonPath("$[2].reference").value(caseId.toString()),
+ jsonPath("$[2].taskNameEn").value("View documents"),
+ jsonPath("$[2].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[2].taskNameCy").value("Gweld y dogfennau"),
+ jsonPath("$[2].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
+ jsonPath("$[3].reference").value(caseId.toString()),
+ jsonPath("$[3].taskNameEn").value("Add the trial arrangements"),
+ jsonPath("$[3].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[3].taskNameCy").value("Ychwanegu trefniadau'r treial"),
+ jsonPath("$[3].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
+ jsonPath("$[4].reference").value(caseId.toString()),
+ jsonPath("$[4].taskNameEn").value("View the bundle"),
+ jsonPath("$[4].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
+ jsonPath("$[4].taskNameCy").value("Gweld y bwndel"),
+ jsonPath("$[4].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
+ jsonPath("$[5].reference").value(caseId.toString()),
+ jsonPath("$[5].taskNameEn")
+ .value("View orders and notices"),
+ jsonPath("$[5].currentStatusEn").value(TaskStatus.AVAILABLE.getName()),
+ jsonPath("$[5].taskNameCy")
+ .value("Gweld gorchmynion a rhybuddion"),
+ jsonPath("$[5].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName()),
+ jsonPath("$[6].reference").value(caseId.toString()),
+ jsonPath("$[6].taskNameEn").value("View the judgment"),
+ jsonPath("$[6].currentStatusEn").value(TaskStatus.AVAILABLE.getName()),
+ jsonPath("$[6].taskNameCy").value("Gweld y Dyfarniad"),
+ jsonPath("$[6].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName())
+ );
+ }
+
+ private CaseData getCaseData(String caseId) {
+ return CaseDataBuilder.builder().atStateClaimDetailsNotified().build()
+ .toBuilder()
+ .legacyCaseReference("reference")
+ .ccdCaseReference(Long.valueOf(caseId))
+ .applicant1Represented(YesOrNo.NO)
+ .respondent1Represented(YesOrNo.NO)
+ .applicant1AcceptPartAdmitPaymentPlanSpec(YesOrNo.YES)
+ .defendantDetailsSpec(DynamicList.builder()
+ .value(DynamicListElement.builder()
+ .label("John Doe")
+ .build())
+ .build())
+ .respondent1(PartyBuilder.builder().organisation().build())
+ .activeJudgment(JudgmentDetails.builder().issueDate(LocalDate.now())
+ .state(JudgmentState.ISSUED)
+ .type(JudgmentType.JUDGMENT_BY_ADMISSION)
+ .build())
+ .build();
}
}
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 92d47928b89..44b55b1c20e 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
@@ -204,6 +204,7 @@ public enum DashboardScenarios {
SCENARIO_AAA6_PROOF_OF_DEBT_PAYMENT_APPLICATION_PROCESSED_DEFENDANT("Scenario.AAA6.ProofofDebtPayment.ApplicationProcessed.Defendant"),
SCENARIO_AAA6_PROOF_OF_DEBT_PAYMENT_APPLICATION_CLAIMANT("Scenario.AAA6.ProofofDebtPayment.Application.Claimant"),
SCENARIO_AAA6_PROOF_OF_DEBT_PAYMENT_APPLICATION_DEFENDANT("Scenario.AAA6.ProofofDebtPayment.Application.Defendant"),
+ SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT("Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant"),
SCENARIO_AAA6_CP_STAY_LIFTED_CLAIMANT("Scenario.AAA6.CP.Stay.Lifted.Claimant"),
SCENARIO_AAA6_CP_STAY_LIFTED_DEFENDANT("Scenario.AAA6.CP.Stay.Lifted.Defendant"),
SCENARIO_AAA6_UPDATE_CASE_PROCEED_IN_CASE_MAN_DEFENDANT("Scenario.AAA6.Update.CaseProceedsInCaseman.Defendant"),
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandler.java
index d024003f171..5617339db89 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandler.java
@@ -14,7 +14,7 @@
import java.util.List;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_JUDGEMENT_BY_ADMISSION_CLAIMANT;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT;
+import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT;
@Service
public class JudgementByAdmissionIssuedClaimantDashboardNotificationHandler extends DashboardJudgementOnlineCallbackHandler {
@@ -43,7 +43,7 @@ public List handledEvents() {
public String getScenario(CaseData caseData) {
if (isJudgmentOrderIssued(caseData)) {
return
- SCENARIO_AAA6_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario();
+ SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario();
}
return null;
}
diff --git a/src/main/resources/db/migration/V2024_11_11_1040__CIV-15682_update_judgment_by_admission_issued_claimant.sql b/src/main/resources/db/migration/V2024_11_11_1040__CIV-15682_update_judgment_by_admission_issued_claimant.sql
new file mode 100644
index 00000000000..0ec15ddc2c9
--- /dev/null
+++ b/src/main/resources/db/migration/V2024_11_11_1040__CIV-15682_update_judgment_by_admission_issued_claimant.sql
@@ -0,0 +1,37 @@
+/**
+ * Add scenario
+ */
+INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
+VALUES ('Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant',
+ '{"Notice.AAA6.ClaimantIntent.CCJ.Requested.Claimant",
+ "Notice.AAA6.ClaimantIntent.RequestedCCJ.ClaimantAcceptedDefendantPlan.Claimant",
+ "Notice.AAA6.ClaimantIntent.RequestCCJ.ClaimantAcceptOrRejectPlan.SettlementRequested.NoDefResponse.Claimant",
+ "Notice.AAA6.ClaimantIntent.RequestCCJ.ClaimantAcceptOrRejectPlan.SettlementRequested.DefPaymentMissed.Claimant"}',
+ '{"Notice.AAA6.JudgmentsOnline.IssuedCCJ.Claimant": ["djClaimantNotificationMessage", "djClaimantNotificationMessageCy"]}');
+
+/**
+ * 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 ('View the hearing', 'Hearing',
+ 'Gweld y gwrandawiad', 'Gwrandawiad',
+ 'Hearing.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 8),
+ ('Upload hearing documents', 'Hearing',
+ 'Llwytho dogfennau''r gwrandawiad', 'Gwrandawiad',
+ 'Hearing.Document.Upload', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 9),
+ ('View documents', 'Hearing',
+ 'Gweld y dogfennau', 'Gwrandawiad',
+ 'Hearing.Document.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 10),
+ ('Add the trial arrangements', 'Hearing',
+ 'Ychwanegu trefniadau''r treial', 'Gwrandawiad',
+ 'Hearing.Arrangements.Add', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 11),
+ ('View the bundle', 'Hearing',
+ 'Gweld y bwndel', 'Gwrandawiad',
+ 'Hearing.Bundle.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 12),
+ ('View orders and notices', 'Orders and notices from the court',
+ 'Gweld gorchmynion a rhybuddion', 'Gorchmynion a rhybuddion gan y llys',
+ 'Order.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{3, 3}', 'CLAIMANT', 13),
+ ('View the judgment', 'Judgments from the court',
+ 'Gweld y Dyfarniad', 'Dyfarniadau gan y llys',
+ 'Judgment.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{3, 3}', 'CLAIMANT', 14);
diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandlerTest.java
index c1b0651dd8b..66a48b5deb9 100644
--- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandlerTest.java
+++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/JudgementByAdmissionIssuedClaimantDashboardNotificationHandlerTest.java
@@ -33,7 +33,7 @@
import static org.mockito.Mockito.when;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_JUDGEMENT_BY_ADMISSION_CLAIMANT;
-import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT;
+import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT;
@ExtendWith(MockitoExtension.class)
class JudgementByAdmissionIssuedClaimantDashboardNotificationHandlerTest extends BaseCallbackHandlerTest {
@@ -104,7 +104,7 @@ void shouldCreateDashboardNotifications_WhenLipvsLipIndividualOrSoleTraderWithJo
handler.handle(callbackParams);
verify(dashboardApiClient, times(1)).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario(),
+ SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(params).build()
);
@@ -143,7 +143,7 @@ void shouldCreateDashboardNotifications_WhenLipvsLipCompanyOrOrganisationWithRep
handler.handle(callbackParams);
verify(dashboardApiClient, times(1)).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario(),
+ SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(params).build()
);
@@ -176,7 +176,7 @@ void shouldNotCreateDashboardNotifications_WhenLRClaimant() {
handler.handle(callbackParams);
verify(dashboardApiClient, times(0)).recordScenario(
caseData.getCcdCaseReference().toString(),
- SCENARIO_AAA6_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario(),
+ SCENARIO_AAA6_UPDATE_JUDGEMENTS_ONLINE_ISSUED_CCJ_CLAIMANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(params).build()
);