adamsaghy commented on code in PR #3195:
URL: https://github.com/apache/fineract/pull/3195#discussion_r1201936033


##########
fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java:
##########
@@ -66,19 +69,31 @@ public String 
transferRequestWithLoanId(@PathParam("loanId") final Long loanId,
             @Parameter(hidden = true) final String apiRequestBodyAsJson) {
         platformUserRightsContext.isAuthenticated();
 
-        throw new NotImplementedException("Not implemented yet");
+        ExternalTransferResponseData response = null;
+        if (commandParam.equals("sale")) {
+            response = 
externalAssetOwnersWriteService.saleLoanByLoanId(loanId, apiRequestBodyAsJson);
+        } else if (commandParam.equals("buyback")) {
+            response = 
externalAssetOwnersWriteService.buyBackLoanByLoanId(loanId, 
apiRequestBodyAsJson);
+        }
+        return apiJsonSerializerService.serialize(response);
     }
 
     @POST
     @Path("/transfers/loans/external-id/{loanExternalId}")
     @Consumes({ MediaType.APPLICATION_JSON })
     @Produces({ MediaType.APPLICATION_JSON })
-    public String 
transferRequestWithLoanExternalId(@PathParam("loanExternalId") final Long 
loanId,
+    public String 
transferRequestWithLoanExternalId(@PathParam("loanExternalId") final String 
externalLoanId,
             @QueryParam("command") @Parameter(description = "command") final 
String commandParam,
             @Parameter(hidden = true) final String apiRequestBodyAsJson) {
         platformUserRightsContext.isAuthenticated();
 
-        throw new NotImplementedException("Not implemented yet");
+        ExternalTransferResponseData response = null;
+        if (commandParam.equals("sale")) {
+            response = 
externalAssetOwnersWriteService.saleLoanByExternalLoanId(new 
ExternalId(externalLoanId), apiRequestBodyAsJson);

Review Comment:
   Please use the `ExternalIdFactory.produce(loanExternalIdStr)` instead of 
manually create ExternalId object



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