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


##########
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);
+
         final Map<String, Object> changes = 
loan.loanApplicationRejection(currentUser, command, 
defaultLoanLifecycleStateMachine);

Review Comment:
   Please extract out logic from loan.loanApplicationRejection method into this 
service. 



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