Skip to content

Commit

Permalink
UXPROD-5001 Avoid sending cancellation notice if the suppressNotifica…
Browse files Browse the repository at this point in the history
…tion flag is set
  • Loading branch information
Vignesh-kalyanasundaram committed Nov 27, 2024
1 parent e30e7ea commit 1183999
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
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"
},
"isSuppressNotification": {
"description": "Flag to suppress sending cancellation notifications. If true, no notification will be sent when cancelling the request",
"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 getSuppressNotificationFlag() {
return getBooleanProperty(requestRepresentation, "isSuppressNotification");
}

public enum Operation {
CREATE, REPLACE, MOVE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ public Result<RequestAndRelatedRecords> sendNoticeOnRequestCancelled(
log.debug("sendNoticeOnRequestCancelled:: parameters records: {}", () -> records);
Request request = records.getRequest();

if (request.hasItemId()) {
sendCancellationNoticeForRequestWithItemId(request);
} else {
sendCancellationNoticeForRequestWithoutItemId(request);
// Send the cancellation notice only if the suppressNotification flag is false
if (!request.getSuppressNotificationFlag()) {
if (request.hasItemId()) {
sendCancellationNoticeForRequestWithItemId(request);
} else {
sendCancellationNoticeForRequestWithoutItemId(request);
}
}

return succeeded(records);
Expand Down

0 comments on commit 1183999

Please sign in to comment.