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


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/DefaultLoanLifecycleStateMachine.java:
##########
@@ -154,7 +154,8 @@ private LoanStatus getNextStatus(LoanEvent loanEvent, Loan 
loan) {
             break;
             case LOAN_CHARGE_PAYMENT:
             case LOAN_REPAYMENT_OR_WAIVER, LOAN_CHARGEBACK:
-                if (anyOfAllowedWhenComingFrom(from, 
LoanStatus.CLOSED_OBLIGATIONS_MET, LoanStatus.OVERPAID)) {
+                if (anyOfAllowedWhenComingFrom(from, 
LoanStatus.CLOSED_OBLIGATIONS_MET, LoanStatus.OVERPAID,

Review Comment:
   I understand that part, but you were changing the behaviour for:
   `LOAN_REPAYMENT_OR_WAIVER, LOAN_CHARGEBACK` and `LOAN_OVERPAYMENT`.
   
   You should create a `LOAN_COMPLETE_TRANSFER` in `LoanEvent` and call 
`loanLifecycleStateMachine.transition` with that and add the implementation for 
which status the loan should go into in this scenario.
   
   
`org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformServiceJpaRepositoryImpl#acceptLoanTransfer`
   
   This logic here is incorrect:
   ```
   if (loan.getTotalOverpaid() != null) {
               loanLifecycleStateMachine.transition(LoanEvent.LOAN_OVERPAYMENT, 
loan);
           } else {
               
loanLifecycleStateMachine.transition(LoanEvent.LOAN_REPAYMENT_OR_WAIVER, loan);
           }
           



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