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-14703 Dashboard notification and status accept FullAdmit PayBySetDate #5129

Merged
merged 25 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c5dd8f
CIV-14703 Set up notification and status
kenneth-hmcts Jul 18, 2024
8f93889
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 18, 2024
f6414ea
CIV-14703 Set up unit test
kenneth-hmcts Jul 18, 2024
e65f333
CIV-14703 Set up unit test
kenneth-hmcts Jul 18, 2024
09edb46
CIV-14703 Set up unit test
kenneth-hmcts Jul 18, 2024
cb56b0b
CIV-14703 Set up unit test
kenneth-hmcts Jul 18, 2024
a4b3008
CIV-14703 Set up unit test
kenneth-hmcts Jul 18, 2024
7d6e601
CIV-14703 Update Check style
kenneth-hmcts Jul 18, 2024
336c840
CIV-14703 Add Unit Test
kenneth-hmcts Jul 18, 2024
26a2803
CIV-14703 Add Unit Test
kenneth-hmcts Jul 18, 2024
59d93de
CIV-14703 Add Unit Test
kenneth-hmcts Jul 19, 2024
b40337d
CIV-14703 Add Unit Test
kenneth-hmcts Jul 19, 2024
5c6631f
CIV-14703 Add Unit Test
kenneth-hmcts Jul 19, 2024
3cd3c4a
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 19, 2024
bdf2709
CIV-14703 Update from review
kenneth-hmcts Jul 22, 2024
deca443
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 22, 2024
5f652cb
CIV-14703 Remove unused import
kenneth-hmcts Jul 22, 2024
f0b96fa
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 22, 2024
6ed53e2
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 22, 2024
9d1fbfe
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 23, 2024
79a8a81
CIV-14736 Update condition for CCJ
kenneth-hmcts Jul 23, 2024
04c020a
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 23, 2024
c554ec8
Merge branch 'master' into bug/CIV-14703
kenneth-hmcts Jul 23, 2024
7121dac
Merge branch 'master' into bug/CIV-14703
sankhajuria Jul 24, 2024
2c10ed0
Merge branch 'master' into bug/CIV-14703
sankhajuria Jul 24, 2024
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 @@ -37,6 +37,7 @@
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_SETTLEMENT_AGREEMENT_CLAIMANT_REJECTS_COURT_AGREES_WITH_CLAIMANT_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_REJECTED_NOT_PAID_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_REQUEST_CCJ_CLAIMANT_REJECTS_DEF_PLAN_CLAIMANT_DISAGREES_COURT_PLAN_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_REQUESTED_CCJ_CLAIMANT_ACCEPTED_DEFENDANT_PLAN_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_REJECT_REPAYMENT_ORG_LTD_CO_DEFENDANT;

