Skip to content

Commit

Permalink
SU-530 repayment schedule missalignement on rollback of transactions …
Browse files Browse the repository at this point in the history
…with grace period installments fixed
  • Loading branch information
faheem205 committed Dec 21, 2024
1 parent caa97a7 commit 7553a66
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,15 @@ private LoanScheduleModel generate(final MathContext mc, final LoanApplicationTe
Money outstandingBalance = scheduleParams.getOutstandingBalanceAsPerRest();
final int periodNumber = scheduleParams.getPeriodNumber();
Integer ignoreInstallment = loanApplicationTerms.getNumberOfInstallmentsToIgnore();
if (ignoreInstallment != null && ignoreInstallment < periodNumber) {
outstandingBalance = outstandingBalance.plus(cumulatingInterestPaymentDueToGrace);
cumulatingInterestPaymentDueToGrace = Money.zero(currency);
}
// SU-530 commenting below code for now because the implementation is not correct.
// 1. Grace interest should not be added to outstanding balance.
// 2. Implementation of checkbox on product level to calculate interest from disbursement date or from grace period end date is violated here
// because this check has never been implemented. For now cumulatingInterestPaymentDueToGrace should be 0
// if (ignoreInstallment != null && ignoreInstallment < periodNumber) {
// outstandingBalance = outstandingBalance.plus(cumulatingInterestPaymentDueToGrace);
// cumulatingInterestPaymentDueToGrace = Money.zero(currency);
// }
cumulatingInterestPaymentDueToGrace = Money.zero(currency);
final TreeMap<LocalDate, Money> principalVariation = mergeVariationsToMap(loanApplicationTerms, scheduleParams);
final Map<LocalDate, Money> compoundingMap = scheduleParams.getCompoundingMap();
final LocalDate periodEndDate = scheduledDueDate;
Expand Down Expand Up @@ -3128,8 +3133,9 @@ private LoanScheduleDTO rescheduleNextInstallmentsForProgressiveLoans(final Math
if (installment.isFullyGraced()) {
periods.add(createLoanScheduleModelDownPaymentPeriod(installment, outstandingBalance));
newRepaymentScheduleInstallments.add(installment);
actualRepaymentDate = getScheduledDateGenerator().generateNextRepaymentDate(actualRepaymentDate, loanApplicationTerms,
isFirstRepayment);
actualRepaymentDate = installment.getDueDate();
periodStartDate = installment.getDueDate();
periodNumber++;
continue;
}
if (installment.isDownPayment()) {
Expand Down

0 comments on commit 7553a66

Please sign in to comment.