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

   ## Problem
   
   Invalid loan lifecycle transitions currently return `HTTP 500`.
   
   The API documentation expects these operations to be represented as 
conflicts with the current resource state.
   
   ## Example
   
   Attempting to submit an application that is already `APPROVED` results in:
   
   `HTTP 500`
   
   The application state itself remains unchanged.
   
   ## Root Cause
   
   `LoanOriginationStateMachine.transition()` throws 
`LoanStateTransitionException`.
   
   There is currently no dedicated exception handler for this exception, so it 
falls through to the generic `500` handler.
   
   ## Proposed Fix
   
   Map `LoanStateTransitionException` to:
   
   `HTTP 409 Conflict`
   
   Return a consistent error response explaining that the requested transition 
is invalid for the current state.
   
   ## Acceptance Criteria
   
   - [ ] Invalid transitions return `409`.
   - [ ] Application state remains unchanged.
   - [ ] Valid transitions continue to work.
   - [ ] Error response follows the standard API format.
   
   ## Regression Tests
   
   - [ ] APPROVED → submit → `409`
   - [ ] Invalid start-review transition → `409`
   - [ ] Valid lifecycle transitions continue to pass.
   
   ## Dependencies 
   
   None


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