@Service
Expand Down Expand Up @@ -90,6 +91,8 @@ public String getScenario(CaseData caseData) {
}
} else if (isClaimantRejectRepaymentPlan(caseData)) {
return SCENARIO_AAA6_CLAIMANT_INTENT_REJECT_REPAYMENT_ORG_LTD_CO_DEFENDANT.getScenario();
} else if (isLrvLipPartFullAdmitAndPayByPlan(caseData)) {
return SCENARIO_AAA6_CLAIMANT_INTENT_REQUESTED_CCJ_CLAIMANT_ACCEPTED_DEFENDANT_PLAN_DEFENDANT.getScenario();
}
return null;
}
Expand Down Expand Up @@ -185,4 +188,11 @@ private boolean isClaimantRejectRepaymentPlan(CaseData caseData) {
private boolean isCarmApplicableForMediation(CaseData caseData) {
return getFeatureToggleService().isCarmEnabledForCase(caseData);
}

private boolean isLrvLipPartFullAdmitAndPayByPlan(CaseData caseData) {
return !featureToggleService.isJudgmentOnlineLive()
&& !caseData.isApplicantLiP()
&& caseData.hasApplicantAcceptedRepaymentPlan()
&& caseData.isCcjRequestJudgmentByAdmission();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ private DashboardClaimInfo translateCaseDataToDashboardClaimInfo(CaseDetails cas

if (caseData.getActiveJudgment() != null) {
item.setCcjRequestedDate(caseData.getActiveJudgment().getCreatedTimestamp());
} else if (caseData.isCcjRequestJudgmentByAdmission()) {
item.setCcjRequestedDate(caseData.getApplicant1ResponseDate());
}

return item;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse;
import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest;
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
Expand All @@ -18,14 +19,15 @@
import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.CCJPaymentDetails;
import uk.gov.hmcts.reform.civil.model.Party;
import uk.gov.hmcts.reform.civil.model.RepaymentPlanLRspec;
import uk.gov.hmcts.reform.civil.model.RespondToClaim;
import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP;
import uk.gov.hmcts.reform.civil.model.citizenui.ClaimantLiPResponse;
import uk.gov.hmcts.reform.civil.model.citizenui.ClaimantMediationLip;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.ClaimantResponseOnCourtDecisionType;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.RepaymentDecisionType;
import uk.gov.hmcts.reform.civil.model.Party;
import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder;
import uk.gov.hmcts.reform.civil.service.DashboardNotificationsParamsMapper;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
Expand All @@ -42,19 +44,20 @@
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_DEFENDANT_DASHBOARD_NOTIFICATION_FOR_CLAIMANT_RESPONSE;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec.FULL_DEFENCE;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec.PART_ADMISSION;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_CLAIM_SETTLED_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_GO_TO_HEARING_DEF_FULL_DEFENCE_CLAIMANT_DISPUTES_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_GO_TO_HEARING_DEF_FULL_DEFENSE_CLAIMANT_DISPUTES_NO_MEDIATION_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_MEDIATION_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_MEDIATION_DEFENDANT_CARM;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_SETTLEMENT_AGREEMENT_CLAIMANT_REJECTS_COURT_AGREES_WITH_CLAIMANT_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_GO_TO_HEARING_PART_ADMIT_FULL_DEFENCE_STATES_PAID_CLAIMANT_CONFIRMS_DEFENDANT;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec.PART_ADMISSION;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_CLAIM_SETTLED_COURT_AGREE_DEFENDANT_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_PART_ADMIT_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_GO_TO_HEARING_DEFENDANT_PART_ADMIT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_REJECTED_NOT_PAID_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_REQUEST_CCJ_CLAIMANT_REJECTS_DEF_PLAN_CLAIMANT_DISAGREES_COURT_PLAN_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_REQUESTED_CCJ_CLAIMANT_ACCEPTED_DEFENDANT_PLAN_DEFENDANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_CLAIMANT_INTENT_REJECT_REPAYMENT_ORG_LTD_CO_DEFENDANT;

@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -636,4 +639,110 @@ void shouldCreateNotificationForDefendantWhenClaimantProceedsCarm() {
ScenarioRequestParams.builder().params(params).build()
);
}

@Test
void shouldCreateNotificationForDefendantWhenClaimantLrAcceptPaymentPlan() {
HashMap<String, Object> params = new HashMap<>();

when(dashboardNotificationsParamsMapper.mapCaseDataToParams(any())).thenReturn(params);
when(featureToggleService.isLipVLipEnabled()).thenReturn(true);
when(featureToggleService.isJudgmentOnlineLive()).thenReturn(false);

CaseData caseData = CaseData.builder()
.legacyCaseReference("reference")
.ccdCaseReference(1000001L)
.ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM)
.respondent1Represented(YesOrNo.NO)
.applicant1AcceptFullAdmitPaymentPlanSpec(YesOrNo.YES)
.ccjPaymentDetails(CCJPaymentDetails.builder()
.ccjPaymentPaidSomeOption(YesOrNo.NO)
.build())
.build();

CallbackParams callbackParams = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.build();

handler.handle(callbackParams);

verify(dashboardApiClient, times(1)).recordScenario(
caseData.getCcdCaseReference().toString(),
SCENARIO_AAA6_CLAIMANT_INTENT_REQUESTED_CCJ_CLAIMANT_ACCEPTED_DEFENDANT_PLAN_DEFENDANT.getScenario(),
"BEARER_TOKEN",
ScenarioRequestParams.builder().params(params).build()
);
}

@Test
void shouldReturnNullWhenNothingIsMatched_Applicant1RejectPaymentPlan() {
HashMap<String, Object> params = new HashMap<>();

when(dashboardNotificationsParamsMapper.mapCaseDataToParams(any())).thenReturn(params);
when(featureToggleService.isLipVLipEnabled()).thenReturn(true);
when(featureToggleService.isJudgmentOnlineLive()).thenReturn(false);

CaseData caseData = CaseData.builder()
.legacyCaseReference("reference")
.ccdCaseReference(1000001L)
.ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM)
.respondent1Represented(YesOrNo.NO)
.applicant1AcceptFullAdmitPaymentPlanSpec(YesOrNo.NO)
.build();

CallbackParams callbackParams = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.build();

var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(callbackParams);
assertThat(response.getErrors()).isNull();
}

