shivaansh0610-LUFFY opened a new pull request, #638:
URL: https://github.com/apache/fineract-backoffice-ui/pull/638

   Addresses #284 by adding UI support for revising a loan's approved amount 
and available disbursement amount. Both `PUT /loans/{id}/approved-amount` and 
`PUT /loans/{id}/available-disbursement-amount` were already available through 
the generated API client, but there was no corresponding UI action to invoke 
either command.
   
   Adds two focused dialogs, `LoanApprovedAmountDialogComponent` and 
`LoanAvailableDisbursementAmountDialogComponent`, and exposes them through the 
loan view's Actions menu. Both actions are gated by `canReviseLoanAmounts`, 
which allows revisions only for approved or active loans and excludes 
before/after states.
   
   The UI intentionally does not duplicate Fineract's business rules around 
minimum amounts, applied amounts, tranches, disbursement state, or decreases. 
Those rules remain enforced by the backend, with the resulting validation 
messages surfaced through the existing error handling.
   
   Both endpoints and the relevant business rules were verified against a live 
Fineract `1.16.0-SNAPSHOT` instance rather than relying solely on the OpenAPI 
specification. This included the minimum-amount constraint, the applied-amount 
ceiling, revision after partial disbursement, and setting the available 
disbursement amount to zero.
   
   During live verification, a related pre-existing issue was identified in 
`error.interceptor.ts`. These two commands return their actual validation 
message one level deeper than Fineract's usual error structure 
(`errors[0].args[0].value`), nested beneath a generic `Validation errors 
exist.` entry. The interceptor now unwraps this response so the UI displays the 
platform's actual refusal reason, with dedicated unit-test coverage.
   
   ### Permission handling
   
   * `UPDATE_APPROVED_AMOUNT_LOAN` is an existing seeded permission and was 
verified against the live backend.
   * `UPDATE_LOAN_AVAILABLE_DISBURSEMENT_AMOUNT` is derived from the backend's 
`@CommandType(entity="LOAN_AVAILABLE_DISBURSEMENT_AMOUNT", action="UPDATE")` 
annotation, inspected with `javap` from the running instance's JAR.
   * The live `1.16.0-SNAPSHOT` instance does not currently contain a seeded 
permission row for the latter command. This is a backend-side gap and is 
outside the scope of this PR. The UI permission check is therefore a visibility 
guard; Fineract remains the authoritative authorization boundary.
   
   ### Tests
   
   Coverage includes unit tests for both dialogs and loan-view wiring, 
including exact request-body assertions; a mocked Playwright e2e spec covering 
the same request payloads; and a real-backend e2e spec exercising the complete 
round trip against Fineract, including the platform's validation refusal 
response.
   
   Refs #284
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
     http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   
   <!-- Commits must be signed to merge — see CONTRIBUTING.md#commit-signing if 
you haven't set this up. -->
   
   ## What and why
   
   <!-- One or two sentences explaining what changed and why. -->
   
   Adds loan-view actions and dialogs for revising the approved amount and 
available disbursement amount using the existing Fineract API endpoints. The UI 
keeps backend business-rule validation authoritative and surfaces the 
platform's actual validation messages.
   
   Closes #284
   
   ## Verification
   
   <!-- List what you ran and what you checked. Note whether the UI was 
exercised with mocks, a real Fineract backend, or both. -->
   
   * Verified both revision flows against a live Fineract `1.16.0-SNAPSHOT` 
backend.
   * Verified the platform's minimum-amount, applied-amount ceiling, 
partial-disbursement, and zero available-disbursement rules.
   * Verified that invalid requests display the backend's actual validation 
refusal message.
   * Added unit tests for both dialogs, loan-view wiring, and the nested 
validation-error handling.
   * Unit tests assert the exact request bodies sent to both endpoints.
   * Added a mocked Playwright e2e spec covering the same request payloads.
   * Added a real-backend e2e spec covering the complete revision round trip 
