diff --git a/ramls/acq-models b/ramls/acq-models index d3cfe3c19..0502772fd 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit d3cfe3c19baf07a03465bb6a51161a40ed294877 +Subproject commit 0502772fdadd941734a132501c0cfe9baab243d8 diff --git a/src/main/java/org/folio/rest/core/exceptions/ErrorCodes.java b/src/main/java/org/folio/rest/core/exceptions/ErrorCodes.java index 766e54128..805a8bc4d 100644 --- a/src/main/java/org/folio/rest/core/exceptions/ErrorCodes.java +++ b/src/main/java/org/folio/rest/core/exceptions/ErrorCodes.java @@ -114,7 +114,11 @@ public enum ErrorCodes { FUND_LOCATION_RESTRICTION_VIOLATION("fundLocationRestrictionViolation", "One of the locations is restricted to be used by all funds."), ENCUMBRANCES_FOR_RE_ENCUMBER_NOT_FOUND("encumbrancesForReEncumberNotFound", "The encumbrances were correctly created during the rollover or have already been updated."), CLAIMING_CONFIG_INVALID("claimingConfigInvalid", "Claiming interval should be set and greater than 0 if claiming is active"), - TEMPLATE_NAME_ALREADY_EXISTS("templateNameNotUnique", "Template name already exists"); + TEMPLATE_NAME_ALREADY_EXISTS("templateNameNotUnique", "Template name already exists"), + INVALID_PHYSICAL_POL("physicalPOLShouldContainOnlyPhysicalElement", "Physical order format should contain only physical resource"), + INVALID_ELECTRONIC_POL("electronicPOLShouldContainOnlyElectronicElement", "Electronic order format should contain only electronic resource"), + INVALID_PEMIX_POL("peMixPOLShouldContainPhysicalAndElectronicElement", "PE mix order format should contain both of physical and electronic resource"), + INVALID_OTHER_POL("otherPOLShouldContainPhysicalElement", "Other order format should contain only physical resource"); private final String code; diff --git a/src/main/java/org/folio/service/orders/CompositePoLineValidationService.java b/src/main/java/org/folio/service/orders/CompositePoLineValidationService.java index dec8e0bba..bdea6ae02 100644 --- a/src/main/java/org/folio/service/orders/CompositePoLineValidationService.java +++ b/src/main/java/org/folio/service/orders/CompositePoLineValidationService.java @@ -34,7 +34,6 @@ import io.vertx.core.Future; - public class CompositePoLineValidationService extends BaseValidationService { private final ExpenseClassValidationService expenseClassValidationService; @@ -55,6 +54,7 @@ public Future> validatePoLine(CompositePoLine compPOL, RequestContex return expenseClassValidationService.validateExpenseClasses(List.of(compPOL), false, requestContext) .onSuccess(v -> errors.addAll(validatePoLineFormats(compPOL))) .onSuccess(v -> errors.addAll(validateLocations(compPOL))) + .onSuccess(v -> errors.addAll(validatePoLineMaterial(compPOL))) .map(v -> { errors.addAll(validateCostPrices(compPOL)); return errors; @@ -76,6 +76,58 @@ private List validatePoLineFormats(CompositePoLine compPOL) { return Collections.emptyList(); } + public List validatePoLineMaterial(CompositePoLine compPOL) { + CompositePoLine.OrderFormat orderFormat = compPOL.getOrderFormat(); + + return switch (orderFormat) { + case P_E_MIX -> checkPEMix(compPOL); + case ELECTRONIC_RESOURCE -> checkElectronicResource(compPOL); + case PHYSICAL_RESOURCE -> checkPhysicalResource(compPOL); + case OTHER -> checkOtherResource(compPOL); + default -> Collections.emptyList(); + }; + } + + private List checkPEMix(CompositePoLine compPOL) { + List errors = new ArrayList<>(); + + if ((compPOL.getPhysical() == null) || (compPOL.getEresource() == null) || (getElectronicCostQuantity(compPOL) == 0) || (getPhysicalCostQuantity(compPOL) == 0)) { + errors.add(ErrorCodes.INVALID_PEMIX_POL); + } + + return convertErrorCodesToErrors(compPOL, errors); + } + + private List checkElectronicResource(CompositePoLine compPOL) { + List errors = new ArrayList<>(); + + if ((compPOL.getPhysical() != null) && (getPhysicalCostQuantity(compPOL) != 0)) { + errors.add(ErrorCodes.INVALID_ELECTRONIC_POL); + } + + return convertErrorCodesToErrors(compPOL, errors); + } + + private List checkPhysicalResource(CompositePoLine compPOL) { + List errors = new ArrayList<>(); + + if ((compPOL.getEresource() != null) && (getElectronicCostQuantity(compPOL) != 0)) { + errors.add(ErrorCodes.INVALID_PHYSICAL_POL); + } + + return convertErrorCodesToErrors(compPOL, errors); + } + + private List checkOtherResource(CompositePoLine compPOL) { + List errors = new ArrayList<>(); + + if ((compPOL.getEresource() != null) && (getElectronicCostQuantity(compPOL) != 0)) { + errors.add(ErrorCodes.INVALID_OTHER_POL); + } + + return convertErrorCodesToErrors(compPOL, errors); + } + private List validatePoLineWithMixedFormat(CompositePoLine compPOL) { List errors = new ArrayList<>(); diff --git a/src/test/java/org/folio/rest/impl/PurchaseOrderLinesApiTest.java b/src/test/java/org/folio/rest/impl/PurchaseOrderLinesApiTest.java index 35bca5d3e..ee2a1424c 100644 --- a/src/test/java/org/folio/rest/impl/PurchaseOrderLinesApiTest.java +++ b/src/test/java/org/folio/rest/impl/PurchaseOrderLinesApiTest.java @@ -58,6 +58,7 @@ import static org.folio.rest.core.exceptions.ErrorCodes.ELECTRONIC_COST_LOC_QTY_MISMATCH; import static org.folio.rest.core.exceptions.ErrorCodes.INACTIVE_EXPENSE_CLASS; import static org.folio.rest.core.exceptions.ErrorCodes.INSTANCE_ID_NOT_ALLOWED_FOR_PACKAGE_POLINE; +import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_ELECTRONIC_POL; import static org.folio.rest.core.exceptions.ErrorCodes.ISBN_NOT_VALID; import static org.folio.rest.core.exceptions.ErrorCodes.LOCATION_CAN_NOT_BE_MODIFIER_AFTER_OPEN; import static org.folio.rest.core.exceptions.ErrorCodes.NON_ZERO_COST_ELECTRONIC_QTY; @@ -448,7 +449,7 @@ void testPutOrderLineElectronicFormatIncorrectQuantityAndPrice() { final Errors response = verifyPut(String.format(LINE_BY_ID_PATH, reqData.getId()), JsonObject.mapFrom(reqData), APPLICATION_JSON, 422).as(Errors.class); - assertThat(response.getErrors(), hasSize(8)); + assertThat(response.getErrors(), hasSize(9)); List errorCodes = response.getErrors() .stream() .map(Error::getCode) @@ -461,7 +462,8 @@ void testPutOrderLineElectronicFormatIncorrectQuantityAndPrice() { COST_ADDITIONAL_COST_INVALID.getCode(), COST_DISCOUNT_INVALID.getCode(), ELECTRONIC_COST_LOC_QTY_MISMATCH.getCode(), - PHYSICAL_COST_LOC_QTY_MISMATCH.getCode())); + PHYSICAL_COST_LOC_QTY_MISMATCH.getCode(), + INVALID_ELECTRONIC_POL.getCode())); // Check that no any calls made by the business logic to other services @@ -1682,7 +1684,7 @@ public void testFundDistributionValidationWhenZeroPriceAndDifferentDistributionT void testPutPhysicalOrderLineByIdWhenSpecificElementIsPresentAndProtectedFieldsChanged(CompositePoLine.OrderFormat orderFormat) { logger.info("=== Test PUT Order Line By Id - Protected fields changed ==="); - String lineId = "0009662b-8b80-4001-b704-ca10971f222d"; + String lineId = "0009662b-8b80-4001-b704-ca10971f222e"; JsonObject body = getMockAsJson(PO_LINES_MOCK_DATA_PATH, lineId); Object[] expected = new Object[]{ POLineFieldNames.ACQUISITION_METHOD.getFieldName()}; if (CompositePoLine.OrderFormat.ELECTRONIC_RESOURCE == orderFormat) { @@ -1750,7 +1752,7 @@ void testPutElecOrderLineByIdWhenSpecificElementIsPresentAndProtectedFieldsChang void testPutMixedOrderLineByIdWhenSpecificElementIsPresentAndProtectedFieldsChanged(CompositePoLine.OrderFormat orderFormat) { logger.info("=== Test PUT Order Line By Id - Protected fields changed ==="); - String lineId = "0009662b-8b80-4001-b704-ca10971f222d"; + String lineId = "0009662b-8b80-4001-b704-ca10971f222f"; JsonObject body = getMockAsJson(PO_LINES_MOCK_DATA_PATH, lineId); Object[] expected = new Object[]{ POLineFieldNames.ACQUISITION_METHOD.getFieldName()}; diff --git a/src/test/java/org/folio/rest/impl/PurchaseOrdersApiTest.java b/src/test/java/org/folio/rest/impl/PurchaseOrdersApiTest.java index d9d93b516..ad12abbcf 100644 --- a/src/test/java/org/folio/rest/impl/PurchaseOrdersApiTest.java +++ b/src/test/java/org/folio/rest/impl/PurchaseOrdersApiTest.java @@ -55,6 +55,9 @@ import static org.folio.rest.core.exceptions.ErrorCodes.INACTIVE_EXPENSE_CLASS; import static org.folio.rest.core.exceptions.ErrorCodes.INCORRECT_FUND_DISTRIBUTION_TOTAL; import static org.folio.rest.core.exceptions.ErrorCodes.INSTANCE_ID_NOT_ALLOWED_FOR_PACKAGE_POLINE; +import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_OTHER_POL; +import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_PEMIX_POL; +import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_PHYSICAL_POL; import static org.folio.rest.core.exceptions.ErrorCodes.ISBN_NOT_VALID; import static org.folio.rest.core.exceptions.ErrorCodes.MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY; import static org.folio.rest.core.exceptions.ErrorCodes.MISSING_MATERIAL_TYPE; @@ -600,7 +603,7 @@ void testPostOrderWithIncorrectCost() throws Exception { final Errors response = verifyPostResponse(COMPOSITE_ORDERS_PATH, JsonObject.mapFrom(reqData).encode(), prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10), APPLICATION_JSON, 422).as(Errors.class); - assertThat(response.getErrors(), hasSize(10)); + assertThat(response.getErrors(), hasSize(12)); Set errorCodes = response.getErrors() .stream() .map(Error::getCode) @@ -612,7 +615,9 @@ void testPostOrderWithIncorrectCost() throws Exception { PHYSICAL_COST_LOC_QTY_MISMATCH.getCode(), ELECTRONIC_COST_LOC_QTY_MISMATCH.getCode(), COST_UNIT_PRICE_ELECTRONIC_INVALID.getCode(), - COST_UNIT_PRICE_INVALID.getCode())); + COST_UNIT_PRICE_INVALID.getCode(), + INVALID_OTHER_POL.getCode(), + INVALID_PEMIX_POL.getCode())); } @Test @@ -726,7 +731,7 @@ void testPutOrderWithIncorrectQuantities() throws Exception { APPLICATION_JSON, 422).as(Errors.class); - assertThat(response.getErrors(), hasSize(5)); + assertThat(response.getErrors(), hasSize(6)); Set errorCodes = response.getErrors() .stream() .map(Error::getCode) @@ -736,7 +741,8 @@ void testPutOrderWithIncorrectQuantities() throws Exception { ZERO_COST_PHYSICAL_QTY.getCode(), ELECTRONIC_COST_LOC_QTY_MISMATCH.getCode(), PHYSICAL_COST_LOC_QTY_MISMATCH.getCode(), - ZERO_LOCATION_QTY.getCode())); + ZERO_LOCATION_QTY.getCode(), + INVALID_PEMIX_POL.getCode())); } @Test @@ -2340,6 +2346,7 @@ void testPostOrdersCreateInventoryPhysicalNone() throws Exception { reqData.getCompositePoLines().get(0).getCost().setListUnitPriceElectronic(0d); reqData.getCompositePoLines().get(0).getLocations().get(0).setQuantityElectronic(0); + verifyPostResponse(COMPOSITE_ORDERS_PATH, JsonObject.mapFrom(reqData).toString(), prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10, X_OKAPI_USER_ID), APPLICATION_JSON, 201).as(CompositePurchaseOrder.class); diff --git a/src/test/java/org/folio/service/orders/CompositePoLineValidationServiceTest.java b/src/test/java/org/folio/service/orders/CompositePoLineValidationServiceTest.java index 863c6130d..25903b4a8 100644 --- a/src/test/java/org/folio/service/orders/CompositePoLineValidationServiceTest.java +++ b/src/test/java/org/folio/service/orders/CompositePoLineValidationServiceTest.java @@ -6,9 +6,12 @@ import java.util.List; import java.util.UUID; +import com.github.tomakehurst.wiremock.http.ssl.TrustEverythingStrategy; + import org.folio.rest.core.exceptions.ErrorCodes; import org.folio.rest.jaxrs.model.CompositePoLine; import org.folio.rest.jaxrs.model.Cost; +import org.folio.rest.jaxrs.model.Eresource; import org.folio.rest.jaxrs.model.Error; import org.folio.rest.jaxrs.model.Location; import org.folio.rest.jaxrs.model.Physical; @@ -23,7 +26,7 @@ public class CompositePoLineValidationServiceTest { private CompositePoLineValidationService compositePoLineValidationService; @BeforeEach - public void initMocks(){ + public void initMocks() { MockitoAnnotations.openMocks(this); } @@ -112,4 +115,68 @@ void shouldReturnErrorIfClaimingIntervalIsNegativeWhenClaimingActive() { assertEquals(1, errors.size()); assertEquals(ErrorCodes.CLAIMING_CONFIG_INVALID.getCode(), errors.get(0).getCode()); } + + @Test + @DisplayName("Should return error if physical order format contains Electronic resources.") + void shouldReturnErrorIfPhysicalContainsElectronicSource() { + Eresource eresource = new Eresource(); + CompositePoLine.OrderFormat format = CompositePoLine.OrderFormat.PHYSICAL_RESOURCE; + Cost cost = new Cost().withQuantityElectronic(1); + CompositePoLine compositePoLine = new CompositePoLine().withOrderFormat(format).withEresource(eresource).withCost(cost); + List errors = compositePoLineValidationService.validatePoLineMaterial(compositePoLine); + + assertEquals(1, errors.size()); + assertEquals(ErrorCodes.INVALID_PHYSICAL_POL.getCode(), errors.get(0).getCode()); + } + + @Test + @DisplayName("Should return error if electronic order format contains physical resources.") + void shouldReturnErrorIfElectronicContainsPhysicalSource() { + Physical physical = new Physical(); + CompositePoLine.OrderFormat format = CompositePoLine.OrderFormat.ELECTRONIC_RESOURCE; + Cost cost = new Cost().withQuantityPhysical(1); + CompositePoLine compositePoLine = new CompositePoLine().withOrderFormat(format).withPhysical(physical).withCost(cost); + List errors = compositePoLineValidationService.validatePoLineMaterial(compositePoLine); + + assertEquals(1, errors.size()); + assertEquals(ErrorCodes.INVALID_ELECTRONIC_POL.getCode(), errors.get(0).getCode()); + } + + @Test + @DisplayName("Should return error if p/e mix order format does not contains physical resources.") + void shouldReturnErrorIfMixedDoesNotContainsPhysicalSource() { + Eresource eresource = new Eresource(); + CompositePoLine.OrderFormat format = CompositePoLine.OrderFormat.P_E_MIX; + CompositePoLine compositePoLine = new CompositePoLine().withOrderFormat(format).withEresource(eresource); + List errors = compositePoLineValidationService.validatePoLineMaterial(compositePoLine); + + assertEquals(1, errors.size()); + assertEquals(ErrorCodes.INVALID_PEMIX_POL.getCode(), errors.get(0).getCode()); + } + + @Test + @DisplayName("Should return error if p/e mix order format does not contains electronic resources.") + void shouldReturnErrorIfMixedDoesNotContainsESource() { + Physical physical = new Physical(); + CompositePoLine.OrderFormat format = CompositePoLine.OrderFormat.P_E_MIX; + CompositePoLine compositePoLine = new CompositePoLine().withOrderFormat(format).withPhysical(physical); + List errors = compositePoLineValidationService.validatePoLineMaterial(compositePoLine); + + assertEquals(1, errors.size()); + assertEquals(ErrorCodes.INVALID_PEMIX_POL.getCode(), errors.get(0).getCode()); + } + + @Test + @DisplayName("Should return error if other order format contains Electronic resources.") + void shouldReturnErrorIfOtherContainsElectronicSource() { + Eresource eresource = new Eresource(); + CompositePoLine.OrderFormat format = CompositePoLine.OrderFormat.OTHER; + Cost cost = new Cost().withQuantityElectronic(1); + CompositePoLine compositePoLine = new CompositePoLine().withOrderFormat(format).withEresource(eresource).withCost(cost); + List errors = compositePoLineValidationService.validatePoLineMaterial(compositePoLine); + + assertEquals(1, errors.size()); + assertEquals(ErrorCodes.INVALID_OTHER_POL.getCode(), errors.get(0).getCode()); + } + } diff --git a/src/test/resources/mockdata/lines/0009662b-8b80-4001-b704-ca10971f222e.json b/src/test/resources/mockdata/lines/0009662b-8b80-4001-b704-ca10971f222e.json new file mode 100644 index 000000000..4a11b75c0 --- /dev/null +++ b/src/test/resources/mockdata/lines/0009662b-8b80-4001-b704-ca10971f222e.json @@ -0,0 +1,83 @@ +{ + "id" : "0009662b-8b80-4001-b704-ca10971f222e", + "acquisitionMethod" : "Purchase At Vendor System", + "alerts" : [ ], + "cancellationRestriction" : false, + "cancellationRestrictionNote" : "ABCDEFGHIJKLMNOPQRSTUVW", + "claims" : [ ], + "collection" : false, + "contributors" : [ { + "contributor" : "Ed Mashburn", + "contributorNameTypeId" : "fbdd42a8-e47d-4694-b448-cc571d1b44c3" + } ], + "cost": { + "currency": "USD", + "listUnitPrice": 900.00, + "quantityPhysical": 1 + }, + "description": "", + "details": { + "receivingNote": "start with v. 162", + "productIds": [ + { + "productId": "0065-3438", + "productIdType": "913300b2-03ed-469a-8179-c1092c991227" + } + ], + "subscriptionFrom": "2018-07-01T00:00:00.000Z", + "subscriptionInterval": 1095, + "subscriptionTo": "2021-06-30T00:00:00.000Z" + }, + "donor": "", + "fundDistribution": [ + { + "code": "STATE-SUBN", + "fundId": "e54b1f4d-7d05-4b1a-9368-3c36b75d8ac6", + "distributionType": "percentage", + "value": 100.0, + "encumbrance": "eb506834-6c70-4239-8d1a-6414a5b08011" + } + ], + "locations": [ + { + "locationId": "758258bc-ecc1-41b8-abca-f7b610822ffd", + "quantity": 1, + "quantityElectronic": 0, + "quantityPhysical": 1 + } + ], + "orderFormat": "Physical Resource", + "paymentStatus": "Pending", + "physical": { + "createInventory": "Instance, Holding, Item", + "materialSupplier": "6828d7cb-d84e-41e5-9db5-fc2e162f9ffb", + "materialType": "2fa93835-ea37-479d-b133-1d2a2279fcd8", + "receiptDue": "2018-07-31T00:00:00.000Z", + "volumes": [] + }, + "poLineDescription": "", + "poLineNumber": "1EFC97C6B7-1", + "publicationDate": "2018", + "publisher": "Plenum Press", + "purchaseOrderId": "11111111-dddd-4444-9999-ffffffffffff", + "receiptDate": null, + "receiptStatus": "Pending", + "reportingCodes": [], + "requester": "", + "rush": false, + "selector": "", + "source": "User", + "tags": { + "tagList": [] + }, + "titleOrPackage": "Advances in astronautical science", + "vendorDetail": { + "instructions": "", + "noteFromVendor": "", + "vendorAccount": "" + }, + "metadata": { + "createdDate": "2010-10-08T03:53:00.000", + "createdByUserId": "ab18897b-0e40-4f31-896b-9c9adc979a88" + } +} diff --git a/src/test/resources/mockdata/lines/0009662b-8b80-4001-b704-ca10971f222f.json b/src/test/resources/mockdata/lines/0009662b-8b80-4001-b704-ca10971f222f.json new file mode 100644 index 000000000..c00d2dd31 --- /dev/null +++ b/src/test/resources/mockdata/lines/0009662b-8b80-4001-b704-ca10971f222f.json @@ -0,0 +1,93 @@ +{ + "id" : "0009662b-8b80-4001-b704-ca10971f222f", + "acquisitionMethod" : "Purchase At Vendor System", + "alerts" : [ ], + "cancellationRestriction" : false, + "cancellationRestrictionNote" : "ABCDEFGHIJKLMNOPQRSTUVW", + "claims" : [ ], + "collection" : false, + "contributors" : [ { + "contributor" : "Ed Mashburn", + "contributorNameTypeId" : "fbdd42a8-e47d-4694-b448-cc571d1b44c3" + } ], + "cost": { + "currency": "USD", + "listUnitPrice": 900.00, + "listUnitPriceElectronic": 22.99, + "quantityPhysical": 1, + "quantityElectronic": 1 + }, + "description": "", + "details": { + "receivingNote": "start with v. 162", + "productIds": [ + { + "productId": "0065-3438", + "productIdType": "913300b2-03ed-469a-8179-c1092c991227" + } + ], + "subscriptionFrom": "2018-07-01T00:00:00.000Z", + "subscriptionInterval": 1095, + "subscriptionTo": "2021-06-30T00:00:00.000Z" + }, + "donor": "", + "fundDistribution": [ + { + "code": "STATE-SUBN", + "fundId": "e54b1f4d-7d05-4b1a-9368-3c36b75d8ac6", + "distributionType": "percentage", + "value": 100.0, + "encumbrance": "eb506834-6c70-4239-8d1a-6414a5b08011" + } + ], + "locations": [ + { + "locationId": "758258bc-ecc1-41b8-abca-f7b610822ffd", + "quantity": 1, + "quantityElectronic": 1, + "quantityPhysical": 1 + } + ], + "orderFormat": "P/E Mix", + "paymentStatus": "Pending", + "physical": { + "createInventory": "Instance, Holding, Item", + "materialSupplier": "6828d7cb-d84e-41e5-9db5-fc2e162f9ffb", + "materialType": "2fa93835-ea37-479d-b133-1d2a2279fcd8", + "receiptDue": "2018-07-31T00:00:00.000Z", + "volumes": [] + }, + "eresource": { + "activationDue": 0, + "createInventory": "Instance", + "expectedActivation": "2019-01-01T00:00:00.000Z", + "userLimit": 0, + "accessProvider": "d0fb5aa0-cdf1-11e8-a8d5-f2801f1b9fd1", + "materialType": "1a54b431-2e4f-452d-9cae-9cee66c9a892" + }, + "poLineDescription": "", + "poLineNumber": "1EFC97C6B7-1", + "publicationDate": "2018", + "publisher": "Plenum Press", + "purchaseOrderId": "11111111-dddd-4444-9999-ffffffffffff", + "receiptDate": null, + "receiptStatus": "Pending", + "reportingCodes": [], + "requester": "", + "rush": false, + "selector": "", + "source": "User", + "tags": { + "tagList": [] + }, + "titleOrPackage": "Advances in astronautical science", + "vendorDetail": { + "instructions": "", + "noteFromVendor": "", + "vendorAccount": "" + }, + "metadata": { + "createdDate": "2010-10-08T03:53:00.000", + "createdByUserId": "ab18897b-0e40-4f31-896b-9c9adc979a88" + } +} diff --git a/src/test/resources/print_monograph_for_create_inventory_test_physical.json b/src/test/resources/print_monograph_for_create_inventory_test_physical.json new file mode 100644 index 000000000..969bf4642 --- /dev/null +++ b/src/test/resources/print_monograph_for_create_inventory_test_physical.json @@ -0,0 +1,159 @@ +{ + "approved": true, + "assignedTo": "ab18897b-0e40-4f31-896b-9c9adc979a88", + "notes": [ + "ABCDEFGHIJKLMNO", + "ABCDEFGHIJKLMNOPQRST", + "ABCDEFGHIJKLMNOPQRSTUV" + ], + "orderType": "One-Time", + "poNumber": "2687001", + "reEncumber": false, + "totalEstimatedPrice": 300.00, + "totalItems": 4, + "vendor": "d0fb5aa0-cdf1-11e8-a8d5-f2801f1b9fd1", + "workflowStatus": "Pending", + "metadata": { + "createdDate": "2010-10-08T03:53:00.000", + "createdByUserId": "ab18897b-0e40-4f31-896b-9c9adc979a88" + }, + "compositePoLines": [ + { + "acquisitionMethod": "306489dd-0053-49ee-a068-c316444a8f55", + "alerts": [ + { + "alert": "Receipt overdue" + } + ], + "cancellationRestriction": false, + "cancellationRestrictionNote": "ABCDEFGHIJKLMNOPQRSTUVW", + "claims": [ + { + "claimed": false, + "sent": "2018-10-09T00:00:00.000Z", + "grace": 30 + } + ], + "collection": false, + "contributors": [ + { + "contributor": "Ed Mashburn", + "contributorNameTypeId": "fbdd42a8-e47d-4694-b448-cc571d1b44c3" + }, + { + "contributor": "Ed Mashburn 2", + "contributorNameTypeId": "2e48e713-17f3-4c13-a9f8-23845bb210aa" + }, + { + "contributor": "Ed Mashburn 3", + "contributorNameTypeId": "e8b311a6-3b21-43f2-a269-dd9310cb2d0a" + } + ], + "cost": { + "currency": "USD", + "listUnitPrice": 24.99, + "listUnitPriceElectronic": 22.99, + "quantityElectronic": 1, + "quantityPhysical": 1 + }, + "description": "ABCDEFGH", + "details": { + "receivingNote": "ABCDEFGHIJKL", + "productIds": [ + { + "productId": "1-4028-9462-7", + "productIdType": "8261054f-be78-422d-bd51-4ed9f33c3422" + } + ], + "subscriptionFrom": "2018-10-09T00:00:00.000Z", + "subscriptionInterval": 824, + "subscriptionTo": "2020-10-09T00:00:00.000Z" + }, + "donor": "ABCDEFGHIJKLM", + "fundDistribution": [ + { + "code": "HIST", + "fundId": "fb7b70f1-b898-4924-a991-0e4b6312bb5f", + "distributionType": "percentage", + "value": 80.0, + "encumbrance": "eb506834-6c70-4239-8d1a-6414a5b08ac3" + }, + { + "code": "EUROHIST", + "fundId": "e9285a1c-1dfc-4380-868c-e74073003f43", + "distributionType": "percentage", + "value": 20.0, + "encumbrance": "0466cb77-0344-43c6-85eb-0a64aa2934e5" + } + ], + "locations": [ + { + "locationId": "fcd64ce1-6995-48f0-840e-89ffa2288371", + "quantity": 2, + "quantityElectronic": 1, + "quantityPhysical": 1 + } + ], + "orderFormat": "P/E Mix", + "paymentStatus": "Awaiting Payment", + "physical": { + "createInventory": "Instance, Holding, Item", + "volumes": [ + "vol.1" + ], + "materialSupplier": "73d14bc5-d131-48c6-b380-f8e62f63c8b6", + "materialType": "2fa93835-ea37-479d-b133-1d2a2279fcd8", + "receiptDue": "2018-10-10T00:00:00.000Z" + }, + "poLineDescription": "ABCDEFGHIJKLMNOPQRSTUVWXY", + "poLineNumber": "268758-03", + "publicationDate": "2017", + "publisher": "Schiffer Publishing", + "receiptDate": "2018-10-09T00:00:00.000Z", + "receiptStatus": "Pending", + "reportingCodes": [ + { + "code": "CODE1", + "id": "5926dcd7-85f5-4504-8283-712595ebc38b", + "description": "ABCDEF" + }, + { + "code": "CODE2", + "id": "fa316c04-8101-4e72-8aaf-01281bac718f", + "description": "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + }, + { + "code": "CODE3", + "id": "ea68b696-3125-4940-bf91-1d128323473e", + "description": "ABCDE" + } + ], + "requester": "Leo Bulero", + "rush": true, + "selector": "ABCD", + "source": "User", + "tags": { + "tagList": [ + "important" + ] + }, + "titleOrPackage": "Kayak Fishing in the Northern Gulf Coast", + "vendorDetail": { + "instructions": "ABCDEFG", + "noteFromVendor": "ABCDEFGHIKJKLMNOP", + "referenceNumbers": [ + { + "refNumber": "123456-78", + "refNumberType": "Vendor title number", + "vendorDetailsSource": "OrderLine" + } + ], + "vendorAccount": "8910-10" + }, + "metadata": { + "createdDate": "2010-10-08T03:53:00.000", + "createdByUserId": "ab18897b-0e40-4f31-896b-9c9adc979a88" + } + } + ] +}