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

   ## Problem
   
   The LOS disbursement flow currently transitions the application to 
`DISBURSED` after receiving a successful response from the Fineract API.
   
   The resulting Fineract loan state is not independently verified.
   
   This can cause LOS to report a successful disbursement even if the external 
system has not reached the expected final state.
   
   ## Risk
   
   LOS and Fineract may become inconsistent if:
   
   - Fineract accepts the request but processes it asynchronously.
   - Maker-checker configuration delays the state transition.
   - A successful response does not guarantee the final loan state.
   - The Fineract version behaves differently from the expected synchronous 
workflow.
   
   ## Proposed Fix
   
   After the disbursement operation:
   
   1. Retrieve the Fineract loan.
   2. Verify the expected active/disbursed state.
   3. Only then transition the LOS application to `DISBURSED`.
   4. Persist the Fineract loan ID and integration state.
   5. Handle cases where the loan exists but is not yet in the expected state.
   
   The exact expected Fineract status should be documented against the Fineract 
version used by the project.
   
   ## Acceptance Criteria
   
   - [ ] LOS does not mark an application `DISBURSED` until the expected 
Fineract state is confirmed.
   - [ ] Fineract loan ID is persisted.
   - [ ] Unexpected Fineract state results in a recoverable integration state.
   - [ ] Existing successful mock and real integration tests continue to work.
   
   ## Regression Tests
   
   - [ ] Successful Fineract disbursement → LOS `DISBURSED`.
   - [ ] Fineract returns success but loan remains pending → LOS does not mark 
`DISBURSED`.
   - [ ] Fineract loan lookup failure → integration failure is persisted.
   
   ## Dependencies 
   
   Related to #154 and #156.
   
   This completes the Fineract disbursement lifecycle by verifying the external 
loan state before LOS transitions the application to DISBURSED, while also 
integrating with the failure/recovery handling addressed in issue 156.


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