Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmp release 24.3.9 #1539

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
Loading