AshharAhmadKhan opened a new pull request, #5655:
URL: https://github.com/apache/fineract/pull/5655

   ## Description
   
   `POST /clients/{clientId}/charges/{chargeId}?command=inactivate` has never 
worked. The API accepted the command and built a `CommandWrapper` with 
`entity=CLIENTCHARGE` and `action=INACTIVATE`, but no command handler was ever 
registered for the key `"CLIENTCHARGE|INACTIVATE"`. The dispatcher threw 
`UnsupportedCommandException` immediately, returning HTTP 500 to every caller. 
The service method `ClientChargeWritePlatformServiceImpl.inactivateCharge()` 
was also a stub returning `null` with the comment `// functionality not yet 
supported`.
   
   All the surrounding infrastructure was already in place — the DB columns 
`is_active` and `inactivated_on_date` exist in `m_client_charge`, the 
permission `INACTIVATE_CLIENTCHARGE` is seeded in `0002_initial_data.xml`, the 
builder method `inactivateClientCharge()` exists in `CommandWrapperBuilder`, 
and the API routing at `ClientChargesApiResource` line 212 correctly accepts 
the command. The handler and service implementation were simply never completed.
   
   Savings charges have had a fully working equivalent 
(`InactivateSavingsAccountChargeCommandHandler`) since MIFOSX-1408. Client 
charges were left behind.
   
   **Changes:**
   
   `InactivateClientChargeCommandHandler.java` — new handler registered under 
`CLIENTCHARGE|INACTIVATE`, modelled on `WaiveClientChargeCommandHandler`.
   
   `ClientCharge.java` — added `inactivate(LocalDate)` domain method setting 
`status = false` and `inactivationDate`. The DB columns already existed, the 
method was simply missing.
   
   `ClientChargeWritePlatformServiceImpl.java` — replaced the `return null` 
stub with a full implementation. Guards for already-inactive, already-waived, 
and already-paid states, followed by `clientCharge.inactivate()` and 
`saveAndFlush`.
   
   `ClientHelper.java` — added `inactivateChargesForClients()` and 
`getClientChargeField()` test helpers.
   
   `ClientChargesTest.java` — added `clientChargeInactivateTest()` covering the 
success path, the `isActive` field assertion post-inactivation, and the 
idempotency failure (inactivating an already-inactive charge must return 400).
   
   ## Checklist
   
   - [x] Write the commit message as per our guidelines
   - [x] Acknowledge that we will not review PRs that are not passing the build 
_("green")_ - it is your responsibility to get a proposed PR to pass the build, 
not primarily the project's maintainers.
   - [x] Create/update unit or integration tests for verifying the changes made.
   - [x] Follow our coding conventions.
   - [ ] Add required Swagger annotation and update API documentation at 
fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with 
details of any API changes
   - [x] This PR must not be a "code dump". Large changes can be made in a 
branch, with assistance.


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