Skip to content

Commit

Permalink
Tmp release 24.3.9 (#1539)
Browse files Browse the repository at this point in the history
* CIRC-2198 Implement the code for the feature UXPROD-5001 (#1521)

CIRC-2198 Implement the code for the feature UXPROD-5001

* Update NEWS.md

* [maven-release-plugin] prepare release v24.3.9

* [maven-release-plugin] prepare for next development iteration

---------

Co-authored-by: Antony Hruschev <[email protected]>
Co-authored-by: Antony_Hruschev <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent ea2e5bd commit 4858ade
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>mod-circulation</artifactId>
<groupId>org.folio</groupId>
<version>24.3.9-SNAPSHOT</version>
<version>24.3.10-SNAPSHOT</version>
<licenses>
<license>
<name>Apache License 2.0</name>
Expand Down
4 changes: 4 additions & 0 deletions ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/folio/circulation/domain/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -427,6 +428,10 @@ public boolean hasLoan() {
return loan != null;
}

public boolean getDcbReRequestCancellationValue() {
return getBooleanProperty(requestRepresentation, "isDcbReRequestCancellation");
}

public enum Operation {
CREATE, REPLACE, MOVE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ public Result<RequestAndRelatedRecords> 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit 4858ade

Please sign in to comment.