From 6639d150803c0d2a795ba944c148575494d5e144 Mon Sep 17 00:00:00 2001 From: Roman Barannyk <53909129+roman-barannyk@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:37:03 +0300 Subject: [PATCH] [MODFEE-337] Mandatory "status" field in "accountdata" schema (#284) * MODFEE-337 make status required in accountdata schema * MODFEE-337 fix broken tests --- descriptors/ModuleDescriptor-template.json | 2 +- ramls/accountdata.json | 1 + .../java/org/folio/rest/impl/FeeFineActionsAPITest.java | 6 ++++-- .../org/folio/rest/service/FeeFineChargeServiceTest.java | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/descriptors/ModuleDescriptor-template.json b/descriptors/ModuleDescriptor-template.json index f6bf18e9..bb95fc96 100644 --- a/descriptors/ModuleDescriptor-template.json +++ b/descriptors/ModuleDescriptor-template.json @@ -54,7 +54,7 @@ "provides":[ { "id":"feesfines", - "version":"18.0", + "version": "19.0", "handlers":[ { "methods":[ diff --git a/ramls/accountdata.json b/ramls/accountdata.json index 8c86f85a..a325e0ba 100644 --- a/ramls/accountdata.json +++ b/ramls/accountdata.json @@ -184,6 +184,7 @@ "required": [ "amount", "remaining", + "status", "paymentStatus", "userId", "feeFineId", diff --git a/src/test/java/org/folio/rest/impl/FeeFineActionsAPITest.java b/src/test/java/org/folio/rest/impl/FeeFineActionsAPITest.java index 8d48d927..396f74f6 100644 --- a/src/test/java/org/folio/rest/impl/FeeFineActionsAPITest.java +++ b/src/test/java/org/folio/rest/impl/FeeFineActionsAPITest.java @@ -27,8 +27,6 @@ import static org.folio.test.support.EntityBuilder.buildLocation; import static org.folio.test.support.EntityBuilder.buildUser; import static org.folio.test.support.matcher.LogEventMatcher.noticeErrorLogRecord; -import static org.folio.test.support.matcher.constant.DbTable.ACCOUNTS_TABLE; -import static org.folio.test.support.matcher.constant.DbTable.FEE_FINE_ACTIONS_TABLE; import static org.folio.test.support.matcher.constant.ServicePath.ACCOUNTS_PATH; import static org.folio.test.support.matcher.constant.ServicePath.CAMPUSES_PATH; import static org.folio.test.support.matcher.constant.ServicePath.FEEFINES_PATH; @@ -72,6 +70,7 @@ import org.folio.rest.jaxrs.model.Location; import org.folio.rest.jaxrs.model.Owner; import org.folio.rest.jaxrs.model.PaymentStatus; +import org.folio.rest.jaxrs.model.Status; import org.folio.rest.jaxrs.model.User; import org.folio.rest.service.LogEventPublisher.LogEventPayloadType; import org.folio.test.support.ApiTests; @@ -473,6 +472,7 @@ public void postFeefineActionsWithoutPatronNotification() { .put("materialTypeId", randomId()) .put("feeFineId", feeFineId) .put("ownerId", ownerId) + .put("status", new Status().withName("Open")) .put("paymentStatus", new PaymentStatus().withName(OUTSTANDING)) .put("remaining", 10.0) .put("amount", 10.0)); @@ -529,6 +529,7 @@ public void postFeeFineActionsChangeStaffInfo() { .put("materialTypeId", randomId()) .put("feeFineId", feeFineId) .put("ownerId", ownerId) + .put("status", new Status().withName("Open")) .put("paymentStatus", new PaymentStatus().withName(OUTSTANDING)) .put("remaining", 10.0) .put("amount", 10.0)); @@ -699,6 +700,7 @@ private static Account createAccount(User user, Item item, Feefine feefine, Owne .withTitle("Account-level title") .withCallNumber("Account-level call number") .withLocation("Account-level location") + .withStatus(new Status().withName("Open")) .withPaymentStatus(new PaymentStatus().withName(PAID_PARTIALLY)) .withFeeFineType(feefine.getFeeFineType()) .withMaterialType("book") diff --git a/src/test/java/org/folio/rest/service/FeeFineChargeServiceTest.java b/src/test/java/org/folio/rest/service/FeeFineChargeServiceTest.java index 7b26c16a..bdccd28b 100644 --- a/src/test/java/org/folio/rest/service/FeeFineChargeServiceTest.java +++ b/src/test/java/org/folio/rest/service/FeeFineChargeServiceTest.java @@ -14,6 +14,7 @@ import org.folio.rest.jaxrs.model.Account; import org.folio.rest.jaxrs.model.Feefineaction; import org.folio.rest.jaxrs.model.PaymentStatus; +import org.folio.rest.jaxrs.model.Status; import org.folio.test.support.ApiTests; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -99,6 +100,7 @@ private static Account buildAccount() { return new Account() .withAmount(new MonetaryValue(9.99)) .withRemaining(new MonetaryValue(9.99)) + .withStatus(new Status().withName("Open")) .withPaymentStatus(new PaymentStatus().withName(PaymentStatus.Name.OUTSTANDING)) .withUserId(randomId()) .withFeeFineId(randomId()) @@ -106,4 +108,4 @@ private static Account buildAccount() { .withId(randomId()); } -} \ No newline at end of file +}