Skip to content

Commit

Permalink
CIRC-2050 update allowed service point mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-barannyk committed Apr 1, 2024
1 parent 1832e8e commit c24f6ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ private CompletableFuture<Result<User>> 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)
Expand Down
9 changes: 6 additions & 3 deletions src/test/java/api/requests/AllowedServicePointsAPITests.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit c24f6ae

Please sign in to comment.