and backend validation.
   * Full unit suite: **1590/1590 passing**.
   * e2e suites: **18/18 + 4/4 passing**.
   * Lint, production build, i18n, accessibility-name, and icon checks all 
passed.
   
   ## Screenshots
   
   ### Before
   
   The loan Actions menu did not provide options to revise the approved amount 
or available disbursement amount.
   
   <img width="1280" height="720" alt="evidence-before-1-menu" 
src="https://github.com/user-attachments/assets/674261e2-7227-498e-a881-9ce075b44ad1";
 />
   
   
[[before.webm](https://github.com/user-attachments/assets/ecfc1075-71b8-495f-8a8b-eb907549ebbe)](https://github.com/user-attachments/assets/ecfc1075-71b8-495f-8a8b-eb907549ebbe)
   
   ### After
   
   The loan Actions menu now provides both revision actions, each opening the 
corresponding dialog.
   
   <img width="1280" height="720" alt="evidence-after-1-menu" 
src="https://github.com/user-attachments/assets/85b4ca22-37c2-449a-ab0d-89867bea47ab";
 />
   
   <img width="1280" height="720" alt="evidence-after-2-approved-amount-dialog" 
src="https://github.com/user-attachments/assets/9f9d6a06-bf01-489e-b730-23f2ddfe83a3";
 />
   
   <img width="1280" height="720" alt="evidence-after-3-approved-amount-filled" 
src="https://github.com/user-attachments/assets/74bca50f-71f7-4200-8aa0-3ffa29945782";
 />
   
   <img width="1280" height="720" 
alt="evidence-after-4-available-disbursement-dialog" 
src="https://github.com/user-attachments/assets/d7da2565-a72c-47be-84f8-7a109a41f638";
 />
   
   <img width="1280" height="720" alt="evidence-after-5-final-amount" 
src="https://github.com/user-attachments/assets/37648068-a938-4a05-88e0-3f0079d694da";
 />
   
   
[[after.webm](https://github.com/user-attachments/assets/14e8c35c-9811-4e44-a04e-e88d8d47e227)](https://github.com/user-attachments/assets/14e8c35c-9811-4e44-a04e-e88d8d47e227)
   
   Screenshots and `.webm` recordings were captured against the live Fineract 
backend.
   
   Evidence is also available locally at:
   
   `~/Downloads/fineract-284-loan-amount-revision/before/`
   
   `~/Downloads/fineract-284-loan-amount-revision/after/`
   
   ## AI assistance (optional)
   
   <!-- If generative AI materially assisted this contribution, optionally 
state the tool or model and
   the harness or workflow used. The contributor remains responsible for the 
submitted change. -->
   
   * Tool / model: OpenAI GPT-5.6 Luna
   * Harness / workflow: OpenAI Codex; AI-assisted implementation, test 
authoring, debugging, verification, and repository workflow via the terminal
   
   ## Checklist
   
   <!-- Check each item, or explain why it does not apply. -->
   
   * [ ] I did not hand-edit generated files under `src/app/api/`.
   * [ ] New component or service code uses the adapter boundary in 
`src/app/core/adapters/` instead of direct browser globals or imperative 
third-party APIs.
   * [x] User-facing strings use translation keys.
   * [x] I added or updated tests appropriate to this change, or explained why 
tests were not needed.
   * [x] UI workflow changes include suitable e2e coverage, including 
real-backend testing where relevant.
   * [ ] Commits are signed — see [[Commit 
Signing](https://chatgpt.com/c/CONTRIBUTING.md#commit-signing)](CONTRIBUTING.md#commit-signing)
 in CONTRIBUTING.md.
   * [x] I followed the [[AI-assisted contributions 
guidance](https://chatgpt.com/c/CONTRIBUTING.md#ai-assisted-contributions)](CONTRIBUTING.md#ai-assisted-contributions).


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