Dpk376 commented on code in PR #5668:
URL: https://github.com/apache/fineract/pull/5668#discussion_r2971184052
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java:
##########
@@ -111,6 +114,58 @@ public static PostClientsResponse createClient(final
PostClientsRequest request)
return
Calls.ok(FineractClientHelper.getFineractClient().clients.createClient(request));
}
+ public static PostClientsResponse addClientAsPerson(final String officeId,
final Long legalFormId, final String externalId) {
+ PostClientsRequest request = new
PostClientsRequest().officeId(officeId != null ? Long.parseLong(officeId) : 1L)
+
.legalFormId(legalFormId).firstname(Utils.randomFirstNameGenerator()).lastname(Utils.randomLastNameGenerator())
+
.externalId(externalId).dateFormat(Utils.DATE_FORMAT).locale("en").active(true).activationDate(DEFAULT_DATE);
+ return createClient(request);
+ }
+
+ public static GetClientsClientIdResponse getClientByExternalId(final
String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveOneClientByExternalId(externalId,
null));
+ }
+
+ public static PutClientsClientIdResponse updateClientByExternalId(final
String externalId, final PutClientsClientIdRequest request) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.updateClientByExternalId(externalId,
request));
+ }
+
+ public static DeleteClientsClientIdResponse deleteClientByExternalId(final
String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.deleteClientByExternalId(externalId));
+ }
+
+ public static GetClientsClientIdAccountsResponse getClientAccounts(final
String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveAllClientAccountsByExternalId(externalId));
+ }
+
+ public static GetClientTransferProposalDateResponse
getProposedTransferDate(final String externalId) {
+ return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveClientTransferTemplateByExternalId(externalId));
+ }
+
+ // public static List<GetObligeeData> getObligeeData(final String
externalId) {
+ // GetClientObligeeDetailsResponse response = Calls
+ //
.ok(FineractClientHelper.getFineractClient().clients.retrieveClientObligeeDetailsByExternalId(externalId));
+ // return response != null && response.getObligees() != null ? new
ArrayList<>(response.getObligees()) : new ArrayList<>();
+ // }
+
Review Comment:
---
> Thank you for the direction! You're right — the root cause was an
incorrect `@ApiResponse` annotation in `ClientsApiResource`.
>
> ### Root Cause
> Both obligee endpoints (`clientId` and `externalId`) were annotated with
`@Schema(implementation = GetClientObligeeDetailsResponse.class)`, describing
the response as a JSON object — but the API actually returns a JSON array
directly.
>
> ### Changes Made
> **`ClientsApiResource.java`**
> - Updated both obligee endpoint annotations to use `@ArraySchema(schema =
@Schema(implementation = GetObligeeData.class))`
>
> **`ClientsApiResourceSwagger.java`**
> - Promoted `GetObligeeData` to a top-level schema class
> - Removed the `GetClientObligeeDetailsResponse` wrapper class
>
> **`ClientHelper.java`**
> - Removed all commented-out code blocks
> - Replaced the RestAssured workaround with a clean feign client call:
> ```java
> return
Calls.ok(FineractClientHelper.getFineractClient().clients.retrieveClientObligeeDetailsByExternalId(externalId));
> ```
>
> Happy to address any further feedback!
--
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]