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-14664 Test Service PR to update Judgments Tab in ExUI #5353

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
36ec300
CIV-14664: Changes to update fields required for Judgments Tab
sjamihmcts Aug 23, 2024
780dd01
CIV-14664: Removed TODO statement and removed logic from SetAsideJudg…
sjamihmcts Aug 23, 2024
65b1078
CIV-14664: Fix compile error
sjamihmcts Aug 23, 2024
da1c66e
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 23, 2024
4a94cc7
CIV-14664: Updated Default Judgment logic
sjamihmcts Aug 23, 2024
1745844
Merge remote-tracking branch 'origin/feat/CIV-14664_Service' into fea…
sjamihmcts Aug 23, 2024
77655bf
CIV-14664: Fixed checkstyle errors
sjamihmcts Aug 23, 2024
d9fe92e
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 23, 2024
832853b
CIV-14664: Fixed tests
sjamihmcts Aug 27, 2024
cdcf556
CIV-14664: Fixed tests
sjamihmcts Aug 27, 2024
8f29633
CIV-14664: Fixed tests 1
sjamihmcts Aug 27, 2024
5034e95
CIV-14664: Fixed tests 2
sjamihmcts Aug 27, 2024
2355f1e
CIV-14664: Updated DJ tests
sjamihmcts Aug 27, 2024
ab5c3c5
CIV-14664: Updated unit tests
sjamihmcts Aug 27, 2024
99cd244
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 27, 2024
285c58c
CIV-14664: Initial commit for repaymentBreakdown field logic for Reco…
sjamihmcts Aug 27, 2024
e7ae321
Merge remote-tracking branch 'origin/feat/CIV-14664_Service' into fea…
sjamihmcts Aug 27, 2024
add9c3a
CIV-14664: Logic updated for repaymentBreakdownSummary
sjamihmcts Aug 29, 2024
ae47f29
CIV-14664: Updated tests - 1
sjamihmcts Aug 29, 2024
64d88f3
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 29, 2024
28cf0cb
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 29, 2024
1ef9d9d
Merge remote-tracking branch 'origin/feat/CIV-14664_Service' into fea…
sjamihmcts Aug 29, 2024
9ab88dd
CIV-14664: Fixed checkstyle error
sjamihmcts Aug 29, 2024
b7aaba9
CIV-14664: Fixed unit test
sjamihmcts Aug 29, 2024
87d31fe
CIV-14664: Fixed unit tests
sjamihmcts Aug 29, 2024
31a3057
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 29, 2024
f5503a8
CIV-14664: Pointing to CCD branch
sjamihmcts Aug 29, 2024
28d692f
Merge branch 'master' into feat/CIV-14664_Service_Test
sjamihmcts Aug 29, 2024
d98daf2
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 29, 2024
2c4da84
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 29, 2024
3ed3ddd
Merge branch 'master' into feat/CIV-14664_Service_Test
sjamihmcts Aug 29, 2024
3162f80
CIV-14664: Removed moving to Historic judgment for Edit Judgment
sjamihmcts Aug 29, 2024
a9d0b5f
Merge remote-tracking branch 'origin/feat/CIV-14664_Service' into fea…
sjamihmcts Aug 29, 2024
116324e
CIV-14664: Updated Default Judgment logic to use activeJudgment field…
sjamihmcts Aug 30, 2024
3571ec4
CIV-14664: Code clean up
sjamihmcts Aug 30, 2024
fdd66d5
Merge branch 'master' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
0ba6bf2
Merge branch 'master' into feat/CIV-14664_Service
sjamihmcts Aug 30, 2024
f62d25f
CIV-14664: Removed unused imports
sjamihmcts Aug 30, 2024
5761e96
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
c4e1bfe
Merge remote-tracking branch 'origin/feat/CIV-14664_Service_Test' int…
sjamihmcts Aug 30, 2024
2beb4ce
CIV-14664: Fixed checkstyle errors
sjamihmcts Aug 30, 2024
3a2c31c
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
27c047a
CIV-14664: Fixed checkstyle errors
sjamihmcts Aug 30, 2024
d5656da
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
1bd5a30
CIV-14664: Fixed tests
sjamihmcts Aug 30, 2024
bd8403e
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
25354fe
CIV-14664: Fixed tests
sjamihmcts Aug 30, 2024
0c1270e
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
de837bd
CIV-14664: Changes as per code review comments
sjamihmcts Aug 30, 2024
d973742
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
f044859
CIV-14664: Changes as per code review comments
sjamihmcts Aug 30, 2024
2a11d3b
CIV-14664: Changes as per code review comments
sjamihmcts Aug 30, 2024
9aa9721
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Aug 30, 2024
3478f37
CIV-14664: Reverted few changes
sjamihmcts Sep 1, 2024
d8b7b07
CIV-14664: Reverted few changes
sjamihmcts Sep 1, 2024
a9b312f
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
sjamihmcts Sep 1, 2024
ffcf63b
Merge branch 'master' into feat/CIV-14664_Service
ShwetaTandel-hmcts Sep 3, 2024
b05ebf8
update indentation
ShwetaTandel-hmcts Sep 4, 2024
6149036
Merge branch 'feat/CIV-14664_Service' into feat/CIV-14664_Service_Test
ShwetaTandel-hmcts Sep 4, 2024
cb37fad
Merge branch 'master' into feat/CIV-14664_Service_Test
Azam-Hmcts Sep 4, 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
2 changes: 1 addition & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import uk.gov.hmcts.contino.GithubAPI
def type = "java"
def product = "civil"
def component = "service"
def ccdBranch = "master"
def ccdBranch = "feat/CIV-14664_CCD"
def camundaBranch = "master"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import uk.gov.hmcts.reform.civil.model.RegistrationInformation;
import uk.gov.hmcts.reform.civil.model.common.DynamicList;
import uk.gov.hmcts.reform.civil.model.common.Element;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import uk.gov.hmcts.reform.civil.service.FeesService;
import uk.gov.hmcts.reform.civil.service.Time;
Expand Down Expand Up @@ -426,6 +427,13 @@ private CallbackResponse repaymentValidate(CallbackParams callbackParams) {

private CallbackResponse generateClaimForm(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
if (featureToggleService.isJudgmentOnlineLive()) {
JudgmentDetails activeJudgment = djOnlineMapper.addUpdateActiveJudgment(caseData);
caseData.setActiveJudgment(activeJudgment);
caseData.setJoRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(activeJudgment));
caseData.setJoIsLiveJudgmentExists(YesOrNo.YES);
}

CaseData.CaseDataBuilder caseDataBuilder = caseData.toBuilder();
String nextState;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,20 @@ private CallbackResponse buildConfirmation(CallbackParams callbackParams) {

private CallbackResponse saveJudgmentDetails(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();
List<String> errors = new ArrayList<>();

if (caseData.getJoIsRegisteredWithRTL() == YesOrNo.YES) {
caseData.setJoIssuedDate(caseData.getJoOrderMadeDate());
caseDataBuilder.joIssuedDate(caseData.getJoOrderMadeDate());
}

if (caseData.getActiveJudgment() != null) {
caseData.setActiveJudgment(editJudgmentOnlineMapper.addUpdateActiveJudgment(caseData));
JudgmentDetails activeJudgment = editJudgmentOnlineMapper.addUpdateActiveJudgment(caseData);
caseDataBuilder.activeJudgment(activeJudgment);
caseDataBuilder.joRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(activeJudgment));
} else {
errors.add("There is no active judgment to edit");
}
CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();

if (caseData.getJoJudgmentRecordReason() == JudgmentRecordedReason.DETERMINATION_OF_MEANS) {
caseDataBuilder.businessProcess(BusinessProcess.ready(NOTIFY_JUDGMENT_VARIED_DETERMINATION_OF_MEANS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ private String getBody() {

private CallbackResponse saveJudgmentPaidInFullDetails(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
caseData.setJoIsLiveJudgmentExists(YesOrNo.NO);
paidInFullJudgmentOnlineMapper.moveToHistoricJudgment(caseData);
caseData.setJoIsLiveJudgmentExists(YesOrNo.YES);
caseData.setActiveJudgment(paidInFullJudgmentOnlineMapper.addUpdateActiveJudgment(caseData));
caseData.setJoRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(caseData.getActiveJudgment()));
CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();
return AboutToStartOrSubmitCallbackResponse.builder()
.data(caseDataBuilder.build().toMap(objectMapper))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ private CallbackResponse saveJudgmentDetails(CallbackParams callbackParams) {
caseData.setJoIssuedDate(caseData.getJoOrderMadeDate());
}
caseData.setActiveJudgment(recordJudgmentOnlineMapper.addUpdateActiveJudgment(caseData));
caseData.setJoRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(caseData.getActiveJudgment()));

CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();
if (caseData.getJoJudgmentRecordReason() == JudgmentRecordedReason.DETERMINATION_OF_MEANS) {
caseDataBuilder.businessProcess(BusinessProcess.ready(RECORD_JUDGMENT_NOTIFICATION));
Expand All @@ -110,4 +112,5 @@ private CallbackResponse saveJudgmentDetails(CallbackParams callbackParams) {
public List<CaseEvent> handledEvents() {
return EVENTS;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentByAdmissionOnlineMapper;
import uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper;
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CCJPaymentDetails;
import uk.gov.hmcts.reform.civil.model.CaseData;
Expand Down Expand Up @@ -117,6 +118,7 @@ private CallbackResponse updateBusinessProcessToReady(CallbackParams callbackPar
if (featureToggleService.isJudgmentOnlineLive()) {
data.setActiveJudgment(judgmentByAdmissionOnlineMapper.addUpdateActiveJudgment(data));
data.setJoIsLiveJudgmentExists(YesOrNo.YES);
data.setJoRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(data.getActiveJudgment()));
}

CaseData.CaseDataBuilder caseDataBuilder = data.toBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.helpers.LocationHelper;
import uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentByAdmissionOnlineMapper;
import uk.gov.hmcts.reform.civil.helpers.judgmentsonline.JudgmentsOnlineHelper;
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.RespondToClaim;
Expand All @@ -37,6 +38,7 @@
import uk.gov.hmcts.reform.civil.model.dq.Hearing;
import uk.gov.hmcts.reform.civil.model.dq.RequestedCourt;
import uk.gov.hmcts.reform.civil.model.dq.SmallClaimHearing;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails;
import uk.gov.hmcts.reform.civil.referencedata.model.LocationRefData;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import uk.gov.hmcts.reform.civil.service.JudgementService;
Expand Down Expand Up @@ -428,8 +430,10 @@ && isOneVOne(caseData)) {
nextState = CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name();
}
if (featureToggleService.isJudgmentOnlineLive()) {
builder.activeJudgment(judgmentByAdmissionOnlineMapper.addUpdateActiveJudgment(caseData));
JudgmentDetails activeJudgment = judgmentByAdmissionOnlineMapper.addUpdateActiveJudgment(caseData);
builder.activeJudgment(activeJudgment);
builder.joIsLiveJudgmentExists(YesOrNo.YES);
builder.joRepaymentSummaryObject(JudgmentsOnlineHelper.calculateRepaymentBreakdownSummary(activeJudgment));
}
} else if (caseData.hasApplicantRejectedRepaymentPlan()) {
nextState = CaseState.PROCEEDS_IN_HERITAGE_SYSTEM.name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private CallbackResponse saveJudgmentDetails(CallbackParams callbackParams) {

CaseData caseData = callbackParams.getCaseData();
caseData.setJoIsLiveJudgmentExists(YesOrNo.NO);
caseData.setJoIsDisplayInJudgmentTab(YesOrNo.NO);
setAsideJudgmentOnlineMapper.moveToHistoricJudgment(caseData);

CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentType;
import uk.gov.hmcts.reform.civil.model.judgmentonline.PaymentFrequency;
import uk.gov.hmcts.reform.civil.model.judgmentonline.PaymentPlanSelection;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentRTLStatus;
import uk.gov.hmcts.reform.civil.utils.InterestCalculator;
import uk.gov.hmcts.reform.civil.utils.MonetaryConversions;

Expand All @@ -39,7 +38,7 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {
isNonDivergent = JudgmentsOnlineHelper.isNonDivergentForDJ(caseData);
JudgmentDetails activeJudgment = super.addUpdateActiveJudgment(caseData);
activeJudgment = super.updateDefendantDetails(activeJudgment, caseData);
return activeJudgment.toBuilder()
JudgmentDetails judgmentDetails = activeJudgment.toBuilder()
.createdTimestamp(LocalDateTime.now())
.state(getJudgmentState(caseData))
.type(JudgmentType.DEFAULT_JUDGMENT)
Expand All @@ -53,6 +52,9 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {
.costs(costs.toString())
.totalAmount(orderAmount.add(costs).toString())
.build();
super.updateJudgmentTabDataWithActiveJudgment(judgmentDetails, caseData);

return judgmentDetails;
}

@Override
Expand Down Expand Up @@ -103,4 +105,5 @@ private PaymentPlanSelection getPaymentPlanSeletion(DJPaymentTypeSelection payme
private LocalDate getPaymentDeadLineDate(CaseData caseData) {
return DJPaymentTypeSelection.SET_DATE.equals(caseData.getPaymentTypeSelection()) ? caseData.getPaymentSetDate() : null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentRTLStatus;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentState;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentType;
import uk.gov.hmcts.reform.civil.utils.MonetaryConversions;

import java.math.BigDecimal;

Expand All @@ -21,6 +23,9 @@ public class EditJudgmentOnlineMapper extends JudgmentOnlineMapper {
public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {
BigDecimal orderAmount = JudgmentsOnlineHelper.getMoneyValue(caseData.getJoAmountOrdered());
BigDecimal costs = JudgmentsOnlineHelper.getMoneyValue(caseData.getJoAmountCostOrdered());
BigDecimal claimFeeAmount = JudgmentsOnlineHelper.getMoneyValue(
MonetaryConversions.poundsToPennies(getClaimFeeAmount(caseData)).toString()
);
JudgmentDetails activeJudgment = caseData.getActiveJudgment();
if (activeJudgment != null) {
activeJudgment = activeJudgment.toBuilder()
Expand All @@ -32,12 +37,24 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {
.issueDate(caseData.getJoOrderMadeDate())
.orderedAmount(orderAmount.toString())
.costs(costs.toString())
.totalAmount(orderAmount.add(costs).toString())
.totalAmount(orderAmount.add(costs).add(claimFeeAmount).toString())
.build();
super.updateJudgmentTabDataWithActiveJudgment(activeJudgment, caseData);
}

return activeJudgment;
}

@NotNull
private BigDecimal getClaimFeeAmount(CaseData caseData) {
return caseData.getCcjPaymentDetails() != null
? getValue(caseData.getCcjPaymentDetails().getCcjJudgmentAmountClaimFee()) : BigDecimal.ZERO;
}

private BigDecimal getValue(BigDecimal value) {
return value != null ? value : BigDecimal.ZERO;
}

@Override
protected JudgmentState getJudgmentState(CaseData caseData) {
return JudgmentState.MODIFIED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {

BigDecimal costsInPounds = getCosts(caseData);
BigInteger costs = MonetaryConversions.poundsToPennies(costsInPounds);
BigInteger orderAmount = MonetaryConversions.poundsToPennies(getOrderAmount(caseData, costsInPounds));
BigInteger orderAmount = MonetaryConversions.poundsToPennies(getOrderAmount(caseData));
BigInteger claimFeeAmount = MonetaryConversions.poundsToPennies(getClaimFeeAmount(caseData));
BigInteger totalStillOwed = MonetaryConversions.poundsToPennies(getTotalStillOwed(caseData));
BigInteger amountAlreadyPaid = MonetaryConversions.poundsToPennies(getAmountAlreadyPaid(caseData));
isNonDivergent = JudgmentsOnlineHelper.isNonDivergentForJBA(caseData);
PaymentPlanSelection paymentPlan = getPaymentPlan(caseData);

JudgmentDetails activeJudgment = super.addUpdateActiveJudgment(caseData);
activeJudgment = super.updateDefendantDetails(activeJudgment, caseData);
return activeJudgment.toBuilder()
JudgmentDetails activeJudgmentDetails = activeJudgment.toBuilder()
.createdTimestamp(LocalDateTime.now())
.state(getJudgmentState(caseData))
.type(JudgmentType.JUDGMENT_BY_ADMISSION)
Expand All @@ -57,14 +60,38 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {
.issueDate(LocalDate.now())
.orderedAmount(orderAmount.toString())
.costs(costs.toString())
.totalAmount(orderAmount.add(costs).toString())
.claimFeeAmount(claimFeeAmount.toString())
.amountAlreadyPaid(amountAlreadyPaid.toString())
.totalAmount(orderAmount.add(costs).add(claimFeeAmount).toString())
.build();

super.updateJudgmentTabDataWithActiveJudgment(activeJudgmentDetails, caseData);

return activeJudgmentDetails;
}

@NotNull
private BigDecimal getOrderAmount(CaseData caseData) {
return caseData.getCcjPaymentDetails() != null
? getValue(caseData.getCcjPaymentDetails().getCcjJudgmentAmountClaimAmount()) : BigDecimal.ZERO;
}

@NotNull
private BigDecimal getClaimFeeAmount(CaseData caseData) {
return caseData.getCcjPaymentDetails() != null
? getValue(caseData.getCcjPaymentDetails().getCcjJudgmentAmountClaimFee()) : BigDecimal.ZERO;
}

@NotNull
private BigDecimal getTotalStillOwed(CaseData caseData) {
return caseData.getCcjPaymentDetails() != null
? getValue(caseData.getCcjPaymentDetails().getCcjJudgmentTotalStillOwed()) : BigDecimal.ZERO;
}

@NotNull
private BigDecimal getOrderAmount(CaseData caseData, BigDecimal costs) {
private BigDecimal getAmountAlreadyPaid(CaseData caseData) {
return caseData.getCcjPaymentDetails() != null
? getValue(caseData.getCcjPaymentDetails().getCcjJudgmentTotalStillOwed()).subtract(costs) : BigDecimal.ZERO;
? getValue(caseData.getCcjPaymentDetails().getCcjPaymentPaidSomeAmountInPounds()) : BigDecimal.ZERO;
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import uk.gov.hmcts.reform.civil.model.common.Element;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentDetails;
import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentState;
import uk.gov.hmcts.reform.civil.model.judgmentonline.PaymentPlanSelection;

import java.time.LocalDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -61,6 +62,31 @@ public JudgmentDetails updateDefendantDetails(JudgmentDetails activeJudgment, Ca
return activeJudgment;
}

public void updateJudgmentTabDataWithActiveJudgment(JudgmentDetails activeJudgment, CaseData caseData) {
caseData.setJoIsDisplayInJudgmentTab(YesOrNo.YES);
caseData.setJoDefendantName1(activeJudgment.getDefendant1Name());
caseData.setJoDefendantName2(activeJudgment.getDefendant2Name());
caseData.setJoPaymentPlanSelected(activeJudgment.getPaymentPlan().getType());

if (null != activeJudgment.getPaymentPlan()
&& PaymentPlanSelection.PAY_IN_INSTALMENTS.equals(activeJudgment.getPaymentPlan().getType())) {
caseData.setJoRepaymentAmount(activeJudgment.getInstalmentDetails().getAmount());
caseData.setJoRepaymentStartDate(activeJudgment.getInstalmentDetails().getStartDate());
caseData.setJoRepaymentFrequency(activeJudgment.getInstalmentDetails().getPaymentFrequency());
} else {
caseData.setJoRepaymentAmount(null);
caseData.setJoRepaymentStartDate(null);
caseData.setJoRepaymentFrequency(null);
}

if (JudgmentState.CANCELLED.equals(activeJudgment.getState())
|| JudgmentState.SATISFIED.equals(activeJudgment.getState())) {
caseData.setJoIssueDate(activeJudgment.getIssueDate());
caseData.setJoState(activeJudgment.getState());
caseData.setJoFullyPaymentMadeDate(activeJudgment.getFullyPaymentMadeDate());
}
}

protected abstract JudgmentState getJudgmentState(CaseData caseData);

private Integer getNextJudgmentId(CaseData caseData) {
Expand All @@ -69,8 +95,7 @@ private Integer getNextJudgmentId(CaseData caseData) {
}

private boolean isHistoricJudgment(JudgmentDetails activeJudgment) {
return JudgmentState.CANCELLED.equals(activeJudgment.getState())
|| JudgmentState.SET_ASIDE_ERROR.equals(activeJudgment.getState())
return JudgmentState.SET_ASIDE_ERROR.equals(activeJudgment.getState())
|| JudgmentState.SET_ASIDE.equals(activeJudgment.getState());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ public JudgmentDetails addUpdateActiveJudgment(CaseData caseData) {

JudgmentDetails activeJudgment = caseData.getActiveJudgment();
JudgmentState state = getJudgmentState(caseData);
return activeJudgment.toBuilder()
JudgmentDetails activeJudgmentDetails = activeJudgment.toBuilder()
.state(state)
.fullyPaymentMadeDate(caseData.getJoJudgmentPaidInFull().getDateOfFullPaymentMade())
.lastUpdateTimeStamp(LocalDateTime.now())
.cancelledTimeStamp(JudgmentState.CANCELLED.equals(state) ? LocalDateTime.now() : null)
.cancelDate(JudgmentState.CANCELLED.equals(state) ? LocalDate.now() : null)
.build();

super.updateJudgmentTabDataWithActiveJudgment(activeJudgmentDetails, caseData);

return activeJudgmentDetails;
}

protected JudgmentState getJudgmentState(CaseData caseData) {
Expand Down
Loading
Loading