galovics commented on code in PR #2672:
URL: https://github.com/apache/fineract/pull/2672#discussion_r995786908


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java:
##########
@@ -37,17 +37,20 @@ public DefaultLoanLifecycleStateMachine(LoanStatus[] 
allowedLoanStatuses, Busine
 
     @Override
     public LoanStatus dryTransition(final LoanEvent loanEvent, final Loan 
loan) {
-        return getNextState(loanEvent, loan);
+        LoanStatus nextStatus = getNextState(loanEvent, loan);
+        return nextStatus != null ? nextStatus : loan.status();
     }
 
     @Override
     public void transition(final LoanEvent loanEvent, final Loan loan) {
         LoanStatus newState = getNextState(loanEvent, loan);
-        loan.setLoanStatus(newState.getValue());
+        if (newState != null) {

Review Comment:
   With this logic in place, the dryTransition is having a different behavior. 
They should be the same (nextStatus != null ...).



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java:
##########
@@ -62,7 +65,7 @@ private LoanStatus getNextState(LoanEvent loanEvent, Loan 
loan) {
         }
 
         LoanStatus from = loan.status();
-        LoanStatus newState = from;
+        LoanStatus newState = null;

Review Comment:
   Why was this needed, could you please explain?



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanEvent.java:
##########
@@ -49,5 +49,6 @@ public enum LoanEvent {
     LOAN_REJECT_TRANSFER, //
     LOAN_WITHDRAW_TRANSFER, //
     LOAN_CREDIT_BALANCE_REFUND, //
-    LOAN_CHARGEBACK;
+    LOAN_CHARGEBACK, //
+    Loan_CHARGE_ADDED;

Review Comment:
   Enum naming is not according to the standards, should be LOAN_CHARGE_ADDED.



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