[
https://issues.apache.org/jira/browse/FINERACT-2932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Saghy resolved FINERACT-2932.
----------------------------------
Resolution: Fixed
> GET /clients/{clientId}/collaterals returns an empty list unless prodId is
> given
> --------------------------------------------------------------------------------
>
> Key: FINERACT-2932
> URL: https://issues.apache.org/jira/browse/FINERACT-2932
> Project: Apache Fineract
> Issue Type: Bug
> Reporter: chinmaya samantara
> Assignee: chinmaya samantara
> Priority: Minor
> Fix For: 1.16.0
>
> Attachments: Screenshot 2026-10-14 at 10.42.25 PM.png
>
>
> hen the optional *prodId* query parameter is not given, even though the
> client has collaterals.
> *Steps to reproduce*
> # Create a collateral product (POST /collateral-management) and add it to a
> client:
> {code:json}
> POST /fineract-provider/api/v1/clients/2/collaterals
> { "collateralId": 1, "quantity": "2", "locale": "en" }
> {code}
> # GET /fineract-provider/api/v1/clients/2/collaterals
> *Actual result:* {{[]}}
> The collateral exists: GET /clients/2/collaterals/1 returns it, and GET
> /clients/2/collaterals?prodId=1 lists it.
> *Expected result:* without prodId, all of the client's collaterals are
> listed. With prodId, only the collaterals in the loan product's currency
> (current behaviour).
> *Cause*
> ClientCollateralManagementRepositoryWrapper.getClientCollateralData() only
> adds a collateral when {{prodId != null && <currency matches>}}, so with no
> prodId nothing is ever added. The currency filter should only apply when a
> loan product is given: {{prodId == null || <currency matches>}}. The code has
> been like this since the collateral module was added (apache/fineract PR
> #1770, 2021).
> Checked on develop 6bb3c0c293.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)