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

CIRCSTORE-552 Implement the code for the feature UXPROD-5001 #501

Merged
merged 3 commits into from
Dec 16, 2024
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
4 changes: 4 additions & 0 deletions ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
"itemLocationCode": {
"description": "Allow specifying item location when creating title-level requests",
"type": "string"
},
"isDcbReRequestCancellation": {
"description": "Indicates if the request was cancelled during a DCB transaction update. This determines whether the Kafka event will be handled and if an email notification will be sent",
"type": "boolean"
}
},
"additionalProperties": false,
Expand Down
27 changes: 27 additions & 0 deletions src/test/java/org/folio/rest/api/RequestUpdateTriggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import io.vertx.core.json.JsonObject;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;
import lombok.SneakyThrows;

import org.joda.time.DateTime;
import org.joda.time.Seconds;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

Expand Down Expand Up @@ -55,6 +57,31 @@ void beforeEach() throws MalformedURLException {
StorageTestSuite.deleteAll(requestStorageUrl());
}

@Test
@SneakyThrows
void isDcbReRequestCancellationShouldBePresentAfterRequestUpdated() {
CompletableFuture<JsonObject> future = new CompletableFuture<>();

String id = "3a57dc83-e70d-404b-b1f1-442b88760331";
Request request = new Request()
.withStatus(fromValue(Request.Status.OPEN_NOT_YET_FILLED.toString()));

assertThat(request.getIsDcbReRequestCancellation(), is(nullValue()));

saveRequest(id, request)
.compose(v -> updateRequest(id, request
.withStatus(fromValue(Request.Status.CLOSED_CANCELLED.toString()))
.withIsDcbReRequestCancellation(Boolean.TRUE)))
.compose(v -> getRequest(id))
.onComplete(updatedRequest -> future.complete(updatedRequest.result()));

JsonObject updatedRequest = future.get(5, TimeUnit.SECONDS);

assertThat(updatedRequest.getString("isDcbReRequestCancellation"),
is(notNullValue()));

}

@ParameterizedTest
@CsvSource(value = {
"Open - Awaiting pickup | Closed - Pickup expired",
Expand Down
Loading