Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-14300 And CIV-14210 Bug Fixes #5127

Merged
merged 19 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void should_enable_view_documents_task_list_when_claimant_uploads_document_scena
jsonPath("$[0].categoryEn").value("Hearing"),
jsonPath("$[0].role").value("CLAIMANT"),
jsonPath("$[0].taskOrder").value("11"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">View documents</a>"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">Gweld y dogfennau</a>"),
jsonPath("$[0].currentStatusCy").value("Ar gael"),
jsonPath("$[0].categoryCy").value("Hearing")
jsonPath("$[0].categoryCy").value("Gwrandawiad")
);
}

Expand Down Expand Up @@ -88,9 +88,9 @@ void should_enable_view_documents_task_list_when_defendant_uploads_document_scen
jsonPath("$[0].categoryEn").value("Hearing"),
jsonPath("$[0].role").value("CLAIMANT"),
jsonPath("$[0].taskOrder").value("11"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">View documents</a>"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">Gweld y dogfennau</a>"),
jsonPath("$[0].currentStatusCy").value("Ar gael"),
jsonPath("$[0].categoryCy").value("Hearing")
jsonPath("$[0].categoryCy").value("Gwrandawiad")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,62 @@ public class TrialArrangementsNotifyOtherPartyScenarioTest extends CaseProgressi

@Test
void should_create_notification_for_claimant_when_defendant_finalises_trial_arrangements() throws Exception {
String caseId = "10002348";
CaseData caseData = createCaseData(caseId, YesOrNo.NO);

handler.handle(callbackParams(caseData));

verifyNotificationCreated(caseId);
verifyTaskStatus(caseId, "DEFENDANT", TaskStatus.DONE);
}

@Test
void should_update_task_list_for_defendant_when_defendant_finalises_trial_arrangements() throws Exception {
String caseId = "10002348";
CaseData caseData = CaseDataBuilder.builder().atStateAwaitingResponseNotFullDefenceReceived().build()
CaseData caseData = createCaseData(caseId, YesOrNo.YES);

handler.handle(callbackParams(caseData));

verifyNotificationNotCreated(caseId);
verifyTaskStatus(caseId, "DEFENDANT", TaskStatus.DONE);
}

private CaseData createCaseData(String caseId, YesOrNo applicant1Represented) {
return CaseDataBuilder.builder().atStateAwaitingResponseNotFullDefenceReceived().build()
.toBuilder()
.legacyCaseReference("reference")
.ccdCaseReference(Long.valueOf(caseId))
.applicant1Represented(YesOrNo.NO)
.applicant1Represented(applicant1Represented)
.respondent1(Party.builder().type(Party.Type.INDIVIDUAL).build())
.build();
}

handler.handle(callbackParams(caseData));

//Verify Notification is created
private void verifyNotificationCreated(String caseId) throws Exception {
doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "CLAIMANT")
.andExpect(status().isOk())
.andExpectAll(
status().is(HttpStatus.OK.value()),
jsonPath("$[0].titleEn").value("The other side has confirmed their trial arrangements"),
jsonPath("$[0].titleCy").value("Mae'r parti arall wedi cadarnhau eu trefniadau treial"),
jsonPath("$[0].descriptionEn")
.value(
"<p class=\"govuk-body\">You can <a href=\"{VIEW_ORDERS_AND_NOTICES_REDIRECT}\" class=\"govuk-link\">view the arrangements that they've confirmed</a>.</p>"),
jsonPath("$[0].descriptionCy")
.value(
"<p class=\"govuk-body\">Gallwch <a href=\"{VIEW_ORDERS_AND_NOTICES_REDIRECT}\" class=\"govuk-link\">weld y trefniadau y maent wedi'u cadarnhau</a>.</p>")
jsonPath("$[0].descriptionEn").value("<p class=\"govuk-body\">You can <a href=\"{VIEW_ORDERS_AND_NOTICES_REDIRECT}\" class=\"govuk-link\">view the arrangements that they've confirmed</a>.</p>"),
jsonPath("$[0].descriptionCy").value("<p class=\"govuk-body\">Gallwch <a href=\"{VIEW_ORDERS_AND_NOTICES_REDIRECT}\" class=\"govuk-link\">weld y trefniadau y maent wedi'u cadarnhau</a>.</p>")
);
}

