FINERACT-2059: Re-aging repayment schedule handling

This commit is contained in:
Adam Saghy
2024-03-19 17:02:08 +01:00
committed by Arnold Gálovics
parent 52f614df59
commit e66da3eaba
2 changed files with 4 additions and 1 deletions
@@ -1335,7 +1335,7 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
}
private void reprocessInstallmentsOrder(List<LoanRepaymentScheduleInstallment> installments) {
AtomicInteger counter = new AtomicInteger(0);
AtomicInteger counter = new AtomicInteger(1);
installments.stream().sorted(LoanRepaymentScheduleInstallment::compareToByDueDate)
.forEachOrdered(i -> i.updateInstallmentNumber(counter.getAndIncrement()));
}
@@ -462,6 +462,7 @@ public abstract class BaseLoanIntegrationTest {
Assertions.assertEquals(installments.length, loanResponse.getRepaymentSchedule().getPeriods().size(),
"Expected installments are not matching with the installments configured on the loan");
int installmentNumber = 0;
for (int i = 1; i < installments.length; i++) {
GetLoansLoanIdRepaymentPeriod period = loanResponse.getRepaymentSchedule().getPeriods().get(i);
Double principalDue = period.getPrincipalDue();
@@ -546,6 +547,8 @@ public abstract class BaseLoanIntegrationTest {
outstandingTotalExpected, outstandingTotal));
}
installmentNumber++;
Assertions.assertEquals(installmentNumber, period.getPeriod());
}
Assertions.assertEquals(installments[i].completed, period.getComplete());
Assertions.assertEquals(LocalDate.parse(installments[i].dueDate, dateTimeFormatter), period.getDueDate());