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


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanScheduleValidator.java:
##########
@@ -176,4 +178,24 @@ private void 
validateRepaymentsStartingFromDateIsAfterDisbursementDate(final Lis
             dataValidationErrors.add(error);
         }
     }
+
+    public boolean validateDownPaymentAttribute(final boolean 
isDownPaymentEnabledInLoanProduct, final JsonElement element) {
+        boolean isDownPaymentEnabled = isDownPaymentEnabledInLoanProduct;

Review Comment:
   This method is overcomplicated:
   ```
   public void validateDownPaymentAttribute(final boolean 
isDownPaymentEnabledInLoanProduct, final JsonElement element) {
         Boolean inputIsDownPaymentEnabled = 
this.fromApiJsonHelper.extractBooleanNamed(LoanProductConstants.ENABLE_DOWN_PAYMENT,
 element);
         if(!isDownPaymentEnabledInLoanProduct && 
Boolean.TRUE.equals(inputIsDownPaymentEnabled)) {
                  throw new 
GeneralPlatformDomainRuleException("error.msg.downpayment.is.not.enabled.in.loan.product",
                           "The Loan can not override the downpayment flag 
because in the Loan Product the downpayment is disabled",
                           inputIsDownPaymentEnabled);
                           }
   }
   ```
   
   What do you think?



-- 
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: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to