private void verifyNotificationNotCreated(String caseId) throws Exception {
doGet(BEARER_TOKEN, GET_NOTIFICATIONS_URL, caseId, "CLAIMANT")
.andExpect(status().isOk())
.andExpect(jsonPath("$").isEmpty());
}

doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, "DEFENDANT")
private void verifyTaskStatus(String caseId, String role, TaskStatus status) throws Exception {
doGet(BEARER_TOKEN, GET_TASKS_ITEMS_URL, caseId, role)
.andExpectAll(
status().is(HttpStatus.OK.value()),
jsonPath("$[0].reference").value(caseId.toString()),
jsonPath("$[0].taskNameEn").value(
"<a>Add the trial arrangements</a>"),
jsonPath("$[0].currentStatusEn").value(TaskStatus.DONE.getName()),
jsonPath("$[0].taskNameCy").value(
"<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[0].currentStatusCy").value(TaskStatus.DONE.getWelshName())
jsonPath("$[0].reference").value(caseId),
jsonPath("$[0].taskNameEn").value("<a>Add the trial arrangements</a>"),
jsonPath("$[0].currentStatusEn").value(status.getName()),
jsonPath("$[0].taskNameCy").value("<a>Ychwanegu trefniadau'r treial</a>"),
jsonPath("$[0].currentStatusCy").value(status.getWelshName())
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ void should_enable_view_documents_task_list_when_defendant_uploads_document_scen
jsonPath("$[0].categoryEn").value("Hearing"),
jsonPath("$[0].role").value("DEFENDANT"),
jsonPath("$[0].taskOrder").value("11"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">View documents</a>"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">Gweld y dogfennau</a>"),
jsonPath("$[0].currentStatusCy").value("Ar gael"),
jsonPath("$[0].categoryCy").value("Hearing")
jsonPath("$[0].categoryCy").value("Gwrandawiad")
);
}

