alberto-art3ch commented on code in PR #5183:
URL: https://github.com/apache/fineract/pull/5183#discussion_r2590962021


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reaging/LoanReAgingValidator.java:
##########
@@ -193,10 +223,21 @@ private void validateReAgeOutstandingBalance(final Loan 
loan, final JsonCommand
             return;
         }
 
-        if 
(loan.getSummary().getTotalPrincipalOutstanding().compareTo(java.math.BigDecimal.ZERO)
 == 0) {
+        final BigDecimal totalPrincipalOutstanding = 
loan.getSummary().getTotalPrincipalOutstanding();
+        if (MathUtil.isZero(totalPrincipalOutstanding)) {
             throw new 
GeneralPlatformDomainRuleException("error.msg.loan.reage.no.outstanding.balance.to.reage",
                     "Loan cannot be re-aged as there are no outstanding 
balances to be re-aged", loan.getId());
         }
+
+        if 
(command.parameterExists(LoanReAgingApiConstants.transactionAmountParamName)) {
+            final BigDecimal transactionAmount = command
+                    
.bigDecimalValueOfParameterNamed(LoanReAgingApiConstants.transactionAmountParamName);
+            final BigDecimal totalReAgeAmount = 
totalPrincipalOutstanding.add(loan.getSummary().getTotalInterestOutstanding());

Review Comment:
   Done! That amount validation has been moved to the line where the ReAge 
transaction is being created and the outstanding amount is calculated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to