Skip to content

Commit

Permalink
CIV-15692 JBA CoSc link visible (#5772)
Browse files Browse the repository at this point in the history
* CIV-15682 changes
* CIV-15692 db script name update
---------

Co-authored-by: krishnanuthalapati <[email protected]>
Co-authored-by: sherlynkhaw <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2024
1 parent 90b8d5c commit 1654754
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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())
Expand All @@ -75,6 +56,80 @@ void should_create_scenario_jo_notification_for_claimant() throws Exception {
"<br> Unwaith y byddant yn gwneud hynny, dylech <a href=\"{CONFIRM_YOU_HAVE_BEEN_PAID_URL}\" class=\"govuk-link\">gadarnhau eu " +
"bod wedi talu’r swm llawn sy’n ddyledus i chi</a>.<br>Os na fyddant yn eich talu erbyn y dyddiad ar y dyfarniad, gallwch " +
"<u>ofyn am gymryd camau gorfodi yn eu herbyn</u>. <br>Os oes arnoch angen newid y telerau talu o fewn y dyfarniad, " +
"fel y rhandaliadau roeddech wedi cytuno arnynt yn flaenorol, gallwch <u>wneud cais i amrywio’r dyfarniad</u>.</p>"));
"fel y rhandaliadau roeddech wedi cytuno arnynt yn flaenorol, gallwch <u>wneud cais i amrywio’r dyfarniad</u>.</p>")
);
}

@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("<a>View the hearing</a>"),
jsonPath("$[0].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
jsonPath("$[0].taskNameCy").value("<a>Gweld y gwrandawiad</a>"),
jsonPath("$[0].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
jsonPath("$[1].reference").value(caseId.toString()),
jsonPath("$[1].taskNameEn").value("<a>Upload hearing documents</a>"),
jsonPath("$[1].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
jsonPath("$[1].taskNameCy").value("<a>Llwytho dogfennau'r gwrandawiad</a>"),
jsonPath("$[1].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
jsonPath("$[2].reference").value(caseId.toString()),
jsonPath("$[2].taskNameEn").value("<a>View documents</a>"),
jsonPath("$[2].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
jsonPath("$[2].taskNameCy").value("<a>Gweld y dogfennau</a>"),
jsonPath("$[2].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
jsonPath("$[3].reference").value(caseId.toString()),
jsonPath("$[3].taskNameEn").value("<a>Add the trial arrangements</a>"),
jsonPath("$[3].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
jsonPath("$[3].taskNameCy").value("<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[3].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
jsonPath("$[4].reference").value(caseId.toString()),
jsonPath("$[4].taskNameEn").value("<a>View the bundle</a>"),
jsonPath("$[4].currentStatusEn").value(TaskStatus.INACTIVE.getName()),
jsonPath("$[4].taskNameCy").value("<a>Gweld y bwndel</a>"),
jsonPath("$[4].currentStatusCy").value(TaskStatus.INACTIVE.getWelshName()),
jsonPath("$[5].reference").value(caseId.toString()),
jsonPath("$[5].taskNameEn")
.value("<a href={VIEW_ORDERS_AND_NOTICES} rel=\"noopener noreferrer\" class=\"govuk-link\">View orders and notices</a>"),
jsonPath("$[5].currentStatusEn").value(TaskStatus.AVAILABLE.getName()),
jsonPath("$[5].taskNameCy")
.value("<a href={VIEW_ORDERS_AND_NOTICES} rel=\"noopener noreferrer\" class=\"govuk-link\">Gweld gorchmynion a rhybuddion</a>"),
jsonPath("$[5].currentStatusCy").value(TaskStatus.AVAILABLE.getWelshName()),
jsonPath("$[6].reference").value(caseId.toString()),
jsonPath("$[6].taskNameEn").value("<a href={VIEW_JUDGEMENT} class=\"govuk-link\">View the judgment</a>"),
jsonPath("$[6].currentStatusEn").value(TaskStatus.AVAILABLE.getName()),
jsonPath("$[6].taskNameCy").value("<a href={VIEW_JUDGEMENT} class=\"govuk-link\">Gweld y Dyfarniad</a>"),
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -43,7 +43,7 @@ public List<CaseEvent> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ('<a>View the hearing</a>', 'Hearing',
'<a>Gweld y gwrandawiad</a>', 'Gwrandawiad',
'Hearing.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 8),
('<a>Upload hearing documents</a>', 'Hearing',
'<a>Llwytho dogfennau''r gwrandawiad</a>', 'Gwrandawiad',
'Hearing.Document.Upload', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 9),
('<a>View documents</a>', 'Hearing',
'<a>Gweld y dogfennau</a>', 'Gwrandawiad',
'Hearing.Document.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 10),
('<a>Add the trial arrangements</a>', 'Hearing',
'<a>Ychwanegu trefniadau''r treial</a>', 'Gwrandawiad',
'Hearing.Arrangements.Add', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 11),
('<a>View the bundle</a>', 'Hearing',
'<a>Gweld y bwndel</a>', 'Gwrandawiad',
'Hearing.Bundle.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{2, 2}', 'CLAIMANT', 12),
('<a href={VIEW_ORDERS_AND_NOTICES} rel="noopener noreferrer" class="govuk-link">View orders and notices</a>', 'Orders and notices from the court',
'<a href={VIEW_ORDERS_AND_NOTICES} rel="noopener noreferrer" class="govuk-link">Gweld gorchmynion a rhybuddion</a>', 'Gorchmynion a rhybuddion gan y llys',
'Order.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{3, 3}', 'CLAIMANT', 13),
('<a href={VIEW_JUDGEMENT} class="govuk-link">View the judgment</a>', 'Judgments from the court',
'<a href={VIEW_JUDGEMENT} class="govuk-link">Gweld y Dyfarniad</a>', 'Dyfarniadau gan y llys',
'Judgment.View', 'Scenario.AAA6.Update.JudgmentsOnline.IssuedCCJ.Claimant', '{3, 3}', 'CLAIMANT', 14);
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
);
Expand Down Expand Up @@ -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()
);
Expand Down Expand Up @@ -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()
);
Expand Down

0 comments on commit 1654754

Please sign in to comment.