From c24f6aeddcb24d071b1bb46aec4638caad064af4 Mon Sep 17 00:00:00 2001 From: Roman_Barannyk Date: Mon, 1 Apr 2024 19:28:45 +0300 Subject: [PATCH] CIRC-2050 update allowed service point mapping --- .../services/AllowedServicePointsService.java | 3 ++- .../java/api/requests/AllowedServicePointsAPITests.java | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/folio/circulation/services/AllowedServicePointsService.java b/src/main/java/org/folio/circulation/services/AllowedServicePointsService.java index 894448ffc2..50e77a3052 100644 --- a/src/main/java/org/folio/circulation/services/AllowedServicePointsService.java +++ b/src/main/java/org/folio/circulation/services/AllowedServicePointsService.java @@ -157,7 +157,8 @@ private CompletableFuture> fetchUser(AllowedServicePointsRequest re if ("true".equals(request.getUseStubItem())) { return requestPolicyRepository.lookupRequestPolicy(user) - .thenCompose(r -> r.after(policy -> mappingFunction.apply(policy, new HashSet<>(items)))); + .thenCompose(r -> r.after(policy -> extractAllowedServicePointsIgnoringItemStatus( + policy, new HashSet<>()))); } return requestPolicyRepository.lookupRequestPolicies(items, user) diff --git a/src/test/java/api/requests/AllowedServicePointsAPITests.java b/src/test/java/api/requests/AllowedServicePointsAPITests.java index 293295f631..b239f16f05 100644 --- a/src/test/java/api/requests/AllowedServicePointsAPITests.java +++ b/src/test/java/api/requests/AllowedServicePointsAPITests.java @@ -767,14 +767,17 @@ void shouldUseStubItemParameterInCirculationRuleMatchingWhenPresent() { "+ g " + patronGroup, "g " + patronGroup)); var response = getCreateOp(requesterId, instanceId, null, "true", HttpStatus.SC_OK).getJson(); - assertThat(response, hasNoJsonPath(HOLD.getValue())); - assertThat(response, hasNoJsonPath(RECALL.getValue())); assertThat(response, hasNoJsonPath(PAGE.getValue())); + JsonArray allowedPageServicePoints = response.getJsonArray(HOLD.getValue()); + assertServicePointsMatch(allowedPageServicePoints, List.of(cd1, cd2, cd4, cd5)); + allowedPageServicePoints = response.getJsonArray(RECALL.getValue()); + assertServicePointsMatch(allowedPageServicePoints, List.of(cd1, cd2, cd4, cd5)); + response = getCreateOp(requesterId, instanceId, null, "false", HttpStatus.SC_OK).getJson(); assertThat(response, hasNoJsonPath(HOLD.getValue())); assertThat(response, hasNoJsonPath(RECALL.getValue())); - JsonArray allowedPageServicePoints = response.getJsonArray(PAGE.getValue()); + allowedPageServicePoints = response.getJsonArray(PAGE.getValue()); assertServicePointsMatch(allowedPageServicePoints, List.of(cd1, cd2, cd4, cd5)); response = getCreateOp(requesterId, instanceId, null, HttpStatus.SC_OK).getJson();