@Test
void shouldReturnNullWhenNothingIsMatched_Applicant1NotRepresented() {
HashMap<String, Object> params = new HashMap<>();

when(dashboardNotificationsParamsMapper.mapCaseDataToParams(any())).thenReturn(params);
when(featureToggleService.isLipVLipEnabled()).thenReturn(true);
when(featureToggleService.isJudgmentOnlineLive()).thenReturn(false);

CaseData caseData = CaseData.builder()
.legacyCaseReference("reference")
.ccdCaseReference(1000002L)
.ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM)
.respondent1Represented(YesOrNo.NO)
.applicant1Represented(YesOrNo.NO)
.applicant1AcceptFullAdmitPaymentPlanSpec(YesOrNo.NO)
.build();

CallbackParams callbackParams = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.build();

var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(callbackParams);
assertThat(response.getErrors()).isNull();
}

@Test
void shouldReturnNullWhenNothingIsMatched_JudgmentOnlineIsSet() {
HashMap<String, Object> params = new HashMap<>();

when(dashboardNotificationsParamsMapper.mapCaseDataToParams(any())).thenReturn(params);
when(featureToggleService.isLipVLipEnabled()).thenReturn(true);
when(featureToggleService.isJudgmentOnlineLive()).thenReturn(true);

CaseData caseData = CaseData.builder()
.legacyCaseReference("reference")
.ccdCaseReference(1000003L)
.ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM)
.respondent1Represented(YesOrNo.NO)
.applicant1AcceptFullAdmitPaymentPlanSpec(YesOrNo.NO)
.build();

CallbackParams callbackParams = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.build();

var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(callbackParams);
assertThat(response.getErrors()).isNull();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import org.mockito.quality.Strictness;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
import uk.gov.hmcts.reform.ccd.client.model.SearchResult;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.CCJPaymentDetails;
import uk.gov.hmcts.reform.civil.model.ClaimValue;
import uk.gov.hmcts.reform.civil.model.Party;
import uk.gov.hmcts.reform.civil.model.RespondToClaimAdmitPartLRspec;
Expand Down Expand Up @@ -279,6 +281,35 @@ void shouldIncludeCcjCreationDateDateWhenItExists() {
assertThat(claimsForDefendant.getClaims().get(0).getCcjRequestedDate()).isEqualTo(DATE_IN_2025);
}

@Test
void shouldIncludeCcjCreationDateDateForCcjJourneyWhenActiveJudgmentNotExist() {
given(caseDetailsConverter.toCaseData(CASE_DETAILS))
.willReturn(CaseData.builder()
.applicant1(Party.builder()
.individualFirstName("Harry")
.individualLastName("Porter")
.type(Party.Type.INDIVIDUAL)
.build())
.respondent1(Party.builder()
.individualFirstName(
"James")
.individualLastName("Bond")
.type(Party.Type.INDIVIDUAL)
.build())
.applicant1ResponseDate(DATE_IN_2025)
.ccjPaymentDetails(CCJPaymentDetails.builder()
.ccjPaymentPaidSomeOption(YesOrNo.NO)
.build())
.build());
DashboardResponse claimsForDefendant = dashboardClaimInfoService.getDashboardDefendantResponse(
"authorisation",
"123",
CURRENT_PAGE_NO
);
assertThat(claimsForDefendant.getClaims().size()).isEqualTo(3);
assertThat(claimsForDefendant.getClaims().get(0).getCcjRequestedDate()).isEqualTo(DATE_IN_2025);
}

@Test
void shouldGetThePartPaymentImmediateValue() {
given(caseDetailsConverter.toCaseData(CASE_DETAILS))
Expand Down
Loading