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)
diff --git a/pom.xml b/pom.xml
index 66256f0938..22530b14de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
mod-circulation
org.folio
- 24.3.9-SNAPSHOT
+ 24.3.10-SNAPSHOT
Apache License 2.0
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());
+ }
+}