Expand Down Expand Up @@ -88,9 +88,9 @@ void should_enable_view_documents_task_list_when_claimant_uploads_document_scena
jsonPath("$[0].categoryEn").value("Hearing"),
jsonPath("$[0].role").value("DEFENDANT"),
jsonPath("$[0].taskOrder").value("11"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">View documents</a>"),
jsonPath("$[0].taskNameCy").value("<a href=\"{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}\" class=\"govuk-link\">Gweld y dogfennau</a>"),
jsonPath("$[0].currentStatusCy").value("Ar gael"),
jsonPath("$[0].categoryCy").value("Hearing")
jsonPath("$[0].categoryCy").value("Gwrandawiad")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ public enum DashboardScenarios {
SCENARIO_AAA6_UPDATE_DASHBOARD_DEFENDANT_TASK_LIST_UPLOAD_DOCUMENTS_FINAL_ORDERS("Scenario.AAA6.Update.Defendant.TaskList.UploadDocuments.FinalOrders"),
SCENARIO_AAA6_UPDATE_DASHBOARD_CLAIMANT_TASK_LIST_UPLOAD_DOCUMENTS_FINAL_ORDERS("Scenario.AAA6.Update.Claimant.TaskList.UploadDocuments.FinalOrders"),
SCENARIO_AAA6_DECISION_REQUEST_FOR_RECONSIDERATION_CLAIMANT("Scenario.AAA6.CP.ReconDecisionMade.Claimant"),
SCENARIO_AAA6_DECISION_REQUEST_FOR_RECONSIDERATION_DEFENDANT("Scenario.AAA6.CP.ReconDecisionMade.Defendant");
SCENARIO_AAA6_DECISION_REQUEST_FOR_RECONSIDERATION_DEFENDANT("Scenario.AAA6.CP.ReconDecisionMade.Defendant"),
SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_LR_CLAIMANT("Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Lr.Claimant");

private final String scenario;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DASHBOARD_NOTIFICATION_TRIAL_ARRANGEMENTS_NOTIFY_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_LR_CLAIMANT;

@Service
public class TrialArrangementsNotifyOtherPartyNotificationHandler extends CaseProgressionDashboardCallbackHandler {
Expand All @@ -39,11 +40,8 @@ public List<CaseEvent> handledEvents() {

@Override
public String getScenario(CaseData caseData) {
return SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_CLAIMANT.getScenario();
}

@Override
public boolean shouldRecordScenario(CaseData caseData) {
return caseData.isApplicantNotRepresented();
return caseData.isApplicantNotRepresented()
? SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_CLAIMANT.getScenario()
: SCENARIO_AAA6_CP_TRIAL_ARRANGEMENTS_NOTIFY_OTHER_PARTY_LR_CLAIMANT.getScenario();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
VALUES ('Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant',
'{"Notice.AAA6.CP.Trial.Arrangements.Required.BothParties"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Required.Defendant"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant" : []}');

/**
Expand All @@ -20,4 +20,4 @@ VALUES ('Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.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>Add the trial arrangements</a>', 'Hearing' ,'<a>Ychwanegu trefniadau''r treial</a>',
'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant', '{7, 7}', 'DEFENDANT', 12);
'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant', '{7, 7}', 'DEFENDANT', 11);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
VALUES ('Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant',
'{"Notice.AAA6.CP.Trial.Arrangements.Required.BothParties"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Required.Claimant"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant" : []}');

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
*/
INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
VALUES ('Scenario.AAA6.CP.Bundle.Ready.Claimant',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant", "Notice.AAA6.CP.Trial.Arrangements.Required.Claimant"}',
'{"Notice.AAA6.CP.Bundle.Ready.Claimant" : []}'),
('Scenario.AAA6.CP.Bundle.Ready.Defendant',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant", "Notice.AAA6.CP.Trial.Arrangements.Required.Defendant"}',
'{"Notice.AAA6.CP.Bundle.Ready.Defendant" : []}'),
('Scenario.AAA6.CP.Bundle.Ready.TrialReady.Claimant',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Defendant", "Notice.AAA6.CP.Trial.Arrangements.Required.Claimant"}',
'{"Notice.AAA6.CP.Bundle.Ready.Claimant" : []}'),
('Scenario.AAA6.CP.Bundle.Ready.TrialReady.Defendant',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant"}',
'{"Notice.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Claimant", "Notice.AAA6.CP.Trial.Arrangements.Required.Defendant"}',
'{"Notice.AAA6.CP.Bundle.Ready.Defendant" : []}');

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ VALUES ('Scenario.AAA6.CP.HearingDocuments.Uploaded.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, hint_text_en, hint_text_cy)
values ('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>',
'Hearing', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.Uploaded.Claimant','{3, 3}', 'CLAIMANT', 11, null, null),
('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>',
'Hearing', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.NotUploaded.Claimant','{3, 3}', 'CLAIMANT', 11, null, null),
('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>',
'Hearing', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.NotUploaded.Defendant','{3, 3}', 'DEFENDANT', 11, null, null),
('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>',
'Hearing', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.Uploaded.Defendant','{3, 3}', 'DEFENDANT', 11, null, null);
values ('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">Gweld y dogfennau</a>',
'Gwrandawiad', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.Uploaded.Claimant','{3, 3}', 'CLAIMANT', 11, null, null),
('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">Gweld y dogfennau</a>',
'Gwrandawiad', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.NotUploaded.Claimant','{3, 3}', 'CLAIMANT', 11, null, null),
('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">Gweld y dogfennau</a>',
'Gwrandawiad', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.NotUploaded.Defendant','{3, 3}', 'DEFENDANT', 11, null, null),
('<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">View documents</a>', 'Hearing' ,'<a href="{VIEW_EVIDENCE_UPLOAD_DOCUMENTS}" class="govuk-link">Gweld y dogfennau</a>',
'Gwrandawiad', 'Hearing.Document.View', 'Scenario.AAA6.CP.HearingDocuments.Uploaded.Defendant','{3, 3}', 'DEFENDANT', 11, null, null);
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Add scenario
*/
INSERT INTO dbs.scenario (name, notifications_to_delete, notifications_to_create)
VALUES ('Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Lr.Claimant',
'{"Notice.AAA6.CP.Trial.Arrangements.Required.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>Add the trial arrangements</a>', 'Hearing' ,'<a>Ychwanegu trefniadau''r treial</a>',
'Gwrandawiad', 'Hearing.Arrangements.Add', 'Scenario.AAA6.CP.Trial.Arrangements.Finalised.NotifyOtherParty.Lr.Claimant', '{7, 7}', 'DEFENDANT', 11);
Loading
Loading