samchinmaya opened a new pull request, #6603: URL: https://github.com/apache/fineract/pull/6603
## Description JIRA: [FINERACT-2907](https://issues.apache.org/jira/browse/FINERACT-2907) For a client with Legal Form = Entity, the legal entity details (constitution, main business line, incorporation number, incorporation validity date, remarks) are saved in `m_client_non_person`, but `GET /clients/{clientId}` never returns them: `clientNonPersonDetails` is always `null`. Front ends that edit the client (e.g. the Mifos web app's Edit Client) therefore show these fields empty, even though they are set. Cause: since FINERACT-1760, `ClientReadPlatformServiceImpl.retrieveOne()` builds the response with `ClientMapper.map(client)`, and `ClientMapper` has `@Mapping(target = "clientNonPersonDetails", ignore = true)`, so the details are never filled in. Change: - `retrieveOne()` loads the client's `ClientNonPerson` through `ClientNonPersonRepositoryWrapper.findOneByClientId()` and sets `clientNonPersonDetails` (constitution and main business line as `CodeValueData`). Clients without non-person details are unchanged. - `@Getter` on `ClientNonPerson` and `ClientNonPersonData`, for the mapping and the tests. - Swagger: `clientNonPersonDetails` added to the `GET /clients/{clientId}` response model. - Tests: unit test in `ClientReadPlatformServiceImplTest` (details are set when present, and stay `null` for a person client); integration test in `ClientTest` that creates an entity client and checks the returned details. Verification: - Unit tests: `ClientReadPlatformServiceImplTest` passes (6/6). `spotlessJavaCheck` and `checkstyle` pass. - Real API, on a Fineract built from this branch with a fresh database: an entity client created with constitution, main business line, incorporation number/date and remarks now returns all of them in `clientNonPersonDetails`, for both `GET /clients/{id}` and `GET /clients/{id}?template=true`. On `develop`, the same request returns `clientNonPersonDetails: null`, while the row exists in `m_client_non_person`. - I could not run the integration-test module locally (the client SDK build runs out of memory on my machine), so I'm relying on CI for `ClientTest`. The legacy `apiLive.htm` doesn't document the non-person fields at all, so I left it unchanged; the Swagger annotation documents the field. ## Checklist Please make sure these boxes are checked before submitting your pull request - thanks! - [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests) - [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](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made. - [x] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions). - [x] 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"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute). - [x] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately. - [x] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy). Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide). -- 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]
