adamsaghy commented on code in PR #5183:
URL: https://github.com/apache/fineract/pull/5183#discussion_r2577263648


##########
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:
   I dont think this is correct. We should move this validation out from this 
and make the check after the correct "reage" amount was calculated by Fineract. 
After we have this information we can do the check and throw error if needed.



-- 
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