Abhishek6122008 commented on code in PR #6076:
URL: https://github.com/apache/fineract/pull/6076#discussion_r3519391214


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientFamilyMembersReadPlatformServiceImpl.java:
##########
@@ -101,14 +103,18 @@ public List<ClientFamilyMembersData> 
getClientFamilyMembers(long clientId) {
     }
 
     @Override
-    public ClientFamilyMembersData getClientFamilyMember(long id) {
+    public ClientFamilyMembersData getClientFamilyMember(long clientId, long 
familyMemberId) {
 
         this.context.authenticatedUser();
 
         final ClientFamilyMembersMapper rm = new ClientFamilyMembersMapper();
-        final String sql = "select " + rm.schema() + " where fmb.id=? ";
+        final String sql = "select " + rm.schema() + " where fmb.client_id=? 
and fmb.id=? ";
 
-        return this.jdbcTemplate.queryForObject(sql, rm, id); // NOSONAR
+        try {
+            return this.jdbcTemplate.queryForObject(sql, rm, clientId, 
familyMemberId); // NOSONAR
+        } catch (final EmptyResultDataAccessException e) {
+            throw new FamilyMemberNotFoundException(familyMemberId, clientId, 
e);

Review Comment:
   It returns HTTP 404 with the platform's standard not-found payload 
(previously HTTP 500):
   
   ```json
   {
       "developerMessage": "The requested resource is not available.",
       "httpStatusCode": "404",
       "defaultUserMessage": "The requested resource is not available.",
       "userMessageGlobalisationCode": "error.msg.resource.not.found",
       "errors": [
           {
               "developerMessage": "Family member with identifier 999999 does 
not exist for client with identifier 7",
               "defaultUserMessage": "Family member with identifier 999999 does 
not exist for client with identifier 7",
               "userMessageGlobalisationCode": 
"error.msg.family.member.id.invalid",
               "parameterName": "id"
           }
       ]
   }
   ```
   
   Same shape for the GSIM lookup with `error.msg.gsim.account.id.invalid`. The 
new integration tests assert both the 404 and the globalisation code.
   



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