FINERACT-2181: Fix integration test / unify getLoanRepaymentScheduleDetail()

This commit is contained in:
Adam Saghy
2025-06-06 15:08:40 +02:00
parent caf42f733c
commit 19b2a77127
12 changed files with 24 additions and 28 deletions
@@ -667,10 +667,6 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
return this.loanProduct;
}
public LoanProductRelatedDetail repaymentScheduleDetail() {
return this.loanRepaymentScheduleDetail;
}
public void updateClient(final Client client) {
this.client = client;
}
@@ -1347,7 +1343,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
}
public Money getTotalOverpaidAsMoney() {
return Money.of(this.repaymentScheduleDetail().getCurrency(), this.totalOverpaid);
return Money.of(this.getLoanProductRelatedDetail().getCurrency(), this.totalOverpaid);
}
public void updateIsInterestRecalculationEnabled() {
@@ -1512,7 +1508,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
public boolean isFeeCompoundingEnabledForInterestRecalculation() {
boolean isEnabled = false;
if (this.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
if (this.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) {
isEnabled = this.loanInterestRecalculationDetails.getInterestRecalculationCompoundingMethod().isFeeCompoundingEnabled();
}
return isEnabled;
@@ -1602,7 +1598,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
}
return numberOfInstallments;
}
return this.repaymentScheduleDetail().getNumberOfRepayments() + adjustNumberOfRepayments();
return this.getLoanProductRelatedDetail().getNumberOfRepayments() + adjustNumberOfRepayments();
}
/*
@@ -86,7 +86,7 @@ public class LoanTermVariationsMapper {
CalendarHistoryDataWrapper calendarHistoryDataWrapper;
RepaymentStartDateType repaymentStartDateType = loan.getLoanProduct().getRepaymentStartDateType();
boolean allowCompoundingOnEod = false;
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
if (loan.getLoanProductRelatedDetail().isInterestRecalculationEnabled()) {
restCalendarInstance = scheduleGeneratorDTO.getCalendarInstanceForInterestRecalculation();
compoundingCalendarInstance = scheduleGeneratorDTO.getCompoundingCalendarInstance();
recalculationFrequencyType = loan.getLoanInterestRecalculationDetails().getRestFrequencyType();
@@ -179,7 +179,7 @@ public class LoanDownPaymentHandlerServiceImpl implements LoanDownPaymentHandler
.reduce(BigDecimal.ZERO, BigDecimal::add);
final BigDecimal totalPrincipalCredited = totalDisbursed.add(totalPrincipalAdjusted).add(totalCapitalizedIncome);
if (totalPrincipalCredited.compareTo(loan.getSummary().getTotalPrincipalRepaid()) < 0
&& loan.repaymentScheduleDetail().getPrincipal().minus(totalDisbursed).isGreaterThanZero()) {
&& loan.getLoanProductRelatedDetail().getPrincipal().minus(totalDisbursed).isGreaterThanZero()) {
final String errorMessage = "The transaction amount cannot exceed threshold.";
throw new InvalidLoanStateTransitionException("transaction", "amount.exceeds.threshold", errorMessage);
}