diff --git a/ramls/actual-cost-record.json b/ramls/actual-cost-record.json index 71e1cd960..72cbe718b 100644 --- a/ramls/actual-cost-record.json +++ b/ramls/actual-cost-record.json @@ -96,6 +96,10 @@ "description": "Permanent item location of the lost item", "type": "string" }, + "accountId": { + "description": "ID of the fee/fine created based on the actual cost record during its manual processing", + "$ref": "raml-util/schemas/uuid.schema" + }, "feeFineOwnerId": { "description": "Fee/fine owner ID", "type": "string", diff --git a/src/test/java/org/folio/rest/api/ActualCostRecordAPITest.java b/src/test/java/org/folio/rest/api/ActualCostRecordAPITest.java index f9f44a42d..848166af3 100644 --- a/src/test/java/org/folio/rest/api/ActualCostRecordAPITest.java +++ b/src/test/java/org/folio/rest/api/ActualCostRecordAPITest.java @@ -28,7 +28,6 @@ import io.vertx.core.json.JsonObject; import lombok.SneakyThrows; import static org.folio.rest.jaxrs.model.ActualCostRecord.ItemLossType.AGED_TO_LOST; -import static org.folio.rest.jaxrs.model.ActualCostRecord.ItemLossType.DECLARED_LOST; import static org.folio.rest.support.matchers.JsonMatchers.hasSameProperties; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @@ -87,12 +86,19 @@ public void canCreateAndGetAndUpdateActualCostRecord() { assertThat(createResult, hasSameProperties(actualCostRecord)); - JsonObject updatedJson = createResult.put("lossType", DECLARED_LOST.value()); + UUID accountId = UUID.randomUUID(); + JsonObject updatedJson = createResult.put("accountId", accountId.toString()); + updateActualCostRecordAndCheckTheResult(updatedJson); - actualCostRecordClient.attemptPutById(updatedJson); + updatedJson.remove("accountId"); + updateActualCostRecordAndCheckTheResult(updatedJson); + } - JsonObject fetchedJson = actualCostRecordClient.getById(updatedJson.getString("id")).getJson(); + @SneakyThrows + private void updateActualCostRecordAndCheckTheResult(JsonObject updatedJson) { + actualCostRecordClient.attemptPutById(updatedJson); + JsonObject fetchedJson = actualCostRecordClient.getById(updatedJson.getString("id")).getJson(); fetchedJson.remove("metadata"); assertThat(updatedJson, hasSameProperties(fetchedJson)); } @@ -121,6 +127,7 @@ private ActualCostRecord createActualCostRecord() { .withFeeFineType("Lost Item fee (actual cost)"); } + private JsonObject toJsonObject(ActualCostRecord actualCostRecord1) throws JsonProcessingException { return new JsonObject(objectMapper.writeValueAsString(actualCostRecord1));