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


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -794,19 +794,25 @@ public CommandProcessingResult rejectApplication(final 
Long loanId, final JsonCo
 
         final AppUser currentUser = getAppUserIfPresent();
 
-        
this.loanApplicationTransitionApiJsonValidator.validateRejection(command.json());
+        // validate before loan assembling
+        loanApplicationTransitionValidator.validateRejection(command.json());
 
+        // retrieve/assemble loan
         final Loan loan = retrieveLoanBy(loanId);
 
+        // check client or group
         checkClientOrGroupActive(loan);
 
+        // check for mandatory entities
         
entityDatatableChecksWritePlatformService.runTheCheckForProduct(loanId, 
EntityTables.LOAN.getName(),
                 StatusEnum.REJECTED.getCode().longValue(), 
EntityTables.LOAN.getForeignKeyColumnNameOnDatatable(), loan.productId());
 
+        // validate loan rejection
+        loanApplicationTransitionValidator.validateRejection(loan, 
defaultLoanLifecycleStateMachine, command);

Review Comment:
   We can do all the validations before executing the rejection. You can load 
the loan in the first validation method as well 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