FINERACT-1724: Approval limit calculation modification

This commit is contained in:
abraham.menyhart
2023-07-05 16:19:21 +02:00
committed by Adam Saghy
parent 1cb1372e68
commit 28747fecd1
4 changed files with 106 additions and 4 deletions
@@ -2668,8 +2668,11 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom {
if (this.loanProduct().isDisallowExpectedDisbursements() && this.loanProduct().isAllowApprovedDisbursedAmountsOverApplied()) {
BigDecimal maxDisbursedAmount = getOverAppliedMax();
if (disbursedAmount.compareTo(maxDisbursedAmount) > 0) {
final String errorMessage = "Loan disbursal amount can't be greater than maximum applied loan amount calculation.";
if (totalDisbursed.compareTo(maxDisbursedAmount) > 0) {
final String errorMessage = String.format(
"Loan disbursal amount can't be greater than maximum applied loan amount calculation. "
+ "Total disbursed amount: %s Maximum disbursal amount: %s",
totalDisbursed.stripTrailingZeros().toPlainString(), maxDisbursedAmount.stripTrailingZeros().toPlainString());
throw new InvalidLoanStateTransitionException("disbursal",
"amount.can't.be.greater.than.maximum.applied.loan.amount.calculation", errorMessage, disbursedAmount,
maxDisbursedAmount);