Aman-Mittal opened a new issue, #778:
URL: https://github.com/apache/fineract-backoffice-ui/issues/778
## Summary
A loan can be **re-aged** or **re-amortized** from this UI (#266 / #194),
but neither operation can be undone. If an operator re-ages the wrong loan or
uses the wrong parameters, the only remedy today is a direct API call.
## Evidence (`main` @ `8da1086f`)
- `src/app/features/loans/loan-transaction-form.component.ts` handles
`reAge` and `reAmortize`, but has no `undoReAge` or `undoReAmortize`.
- `src/app/core/guards/command-permissions.ts` maps `reAge: 'REAGE_LOAN'`.
It leaves `reAmortize` unmapped because the earlier probe was inconclusive, as
documented in the table at the top of that file.
## Platform support
`POST /v1/loans/{loanId}/transactions?command=undoReAge` and
`?command=undoReAmortize` (`LoanTransactionsApiResource`, lines ~616–620). Both
reverse the most recent re-age / re-amortization and restore the prior schedule.
## Proposed implementation
- Add **Undo re-age** and **Undo re-amortize** to the loan's actions. Offer
them only when the loan's latest relevant transaction is a non-reversed Re-age
/ Re-amortize.
- Put a destructive `DialogService.confirm` in front of each, explaining
that the repayment schedule reverts.
- Refresh the schedule and transactions after the undo.
## RBAC
| Action | Permission code | Typically granted to |
|---|---|---|
| Re-age (existing) | `REAGE_LOAN` | collections / restructuring officer |
| Undo re-age | `UNDO_REAGE_LOAN` | restructuring supervisor (ideally not
the maker) |
| Re-amortize (existing) | `REAMORTIZE_LOAN` | restructuring officer |
| Undo re-amortize | `UNDO_REAMORTIZE_LOAN` | restructuring supervisor |
All four codes are in `scripts/permission-codes.json`.
- Before adding `undoReAge` / `undoReAmortize` to
`LOAN_COMMAND_PERMISSIONS`, re-run the probe described in
`command-permissions.ts` so the mapping is verified, not assumed. Settle the
`reAmortize` mapping at the same time.
- Writes pass with the exact code **or** `ALL_FUNCTIONS`. With maker-checker
on, the undo is queued for `UNDO_REAGE_LOAN_CHECKER` /
`UNDO_REAMORTIZE_LOAN_CHECKER`, and the UI should show "submitted for approval".
### UI expectations
- Guard the route through `loanCommandPermission`.
- Gate the menu items with `[appRequiresPermission]`.
- A read-only user sees neither item enabled.
## Acceptance criteria
- [ ] After a re-age, **Undo re-age** restores the previous schedule. The
same holds for re-amortize.
- [ ] The undo actions only appear when there is something to undo.
- [ ] Gating is on `UNDO_REAGE_LOAN` / `UNDO_REAMORTIZE_LOAN`, with verified
mappings.
- [ ] Unit tests cover visibility, payloads and gating.
--
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]