FINERACT-1971: update installment accrued portions on charge accrual

This commit is contained in:
adam.magyari
2024-12-10 15:04:01 +01:00
committed by Adam Saghy
parent bc2ef08e0c
commit d0006a2169
2 changed files with 31 additions and 0 deletions
@@ -769,6 +769,13 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
transactionDate, feeCharges, penaltyCharges, externalId);
Integer installmentNumber = null;
final LoanRepaymentScheduleInstallment installmentForCharge = this.getRelatedRepaymentScheduleInstallment(loanCharge.getDueDate());
if (installmentForCharge != null) {
installmentForCharge.updateAccrualPortion(installmentForCharge.getInterestAccrued(this.getCurrency()),
installmentForCharge.getFeeAccrued(this.getCurrency()).add(feeCharges),
installmentForCharge.getPenaltyAccrued(this.getCurrency()).add(penaltyCharges));
installmentNumber = installmentForCharge.getInstallmentNumber();
}
final LoanChargePaidBy loanChargePaidBy = new LoanChargePaidBy(applyLoanChargeTransaction, loanCharge,
loanCharge.getAmount(getCurrency()).getAmount(), installmentNumber);
applyLoanChargeTransaction.getLoanChargesPaid().add(loanChargePaidBy);