diff --git a/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java b/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java index c46ded1..46e55c5 100644 --- a/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java +++ b/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java @@ -554,6 +554,9 @@ public JsonObject acceptItem(AcceptItemInitiationData initData, UserId userId, S public JsonObject requestItem(String hrid, UserId userId, boolean titleRequest, String requestType) throws Exception { JsonObject returnValues = new JsonObject(); + JsonObject user = lookupPatronRecord(userId); + if (user == null) + throw new FolioNcipException(Constants.USER_NOT_FOUND); try { String baseUrl = okapiHeaders.get(Constants.X_OKAPI_URL); String searchUrl = baseUrl + (titleRequest ? Constants.INSTANCE_SEARCH_URL : Constants.ITEM_SEARCH_URL) @@ -580,7 +583,7 @@ public JsonObject requestItem(String hrid, UserId userId, boolean titleRequest, } request.put("requestType", requestType); request.put("fulfillmentPreference", "Delivery"); - request.put("requesterId", userId.getUserIdentifierValue()); + request.put("requesterId", user.getString("id")); request.put("requestDate", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now())); String requestUrl = baseUrl + Constants.REQUEST_URL;