FINERACT-2355: Fix charge off and loan charge for zero installments

This commit is contained in:
Oleksii Novikov
2025-09-03 12:55:58 +02:00
committed by Adam Saghy
parent 7378aea0b2
commit 33c74abeb7
4 changed files with 61 additions and 3 deletions
@@ -914,6 +914,10 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom<Long
retainMappings.add(newMapping);
}
}
if (retainMappings != null) {
retainMappings.removeIf(LoanTransactionToRepaymentScheduleMapping::isZeroAmount);
}
}
public void updateLoanChargePaidMappings(final Collection<LoanChargePaidBy> updatedMappings) {
@@ -141,4 +141,8 @@ public class LoanTransactionToRepaymentScheduleMapping extends AbstractPersistab
return Money.of(currency, this.penaltyChargesPortion);
}
public boolean isZeroAmount() {
return this.amount == null || this.amount.compareTo(BigDecimal.ZERO) == 0;
}
}