FINERACT-2354: handle reamortization error code 500 issue on same disbursement day

This commit is contained in:
Attila Budai
2026-01-15 10:17:43 +01:00
committed by Adam Saghy
parent 53ff74425c
commit 442290ef92
6 changed files with 219 additions and 54 deletions
@@ -131,6 +131,15 @@ public class LoanReAmortizationValidator {
throw new GeneralPlatformDomainRuleException("error.msg.loan.reamortize.not.allowed.on.contract.terminated",
"Loan re-amortization is not allowed on contract terminated loan.", loan.getId());
}
// validate there are overdue installments to re-amortize
boolean hasOverdueInstallments = loan.getRepaymentScheduleInstallments().stream()
.anyMatch(installment -> installment.getDueDate().isBefore(getBusinessLocalDate())
&& installment.getPrincipalOutstanding(loan.getCurrency()).isGreaterThanZero());
if (!hasOverdueInstallments) {
throw new GeneralPlatformDomainRuleException("error.msg.loan.reamortize.no.overdue.amount",
"Re-amortization cannot be executed: no overdue amount exists.", loan.getId());
}
}
public LoanTransaction findAndValidateReAmortizeTransactionForUndo(Loan loan) {