From 72afaacc125893c576b15ae4a52716a3f010109c Mon Sep 17 00:00:00 2001 From: Antony Hruschev Date: Mon, 16 Dec 2024 13:49:50 +0400 Subject: [PATCH 1/4] CIRC-2198 Implement the code for the feature UXPROD-5001 (#1521) CIRC-2198 Implement the code for the feature UXPROD-5001 --- ramls/request.json | 4 +++ .../org/folio/circulation/domain/Request.java | 5 +++ .../resources/RequestNoticeSender.java | 10 +++--- .../resources/RequestNoticeSenderTest.java | 36 +++++++++++++++++++ 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 src/test/java/org/folio/circulation/resources/RequestNoticeSenderTest.java diff --git a/ramls/request.json b/ramls/request.json index 491928db08..e7f2fcf3f9 100644 --- a/ramls/request.json +++ b/ramls/request.json @@ -437,6 +437,10 @@ "itemLocationCode": { "description": "Allow specifying item location when creating title-level requests", "type": "string" + }, + "isDcbReRequestCancellation": { + "description": "Indicates whether the request was cancelled during a DCB transaction update", + "type": "boolean" } }, "additionalProperties": false, diff --git a/src/main/java/org/folio/circulation/domain/Request.java b/src/main/java/org/folio/circulation/domain/Request.java index 597cda08ef..6e4a6b7c0e 100644 --- a/src/main/java/org/folio/circulation/domain/Request.java +++ b/src/main/java/org/folio/circulation/domain/Request.java @@ -29,6 +29,7 @@ import static org.folio.circulation.domain.representations.RequestProperties.REQUEST_LEVEL; import static org.folio.circulation.domain.representations.RequestProperties.REQUEST_TYPE; import static org.folio.circulation.domain.representations.RequestProperties.STATUS; +import static org.folio.circulation.support.json.JsonPropertyFetcher.getBooleanProperty; import static org.folio.circulation.support.json.JsonPropertyFetcher.getDateTimeProperty; import static org.folio.circulation.support.json.JsonPropertyFetcher.getIntegerProperty; import static org.folio.circulation.support.json.JsonPropertyFetcher.getProperty; @@ -427,6 +428,10 @@ public boolean hasLoan() { return loan != null; } + public boolean getDcbReRequestCancellationValue() { + return getBooleanProperty(requestRepresentation, "isDcbReRequestCancellation"); + } + public enum Operation { CREATE, REPLACE, MOVE; } diff --git a/src/main/java/org/folio/circulation/resources/RequestNoticeSender.java b/src/main/java/org/folio/circulation/resources/RequestNoticeSender.java index 01e585550d..3499623d01 100644 --- a/src/main/java/org/folio/circulation/resources/RequestNoticeSender.java +++ b/src/main/java/org/folio/circulation/resources/RequestNoticeSender.java @@ -120,10 +120,12 @@ public Result sendNoticeOnRequestCancelled( log.debug("sendNoticeOnRequestCancelled:: parameters records: {}", () -> records); Request request = records.getRequest(); - if (request.hasItemId()) { - sendCancellationNoticeForRequestWithItemId(request); - } else { - sendCancellationNoticeForRequestWithoutItemId(request); + if (!request.getDcbReRequestCancellationValue()) { + if (request.hasItemId()) { + sendCancellationNoticeForRequestWithItemId(request); + } else { + sendCancellationNoticeForRequestWithoutItemId(request); + } } return succeeded(records); diff --git a/src/test/java/org/folio/circulation/resources/RequestNoticeSenderTest.java b/src/test/java/org/folio/circulation/resources/RequestNoticeSenderTest.java new file mode 100644 index 0000000000..a742d50205 --- /dev/null +++ b/src/test/java/org/folio/circulation/resources/RequestNoticeSenderTest.java @@ -0,0 +1,36 @@ +package org.folio.circulation.resources; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; + +import org.folio.circulation.domain.Request; +import org.folio.circulation.domain.RequestAndRelatedRecords; +import org.folio.circulation.domain.notice.ImmediatePatronNoticeService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.jupiter.MockitoExtension; + +import api.support.builders.RequestBuilder; +import io.vertx.core.json.JsonObject; + +@ExtendWith(MockitoExtension.class) +class RequestNoticeSenderTest { + + @Mock + private ImmediatePatronNoticeService immediatePatronNoticeService; + @InjectMocks + private RequestNoticeSender requestNoticeSender; + + @Test + void shouldNotSendNotificationWhenIsDcbCancellationTrue() { + JsonObject representation = new RequestBuilder().create(); + representation.put("isDcbReRequestCancellation", true); + requestNoticeSender.sendNoticeOnRequestCancelled( + new RequestAndRelatedRecords(Request.from(representation))); + Mockito.verify(immediatePatronNoticeService, times(0)).acceptNoticeEvent(any()); + Mockito.verify(immediatePatronNoticeService, times(0)).sendNotice(any(), any()); + } +} From 40b6e66fddca202380dce83123985afaa096c993 Mon Sep 17 00:00:00 2001 From: gurleenkaurbp Date: Fri, 17 Jan 2025 14:59:45 +0530 Subject: [PATCH 2/4] Update NEWS.md --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 14169c8832..4320d5784e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +## 24.3.9 2025-01-17 +* Support DCB re-request (CIRC-2198) + ## 24.3.8 2025-01-14 * Fix TLR fetching issue for search slips (CIRC-2197) From 1de258c41ce9852ec85a570bc21d80a64bb08783 Mon Sep 17 00:00:00 2001 From: Antony_Hruschev Date: Fri, 17 Jan 2025 15:14:02 +0400 Subject: [PATCH 3/4] [maven-release-plugin] prepare release v24.3.9 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 66256f0938..c1c445acec 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 mod-circulation org.folio - 24.3.9-SNAPSHOT + 24.3.9 Apache License 2.0 @@ -303,7 +303,7 @@ https://github.com/folio-org/mod-inventory scm:git:git://github.com:folio-org/mod-inventory.git scm:git:git@github.com:folio-org/mod-inventory.git - HEAD + v24.3.9 From 75b78f8533f0f43a5db245fd18dff43fc9e67c1f Mon Sep 17 00:00:00 2001 From: Antony_Hruschev Date: Fri, 17 Jan 2025 15:14:03 +0400 Subject: [PATCH 4/4] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c1c445acec..22530b14de 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 mod-circulation org.folio - 24.3.9 + 24.3.10-SNAPSHOT Apache License 2.0 @@ -303,7 +303,7 @@ https://github.com/folio-org/mod-inventory scm:git:git://github.com:folio-org/mod-inventory.git scm:git:git@github.com:folio-org/mod-inventory.git - v24.3.9 + HEAD