diff --git a/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java b/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java index de153ba0e2..5a0fc559ae 100644 --- a/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java +++ b/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java @@ -147,6 +147,7 @@ public CompletableFuture> fetchByBarcode(String barcode) { return fetchItemByBarcode(barcode, createItemFinder()) .thenComposeAsync(itemResult -> itemResult.after(when(item -> ofAsync(item::isNotFound), item -> fetchItemByBarcode(barcode, createCirculationItemFinder()) + .thenApply(r -> r.mapFailure(failure -> Result.succeeded(item))) , item -> completedFuture(itemResult)))) .thenComposeAsync(this::fetchItemRelatedRecords); } @@ -276,6 +277,7 @@ private CompletableFuture> fetchItem(String itemId) { } public CompletableFuture> fetchItemAsJson(String itemId) { + return SingleRecordFetcher.jsonOrNull(itemsClient, "item") .fetch(itemId) .thenApply(mapResult(identityMap::add));