FINERACT-1981: fix post maturity charge removed by cob on progressive loan

This commit is contained in:
adam.magyari
2024-12-07 13:25:07 +01:00
committed by Arnold Gálovics
parent 84f01e0687
commit 56350673ad
4 changed files with 88 additions and 1 deletions
@@ -29,6 +29,7 @@ import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleDTO;
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleModel;
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
@RequiredArgsConstructor
public class LoanScheduleService {
@@ -98,7 +99,8 @@ public class LoanScheduleService {
for (final LoanCharge loanCharge : charges) {
if (!loanCharge.isDueAtDisbursement()) {
loan.updateOverdueScheduleInstallment(loanCharge);
if (loanCharge.getDueLocalDate() == null || !DateUtils.isBefore(lastRepaymentDate, loanCharge.getDueLocalDate())) {
if (loanCharge.getDueLocalDate() == null || (!DateUtils.isBefore(lastRepaymentDate, loanCharge.getDueLocalDate())
|| loan.getLoanProductRelatedDetail().getLoanScheduleType().equals(LoanScheduleType.PROGRESSIVE))) {
if ((loanCharge.isInstalmentFee() || !loanCharge.isWaived()) && (loanCharge.getDueLocalDate() == null
|| !DateUtils.isAfter(lastTransactionDate, loanCharge.getDueLocalDate()))) {
loanChargeService.recalculateLoanCharge(loan, loanCharge, generatorDTO.getPenaltyWaitPeriod());