FINERACT-2235: Accelerate maturity to charge-off date when interest recalculation is disabled.

This commit is contained in:
mariiaKraievska
2025-01-21 17:21:10 +01:00
committed by Adam Saghy
parent 9a8db7e82e
commit 771b48b078
7 changed files with 629 additions and 18 deletions
@@ -1220,11 +1220,12 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
final long totalDaysInPeriod = ChronoUnit.DAYS.between(currentInstallment.getFromDate(), currentInstallment.getDueDate());
final long daysTillChargeOff = ChronoUnit.DAYS.between(currentInstallment.getFromDate(), transactionDate);
final BigDecimal interestTillChargeOff = totalInterest
.divide(BigDecimal.valueOf(totalDaysInPeriod), MoneyHelper.getMathContext())
.multiply(BigDecimal.valueOf(daysTillChargeOff));
final MathContext mc = MoneyHelper.getMathContext();
final Money interestTillChargeOff = Money.of(transactionCtx.getCurrency(),
totalInterest.divide(BigDecimal.valueOf(totalDaysInPeriod), mc).multiply(BigDecimal.valueOf(daysTillChargeOff), mc),
mc);
currentInstallment.updateInterestCharged(interestTillChargeOff);
currentInstallment.updateInterestCharged(interestTillChargeOff.getAmount());
}
currentInstallment.updateDueDate(transactionDate);