From 51c956f9f87ed7beb2e683c97740b949ea22fa31 Mon Sep 17 00:00:00 2001 From: JanisSaldabols <143704574+JanisSaldabols@users.noreply.github.com> Date: Wed, 22 May 2024 10:40:35 +0300 Subject: [PATCH] Pr 1709 dev (#7) * PR-1709 Make valid response with all mandatory fields * PR-1709 Use user barcode for request item --- src/main/java/org/folio/ncip/FolioRemoteServiceManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;