Skip to content

Commit d263fec

Browse files
mariiaKraievskaadamsaghy
authored andcommitted
FINERACT-2413: Re-amortization on charged-off, contract terminated & written-off loan
1 parent 0ba1745 commit d263fec

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reamortization/LoanReAmortizationValidator.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ private void validateReAmortizeBusinessRules(Loan loan) {
105105
loan.getId());
106106
}
107107

108-
// validate reamortization is only done on an active loan
108+
// validate re-amortization is only done on an active loan
109109
if (!loan.getStatus().isActive()) {
110110
throw new GeneralPlatformDomainRuleException("error.msg.loan.reamortize.supported.only.for.active.loans",
111-
"Loan reamortization can only be done on active loans", loan.getId());
111+
"Loan re-amortization can only be done on active loans", loan.getId());
112112
}
113113

114114
// validate if there's already a re-amortization transaction for today
@@ -119,6 +119,18 @@ private void validateReAmortizeBusinessRules(Loan loan) {
119119
"Loan reamortization can only be done once a day. There has already been a reamortization done for today",
120120
loan.getId());
121121
}
122+
123+
// validate loan is not charged-off
124+
if (loan.isChargedOff()) {
125+
throw new GeneralPlatformDomainRuleException("error.msg.loan.reamortize.not.allowed.on.charged.off",
126+
"Loan re-amortization is not allowed on charged-off loan.", loan.getId());
127+
}
128+
129+
// validate loan is not contract terminated
130+
if (loan.isContractTermination()) {
131+
throw new GeneralPlatformDomainRuleException("error.msg.loan.reamortize.not.allowed.on.contract.terminated",
132+
"Loan re-amortization is not allowed on contract terminated loan.", loan.getId());
133+
}
122134
}
123135

124136
public LoanTransaction findAndValidateReAmortizeTransactionForUndo(Loan loan) {

0 commit comments

Comments
 (0)