KRYSTALM7 opened a new issue, #156:
URL: https://github.com/apache/fineract-loan-origination/issues/156

   ## Problem
   
   When a Fineract operation fails during disbursement, LOS attempts to persist 
the failure state, but the transaction is rolled back.
   
   As a result, LOS loses information about the failed integration attempt.
   
   An already-created Fineract loan ID can also be lost if a later step fails.
   
   ## Runtime Evidence
   
   After a failed disbursement:
   
   ```text
   status = APPROVED
   fineract_integration_status = null
   fineract_loan_id = null
   
   ## Root Cause
   
   DisbursementBridgeService.executeFullDisbursement() is transactional and 
performs multiple external Fineract calls.
   Failure handlers save the failure state and then throw 
FineractIntegrationException.
   Because this is a runtime exception, the transaction rolls back those writes.
   
   ## Impact
   
   A partial Fineract operation can become invisible to LOS.
   
   For example:
   Fineract creates the loan.
   LOS receives the loan ID.
   Fineract approval fails.
   LOS transaction rolls back.
   Loan ID is lost.
   A retry could create another Fineract loan.
   
   ## Proposed Fix
   
   Persist external integration progress independently from the business 
transaction.
   The implementation should:
   Persist the Fineract loan ID immediately after creation.
   Persist the current integration step.
   Persist failure status independently.
   Prevent retries from blindly creating another loan.
   Resume from the last successfully completed step.
   
   ## Acceptance Criteria
   
   [ ] Failed integrations retain a persisted failure state.
   [ ] Successfully created Fineract loan IDs are never lost.
   [ ] Retrying does not create duplicate Fineract loans.
   [ ] LOS knows the last successful integration step.
   [ ] Recovery from partial integration is deterministic.
   
   ## Regression Tests
   
   [ ] Create succeeds + approval fails → loan ID remains.
   [ ] Create fails → failure state remains.
   [ ] Retry does not create duplicate loan.
   [ ] Successful lifecycle still reaches DISBURSED.
   
   **Dependencies:** Coordinate with **#154**.
   


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