FINERACT-2050: Fix client transfer loan status staying in TRANSFER_IN_PROGRESS

This commit is contained in:
airajena
2026-02-17 12:06:12 +00:00
committed by Adam Saghy
parent 7daf4b8a84
commit 2ee6f22713
4 changed files with 63 additions and 5 deletions
@@ -202,6 +202,18 @@ public class DefaultLoanLifecycleStateMachine implements LoanLifecycleStateMachi
newState = activeTransition();
}
break;
case LOAN_COMPLETE_TRANSFER:
if (anyOfAllowedWhenComingFrom(from, LoanStatus.TRANSFER_IN_PROGRESS)) {
boolean isOverpaid = loan.getTotalOverpaid() != null && loan.getTotalOverpaid().compareTo(BigDecimal.ZERO) > 0;
if (isOverpaid) {
newState = overpaidTransition();
} else if (loan.getSummary().isRepaidInFull(loan.getCurrency())) {
newState = closeObligationsMetTransition();
} else {
newState = activeTransition();
}
}
break;
case WRITE_OFF_OUTSTANDING_UNDO:
if (anyOfAllowedWhenComingFrom(from, LoanStatus.CLOSED_WRITTEN_OFF)) {
newState = activeTransition();
@@ -48,6 +48,7 @@ public enum LoanEvent {
LOAN_INITIATE_TRANSFER, //
LOAN_REJECT_TRANSFER, //
LOAN_WITHDRAW_TRANSFER, //
LOAN_COMPLETE_TRANSFER, //
LOAN_CREDIT_BALANCE_REFUND, //
LOAN_CHARGEBACK, //
LOAN_CHARGE_ADDED, //