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-15754 LR JbA Live Feed #5901

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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 @@ -37,7 +37,6 @@
import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.JUDGEMENT_BY_ADMISSION_NON_DIVERGENT_SPEC;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.REQUEST_JUDGEMENT_ADMISSION_SPEC;
import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.isOneVOne;

@Service
@RequiredArgsConstructor
Expand Down Expand Up @@ -120,7 +119,7 @@ private CallbackResponse updateBusinessProcessToReady(CallbackParams callbackPar
data.getCcjPaymentDetails();

if (featureToggleService.isJudgmentOnlineLive()
&& isOneVOne(data)
&& (data.isLipvLipOneVOne() || data.isLRvLipOneVOne())
&& data.isPayImmediately()) {

nextState = CaseState.All_FINAL_ORDERS_ISSUED.name();
Expand All @@ -140,6 +139,7 @@ && isOneVOne(data)
updatedCaseData.setActiveJudgment(judgmentByAdmissionOnlineMapper.addUpdateActiveJudgment(updatedCaseData));
updatedCaseData.setJoIsLiveJudgmentExists(YesOrNo.YES);
updatedCaseData.setJoRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(updatedCaseData.getActiveJudgment()));
updatedCaseData.setIsTakenOfflineAfterJBA(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name().equals(nextState) ? YesOrNo.YES : YesOrNo.NO);
}

return AboutToStartOrSubmitCallbackResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ private Pair<String, BusinessProcess> handleAcceptedRepaymentPlan(CaseData caseD
BusinessProcess businessProcess) {
String nextState;
if (featureToggleService.isJudgmentOnlineLive()
&& (caseData.isPayByInstallment() || caseData.isPayBySetDate())) {
&& (caseData.isPayByInstallment() || caseData.isPayBySetDate())
&& caseData.isLRvLipOneVOne()) {
ShwetaTandel-hmcts marked this conversation as resolved.
Show resolved Hide resolved
nextState = CaseState.All_FINAL_ORDERS_ISSUED.name();
businessProcess = BusinessProcess.ready(JUDGEMENT_BY_ADMISSION_NON_DIVERGENT_SPEC);
} else {
Expand All @@ -129,6 +130,7 @@ private Pair<String, BusinessProcess> handleAcceptedRepaymentPlan(CaseData caseD
builder.activeJudgment(activeJudgment);
builder.joIsLiveJudgmentExists(YesOrNo.YES);
builder.joRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(activeJudgment));
builder.isTakenOfflineAfterJBA(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name().equals(nextState) ? YesOrNo.YES : YesOrNo.NO);
}

return Pair.of(nextState, businessProcess);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ public boolean hasNoOngoingBusinessProcess() {
private YesOrNo joShowRegisteredWithRTLOption;
private JudgmentDetails activeJudgment;
private List<Element<JudgmentDetails>> historicJudgment;
private YesOrNo isTakenOfflineAfterJBA;

private String joDefendantName1;
private String joDefendantName2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ public class EventHistoryMapper {
public static final String BS_END_DATE = "actual end date";
public static final String RPA_REASON_MANUAL_DETERMINATION = "RPA Reason: Manual Determination Required.";
public static final String RPA_REASON_JUDGMENT_BY_ADMISSION = "RPA Reason: Judgment by Admission requested and claim moved offline.";
public static final String RPA_RECORD_JUDGMENT = "Judgment recorded.";
public static final String RECORD_JUDGMENT = "Judgment recorded.";
public static final String RPA_RECORD_JUDGMENT_REASON = "RPA Reason: Judgment recorded.";
public static final String RPA_RECORD_JUDGMENT_OFFLINE = "RPA Reason: Judgment recorded and claim moved offline";
public static final String RPA_IN_MEDIATION = "IN MEDIATION";
static final String ENTER = "Enter";
static final String LIFTED = "Lifted";
Expand Down Expand Up @@ -531,15 +533,20 @@ private void buildCcjEvent(EventHistory.EventHistoryBuilder builder, CaseData ca
buildJudgmentByAdmissionEventDetails(builder, caseData);

String miscTextRequested = RPA_REASON_JUDGMENT_BY_ADMISSION;
String detailsTextRequested = RPA_REASON_JUDGMENT_BY_ADMISSION;
if (featureToggleService.isJOLiveFeedActive()) {
miscTextRequested = RPA_RECORD_JUDGMENT;
miscTextRequested = RECORD_JUDGMENT;
detailsTextRequested = RPA_RECORD_JUDGMENT_REASON;
if (Objects.nonNull(caseData.getIsTakenOfflineAfterJBA()) && YesOrNo.YES.equals(caseData.getIsTakenOfflineAfterJBA())) {
detailsTextRequested = RPA_RECORD_JUDGMENT_OFFLINE;
}
}

builder.miscellaneous((Event.builder()
.eventSequence(prepareEventSequence(builder.build()))
.eventCode(MISCELLANEOUS.getCode())
.dateReceived(setApplicant1ResponseDate(caseData))
.eventDetailsText(miscTextRequested)
.eventDetailsText(detailsTextRequested)
.eventDetails(EventDetails.builder()
.miscText(miscTextRequested)
.build())
Expand Down Expand Up @@ -2286,7 +2293,7 @@ private void buildMiscellaneousDJEvent(EventHistory.EventHistoryBuilder builder,

if (featureToggleService.isJOLiveFeedActive()
&& caseData.getCcdState() == CaseState.All_FINAL_ORDERS_ISSUED) {
miscTextGranted = RPA_RECORD_JUDGMENT;
miscTextGranted = RECORD_JUDGMENT;
}

if (caseData.getDefendantDetailsSpec() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ void shouldSetUpBusinessProcessAndContinueOnlineAndCaseState_whenIsLRvLiP1v1AndP
assertThat(response.getData().get("activeJudgment")).extracting("defendant1Name").isEqualTo("Mr. John Rambo");
assertThat(response.getData().get("activeJudgment")).extracting("defendant1Address").isNotNull();
assertThat(response.getData().get("activeJudgment")).extracting("defendant1Dob").isNotNull();
assertThat(response.getData()).extracting("isTakenOfflineAfterJBA").isEqualTo("No");
}

@Test
Expand Down Expand Up @@ -614,6 +615,7 @@ void shouldSetUpBusinessProcessAndContinueOfflineAndCaseState_whenIs1v2AndPaidIm
.extracting("businessProcess")
.extracting("camundaEvent")
.isEqualTo(REQUEST_JUDGEMENT_ADMISSION_SPEC.name());
assertThat(response.getData()).extracting("isTakenOfflineAfterJBA").isEqualTo("Yes");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ void shouldChangeCaseState_WhenRespondentRepaymentPlanAndFlagV2WithJudgementLive
AboutToStartOrSubmitCallbackResponse response = (AboutToStartOrSubmitCallbackResponse) handler
.handle(params);
assertThat(response.getState())
.isEqualTo(CaseState.All_FINAL_ORDERS_ISSUED.name());
.isEqualTo(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ void shouldSetStateAllFinalOrdersIssuedWhenApplicantAcceptedRepaymentPlan() {
assertEquals(All_FINAL_ORDERS_ISSUED.name(), resultState);
verify(builder).activeJudgment(activeJudgment);
verify(builder).joIsLiveJudgmentExists(YesOrNo.YES);
verify(builder).isTakenOfflineAfterJBA(NO);
sherlynkhaw marked this conversation as resolved.
Show resolved Hide resolved
}

@Test
Expand Down Expand Up @@ -272,6 +273,38 @@ void shouldSetStateCaseStayedWhenItsLipVLipOneVOne() {
assertEquals(CASE_STAYED.name(), resultState);
}

@Test
void shouldSetProceedsInHeritageSystemWhenApplicantAcceptedRepaymentPlanAndNotLrVLip() {

CaseData.CaseDataBuilder<?, ?> builder = mock(CaseData.CaseDataBuilder.class);
BusinessProcess businessProcess = BusinessProcess.builder().build();

CaseData caseData = CaseDataBuilder.builder()
.applicant1AcceptPartAdmitPaymentPlanSpec(YES)
.respondent1Represented(YES)
.applicant1Represented(YES)
.build();
JudgmentDetails activeJudgment = mock(JudgmentDetails.class);

when(activeJudgment.getTotalAmount()).thenReturn("1000");
when(activeJudgment.getOrderedAmount()).thenReturn("500");
when(activeJudgment.getCosts()).thenReturn("150");
when(activeJudgment.getClaimFeeAmount()).thenReturn("50");
when(activeJudgment.getAmountAlreadyPaid()).thenReturn("200");
when(judgmentByAdmissionOnlineMapper.addUpdateActiveJudgment(caseData)).thenReturn(activeJudgment);
when(featureToggleService.isPinInPostEnabled()).thenReturn(true);
when(featureToggleService.isJudgmentOnlineLive()).thenReturn(true);

String resultState = determineNextState.determineNextState(caseData, callbackParams(caseData),
builder, "", businessProcess);

assertNotNull(resultState);
assertEquals(PROCEEDS_IN_HERITAGE_SYSTEM.name(), resultState);
verify(builder).activeJudgment(activeJudgment);
verify(builder).joIsLiveJudgmentExists(YesOrNo.YES);
verify(builder).isTakenOfflineAfterJBA(YES);
}

private CallbackParams callbackParams(CaseData caseData) {

return CallbackParams.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
import static uk.gov.hmcts.reform.civil.service.robotics.RoboticsNotificationService.findLatestEventTriggerReason;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RPA_IN_MEDIATION;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RPA_REASON_JUDGMENT_BY_ADMISSION;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RPA_RECORD_JUDGMENT;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RECORD_JUDGMENT;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RPA_RECORD_JUDGMENT_REASON;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RPA_RECORD_JUDGMENT_OFFLINE;
import static uk.gov.hmcts.reform.civil.service.robotics.mapper.EventHistoryMapper.RPA_REASON_MANUAL_DETERMINATION;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.wrapElements;

Expand Down Expand Up @@ -8499,7 +8501,43 @@ void shouldGenerateRPA_WhenClaimPayImmediately() {
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventCode").asString().contains("999");
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT);
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT_REASON);
}

@Test
void shouldGenerateRPA_WhenLrvLrClaimPayImmediately() {
LocalDate whenWillPay = LocalDate.now().plusDays(5);
CCJPaymentDetails ccjPaymentDetails = buildCcjPaymentDetails();
RespondToClaimAdmitPartLRspec paymentDetails = RespondToClaimAdmitPartLRspec.builder()
.whenWillThisAmountBePaid(whenWillPay)
.build();
CaseData caseData = CaseDataBuilder.builder()
.setClaimTypeToSpecClaim()
.atStateSpec1v1ClaimSubmitted()
.atStateRespondent1v1FullAdmissionSpec().build().toBuilder()
.ccjPaymentDetails(ccjPaymentDetails)
.defenceAdmitPartPaymentTimeRouteRequired(RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY)
.respondToClaimAdmitPartLRspec(paymentDetails)
.totalInterest(BigDecimal.ZERO)
.applicant1ResponseDate(LocalDateTime.now())
.respondent1Represented(YesOrNo.YES)
.specRespondent1Represented(YesOrNo.YES)
.applicant1Represented(YesOrNo.YES)
.isTakenOfflineAfterJBA(YesOrNo.YES)
.ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM)
.build();
when(featureToggleService.isJOLiveFeedActive()).thenReturn(true);
var eventHistory = mapper.buildEvents(caseData, BEARER_TOKEN);
assertThat(eventHistory).isNotNull();
assertThat(eventHistory).extracting("judgmentByAdmission").isNotNull();
assertThat(eventHistory).extracting("judgmentByAdmission").asList()
.extracting("eventCode").asString().contains("240");
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventCode").asString().contains("999");
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetails").extracting("miscText").asString().contains(RECORD_JUDGMENT);
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT_OFFLINE);
}

@Test
Expand Down Expand Up @@ -8528,7 +8566,9 @@ public void shouldGenerateRPA_ForFullAdmit_WhenLipClaimAgreedRepaymentPlan_BySet
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventCode").asString().contains("999");
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT);
.extracting("eventDetails").extracting("miscText").asString().contains(RECORD_JUDGMENT);
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT_REASON);
}

@Test
Expand Down Expand Up @@ -8558,7 +8598,9 @@ public void shouldGenerateRPA_ForFullAdmit_WhenLipClaimAgreedRepaymentPlan_JoLiv
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventCode").asString().contains("999");
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT);
.extracting("eventDetails").extracting("miscText").asString().contains(RECORD_JUDGMENT);
assertThat(eventHistory).extracting("miscellaneous").asList()
.extracting("eventDetailsText").asString().contains(RPA_RECORD_JUDGMENT_REASON);
}

private CCJPaymentDetails buildCcjPaymentDetails() {
Expand Down
Loading