From 264a5aafabe2273fafac05565c805d3ad9179b7a Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Fri, 20 Oct 2023 10:01:38 +0200 Subject: [PATCH 1/2] DT-480 [5/?]: Support CBR and commodity being unresolvable Signed-off-by: Niels Thykier --- .../persistence/entity/ConsignmentItem.java | 7 + .../entity/ShippingInstruction.java | 2 +- .../validations/ConsignmentItemValidator.java | 30 ++- .../ShippingInstructionValidator.java | 28 ++- .../db/migration/V3_0__dcsa_im_v3.sql | 2 +- .../service/ShippingInstructionService.java | 31 +++- postman_collection.json | 173 ++++++++++++++++-- 7 files changed, 243 insertions(+), 30 deletions(-) diff --git a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ConsignmentItem.java b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ConsignmentItem.java index 844fa013..8e5eb585 100644 --- a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ConsignmentItem.java +++ b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ConsignmentItem.java @@ -94,4 +94,11 @@ public void resolvedConfirmedBooking(@NotNull ConfirmedBooking confirmedBooking) } this.confirmedBooking = confirmedBooking; } + + public void resolvedCommodity(@NotNull Commodity commodity) { + if (!this.getCommoditySubreference().equals(commodity.getCommoditySubreference())) { + throw new IllegalArgumentException("Commodity had the wrong commodity subreference"); + } + this.commodity = commodity; + } } diff --git a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ShippingInstruction.java b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ShippingInstruction.java index 9c8f85fc..a576930e 100644 --- a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ShippingInstruction.java +++ b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/persistence/entity/ShippingInstruction.java @@ -432,7 +432,7 @@ protected RuntimeException errorForTargetStateNotListedAsSuccessor( e); } - public void assignConsignmentItems(List consignmentItems) { + public void assignConsignmentItems(@NotNull List consignmentItems) { this.consignmentItems = consignmentItems; for (var ci : consignmentItems) { ci.setShippingInstruction(this); diff --git a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ConsignmentItemValidator.java b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ConsignmentItemValidator.java index a3f8cd7c..ff3af2ee 100644 --- a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ConsignmentItemValidator.java +++ b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ConsignmentItemValidator.java @@ -17,13 +17,25 @@ public boolean isValid(ConsignmentItem value, ConstraintValidatorContext context context.disableDefaultConstraintViolation(); var state = ValidationState.of(value, context); - validateConfirmedBookings(state); + validateBookingAndCommodity(state); validateCustomsReferences(state,state.getValue().getCustomsReferences()); return state.isValid(); } - private void validateConfirmedBookings(ValidationState state) { - var confirmedBooking = state.getValue().getConfirmedBooking(); + private void validateBookingAndCommodity(ValidationState state) { + var consignmentItem = state.getValue(); + var confirmedBooking = consignmentItem.getConfirmedBooking(); + if (confirmedBooking == null) { + state.getContext().buildConstraintViolationWithTemplate( + "Could not resolve booking with reference " + + consignmentItem.getCarrierBookingReference() + + ": It is not a known carrier booking reference") + // Match the TO path + .addPropertyNode("carrierBookingReference") + .addConstraintViolation(); + state.invalidate(); + return; + } if (!confirmedBooking.getBooking().getBookingStatus().equals(BookingStatus.CONFIRMED)) { state.getContext().buildConstraintViolationWithTemplate("The booking " + confirmedBooking.getCarrierBookingReference() + " is not in state CONFIRMED") // Match the TO path @@ -31,5 +43,17 @@ private void validateConfirmedBookings(ValidationState state) { .addConstraintViolation(); state.invalidate(); } + if (consignmentItem.getCommodity() == null) { + state.getContext().buildConstraintViolationWithTemplate( + "Could not resolve the commodity subreference " + + consignmentItem.getCommoditySubreference() + + " on the booking with carrier booking reference " + + consignmentItem.getCarrierBookingReference() + + ": It is not a known commodity subreference on said booking") + // Match the TO path + .addPropertyNode("carrierBookingReference") + .addConstraintViolation(); + state.invalidate(); + } } } diff --git a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ShippingInstructionValidator.java b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ShippingInstructionValidator.java index df908f87..00a975b4 100644 --- a/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ShippingInstructionValidator.java +++ b/edocumentation-domain/src/main/java/org/dcsa/edocumentation/domain/validations/ShippingInstructionValidator.java @@ -151,16 +151,32 @@ private void validateShipper(ValidationState state) { } private void validateManifestFilings(ValidationState state) { + var si = state.getValue(); - List advanceManifestFilingSIs = state.getValue().getAdvanceManifestFilings(); - List consignmentItems = state.getValue().getConsignmentItems(); + List advanceManifestFilingSIs = si.getAdvanceManifestFilings(); + List consignmentItems = si.getConsignmentItems(); - ConsignmentItem firstconsignmentItem = state.getValue().getConsignmentItems().get(0); - List advanceManifestFilingBase = firstconsignmentItem.getConfirmedBooking().getAdvanceManifestFilings(); + var firstBooking = si.getConsignmentItems().stream() + .map(ConsignmentItem::getConfirmedBooking) + .filter(Objects::nonNull) + .findFirst() + .orElse(null); + + if (firstBooking == null) { + // ConsignmentItemValidator flags shipment being null, so we are silent here. + return; + } + + List advanceManifestFilingBase = firstBooking.getAdvanceManifestFilings(); Map> misMatchedConsignmentManifestFilings = new HashMap<>(); - for(ConsignmentItem ci: consignmentItems) { - List advanceManifestFilings = ci.getConfirmedBooking().getAdvanceManifestFilings(); + for (ConsignmentItem ci : consignmentItems) { + var confirmedBooking = ci.getConfirmedBooking(); + if (confirmedBooking == null) { + // ConsignmentItemValidator flags shipment being null, so we are silent here. + continue; + } + List advanceManifestFilings = confirmedBooking.getAdvanceManifestFilings(); List misMatchedManifestFilings = advanceManifestFilingBase.stream() .filter(two -> advanceManifestFilings.stream() .noneMatch(one -> one.getManifestTypeCode().equals(two.getManifestTypeCode()) diff --git a/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql b/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql index 12d6db71..223e68be 100644 --- a/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql +++ b/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql @@ -447,7 +447,7 @@ CREATE TABLE consignment_item ( carrier_booking_reference varchar(35) NOT NULL, commodity_subreference varchar(100) NOT NULL, shipping_instruction_id uuid NOT NULL REFERENCES shipping_instruction (id), - confirmed_booking_id uuid NOT NULL REFERENCES confirmed_booking (id), -- TODO; should be `NULL` instead of `NOT NULL`. + confirmed_booking_id uuid NULL REFERENCES confirmed_booking (id), -- TODO; should be `NULL` instead of `NOT NULL`. commodity_id uuid NULL REFERENCES commodity (id), si_entry_order int NOT NULL default 0 ); diff --git a/edocumentation-service/src/main/java/org/dcsa/edocumentation/service/ShippingInstructionService.java b/edocumentation-service/src/main/java/org/dcsa/edocumentation/service/ShippingInstructionService.java index 6d8aa2df..c106a69e 100644 --- a/edocumentation-service/src/main/java/org/dcsa/edocumentation/service/ShippingInstructionService.java +++ b/edocumentation-service/src/main/java/org/dcsa/edocumentation/service/ShippingInstructionService.java @@ -1,9 +1,12 @@ package org.dcsa.edocumentation.service; import jakarta.transaction.Transactional; +import jakarta.validation.constraints.NotNull; import java.util.Map; +import java.util.Objects; import java.util.Optional; import lombok.RequiredArgsConstructor; +import org.dcsa.edocumentation.domain.persistence.entity.*; import org.dcsa.edocumentation.domain.persistence.entity.CargoItem; import org.dcsa.edocumentation.domain.persistence.entity.ConfirmedBooking; import org.dcsa.edocumentation.domain.persistence.entity.ShippingInstruction; @@ -62,7 +65,15 @@ public void resolveStuffing( Map savedTransportEquipments) { for (var ci : shippingInstruction.getConsignmentItems()) { - ci.resolvedConfirmedBooking(resolveConfirmedBooking(ci.getCarrierBookingReference())); + var confirmedBooking = resolveConfirmedBooking(ci.getCarrierBookingReference()); + Commodity commodity = null; + if (confirmedBooking != null) { + ci.resolvedConfirmedBooking(confirmedBooking); + commodity = resolveCommodity(confirmedBooking, ci.getCommoditySubreference()); + } + if (commodity != null) { + ci.resolvedCommodity(commodity); + } for (var c : ci.getCargoItems()) { c.assignEquipment(findSavedUtilizedTransportEquipmentViaCargoItem(savedTransportEquipments, c)); } @@ -74,12 +85,18 @@ public void resolveStuffing( private ConfirmedBooking resolveConfirmedBooking(String carrierBookingReference) { return confirmedBookingRepository .findByCarrierBookingReference(carrierBookingReference) - .orElseThrow( - () -> - // TODO: This should result in a PENDING UPDATE rather than a HTTP 400 by the time DT-578 is finished - ConcreteRequestErrorMessageException.invalidInput( - "No shipment has been found for this carrierBookingReference: " - + carrierBookingReference)); + .orElse(null); + } + + private Commodity resolveCommodity(@NotNull ConfirmedBooking shipment, @NotNull String commoditySubreference) { + for (var reg : shipment.getBooking().getRequestedEquipments()) { + for (var commodity : reg.getCommodities()) { + if (Objects.equals(commoditySubreference, commodity.getCommoditySubreference())) { + return commodity; + } + } + } + return null; } private UtilizedTransportEquipment findSavedUtilizedTransportEquipmentViaCargoItem( diff --git a/postman_collection.json b/postman_collection.json index c4019773..be07191a 100755 --- a/postman_collection.json +++ b/postman_collection.json @@ -3732,7 +3732,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"isShippedOnBoardType\": true,\r\n \"isElectronic\": true,\r\n \"isToOrder\": true,\r\n \"displayedNameForPortOfLoad\": [\r\n \"Port of Rotterdam\"\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ],\r\n \"consignmentItems\": [\r\n {\r\n \"HSCodes\": [\"411510\"],\r\n \"carrierBookingReference\": \"A379021B7782\",\r\n \"commoditySubreference\": \"unknown-commodity-subreference\",\r\n \"weight\": 120.4,\r\n \"weightUnit\": \"KGM\",\r\n \"descriptionOfGoods\": \"description\",\r\n \"cargoItems\": [\r\n {\r\n \"equipmentReference\": \"BMOU2149612\",\r\n \"weight\": 120.3,\r\n \"weightUnit\": \"KGM\",\r\n \"shippingMarks\": [\"bar\"]\r\n }\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"utilizedTransportEquipments\": [\r\n {\r\n \"equipmentReference\": \"BMOU2149612\",\r\n \"cargoGrossWeight\": 120.3,\r\n \"cargoGrossWeightUnit\": \"KGM\",\r\n \"isShipperOwned\": false,\r\n \"seals\": [\r\n {\r\n \"number\": \"12345\",\r\n \"source\": \"CAR\",\r\n \"type\": \"BLT\"\r\n },\r\n {\r\n \"number\": \"98765\",\r\n \"source\": \"RACxx\",\r\n \"type\": \"TLBxx\"\r\n }\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"documentParties\": [\r\n {\r\n \"party\": {\r\n \"partyName\": \"foo party\",\r\n \"address\": {\r\n \"name\": \"foo address name\"\r\n },\r\n \"partyContactDetails\": [\r\n {\r\n \"name\": \"partycontact details\",\r\n \"phone\": \"+31611444666\"\r\n }\r\n ]\r\n },\r\n \"partyFunction\": \"CN\",\r\n \"displayedAddress\": [\r\n \"foo\"\r\n ],\r\n \"isToBeNotified\": false\r\n }\r\n ],\r\n \"references\": [\r\n {\r\n \"type\": \"AAO\",\r\n \"value\": \"foo reference\"\r\n }\r\n ]\r\n}", + "raw": "{\r\n \"isShippedOnBoardType\": true,\r\n \"isElectronic\": true,\r\n \"isToOrder\": true,\r\n \"displayedNameForPortOfLoad\": [\r\n \"Port of Rotterdam\"\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ],\r\n \"consignmentItems\": [\r\n {\r\n \"HSCodes\": [\"411510\"],\r\n \"carrierBookingReference\": \"UNKOWN-CBR\",\r\n \"commoditySubreference\": \"unknown-commodity-subreference\",\r\n \"weight\": 120.4,\r\n \"weightUnit\": \"KGM\",\r\n \"descriptionOfGoods\": \"description\",\r\n \"cargoItems\": [\r\n {\r\n \"equipmentReference\": \"BMOU2149612\",\r\n \"weight\": 120.3,\r\n \"weightUnit\": \"KGM\",\r\n \"shippingMarks\": [\"bar\"]\r\n }\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"utilizedTransportEquipments\": [\r\n {\r\n \"equipmentReference\": \"BMOU2149612\",\r\n \"cargoGrossWeight\": 120.3,\r\n \"cargoGrossWeightUnit\": \"KGM\",\r\n \"isShipperOwned\": false,\r\n \"seals\": [\r\n {\r\n \"number\": \"12345\",\r\n \"source\": \"CAR\",\r\n \"type\": \"BLT\"\r\n },\r\n {\r\n \"number\": \"98765\",\r\n \"source\": \"RACxx\",\r\n \"type\": \"TLBxx\"\r\n }\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"documentParties\": [\r\n {\r\n \"party\": {\r\n \"partyName\": \"foo party\",\r\n \"address\": {\r\n \"name\": \"foo address name\"\r\n },\r\n \"partyContactDetails\": [\r\n {\r\n \"name\": \"partycontact details\",\r\n \"phone\": \"+31611444666\"\r\n }\r\n ]\r\n },\r\n \"partyFunction\": \"CN\",\r\n \"displayedAddress\": [\r\n \"foo\"\r\n ],\r\n \"isToBeNotified\": false\r\n }\r\n ],\r\n \"references\": [\r\n {\r\n \"type\": \"AAO\",\r\n \"value\": \"foo reference\"\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -3830,6 +3830,150 @@ { "name": "Negative test cases", "item": [ + { + "name": "Test: Unknown carrier booking reference", + "item": [ + { + "name": "Create Shipping instruction with unknown CBR", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const parsedBody = pm.response.json();\r", + "pm.collectionVariables.set(\"SHIPPING_INSTRUCTION_REFERENCE\", parsedBody.shippingInstructionReference);\r", + "\r", + "pm.test(\"Status code is 201\", () => {\r", + " pm.response.to.have.status(201);\r", + "});\r", + "\r", + "pm.test(\"documentStatus is RECEIVED\", () => {\r", + " const jsonData = pm.response.json();\r", + " pm.expect(jsonData.documentStatus).to.eql(\"RECEIVED\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"isShippedOnBoardType\": true,\r\n \"isElectronic\": true,\r\n \"isToOrder\": true,\r\n \"displayedNameForPortOfLoad\": [\r\n \"Port of Rotterdam\"\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ],\r\n \"consignmentItems\": [\r\n {\r\n \"HSCodes\": [\"411510\"],\r\n \"carrierBookingReference\": \"UNKNOWN-CBR\",\r\n \"commoditySubreference\": \"unknown-commodity-subreference\",\r\n \"weight\": 120.4,\r\n \"weightUnit\": \"KGM\",\r\n \"descriptionOfGoods\": \"description\",\r\n \"cargoItems\": [\r\n {\r\n \"equipmentReference\": \"BMOU2149612\",\r\n \"weight\": 120.3,\r\n \"weightUnit\": \"KGM\",\r\n \"shippingMarks\": [\"bar\"]\r\n }\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"utilizedTransportEquipments\": [\r\n {\r\n \"equipmentReference\": \"BMOU2149612\",\r\n \"cargoGrossWeight\": 120.3,\r\n \"cargoGrossWeightUnit\": \"KGM\",\r\n \"isShipperOwned\": false,\r\n \"seals\": [\r\n {\r\n \"number\": \"12345\",\r\n \"source\": \"CAR\",\r\n \"type\": \"BLT\"\r\n },\r\n {\r\n \"number\": \"98765\",\r\n \"source\": \"CAR\",\r\n \"type\": \"BLT\"\r\n }\r\n ],\r\n \"customsReferences\": [\r\n {\r\n \"type\": \"CERS\",\r\n \"countryCode\": \"CA\",\r\n \"value\": \"12345678\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"documentParties\": [\r\n {\r\n \"party\": {\r\n \"partyName\": \"foo party\",\r\n \"address\": {\r\n \"name\": \"foo address name\"\r\n },\r\n \"partyContactDetails\": [\r\n {\r\n \"name\": \"partycontact details\",\r\n \"phone\": \"+31611444666\"\r\n }\r\n ],\r\n \"identifyingCodes\": [\r\n {\r\n \"partyCode\": \"foo@bar\",\r\n \"DCSAResponsibleAgencyCode\": \"EPI\"\r\n }\r\n ]\r\n },\r\n \"partyFunction\": \"OS\",\r\n \"displayedAddress\": [\r\n \"foo\"\r\n ],\r\n \"isToBeNotified\": false\r\n }\r\n ],\r\n \"references\": [\r\n {\r\n \"type\": \"AAO\",\r\n \"value\": \"foo reference\"\r\n }\r\n ]\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{BASE_URL}}{{EBL_CONTEXT_PATH}}/shipping-instructions", + "host": [ + "{{BASE_URL}}{{EBL_CONTEXT_PATH}}" + ], + "path": [ + "shipping-instructions" + ] + } + }, + "response": [] + }, + { + "name": "Verify saved shipping instruction", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const shippingInstructionReference = pm.collectionVariables.get(\"SHIPPING_INSTRUCTION_REFERENCE\");\r", + "\r", + "pm.test(\"Status code is 200\", () => {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "\r", + "pm.test(\"Response contains updated values\", () => {\r", + " const jsonData = pm.response.json();\r", + " pm.expect(jsonData.shippingInstructionReference).to.eql(shippingInstructionReference);\r", + "\r", + " // Posting a new shipping instruction should put us in \"RECEIVED\".\r", + " pm.expect(jsonData.documentStatus).to.eql(\"RECEIVED\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{BASE_URL}}{{EBL_CONTEXT_PATH}}/shipping-instructions/{{SHIPPING_INSTRUCTION_REFERENCE}}", + "host": [ + "{{BASE_URL}}{{EBL_CONTEXT_PATH}}" + ], + "path": [ + "shipping-instructions", + "{{SHIPPING_INSTRUCTION_REFERENCE}}" + ] + } + }, + "response": [] + }, + { + "name": "Validate Shipping instruction", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const parsedBody = pm.response.json();\r", + "pm.collectionVariables.set(\"SHIPPING_INSTRUCTION_REFERENCE\", parsedBody.shippingInstructionReference);\r", + "\r", + "pm.collectionVariables.unset(\"SHIPPING_INSTRUCTION_REFERENCE\");\r", + "\r", + "pm.test(\"Status code is correct\", () => {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "pm.test(\"documentStatus is correct\", () => {\r", + " const jsonData = pm.response.json();\r", + " pm.expect(jsonData.documentStatus).to.eql(\"PENDING UPDATE\");\r", + "});\r", + "\r", + "pm.test(\"error-message is correct\", () => {\r", + " const jsonData = pm.response.json();\r", + " const requestedChanges = jsonData.requestedChanges;\r", + " pm.expect(requestedChanges[0].path).to.eql(\"consignmentItems[0].carrierBookingReference\");\r", + " pm.expect(requestedChanges[0].message).to.eql(\"Could not resolve booking with reference UNKNOWN-CBR: It is not a known carrier booking reference\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "{{BASE_URL}}/unofficial{{EBL_CONTEXT_PATH}}/shipping-instructions/{{SHIPPING_INSTRUCTION_REFERENCE}}/validate", + "host": [ + "{{BASE_URL}}" + ], + "path": [ + "unofficial{{EBL_CONTEXT_PATH}}", + "shipping-instructions", + "{{SHIPPING_INSTRUCTION_REFERENCE}}", + "validate" + ] + } + }, + "response": [] + } + ] + }, { "name": "Create Shipping instruction invalid utilizedTransportEquipment", "event": [ @@ -3837,6 +3981,13 @@ "listen": "test", "script": { "exec": [ + "const schema = pm.collectionVariables.get(\"ERROR_SCHEMA\");\r", + "const schemaObject = JSON.parse(schema);\r", + "\r", + "pm.test('Schema is valid', () => {\r", + " pm.response.to.have.jsonSchema(schemaObject);\r", + "});\r", + "\r", "pm.test(\"Status code is 400\", () => {\r", " pm.response.to.have.status(400);\r", "});\r", @@ -3886,6 +4037,13 @@ "listen": "test", "script": { "exec": [ + "const schema = pm.collectionVariables.get(\"ERROR_SCHEMA\");\r", + "const schemaObject = JSON.parse(schema);\r", + "\r", + "pm.test('Schema is valid', () => {\r", + " pm.response.to.have.jsonSchema(schemaObject);\r", + "});\r", + "\r", "pm.test(\"Status code is 400\", () => {\r", " pm.response.to.have.status(400);\r", "});\r", @@ -3993,12 +4151,7 @@ "script": { "type": "text/javascript", "exec": [ - "const schema = pm.collectionVariables.get(\"ERROR_SCHEMA\");", - "const schemaObject = JSON.parse(schema);", - "", - "pm.test('Schema is valid', () => {", - " pm.response.to.have.jsonSchema(schemaObject);", - "});" + "" ] } } @@ -5424,10 +5577,6 @@ "key": "CARRIER_BOOKING_REFERENCE", "value": "" }, - { - "key": "SHIPPING_INSTRUCTION_REFERENCE", - "value": "" - }, { "key": "TRANSPORT_DOCUMENT_REFERENCE", "value": "" @@ -5437,4 +5586,4 @@ "value": "" } ] -} +} \ No newline at end of file From 427be6104402ef06a5a4bd8a8b04ca631ea75a40 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Mon, 30 Oct 2023 12:15:29 +0100 Subject: [PATCH 2/2] Update edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Henrik Helmø Larsen --- .../src/main/resources/db/migration/V3_0__dcsa_im_v3.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql b/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql index 223e68be..ad38926d 100644 --- a/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql +++ b/edocumentation-domain/src/main/resources/db/migration/V3_0__dcsa_im_v3.sql @@ -447,7 +447,7 @@ CREATE TABLE consignment_item ( carrier_booking_reference varchar(35) NOT NULL, commodity_subreference varchar(100) NOT NULL, shipping_instruction_id uuid NOT NULL REFERENCES shipping_instruction (id), - confirmed_booking_id uuid NULL REFERENCES confirmed_booking (id), -- TODO; should be `NULL` instead of `NOT NULL`. + confirmed_booking_id uuid NULL REFERENCES confirmed_booking (id), commodity_id uuid NULL REFERENCES commodity (id), si_entry_order int NOT NULL default 0 );