You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/10/14 14:03:43 UTC

[GitHub] [fineract] galovics commented on a diff in pull request #2672: FINERACT-1773: Allow 'specific due date charges' to be applied after the maturity date

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

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