diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index 6b80d8d47a1..ac5b2533fc5 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -336,7 +336,7 @@ func init() { }, "/mto-service-items": { "post": { - "description": "Creates one or more MTOServiceItems. Not all service items may be created, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to create and the documentation will update with the new definition.\n\nUpon creation these items are associated with a Move Task Order and an MTO Shipment.\nThe request must include UUIDs for the MTO and MTO Shipment connected to this service item. Some service item types require\nadditional service items to be autogenerated when added - all created service items, autogenerated included,\nwill be returned in the response.\n\nTo update a service item, please use [updateMTOServiceItem](#operation/updateMTOServiceItem) endpoint.\n\n---\n\n**` + "`" + `MTOServiceItemOriginSIT` + "`" + `**\n\nMTOServiceItemOriginSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic origin SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DOFSIT**\n\n**1st day origin SIT service item**. When a DOFSIT is requested, the API will auto-create the following group of service items:\n * DOFSIT - Domestic origin 1st day SIT\n * DOASIT - Domestic origin Additional day SIT\n * DOPSIT - Domestic origin SIT pickup\n * DOSFSC - Domestic origin SIT fuel surcharge\n\n**DOASIT**\n\n**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item.\nAdditional DOASIT service items can be created and added to an existing shipment that **includes a DOFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemDestSIT` + "`" + `**\n\nMTOServiceItemDestSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic destination SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DDFSIT**\n\n**1st day destination SIT service item**.\n\nThese additional fields are optional for creating a DDFSIT:\n * ` + "`" + `firstAvailableDeliveryDate1` + "`" + `\n * string \u003cdate\u003e\n * First available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together\n * ` + "`" + `dateOfContact1` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `\n * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `timeMilitary1` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.\n * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `firstAvailableDeliveryDate2` + "`" + `\n * string \u003cdate\u003e\n * Second available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together\n * ` + "`" + `dateOfContact2` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact delivery by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `\n * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together\n * ` + "`" + `timeMilitary2` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.\n * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together\n\nWhen a DDFSIT is requested, the API will auto-create the following group of service items:\n * DDFSIT - Domestic destination 1st day SIT\n * DDASIT - Domestic destination Additional day SIT\n * DDDSIT - Domestic destination SIT delivery\n * DDSFSC - Domestic destination SIT fuel surcharge\n\n**NOTE** When providing the ` + "`" + `sitEntryDate` + "`" + ` value in the payload, please ensure that the date is not BEFORE\n` + "`" + `firstAvailableDeliveryDate1` + "`" + ` or ` + "`" + `firstAvailableDeliveryDate2` + "`" + `. If it is, you will receive an error response.\n\n**DDASIT**\n\n**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item.\nAdditional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**.\n", + "description": "Creates one or more MTOServiceItems. Not all service items may be created, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to create and the documentation will update with the new definition.\n\nUpon creation these items are associated with a Move Task Order and an MTO Shipment.\nThe request must include UUIDs for the MTO and MTO Shipment connected to this service item. Some service item types require\nadditional service items to be autogenerated when added - all created service items, autogenerated included,\nwill be returned in the response.\n\nTo update a service item, please use [updateMTOServiceItem](#operation/updateMTOServiceItem) endpoint.\n\n---\n\n**` + "`" + `MTOServiceItemOriginSIT` + "`" + `**\n\nMTOServiceItemOriginSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic origin SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DOFSIT**\n\n**1st day origin SIT service item**. When a DOFSIT is requested, the API will auto-create the following group of service items:\n * DOFSIT - Domestic origin 1st day SIT\n * DOASIT - Domestic origin Additional day SIT\n * DOPSIT - Domestic origin SIT pickup\n * DOSFSC - Domestic origin SIT fuel surcharge\n\n**DOASIT**\n\n**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item.\nAdditional DOASIT service items can be created and added to an existing shipment that **includes a DOFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemDestSIT` + "`" + `**\n\nMTOServiceItemDestSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic destination SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DDFSIT**\n\n**1st day destination SIT service item**.\n\nThese additional fields are optional for creating a DDFSIT:\n * ` + "`" + `firstAvailableDeliveryDate1` + "`" + `\n * string \u003cdate\u003e\n * First available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together\n * ` + "`" + `dateOfContact1` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `\n * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `timeMilitary1` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.\n * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `firstAvailableDeliveryDate2` + "`" + `\n * string \u003cdate\u003e\n * Second available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together\n * ` + "`" + `dateOfContact2` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact delivery by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `\n * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together\n * ` + "`" + `timeMilitary2` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.\n * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together\n\nWhen a DDFSIT is requested, the API will auto-create the following group of service items:\n * DDFSIT - Domestic destination 1st day SIT\n * DDASIT - Domestic destination Additional day SIT\n * DDDSIT - Domestic destination SIT delivery\n * DDSFSC - Domestic destination SIT fuel surcharge\n\n**NOTE** When providing the ` + "`" + `sitEntryDate` + "`" + ` value in the payload, please ensure that the date is not BEFORE\n` + "`" + `firstAvailableDeliveryDate1` + "`" + ` or ` + "`" + `firstAvailableDeliveryDate2` + "`" + `. If it is, you will receive an error response.\n\n**DDASIT**\n\n**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item.\nAdditional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemInternationalOriginSIT` + "`" + `**\n\nMTOServiceItemInternationalOriginSIT is a subtype of MTOServiceItem.\n\nThis model type describes a international origin SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**IOFSIT**\n\n**1st day origin SIT service item**. When a IOFSIT is requested, the API will auto-create the following group of service items:\n * IOFSIT - International origin 1st day SIT\n * IOASIT - International origin Additional day SIT\n * IOPSIT - International origin SIT pickup\n * IOSFSC - International origin SIT fuel surcharge\n\n**IOASIT**\n\n**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item.\nAdditional IOASIT service items can be created and added to an existing shipment that **includes a IOFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemInternationalDestSIT` + "`" + `**\n\nMTOServiceItemInternationalDestSIT is a subtype of MTOServiceItem.\n\nThis model type describes a international destination SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**IDFSIT**\n\n**1st day destination SIT service item**.\n\nThese additional fields are optional for creating a IDFSIT:\n * ` + "`" + `firstAvailableDeliveryDate1` + "`" + `\n * string \u003cdate\u003e\n * First available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together\n * ` + "`" + `dateOfContact1` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `\n * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `timeMilitary1` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.\n * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `firstAvailableDeliveryDate2` + "`" + `\n * string \u003cdate\u003e\n * Second available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together\n * ` + "`" + `dateOfContact2` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact delivery by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `\n * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together\n * ` + "`" + `timeMilitary2` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.\n * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together\n\nWhen a IDFSIT is requested, the API will auto-create the following group of service items:\n * IDFSIT - International destination 1st day SIT\n * IDASIT - International destination Additional day SIT\n * IDDSIT - International destination SIT delivery\n * IDSFSC - International destination SIT fuel surcharge\n\n**NOTE** When providing the ` + "`" + `sitEntryDate` + "`" + ` value in the payload, please ensure that the date is not BEFORE\n` + "`" + `firstAvailableDeliveryDate1` + "`" + ` or ` + "`" + `firstAvailableDeliveryDate2` + "`" + `. If it is, you will receive an error response.\n\n**IDASIT**\n\n**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item.\nAdditional IDASIT service items can be created and added to an existing shipment that **includes a IDFSIT service item**.\n", "consumes": [ "application/json" ], @@ -393,7 +393,7 @@ func init() { }, "/mto-service-items/{mtoServiceItemID}": { "patch": { - "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT/Accessorial service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n\nThe following Accessorial service items can be resubmitted following a rejection:\n- IOSHUT\n- IDSHUT\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following crating/uncrating service items can be resubmitted following a rejection:\n- ICRT\n- IUCRT\n\nAt a MINIMUM, the payload for resubmitting a rejected crating/uncrating service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"item\": {\n \"length\": 10000,\n \"width\": 10000,\n \"height\": 10000\n },\n \"crate\": {\n \"length\": 20000,\n \"width\": 20000,\n \"height\": 20000\n },\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemCrating\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n", + "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT/Accessorial service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n- IDASIT\n- IDDSIT\n- IDFSIT\n- IOASIT\n- IOPSIT\n- IOFSIT\n- IDSFSC\n- IOSFSC\n\nThe following Accessorial service items can be resubmitted following a rejection:\n- IOSHUT\n- IDSHUT\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following crating/uncrating service items can be resubmitted following a rejection:\n- ICRT\n- IUCRT\n\nAt a MINIMUM, the payload for resubmitting a rejected crating/uncrating service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"item\": {\n \"length\": 10000,\n \"width\": 10000,\n \"height\": 10000\n },\n \"crate\": {\n \"length\": 20000,\n \"width\": 20000,\n \"height\": 20000\n },\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemCrating\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n", "consumes": [ "application/json" ], @@ -2484,6 +2484,102 @@ func init() { } ] }, + "MTOServiceItemInternationalDestSIT": { + "description": "Describes a international destination SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "sitEntryDate", + "reason" + ], + "properties": { + "dateOfContact1": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "dateOfContact2": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate1": { + "description": "First available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate2": { + "description": "Second available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDFSIT", + "IDASIT" + ] + }, + "reason": { + "description": "The reason item has been placed in SIT.\n", + "type": "string", + "x-nullable": true, + "x-omitempty": false + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDestinationFinalAddress": { + "$ref": "#/definitions/Address" + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "timeMilitary1": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + }, + "timeMilitary2": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + } + } + } + ] + }, "MTOServiceItemInternationalFuelSurcharge": { "description": "Describes a international Port of Embarkation/Debarkation fuel surcharge service item subtype of a MTOServiceItem.", "allOf": [ @@ -2509,6 +2605,76 @@ func init() { } ] }, + "MTOServiceItemInternationalOriginSIT": { + "description": "Describes a international origin SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "reason", + "sitPostalCode", + "sitEntryDate" + ], + "properties": { + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IOFSIT", + "IOASIT" + ] + }, + "reason": { + "description": "Explanation of why Prime is picking up SIT item.", + "type": "string", + "example": "Storage items need to be picked up" + }, + "requestApprovalsRequestedStatus": { + "type": "boolean" + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitHHGActualOrigin": { + "$ref": "#/definitions/Address" + }, + "sitHHGOriginalOrigin": { + "$ref": "#/definitions/Address" + }, + "sitPostalCode": { + "type": "string", + "format": "zip", + "pattern": "^(\\d{5}([\\-]\\d{4})?)$", + "example": "90210" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemInternationalShuttle": { "description": "Describes an international shuttle service item.", "allOf": [ @@ -2568,12 +2734,14 @@ func init() { ] }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT\n * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", + "MTOServiceItemInternationalOriginSIT", + "MTOServiceItemInternationalDestSIT", "MTOServiceItemShuttle", "MTOServiceItemDomesticShuttle", "MTOServiceItemInternationalShuttle", @@ -3888,7 +4056,7 @@ func init() { "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" }, "params": { - "description": "This should be populated for the following service items:\n * DOASIT(Domestic origin Additional day SIT)\n * DDASIT(Domestic destination Additional day SIT)\n\nBoth take in the following param keys:\n * ` + "`" + `SITPaymentRequestStart` + "`" + `\n * ` + "`" + `SITPaymentRequestEnd` + "`" + `\n\nThe value of each is a date string in the format \"YYYY-MM-DD\" (e.g. \"2023-01-15\")\n", + "description": "This should be populated for the following service items:\n * DOASIT(Domestic origin Additional day SIT)\n * DDASIT(Domestic destination Additional day SIT)\n * IOASIT(International origin Additional day SIT)\n * IDASIT(International destination Additional day SIT)\n\nBoth take in the following param keys:\n * ` + "`" + `SITPaymentRequestStart` + "`" + `\n * ` + "`" + `SITPaymentRequestEnd` + "`" + `\n\nThe value of each is a date string in the format \"YYYY-MM-DD\" (e.g. \"2023-01-15\")\n", "type": "array", "items": { "type": "object", @@ -4282,7 +4450,7 @@ func init() { ] }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n * ICRT - UpdateMTOServiceItemCrating\n * IUCRT - UpdateMTOServiceItemCrating\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * IDDSIT - UpdateMTOServiceItemSIT\n * IDFSIT - UpdateMTOServiceItemSIT\n * IDASIT - UpdateMTOServiceItemSIT\n * IOPSIT - UpdateMTOServiceItemSIT\n * IOASIT - UpdateMTOServiceItemSIT\n * IOFSIT - UpdateMTOServiceItemSIT\n * IOSFSC - UpdateMTOServiceItemSIT\n * IDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n * ICRT - UpdateMTOServiceItemCrating\n * IUCRT - UpdateMTOServiceItemCrating\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -4336,7 +4504,15 @@ func init() { "DOPSIT", "DOASIT", "DOFSIT", - "DOSFSC" + "DOSFSC", + "IDDSIT", + "IDASIT", + "IDFSIT", + "IDSFSC", + "IOPSIT", + "IOASIT", + "IOFSIT", + "IOSFSC" ] }, "requestApprovalsRequestedStatus": { @@ -5419,7 +5595,7 @@ func init() { }, "/mto-service-items": { "post": { - "description": "Creates one or more MTOServiceItems. Not all service items may be created, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to create and the documentation will update with the new definition.\n\nUpon creation these items are associated with a Move Task Order and an MTO Shipment.\nThe request must include UUIDs for the MTO and MTO Shipment connected to this service item. Some service item types require\nadditional service items to be autogenerated when added - all created service items, autogenerated included,\nwill be returned in the response.\n\nTo update a service item, please use [updateMTOServiceItem](#operation/updateMTOServiceItem) endpoint.\n\n---\n\n**` + "`" + `MTOServiceItemOriginSIT` + "`" + `**\n\nMTOServiceItemOriginSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic origin SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DOFSIT**\n\n**1st day origin SIT service item**. When a DOFSIT is requested, the API will auto-create the following group of service items:\n * DOFSIT - Domestic origin 1st day SIT\n * DOASIT - Domestic origin Additional day SIT\n * DOPSIT - Domestic origin SIT pickup\n * DOSFSC - Domestic origin SIT fuel surcharge\n\n**DOASIT**\n\n**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item.\nAdditional DOASIT service items can be created and added to an existing shipment that **includes a DOFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemDestSIT` + "`" + `**\n\nMTOServiceItemDestSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic destination SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DDFSIT**\n\n**1st day destination SIT service item**.\n\nThese additional fields are optional for creating a DDFSIT:\n * ` + "`" + `firstAvailableDeliveryDate1` + "`" + `\n * string \u003cdate\u003e\n * First available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together\n * ` + "`" + `dateOfContact1` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `\n * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `timeMilitary1` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.\n * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `firstAvailableDeliveryDate2` + "`" + `\n * string \u003cdate\u003e\n * Second available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together\n * ` + "`" + `dateOfContact2` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact delivery by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `\n * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together\n * ` + "`" + `timeMilitary2` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.\n * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together\n\nWhen a DDFSIT is requested, the API will auto-create the following group of service items:\n * DDFSIT - Domestic destination 1st day SIT\n * DDASIT - Domestic destination Additional day SIT\n * DDDSIT - Domestic destination SIT delivery\n * DDSFSC - Domestic destination SIT fuel surcharge\n\n**NOTE** When providing the ` + "`" + `sitEntryDate` + "`" + ` value in the payload, please ensure that the date is not BEFORE\n` + "`" + `firstAvailableDeliveryDate1` + "`" + ` or ` + "`" + `firstAvailableDeliveryDate2` + "`" + `. If it is, you will receive an error response.\n\n**DDASIT**\n\n**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item.\nAdditional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**.\n", + "description": "Creates one or more MTOServiceItems. Not all service items may be created, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to create and the documentation will update with the new definition.\n\nUpon creation these items are associated with a Move Task Order and an MTO Shipment.\nThe request must include UUIDs for the MTO and MTO Shipment connected to this service item. Some service item types require\nadditional service items to be autogenerated when added - all created service items, autogenerated included,\nwill be returned in the response.\n\nTo update a service item, please use [updateMTOServiceItem](#operation/updateMTOServiceItem) endpoint.\n\n---\n\n**` + "`" + `MTOServiceItemOriginSIT` + "`" + `**\n\nMTOServiceItemOriginSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic origin SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DOFSIT**\n\n**1st day origin SIT service item**. When a DOFSIT is requested, the API will auto-create the following group of service items:\n * DOFSIT - Domestic origin 1st day SIT\n * DOASIT - Domestic origin Additional day SIT\n * DOPSIT - Domestic origin SIT pickup\n * DOSFSC - Domestic origin SIT fuel surcharge\n\n**DOASIT**\n\n**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item.\nAdditional DOASIT service items can be created and added to an existing shipment that **includes a DOFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemDestSIT` + "`" + `**\n\nMTOServiceItemDestSIT is a subtype of MTOServiceItem.\n\nThis model type describes a domestic destination SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**DDFSIT**\n\n**1st day destination SIT service item**.\n\nThese additional fields are optional for creating a DDFSIT:\n * ` + "`" + `firstAvailableDeliveryDate1` + "`" + `\n * string \u003cdate\u003e\n * First available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together\n * ` + "`" + `dateOfContact1` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `\n * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `timeMilitary1` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.\n * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `firstAvailableDeliveryDate2` + "`" + `\n * string \u003cdate\u003e\n * Second available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together\n * ` + "`" + `dateOfContact2` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact delivery by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `\n * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together\n * ` + "`" + `timeMilitary2` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.\n * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together\n\nWhen a DDFSIT is requested, the API will auto-create the following group of service items:\n * DDFSIT - Domestic destination 1st day SIT\n * DDASIT - Domestic destination Additional day SIT\n * DDDSIT - Domestic destination SIT delivery\n * DDSFSC - Domestic destination SIT fuel surcharge\n\n**NOTE** When providing the ` + "`" + `sitEntryDate` + "`" + ` value in the payload, please ensure that the date is not BEFORE\n` + "`" + `firstAvailableDeliveryDate1` + "`" + ` or ` + "`" + `firstAvailableDeliveryDate2` + "`" + `. If it is, you will receive an error response.\n\n**DDASIT**\n\n**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item.\nAdditional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemInternationalOriginSIT` + "`" + `**\n\nMTOServiceItemInternationalOriginSIT is a subtype of MTOServiceItem.\n\nThis model type describes a international origin SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**IOFSIT**\n\n**1st day origin SIT service item**. When a IOFSIT is requested, the API will auto-create the following group of service items:\n * IOFSIT - International origin 1st day SIT\n * IOASIT - International origin Additional day SIT\n * IOPSIT - International origin SIT pickup\n * IOSFSC - International origin SIT fuel surcharge\n\n**IOASIT**\n\n**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item.\nAdditional IOASIT service items can be created and added to an existing shipment that **includes a IOFSIT service item**.\n\n---\n\n**` + "`" + `MTOServiceItemInternationalDestSIT` + "`" + `**\n\nMTOServiceItemInternationalDestSIT is a subtype of MTOServiceItem.\n\nThis model type describes a international destination SIT service item. Items can be created using this\nmodel type with the following codes:\n\n**IDFSIT**\n\n**1st day destination SIT service item**.\n\nThese additional fields are optional for creating a IDFSIT:\n * ` + "`" + `firstAvailableDeliveryDate1` + "`" + `\n * string \u003cdate\u003e\n * First available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together\n * ` + "`" + `dateOfContact1` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `\n * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `timeMilitary1` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.\n * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together\n * ` + "`" + `firstAvailableDeliveryDate2` + "`" + `\n * string \u003cdate\u003e\n * Second available date that Prime can deliver SIT service item.\n * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together\n * ` + "`" + `dateOfContact2` + "`" + `\n * string \u003cdate\u003e\n * Date of attempted contact delivery by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `\n * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together\n * ` + "`" + `timeMilitary2` + "`" + `\n * string\\d{4}Z\n * Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.\n * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together\n\nWhen a IDFSIT is requested, the API will auto-create the following group of service items:\n * IDFSIT - International destination 1st day SIT\n * IDASIT - International destination Additional day SIT\n * IDDSIT - International destination SIT delivery\n * IDSFSC - International destination SIT fuel surcharge\n\n**NOTE** When providing the ` + "`" + `sitEntryDate` + "`" + ` value in the payload, please ensure that the date is not BEFORE\n` + "`" + `firstAvailableDeliveryDate1` + "`" + ` or ` + "`" + `firstAvailableDeliveryDate2` + "`" + `. If it is, you will receive an error response.\n\n**IDASIT**\n\n**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item.\nAdditional IDASIT service items can be created and added to an existing shipment that **includes a IDFSIT service item**.\n", "consumes": [ "application/json" ], @@ -5497,7 +5673,7 @@ func init() { }, "/mto-service-items/{mtoServiceItemID}": { "patch": { - "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT/Accessorial service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n\nThe following Accessorial service items can be resubmitted following a rejection:\n- IOSHUT\n- IDSHUT\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following crating/uncrating service items can be resubmitted following a rejection:\n- ICRT\n- IUCRT\n\nAt a MINIMUM, the payload for resubmitting a rejected crating/uncrating service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"item\": {\n \"length\": 10000,\n \"width\": 10000,\n \"height\": 10000\n },\n \"crate\": {\n \"length\": 20000,\n \"width\": 20000,\n \"height\": 20000\n },\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemCrating\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n", + "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT/Accessorial service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n- IDASIT\n- IDDSIT\n- IDFSIT\n- IOASIT\n- IOPSIT\n- IOFSIT\n- IDSFSC\n- IOSFSC\n\nThe following Accessorial service items can be resubmitted following a rejection:\n- IOSHUT\n- IDSHUT\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following crating/uncrating service items can be resubmitted following a rejection:\n- ICRT\n- IUCRT\n\nAt a MINIMUM, the payload for resubmitting a rejected crating/uncrating service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"item\": {\n \"length\": 10000,\n \"width\": 10000,\n \"height\": 10000\n },\n \"crate\": {\n \"length\": 20000,\n \"width\": 20000,\n \"height\": 20000\n },\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemCrating\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n", "consumes": [ "application/json" ], @@ -7863,6 +8039,102 @@ func init() { } ] }, + "MTOServiceItemInternationalDestSIT": { + "description": "Describes a international destination SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "sitEntryDate", + "reason" + ], + "properties": { + "dateOfContact1": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "dateOfContact2": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate1": { + "description": "First available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate2": { + "description": "Second available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDFSIT", + "IDASIT" + ] + }, + "reason": { + "description": "The reason item has been placed in SIT.\n", + "type": "string", + "x-nullable": true, + "x-omitempty": false + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDestinationFinalAddress": { + "$ref": "#/definitions/Address" + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "timeMilitary1": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + }, + "timeMilitary2": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + } + } + } + ] + }, "MTOServiceItemInternationalFuelSurcharge": { "description": "Describes a international Port of Embarkation/Debarkation fuel surcharge service item subtype of a MTOServiceItem.", "allOf": [ @@ -7888,6 +8160,76 @@ func init() { } ] }, + "MTOServiceItemInternationalOriginSIT": { + "description": "Describes a international origin SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "reason", + "sitPostalCode", + "sitEntryDate" + ], + "properties": { + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IOFSIT", + "IOASIT" + ] + }, + "reason": { + "description": "Explanation of why Prime is picking up SIT item.", + "type": "string", + "example": "Storage items need to be picked up" + }, + "requestApprovalsRequestedStatus": { + "type": "boolean" + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitHHGActualOrigin": { + "$ref": "#/definitions/Address" + }, + "sitHHGOriginalOrigin": { + "$ref": "#/definitions/Address" + }, + "sitPostalCode": { + "type": "string", + "format": "zip", + "pattern": "^(\\d{5}([\\-]\\d{4})?)$", + "example": "90210" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemInternationalShuttle": { "description": "Describes an international shuttle service item.", "allOf": [ @@ -7947,12 +8289,14 @@ func init() { ] }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT\n * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", + "MTOServiceItemInternationalOriginSIT", + "MTOServiceItemInternationalDestSIT", "MTOServiceItemShuttle", "MTOServiceItemDomesticShuttle", "MTOServiceItemInternationalShuttle", @@ -9267,7 +9611,7 @@ func init() { "example": "c56a4180-65aa-42ec-a945-5fd21dec0538" }, "params": { - "description": "This should be populated for the following service items:\n * DOASIT(Domestic origin Additional day SIT)\n * DDASIT(Domestic destination Additional day SIT)\n\nBoth take in the following param keys:\n * ` + "`" + `SITPaymentRequestStart` + "`" + `\n * ` + "`" + `SITPaymentRequestEnd` + "`" + `\n\nThe value of each is a date string in the format \"YYYY-MM-DD\" (e.g. \"2023-01-15\")\n", + "description": "This should be populated for the following service items:\n * DOASIT(Domestic origin Additional day SIT)\n * DDASIT(Domestic destination Additional day SIT)\n * IOASIT(International origin Additional day SIT)\n * IDASIT(International destination Additional day SIT)\n\nBoth take in the following param keys:\n * ` + "`" + `SITPaymentRequestStart` + "`" + `\n * ` + "`" + `SITPaymentRequestEnd` + "`" + `\n\nThe value of each is a date string in the format \"YYYY-MM-DD\" (e.g. \"2023-01-15\")\n", "type": "array", "items": { "$ref": "#/definitions/ServiceItemParamsItems0" @@ -9666,7 +10010,7 @@ func init() { ] }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n * ICRT - UpdateMTOServiceItemCrating\n * IUCRT - UpdateMTOServiceItemCrating\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * IDDSIT - UpdateMTOServiceItemSIT\n * IDFSIT - UpdateMTOServiceItemSIT\n * IDASIT - UpdateMTOServiceItemSIT\n * IOPSIT - UpdateMTOServiceItemSIT\n * IOASIT - UpdateMTOServiceItemSIT\n * IOFSIT - UpdateMTOServiceItemSIT\n * IOSFSC - UpdateMTOServiceItemSIT\n * IDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n * ICRT - UpdateMTOServiceItemCrating\n * IUCRT - UpdateMTOServiceItemCrating\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -9720,7 +10064,15 @@ func init() { "DOPSIT", "DOASIT", "DOFSIT", - "DOSFSC" + "DOSFSC", + "IDDSIT", + "IDASIT", + "IDFSIT", + "IDSFSC", + "IOPSIT", + "IOASIT", + "IOFSIT", + "IOSFSC" ] }, "requestApprovalsRequestedStatus": { diff --git a/pkg/gen/primeapi/primeoperations/mto_service_item/create_m_t_o_service_item.go b/pkg/gen/primeapi/primeoperations/mto_service_item/create_m_t_o_service_item.go index 85456161f0c..88adde61f94 100644 --- a/pkg/gen/primeapi/primeoperations/mto_service_item/create_m_t_o_service_item.go +++ b/pkg/gen/primeapi/primeoperations/mto_service_item/create_m_t_o_service_item.go @@ -121,6 +121,81 @@ When a DDFSIT is requested, the API will auto-create the following group of serv **Addt'l days destination SIT service item**. This represents an additional day of storage for the same item. Additional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**. + +--- + +**`MTOServiceItemInternationalOriginSIT`** + +MTOServiceItemInternationalOriginSIT is a subtype of MTOServiceItem. + +This model type describes a international origin SIT service item. Items can be created using this +model type with the following codes: + +**IOFSIT** + +**1st day origin SIT service item**. When a IOFSIT is requested, the API will auto-create the following group of service items: + - IOFSIT - International origin 1st day SIT + - IOASIT - International origin Additional day SIT + - IOPSIT - International origin SIT pickup + - IOSFSC - International origin SIT fuel surcharge + +**IOASIT** + +**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item. +Additional IOASIT service items can be created and added to an existing shipment that **includes a IOFSIT service item**. + +--- + +**`MTOServiceItemInternationalDestSIT`** + +MTOServiceItemInternationalDestSIT is a subtype of MTOServiceItem. + +This model type describes a international destination SIT service item. Items can be created using this +model type with the following codes: + +**IDFSIT** + +**1st day destination SIT service item**. + +These additional fields are optional for creating a IDFSIT: + - `firstAvailableDeliveryDate1` + - string + - First available date that Prime can deliver SIT service item. + - firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together + - `dateOfContact1` + - string + - Date of attempted contact by the prime corresponding to `timeMilitary1` + - dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together + - `timeMilitary1` + - string\d{4}Z + - Time of attempted contact corresponding to `dateOfContact1`, in military format. + - timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together + - `firstAvailableDeliveryDate2` + - string + - Second available date that Prime can deliver SIT service item. + - firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together + - `dateOfContact2` + - string + - Date of attempted contact delivery by the prime corresponding to `timeMilitary2` + - dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together + - `timeMilitary2` + - string\d{4}Z + - Time of attempted contact corresponding to `dateOfContact2`, in military format. + - timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together + +When a IDFSIT is requested, the API will auto-create the following group of service items: + - IDFSIT - International destination 1st day SIT + - IDASIT - International destination Additional day SIT + - IDDSIT - International destination SIT delivery + - IDSFSC - International destination SIT fuel surcharge + +**NOTE** When providing the `sitEntryDate` value in the payload, please ensure that the date is not BEFORE +`firstAvailableDeliveryDate1` or `firstAvailableDeliveryDate2`. If it is, you will receive an error response. + +**IDASIT** + +**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item. +Additional IDASIT service items can be created and added to an existing shipment that **includes a IDFSIT service item**. */ type CreateMTOServiceItem struct { Context *middleware.Context diff --git a/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go b/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go index 884e2637045..c6215639acd 100644 --- a/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go +++ b/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go @@ -64,6 +64,14 @@ The following SIT service items can be resubmitted following a rejection: - DOFSIT - DDSFSC - DOSFSC +- IDASIT +- IDDSIT +- IDFSIT +- IOASIT +- IOPSIT +- IOFSIT +- IDSFSC +- IOSFSC The following Accessorial service items can be resubmitted following a rejection: - IOSHUT diff --git a/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go b/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go index 07040bad20e..af261a8501c 100644 --- a/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go +++ b/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go @@ -129,6 +129,81 @@ When a DDFSIT is requested, the API will auto-create the following group of serv **Addt'l days destination SIT service item**. This represents an additional day of storage for the same item. Additional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**. + +--- + +**`MTOServiceItemInternationalOriginSIT`** + +MTOServiceItemInternationalOriginSIT is a subtype of MTOServiceItem. + +This model type describes a international origin SIT service item. Items can be created using this +model type with the following codes: + +**IOFSIT** + +**1st day origin SIT service item**. When a IOFSIT is requested, the API will auto-create the following group of service items: + - IOFSIT - International origin 1st day SIT + - IOASIT - International origin Additional day SIT + - IOPSIT - International origin SIT pickup + - IOSFSC - International origin SIT fuel surcharge + +**IOASIT** + +**Addt'l days origin SIT service item**. This represents an additional day of storage for the same item. +Additional IOASIT service items can be created and added to an existing shipment that **includes a IOFSIT service item**. + +--- + +**`MTOServiceItemInternationalDestSIT`** + +MTOServiceItemInternationalDestSIT is a subtype of MTOServiceItem. + +This model type describes a international destination SIT service item. Items can be created using this +model type with the following codes: + +**IDFSIT** + +**1st day destination SIT service item**. + +These additional fields are optional for creating a IDFSIT: + - `firstAvailableDeliveryDate1` + - string + - First available date that Prime can deliver SIT service item. + - firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together + - `dateOfContact1` + - string + - Date of attempted contact by the prime corresponding to `timeMilitary1` + - dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together + - `timeMilitary1` + - string\d{4}Z + - Time of attempted contact corresponding to `dateOfContact1`, in military format. + - timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together + - `firstAvailableDeliveryDate2` + - string + - Second available date that Prime can deliver SIT service item. + - firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together + - `dateOfContact2` + - string + - Date of attempted contact delivery by the prime corresponding to `timeMilitary2` + - dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together + - `timeMilitary2` + - string\d{4}Z + - Time of attempted contact corresponding to `dateOfContact2`, in military format. + - timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together + +When a IDFSIT is requested, the API will auto-create the following group of service items: + - IDFSIT - International destination 1st day SIT + - IDASIT - International destination Additional day SIT + - IDDSIT - International destination SIT delivery + - IDSFSC - International destination SIT fuel surcharge + +**NOTE** When providing the `sitEntryDate` value in the payload, please ensure that the date is not BEFORE +`firstAvailableDeliveryDate1` or `firstAvailableDeliveryDate2`. If it is, you will receive an error response. + +**IDASIT** + +**Addt'l days destination SIT service item**. This represents an additional day of storage for the same item. +Additional IDASIT service items can be created and added to an existing shipment that **includes a IDFSIT service item**. */ func (a *Client) CreateMTOServiceItem(params *CreateMTOServiceItemParams, opts ...ClientOption) (*CreateMTOServiceItemOK, error) { // TODO: Validate the params before sending @@ -247,6 +322,14 @@ The following SIT service items can be resubmitted following a rejection: - DOFSIT - DDSFSC - DOSFSC +- IDASIT +- IDDSIT +- IDFSIT +- IOASIT +- IOPSIT +- IOFSIT +- IDSFSC +- IOSFSC The following Accessorial service items can be resubmitted following a rejection: - IOSHUT diff --git a/pkg/gen/primemessages/m_t_o_service_item.go b/pkg/gen/primemessages/m_t_o_service_item.go index 028e219d5df..568ee5954c6 100644 --- a/pkg/gen/primemessages/m_t_o_service_item.go +++ b/pkg/gen/primemessages/m_t_o_service_item.go @@ -285,12 +285,24 @@ func unmarshalMTOServiceItem(data []byte, consumer runtime.Consumer) (MTOService return nil, err } return &result, nil + case "MTOServiceItemInternationalDestSIT": + var result MTOServiceItemInternationalDestSIT + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemInternationalFuelSurcharge": var result MTOServiceItemInternationalFuelSurcharge if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil + case "MTOServiceItemInternationalOriginSIT": + var result MTOServiceItemInternationalOriginSIT + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemInternationalShuttle": var result MTOServiceItemInternationalShuttle if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primemessages/m_t_o_service_item_international_dest_s_i_t.go b/pkg/gen/primemessages/m_t_o_service_item_international_dest_s_i_t.go new file mode 100644 index 00000000000..07ab443e34d --- /dev/null +++ b/pkg/gen/primemessages/m_t_o_service_item_international_dest_s_i_t.go @@ -0,0 +1,987 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primemessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalDestSIT Describes a international destination SIT service item. Subtype of a MTOServiceItem. +// +// swagger:model MTOServiceItemInternationalDestSIT +type MTOServiceItemInternationalDestSIT struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalDestSIT) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalDestSIT) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalDestSIT) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalDestSIT) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalDestSIT" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalDestSIT) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalDestSIT) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalDestSIT) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalDestSIT) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalDestSIT) UnmarshalJSON(raw []byte) error { + var data struct { + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalDestSIT + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.DateOfContact1 = data.DateOfContact1 + result.DateOfContact2 = data.DateOfContact2 + result.FirstAvailableDeliveryDate1 = data.FirstAvailableDeliveryDate1 + result.FirstAvailableDeliveryDate2 = data.FirstAvailableDeliveryDate2 + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.SitCustomerContacted = data.SitCustomerContacted + result.SitDepartureDate = data.SitDepartureDate + result.SitDestinationFinalAddress = data.SitDestinationFinalAddress + result.SitEntryDate = data.SitEntryDate + result.SitRequestedDelivery = data.SitRequestedDelivery + result.TimeMilitary1 = data.TimeMilitary1 + result.TimeMilitary2 = data.TimeMilitary2 + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalDestSIT) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` + }{ + + DateOfContact1: m.DateOfContact1, + + DateOfContact2: m.DateOfContact2, + + FirstAvailableDeliveryDate1: m.FirstAvailableDeliveryDate1, + + FirstAvailableDeliveryDate2: m.FirstAvailableDeliveryDate2, + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + SitCustomerContacted: m.SitCustomerContacted, + + SitDepartureDate: m.SitDepartureDate, + + SitDestinationFinalAddress: m.SitDestinationFinalAddress, + + SitEntryDate: m.SitEntryDate, + + SitRequestedDelivery: m.SitRequestedDelivery, + + TimeMilitary1: m.TimeMilitary1, + + TimeMilitary2: m.TimeMilitary2, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international dest s i t +func (m *MTOServiceItemInternationalDestSIT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDateOfContact1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDateOfContact2(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFirstAvailableDeliveryDate1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFirstAvailableDeliveryDate2(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitCustomerContacted(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDepartureDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDestinationFinalAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitEntryDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitRequestedDelivery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeMilitary1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeMilitary2(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateDateOfContact1(formats strfmt.Registry) error { + + if swag.IsZero(m.DateOfContact1) { // not required + return nil + } + + if err := validate.FormatOf("dateOfContact1", "body", "date", m.DateOfContact1.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateDateOfContact2(formats strfmt.Registry) error { + + if swag.IsZero(m.DateOfContact2) { // not required + return nil + } + + if err := validate.FormatOf("dateOfContact2", "body", "date", m.DateOfContact2.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateFirstAvailableDeliveryDate1(formats strfmt.Registry) error { + + if swag.IsZero(m.FirstAvailableDeliveryDate1) { // not required + return nil + } + + if err := validate.FormatOf("firstAvailableDeliveryDate1", "body", "date", m.FirstAvailableDeliveryDate1.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateFirstAvailableDeliveryDate2(formats strfmt.Registry) error { + + if swag.IsZero(m.FirstAvailableDeliveryDate2) { // not required + return nil + } + + if err := validate.FormatOf("firstAvailableDeliveryDate2", "body", "date", m.FirstAvailableDeliveryDate2.String(), formats); err != nil { + return err + } + + return nil +} + +var mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IDFSIT","IDASIT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum = append(mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalDestSIT) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitCustomerContacted(formats strfmt.Registry) error { + + if swag.IsZero(m.SitCustomerContacted) { // not required + return nil + } + + if err := validate.FormatOf("sitCustomerContacted", "body", "date", m.SitCustomerContacted.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitDepartureDate(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDepartureDate) { // not required + return nil + } + + if err := validate.FormatOf("sitDepartureDate", "body", "date", m.SitDepartureDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitDestinationFinalAddress(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDestinationFinalAddress) { // not required + return nil + } + + if m.SitDestinationFinalAddress != nil { + if err := m.SitDestinationFinalAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitDestinationFinalAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitDestinationFinalAddress") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitEntryDate(formats strfmt.Registry) error { + + if err := validate.Required("sitEntryDate", "body", m.SitEntryDate); err != nil { + return err + } + + if err := validate.FormatOf("sitEntryDate", "body", "date", m.SitEntryDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitRequestedDelivery(formats strfmt.Registry) error { + + if swag.IsZero(m.SitRequestedDelivery) { // not required + return nil + } + + if err := validate.FormatOf("sitRequestedDelivery", "body", "date", m.SitRequestedDelivery.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateTimeMilitary1(formats strfmt.Registry) error { + + if swag.IsZero(m.TimeMilitary1) { // not required + return nil + } + + if err := validate.Pattern("timeMilitary1", "body", *m.TimeMilitary1, `\d{4}Z`); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateTimeMilitary2(formats strfmt.Registry) error { + + if swag.IsZero(m.TimeMilitary2) { // not required + return nil + } + + if err := validate.Pattern("timeMilitary2", "body", *m.TimeMilitary2, `\d{4}Z`); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international dest s i t based on the context it is used +func (m *MTOServiceItemInternationalDestSIT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitDestinationFinalAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateSitDestinationFinalAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.SitDestinationFinalAddress != nil { + + if swag.IsZero(m.SitDestinationFinalAddress) { // not required + return nil + } + + if err := m.SitDestinationFinalAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitDestinationFinalAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitDestinationFinalAddress") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalDestSIT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalDestSIT) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalDestSIT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primemessages/m_t_o_service_item_international_origin_s_i_t.go b/pkg/gen/primemessages/m_t_o_service_item_international_origin_s_i_t.go new file mode 100644 index 00000000000..96392736360 --- /dev/null +++ b/pkg/gen/primemessages/m_t_o_service_item_international_origin_s_i_t.go @@ -0,0 +1,900 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primemessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalOriginSIT Describes a international origin SIT service item. Subtype of a MTOServiceItem. +// +// swagger:model MTOServiceItemInternationalOriginSIT +type MTOServiceItemInternationalOriginSIT struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalOriginSIT" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalOriginSIT) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalOriginSIT) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalOriginSIT) UnmarshalJSON(raw []byte) error { + var data struct { + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalOriginSIT + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + result.SitCustomerContacted = data.SitCustomerContacted + result.SitDepartureDate = data.SitDepartureDate + result.SitEntryDate = data.SitEntryDate + result.SitHHGActualOrigin = data.SitHHGActualOrigin + result.SitHHGOriginalOrigin = data.SitHHGOriginalOrigin + result.SitPostalCode = data.SitPostalCode + result.SitRequestedDelivery = data.SitRequestedDelivery + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalOriginSIT) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + }{ + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + + SitCustomerContacted: m.SitCustomerContacted, + + SitDepartureDate: m.SitDepartureDate, + + SitEntryDate: m.SitEntryDate, + + SitHHGActualOrigin: m.SitHHGActualOrigin, + + SitHHGOriginalOrigin: m.SitHHGOriginalOrigin, + + SitPostalCode: m.SitPostalCode, + + SitRequestedDelivery: m.SitRequestedDelivery, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international origin s i t +func (m *MTOServiceItemInternationalOriginSIT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitCustomerContacted(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDepartureDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitEntryDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitHHGActualOrigin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitHHGOriginalOrigin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitPostalCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitRequestedDelivery(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +var mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IOFSIT","IOASIT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum = append(mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalOriginSIT) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitCustomerContacted(formats strfmt.Registry) error { + + if swag.IsZero(m.SitCustomerContacted) { // not required + return nil + } + + if err := validate.FormatOf("sitCustomerContacted", "body", "date", m.SitCustomerContacted.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitDepartureDate(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDepartureDate) { // not required + return nil + } + + if err := validate.FormatOf("sitDepartureDate", "body", "date", m.SitDepartureDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitEntryDate(formats strfmt.Registry) error { + + if err := validate.Required("sitEntryDate", "body", m.SitEntryDate); err != nil { + return err + } + + if err := validate.FormatOf("sitEntryDate", "body", "date", m.SitEntryDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitHHGActualOrigin(formats strfmt.Registry) error { + + if swag.IsZero(m.SitHHGActualOrigin) { // not required + return nil + } + + if m.SitHHGActualOrigin != nil { + if err := m.SitHHGActualOrigin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGActualOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGActualOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitHHGOriginalOrigin(formats strfmt.Registry) error { + + if swag.IsZero(m.SitHHGOriginalOrigin) { // not required + return nil + } + + if m.SitHHGOriginalOrigin != nil { + if err := m.SitHHGOriginalOrigin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGOriginalOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGOriginalOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitPostalCode(formats strfmt.Registry) error { + + if err := validate.Required("sitPostalCode", "body", m.SitPostalCode); err != nil { + return err + } + + if err := validate.Pattern("sitPostalCode", "body", *m.SitPostalCode, `^(\d{5}([\-]\d{4})?)$`); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitRequestedDelivery(formats strfmt.Registry) error { + + if swag.IsZero(m.SitRequestedDelivery) { // not required + return nil + } + + if err := validate.FormatOf("sitRequestedDelivery", "body", "date", m.SitRequestedDelivery.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international origin s i t based on the context it is used +func (m *MTOServiceItemInternationalOriginSIT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitHHGActualOrigin(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitHHGOriginalOrigin(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateSitHHGActualOrigin(ctx context.Context, formats strfmt.Registry) error { + + if m.SitHHGActualOrigin != nil { + + if swag.IsZero(m.SitHHGActualOrigin) { // not required + return nil + } + + if err := m.SitHHGActualOrigin.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGActualOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGActualOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateSitHHGOriginalOrigin(ctx context.Context, formats strfmt.Registry) error { + + if m.SitHHGOriginalOrigin != nil { + + if swag.IsZero(m.SitHHGOriginalOrigin) { // not required + return nil + } + + if err := m.SitHHGOriginalOrigin.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGOriginalOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGOriginalOrigin") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalOriginSIT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalOriginSIT) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalOriginSIT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primemessages/m_t_o_service_item_model_type.go b/pkg/gen/primemessages/m_t_o_service_item_model_type.go index 3c494ac62f3..0e273fe2bd3 100644 --- a/pkg/gen/primemessages/m_t_o_service_item_model_type.go +++ b/pkg/gen/primemessages/m_t_o_service_item_model_type.go @@ -19,6 +19,8 @@ import ( // Using this list, choose the correct modelType in the dropdown, corresponding to the service item type. // - DOFSIT, DOASIT - MTOServiceItemOriginSIT // - DDFSIT, DDASIT - MTOServiceItemDestSIT +// - IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT +// - IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT // - DOSHUT, DDSHUT - MTOServiceItemShuttle // - DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle // - IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -51,6 +53,12 @@ const ( // MTOServiceItemModelTypeMTOServiceItemDestSIT captures enum value "MTOServiceItemDestSIT" MTOServiceItemModelTypeMTOServiceItemDestSIT MTOServiceItemModelType = "MTOServiceItemDestSIT" + // MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT captures enum value "MTOServiceItemInternationalOriginSIT" + MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT MTOServiceItemModelType = "MTOServiceItemInternationalOriginSIT" + + // MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT captures enum value "MTOServiceItemInternationalDestSIT" + MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT MTOServiceItemModelType = "MTOServiceItemInternationalDestSIT" + // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" @@ -75,7 +83,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemInternationalOriginSIT","MTOServiceItemInternationalDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primemessages/service_item.go b/pkg/gen/primemessages/service_item.go index 9f41d0b13e2..6c29dbc0d40 100644 --- a/pkg/gen/primemessages/service_item.go +++ b/pkg/gen/primemessages/service_item.go @@ -32,6 +32,8 @@ type ServiceItem struct { // This should be populated for the following service items: // * DOASIT(Domestic origin Additional day SIT) // * DDASIT(Domestic destination Additional day SIT) + // * IOASIT(International origin Additional day SIT) + // * IDASIT(International destination Additional day SIT) // // Both take in the following param keys: // * `SITPaymentRequestStart` diff --git a/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go b/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go index 24f9aa5707e..3a41327a34b 100644 --- a/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go +++ b/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go @@ -23,6 +23,14 @@ import ( // - DOFSIT - UpdateMTOServiceItemSIT // - DOSFSC - UpdateMTOServiceItemSIT // - DDSFSC - UpdateMTOServiceItemSIT +// - IDDSIT - UpdateMTOServiceItemSIT +// - IDFSIT - UpdateMTOServiceItemSIT +// - IDASIT - UpdateMTOServiceItemSIT +// - IOPSIT - UpdateMTOServiceItemSIT +// - IOASIT - UpdateMTOServiceItemSIT +// - IOFSIT - UpdateMTOServiceItemSIT +// - IOSFSC - UpdateMTOServiceItemSIT +// - IDSFSC - UpdateMTOServiceItemSIT // - DDSHUT - UpdateMTOServiceItemShuttle // - DOSHUT - UpdateMTOServiceItemShuttle // - PODFSC - UpdateMTOServiceItemInternationalPortFSC diff --git a/pkg/gen/primemessages/update_m_t_o_service_item_s_i_t.go b/pkg/gen/primemessages/update_m_t_o_service_item_s_i_t.go index 34fed36c1aa..5c76260ea6a 100644 --- a/pkg/gen/primemessages/update_m_t_o_service_item_s_i_t.go +++ b/pkg/gen/primemessages/update_m_t_o_service_item_s_i_t.go @@ -39,7 +39,7 @@ type UpdateMTOServiceItemSIT struct { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DDASIT DDFSIT DDSFSC DOPSIT DOASIT DOFSIT DOSFSC] + // Enum: [DDDSIT DDASIT DDFSIT DDSFSC DOPSIT DOASIT DOFSIT DOSFSC IDDSIT IDASIT IDFSIT IDSFSC IOPSIT IOASIT IOFSIT IOSFSC] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -123,7 +123,7 @@ func (m *UpdateMTOServiceItemSIT) UnmarshalJSON(raw []byte) error { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DDASIT DDFSIT DDSFSC DOPSIT DOASIT DOFSIT DOSFSC] + // Enum: [DDDSIT DDASIT DDFSIT DDSFSC DOPSIT DOASIT DOFSIT DOSFSC IDDSIT IDASIT IDFSIT IDSFSC IOPSIT IOASIT IOFSIT IOSFSC] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -242,7 +242,7 @@ func (m UpdateMTOServiceItemSIT) MarshalJSON() ([]byte, error) { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DDASIT DDFSIT DDSFSC DOPSIT DOASIT DOFSIT DOSFSC] + // Enum: [DDDSIT DDASIT DDFSIT DDSFSC DOPSIT DOASIT DOFSIT DOSFSC IDDSIT IDASIT IDFSIT IDSFSC IOPSIT IOASIT IOFSIT IOSFSC] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -471,7 +471,7 @@ var updateMTOServiceItemSITTypeReServiceCodePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["DDDSIT","DDASIT","DDFSIT","DDSFSC","DOPSIT","DOASIT","DOFSIT","DOSFSC"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["DDDSIT","DDASIT","DDFSIT","DDSFSC","DOPSIT","DOASIT","DOFSIT","DOSFSC","IDDSIT","IDASIT","IDFSIT","IDSFSC","IOPSIT","IOASIT","IOFSIT","IOSFSC"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev2api/embedded_spec.go b/pkg/gen/primev2api/embedded_spec.go index 8a15212de76..85afde7f3e3 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -1551,6 +1551,172 @@ func init() { } ] }, + "MTOServiceItemInternationalDestSIT": { + "description": "Describes a international destination SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "sitEntryDate", + "reason" + ], + "properties": { + "dateOfContact1": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "dateOfContact2": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate1": { + "description": "First available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate2": { + "description": "Second available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDFSIT", + "IDASIT" + ] + }, + "reason": { + "description": "The reason item has been placed in SIT.\n", + "type": "string", + "x-nullable": true, + "x-omitempty": false + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDestinationFinalAddress": { + "$ref": "#/definitions/Address" + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "timeMilitary1": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + }, + "timeMilitary2": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + } + } + } + ] + }, + "MTOServiceItemInternationalOriginSIT": { + "description": "Describes a international origin SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "reason", + "sitPostalCode", + "sitEntryDate" + ], + "properties": { + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IOFSIT", + "IOASIT" + ] + }, + "reason": { + "description": "Explanation of why Prime is picking up SIT item.", + "type": "string", + "example": "Storage items need to be picked up" + }, + "requestApprovalsRequestedStatus": { + "type": "boolean" + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitHHGActualOrigin": { + "$ref": "#/definitions/Address" + }, + "sitHHGOriginalOrigin": { + "$ref": "#/definitions/Address" + }, + "sitPostalCode": { + "type": "string", + "format": "zip", + "pattern": "^(\\d{5}([\\-]\\d{4})?)$", + "example": "90210" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemInternationalShuttle": { "description": "Describes an international shuttle service item.", "allOf": [ @@ -1610,12 +1776,14 @@ func init() { ] }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT\n * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", + "MTOServiceItemInternationalOriginSIT", + "MTOServiceItemInternationalDestSIT", "MTOServiceItemShuttle", "MTOServiceItemDomesticShuttle", "MTOServiceItemInternationalShuttle", @@ -3224,7 +3392,7 @@ func init() { ] }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * IDDSIT - UpdateMTOServiceItemSIT\n * IOPSIT - UpdateMTOServiceItemSIT\n * IOASIT - UpdateMTOServiceItemSIT\n * IOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -3272,7 +3440,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { @@ -5360,6 +5532,172 @@ func init() { } ] }, + "MTOServiceItemInternationalDestSIT": { + "description": "Describes a international destination SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "sitEntryDate", + "reason" + ], + "properties": { + "dateOfContact1": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "dateOfContact2": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate1": { + "description": "First available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate2": { + "description": "Second available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDFSIT", + "IDASIT" + ] + }, + "reason": { + "description": "The reason item has been placed in SIT.\n", + "type": "string", + "x-nullable": true, + "x-omitempty": false + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDestinationFinalAddress": { + "$ref": "#/definitions/Address" + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "timeMilitary1": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + }, + "timeMilitary2": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + } + } + } + ] + }, + "MTOServiceItemInternationalOriginSIT": { + "description": "Describes a international origin SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "reason", + "sitPostalCode", + "sitEntryDate" + ], + "properties": { + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IOFSIT", + "IOASIT" + ] + }, + "reason": { + "description": "Explanation of why Prime is picking up SIT item.", + "type": "string", + "example": "Storage items need to be picked up" + }, + "requestApprovalsRequestedStatus": { + "type": "boolean" + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitHHGActualOrigin": { + "$ref": "#/definitions/Address" + }, + "sitHHGOriginalOrigin": { + "$ref": "#/definitions/Address" + }, + "sitPostalCode": { + "type": "string", + "format": "zip", + "pattern": "^(\\d{5}([\\-]\\d{4})?)$", + "example": "90210" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemInternationalShuttle": { "description": "Describes an international shuttle service item.", "allOf": [ @@ -5419,12 +5757,14 @@ func init() { ] }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT\n * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", + "MTOServiceItemInternationalOriginSIT", + "MTOServiceItemInternationalDestSIT", "MTOServiceItemShuttle", "MTOServiceItemDomesticShuttle", "MTOServiceItemInternationalShuttle", @@ -7035,7 +7375,7 @@ func init() { ] }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * IDDSIT - UpdateMTOServiceItemSIT\n * IOPSIT - UpdateMTOServiceItemSIT\n * IOASIT - UpdateMTOServiceItemSIT\n * IOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -7083,7 +7423,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { diff --git a/pkg/gen/primev2messages/m_t_o_service_item.go b/pkg/gen/primev2messages/m_t_o_service_item.go index c06f87e420c..1cd148dfd39 100644 --- a/pkg/gen/primev2messages/m_t_o_service_item.go +++ b/pkg/gen/primev2messages/m_t_o_service_item.go @@ -285,6 +285,18 @@ func unmarshalMTOServiceItem(data []byte, consumer runtime.Consumer) (MTOService return nil, err } return &result, nil + case "MTOServiceItemInternationalDestSIT": + var result MTOServiceItemInternationalDestSIT + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil + case "MTOServiceItemInternationalOriginSIT": + var result MTOServiceItemInternationalOriginSIT + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemInternationalShuttle": var result MTOServiceItemInternationalShuttle if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primev2messages/m_t_o_service_item_international_dest_s_i_t.go b/pkg/gen/primev2messages/m_t_o_service_item_international_dest_s_i_t.go new file mode 100644 index 00000000000..fb503d39a43 --- /dev/null +++ b/pkg/gen/primev2messages/m_t_o_service_item_international_dest_s_i_t.go @@ -0,0 +1,987 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev2messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalDestSIT Describes a international destination SIT service item. Subtype of a MTOServiceItem. +// +// swagger:model MTOServiceItemInternationalDestSIT +type MTOServiceItemInternationalDestSIT struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalDestSIT) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalDestSIT) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalDestSIT) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalDestSIT) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalDestSIT" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalDestSIT) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalDestSIT) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalDestSIT) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalDestSIT) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalDestSIT) UnmarshalJSON(raw []byte) error { + var data struct { + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalDestSIT + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.DateOfContact1 = data.DateOfContact1 + result.DateOfContact2 = data.DateOfContact2 + result.FirstAvailableDeliveryDate1 = data.FirstAvailableDeliveryDate1 + result.FirstAvailableDeliveryDate2 = data.FirstAvailableDeliveryDate2 + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.SitCustomerContacted = data.SitCustomerContacted + result.SitDepartureDate = data.SitDepartureDate + result.SitDestinationFinalAddress = data.SitDestinationFinalAddress + result.SitEntryDate = data.SitEntryDate + result.SitRequestedDelivery = data.SitRequestedDelivery + result.TimeMilitary1 = data.TimeMilitary1 + result.TimeMilitary2 = data.TimeMilitary2 + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalDestSIT) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` + }{ + + DateOfContact1: m.DateOfContact1, + + DateOfContact2: m.DateOfContact2, + + FirstAvailableDeliveryDate1: m.FirstAvailableDeliveryDate1, + + FirstAvailableDeliveryDate2: m.FirstAvailableDeliveryDate2, + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + SitCustomerContacted: m.SitCustomerContacted, + + SitDepartureDate: m.SitDepartureDate, + + SitDestinationFinalAddress: m.SitDestinationFinalAddress, + + SitEntryDate: m.SitEntryDate, + + SitRequestedDelivery: m.SitRequestedDelivery, + + TimeMilitary1: m.TimeMilitary1, + + TimeMilitary2: m.TimeMilitary2, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international dest s i t +func (m *MTOServiceItemInternationalDestSIT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDateOfContact1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDateOfContact2(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFirstAvailableDeliveryDate1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFirstAvailableDeliveryDate2(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitCustomerContacted(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDepartureDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDestinationFinalAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitEntryDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitRequestedDelivery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeMilitary1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeMilitary2(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateDateOfContact1(formats strfmt.Registry) error { + + if swag.IsZero(m.DateOfContact1) { // not required + return nil + } + + if err := validate.FormatOf("dateOfContact1", "body", "date", m.DateOfContact1.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateDateOfContact2(formats strfmt.Registry) error { + + if swag.IsZero(m.DateOfContact2) { // not required + return nil + } + + if err := validate.FormatOf("dateOfContact2", "body", "date", m.DateOfContact2.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateFirstAvailableDeliveryDate1(formats strfmt.Registry) error { + + if swag.IsZero(m.FirstAvailableDeliveryDate1) { // not required + return nil + } + + if err := validate.FormatOf("firstAvailableDeliveryDate1", "body", "date", m.FirstAvailableDeliveryDate1.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateFirstAvailableDeliveryDate2(formats strfmt.Registry) error { + + if swag.IsZero(m.FirstAvailableDeliveryDate2) { // not required + return nil + } + + if err := validate.FormatOf("firstAvailableDeliveryDate2", "body", "date", m.FirstAvailableDeliveryDate2.String(), formats); err != nil { + return err + } + + return nil +} + +var mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IDFSIT","IDASIT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum = append(mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalDestSIT) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitCustomerContacted(formats strfmt.Registry) error { + + if swag.IsZero(m.SitCustomerContacted) { // not required + return nil + } + + if err := validate.FormatOf("sitCustomerContacted", "body", "date", m.SitCustomerContacted.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitDepartureDate(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDepartureDate) { // not required + return nil + } + + if err := validate.FormatOf("sitDepartureDate", "body", "date", m.SitDepartureDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitDestinationFinalAddress(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDestinationFinalAddress) { // not required + return nil + } + + if m.SitDestinationFinalAddress != nil { + if err := m.SitDestinationFinalAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitDestinationFinalAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitDestinationFinalAddress") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitEntryDate(formats strfmt.Registry) error { + + if err := validate.Required("sitEntryDate", "body", m.SitEntryDate); err != nil { + return err + } + + if err := validate.FormatOf("sitEntryDate", "body", "date", m.SitEntryDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitRequestedDelivery(formats strfmt.Registry) error { + + if swag.IsZero(m.SitRequestedDelivery) { // not required + return nil + } + + if err := validate.FormatOf("sitRequestedDelivery", "body", "date", m.SitRequestedDelivery.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateTimeMilitary1(formats strfmt.Registry) error { + + if swag.IsZero(m.TimeMilitary1) { // not required + return nil + } + + if err := validate.Pattern("timeMilitary1", "body", *m.TimeMilitary1, `\d{4}Z`); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateTimeMilitary2(formats strfmt.Registry) error { + + if swag.IsZero(m.TimeMilitary2) { // not required + return nil + } + + if err := validate.Pattern("timeMilitary2", "body", *m.TimeMilitary2, `\d{4}Z`); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international dest s i t based on the context it is used +func (m *MTOServiceItemInternationalDestSIT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitDestinationFinalAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateSitDestinationFinalAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.SitDestinationFinalAddress != nil { + + if swag.IsZero(m.SitDestinationFinalAddress) { // not required + return nil + } + + if err := m.SitDestinationFinalAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitDestinationFinalAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitDestinationFinalAddress") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalDestSIT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalDestSIT) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalDestSIT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev2messages/m_t_o_service_item_international_origin_s_i_t.go b/pkg/gen/primev2messages/m_t_o_service_item_international_origin_s_i_t.go new file mode 100644 index 00000000000..37e22af66af --- /dev/null +++ b/pkg/gen/primev2messages/m_t_o_service_item_international_origin_s_i_t.go @@ -0,0 +1,900 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev2messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalOriginSIT Describes a international origin SIT service item. Subtype of a MTOServiceItem. +// +// swagger:model MTOServiceItemInternationalOriginSIT +type MTOServiceItemInternationalOriginSIT struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalOriginSIT" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalOriginSIT) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalOriginSIT) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalOriginSIT) UnmarshalJSON(raw []byte) error { + var data struct { + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalOriginSIT + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + result.SitCustomerContacted = data.SitCustomerContacted + result.SitDepartureDate = data.SitDepartureDate + result.SitEntryDate = data.SitEntryDate + result.SitHHGActualOrigin = data.SitHHGActualOrigin + result.SitHHGOriginalOrigin = data.SitHHGOriginalOrigin + result.SitPostalCode = data.SitPostalCode + result.SitRequestedDelivery = data.SitRequestedDelivery + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalOriginSIT) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + }{ + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + + SitCustomerContacted: m.SitCustomerContacted, + + SitDepartureDate: m.SitDepartureDate, + + SitEntryDate: m.SitEntryDate, + + SitHHGActualOrigin: m.SitHHGActualOrigin, + + SitHHGOriginalOrigin: m.SitHHGOriginalOrigin, + + SitPostalCode: m.SitPostalCode, + + SitRequestedDelivery: m.SitRequestedDelivery, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international origin s i t +func (m *MTOServiceItemInternationalOriginSIT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitCustomerContacted(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDepartureDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitEntryDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitHHGActualOrigin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitHHGOriginalOrigin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitPostalCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitRequestedDelivery(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +var mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IOFSIT","IOASIT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum = append(mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalOriginSIT) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitCustomerContacted(formats strfmt.Registry) error { + + if swag.IsZero(m.SitCustomerContacted) { // not required + return nil + } + + if err := validate.FormatOf("sitCustomerContacted", "body", "date", m.SitCustomerContacted.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitDepartureDate(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDepartureDate) { // not required + return nil + } + + if err := validate.FormatOf("sitDepartureDate", "body", "date", m.SitDepartureDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitEntryDate(formats strfmt.Registry) error { + + if err := validate.Required("sitEntryDate", "body", m.SitEntryDate); err != nil { + return err + } + + if err := validate.FormatOf("sitEntryDate", "body", "date", m.SitEntryDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitHHGActualOrigin(formats strfmt.Registry) error { + + if swag.IsZero(m.SitHHGActualOrigin) { // not required + return nil + } + + if m.SitHHGActualOrigin != nil { + if err := m.SitHHGActualOrigin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGActualOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGActualOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitHHGOriginalOrigin(formats strfmt.Registry) error { + + if swag.IsZero(m.SitHHGOriginalOrigin) { // not required + return nil + } + + if m.SitHHGOriginalOrigin != nil { + if err := m.SitHHGOriginalOrigin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGOriginalOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGOriginalOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitPostalCode(formats strfmt.Registry) error { + + if err := validate.Required("sitPostalCode", "body", m.SitPostalCode); err != nil { + return err + } + + if err := validate.Pattern("sitPostalCode", "body", *m.SitPostalCode, `^(\d{5}([\-]\d{4})?)$`); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitRequestedDelivery(formats strfmt.Registry) error { + + if swag.IsZero(m.SitRequestedDelivery) { // not required + return nil + } + + if err := validate.FormatOf("sitRequestedDelivery", "body", "date", m.SitRequestedDelivery.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international origin s i t based on the context it is used +func (m *MTOServiceItemInternationalOriginSIT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitHHGActualOrigin(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitHHGOriginalOrigin(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateSitHHGActualOrigin(ctx context.Context, formats strfmt.Registry) error { + + if m.SitHHGActualOrigin != nil { + + if swag.IsZero(m.SitHHGActualOrigin) { // not required + return nil + } + + if err := m.SitHHGActualOrigin.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGActualOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGActualOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateSitHHGOriginalOrigin(ctx context.Context, formats strfmt.Registry) error { + + if m.SitHHGOriginalOrigin != nil { + + if swag.IsZero(m.SitHHGOriginalOrigin) { // not required + return nil + } + + if err := m.SitHHGOriginalOrigin.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGOriginalOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGOriginalOrigin") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalOriginSIT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalOriginSIT) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalOriginSIT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev2messages/m_t_o_service_item_model_type.go b/pkg/gen/primev2messages/m_t_o_service_item_model_type.go index 77247b78fe0..b443afec65b 100644 --- a/pkg/gen/primev2messages/m_t_o_service_item_model_type.go +++ b/pkg/gen/primev2messages/m_t_o_service_item_model_type.go @@ -19,6 +19,8 @@ import ( // Using this list, choose the correct modelType in the dropdown, corresponding to the service item type. // - DOFSIT, DOASIT - MTOServiceItemOriginSIT // - DDFSIT, DDASIT - MTOServiceItemDestSIT +// - IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT +// - IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT // - DOSHUT, DDSHUT - MTOServiceItemShuttle // - DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle // - IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -51,6 +53,12 @@ const ( // MTOServiceItemModelTypeMTOServiceItemDestSIT captures enum value "MTOServiceItemDestSIT" MTOServiceItemModelTypeMTOServiceItemDestSIT MTOServiceItemModelType = "MTOServiceItemDestSIT" + // MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT captures enum value "MTOServiceItemInternationalOriginSIT" + MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT MTOServiceItemModelType = "MTOServiceItemInternationalOriginSIT" + + // MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT captures enum value "MTOServiceItemInternationalDestSIT" + MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT MTOServiceItemModelType = "MTOServiceItemInternationalDestSIT" + // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" @@ -75,7 +83,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemInternationalOriginSIT","MTOServiceItemInternationalDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go b/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go index 8b865cfec1f..ce2195310c9 100644 --- a/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go +++ b/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go @@ -19,6 +19,10 @@ import ( // - DOPSIT - UpdateMTOServiceItemSIT // - DOASIT - UpdateMTOServiceItemSIT // - DOFSIT - UpdateMTOServiceItemSIT +// - IDDSIT - UpdateMTOServiceItemSIT +// - IOPSIT - UpdateMTOServiceItemSIT +// - IOASIT - UpdateMTOServiceItemSIT +// - IOFSIT - UpdateMTOServiceItemSIT // - DDSHUT - UpdateMTOServiceItemShuttle // - DOSHUT - UpdateMTOServiceItemShuttle // - IDSHUT - UpdateMTOServiceItemInternationalShuttle diff --git a/pkg/gen/primev2messages/update_m_t_o_service_item_s_i_t.go b/pkg/gen/primev2messages/update_m_t_o_service_item_s_i_t.go index 558e84ba19c..9accd54333f 100644 --- a/pkg/gen/primev2messages/update_m_t_o_service_item_s_i_t.go +++ b/pkg/gen/primev2messages/update_m_t_o_service_item_s_i_t.go @@ -39,7 +39,7 @@ type UpdateMTOServiceItemSIT struct { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DOPSIT DOASIT DOFSIT] + // Enum: [DDDSIT DOPSIT DOASIT DOFSIT IDDSIT IOPSIT IOASIT IOFSIT] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -123,7 +123,7 @@ func (m *UpdateMTOServiceItemSIT) UnmarshalJSON(raw []byte) error { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DOPSIT DOASIT DOFSIT] + // Enum: [DDDSIT DOPSIT DOASIT DOFSIT IDDSIT IOPSIT IOASIT IOFSIT] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -242,7 +242,7 @@ func (m UpdateMTOServiceItemSIT) MarshalJSON() ([]byte, error) { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DOPSIT DOASIT DOFSIT] + // Enum: [DDDSIT DOPSIT DOASIT DOFSIT IDDSIT IOPSIT IOASIT IOFSIT] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -471,7 +471,7 @@ var updateMTOServiceItemSITTypeReServiceCodePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["DDDSIT","DOPSIT","DOASIT","DOFSIT"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["DDDSIT","DOPSIT","DOASIT","DOFSIT","IDDSIT","IOPSIT","IOASIT","IOFSIT"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev3api/embedded_spec.go b/pkg/gen/primev3api/embedded_spec.go index b926e318a3e..582a95400fd 100644 --- a/pkg/gen/primev3api/embedded_spec.go +++ b/pkg/gen/primev3api/embedded_spec.go @@ -1713,6 +1713,102 @@ func init() { } ] }, + "MTOServiceItemInternationalDestSIT": { + "description": "Describes a international destination SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "sitEntryDate", + "reason" + ], + "properties": { + "dateOfContact1": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "dateOfContact2": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate1": { + "description": "First available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate2": { + "description": "Second available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDFSIT", + "IDASIT" + ] + }, + "reason": { + "description": "The reason item has been placed in SIT.\n", + "type": "string", + "x-nullable": true, + "x-omitempty": false + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDestinationFinalAddress": { + "$ref": "#/definitions/Address" + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "timeMilitary1": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + }, + "timeMilitary2": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + } + } + } + ] + }, "MTOServiceItemInternationalFuelSurcharge": { "description": "Describes a international Port of Embarkation/Debarkation fuel surcharge service item subtype of a MTOServiceItem.", "allOf": [ @@ -1738,6 +1834,76 @@ func init() { } ] }, + "MTOServiceItemInternationalOriginSIT": { + "description": "Describes a international origin SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "reason", + "sitPostalCode", + "sitEntryDate" + ], + "properties": { + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IOFSIT", + "IOASIT" + ] + }, + "reason": { + "description": "Explanation of why Prime is picking up SIT item.", + "type": "string", + "example": "Storage items need to be picked up" + }, + "requestApprovalsRequestedStatus": { + "type": "boolean" + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitHHGActualOrigin": { + "$ref": "#/definitions/Address" + }, + "sitHHGOriginalOrigin": { + "$ref": "#/definitions/Address" + }, + "sitPostalCode": { + "type": "string", + "format": "zip", + "pattern": "^(\\d{5}([\\-]\\d{4})?)$", + "example": "90210" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemInternationalShuttle": { "description": "Describes an international shuttle service item.", "allOf": [ @@ -1797,12 +1963,14 @@ func init() { ] }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT\n * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", + "MTOServiceItemInternationalOriginSIT", + "MTOServiceItemInternationalDestSIT", "MTOServiceItemShuttle", "MTOServiceItemDomesticShuttle", "MTOServiceItemInternationalShuttle", @@ -3842,7 +4010,7 @@ func init() { ] }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * IDDSIT - UpdateMTOServiceItemSIT\n * IOPSIT - UpdateMTOServiceItemSIT\n * IOASIT - UpdateMTOServiceItemSIT\n * IOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -3890,7 +4058,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { @@ -6232,6 +6404,102 @@ func init() { } ] }, + "MTOServiceItemInternationalDestSIT": { + "description": "Describes a international destination SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "sitEntryDate", + "reason" + ], + "properties": { + "dateOfContact1": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary1` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "dateOfContact2": { + "description": "Date of attempted contact by the prime corresponding to ` + "`" + `timeMilitary2` + "`" + `.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate1": { + "description": "First available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "firstAvailableDeliveryDate2": { + "description": "Second available date that Prime can deliver SIT service item.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDFSIT", + "IDASIT" + ] + }, + "reason": { + "description": "The reason item has been placed in SIT.\n", + "type": "string", + "x-nullable": true, + "x-omitempty": false + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDestinationFinalAddress": { + "$ref": "#/definitions/Address" + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "timeMilitary1": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact1` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + }, + "timeMilitary2": { + "description": "Time of attempted contact corresponding to ` + "`" + `dateOfContact2` + "`" + `, in military format.", + "type": "string", + "pattern": "\\d{4}Z", + "x-nullable": true, + "example": "1400Z" + } + } + } + ] + }, "MTOServiceItemInternationalFuelSurcharge": { "description": "Describes a international Port of Embarkation/Debarkation fuel surcharge service item subtype of a MTOServiceItem.", "allOf": [ @@ -6257,6 +6525,76 @@ func init() { } ] }, + "MTOServiceItemInternationalOriginSIT": { + "description": "Describes a international origin SIT service item. Subtype of a MTOServiceItem.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reServiceCode", + "reason", + "sitPostalCode", + "sitEntryDate" + ], + "properties": { + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IOFSIT", + "IOASIT" + ] + }, + "reason": { + "description": "Explanation of why Prime is picking up SIT item.", + "type": "string", + "example": "Storage items need to be picked up" + }, + "requestApprovalsRequestedStatus": { + "type": "boolean" + }, + "sitCustomerContacted": { + "description": "Date when the customer contacted the prime for a delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitDepartureDate": { + "description": "Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date.", + "type": "string", + "format": "date", + "x-nullable": true + }, + "sitEntryDate": { + "description": "Entry date for the SIT", + "type": "string", + "format": "date" + }, + "sitHHGActualOrigin": { + "$ref": "#/definitions/Address" + }, + "sitHHGOriginalOrigin": { + "$ref": "#/definitions/Address" + }, + "sitPostalCode": { + "type": "string", + "format": "zip", + "pattern": "^(\\d{5}([\\-]\\d{4})?)$", + "example": "90210" + }, + "sitRequestedDelivery": { + "description": "Date when the customer has requested delivery out of SIT.", + "type": "string", + "format": "date", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemInternationalShuttle": { "description": "Describes an international shuttle service item.", "allOf": [ @@ -6316,12 +6654,14 @@ func init() { ] }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT\n * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", + "MTOServiceItemInternationalOriginSIT", + "MTOServiceItemInternationalDestSIT", "MTOServiceItemShuttle", "MTOServiceItemDomesticShuttle", "MTOServiceItemInternationalShuttle", @@ -8363,7 +8703,7 @@ func init() { ] }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * IDDSIT - UpdateMTOServiceItemSIT\n * IOPSIT - UpdateMTOServiceItemSIT\n * IOASIT - UpdateMTOServiceItemSIT\n * IOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -8411,7 +8751,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { diff --git a/pkg/gen/primev3messages/m_t_o_service_item.go b/pkg/gen/primev3messages/m_t_o_service_item.go index 06f0d63c776..93880d33231 100644 --- a/pkg/gen/primev3messages/m_t_o_service_item.go +++ b/pkg/gen/primev3messages/m_t_o_service_item.go @@ -285,12 +285,24 @@ func unmarshalMTOServiceItem(data []byte, consumer runtime.Consumer) (MTOService return nil, err } return &result, nil + case "MTOServiceItemInternationalDestSIT": + var result MTOServiceItemInternationalDestSIT + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemInternationalFuelSurcharge": var result MTOServiceItemInternationalFuelSurcharge if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil + case "MTOServiceItemInternationalOriginSIT": + var result MTOServiceItemInternationalOriginSIT + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemInternationalShuttle": var result MTOServiceItemInternationalShuttle if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primev3messages/m_t_o_service_item_international_dest_s_i_t.go b/pkg/gen/primev3messages/m_t_o_service_item_international_dest_s_i_t.go new file mode 100644 index 00000000000..cd60e27e3d1 --- /dev/null +++ b/pkg/gen/primev3messages/m_t_o_service_item_international_dest_s_i_t.go @@ -0,0 +1,987 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev3messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalDestSIT Describes a international destination SIT service item. Subtype of a MTOServiceItem. +// +// swagger:model MTOServiceItemInternationalDestSIT +type MTOServiceItemInternationalDestSIT struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalDestSIT) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalDestSIT) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalDestSIT) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalDestSIT) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalDestSIT" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalDestSIT) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalDestSIT) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalDestSIT) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalDestSIT) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalDestSIT) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalDestSIT) UnmarshalJSON(raw []byte) error { + var data struct { + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalDestSIT + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.DateOfContact1 = data.DateOfContact1 + result.DateOfContact2 = data.DateOfContact2 + result.FirstAvailableDeliveryDate1 = data.FirstAvailableDeliveryDate1 + result.FirstAvailableDeliveryDate2 = data.FirstAvailableDeliveryDate2 + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.SitCustomerContacted = data.SitCustomerContacted + result.SitDepartureDate = data.SitDepartureDate + result.SitDestinationFinalAddress = data.SitDestinationFinalAddress + result.SitEntryDate = data.SitEntryDate + result.SitRequestedDelivery = data.SitRequestedDelivery + result.TimeMilitary1 = data.TimeMilitary1 + result.TimeMilitary2 = data.TimeMilitary2 + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalDestSIT) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Date of attempted contact by the prime corresponding to `timeMilitary1`. + // Format: date + DateOfContact1 *strfmt.Date `json:"dateOfContact1,omitempty"` + + // Date of attempted contact by the prime corresponding to `timeMilitary2`. + // Format: date + DateOfContact2 *strfmt.Date `json:"dateOfContact2,omitempty"` + + // First available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate1 *strfmt.Date `json:"firstAvailableDeliveryDate1,omitempty"` + + // Second available date that Prime can deliver SIT service item. + // Format: date + FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` + + // Service code allowed for this model type. + // Required: true + // Enum: [IDFSIT IDASIT] + ReServiceCode *string `json:"reServiceCode"` + + // The reason item has been placed in SIT. + // + // Required: true + Reason *string `json:"reason"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // sit destination final address + SitDestinationFinalAddress *Address `json:"sitDestinationFinalAddress,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact1`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary1 *string `json:"timeMilitary1,omitempty"` + + // Time of attempted contact corresponding to `dateOfContact2`, in military format. + // Example: 1400Z + // Pattern: \d{4}Z + TimeMilitary2 *string `json:"timeMilitary2,omitempty"` + }{ + + DateOfContact1: m.DateOfContact1, + + DateOfContact2: m.DateOfContact2, + + FirstAvailableDeliveryDate1: m.FirstAvailableDeliveryDate1, + + FirstAvailableDeliveryDate2: m.FirstAvailableDeliveryDate2, + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + SitCustomerContacted: m.SitCustomerContacted, + + SitDepartureDate: m.SitDepartureDate, + + SitDestinationFinalAddress: m.SitDestinationFinalAddress, + + SitEntryDate: m.SitEntryDate, + + SitRequestedDelivery: m.SitRequestedDelivery, + + TimeMilitary1: m.TimeMilitary1, + + TimeMilitary2: m.TimeMilitary2, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international dest s i t +func (m *MTOServiceItemInternationalDestSIT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDateOfContact1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDateOfContact2(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFirstAvailableDeliveryDate1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFirstAvailableDeliveryDate2(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitCustomerContacted(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDepartureDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDestinationFinalAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitEntryDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitRequestedDelivery(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeMilitary1(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimeMilitary2(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateDateOfContact1(formats strfmt.Registry) error { + + if swag.IsZero(m.DateOfContact1) { // not required + return nil + } + + if err := validate.FormatOf("dateOfContact1", "body", "date", m.DateOfContact1.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateDateOfContact2(formats strfmt.Registry) error { + + if swag.IsZero(m.DateOfContact2) { // not required + return nil + } + + if err := validate.FormatOf("dateOfContact2", "body", "date", m.DateOfContact2.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateFirstAvailableDeliveryDate1(formats strfmt.Registry) error { + + if swag.IsZero(m.FirstAvailableDeliveryDate1) { // not required + return nil + } + + if err := validate.FormatOf("firstAvailableDeliveryDate1", "body", "date", m.FirstAvailableDeliveryDate1.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateFirstAvailableDeliveryDate2(formats strfmt.Registry) error { + + if swag.IsZero(m.FirstAvailableDeliveryDate2) { // not required + return nil + } + + if err := validate.FormatOf("firstAvailableDeliveryDate2", "body", "date", m.FirstAvailableDeliveryDate2.String(), formats); err != nil { + return err + } + + return nil +} + +var mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IDFSIT","IDASIT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum = append(mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalDestSIT) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalDestSITTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitCustomerContacted(formats strfmt.Registry) error { + + if swag.IsZero(m.SitCustomerContacted) { // not required + return nil + } + + if err := validate.FormatOf("sitCustomerContacted", "body", "date", m.SitCustomerContacted.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitDepartureDate(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDepartureDate) { // not required + return nil + } + + if err := validate.FormatOf("sitDepartureDate", "body", "date", m.SitDepartureDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitDestinationFinalAddress(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDestinationFinalAddress) { // not required + return nil + } + + if m.SitDestinationFinalAddress != nil { + if err := m.SitDestinationFinalAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitDestinationFinalAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitDestinationFinalAddress") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitEntryDate(formats strfmt.Registry) error { + + if err := validate.Required("sitEntryDate", "body", m.SitEntryDate); err != nil { + return err + } + + if err := validate.FormatOf("sitEntryDate", "body", "date", m.SitEntryDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateSitRequestedDelivery(formats strfmt.Registry) error { + + if swag.IsZero(m.SitRequestedDelivery) { // not required + return nil + } + + if err := validate.FormatOf("sitRequestedDelivery", "body", "date", m.SitRequestedDelivery.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateTimeMilitary1(formats strfmt.Registry) error { + + if swag.IsZero(m.TimeMilitary1) { // not required + return nil + } + + if err := validate.Pattern("timeMilitary1", "body", *m.TimeMilitary1, `\d{4}Z`); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) validateTimeMilitary2(formats strfmt.Registry) error { + + if swag.IsZero(m.TimeMilitary2) { // not required + return nil + } + + if err := validate.Pattern("timeMilitary2", "body", *m.TimeMilitary2, `\d{4}Z`); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international dest s i t based on the context it is used +func (m *MTOServiceItemInternationalDestSIT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitDestinationFinalAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalDestSIT) contextValidateSitDestinationFinalAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.SitDestinationFinalAddress != nil { + + if swag.IsZero(m.SitDestinationFinalAddress) { // not required + return nil + } + + if err := m.SitDestinationFinalAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitDestinationFinalAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitDestinationFinalAddress") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalDestSIT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalDestSIT) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalDestSIT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev3messages/m_t_o_service_item_international_origin_s_i_t.go b/pkg/gen/primev3messages/m_t_o_service_item_international_origin_s_i_t.go new file mode 100644 index 00000000000..de349763f20 --- /dev/null +++ b/pkg/gen/primev3messages/m_t_o_service_item_international_origin_s_i_t.go @@ -0,0 +1,900 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev3messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalOriginSIT Describes a international origin SIT service item. Subtype of a MTOServiceItem. +// +// swagger:model MTOServiceItemInternationalOriginSIT +type MTOServiceItemInternationalOriginSIT struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalOriginSIT" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalOriginSIT) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalOriginSIT) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalOriginSIT) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalOriginSIT) UnmarshalJSON(raw []byte) error { + var data struct { + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalOriginSIT + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + result.SitCustomerContacted = data.SitCustomerContacted + result.SitDepartureDate = data.SitDepartureDate + result.SitEntryDate = data.SitEntryDate + result.SitHHGActualOrigin = data.SitHHGActualOrigin + result.SitHHGOriginalOrigin = data.SitHHGOriginalOrigin + result.SitPostalCode = data.SitPostalCode + result.SitRequestedDelivery = data.SitRequestedDelivery + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalOriginSIT) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Service code allowed for this model type. + // Required: true + // Enum: [IOFSIT IOASIT] + ReServiceCode *string `json:"reServiceCode"` + + // Explanation of why Prime is picking up SIT item. + // Example: Storage items need to be picked up + // Required: true + Reason *string `json:"reason"` + + // request approvals requested status + RequestApprovalsRequestedStatus bool `json:"requestApprovalsRequestedStatus,omitempty"` + + // Date when the customer contacted the prime for a delivery out of SIT. + // Format: date + SitCustomerContacted *strfmt.Date `json:"sitCustomerContacted,omitempty"` + + // Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + // Format: date + SitDepartureDate *strfmt.Date `json:"sitDepartureDate,omitempty"` + + // Entry date for the SIT + // Required: true + // Format: date + SitEntryDate *strfmt.Date `json:"sitEntryDate"` + + // sit h h g actual origin + SitHHGActualOrigin *Address `json:"sitHHGActualOrigin,omitempty"` + + // sit h h g original origin + SitHHGOriginalOrigin *Address `json:"sitHHGOriginalOrigin,omitempty"` + + // sit postal code + // Example: 90210 + // Required: true + // Pattern: ^(\d{5}([\-]\d{4})?)$ + SitPostalCode *string `json:"sitPostalCode"` + + // Date when the customer has requested delivery out of SIT. + // Format: date + SitRequestedDelivery *strfmt.Date `json:"sitRequestedDelivery,omitempty"` + }{ + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + + SitCustomerContacted: m.SitCustomerContacted, + + SitDepartureDate: m.SitDepartureDate, + + SitEntryDate: m.SitEntryDate, + + SitHHGActualOrigin: m.SitHHGActualOrigin, + + SitHHGOriginalOrigin: m.SitHHGOriginalOrigin, + + SitPostalCode: m.SitPostalCode, + + SitRequestedDelivery: m.SitRequestedDelivery, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international origin s i t +func (m *MTOServiceItemInternationalOriginSIT) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitCustomerContacted(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitDepartureDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitEntryDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitHHGActualOrigin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitHHGOriginalOrigin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitPostalCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSitRequestedDelivery(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +var mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IOFSIT","IOASIT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum = append(mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalOriginSIT) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalOriginSITTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitCustomerContacted(formats strfmt.Registry) error { + + if swag.IsZero(m.SitCustomerContacted) { // not required + return nil + } + + if err := validate.FormatOf("sitCustomerContacted", "body", "date", m.SitCustomerContacted.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitDepartureDate(formats strfmt.Registry) error { + + if swag.IsZero(m.SitDepartureDate) { // not required + return nil + } + + if err := validate.FormatOf("sitDepartureDate", "body", "date", m.SitDepartureDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitEntryDate(formats strfmt.Registry) error { + + if err := validate.Required("sitEntryDate", "body", m.SitEntryDate); err != nil { + return err + } + + if err := validate.FormatOf("sitEntryDate", "body", "date", m.SitEntryDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitHHGActualOrigin(formats strfmt.Registry) error { + + if swag.IsZero(m.SitHHGActualOrigin) { // not required + return nil + } + + if m.SitHHGActualOrigin != nil { + if err := m.SitHHGActualOrigin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGActualOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGActualOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitHHGOriginalOrigin(formats strfmt.Registry) error { + + if swag.IsZero(m.SitHHGOriginalOrigin) { // not required + return nil + } + + if m.SitHHGOriginalOrigin != nil { + if err := m.SitHHGOriginalOrigin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGOriginalOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGOriginalOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitPostalCode(formats strfmt.Registry) error { + + if err := validate.Required("sitPostalCode", "body", m.SitPostalCode); err != nil { + return err + } + + if err := validate.Pattern("sitPostalCode", "body", *m.SitPostalCode, `^(\d{5}([\-]\d{4})?)$`); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) validateSitRequestedDelivery(formats strfmt.Registry) error { + + if swag.IsZero(m.SitRequestedDelivery) { // not required + return nil + } + + if err := validate.FormatOf("sitRequestedDelivery", "body", "date", m.SitRequestedDelivery.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international origin s i t based on the context it is used +func (m *MTOServiceItemInternationalOriginSIT) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitHHGActualOrigin(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSitHHGOriginalOrigin(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateSitHHGActualOrigin(ctx context.Context, formats strfmt.Registry) error { + + if m.SitHHGActualOrigin != nil { + + if swag.IsZero(m.SitHHGActualOrigin) { // not required + return nil + } + + if err := m.SitHHGActualOrigin.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGActualOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGActualOrigin") + } + return err + } + } + + return nil +} + +func (m *MTOServiceItemInternationalOriginSIT) contextValidateSitHHGOriginalOrigin(ctx context.Context, formats strfmt.Registry) error { + + if m.SitHHGOriginalOrigin != nil { + + if swag.IsZero(m.SitHHGOriginalOrigin) { // not required + return nil + } + + if err := m.SitHHGOriginalOrigin.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sitHHGOriginalOrigin") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sitHHGOriginalOrigin") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalOriginSIT) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalOriginSIT) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalOriginSIT + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev3messages/m_t_o_service_item_model_type.go b/pkg/gen/primev3messages/m_t_o_service_item_model_type.go index 4dea531b524..7301906a417 100644 --- a/pkg/gen/primev3messages/m_t_o_service_item_model_type.go +++ b/pkg/gen/primev3messages/m_t_o_service_item_model_type.go @@ -19,6 +19,8 @@ import ( // Using this list, choose the correct modelType in the dropdown, corresponding to the service item type. // - DOFSIT, DOASIT - MTOServiceItemOriginSIT // - DDFSIT, DDASIT - MTOServiceItemDestSIT +// - IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT +// - IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT // - DOSHUT, DDSHUT - MTOServiceItemShuttle // - DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle // - IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -51,6 +53,12 @@ const ( // MTOServiceItemModelTypeMTOServiceItemDestSIT captures enum value "MTOServiceItemDestSIT" MTOServiceItemModelTypeMTOServiceItemDestSIT MTOServiceItemModelType = "MTOServiceItemDestSIT" + // MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT captures enum value "MTOServiceItemInternationalOriginSIT" + MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT MTOServiceItemModelType = "MTOServiceItemInternationalOriginSIT" + + // MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT captures enum value "MTOServiceItemInternationalDestSIT" + MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT MTOServiceItemModelType = "MTOServiceItemInternationalDestSIT" + // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" @@ -75,7 +83,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemInternationalOriginSIT","MTOServiceItemInternationalDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go b/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go index a1bc8152ec6..e1ad72b1e4e 100644 --- a/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go +++ b/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go @@ -19,6 +19,10 @@ import ( // - DOPSIT - UpdateMTOServiceItemSIT // - DOASIT - UpdateMTOServiceItemSIT // - DOFSIT - UpdateMTOServiceItemSIT +// - IDDSIT - UpdateMTOServiceItemSIT +// - IOPSIT - UpdateMTOServiceItemSIT +// - IOASIT - UpdateMTOServiceItemSIT +// - IOFSIT - UpdateMTOServiceItemSIT // - DDSHUT - UpdateMTOServiceItemShuttle // - DOSHUT - UpdateMTOServiceItemShuttle // - IDSHUT - UpdateMTOServiceItemInternationalShuttle diff --git a/pkg/gen/primev3messages/update_m_t_o_service_item_s_i_t.go b/pkg/gen/primev3messages/update_m_t_o_service_item_s_i_t.go index 7012106e91e..ea432a5d501 100644 --- a/pkg/gen/primev3messages/update_m_t_o_service_item_s_i_t.go +++ b/pkg/gen/primev3messages/update_m_t_o_service_item_s_i_t.go @@ -39,7 +39,7 @@ type UpdateMTOServiceItemSIT struct { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DOPSIT DOASIT DOFSIT] + // Enum: [DDDSIT DOPSIT DOASIT DOFSIT IDDSIT IOPSIT IOASIT IOFSIT] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -123,7 +123,7 @@ func (m *UpdateMTOServiceItemSIT) UnmarshalJSON(raw []byte) error { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DOPSIT DOASIT DOFSIT] + // Enum: [DDDSIT DOPSIT DOASIT DOFSIT IDDSIT IOPSIT IOASIT IOFSIT] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -242,7 +242,7 @@ func (m UpdateMTOServiceItemSIT) MarshalJSON() ([]byte, error) { FirstAvailableDeliveryDate2 *strfmt.Date `json:"firstAvailableDeliveryDate2,omitempty"` // Service code allowed for this model type. - // Enum: [DDDSIT DOPSIT DOASIT DOFSIT] + // Enum: [DDDSIT DOPSIT DOASIT DOFSIT IDDSIT IOPSIT IOASIT IOFSIT] ReServiceCode string `json:"reServiceCode,omitempty"` // Indicates if "Approvals Requested" status is being requested. @@ -471,7 +471,7 @@ var updateMTOServiceItemSITTypeReServiceCodePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["DDDSIT","DOPSIT","DOASIT","DOFSIT"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["DDDSIT","DOPSIT","DOASIT","DOFSIT","IDDSIT","IOPSIT","IOASIT","IOFSIT"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/handlers/primeapi/mto_service_item.go b/pkg/handlers/primeapi/mto_service_item.go index c78f37b6950..577afccaa08 100644 --- a/pkg/handlers/primeapi/mto_service_item.go +++ b/pkg/handlers/primeapi/mto_service_item.go @@ -25,13 +25,14 @@ import ( // THIS WILL NEED TO BE UPDATED AS WE CONTINUE TO ADD MORE SERVICE ITEMS. // We will eventually remove this when all service items are added. var CreateableServiceItemMap = map[primemessages.MTOServiceItemModelType]bool{ - primemessages.MTOServiceItemModelTypeMTOServiceItemOriginSIT: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemDestSIT: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemShuttle: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticShuttle: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemOriginSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemDestSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticShuttle: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, } // CreateMTOServiceItemHandler is the handler to create MTO service items diff --git a/pkg/handlers/primeapi/mto_service_item_test.go b/pkg/handlers/primeapi/mto_service_item_test.go index 8f58d9a096b..68fe0b8e23b 100644 --- a/pkg/handlers/primeapi/mto_service_item_test.go +++ b/pkg/handlers/primeapi/mto_service_item_test.go @@ -43,7 +43,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mtoServiceItem models.MTOServiceItem } - makeSubtestDataWithPPMShipmentType := func(isPPM bool) (subtestData *localSubtestData) { + makeSubtestDataWithPPMShipmentType := func(isPPM bool, isInternational bool) (subtestData *localSubtestData) { subtestData = &localSubtestData{} mtoShipmentID, _ := uuid.NewV4() @@ -62,15 +62,34 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { }, }, nil) } else { - subtestData.mtoShipment = factory.BuildMTOShipment(suite.DB(), []factory.Customization{ - { - Model: mto, - LinkOnly: true, - }, - }, nil) + if isInternational { + subtestData.mtoShipment = factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: mto, + LinkOnly: true, + }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, + }, nil) + } else { + subtestData.mtoShipment = factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: mto, + LinkOnly: true, + }, + }, nil) + } + } + + if isInternational { + factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeIOFSIT) + } else { + factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOFSIT) } - factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOFSIT) req := httptest.NewRequest("POST", "/mto-service-items", nil) sitEntryDate := time.Now() sitPostalCode := "00000" @@ -84,10 +103,16 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { // that we properly create the address coming in from the API. actualPickupAddress := factory.BuildAddress(nil, nil, []factory.Trait{factory.GetTraitAddress2}) + serviceCode := models.ReService{Code: models.ReServiceCodeDOFSIT} + + if isInternational { + serviceCode = models.ReService{Code: models.ReServiceCodeIOFSIT} + } + subtestData.mtoServiceItem = models.MTOServiceItem{ MoveTaskOrderID: mto.ID, MTOShipmentID: &subtestData.mtoShipment.ID, - ReService: models.ReService{Code: models.ReServiceCodeDOFSIT}, + ReService: serviceCode, Reason: models.StringPointer("lorem ipsum"), SITEntryDate: &sitEntryDate, SITPostalCode: &sitPostalCode, @@ -104,7 +129,11 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { } makeSubtestData := func() (subtestData *localSubtestData) { - return makeSubtestDataWithPPMShipmentType(false) + return makeSubtestDataWithPPMShipmentType(false, false) + } + + makeSubtestInternationalData := func() (subtestData *localSubtestData) { + return makeSubtestDataWithPPMShipmentType(false, true) } suite.Run("Successful POST - Integration Test", func() { @@ -143,6 +172,34 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { suite.NotZero(okResponse.Payload[0].ID()) }) + suite.Run("Successful POST International - Integration Test", func() { + subtestData := makeSubtestInternationalData() + moveRouter := moverouter.NewMoveRouter() + planner := &routemocks.Planner{} + planner.On("ZipTransitDistance", + mock.AnythingOfType("*appcontext.appContext"), + mock.Anything, + mock.Anything, + false, + false, + ).Return(400, nil) + creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) + handler := CreateMTOServiceItemHandler{ + suite.HandlerConfig(), + creator, + mtoChecker, + } + + // Validate incoming payload + suite.NoError(subtestData.params.Body.Validate(strfmt.Default)) + + response := handler.Handle(subtestData.params) + suite.IsType(&mtoserviceitemops.CreateMTOServiceItemOK{}, response) + okResponse := response.(*mtoserviceitemops.CreateMTOServiceItemOK) + + suite.NotZero(okResponse.Payload[0].ID()) + }) + suite.Run("Successful POST for Creating Shuttling without PrimeEstimatedWeight set - Integration Test", func() { mto := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ @@ -200,7 +257,13 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { Model: mto, LinkOnly: true, }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, }, nil) + mtoShipment.PrimeEstimatedWeight = nil req := httptest.NewRequest("POST", "/mto-service-items", nil) reason := "lorem ipsum" @@ -502,7 +565,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { }) suite.Run("POST failure - Shipment fetch not found", func() { - subtestData := makeSubtestDataWithPPMShipmentType(true) + subtestData := makeSubtestDataWithPPMShipmentType(true, false) moveRouter := moverouter.NewMoveRouter() planner := &routemocks.Planner{} planner.On("ZipTransitDistance", @@ -534,7 +597,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { }) suite.Run("POST failure - 422 - PPM not allowed to create service item", func() { - subtestData := makeSubtestDataWithPPMShipmentType(true) + subtestData := makeSubtestDataWithPPMShipmentType(true, false) moveRouter := moverouter.NewMoveRouter() planner := &routemocks.Planner{} planner.On("ZipTransitDistance", diff --git a/pkg/handlers/primeapi/payloads/model_to_payload.go b/pkg/handlers/primeapi/payloads/model_to_payload.go index abe1b64a920..5f5106e6569 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload.go @@ -706,6 +706,23 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primemessages.MTOServ SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), } + case models.ReServiceCodeIOFSIT, models.ReServiceCodeIOASIT, models.ReServiceCodeIOPSIT, models.ReServiceCodeIOSFSC: + var sitDepartureDate time.Time + if mtoServiceItem.SITDepartureDate != nil { + sitDepartureDate = *mtoServiceItem.SITDepartureDate + } + payload = &primemessages.MTOServiceItemInternationalOriginSIT{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + SitDepartureDate: handlers.FmtDate(sitDepartureDate), + SitEntryDate: handlers.FmtDatePtr(mtoServiceItem.SITEntryDate), + SitPostalCode: mtoServiceItem.SITPostalCode, + SitHHGActualOrigin: Address(mtoServiceItem.SITOriginHHGActualAddress), + SitHHGOriginalOrigin: Address(mtoServiceItem.SITOriginHHGOriginalAddress), + RequestApprovalsRequestedStatus: *mtoServiceItem.RequestedApprovalsRequestedStatus, + SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), + SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), + } case models.ReServiceCodeDDFSIT, models.ReServiceCodeDDASIT, models.ReServiceCodeDDDSIT, models.ReServiceCodeDDSFSC: var sitDepartureDate, firstAvailableDeliveryDate1, firstAvailableDeliveryDate2, dateOfContact1, dateOfContact2 time.Time var timeMilitary1, timeMilitary2 *string @@ -750,6 +767,50 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primemessages.MTOServ SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), } + case models.ReServiceCodeIDFSIT, models.ReServiceCodeIDASIT, models.ReServiceCodeIDDSIT, models.ReServiceCodeIDSFSC: + var sitDepartureDate, firstAvailableDeliveryDate1, firstAvailableDeliveryDate2, dateOfContact1, dateOfContact2 time.Time + var timeMilitary1, timeMilitary2 *string + + if mtoServiceItem.SITDepartureDate != nil { + sitDepartureDate = *mtoServiceItem.SITDepartureDate + } + + firstContact := GetCustomerContact(mtoServiceItem.CustomerContacts, models.CustomerContactTypeFirst) + secondContact := GetCustomerContact(mtoServiceItem.CustomerContacts, models.CustomerContactTypeSecond) + timeMilitary1 = &firstContact.TimeMilitary + timeMilitary2 = &secondContact.TimeMilitary + + if !firstContact.DateOfContact.IsZero() { + dateOfContact1 = firstContact.DateOfContact + } + + if !secondContact.DateOfContact.IsZero() { + dateOfContact2 = secondContact.DateOfContact + } + + if !firstContact.FirstAvailableDeliveryDate.IsZero() { + firstAvailableDeliveryDate1 = firstContact.FirstAvailableDeliveryDate + } + + if !secondContact.FirstAvailableDeliveryDate.IsZero() { + firstAvailableDeliveryDate2 = secondContact.FirstAvailableDeliveryDate + } + + payload = &primemessages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + DateOfContact1: handlers.FmtDate(dateOfContact1), + TimeMilitary1: handlers.FmtStringPtrNonEmpty(timeMilitary1), + FirstAvailableDeliveryDate1: handlers.FmtDate(firstAvailableDeliveryDate1), + DateOfContact2: handlers.FmtDate(dateOfContact2), + TimeMilitary2: handlers.FmtStringPtrNonEmpty(timeMilitary2), + FirstAvailableDeliveryDate2: handlers.FmtDate(firstAvailableDeliveryDate2), + SitDepartureDate: handlers.FmtDate(sitDepartureDate), + SitEntryDate: handlers.FmtDatePtr(mtoServiceItem.SITEntryDate), + SitDestinationFinalAddress: Address(mtoServiceItem.SITDestinationFinalAddress), + SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), + SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), + } case models.ReServiceCodeDCRT, models.ReServiceCodeDUCRT: item := GetDimension(mtoServiceItem.Dimensions, models.DimensionTypeItem) diff --git a/pkg/handlers/primeapi/payloads/model_to_payload_test.go b/pkg/handlers/primeapi/payloads/model_to_payload_test.go index e94d78b063a..3ec3fda6327 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload_test.go @@ -740,6 +740,136 @@ func (suite *PayloadsSuite) TestAddress() { suite.Equal(strfmt.UUID(""), result.UsPostRegionCitiesID) } +func (suite *PayloadsSuite) TestMTOServiceItemDestSIT() { + reServiceCode := models.ReServiceCodeDDFSIT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + sitDepartureDate := time.Now().AddDate(0, 1, 0) + sitEntryDate := time.Now().AddDate(0, 0, -30) + finalAddress := models.Address{ + StreetAddress1: "dummyStreet", + City: "dummyCity", + State: "FL", + PostalCode: "55555", + } + mtoShipmentID := uuid.Must(uuid.NewV4()) + + mtoServiceItemDestSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + SITDepartureDate: &sitDepartureDate, + SITEntryDate: &sitEntryDate, + SITDestinationFinalAddress: &finalAddress, + MTOShipmentID: &mtoShipmentID, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultDestSIT := MTOServiceItem(mtoServiceItemDestSIT) + suite.NotNil(resultDestSIT) + destSIT, ok := resultDestSIT.(*primemessages.MTOServiceItemDestSIT) + suite.True(ok) + + suite.Equal(string(reServiceCode), string(*destSIT.ReServiceCode)) + suite.Equal(reason, *destSIT.Reason) + suite.Equal(strfmt.Date(sitDepartureDate).String(), destSIT.SitDepartureDate.String()) + suite.Equal(strfmt.Date(sitEntryDate).String(), destSIT.SitEntryDate.String()) + suite.Equal(strfmt.Date(dateOfContact1).String(), destSIT.DateOfContact1.String()) + suite.Equal(timeMilitary1, *destSIT.TimeMilitary1) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate1).String(), destSIT.FirstAvailableDeliveryDate1.String()) + suite.Equal(strfmt.Date(dateOfContact2).String(), destSIT.DateOfContact2.String()) + suite.Equal(timeMilitary2, *destSIT.TimeMilitary2) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate2).String(), destSIT.FirstAvailableDeliveryDate2.String()) + suite.Equal(finalAddress.StreetAddress1, *destSIT.SitDestinationFinalAddress.StreetAddress1) + suite.Equal(finalAddress.City, *destSIT.SitDestinationFinalAddress.City) + suite.Equal(finalAddress.State, *destSIT.SitDestinationFinalAddress.State) + suite.Equal(finalAddress.PostalCode, *destSIT.SitDestinationFinalAddress.PostalCode) + suite.Equal(mtoShipmentID.String(), destSIT.MtoShipmentID().String()) +} + +func (suite *PayloadsSuite) TestMTOServiceItemInternationalDestSIT() { + reServiceCode := models.ReServiceCodeIDFSIT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + sitDepartureDate := time.Now().AddDate(0, 1, 0) + sitEntryDate := time.Now().AddDate(0, 0, -30) + finalAddress := models.Address{ + StreetAddress1: "dummyStreet", + City: "dummyCity", + State: "FL", + PostalCode: "55555", + } + mtoShipmentID := uuid.Must(uuid.NewV4()) + + mtoServiceItemDestSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + SITDepartureDate: &sitDepartureDate, + SITEntryDate: &sitEntryDate, + SITDestinationFinalAddress: &finalAddress, + MTOShipmentID: &mtoShipmentID, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultDestSIT := MTOServiceItem(mtoServiceItemDestSIT) + suite.NotNil(resultDestSIT) + destSIT, ok := resultDestSIT.(*primemessages.MTOServiceItemInternationalDestSIT) + suite.True(ok) + + suite.Equal(string(reServiceCode), string(*destSIT.ReServiceCode)) + suite.Equal(reason, *destSIT.Reason) + suite.Equal(strfmt.Date(sitDepartureDate).String(), destSIT.SitDepartureDate.String()) + suite.Equal(strfmt.Date(sitEntryDate).String(), destSIT.SitEntryDate.String()) + suite.Equal(strfmt.Date(dateOfContact1).String(), destSIT.DateOfContact1.String()) + suite.Equal(timeMilitary1, *destSIT.TimeMilitary1) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate1).String(), destSIT.FirstAvailableDeliveryDate1.String()) + suite.Equal(strfmt.Date(dateOfContact2).String(), destSIT.DateOfContact2.String()) + suite.Equal(timeMilitary2, *destSIT.TimeMilitary2) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate2).String(), destSIT.FirstAvailableDeliveryDate2.String()) + suite.Equal(finalAddress.StreetAddress1, *destSIT.SitDestinationFinalAddress.StreetAddress1) + suite.Equal(finalAddress.City, *destSIT.SitDestinationFinalAddress.City) + suite.Equal(finalAddress.State, *destSIT.SitDestinationFinalAddress.State) + suite.Equal(finalAddress.PostalCode, *destSIT.SitDestinationFinalAddress.PostalCode) + suite.Equal(mtoShipmentID.String(), destSIT.MtoShipmentID().String()) +} + func (suite *PayloadsSuite) TestMTOServiceItemDCRTandDOFSITandDDFSIT() { reServiceCode := models.ReServiceCodeDCRT reServiceCodeSIT := models.ReServiceCodeDOFSIT @@ -854,6 +984,120 @@ func (suite *PayloadsSuite) TestMTOServiceItemDCRTandDOFSITandDDFSIT() { suite.True(ok) } +func (suite *PayloadsSuite) TestMTOServiceItemICRTandIOFSITandIDFSIT() { + reServiceCode := models.ReServiceCodeICRT + reServiceCodeSIT := models.ReServiceCodeIOFSIT + reServiceCodeIDFSIT := models.ReServiceCodeIDFSIT + + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + + mtoServiceItemICRT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + year, month, day := time.Now().Date() + aWeekAgo := time.Date(year, month, day-7, 0, 0, 0, 0, time.UTC) + departureDate := aWeekAgo.Add(time.Hour * 24 * 30) + actualPickupAddress := factory.BuildAddress(nil, nil, []factory.Trait{factory.GetTraitAddress2}) + requestApprovalRequestedStatus := false + mtoServiceItemIOFSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCodeSIT}, + Reason: &reason, + SITDepartureDate: &departureDate, + SITEntryDate: &aWeekAgo, + SITPostalCode: models.StringPointer("90210"), + SITOriginHHGActualAddress: &actualPickupAddress, + SITCustomerContacted: &aWeekAgo, + SITRequestedDelivery: &aWeekAgo, + SITOriginHHGOriginalAddress: &models.Address{ + StreetAddress1: "dummyStreet2", + City: "dummyCity2", + State: "FL", + PostalCode: "55555", + }, + RequestedApprovalsRequestedStatus: &requestApprovalRequestedStatus, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + mtoServiceItemIDFSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCodeIDFSIT}, + Reason: &reason, + SITDepartureDate: &departureDate, + SITEntryDate: &aWeekAgo, + SITPostalCode: models.StringPointer("90210"), + SITOriginHHGActualAddress: &actualPickupAddress, + SITCustomerContacted: &aWeekAgo, + SITRequestedDelivery: &aWeekAgo, + SITOriginHHGOriginalAddress: &models.Address{ + StreetAddress1: "dummyStreet2", + City: "dummyCity2", + State: "FL", + PostalCode: "55555", + }, + RequestedApprovalsRequestedStatus: &requestApprovalRequestedStatus, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultICRT := MTOServiceItem(mtoServiceItemICRT) + resultIOFSIT := MTOServiceItem(mtoServiceItemIOFSIT) + resultIDFSIT := MTOServiceItem(mtoServiceItemIDFSIT) + + suite.NotNil(resultICRT) + suite.NotNil(resultIOFSIT) + suite.NotNil(resultIDFSIT) + _, ok := resultICRT.(*primemessages.MTOServiceItemInternationalCrating) + + suite.True(ok) +} + func (suite *PayloadsSuite) TestMTOServiceItemICRTandIUCRT() { icrtReServiceCode := models.ReServiceCodeICRT iucrtReServiceCode := models.ReServiceCodeIUCRT diff --git a/pkg/handlers/primeapi/payloads/payload_to_model.go b/pkg/handlers/primeapi/payloads/payload_to_model.go index 5f2bfa9bada..c01b4913c18 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model.go @@ -470,6 +470,49 @@ func MTOServiceItemModel(mtoServiceItem primemessages.MTOServiceItem) (*models.M model.SITOriginHHGActualAddressID = &model.SITOriginHHGActualAddress.ID } + case primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT: + + originsit := mtoServiceItem.(*primemessages.MTOServiceItemInternationalOriginSIT) + + if originsit.ReServiceCode != nil { + model.ReService.Code = models.ReServiceCode(*originsit.ReServiceCode) + } + + model.Reason = originsit.Reason + // Check for reason required field on a IOASIT + if model.ReService.Code == models.ReServiceCodeIOASIT { + reasonVerrs := validateReasonInternationalOriginSIT(*originsit) + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + if model.ReService.Code == models.ReServiceCodeIOFSIT { + reasonVerrs := validateReasonInternationalOriginSIT(*originsit) + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + sitEntryDate := handlers.FmtDatePtrToPopPtr(originsit.SitEntryDate) + + if sitEntryDate != nil { + model.SITEntryDate = sitEntryDate + } + + if originsit.SitDepartureDate != nil { + model.SITDepartureDate = handlers.FmtDatePtrToPopPtr(originsit.SitDepartureDate) + } + + model.SITPostalCode = originsit.SitPostalCode + + model.SITOriginHHGActualAddress = AddressModel(originsit.SitHHGActualOrigin) + if model.SITOriginHHGActualAddress != nil { + model.SITOriginHHGActualAddressID = &model.SITOriginHHGActualAddress.ID + } + case primemessages.MTOServiceItemModelTypeMTOServiceItemDestSIT: destsit := mtoServiceItem.(*primemessages.MTOServiceItemDestSIT) @@ -529,6 +572,65 @@ func MTOServiceItemModel(mtoServiceItem primemessages.MTOServiceItem) (*models.M model.SITDestinationFinalAddressID = &model.SITDestinationFinalAddress.ID } + case primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT: + destsit := mtoServiceItem.(*primemessages.MTOServiceItemInternationalDestSIT) + + if destsit.ReServiceCode != nil { + model.ReService.Code = models.ReServiceCode(*destsit.ReServiceCode) + + } + + model.Reason = destsit.Reason + sitEntryDate := handlers.FmtDatePtrToPopPtr(destsit.SitEntryDate) + + // Check for required fields on a IDFSIT + if model.ReService.Code == models.ReServiceCodeIDFSIT { + verrs := validateIDFSITForCreate(*destsit) + reasonVerrs := validateReasonInternationalDestSIT(*destsit) + + if verrs.HasAny() { + return nil, verrs + } + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + var customerContacts models.MTOServiceItemCustomerContacts + + if destsit.TimeMilitary1 != nil && destsit.FirstAvailableDeliveryDate1 != nil && destsit.DateOfContact1 != nil { + customerContacts = append(customerContacts, models.MTOServiceItemCustomerContact{ + Type: models.CustomerContactTypeFirst, + DateOfContact: time.Time(*destsit.DateOfContact1), + TimeMilitary: *destsit.TimeMilitary1, + FirstAvailableDeliveryDate: time.Time(*destsit.FirstAvailableDeliveryDate1), + }) + } + if destsit.TimeMilitary2 != nil && destsit.FirstAvailableDeliveryDate2 != nil && destsit.DateOfContact2 != nil { + customerContacts = append(customerContacts, models.MTOServiceItemCustomerContact{ + Type: models.CustomerContactTypeSecond, + DateOfContact: time.Time(*destsit.DateOfContact2), + TimeMilitary: *destsit.TimeMilitary2, + FirstAvailableDeliveryDate: time.Time(*destsit.FirstAvailableDeliveryDate2), + }) + } + + model.CustomerContacts = customerContacts + + if sitEntryDate != nil { + model.SITEntryDate = sitEntryDate + } + + if destsit.SitDepartureDate != nil { + model.SITDepartureDate = handlers.FmtDatePtrToPopPtr(destsit.SitDepartureDate) + } + + model.SITDestinationFinalAddress = AddressModel(destsit.SitDestinationFinalAddress) + if model.SITDestinationFinalAddress != nil { + model.SITDestinationFinalAddressID = &model.SITDestinationFinalAddress.ID + } + case primemessages.MTOServiceItemModelTypeMTOServiceItemShuttle: shuttleService := mtoServiceItem.(*primemessages.MTOServiceItemShuttle) // values to get from payload @@ -860,6 +962,31 @@ func validateDDFSITForCreate(m primemessages.MTOServiceItemDestSIT) *validate.Er return verrs } +// validateIDFSITForCreate validates IDFSIT service item has all required fields +func validateIDFSITForCreate(m primemessages.MTOServiceItemInternationalDestSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.FirstAvailableDeliveryDate1 == nil && m.DateOfContact1 != nil && m.TimeMilitary1 != nil { + verrs.Add("firstAvailableDeliveryDate1", "firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 must be provided together in body.") + } + if m.DateOfContact1 == nil && m.TimeMilitary1 != nil && m.FirstAvailableDeliveryDate1 != nil { + verrs.Add("DateOfContact1", "dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 must be provided together in body.") + } + if m.TimeMilitary1 == nil && m.DateOfContact1 != nil && m.FirstAvailableDeliveryDate1 != nil { + verrs.Add("timeMilitary1", "timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 must be provided together in body.") + } + if m.FirstAvailableDeliveryDate2 == nil && m.DateOfContact2 != nil && m.TimeMilitary2 != nil { + verrs.Add("firstAvailableDeliveryDate2", "firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 must be provided together in body.") + } + if m.DateOfContact2 == nil && m.TimeMilitary2 != nil && m.FirstAvailableDeliveryDate2 != nil { + verrs.Add("DateOfContact2", "dateOfContact2, firstAvailableDeliveryDate2, and timeMilitary2 must be provided together in body.") + } + if m.TimeMilitary2 == nil && m.DateOfContact2 != nil && m.FirstAvailableDeliveryDate2 != nil { + verrs.Add("timeMilitary2", "timeMilitary2, firstAvailableDeliveryDate2, and dateOfContact2 must be provided together in body.") + } + return verrs +} + // validateDestSITForUpdate validates DDDSIT service item has all required fields func validateDestSITForUpdate(m primemessages.UpdateMTOServiceItemSIT) *validate.Errors { verrs := validate.NewErrors() @@ -895,6 +1022,16 @@ func validateReasonDestSIT(m primemessages.MTOServiceItemDestSIT) *validate.Erro return verrs } +// validateReasonInternationalDestSIT validates that International Destination SIT service items have required Reason field +func validateReasonInternationalDestSIT(m primemessages.MTOServiceItemInternationalDestSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.Reason == nil || m.Reason == models.StringPointer("") { + verrs.Add("reason", "reason is required in body.") + } + return verrs +} + // validateReasonOriginSIT validates that Origin SIT service items have required Reason field func validateReasonOriginSIT(m primemessages.MTOServiceItemOriginSIT) *validate.Errors { verrs := validate.NewErrors() @@ -920,3 +1057,13 @@ func VLocationModel(vLocation *primemessages.VLocation) *models.VLocation { UsPostRegionCitiesID: &usPostRegionCitiesID, } } + +// validateReasonInternationalOriginSIT validates that International Origin SIT service items have required Reason field +func validateReasonInternationalOriginSIT(m primemessages.MTOServiceItemInternationalOriginSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.Reason == nil || m.Reason == models.StringPointer("") { + verrs.Add("reason", "reason is required in body.") + } + return verrs +} diff --git a/pkg/handlers/primeapi/payloads/payload_to_model_test.go b/pkg/handlers/primeapi/payloads/payload_to_model_test.go index 2f18cec241d..667bad2439f 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model_test.go @@ -397,6 +397,31 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(originSITDepartureDate, *handlers.FmtDatePtr(returnedModel.SITDepartureDate)) }) + suite.Run("Success - Returns international SIT origin service item model", func() { + originSITServiceItem := &primemessages.MTOServiceItemInternationalOriginSIT{ + ReServiceCode: &originServiceCode, + SitEntryDate: &originSITEntryDate, + SitDepartureDate: &originSITDepartureDate, + SitHHGActualOrigin: &sitHHGActualOriginAddress, + Reason: &originReason, + } + + originSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + originSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(originSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDOFSIT, returnedModel.ReService.Code) + suite.Equal(originStreet1, returnedModel.SITOriginHHGActualAddress.StreetAddress1) + suite.Equal(originCity, returnedModel.SITOriginHHGActualAddress.City) + suite.Equal(originState, returnedModel.SITOriginHHGActualAddress.State) + suite.Equal(originPostalCode, returnedModel.SITOriginHHGActualAddress.PostalCode) + suite.Equal(originSITEntryDate, *handlers.FmtDatePtr(returnedModel.SITEntryDate)) + suite.Equal(originSITDepartureDate, *handlers.FmtDatePtr(returnedModel.SITDepartureDate)) + }) + suite.Run("Success - Returns SIT destination service item model", func() { destSITServiceItem := &primemessages.MTOServiceItemDestSIT{ ReServiceCode: &destServiceCode, @@ -423,6 +448,32 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) }) + suite.Run("Success - Returns international SIT destination service item model", func() { + destSITServiceItem := &primemessages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: &destServiceCode, + FirstAvailableDeliveryDate1: &destDate, + FirstAvailableDeliveryDate2: &destDate, + DateOfContact1: &destDate, + DateOfContact2: &destDate, + TimeMilitary1: &destTime, + TimeMilitary2: &destTime, + SitDestinationFinalAddress: &sitFinalDestAddress, + Reason: &destReason, + } + + destSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + destSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(destSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDFSIT, returnedModel.ReService.Code) + suite.Equal(destPostalCode, returnedModel.SITDestinationFinalAddress.PostalCode) + suite.Equal(destStreet, returnedModel.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) + }) + suite.Run("Success - Returns SIT destination service item model without customer contact fields", func() { destSITServiceItem := &primemessages.MTOServiceItemDestSIT{ ReServiceCode: &destServiceCode, @@ -443,6 +494,27 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) suite.Equal(destReason, *returnedModel.Reason) }) + + suite.Run("Success - Returns internatonal SIT destination service item model without customer contact fields", func() { + destSITServiceItem := &primemessages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: &destServiceCode, + SitDestinationFinalAddress: &sitFinalDestAddress, + Reason: &destReason, + } + + destSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + destSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(destSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDFSIT, returnedModel.ReService.Code) + suite.Equal(destPostalCode, returnedModel.SITDestinationFinalAddress.PostalCode) + suite.Equal(destStreet, returnedModel.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) + suite.Equal(destReason, *returnedModel.Reason) + }) } func (suite *PayloadsSuite) TestReweighModelFromUpdate() { diff --git a/pkg/handlers/primeapiv2/mto_service_item_test.go b/pkg/handlers/primeapiv2/mto_service_item_test.go index a48c9bfe87d..376353adfa4 100644 --- a/pkg/handlers/primeapiv2/mto_service_item_test.go +++ b/pkg/handlers/primeapiv2/mto_service_item_test.go @@ -194,6 +194,11 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { Model: mto, LinkOnly: true, }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, }, nil) mtoShipment.PrimeEstimatedWeight = nil factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOSHUT) diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload.go b/pkg/handlers/primeapiv2/payloads/model_to_payload.go index 09f107a9e04..7b39c88c803 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload.go @@ -617,6 +617,20 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primev2messages.MTOSe SitHHGActualOrigin: Address(mtoServiceItem.SITOriginHHGActualAddress), SitHHGOriginalOrigin: Address(mtoServiceItem.SITOriginHHGOriginalAddress), } + case models.ReServiceCodeIOFSIT, models.ReServiceCodeIOASIT, models.ReServiceCodeIOPSIT, models.ReServiceCodeIOSFSC: + var sitDepartureDate time.Time + if mtoServiceItem.SITDepartureDate != nil { + sitDepartureDate = *mtoServiceItem.SITDepartureDate + } + payload = &primev2messages.MTOServiceItemInternationalOriginSIT{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + SitDepartureDate: handlers.FmtDate(sitDepartureDate), + SitEntryDate: handlers.FmtDatePtr(mtoServiceItem.SITEntryDate), + SitPostalCode: mtoServiceItem.SITPostalCode, + SitHHGActualOrigin: Address(mtoServiceItem.SITOriginHHGActualAddress), + SitHHGOriginalOrigin: Address(mtoServiceItem.SITOriginHHGOriginalAddress), + } case models.ReServiceCodeDDFSIT, models.ReServiceCodeDDASIT, models.ReServiceCodeDDDSIT, models.ReServiceCodeDDSFSC: var sitDepartureDate, firstAvailableDeliveryDate1, firstAvailableDeliveryDate2, dateOfContact1, dateOfContact2 time.Time var timeMilitary1, timeMilitary2 *string @@ -661,6 +675,50 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primev2messages.MTOSe SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), } + case models.ReServiceCodeIDFSIT, models.ReServiceCodeIDASIT, models.ReServiceCodeIDDSIT, models.ReServiceCodeIDSFSC: + var sitDepartureDate, firstAvailableDeliveryDate1, firstAvailableDeliveryDate2, dateOfContact1, dateOfContact2 time.Time + var timeMilitary1, timeMilitary2 *string + + if mtoServiceItem.SITDepartureDate != nil { + sitDepartureDate = *mtoServiceItem.SITDepartureDate + } + + firstContact := GetCustomerContact(mtoServiceItem.CustomerContacts, models.CustomerContactTypeFirst) + secondContact := GetCustomerContact(mtoServiceItem.CustomerContacts, models.CustomerContactTypeSecond) + timeMilitary1 = &firstContact.TimeMilitary + timeMilitary2 = &secondContact.TimeMilitary + + if !firstContact.DateOfContact.IsZero() { + dateOfContact1 = firstContact.DateOfContact + } + + if !secondContact.DateOfContact.IsZero() { + dateOfContact2 = secondContact.DateOfContact + } + + if !firstContact.FirstAvailableDeliveryDate.IsZero() { + firstAvailableDeliveryDate1 = firstContact.FirstAvailableDeliveryDate + } + + if !secondContact.FirstAvailableDeliveryDate.IsZero() { + firstAvailableDeliveryDate2 = secondContact.FirstAvailableDeliveryDate + } + + payload = &primev2messages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + DateOfContact1: handlers.FmtDate(dateOfContact1), + TimeMilitary1: handlers.FmtStringPtrNonEmpty(timeMilitary1), + FirstAvailableDeliveryDate1: handlers.FmtDate(firstAvailableDeliveryDate1), + DateOfContact2: handlers.FmtDate(dateOfContact2), + TimeMilitary2: handlers.FmtStringPtrNonEmpty(timeMilitary2), + FirstAvailableDeliveryDate2: handlers.FmtDate(firstAvailableDeliveryDate2), + SitDepartureDate: handlers.FmtDate(sitDepartureDate), + SitEntryDate: handlers.FmtDatePtr(mtoServiceItem.SITEntryDate), + SitDestinationFinalAddress: Address(mtoServiceItem.SITDestinationFinalAddress), + SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), + SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), + } case models.ReServiceCodeDCRT, models.ReServiceCodeDUCRT: item := GetDimension(mtoServiceItem.Dimensions, models.DimensionTypeItem) diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go b/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go index 2119ecd1a8e..ec53f8a3457 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go @@ -640,6 +640,50 @@ func (suite *PayloadsSuite) TestMTOServiceItem() { suite.Equal(mtoServiceItemDefault.MoveTaskOrderID.String(), basicItem.MoveTaskOrderID().String()) } +func (suite *PayloadsSuite) TestMTOServiceInternationalItem() { + sitPostalCode := "55555" + mtoServiceItemIOFSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: models.ReServiceCodeIOFSIT}, + SITDepartureDate: nil, + SITEntryDate: nil, + SITPostalCode: &sitPostalCode, + SITOriginHHGActualAddress: &models.Address{ + StreetAddress1: "dummyStreet", + City: "dummyCity", + State: "FL", + PostalCode: "55555", + }, + SITOriginHHGOriginalAddress: &models.Address{ + StreetAddress1: "dummyStreet2", + City: "dummyCity2", + State: "FL", + PostalCode: "55555", + }, + } + + resultIOFSIT := MTOServiceItem(mtoServiceItemIOFSIT) + suite.NotNil(resultIOFSIT) + sitOrigin, ok := resultIOFSIT.(*primev2messages.MTOServiceItemInternationalOriginSIT) + suite.True(ok) + suite.Equal("55555", *sitOrigin.SitPostalCode) + suite.Equal("dummyStreet", *sitOrigin.SitHHGActualOrigin.StreetAddress1) + suite.Equal("dummyStreet2", *sitOrigin.SitHHGOriginalOrigin.StreetAddress1) + + mtoServiceItemDefault := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: "SOME_OTHER_SERVICE_CODE"}, + MoveTaskOrderID: uuid.Must(uuid.NewV4()), + } + + resultDefault := MTOServiceItem(mtoServiceItemDefault) + suite.NotNil(resultDefault) + basicItem, ok := resultDefault.(*primev2messages.MTOServiceItemBasic) + suite.True(ok) + suite.Equal("SOME_OTHER_SERVICE_CODE", string(*basicItem.ReServiceCode)) + suite.Equal(mtoServiceItemDefault.MoveTaskOrderID.String(), basicItem.MoveTaskOrderID().String()) +} + func (suite *PayloadsSuite) TestGetCustomerContact() { customerContacts := models.MTOServiceItemCustomerContacts{ models.MTOServiceItemCustomerContact{Type: models.CustomerContactTypeFirst}, @@ -725,6 +769,72 @@ func (suite *PayloadsSuite) TestMTOServiceItemDestSIT() { suite.Equal(finalAddress.PostalCode, *destSIT.SitDestinationFinalAddress.PostalCode) suite.Equal(mtoShipmentID.String(), destSIT.MtoShipmentID().String()) } + +func (suite *PayloadsSuite) TestMTOServiceItemInternationalDestSIT() { + reServiceCode := models.ReServiceCodeIDFSIT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + sitDepartureDate := time.Now().AddDate(0, 1, 0) + sitEntryDate := time.Now().AddDate(0, 0, -30) + finalAddress := models.Address{ + StreetAddress1: "dummyStreet", + City: "dummyCity", + State: "FL", + PostalCode: "55555", + } + mtoShipmentID := uuid.Must(uuid.NewV4()) + + mtoServiceItemDestSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + SITDepartureDate: &sitDepartureDate, + SITEntryDate: &sitEntryDate, + SITDestinationFinalAddress: &finalAddress, + MTOShipmentID: &mtoShipmentID, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultDestSIT := MTOServiceItem(mtoServiceItemDestSIT) + suite.NotNil(resultDestSIT) + destSIT, ok := resultDestSIT.(*primev2messages.MTOServiceItemInternationalDestSIT) + suite.True(ok) + + suite.Equal(string(reServiceCode), string(*destSIT.ReServiceCode)) + suite.Equal(reason, *destSIT.Reason) + suite.Equal(strfmt.Date(sitDepartureDate).String(), destSIT.SitDepartureDate.String()) + suite.Equal(strfmt.Date(sitEntryDate).String(), destSIT.SitEntryDate.String()) + suite.Equal(strfmt.Date(dateOfContact1).String(), destSIT.DateOfContact1.String()) + suite.Equal(timeMilitary1, *destSIT.TimeMilitary1) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate1).String(), destSIT.FirstAvailableDeliveryDate1.String()) + suite.Equal(strfmt.Date(dateOfContact2).String(), destSIT.DateOfContact2.String()) + suite.Equal(timeMilitary2, *destSIT.TimeMilitary2) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate2).String(), destSIT.FirstAvailableDeliveryDate2.String()) + suite.Equal(finalAddress.StreetAddress1, *destSIT.SitDestinationFinalAddress.StreetAddress1) + suite.Equal(finalAddress.City, *destSIT.SitDestinationFinalAddress.City) + suite.Equal(finalAddress.State, *destSIT.SitDestinationFinalAddress.State) + suite.Equal(finalAddress.PostalCode, *destSIT.SitDestinationFinalAddress.PostalCode) + suite.Equal(mtoShipmentID.String(), destSIT.MtoShipmentID().String()) +} + func (suite *PayloadsSuite) TestMTOServiceItemDCRT() { reServiceCode := models.ReServiceCodeDCRT reason := "reason" diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model.go b/pkg/handlers/primeapiv2/payloads/payload_to_model.go index 2b2f5e420c8..33c1d26c453 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model.go @@ -562,7 +562,44 @@ func MTOServiceItemModel(mtoServiceItem primev2messages.MTOServiceItem) (*models if model.SITOriginHHGActualAddress != nil { model.SITOriginHHGActualAddressID = &model.SITOriginHHGActualAddress.ID } + case primev2messages.MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT: + originsit := mtoServiceItem.(*primev2messages.MTOServiceItemInternationalOriginSIT) + + if originsit.ReServiceCode != nil { + model.ReService.Code = models.ReServiceCode(*originsit.ReServiceCode) + } + + model.Reason = originsit.Reason + // Check for reason required field on a IOASIT + if model.ReService.Code == models.ReServiceCodeIOASIT { + reasonVerrs := validateReasonInternationalOriginSIT(*originsit) + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + if model.ReService.Code == models.ReServiceCodeIOFSIT { + reasonVerrs := validateReasonInternationalOriginSIT(*originsit) + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + sitEntryDate := handlers.FmtDatePtrToPopPtr(originsit.SitEntryDate) + + if sitEntryDate != nil { + model.SITEntryDate = sitEntryDate + } + + model.SITPostalCode = originsit.SitPostalCode + + model.SITOriginHHGActualAddress = AddressModel(originsit.SitHHGActualOrigin) + if model.SITOriginHHGActualAddress != nil { + model.SITOriginHHGActualAddressID = &model.SITOriginHHGActualAddress.ID + } case primev2messages.MTOServiceItemModelTypeMTOServiceItemDestSIT: destsit := mtoServiceItem.(*primev2messages.MTOServiceItemDestSIT) @@ -617,6 +654,64 @@ func MTOServiceItemModel(mtoServiceItem primev2messages.MTOServiceItem) (*models model.SITDepartureDate = handlers.FmtDatePtrToPopPtr(destsit.SitDepartureDate) } + model.SITDestinationFinalAddress = AddressModel(destsit.SitDestinationFinalAddress) + if model.SITDestinationFinalAddress != nil { + model.SITDestinationFinalAddressID = &model.SITDestinationFinalAddress.ID + } + case primev2messages.MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT: + destsit := mtoServiceItem.(*primev2messages.MTOServiceItemInternationalDestSIT) + + if destsit.ReServiceCode != nil { + model.ReService.Code = models.ReServiceCode(*destsit.ReServiceCode) + + } + + model.Reason = destsit.Reason + sitEntryDate := handlers.FmtDatePtrToPopPtr(destsit.SitEntryDate) + + // Check for required fields on a IDFSIT + if model.ReService.Code == models.ReServiceCodeIDFSIT { + verrs := validateIDFSITForCreate(*destsit) + reasonVerrs := validateReasonInternationalDestSIT(*destsit) + + if verrs.HasAny() { + return nil, verrs + } + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + var customerContacts models.MTOServiceItemCustomerContacts + + if destsit.TimeMilitary1 != nil && destsit.FirstAvailableDeliveryDate1 != nil && destsit.DateOfContact1 != nil { + customerContacts = append(customerContacts, models.MTOServiceItemCustomerContact{ + Type: models.CustomerContactTypeFirst, + DateOfContact: time.Time(*destsit.DateOfContact1), + TimeMilitary: *destsit.TimeMilitary1, + FirstAvailableDeliveryDate: time.Time(*destsit.FirstAvailableDeliveryDate1), + }) + } + if destsit.TimeMilitary2 != nil && destsit.FirstAvailableDeliveryDate2 != nil && destsit.DateOfContact2 != nil { + customerContacts = append(customerContacts, models.MTOServiceItemCustomerContact{ + Type: models.CustomerContactTypeSecond, + DateOfContact: time.Time(*destsit.DateOfContact2), + TimeMilitary: *destsit.TimeMilitary2, + FirstAvailableDeliveryDate: time.Time(*destsit.FirstAvailableDeliveryDate2), + }) + } + + model.CustomerContacts = customerContacts + + if sitEntryDate != nil { + model.SITEntryDate = sitEntryDate + } + + if destsit.SitDepartureDate != nil { + model.SITDepartureDate = handlers.FmtDatePtrToPopPtr(destsit.SitDepartureDate) + } + model.SITDestinationFinalAddress = AddressModel(destsit.SitDestinationFinalAddress) if model.SITDestinationFinalAddress != nil { model.SITDestinationFinalAddressID = &model.SITDestinationFinalAddress.ID @@ -932,6 +1027,31 @@ func validateDDFSITForCreate(m primev2messages.MTOServiceItemDestSIT) *validate. return verrs } +// validateIDFSITForCreate validates IDFSIT service item has all required fields +func validateIDFSITForCreate(m primev2messages.MTOServiceItemInternationalDestSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.FirstAvailableDeliveryDate1 == nil && m.DateOfContact1 != nil && m.TimeMilitary1 != nil { + verrs.Add("firstAvailableDeliveryDate1", "firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 must be provided together in body.") + } + if m.DateOfContact1 == nil && m.TimeMilitary1 != nil && m.FirstAvailableDeliveryDate1 != nil { + verrs.Add("DateOfContact1", "dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 must be provided together in body.") + } + if m.TimeMilitary1 == nil && m.DateOfContact1 != nil && m.FirstAvailableDeliveryDate1 != nil { + verrs.Add("timeMilitary1", "timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 must be provided together in body.") + } + if m.FirstAvailableDeliveryDate2 == nil && m.DateOfContact2 != nil && m.TimeMilitary2 != nil { + verrs.Add("firstAvailableDeliveryDate2", "firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 must be provided together in body.") + } + if m.DateOfContact2 == nil && m.TimeMilitary2 != nil && m.FirstAvailableDeliveryDate2 != nil { + verrs.Add("DateOfContact2", "dateOfContact2, firstAvailableDeliveryDate2, and timeMilitary2 must be provided together in body.") + } + if m.TimeMilitary2 == nil && m.DateOfContact2 != nil && m.FirstAvailableDeliveryDate2 != nil { + verrs.Add("timeMilitary2", "timeMilitary2, firstAvailableDeliveryDate2, and dateOfContact2 must be provided together in body.") + } + return verrs +} + // validateDestSITForUpdate validates DDDSIT service item has all required fields func validateDestSITForUpdate(m primev2messages.UpdateMTOServiceItemSIT) *validate.Errors { verrs := validate.NewErrors() @@ -967,6 +1087,16 @@ func validateReasonDestSIT(m primev2messages.MTOServiceItemDestSIT) *validate.Er return verrs } +// validateReasonInternationalDestSIT validates that International Destination SIT service items have required Reason field +func validateReasonInternationalDestSIT(m primev2messages.MTOServiceItemInternationalDestSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.Reason == nil || m.Reason == models.StringPointer("") { + verrs.Add("reason", "reason is required in body.") + } + return verrs +} + // validateReasonOriginSIT validates that Origin SIT service items have required Reason field func validateReasonOriginSIT(m primev2messages.MTOServiceItemOriginSIT) *validate.Errors { verrs := validate.NewErrors() @@ -977,6 +1107,16 @@ func validateReasonOriginSIT(m primev2messages.MTOServiceItemOriginSIT) *validat return verrs } +// validateReasonInternationalOriginSIT validates that International Origin SIT service items have required Reason field +func validateReasonInternationalOriginSIT(m primev2messages.MTOServiceItemInternationalOriginSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.Reason == nil || m.Reason == models.StringPointer("") { + verrs.Add("reason", "reason is required in body.") + } + return verrs +} + // validateBoatShipmentType validates that the shipment type is a valid boat type, and is not nil. func validateBoatShipmentType(s primev2messages.MTOShipmentType) *validate.Errors { verrs := validate.NewErrors() diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go index 5a1e7844ab6..2f32f2f611a 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go @@ -378,6 +378,32 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) }) + suite.Run("Success - Returns SIT destination service item model - international", func() { + destSITServiceItem := &primev2messages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: &destServiceCode, + FirstAvailableDeliveryDate1: &destDate, + FirstAvailableDeliveryDate2: &destDate, + DateOfContact1: &destDate, + DateOfContact2: &destDate, + TimeMilitary1: &destTime, + TimeMilitary2: &destTime, + SitDestinationFinalAddress: &sitFinalDestAddress, + Reason: &destReason, + } + + destSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + destSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(destSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDFSIT, returnedModel.ReService.Code) + suite.Equal(destPostalCode, returnedModel.SITDestinationFinalAddress.PostalCode) + suite.Equal(destStreet, returnedModel.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) + }) + suite.Run("Success - Returns SIT destination service item model without customer contact fields", func() { destSITServiceItem := &primev2messages.MTOServiceItemDestSIT{ ReServiceCode: &destServiceCode, @@ -398,6 +424,27 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) suite.Equal(destReason, *returnedModel.Reason) }) + + suite.Run("Success - Returns SIT destination service item model without customer contact fields - international", func() { + destSITServiceItem := &primev2messages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: &destServiceCode, + SitDestinationFinalAddress: &sitFinalDestAddress, + Reason: &destReason, + } + + destSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + destSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(destSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDFSIT, returnedModel.ReService.Code) + suite.Equal(destPostalCode, returnedModel.SITDestinationFinalAddress.PostalCode) + suite.Equal(destStreet, returnedModel.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) + suite.Equal(destReason, *returnedModel.Reason) + }) } func (suite *PayloadsSuite) TestReweighModelFromUpdate() { @@ -641,6 +688,23 @@ func (suite *PayloadsSuite) TestValidateReasonOriginSIT() { verrs := validateReasonOriginSIT(mtoServiceItemOriginSIT) suite.True(verrs.HasAny()) }) + + suite.Run("Reason provided - international", func() { + reason := "reason" + mtoServiceItemOriginSIT := primev2messages.MTOServiceItemInternationalOriginSIT{ + Reason: &reason, + } + + verrs := validateReasonInternationalOriginSIT(mtoServiceItemOriginSIT) + suite.False(verrs.HasAny()) + }) + + suite.Run("No reason provided - international", func() { + mtoServiceItemOriginSIT := primev2messages.MTOServiceItemInternationalOriginSIT{} + + verrs := validateReasonInternationalOriginSIT(mtoServiceItemOriginSIT) + suite.True(verrs.HasAny()) + }) } func (suite *PayloadsSuite) TestShipmentAddressUpdateModel() { diff --git a/pkg/handlers/primeapiv3/mto_service_item_test.go b/pkg/handlers/primeapiv3/mto_service_item_test.go index b0b02a71aca..cd7bd7a3fc1 100644 --- a/pkg/handlers/primeapiv3/mto_service_item_test.go +++ b/pkg/handlers/primeapiv3/mto_service_item_test.go @@ -195,6 +195,11 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { Model: mto, LinkOnly: true, }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, }, nil) mtoShipment.PrimeEstimatedWeight = nil factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOSHUT) diff --git a/pkg/handlers/primeapiv3/payloads/model_to_payload.go b/pkg/handlers/primeapiv3/payloads/model_to_payload.go index aba7a9c1718..f7b6bbc3af4 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload.go @@ -760,6 +760,20 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primev3messages.MTOSe SitHHGActualOrigin: Address(mtoServiceItem.SITOriginHHGActualAddress), SitHHGOriginalOrigin: Address(mtoServiceItem.SITOriginHHGOriginalAddress), } + case models.ReServiceCodeIOFSIT, models.ReServiceCodeIOASIT, models.ReServiceCodeIOPSIT, models.ReServiceCodeIOSFSC: + var sitDepartureDate time.Time + if mtoServiceItem.SITDepartureDate != nil { + sitDepartureDate = *mtoServiceItem.SITDepartureDate + } + payload = &primev3messages.MTOServiceItemInternationalOriginSIT{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + SitDepartureDate: handlers.FmtDate(sitDepartureDate), + SitEntryDate: handlers.FmtDatePtr(mtoServiceItem.SITEntryDate), + SitPostalCode: mtoServiceItem.SITPostalCode, + SitHHGActualOrigin: Address(mtoServiceItem.SITOriginHHGActualAddress), + SitHHGOriginalOrigin: Address(mtoServiceItem.SITOriginHHGOriginalAddress), + } case models.ReServiceCodeDDFSIT, models.ReServiceCodeDDASIT, models.ReServiceCodeDDDSIT, models.ReServiceCodeDDSFSC: var sitDepartureDate, firstAvailableDeliveryDate1, firstAvailableDeliveryDate2, dateOfContact1, dateOfContact2 time.Time var timeMilitary1, timeMilitary2 *string @@ -804,7 +818,50 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primev3messages.MTOSe SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), } + case models.ReServiceCodeIDFSIT, models.ReServiceCodeIDASIT, models.ReServiceCodeIDDSIT, models.ReServiceCodeIDSFSC: + var sitDepartureDate, firstAvailableDeliveryDate1, firstAvailableDeliveryDate2, dateOfContact1, dateOfContact2 time.Time + var timeMilitary1, timeMilitary2 *string + + if mtoServiceItem.SITDepartureDate != nil { + sitDepartureDate = *mtoServiceItem.SITDepartureDate + } + + firstContact := GetCustomerContact(mtoServiceItem.CustomerContacts, models.CustomerContactTypeFirst) + secondContact := GetCustomerContact(mtoServiceItem.CustomerContacts, models.CustomerContactTypeSecond) + timeMilitary1 = &firstContact.TimeMilitary + timeMilitary2 = &secondContact.TimeMilitary + + if !firstContact.DateOfContact.IsZero() { + dateOfContact1 = firstContact.DateOfContact + } + if !secondContact.DateOfContact.IsZero() { + dateOfContact2 = secondContact.DateOfContact + } + + if !firstContact.FirstAvailableDeliveryDate.IsZero() { + firstAvailableDeliveryDate1 = firstContact.FirstAvailableDeliveryDate + } + + if !secondContact.FirstAvailableDeliveryDate.IsZero() { + firstAvailableDeliveryDate2 = secondContact.FirstAvailableDeliveryDate + } + + payload = &primev3messages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + DateOfContact1: handlers.FmtDate(dateOfContact1), + TimeMilitary1: handlers.FmtStringPtrNonEmpty(timeMilitary1), + FirstAvailableDeliveryDate1: handlers.FmtDate(firstAvailableDeliveryDate1), + DateOfContact2: handlers.FmtDate(dateOfContact2), + TimeMilitary2: handlers.FmtStringPtrNonEmpty(timeMilitary2), + FirstAvailableDeliveryDate2: handlers.FmtDate(firstAvailableDeliveryDate2), + SitDepartureDate: handlers.FmtDate(sitDepartureDate), + SitEntryDate: handlers.FmtDatePtr(mtoServiceItem.SITEntryDate), + SitDestinationFinalAddress: Address(mtoServiceItem.SITDestinationFinalAddress), + SitCustomerContacted: handlers.FmtDatePtr(mtoServiceItem.SITCustomerContacted), + SitRequestedDelivery: handlers.FmtDatePtr(mtoServiceItem.SITRequestedDelivery), + } case models.ReServiceCodeDCRT, models.ReServiceCodeDUCRT: item := GetDimension(mtoServiceItem.Dimensions, models.DimensionTypeItem) crate := GetDimension(mtoServiceItem.Dimensions, models.DimensionTypeCrate) diff --git a/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go b/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go index f0f7036eac6..3de4cb386fb 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go @@ -1002,6 +1002,72 @@ func (suite *PayloadsSuite) TestMTOServiceItemDestSIT() { suite.Equal(finalAddress.PostalCode, *destSIT.SitDestinationFinalAddress.PostalCode) suite.Equal(mtoShipmentID.String(), destSIT.MtoShipmentID().String()) } + +func (suite *PayloadsSuite) TestMTOServiceItemInternationalDestSIT() { + reServiceCode := models.ReServiceCodeIDFSIT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + sitDepartureDate := time.Now().AddDate(0, 1, 0) + sitEntryDate := time.Now().AddDate(0, 0, -30) + finalAddress := models.Address{ + StreetAddress1: "dummyStreet", + City: "dummyCity", + State: "FL", + PostalCode: "55555", + } + mtoShipmentID := uuid.Must(uuid.NewV4()) + + mtoServiceItemDestSIT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + SITDepartureDate: &sitDepartureDate, + SITEntryDate: &sitEntryDate, + SITDestinationFinalAddress: &finalAddress, + MTOShipmentID: &mtoShipmentID, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultDestSIT := MTOServiceItem(mtoServiceItemDestSIT) + suite.NotNil(resultDestSIT) + destSIT, ok := resultDestSIT.(*primev3messages.MTOServiceItemInternationalDestSIT) + suite.True(ok) + + suite.Equal(string(reServiceCode), string(*destSIT.ReServiceCode)) + suite.Equal(reason, *destSIT.Reason) + suite.Equal(strfmt.Date(sitDepartureDate).String(), destSIT.SitDepartureDate.String()) + suite.Equal(strfmt.Date(sitEntryDate).String(), destSIT.SitEntryDate.String()) + suite.Equal(strfmt.Date(dateOfContact1).String(), destSIT.DateOfContact1.String()) + suite.Equal(timeMilitary1, *destSIT.TimeMilitary1) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate1).String(), destSIT.FirstAvailableDeliveryDate1.String()) + suite.Equal(strfmt.Date(dateOfContact2).String(), destSIT.DateOfContact2.String()) + suite.Equal(timeMilitary2, *destSIT.TimeMilitary2) + suite.Equal(strfmt.Date(firstAvailableDeliveryDate2).String(), destSIT.FirstAvailableDeliveryDate2.String()) + suite.Equal(finalAddress.StreetAddress1, *destSIT.SitDestinationFinalAddress.StreetAddress1) + suite.Equal(finalAddress.City, *destSIT.SitDestinationFinalAddress.City) + suite.Equal(finalAddress.State, *destSIT.SitDestinationFinalAddress.State) + suite.Equal(finalAddress.PostalCode, *destSIT.SitDestinationFinalAddress.PostalCode) + suite.Equal(mtoShipmentID.String(), destSIT.MtoShipmentID().String()) +} + func (suite *PayloadsSuite) TestMTOServiceItemDCRT() { reServiceCode := models.ReServiceCodeDCRT reason := "reason" diff --git a/pkg/handlers/primeapiv3/payloads/payload_to_model.go b/pkg/handlers/primeapiv3/payloads/payload_to_model.go index 2acc20eb04a..84b22616fdd 100644 --- a/pkg/handlers/primeapiv3/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv3/payloads/payload_to_model.go @@ -727,7 +727,44 @@ func MTOServiceItemModel(mtoServiceItem primev3messages.MTOServiceItem) (*models if model.SITOriginHHGActualAddress != nil { model.SITOriginHHGActualAddressID = &model.SITOriginHHGActualAddress.ID } + case primev3messages.MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT: + originsit := mtoServiceItem.(*primev3messages.MTOServiceItemInternationalOriginSIT) + + if originsit.ReServiceCode != nil { + model.ReService.Code = models.ReServiceCode(*originsit.ReServiceCode) + } + + model.Reason = originsit.Reason + // Check for reason required field on a DDFSIT + if model.ReService.Code == models.ReServiceCodeDOASIT { + reasonVerrs := validateReasonInternationalOriginSIT(*originsit) + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + if model.ReService.Code == models.ReServiceCodeDOFSIT { + reasonVerrs := validateReasonInternationalOriginSIT(*originsit) + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + sitEntryDate := handlers.FmtDatePtrToPopPtr(originsit.SitEntryDate) + + if sitEntryDate != nil { + model.SITEntryDate = sitEntryDate + } + + model.SITPostalCode = originsit.SitPostalCode + + model.SITOriginHHGActualAddress = AddressModel(originsit.SitHHGActualOrigin) + if model.SITOriginHHGActualAddress != nil { + model.SITOriginHHGActualAddressID = &model.SITOriginHHGActualAddress.ID + } case primev3messages.MTOServiceItemModelTypeMTOServiceItemDestSIT: destsit := mtoServiceItem.(*primev3messages.MTOServiceItemDestSIT) @@ -782,6 +819,64 @@ func MTOServiceItemModel(mtoServiceItem primev3messages.MTOServiceItem) (*models model.SITDepartureDate = handlers.FmtDatePtrToPopPtr(destsit.SitDepartureDate) } + model.SITDestinationFinalAddress = AddressModel(destsit.SitDestinationFinalAddress) + if model.SITDestinationFinalAddress != nil { + model.SITDestinationFinalAddressID = &model.SITDestinationFinalAddress.ID + } + case primev3messages.MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT: + destsit := mtoServiceItem.(*primev3messages.MTOServiceItemInternationalDestSIT) + + if destsit.ReServiceCode != nil { + model.ReService.Code = models.ReServiceCode(*destsit.ReServiceCode) + + } + + model.Reason = destsit.Reason + sitEntryDate := handlers.FmtDatePtrToPopPtr(destsit.SitEntryDate) + + // Check for required fields on a IDFSIT + if model.ReService.Code == models.ReServiceCodeIDFSIT { + verrs := validateIDFSITForCreate(*destsit) + reasonVerrs := validateReasonInternationalDestSIT(*destsit) + + if verrs.HasAny() { + return nil, verrs + } + + if reasonVerrs.HasAny() { + return nil, reasonVerrs + } + } + + var customerContacts models.MTOServiceItemCustomerContacts + + if destsit.TimeMilitary1 != nil && destsit.FirstAvailableDeliveryDate1 != nil && destsit.DateOfContact1 != nil { + customerContacts = append(customerContacts, models.MTOServiceItemCustomerContact{ + Type: models.CustomerContactTypeFirst, + DateOfContact: time.Time(*destsit.DateOfContact1), + TimeMilitary: *destsit.TimeMilitary1, + FirstAvailableDeliveryDate: time.Time(*destsit.FirstAvailableDeliveryDate1), + }) + } + if destsit.TimeMilitary2 != nil && destsit.FirstAvailableDeliveryDate2 != nil && destsit.DateOfContact2 != nil { + customerContacts = append(customerContacts, models.MTOServiceItemCustomerContact{ + Type: models.CustomerContactTypeSecond, + DateOfContact: time.Time(*destsit.DateOfContact2), + TimeMilitary: *destsit.TimeMilitary2, + FirstAvailableDeliveryDate: time.Time(*destsit.FirstAvailableDeliveryDate2), + }) + } + + model.CustomerContacts = customerContacts + + if sitEntryDate != nil { + model.SITEntryDate = sitEntryDate + } + + if destsit.SitDepartureDate != nil { + model.SITDepartureDate = handlers.FmtDatePtrToPopPtr(destsit.SitDepartureDate) + } + model.SITDestinationFinalAddress = AddressModel(destsit.SitDestinationFinalAddress) if model.SITDestinationFinalAddress != nil { model.SITDestinationFinalAddressID = &model.SITDestinationFinalAddress.ID @@ -1096,6 +1191,31 @@ func validateDDFSITForCreate(m primev3messages.MTOServiceItemDestSIT) *validate. return verrs } +// validateIDFSITForCreate validates IDFSIT service item has all required fields +func validateIDFSITForCreate(m primev3messages.MTOServiceItemInternationalDestSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.FirstAvailableDeliveryDate1 == nil && m.DateOfContact1 != nil && m.TimeMilitary1 != nil { + verrs.Add("firstAvailableDeliveryDate1", "firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 must be provided together in body.") + } + if m.DateOfContact1 == nil && m.TimeMilitary1 != nil && m.FirstAvailableDeliveryDate1 != nil { + verrs.Add("DateOfContact1", "dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 must be provided together in body.") + } + if m.TimeMilitary1 == nil && m.DateOfContact1 != nil && m.FirstAvailableDeliveryDate1 != nil { + verrs.Add("timeMilitary1", "timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 must be provided together in body.") + } + if m.FirstAvailableDeliveryDate2 == nil && m.DateOfContact2 != nil && m.TimeMilitary2 != nil { + verrs.Add("firstAvailableDeliveryDate2", "firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 must be provided together in body.") + } + if m.DateOfContact2 == nil && m.TimeMilitary2 != nil && m.FirstAvailableDeliveryDate2 != nil { + verrs.Add("DateOfContact1", "dateOfContact2, firstAvailableDeliveryDate2, and timeMilitary2 must be provided together in body.") + } + if m.TimeMilitary2 == nil && m.DateOfContact2 != nil && m.FirstAvailableDeliveryDate2 != nil { + verrs.Add("timeMilitary2", "timeMilitary2, firstAvailableDeliveryDate2, and dateOfContact2 must be provided together in body.") + } + return verrs +} + // validateDestSITForUpdate validates DDDSIT service item has all required fields func validateDestSITForUpdate(m primev3messages.UpdateMTOServiceItemSIT) *validate.Errors { verrs := validate.NewErrors() @@ -1131,6 +1251,16 @@ func validateReasonDestSIT(m primev3messages.MTOServiceItemDestSIT) *validate.Er return verrs } +// validateReasonInternationalDestSIT validates that International Destination SIT service items have required Reason field +func validateReasonInternationalDestSIT(m primev3messages.MTOServiceItemInternationalDestSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.Reason == nil || m.Reason == models.StringPointer("") { + verrs.Add("reason", "reason is required in body.") + } + return verrs +} + // validateReasonOriginSIT validates that Origin SIT service items have required Reason field func validateReasonOriginSIT(m primev3messages.MTOServiceItemOriginSIT) *validate.Errors { verrs := validate.NewErrors() @@ -1141,6 +1271,16 @@ func validateReasonOriginSIT(m primev3messages.MTOServiceItemOriginSIT) *validat return verrs } +// validateReasonInternationalOriginSIT validates that International Origin SIT service items have required Reason field +func validateReasonInternationalOriginSIT(m primev3messages.MTOServiceItemInternationalOriginSIT) *validate.Errors { + verrs := validate.NewErrors() + + if m.Reason == nil || m.Reason == models.StringPointer("") { + verrs.Add("reason", "reason is required in body.") + } + return verrs +} + // validateBoatShipmentType validates that the shipment type is a valid boat type, and is not nil. func validateBoatShipmentType(s primev3messages.MTOShipmentType) *validate.Errors { verrs := validate.NewErrors() diff --git a/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go index 4f12b050b83..2d99bd58d77 100644 --- a/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go @@ -378,6 +378,32 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) }) + suite.Run("Success - Returns international SIT destination service item model", func() { + destSITServiceItem := &primev3messages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: &destServiceCode, + FirstAvailableDeliveryDate1: &destDate, + FirstAvailableDeliveryDate2: &destDate, + DateOfContact1: &destDate, + DateOfContact2: &destDate, + TimeMilitary1: &destTime, + TimeMilitary2: &destTime, + SitDestinationFinalAddress: &sitFinalDestAddress, + Reason: &destReason, + } + + destSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + destSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(destSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDFSIT, returnedModel.ReService.Code) + suite.Equal(destPostalCode, returnedModel.SITDestinationFinalAddress.PostalCode) + suite.Equal(destStreet, returnedModel.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) + }) + suite.Run("Success - Returns SIT destination service item model without customer contact fields", func() { destSITServiceItem := &primev3messages.MTOServiceItemDestSIT{ ReServiceCode: &destServiceCode, @@ -398,6 +424,27 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) suite.Equal(destReason, *returnedModel.Reason) }) + + suite.Run("Success - Returns international SIT destination service item model without customer contact fields", func() { + destSITServiceItem := &primev3messages.MTOServiceItemInternationalDestSIT{ + ReServiceCode: &destServiceCode, + SitDestinationFinalAddress: &sitFinalDestAddress, + Reason: &destReason, + } + + destSITServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + destSITServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + returnedModel, verrs := MTOServiceItemModel(destSITServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDFSIT, returnedModel.ReService.Code) + suite.Equal(destPostalCode, returnedModel.SITDestinationFinalAddress.PostalCode) + suite.Equal(destStreet, returnedModel.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(destUSPRCID.String(), returnedModel.SITDestinationFinalAddress.UsPostRegionCityID.String()) + suite.Equal(destReason, *returnedModel.Reason) + }) } func (suite *PayloadsSuite) TestReweighModelFromUpdate() { @@ -724,6 +771,23 @@ func (suite *PayloadsSuite) TestValidateReasonOriginSIT() { verrs := validateReasonOriginSIT(mtoServiceItemOriginSIT) suite.True(verrs.HasAny()) }) + + suite.Run("Reason provided - international", func() { + reason := "reason" + mtoServiceItemOriginSIT := primev3messages.MTOServiceItemInternationalOriginSIT{ + Reason: &reason, + } + + verrs := validateReasonInternationalOriginSIT(mtoServiceItemOriginSIT) + suite.False(verrs.HasAny()) + }) + + suite.Run("No reason provided - international", func() { + mtoServiceItemOriginSIT := primev3messages.MTOServiceItemInternationalOriginSIT{} + + verrs := validateReasonInternationalOriginSIT(mtoServiceItemOriginSIT) + suite.True(verrs.HasAny()) + }) } func (suite *PayloadsSuite) TestShipmentAddressUpdateModel() { diff --git a/pkg/models/mto_shipments.go b/pkg/models/mto_shipments.go index 148f1130e65..1d7f6a2dada 100644 --- a/pkg/models/mto_shipments.go +++ b/pkg/models/mto_shipments.go @@ -48,6 +48,8 @@ var internationalAccessorialServiceItems = []ReServiceCode{ ReServiceCodeIDDSIT, ReServiceCodeIDSHUT, ReServiceCodeIOSHUT, + ReServiceCodeIOSFSC, + ReServiceCodeIDSFSC, } const ( diff --git a/pkg/services/mto_service_item/mto_service_item_creator.go b/pkg/services/mto_service_item/mto_service_item_creator.go index 2dc4d89d7fa..d4966974691 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator.go +++ b/pkg/services/mto_service_item/mto_service_item_creator.go @@ -3,6 +3,7 @@ package mtoserviceitem import ( "database/sql" "fmt" + "slices" "strconv" "time" @@ -450,22 +451,35 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex // checking to see if the service item being created is a destination SIT // if so, we want the destination address to be the same as the shipment's // which will later populate the additional dest SIT service items as well - if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT && mtoShipment.DestinationAddressID != nil { + if (serviceItem.ReService.Code == models.ReServiceCodeDDFSIT || serviceItem.ReService.Code == models.ReServiceCodeIDFSIT) && + mtoShipment.DestinationAddressID != nil { serviceItem.SITDestinationFinalAddress = mtoShipment.DestinationAddress serviceItem.SITDestinationFinalAddressID = mtoShipment.DestinationAddressID } - if serviceItem.ReService.Code == models.ReServiceCodeDOASIT { + if serviceItem.ReService.Code == models.ReServiceCodeDOASIT || serviceItem.ReService.Code == models.ReServiceCodeIOASIT { + // validation mappings // DOASIT must be associated with shipment that has DOFSIT - serviceItem, err = o.validateSITStandaloneServiceItem(appCtx, serviceItem, models.ReServiceCodeDOFSIT) + // IOASIT must be associated with shipment that has IOFSIT + m := make(map[models.ReServiceCode]models.ReServiceCode) + m[models.ReServiceCodeDOASIT] = models.ReServiceCodeDOFSIT + m[models.ReServiceCodeIOASIT] = models.ReServiceCodeIOFSIT + + serviceItem, err = o.validateSITStandaloneServiceItem(appCtx, serviceItem, m[serviceItem.ReService.Code]) if err != nil { return nil, nil, err } } - if serviceItem.ReService.Code == models.ReServiceCodeDDASIT { + if serviceItem.ReService.Code == models.ReServiceCodeDDASIT || serviceItem.ReService.Code == models.ReServiceCodeIDASIT { + // validation mappings // DDASIT must be associated with shipment that has DDFSIT - serviceItem, err = o.validateSITStandaloneServiceItem(appCtx, serviceItem, models.ReServiceCodeDDFSIT) + // IDASIT must be associated with shipment that has IDFSIT + m := make(map[models.ReServiceCode]models.ReServiceCode) + m[models.ReServiceCodeDDASIT] = models.ReServiceCodeDDFSIT + m[models.ReServiceCodeIDASIT] = models.ReServiceCodeIDFSIT + + serviceItem, err = o.validateSITStandaloneServiceItem(appCtx, serviceItem, m[serviceItem.ReService.Code]) if err != nil { return nil, nil, err } @@ -480,7 +494,9 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } if serviceItem.ReService.Code == models.ReServiceCodeDDDSIT || serviceItem.ReService.Code == models.ReServiceCodeDOPSIT || - serviceItem.ReService.Code == models.ReServiceCodeDDSFSC || serviceItem.ReService.Code == models.ReServiceCodeDOSFSC { + serviceItem.ReService.Code == models.ReServiceCodeDDSFSC || serviceItem.ReService.Code == models.ReServiceCodeDOSFSC || + serviceItem.ReService.Code == models.ReServiceCodeIDDSIT || serviceItem.ReService.Code == models.ReServiceCodeIOPSIT || + serviceItem.ReService.Code == models.ReServiceCodeIDSFSC || serviceItem.ReService.Code == models.ReServiceCodeIOSFSC { verrs = validate.NewErrors() verrs.Add("reServiceCode", fmt.Sprintf("%s cannot be created", serviceItem.ReService.Code)) return nil, nil, apperror.NewInvalidInputError(serviceItem.ID, nil, verrs, @@ -488,15 +504,19 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } updateShipmentPickupAddress := false - if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT || serviceItem.ReService.Code == models.ReServiceCodeDOFSIT { + if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT || + serviceItem.ReService.Code == models.ReServiceCodeDOFSIT || + serviceItem.ReService.Code == models.ReServiceCodeIDFSIT || + serviceItem.ReService.Code == models.ReServiceCodeIOFSIT { extraServiceItems, errSIT := o.validateFirstDaySITServiceItem(appCtx, serviceItem) if errSIT != nil { return nil, nil, errSIT } - // update HHG origin address for ReServiceCodeDOFSIT service item - if serviceItem.ReService.Code == models.ReServiceCodeDOFSIT { - // When creating a DOFSIT, the prime must provide an HHG actual address for the move/shift in origin (pickup address) + // update HHG origin address for ReServiceCodeDOFSIT/ReServiceCodeIOFSIT service item + if serviceItem.ReService.Code == models.ReServiceCodeDOFSIT || + serviceItem.ReService.Code == models.ReServiceCodeIOFSIT { + // When creating a DOFSIT/IOFSIT, the prime must provide an HHG actual address for the move/shift in origin (pickup address) if serviceItem.SITOriginHHGActualAddress == nil { verrs = validate.NewErrors() verrs.Add("reServiceCode", fmt.Sprintf("%s cannot be created", serviceItem.ReService.Code)) @@ -545,13 +565,16 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex // changes were made to the shipment, needs to be saved to the database updateShipmentPickupAddress = true - // Find the DOPSIT service item and update the SIT related address fields. These fields - // will be used for pricing when a payment request is created for DOPSIT + // Find the DOPSIT/IOPSIT service item and update the SIT related address fields. These fields + // will be used for pricing when a payment request is created for DOPSIT/IOPSIT for itemIndex := range *extraServiceItems { extraServiceItem := &(*extraServiceItems)[itemIndex] if extraServiceItem.ReService.Code == models.ReServiceCodeDOPSIT || extraServiceItem.ReService.Code == models.ReServiceCodeDOASIT || - extraServiceItem.ReService.Code == models.ReServiceCodeDOSFSC { + extraServiceItem.ReService.Code == models.ReServiceCodeDOSFSC || + extraServiceItem.ReService.Code == models.ReServiceCodeIOPSIT || + extraServiceItem.ReService.Code == models.ReServiceCodeIOASIT || + extraServiceItem.ReService.Code == models.ReServiceCodeIOSFSC { extraServiceItem.SITOriginHHGActualAddress = serviceItem.SITOriginHHGActualAddress extraServiceItem.SITOriginHHGActualAddressID = serviceItem.SITOriginHHGActualAddressID extraServiceItem.SITOriginHHGOriginalAddress = serviceItem.SITOriginHHGOriginalAddress @@ -561,12 +584,17 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } // make sure SITDestinationFinalAddress is the same for all destination SIT related service item - if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT && serviceItem.SITDestinationFinalAddress != nil { + if (serviceItem.ReService.Code == models.ReServiceCodeDDFSIT || serviceItem.ReService.Code == models.ReServiceCodeIDFSIT) && + serviceItem.SITDestinationFinalAddress != nil { for itemIndex := range *extraServiceItems { extraServiceItem := &(*extraServiceItems)[itemIndex] + // handle both domestic and internationl(OCONUS) if extraServiceItem.ReService.Code == models.ReServiceCodeDDDSIT || extraServiceItem.ReService.Code == models.ReServiceCodeDDASIT || - extraServiceItem.ReService.Code == models.ReServiceCodeDDSFSC { + extraServiceItem.ReService.Code == models.ReServiceCodeDDSFSC || + extraServiceItem.ReService.Code == models.ReServiceCodeIDDSIT || + extraServiceItem.ReService.Code == models.ReServiceCodeIDASIT || + extraServiceItem.ReService.Code == models.ReServiceCodeIDSFSC { extraServiceItem.SITDestinationFinalAddress = serviceItem.SITDestinationFinalAddress extraServiceItem.SITDestinationFinalAddressID = serviceItem.SITDestinationFinalAddressID } @@ -576,11 +604,13 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex milesCalculated, errCalcSITDelivery := o.calculateSITDeliveryMiles(appCtx, serviceItem, mtoShipment) // only calculate SITDeliveryMiles for DOPSIT and DOSFSC origin service items - if serviceItem.ReService.Code == models.ReServiceCodeDOFSIT && milesCalculated != 0 { + if (serviceItem.ReService.Code == models.ReServiceCodeDOFSIT || serviceItem.ReService.Code == models.ReServiceCodeIOFSIT) && + milesCalculated != 0 { for itemIndex := range *extraServiceItems { extraServiceItem := &(*extraServiceItems)[itemIndex] - if extraServiceItem.ReService.Code == models.ReServiceCodeDOPSIT || - extraServiceItem.ReService.Code == models.ReServiceCodeDOSFSC { + if extraServiceItem.ReService.Code == models.ReServiceCodeDOPSIT || extraServiceItem.ReService.Code == models.ReServiceCodeIOPSIT || + extraServiceItem.ReService.Code == models.ReServiceCodeDOSFSC || + extraServiceItem.ReService.Code == models.ReServiceCodeIOSFSC { if milesCalculated > 0 && errCalcSITDelivery == nil { extraServiceItem.SITDeliveryMiles = &milesCalculated } @@ -589,11 +619,12 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } // only calculate SITDeliveryMiles for DDDSIT and DDSFSC destination service items - if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT && milesCalculated != 0 { + if (serviceItem.ReService.Code == models.ReServiceCodeDDFSIT || serviceItem.ReService.Code == models.ReServiceCodeIDFSIT) && milesCalculated != 0 { for itemIndex := range *extraServiceItems { extraServiceItem := &(*extraServiceItems)[itemIndex] - if extraServiceItem.ReService.Code == models.ReServiceCodeDDDSIT || - extraServiceItem.ReService.Code == models.ReServiceCodeDDSFSC { + if extraServiceItem.ReService.Code == models.ReServiceCodeDDDSIT || extraServiceItem.ReService.Code == models.ReServiceCodeIDDSIT || + extraServiceItem.ReService.Code == models.ReServiceCodeDDSFSC || + extraServiceItem.ReService.Code == models.ReServiceCodeIDSFSC { if milesCalculated > 0 && errCalcSITDelivery == nil { extraServiceItem.SITDeliveryMiles = &milesCalculated } @@ -675,11 +706,15 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } if mtoShipment.MarketCode == models.MarketCodeInternational { - createdInternationalServiceItemIds, err = models.CreateInternationalAccessorialServiceItemsForShipment(appCtx.DB(), *serviceItem.MTOShipmentID, models.MTOServiceItems{*serviceItem}) + createdInternationalServiceItemIds, err = models.CreateInternationalAccessorialServiceItemsForShipment(appCtx.DB(), *requestedServiceItem.MTOShipmentID, models.MTOServiceItems{*requestedServiceItem}) if err != nil { return err } } else { + if isInternationalServiceItem(requestedServiceItem) { + err := fmt.Errorf("cannot create international service items for domestic shipment: %s", mtoShipment.ID) + return apperror.NewInvalidInputError(mtoShipment.ID, err, nil, err.Error()) + } verrs, err = o.builder.CreateOne(txnAppCtx, requestedServiceItem) if verrs != nil || err != nil { return fmt.Errorf("%#v %e", verrs, err) @@ -940,6 +975,10 @@ func (o *mtoServiceItemCreator) validateFirstDaySITServiceItem(appCtx appcontext reServiceCodes = append(reServiceCodes, models.ReServiceCodeDDASIT, models.ReServiceCodeDDDSIT, models.ReServiceCodeDDSFSC) case models.ReServiceCodeDOFSIT: reServiceCodes = append(reServiceCodes, models.ReServiceCodeDOASIT, models.ReServiceCodeDOPSIT, models.ReServiceCodeDOSFSC) + case models.ReServiceCodeIDFSIT: + reServiceCodes = append(reServiceCodes, models.ReServiceCodeIDASIT, models.ReServiceCodeIDDSIT, models.ReServiceCodeIDSFSC) + case models.ReServiceCodeIOFSIT: + reServiceCodes = append(reServiceCodes, models.ReServiceCodeIOASIT, models.ReServiceCodeIOPSIT, models.ReServiceCodeIOSFSC) default: verrs := validate.NewErrors() verrs.Add("reServiceCode", fmt.Sprintf("%s invalid code", serviceItem.ReService.Code)) @@ -979,3 +1018,21 @@ func GetAdjustedWeight(incomingWeight unit.Pound, isUB bool) *unit.Pound { } return adjustedWeight } + +func isInternationalServiceItem(serviceItem *models.MTOServiceItem) bool { + var internationalAccessorialServiceItems = []models.ReServiceCode{ + models.ReServiceCodeICRT, + models.ReServiceCodeIUCRT, + models.ReServiceCodeIOASIT, + models.ReServiceCodeIDASIT, + models.ReServiceCodeIOFSIT, + models.ReServiceCodeIDFSIT, + models.ReServiceCodeIOPSIT, + models.ReServiceCodeIDDSIT, + models.ReServiceCodeIDSHUT, + models.ReServiceCodeIOSHUT, + models.ReServiceCodeIOSFSC, + models.ReServiceCodeIDSFSC, + } + return slices.Contains(internationalAccessorialServiceItems, serviceItem.ReService.Code) +} diff --git a/pkg/services/mto_service_item/mto_service_item_creator_test.go b/pkg/services/mto_service_item/mto_service_item_creator_test.go index c785f78ec1b..463e06e9090 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator_test.go +++ b/pkg/services/mto_service_item/mto_service_item_creator_test.go @@ -112,6 +112,45 @@ func (suite *MTOServiceItemServiceSuite) buildValidDDFSITServiceItemWithValidMov return serviceItem } +func (suite *MTOServiceItemServiceSuite) buildValidIDFSITServiceItemWithValidMove() models.MTOServiceItem { + move := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + dimension := models.MTOServiceItemDimension{ + Type: models.DimensionTypeItem, + Length: 12000, + Height: 12000, + Width: 12000, + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + } + reServiceIDFSIT := factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeIDFSIT) + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: move, + LinkOnly: true, + }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, + }, nil) + destAddress := factory.BuildDefaultAddress(suite.DB()) + + serviceItem := models.MTOServiceItem{ + MoveTaskOrderID: move.ID, + MoveTaskOrder: move, + ReService: reServiceIDFSIT, + MTOShipmentID: &shipment.ID, + MTOShipment: shipment, + Dimensions: models.MTOServiceItemDimensions{dimension}, + Status: models.MTOServiceItemStatusSubmitted, + SITDestinationFinalAddressID: &destAddress.ID, + SITDestinationFinalAddress: &destAddress, + } + + return serviceItem +} + func (suite *MTOServiceItemServiceSuite) buildValidDOSHUTServiceItemWithValidMove() models.MTOServiceItem { move := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) reServiceDOSHUT := factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOSHUT) @@ -281,6 +320,60 @@ func (suite *MTOServiceItemServiceSuite) TestCreateMTOServiceItem() { suite.Equal(numDDSFSCFound, 1) }) + suite.Run("200 Success - International Destination SIT Service Item Creation", func() { + + // TESTCASE SCENARIO + // Under test: CreateMTOServiceItem function + // Set up: We create an approved move and attempt to create IDFSIT service item on it. Includes Dimensions + // and a SITDestinationFinalAddress + // Expected outcome: + // 4 SIT items are created, status of move is APPROVALS_REQUESTED + + sitServiceItem := suite.buildValidIDFSITServiceItemWithValidMove() + sitMove := sitServiceItem.MoveTaskOrder + sitShipment := sitServiceItem.MTOShipment + + createdServiceItems, verrs, err := creator.CreateMTOServiceItem(suite.AppContextForTest(), &sitServiceItem) + suite.NoError(err) + suite.Nil(verrs) + suite.NotNil(createdServiceItems) + + var foundMove models.Move + err = suite.DB().Find(&foundMove, sitMove.ID) + suite.NoError(err) + + createdServiceItemList := *createdServiceItems + suite.Equal(len(createdServiceItemList), 4) + suite.Equal(models.MoveStatusAPPROVALSREQUESTED, foundMove.Status) + + numIDFSITFound := 0 + numIDASITFound := 0 + numIDDSITFound := 0 + numIDSFSCFound := 0 + + for _, createdServiceItem := range createdServiceItemList { + // checking that the service item final destination address equals the shipment's final destination address + suite.Equal(sitShipment.DestinationAddress.StreetAddress1, createdServiceItem.SITDestinationFinalAddress.StreetAddress1) + suite.Equal(sitShipment.DestinationAddressID, createdServiceItem.SITDestinationFinalAddressID) + + switch createdServiceItem.ReService.Code { + case models.ReServiceCodeIDFSIT: + suite.NotEmpty(createdServiceItem.Dimensions) + numIDFSITFound++ + case models.ReServiceCodeIDASIT: + numIDASITFound++ + case models.ReServiceCodeIDDSIT: + numIDDSITFound++ + case models.ReServiceCodeIDSFSC: + numIDSFSCFound++ + } + } + suite.Equal(numIDASITFound, 1) + suite.Equal(numIDDSITFound, 1) + suite.Equal(numIDFSITFound, 1) + suite.Equal(numIDSFSCFound, 1) + }) + // Happy path: If the service item is created successfully it should be returned suite.Run("200 Success - SHUT Service Item Creation", func() { @@ -1975,6 +2068,122 @@ func (suite *MTOServiceItemServiceSuite) TestCreateDestSITServiceItem() { suite.NotEmpty(invalidInputError.ValidationErrors) suite.Contains(invalidInputError.ValidationErrors.Keys(), "reServiceCode") }) + + suite.Run("Failure - cannot create domestic service item international domestic shipment", func() { + move := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + dimension := models.MTOServiceItemDimension{ + Type: models.DimensionTypeItem, + Length: 12000, + Height: 12000, + Width: 12000, + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + } + + // setup domestic shipment + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: move, + LinkOnly: true, + }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, + }, nil) + destAddress := factory.BuildDefaultAddress(suite.DB()) + + // setup international service item. must fail validation for a domestic shipment + reServiceDDFSIT := factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDDFSIT) + internationalServiceItem := models.MTOServiceItem{ + MoveTaskOrderID: move.ID, + MoveTaskOrder: move, + ReService: reServiceDDFSIT, + MTOShipmentID: &shipment.ID, + MTOShipment: shipment, + Dimensions: models.MTOServiceItemDimensions{dimension}, + Status: models.MTOServiceItemStatusSubmitted, + SITDestinationFinalAddressID: &destAddress.ID, + SITDestinationFinalAddress: &destAddress, + } + + builder := query.NewQueryBuilder() + moveRouter := moverouter.NewMoveRouter() + planner := &mocks.Planner{} + planner.On("ZipTransitDistance", + mock.AnythingOfType("*appcontext.appContext"), + mock.Anything, + mock.Anything, + false, + ).Return(400, nil) + creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) + + createdServiceItems, _, err := creator.CreateMTOServiceItem(suite.AppContextForTest(), &internationalServiceItem) + suite.Nil(createdServiceItems) + suite.Error(err) + suite.IsType(apperror.InvalidInputError{}, err) + + suite.Contains(err.Error(), "cannot create domestic service items for international shipment") + }) + + suite.Run("Failure - cannot create international service item for domestic shipment", func() { + move := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + dimension := models.MTOServiceItemDimension{ + Type: models.DimensionTypeItem, + Length: 12000, + Height: 12000, + Width: 12000, + CreatedAt: time.Now(), + UpdatedAt: time.Now(), + } + + // setup domestic shipment + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: move, + LinkOnly: true, + }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeDomestic, + }, + }, + }, nil) + destAddress := factory.BuildDefaultAddress(suite.DB()) + + // setup international service item. must fail validation for a domestic shipment + reServiceIDFSIT := factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeIDFSIT) + internationalServiceItem := models.MTOServiceItem{ + MoveTaskOrderID: move.ID, + MoveTaskOrder: move, + ReService: reServiceIDFSIT, + MTOShipmentID: &shipment.ID, + MTOShipment: shipment, + Dimensions: models.MTOServiceItemDimensions{dimension}, + Status: models.MTOServiceItemStatusSubmitted, + SITDestinationFinalAddressID: &destAddress.ID, + SITDestinationFinalAddress: &destAddress, + } + + builder := query.NewQueryBuilder() + moveRouter := moverouter.NewMoveRouter() + planner := &mocks.Planner{} + planner.On("ZipTransitDistance", + mock.AnythingOfType("*appcontext.appContext"), + mock.Anything, + mock.Anything, + false, + ).Return(400, nil) + creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) + + createdServiceItems, _, err := creator.CreateMTOServiceItem(suite.AppContextForTest(), &internationalServiceItem) + suite.Nil(createdServiceItems) + suite.Error(err) + suite.IsType(apperror.InvalidInputError{}, err) + + suite.Contains(err.Error(), "cannot create international service items for domestic shipment") + }) } func (suite *MTOServiceItemServiceSuite) TestPriceEstimator() { diff --git a/pkg/services/mto_service_item/mto_service_item_validators.go b/pkg/services/mto_service_item/mto_service_item_validators.go index a16ee07fc10..786f18d9944 100644 --- a/pkg/services/mto_service_item/mto_service_item_validators.go +++ b/pkg/services/mto_service_item/mto_service_item_validators.go @@ -43,6 +43,14 @@ var allSITServiceItemsToCheck = []models.ReServiceCode{ models.ReServiceCodeDOFSIT, models.ReServiceCodeDOASIT, models.ReServiceCodeDOSFSC, + models.ReServiceCodeIDDSIT, + models.ReServiceCodeIDASIT, + models.ReServiceCodeIDFSIT, + models.ReServiceCodeIDSFSC, + models.ReServiceCodeIOPSIT, + models.ReServiceCodeIOFSIT, + models.ReServiceCodeIOASIT, + models.ReServiceCodeIOSFSC, } var allAccessorialServiceItemsToCheck = []models.ReServiceCode{ diff --git a/pkg/services/mto_service_item/mto_service_item_validators_test.go b/pkg/services/mto_service_item/mto_service_item_validators_test.go index 947758dec43..f9b1ae18d36 100644 --- a/pkg/services/mto_service_item/mto_service_item_validators_test.go +++ b/pkg/services/mto_service_item/mto_service_item_validators_test.go @@ -181,6 +181,29 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.NoError(err) }) + suite.Run("checkForSITItemChanges - should not throw error when SIT Item is changed - international", func() { + + // Update the non-updateable fields: + oldServiceItem, newServiceItem := setupTestData() // Create old and new service item + + // Make both sthe newServiceItem of type DOFSIT because this type of service item will be checked by checkForSITItemChanges + newServiceItem.ReService.Code = models.ReServiceCodeIOFSIT + + // Sit Entry Date change. Need to make the newServiceItem different than the old. + newSitEntryDate := time.Date(2023, time.October, 10, 10, 10, 0, 0, time.UTC) + newServiceItem.SITEntryDate = &newSitEntryDate + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newServiceItem, + oldServiceItem: oldServiceItem, + verrs: validate.NewErrors(), + } + + err := serviceItemData.checkForSITItemChanges(&serviceItemData) + + suite.NoError(err) + }) + suite.Run("checkForSITItemChanges - should throw error when SIT Item is not changed", func() { oldServiceItem, newServiceItem := setupTestData() // Create old and new service item @@ -204,6 +227,29 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { }) + suite.Run("checkForSITItemChanges - should throw error when SIT Item is not changed - international", func() { + + oldServiceItem, newServiceItem := setupTestData() // Create old and new service item + + // Make both service items of type IOFSIT because this type of service item will be checked by checkForSITItemChanges + oldServiceItem.ReService.Code = models.ReServiceCodeIOFSIT + newServiceItem.ReService.Code = models.ReServiceCodeIOFSIT + oldServiceItem.SITDepartureDate, newServiceItem.SITDepartureDate = &now, &now + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newServiceItem, + oldServiceItem: oldServiceItem, + verrs: validate.NewErrors(), + } + + err := serviceItemData.checkForSITItemChanges(&serviceItemData) + + // Should error with message if nothing has changed between the new service item and the old one + suite.Error(err) + suite.Contains(err.Error(), "To re-submit a SIT sevice item the new SIT service item must be different than the previous one.") + + }) + // Test successful check for SIT departure service item - not updating SITDepartureDate suite.Run("checkSITDeparture w/ no SITDepartureDate update - success", func() { oldServiceItem, newServiceItem := setupTestData() // These @@ -247,6 +293,62 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.NoVerrs(serviceItemData.verrs) }) + // Test successful check for SIT departure service item - IDDSIT + suite.Run("checkSITDeparture w/ IDDSIT - success", func() { + // Under test: checkSITDeparture checks that the service item is a + // IDDSIT or IOPSIT if the user is trying to update the + // SITDepartureDate + // Set up: Create an old and new IDDSIT, with a new date and try to update. + // Expected outcome: Success if both are IDDSIT + oldIDDSIT := factory.BuildMTOServiceItem(nil, []factory.Customization{ + { + Model: models.ReService{ + Code: models.ReServiceCodeIDDSIT, + }, + }, + }, nil) + newIDDSIT := oldIDDSIT + newIDDSIT.SITDepartureDate = &now + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newIDDSIT, + oldServiceItem: oldIDDSIT, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkSITDeparture(suite.AppContextForTest()) + + suite.NoError(err) + suite.NoVerrs(serviceItemData.verrs) + }) + + // Test successful check for SIT departure service item - IDDSIT + suite.Run("checkSITDeparture w/ IDDSIT - success", func() { + // Under test: checkSITDeparture checks that the service item is a + // IDDSIT or IOPSIT if the user is trying to update the + // SITDepartureDate + // Set up: Create an old and new IDDSIT, with a new date and try to update. + // Expected outcome: Success if both are IDDSIT + oldIDDSIT := factory.BuildMTOServiceItem(nil, []factory.Customization{ + { + Model: models.ReService{ + Code: models.ReServiceCodeIDDSIT, + }, + }, + }, nil) + newIDDSIT := oldIDDSIT + newIDDSIT.SITDepartureDate = &now + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newIDDSIT, + oldServiceItem: oldIDDSIT, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkSITDeparture(suite.AppContextForTest()) + + suite.NoError(err) + suite.NoVerrs(serviceItemData.verrs) + }) + // Test unsuccessful check for SIT departure service item - not a departure SIT item suite.Run("checkSITDeparture w/ non-departure SIT - failure", func() { // Under test: checkSITDeparture checks that the service item is a @@ -397,6 +499,37 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.Contains(err.Error(), "- reason cannot be empty when resubmitting a previously rejected SIT service item") }) + // Test unsuccessful check service item when the reason isn't being updated + suite.Run("checkReasonWasUpdatedOnRejectedSIT - failure when empty string - international", func() { + // Under test: checkReasonWasUpdatedOnRejectedSIT ensures that the reason value is being updated + // Set up: Create any SIT service item + // Expected outcome: ConflictError + oldServiceItem, newServiceItem := setupTestData() + + // only checks rejected SIT service items + newServiceItem.Status = models.MTOServiceItemStatusSubmitted + oldServiceItem.Status = models.MTOServiceItemStatusRejected + + // This only checks SIT service items + newServiceItem.ReService.Code = models.ReServiceCodeIDFSIT + oldServiceItem.ReService.Code = models.ReServiceCodeIDFSIT + + newServiceItem.Reason = models.StringPointer("") + oldServiceItem.Reason = models.StringPointer("a reason") + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newServiceItem, + oldServiceItem: oldServiceItem, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkReasonWasUpdatedOnRejectedSIT(suite.AppContextForTest()) + + suite.Error(err) + suite.IsType(apperror.ConflictError{}, err) + suite.NoVerrs(serviceItemData.verrs) + suite.Contains(err.Error(), "- reason cannot be empty when resubmitting a previously rejected SIT service item") + }) + // Test unsuccessful check service item when the reason isn't being updated suite.Run("checkReasonWasUpdatedOnRejectedSIT - failure when no reason is provided", func() { // Under test: checkReasonWasUpdatedOnRejectedSIT ensures that the reason value is being updated @@ -428,6 +561,37 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.Contains(err.Error(), "- you must provide a new reason when resubmitting a previously rejected SIT service item") }) + // Test unsuccessful check service item when the reason isn't being updated + suite.Run("checkReasonWasUpdatedOnRejectedSIT - failure when no reason is provided - international", func() { + // Under test: checkReasonWasUpdatedOnRejectedSIT ensures that the reason value is being updated + // Set up: Create any SIT service item + // Expected outcome: ConflictError + oldServiceItem, newServiceItem := setupTestData() + + // only checks rejected SIT service items + newServiceItem.Status = models.MTOServiceItemStatusSubmitted + oldServiceItem.Status = models.MTOServiceItemStatusRejected + + // This only checks SIT service items + newServiceItem.ReService.Code = models.ReServiceCodeIDFSIT + oldServiceItem.ReService.Code = models.ReServiceCodeIDFSIT + + newServiceItem.Reason = nil + oldServiceItem.Reason = models.StringPointer("a reason") + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newServiceItem, + oldServiceItem: oldServiceItem, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkReasonWasUpdatedOnRejectedSIT(suite.AppContextForTest()) + + suite.Error(err) + suite.IsType(apperror.ConflictError{}, err) + suite.NoVerrs(serviceItemData.verrs) + suite.Contains(err.Error(), "- you must provide a new reason when resubmitting a previously rejected SIT service item") + }) + suite.Run("checkReasonWasUpdatedOnRejectedSIT - success", func() { // Under test: checkReasonWasUpdatedOnRejectedSIT ensures that the reason value is being updated // Set up: Create any SIT service item @@ -456,6 +620,34 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.NoVerrs(serviceItemData.verrs) }) + suite.Run("checkReasonWasUpdatedOnRejectedSIT - international - success", func() { + // Under test: checkReasonWasUpdatedOnRejectedSIT ensures that the reason value is being updated + // Set up: Create any SIT service item + // Expected outcome: No errors + oldServiceItem, newServiceItem := setupTestData() + + // only checks rejected SIT service items + newServiceItem.Status = models.MTOServiceItemStatusSubmitted + oldServiceItem.Status = models.MTOServiceItemStatusRejected + + // This only checks SIT service items + newServiceItem.ReService.Code = models.ReServiceCodeIDFSIT + oldServiceItem.ReService.Code = models.ReServiceCodeIDFSIT + + newServiceItem.Reason = models.StringPointer("one reason") + oldServiceItem.Reason = models.StringPointer("another reason") + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newServiceItem, + oldServiceItem: oldServiceItem, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkReasonWasUpdatedOnRejectedSIT(suite.AppContextForTest()) + + suite.NoError(err) + suite.NoVerrs(serviceItemData.verrs) + }) + // Test getVerrs for successful example suite.Run("getVerrs - success", func() { // Under test: getVerrs returns a list of validation errors @@ -860,7 +1052,73 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { }) - suite.Run("SITDepartureDate - errors when set before or equal the SIT entry date", func() { + suite.Run("SITDepartureDate - Does not error or update shipment auth end date when set after the authorized end date - international", func() { + // Under test: checkSITDepartureDate checks that + // the SITDepartureDate is not later than the authorized end date + // Set up: Create an old and new IOPSIT and IDDSIT, with a date later than the + // shipment and try to update. + // Expected outcome: No ERROR if departure date comes after the end date. + // Shipment auth end date does not change + mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: models.MTOShipment{OriginSITAuthEndDate: &now, + DestinationSITAuthEndDate: &now}, + }, + }, nil) + testCases := []struct { + reServiceCode models.ReServiceCode + }{ + { + reServiceCode: models.ReServiceCodeIOPSIT, + }, + { + reServiceCode: models.ReServiceCodeIDDSIT, + }, + } + for _, tc := range testCases { + oldSITServiceItem := factory.BuildMTOServiceItem(nil, []factory.Customization{ + { + Model: models.ReService{ + Code: tc.reServiceCode, + }, + }, + { + Model: mtoShipment, + LinkOnly: true, + }, + { + Model: models.MTOServiceItem{ + SITEntryDate: &later, + }, + }, + }, nil) + newSITServiceItem := oldSITServiceItem + newSITServiceItem.SITDepartureDate = &later + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newSITServiceItem, + oldServiceItem: oldSITServiceItem, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkSITDepartureDate(suite.AppContextForTest()) + suite.NoError(err) + suite.False(serviceItemData.verrs.HasAny()) + + // Double check the shipment and ensure that the SITDepartureDate is in fact after the authorized end date + var postUpdateShipment models.MTOShipment + err = suite.DB().Find(&postUpdateShipment, mtoShipment.ID) + suite.NoError(err) + if tc.reServiceCode == models.ReServiceCodeIOPSIT { + suite.True(mtoShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour).Equal(postUpdateShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour))) + suite.True(newSITServiceItem.SITEntryDate.Truncate(24 * time.Hour).After(postUpdateShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour))) + } + if tc.reServiceCode == models.ReServiceCodeIDDSIT { + suite.True(mtoShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour).Equal(postUpdateShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour))) + suite.True(newSITServiceItem.SITEntryDate.Truncate(24 * time.Hour).After(postUpdateShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour))) + } + } + }) + + suite.Run("SITDepartureDate - errors when set before the SIT entry date", func() { mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ { Model: models.MTOShipment{OriginSITAuthEndDate: &now, @@ -960,6 +1218,55 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { }) + suite.Run("SITDepartureDate - errors when set before the SIT entry date - international", func() { + mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: models.MTOShipment{OriginSITAuthEndDate: &now, + DestinationSITAuthEndDate: &now}, + }, + }, nil) + testCases := []struct { + reServiceCode models.ReServiceCode + }{ + { + reServiceCode: models.ReServiceCodeIOPSIT, + }, + { + reServiceCode: models.ReServiceCodeIDDSIT, + }, + } + for _, tc := range testCases { + oldSITServiceItem := factory.BuildMTOServiceItem(nil, []factory.Customization{ + { + Model: models.ReService{ + Code: tc.reServiceCode, + }, + }, + { + Model: mtoShipment, + LinkOnly: true, + }, + { + Model: models.MTOServiceItem{ + SITEntryDate: &later, + }, + }, + }, nil) + newSITServiceItem := oldSITServiceItem + newSITServiceItem.SITDepartureDate = &before + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newSITServiceItem, + oldServiceItem: oldSITServiceItem, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkSITDepartureDate(suite.AppContextForTest()) + suite.NoError(err) // Just verrs + suite.True(serviceItemData.verrs.HasAny()) + suite.Contains(serviceItemData.verrs.Keys(), "SITDepartureDate") + suite.Contains(serviceItemData.verrs.Get("SITDepartureDate"), "SIT departure date cannot be set before the SIT entry date.") + } + }) + suite.Run("SITDepartureDate - errors when service item is missing a shipment ID", func() { oldSITServiceItem := factory.BuildMTOServiceItem(nil, []factory.Customization{ diff --git a/pkg/services/sit_entry_date_update/sit_entry_date_updater.go b/pkg/services/sit_entry_date_update/sit_entry_date_updater.go index 2e32dc8172c..54012f13bb0 100644 --- a/pkg/services/sit_entry_date_update/sit_entry_date_updater.go +++ b/pkg/services/sit_entry_date_update/sit_entry_date_updater.go @@ -53,9 +53,10 @@ func (p sitEntryDateUpdater) UpdateSitEntryDate(appCtx appcontext.AppContext, s return nil, apperror.NewQueryError("Shipment", err, "") } - // the service code can either be DOFSIT or DDFSIT + // the service code can either be DOFSIT/DDFSIT or IOFSIT/IDFSIT serviceItemCode := serviceItem.ReService.Code - if serviceItemCode != models.ReServiceCodeDOFSIT && serviceItemCode != models.ReServiceCodeDDFSIT { + if serviceItemCode != models.ReServiceCodeDOFSIT && serviceItemCode != models.ReServiceCodeDDFSIT && + serviceItemCode != models.ReServiceCodeIOFSIT && serviceItemCode != models.ReServiceCodeIDFSIT { return nil, apperror.NewUnprocessableEntityError(string(serviceItemCode) + "You cannot change the SIT entry date of this service item.") } @@ -63,16 +64,16 @@ func (p sitEntryDateUpdater) UpdateSitEntryDate(appCtx appcontext.AppContext, s // then looking for the sister service item of add'l days // once found, we'll set the value of variable to that service item // so now we have the 1st day of SIT service item & the add'l days SIT service item - if serviceItemCode == models.ReServiceCodeDOFSIT { + if serviceItemCode == models.ReServiceCodeDOFSIT || serviceItemCode == models.ReServiceCodeIOFSIT { for _, si := range shipment.MTOServiceItems { - if si.ReService.Code == models.ReServiceCodeDOASIT { + if si.ReService.Code == models.ReServiceCodeDOASIT || si.ReService.Code == models.ReServiceCodeIOASIT { serviceItemAdditionalDays = si break } } - } else if serviceItemCode == models.ReServiceCodeDDFSIT { + } else if serviceItemCode == models.ReServiceCodeDDFSIT || serviceItemCode == models.ReServiceCodeIDFSIT { for _, si := range shipment.MTOServiceItems { - if si.ReService.Code == models.ReServiceCodeDDASIT { + if si.ReService.Code == models.ReServiceCodeDDASIT || si.ReService.Code == models.ReServiceCodeIDASIT { serviceItemAdditionalDays = si break } diff --git a/pkg/services/sit_entry_date_update/sit_entry_date_updater_test.go b/pkg/services/sit_entry_date_update/sit_entry_date_updater_test.go index d3546d7a5f7..7144a84f784 100644 --- a/pkg/services/sit_entry_date_update/sit_entry_date_updater_test.go +++ b/pkg/services/sit_entry_date_update/sit_entry_date_updater_test.go @@ -49,6 +49,44 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { return ddfServiceItem, ddaServiceItem } + setupInternationalModels := func() (models.MTOServiceItem, models.MTOServiceItem) { + move := factory.BuildMove(suite.DB(), nil, nil) + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: move, + LinkOnly: true, + }, + { + Model: models.MTOShipment{ + MarketCode: models.MarketCodeInternational, + }, + }, + }, nil) + idfServiceItem := factory.BuildMTOServiceItem(suite.DB(), []factory.Customization{ + { + Model: shipment, + LinkOnly: true, + }, + { + Model: models.ReService{ + Code: models.ReServiceCodeIDFSIT, + }, + }, + }, nil) + idaServiceItem := factory.BuildMTOServiceItem(suite.DB(), []factory.Customization{ + { + Model: shipment, + LinkOnly: true, + }, + { + Model: models.ReService{ + Code: models.ReServiceCodeIDASIT, + }, + }, + }, nil) + return idfServiceItem, idaServiceItem + } + // Test not found error suite.Run("Not Found Error", func() { ddfServiceItem, _ := setupModels() @@ -67,6 +105,23 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { suite.IsType(apperror.NotFoundError{}, err) }) + suite.Run("Not Found Error - international", func() { + idfServiceItem, _ := setupInternationalModels() + notFoundServiceItem := models.SITEntryDateUpdate{ + ID: idfServiceItem.ID, + SITEntryDate: idfServiceItem.SITEntryDate, + } + notFoundUUID, err := uuid.NewV4() + suite.NoError(err) + notFoundServiceItem.ID = notFoundUUID + + updatedServiceItem, err := updater.UpdateSitEntryDate(suite.AppContextForTest(), ¬FoundServiceItem) + + suite.Nil(updatedServiceItem) + suite.Error(err) + suite.IsType(apperror.NotFoundError{}, err) + }) + // Test successful update of both service items suite.Run("Successful update of service items", func() { ddfServiceItem, ddaServiceItem := setupModels() @@ -252,4 +307,25 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { ) suite.Contains(err.Error(), expectedError) }) + suite.Run("Successful update of service items - international", func() { + idfServiceItem, idaServiceItem := setupInternationalModels() + updatedServiceItem := models.SITEntryDateUpdate{ + ID: idfServiceItem.ID, + SITEntryDate: idfServiceItem.SITEntryDate, + } + newSitEntryDate := time.Date(2020, time.December, 02, 0, 0, 0, 0, time.UTC) + newSitEntryDateNextDay := newSitEntryDate.Add(24 * time.Hour) + + updatedServiceItem.SITEntryDate = &newSitEntryDate + idaServiceItem.SITEntryDate = &newSitEntryDateNextDay + + changedServiceItem, err := updater.UpdateSitEntryDate(suite.AppContextForTest(), &updatedServiceItem) + + suite.NoError(err) + suite.NotNil(updatedServiceItem) + suite.Equal(idfServiceItem.ID, updatedServiceItem.ID) + suite.Equal(updatedServiceItem.SITEntryDate.Local(), changedServiceItem.SITEntryDate.Local()) + suite.Equal(idaServiceItem.SITEntryDate.Local(), newSitEntryDateNextDay.Local()) + }) + } diff --git a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx index 416134e0672..cbad67cc0b5 100644 --- a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx +++ b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx @@ -13,6 +13,7 @@ import { SitStatusShape } from 'types/sitStatusShape'; import { formatDateWithUTC } from 'shared/dates'; import { formatCityStateAndPostalCode } from 'utils/shipmentDisplay'; import { formatWeight, convertFromThousandthInchToInch, formatCents, toDollarString } from 'utils/formatters'; +import { SERVICE_ITEM_CODES } from 'constants/serviceItems'; function generateDetailText(details, id, className) { const detailList = Object.keys(details).map((detail) => ( @@ -38,7 +39,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai 'First available delivery date 1': '-', 'Customer contact 1': '-', }); - const numberOfDaysApprovedForDOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; + const numberOfDaysApprovedForSIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; const sitEndDate = sitStatus && sitStatus.currentSIT?.sitAuthorizedEndDate && @@ -50,7 +51,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai return (
- {code === 'DDFSIT' + {code === SERVICE_ITEM_CODES.DDFSIT || code === SERVICE_ITEM_CODES.IDFSIT ? generateDetailText({ 'Original Delivery Address': originalDeliveryAddress ? formatCityStateAndPostalCode(originalDeliveryAddress) @@ -58,7 +59,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai 'SIT entry date': details.sitEntryDate ? formatDateWithUTC(details.sitEntryDate, 'DD MMM YYYY') : '-', }) : null} - {code === 'DDASIT' && ( + {code === SERVICE_ITEM_CODES.DDASIT && ( <> {generateDetailText( { @@ -68,7 +69,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai "Add'l SIT Start Date": details.sitEntryDate ? moment.utc(details.sitEntryDate).add(1, 'days').format('DD MMM YYYY') : '-', - '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForDOASIT} days` : '-', + '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForSIT} days` : '-', 'SIT expiration date': sitEndDate || '-', }, id, @@ -87,7 +88,36 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {code === 'DDSFSC' + {code === SERVICE_ITEM_CODES.IDASIT && ( + <> + {generateDetailText( + { + 'Original Delivery Address': originalDeliveryAddress + ? formatCityStateAndPostalCode(originalDeliveryAddress) + : '-', + "Add'l SIT Start Date": details.sitEntryDate + ? moment.utc(details.sitEntryDate).add(1, 'days').format('DD MMM YYYY') + : '-', + '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForSIT} days` : '-', + 'SIT expiration date': sitEndDate || '-', + }, + id, + )} + {!isEmpty(serviceRequestDocUploads) ? ( +
+

Download service item documentation:

+ {serviceRequestDocUploads.map((file) => ( + + ))} +
+ ) : null} + + )} + {code === SERVICE_ITEM_CODES.DDSFSC || code === SERVICE_ITEM_CODES.IDSFSC ? generateDetailText( { 'Original Delivery Address': originalDeliveryAddress @@ -102,7 +132,45 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai id, ) : null} - {code === 'DDDSIT' && ( + {code === SERVICE_ITEM_CODES.DDDSIT && ( + <> + {generateDetailText( + { + 'Original Delivery Address': originalDeliveryAddress + ? formatCityStateAndPostalCode(originalDeliveryAddress) + : '-', + 'Final Delivery Address': + details.sitDestinationFinalAddress && details.status !== 'SUBMITTED' + ? formatCityStateAndPostalCode(details.sitDestinationFinalAddress) + : '-', + 'Delivery miles out of SIT': details.sitDeliveryMiles ? details.sitDeliveryMiles : '-', + 'Customer contacted homesafe': details.sitCustomerContacted + ? formatDateWithUTC(details.sitCustomerContacted, 'DD MMM YYYY') + : '-', + 'Customer requested delivery date': details.sitRequestedDelivery + ? formatDateWithUTC(details.sitRequestedDelivery, 'DD MMM YYYY') + : '-', + 'SIT departure date': details.sitDepartureDate + ? formatDateWithUTC(details.sitDepartureDate, 'DD MMM YYYY') + : '-', + }, + id, + )} + {!isEmpty(serviceRequestDocUploads) ? ( +
+

Download service item documentation:

+ {serviceRequestDocUploads.map((file) => ( + + ))} +
+ ) : null} + + )} + {code === SERVICE_ITEM_CODES.IDDSIT && ( <> {generateDetailText( { @@ -140,7 +208,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {code === 'DDFSIT' && ( + {(code === SERVICE_ITEM_CODES.DDFSIT || code === SERVICE_ITEM_CODES.IDFSIT) && ( <> {!isEmpty(sortedCustomerContacts) ? sortedCustomerContacts.map((contact, index) => ( @@ -188,7 +256,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s let detailSection; switch (code) { - case 'DOFSIT': { + case SERVICE_ITEM_CODES.DOFSIT: + case SERVICE_ITEM_CODES.IOFSIT: { detailSection = (
@@ -221,12 +290,13 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOASIT': { - const numberOfDaysApprovedForDOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; + case SERVICE_ITEM_CODES.DOASIT: + case SERVICE_ITEM_CODES.IOASIT: { const sitEndDate = sitStatus && sitStatus.currentSIT?.sitAuthorizedEndDate && formatDateWithUTC(sitStatus.currentSIT.sitAuthorizedEndDate, 'DD MMM YYYY'); + const numberOfDaysApprovedForSIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; detailSection = (
@@ -239,7 +309,7 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s "Add'l SIT Start Date": details.sitEntryDate ? moment.utc(details.sitEntryDate).add(1, 'days').format('DD MMM YYYY') : '-', - '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForDOASIT} days` : '-', + '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForSIT} days` : '-', 'SIT expiration date': sitEndDate || '-', 'Customer contacted homesafe': details.sitCustomerContacted ? formatDateWithUTC(details.sitCustomerContacted, 'DD MMM YYYY') @@ -272,7 +342,10 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOPSIT': { + case SERVICE_ITEM_CODES.DOPSIT: + case SERVICE_ITEM_CODES.IOPSIT: + case SERVICE_ITEM_CODES.DOSFSC: + case SERVICE_ITEM_CODES.IOSFSC: { detailSection = (
@@ -307,65 +380,14 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOSFSC': { - detailSection = ( -
-
- {generateDetailText( - { - 'Original Pickup Address': details.sitOriginHHGOriginalAddress - ? formatCityStateAndPostalCode(details.sitOriginHHGOriginalAddress) - : '-', - 'Actual Pickup Address': details.sitOriginHHGActualAddress - ? formatCityStateAndPostalCode(details.sitOriginHHGActualAddress) - : '-', - 'Delivery miles into SIT': details.sitDeliveryMiles ? details.sitDeliveryMiles : '-', - }, - id, - )} - {details.rejectionReason && - generateDetailText({ 'Rejection reason': details.rejectionReason }, id, 'margin-top-2')} - {!isEmpty(serviceRequestDocUploads) ? ( -
-

Download service item documentation:

- {serviceRequestDocUploads.map((file) => ( - - ))} -
- ) : null} -
-
- ); - break; - } - case 'DDFSIT': - case 'DDASIT': { - detailSection = generateDestinationSITDetailSection( - id, - serviceRequestDocUploads, - details, - code, - shipment, - sitStatus, - ); - break; - } - case 'DDDSIT': { - detailSection = generateDestinationSITDetailSection( - id, - serviceRequestDocUploads, - details, - code, - shipment, - sitStatus, - ); - break; - } - case 'DDSFSC': { + case SERVICE_ITEM_CODES.DDFSIT: + case SERVICE_ITEM_CODES.DDASIT: + case SERVICE_ITEM_CODES.IDFSIT: + case SERVICE_ITEM_CODES.IDASIT: + case SERVICE_ITEM_CODES.DDDSIT: + case SERVICE_ITEM_CODES.IDDSIT: + case SERVICE_ITEM_CODES.DDSFSC: + case SERVICE_ITEM_CODES.IDSFSC: { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, @@ -376,8 +398,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DCRT': - case 'DCRTSA': { + case SERVICE_ITEM_CODES.DCRT: + case SERVICE_ITEM_CODES.DCRTSA: { const { description, itemDimensions, crateDimensions } = details; const itemDimensionFormat = `${convertFromThousandthInchToInch( itemDimensions?.length, @@ -415,7 +437,7 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DUCRT': { + case SERVICE_ITEM_CODES.DUCRT: { const { description, itemDimensions, crateDimensions } = details; const itemDimensionFormat = `${convertFromThousandthInchToInch( itemDimensions?.length, @@ -452,8 +474,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOSHUT': - case 'DDSHUT': { + case SERVICE_ITEM_CODES.DOSHUT: + case SERVICE_ITEM_CODES.DDSHUT: { const estimatedWeight = details.estimatedWeight != null ? formatWeight(details.estimatedWeight) : `— lbs`; detailSection = (
@@ -481,8 +503,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'IOSHUT': - case 'IDSHUT': { + case SERVICE_ITEM_CODES.IOSHUT: + case SERVICE_ITEM_CODES.IDSHUT: { const estimatedWeight = details.estimatedWeight != null ? formatWeight(details.estimatedWeight) : `— lbs`; detailSection = (
@@ -514,21 +536,21 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DLH': - case 'DSH': - case 'FSC': - case 'DOP': - case 'DDP': - case 'DPK': - case 'DUPK': - case 'ISLH': - case 'IHPK': - case 'IHUPK': - case 'IUBPK': - case 'IUBUPK': - case 'POEFSC': - case 'PODFSC': - case 'UBP': { + case SERVICE_ITEM_CODES.DLH: + case SERVICE_ITEM_CODES.DSH: + case SERVICE_ITEM_CODES.FSC: + case SERVICE_ITEM_CODES.DOP: + case SERVICE_ITEM_CODES.DDP: + case SERVICE_ITEM_CODES.DPK: + case SERVICE_ITEM_CODES.DUPK: + case SERVICE_ITEM_CODES.ISLH: + case SERVICE_ITEM_CODES.IHPK: + case SERVICE_ITEM_CODES.IHUPK: + case SERVICE_ITEM_CODES.IUBPK: + case SERVICE_ITEM_CODES.IUBUPK: + case SERVICE_ITEM_CODES.POEFSC: + case SERVICE_ITEM_CODES.PODFSC: + case SERVICE_ITEM_CODES.UBP: { detailSection = (
@@ -540,8 +562,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'MS': - case 'CS': { + case SERVICE_ITEM_CODES.MS: + case SERVICE_ITEM_CODES.CS: { const { estimatedPrice } = details; detailSection = (
@@ -550,7 +572,7 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'ICRT': { + case SERVICE_ITEM_CODES.ICRT: { const { description, itemDimensions, crateDimensions, market, externalCrate } = details; const itemDimensionFormat = `${convertFromThousandthInchToInch( itemDimensions?.length, @@ -590,7 +612,7 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'IUCRT': { + case SERVICE_ITEM_CODES.IUCRT: { const { description, itemDimensions, crateDimensions, market } = details; const itemDimensionFormat = `${convertFromThousandthInchToInch( itemDimensions?.length, diff --git a/src/components/Office/ServiceItemDetails/ServiceItemDetails.test.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.test.jsx index 53aa270d13f..0aa382213fe 100644 --- a/src/components/Office/ServiceItemDetails/ServiceItemDetails.test.jsx +++ b/src/components/Office/ServiceItemDetails/ServiceItemDetails.test.jsx @@ -170,6 +170,42 @@ describe('ServiceItemDetails Domestic Destination SIT', () => { expect(downloadLink).toBeInstanceOf(HTMLAnchorElement); }); + it('renders IDASIT details', () => { + render( + , + ); + expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('Destination Original Tampa, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText("Add'l SIT Start Date:")).toBeInTheDocument(); + expect(screen.getByText('12 Mar 2024')).toBeInTheDocument(); + + expect(screen.queryByText('Customer contacted homesafe:')).not.toBeInTheDocument(); + expect(screen.queryByText('14 Mar 2024')).not.toBeInTheDocument(); + + expect(screen.getByText('# of days approved for:')).toBeInTheDocument(); + expect(screen.getByText('89 days')).toBeInTheDocument(); + + expect(screen.getByText('SIT expiration date:')).toBeInTheDocument(); + expect(screen.getByText('17 Mar 2024')).toBeInTheDocument(); + + expect(screen.queryByText('Customer requested delivery date:')).not.toBeInTheDocument(); + expect(screen.queryByText('15 Mar 2024')).not.toBeInTheDocument(); + + expect(screen.queryByText('SIT departure date:')).not.toBeInTheDocument(); + expect(screen.queryByText('16 Mar 2024')).not.toBeInTheDocument(); + expect(screen.getByText('Download service item documentation:')).toBeInTheDocument(); + const downloadLink = screen.getByText('receipt.pdf'); + expect(downloadLink).toBeInstanceOf(HTMLAnchorElement); + }); + it('renders DDDSIT details', () => { render(); expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); @@ -193,6 +229,31 @@ describe('ServiceItemDetails Domestic Destination SIT', () => { const downloadLink = screen.getByText('receipt.pdf'); expect(downloadLink).toBeInstanceOf(HTMLAnchorElement); }); + + it('renders IDDSIT details', () => { + render(); + expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('Destination Original Tampa, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Final Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('Destination Final MacDill, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Delivery miles out of SIT:')).toBeInTheDocument(); + expect(screen.getByText('50')).toBeInTheDocument(); + + expect(screen.getByText('Customer contacted homesafe:')).toBeInTheDocument(); + expect(screen.getByText('14 Mar 2024')).toBeInTheDocument(); + + expect(screen.getByText('Customer requested delivery date:')).toBeInTheDocument(); + expect(screen.getByText('15 Mar 2024')).toBeInTheDocument(); + + expect(screen.getByText('SIT departure date:')).toBeInTheDocument(); + expect(screen.getByText('16 Mar 2024')).toBeInTheDocument(); + expect(screen.getByText('Download service item documentation:')).toBeInTheDocument(); + const downloadLink = screen.getByText('receipt.pdf'); + expect(downloadLink).toBeInstanceOf(HTMLAnchorElement); + }); + it('renders DDDSIT details with - for the final delivery address is service item is in submitted state', () => { render( { expect(screen.getByText('Final Delivery Address:')).toBeInTheDocument(); expect(screen.getByText('-')).toBeInTheDocument(); }); + + it('renders IDDSIT details with - for the final delivery address is service item is in submitted state', () => { + render( + , + ); + + expect(screen.getByText('Final Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('-')).toBeInTheDocument(); + }); + it('renders DDFSIT details', () => { render(); expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); expect(screen.getByText('Destination Original Tampa, FL 33621')).toBeInTheDocument(); }); + + it('renders IDFSIT details', () => { + render(); + expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('Destination Original Tampa, FL 33621')).toBeInTheDocument(); + }); + it('renders DDSFSC details', () => { render(); expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); @@ -222,6 +305,19 @@ describe('ServiceItemDetails Domestic Destination SIT', () => { expect(screen.getByText('Delivery miles out of SIT:')).toBeInTheDocument(); expect(screen.getByText('50')).toBeInTheDocument(); }); + + it('renders IDSFSC details', () => { + render(); + expect(screen.getByText('Original Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('Destination Original Tampa, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Final Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('Destination Final MacDill, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Delivery miles out of SIT:')).toBeInTheDocument(); + expect(screen.getByText('50')).toBeInTheDocument(); + }); + it('renders DDSFSC details with - for the final delivery address is service item is in submitted state', () => { render( { expect(screen.getByText('Final Delivery Address:')).toBeInTheDocument(); expect(screen.getByText('-')).toBeInTheDocument(); }); + + it('renders IDSFSC details with - for the final delivery address is service item is in submitted state', () => { + render( + , + ); + + expect(screen.getByText('Final Delivery Address:')).toBeInTheDocument(); + expect(screen.getByText('-')).toBeInTheDocument(); + }); }); describe('ServiceItemDetails Domestic Origin SIT', () => { @@ -272,6 +382,40 @@ describe('ServiceItemDetails Domestic Origin SIT', () => { expect(screen.getByText('16 Mar 2024')).toBeInTheDocument(); }); + it(`renders IOASIT details`, () => { + render( + , + ); + + expect(screen.getByText('Original Pickup Address:')).toBeInTheDocument(); + expect(screen.getByText('Origin Original Tampa, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText("Add'l SIT Start Date:")).toBeInTheDocument(); + expect(screen.getByText('12 Mar 2024')).toBeInTheDocument(); + + expect(screen.getByText('# of days approved for:')).toBeInTheDocument(); + expect(screen.getByText('89 days')).toBeInTheDocument(); + + expect(screen.getByText('SIT expiration date:')).toBeInTheDocument(); + expect(screen.getByText('17 Mar 2024')).toBeInTheDocument(); + + expect(screen.getByText('Customer contacted homesafe:')).toBeInTheDocument(); + expect(screen.getByText('14 Mar 2024')).toBeInTheDocument(); + + expect(screen.getByText('Customer requested delivery date:')).toBeInTheDocument(); + expect(screen.getByText('15 Mar 2024')).toBeInTheDocument(); + + expect(screen.getByText('SIT departure date:')).toBeInTheDocument(); + expect(screen.getByText('16 Mar 2024')).toBeInTheDocument(); + }); + it(`renders DOPSIT details`, () => { render(); @@ -285,6 +429,19 @@ describe('ServiceItemDetails Domestic Origin SIT', () => { expect(screen.getByText('50')).toBeInTheDocument(); }); + it(`renders IOPSIT details`, () => { + render(); + + expect(screen.getByText('Original Pickup Address:')).toBeInTheDocument(); + expect(screen.getByText('Origin Original Tampa, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Actual Pickup Address:')).toBeInTheDocument(); + expect(screen.getByText('Origin Actual MacDill, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Delivery miles into SIT:')).toBeInTheDocument(); + expect(screen.getByText('50')).toBeInTheDocument(); + }); + it(`renders DOSFSC details`, () => { render(); @@ -297,11 +454,24 @@ describe('ServiceItemDetails Domestic Origin SIT', () => { expect(screen.getByText('Delivery miles into SIT:')).toBeInTheDocument(); expect(screen.getByText('50')).toBeInTheDocument(); }); + + it(`renders IOSFSC details`, () => { + render(); + + expect(screen.getByText('Original Pickup Address:')).toBeInTheDocument(); + expect(screen.getByText('Origin Original Tampa, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Actual Pickup Address:')).toBeInTheDocument(); + expect(screen.getByText('Origin Actual MacDill, FL 33621')).toBeInTheDocument(); + + expect(screen.getByText('Delivery miles into SIT:')).toBeInTheDocument(); + expect(screen.getByText('50')).toBeInTheDocument(); + }); }); -describe('ServiceItemDetails for DOFSIT', () => { - it('renders SIT entry date, ZIP, original pickup address, and reason', () => { - render(); +describe('ServiceItemDetails for DOFSIT/IOFSIT - origin 1st day SIT', () => { + it.each([['DOFSIT'], ['IOFSIT']])('renders SIT entry date, ZIP, original pickup address, and reason', (code) => { + render(); expect(screen.getByText('Original Pickup Address:')).toBeInTheDocument(); expect(screen.getByText('Origin Original Tampa, FL 33621')).toBeInTheDocument(); diff --git a/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx b/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx index 60f48a93f84..5495ad0fc48 100644 --- a/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx +++ b/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx @@ -10,6 +10,7 @@ import { ServiceItemDetailsShape } from '../../../types/serviceItems'; import styles from './ServiceItemsTable.module.scss'; import { SERVICE_ITEM_STATUS } from 'shared/constants'; +import { SERVICE_ITEM_CODES } from 'constants/serviceItems'; import { ALLOWED_RESUBMISSION_SI_CODES, ALLOWED_SIT_UPDATE_SI_CODES } from 'constants/sitUpdates'; import { formatDateFromIso } from 'utils/formatters'; import ServiceItemDetails from 'components/Office/ServiceItemDetails/ServiceItemDetails'; @@ -30,19 +31,37 @@ import { nullSafeStringCompare } from 'utils/string'; // destination SIT function sortServiceItems(items) { // Prioritize service items with codes 'DSH' (shorthaul) and 'DLH' (linehaul) to be at the top of the list - const haulTypeServiceItemCodes = ['DSH', 'DLH']; + const haulTypeServiceItemCodes = [SERVICE_ITEM_CODES.DSH, SERVICE_ITEM_CODES.DLH]; const haulTypeServiceItems = items.filter((item) => haulTypeServiceItemCodes.includes(item.code)); const sortedHaulTypeServiceItems = haulTypeServiceItems.sort( (a, b) => haulTypeServiceItemCodes.indexOf(a.code) - haulTypeServiceItemCodes.indexOf(b.code), ); // Filter and sort destination SIT. Code index is also the sort order - const destinationServiceItemCodes = ['DDFSIT', 'DDASIT', 'DDDSIT', 'DDSFSC']; + const destinationServiceItemCodes = [ + SERVICE_ITEM_CODES.DDFSIT, + SERVICE_ITEM_CODES.DDASIT, + SERVICE_ITEM_CODES.DDDSIT, + SERVICE_ITEM_CODES.DDSFSC, + SERVICE_ITEM_CODES.IDFSIT, + SERVICE_ITEM_CODES.IDASIT, + SERVICE_ITEM_CODES.IDDSIT, + SERVICE_ITEM_CODES.IDSFSC, + ]; const destinationServiceItems = items.filter((item) => destinationServiceItemCodes.includes(item.code)); const sortedDestinationServiceItems = destinationServiceItems.sort( (a, b) => destinationServiceItemCodes.indexOf(a.code) - destinationServiceItemCodes.indexOf(b.code), ); // Filter origin SIT. Code index is also the sort order - const originServiceItemCodes = ['DOFSIT', 'DOASIT', 'DOPSIT', 'DOSFSC']; + const originServiceItemCodes = [ + SERVICE_ITEM_CODES.DOFSIT, + SERVICE_ITEM_CODES.DOASIT, + SERVICE_ITEM_CODES.DOPSIT, + SERVICE_ITEM_CODES.DOSFSC, + SERVICE_ITEM_CODES.IOFSIT, + SERVICE_ITEM_CODES.IOASIT, + SERVICE_ITEM_CODES.IOPSIT, + SERVICE_ITEM_CODES.IOSFSC, + ]; const originServiceItems = items.filter((item) => originServiceItemCodes.includes(item.code)); const sortedOriginServiceItems = originServiceItems.sort( (a, b) => originServiceItemCodes.indexOf(a.code) - originServiceItemCodes.indexOf(b.code), @@ -202,7 +221,7 @@ const ServiceItemsTable = ({ // we don't want to display the "Accept" button for a DLH or DSH service item that was rejected by a shorthaul to linehaul change or vice versa let rejectedDSHorDLHServiceItem = false; if ( - (serviceItem.code === 'DLH' || serviceItem.code === 'DSH') && + (serviceItem.code === SERVICE_ITEM_CODES.DLH || serviceItem.code === SERVICE_ITEM_CODES.DSH) && serviceItem.details.rejectionReason === 'Automatically rejected due to change in delivery address affecting the ZIP code qualification for short haul / line haul.' ) { @@ -215,7 +234,9 @@ const ServiceItemsTable = ({
{serviceItem.serviceItem} - {(code === 'DCRT' || code === 'ICRT') && serviceItem.details.standaloneCrate && ' - Standalone'} + {(code === SERVICE_ITEM_CODES.DCRT || code === SERVICE_ITEM_CODES.ICRT) && + serviceItem.details.standaloneCrate && + ' - Standalone'} {ALLOWED_RESUBMISSION_SI_CODES.includes(code) && resubmittedToolTip.isResubmitted ? ( { - if (code === 'DDFSIT' || code === 'DOFSIT') { + if ( + code === SERVICE_ITEM_CODES.DDFSIT || + code === SERVICE_ITEM_CODES.DOFSIT || + code === SERVICE_ITEM_CODES.IDFSIT || + code === SERVICE_ITEM_CODES.IOFSIT + ) { handleShowEditSitEntryDateModal(id, mtoShipmentID); } else { handleShowEditSitAddressModal(id, mtoShipmentID); diff --git a/src/components/Office/ServiceItemsTable/ServiceItemsTable.test.jsx b/src/components/Office/ServiceItemsTable/ServiceItemsTable.test.jsx index 6b3e4a6ee87..cc159e86625 100644 --- a/src/components/Office/ServiceItemsTable/ServiceItemsTable.test.jsx +++ b/src/components/Office/ServiceItemsTable/ServiceItemsTable.test.jsx @@ -298,6 +298,63 @@ describe('ServiceItemsTable', () => { expect(wrapper.find('dd').at(5).text()).toBe('01 Jan 2021, 0800Z'); }); + it('renders the customer contacts for IDFSIT service item', () => { + const serviceItems = [ + { + id: 'abc123', + createdAt: '2020-11-20', + serviceItem: 'Domestic Crating', + code: 'IDFSIT', + details: { + sitEntryDate: '2020-12-31', + customerContacts: [ + { + timeMilitary: '0400Z', + firstAvailableDeliveryDate: '2020-12-31', + dateOfContact: '2020-12-31', + }, + { timeMilitary: '0800Z', firstAvailableDeliveryDate: '2021-01-01', dateOfContact: '2021-01-01' }, + ], + sitDestinationOriginalAddress: { + city: 'Destination Original Tampa', + eTag: 'MjAyNC0wMy0xMlQxOTo1OTowOC41NjkxMzla', + id: '7fd6cb90-54cd-44d8-8735-102e28734d84', + postalCode: '33621', + state: 'FL', + streetAddress1: 'MacDill', + }, + }, + }, + ]; + + const wrapper = mount( + + + , + ); + + expect(wrapper.find('table').exists()).toBe(true); + expect(wrapper.find('dt').at(0).text()).toBe('Original Delivery Address:'); + expect(wrapper.find('dd').at(0).text()).toBe('Destination Original Tampa, FL 33621'); + + expect(wrapper.find('dt').at(1).text()).toBe('SIT entry date:'); + expect(wrapper.find('dd').at(1).text()).toBe('31 Dec 2020'); + + expect(wrapper.find('dt').at(2).text()).toBe('First available delivery date 1:'); + expect(wrapper.find('dd').at(2).text()).toBe('31 Dec 2020'); + expect(wrapper.find('dt').at(3).text()).toBe('Customer contact attempt 1:'); + expect(wrapper.find('dd').at(3).text()).toBe('31 Dec 2020, 0400Z'); + + expect(wrapper.find('dt').at(4).text()).toBe('First available delivery date 2:'); + expect(wrapper.find('dd').at(4).text()).toBe('01 Jan 2021'); + expect(wrapper.find('dt').at(5).text()).toBe('Customer contact attempt 2:'); + expect(wrapper.find('dd').at(5).text()).toBe('01 Jan 2021, 0800Z'); + }); + it('should render the SITPostalCode ZIP, and reason for DOFSIT service item', () => { const serviceItems = [ { @@ -340,6 +397,48 @@ describe('ServiceItemsTable', () => { expect(wrapper.find('dd').at(2).contains('This is the reason')).toBe(true); }); + it('should render the SITPostalCode ZIP, and reason for IOFSIT service item', () => { + const serviceItems = [ + { + id: 'abc123', + submittedAt: '2020-11-20', + serviceItem: 'Domestic Origin 1st Day SIT', + code: 'IOFSIT', + details: { + pickupPostalCode: '11111', + SITPostalCode: '12345', + reason: 'This is the reason', + sitEntryDate: '2023-12-25T00:00:00.000Z', + sitOriginHHGOriginalAddress: { + city: 'Origin Original Tampa', + eTag: 'MjAyNC0wMy0xMlQxOTo1OTowOC41NjkxMzla', + id: '7fd6cb90-54cd-44d8-8735-102e28734d84', + postalCode: '33621', + state: 'FL', + streetAddress1: 'MacDill', + }, + }, + }, + ]; + + const wrapper = mount( + + + , + ); + expect(wrapper.find('dt').at(0).contains('Original Pickup Address')).toBe(true); + expect(wrapper.find('dd').at(0).contains('Origin Original Tampa, FL 33621')).toBe(true); + + expect(wrapper.find('dt').at(1).contains('SIT entry date')).toBe(true); + expect(wrapper.find('dd').at(1).contains('25 Dec 2023')).toBe(true); + expect(wrapper.find('dt').at(2).contains('Reason')).toBe(true); + expect(wrapper.find('dd').at(2).contains('This is the reason')).toBe(true); + }); + it('calls the update service item status handler when the accept button is clicked', () => { const serviceItems = [ { diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx index 1bb2f9c517d..a56dfd8a78c 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx @@ -5,6 +5,8 @@ import PropTypes from 'prop-types'; import styles from './CreateShipmentServiceItemForm.module.scss'; import DestinationSITServiceItemForm from './DestinationSITServiceItemForm'; import OriginSITServiceItemForm from './OriginSITServiceItemForm'; +import InternationalDestinationSITServiceItemForm from './InternationalDestinationSITServiceItemForm'; +import InternationalOriginSITServiceItemForm from './InternationalOriginSITServiceItemForm'; import ShuttleSITServiceItemForm from './ShuttleSITServiceItemForm'; import DomesticCratingForm from './DomesticCratingForm'; import InternationalCratingForm from './InternationalCratingForm'; @@ -20,6 +22,8 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) const { MTOServiceItemOriginSIT, MTOServiceItemDestSIT, + MTOServiceItemInternationalOriginSIT, + MTOServiceItemInternationalDestSIT, MTOServiceItemDomesticShuttle, MTOServiceItemDomesticCrating, MTOServiceItemInternationalCrating, @@ -49,6 +53,8 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) <> + + @@ -61,6 +67,14 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) {selectedServiceItemType === MTOServiceItemDestSIT && ( )} + + {selectedServiceItemType === MTOServiceItemInternationalOriginSIT && ( + + )} + {selectedServiceItemType === MTOServiceItemInternationalDestSIT && ( + + )} + {selectedServiceItemType === MTOServiceItemDomesticShuttle && ( )} diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx index 59c136325ce..3efc032ed9e 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx @@ -88,6 +88,8 @@ describe('CreateShipmentServiceItemForm component', () => { it.each([ ['originSITServiceItemForm', createServiceItemModelTypes.MTOServiceItemOriginSIT], ['destinationSITServiceItemForm', createServiceItemModelTypes.MTOServiceItemDestSIT], + ['internationalOriginSITServiceItemForm', createServiceItemModelTypes.MTOServiceItemInternationalOriginSIT], + ['internationalDestinationSITServiceItemForm', createServiceItemModelTypes.MTOServiceItemInternationalDestSIT], ['shuttleSITServiceItemForm', createServiceItemModelTypes.MTOServiceItemDomesticShuttle], ['DomesticCratingForm', createServiceItemModelTypes.MTOServiceItemDomesticCrating], ['InternationalCratingForm', createServiceItemModelTypes.MTOServiceItemInternationalCrating], diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx new file mode 100644 index 00000000000..0a4c4ffeb70 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx @@ -0,0 +1,133 @@ +import * as Yup from 'yup'; +import { Formik } from 'formik'; +import { Button } from '@trussworks/react-uswds'; +import React from 'react'; +import PropTypes from 'prop-types'; + +import { Form } from 'components/form/Form'; +import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextField'; +import { formatDateForSwagger } from 'shared/dates'; +import { formatAddressForPrimeAPI } from 'utils/formatters'; +import { DatePickerInput } from 'components/form/fields'; +import { ShipmentShape } from 'types/shipment'; +import TextField from 'components/form/fields/TextField/TextField'; +import Hint from 'components/Hint'; + +const destinationSITValidationSchema = Yup.object().shape({ + reason: Yup.string().required('Required'), + firstAvailableDeliveryDate1: Yup.date().typeError('Enter a complete date in DD MMM YYYY format (day, month, year).'), + timeMilitary1: Yup.string().matches(/^(\d{4}Z)$/, 'Must be a valid military time (e.g. 1400Z)'), + firstAvailableDeliveryDate2: Yup.date().typeError('Enter a complete date in DD MMM YYYY format (day, month, year).'), + timeMilitary2: Yup.string().matches(/^(\d{4}Z)$/, 'Must be a valid military time (e.g. 1400Z)'), + sitEntryDate: Yup.date() + .typeError('Enter a complete date in DD MMM YYYY format (day, month, year).') + .required('Required'), + sitDepartureDate: Yup.date().typeError('Enter a complete date in DD MMM YYYY format (day, month, year).'), +}); + +const InternationalDestinationSITServiceItemForm = ({ shipment, submission }) => { + const initialValues = { + moveTaskOrderID: shipment.moveTaskOrderID, + mtoShipmentID: shipment.id, + modelType: 'MTOServiceItemInternationalDestSIT', + reServiceCode: 'IDFSIT', + reason: '', + firstAvailableDeliveryDate1: '', + dateOfContact1: '', + timeMilitary1: '', + firstAvailableDeliveryDate2: '', + dateOfContact2: '', + timeMilitary2: '', + sitEntryDate: '', + sitDepartureDate: '', + sitDestinationFinalAddress: { streetAddress1: '', streetAddress2: '', city: '', state: '', postalCode: '' }, + }; + + const onSubmit = (values) => { + const { + firstAvailableDeliveryDate1, + firstAvailableDeliveryDate2, + sitEntryDate, + sitDepartureDate, + sitDestinationFinalAddress, + timeMilitary1, + timeMilitary2, + dateOfContact1, + dateOfContact2, + ...serviceItemValues + } = values; + const body = { + firstAvailableDeliveryDate1: formatDateForSwagger(firstAvailableDeliveryDate1), + firstAvailableDeliveryDate2: formatDateForSwagger(firstAvailableDeliveryDate2), + dateOfContact1: formatDateForSwagger(dateOfContact1), + dateOfContact2: formatDateForSwagger(dateOfContact2), + sitEntryDate: formatDateForSwagger(sitEntryDate), + sitDepartureDate: sitDepartureDate ? formatDateForSwagger(sitDepartureDate) : null, + sitDestinationFinalAddress: sitDestinationFinalAddress.streetAddress1 + ? formatAddressForPrimeAPI(sitDestinationFinalAddress) + : null, + timeMilitary1: timeMilitary1 || null, + timeMilitary2: timeMilitary2 || null, + ...serviceItemValues, + }; + submission({ body }); + }; + + return ( + +
+ + + + + + + + + + + + + + + The following service items will be created:
+ IDFSIT (Destination 1st day SIT)
+ IDASIT (Destination additional days SIT)
+ IDDSIT (Destination SIT delivery)
+ IDSFSC (Destination SIT fuel surcharge)
+
+ NOTE: The above service items will use the current delivery address of the shipment as their + final delivery address. Ensure the shipment address is accurate before creating these service items. +
+ + +
+ ); +}; + +InternationalDestinationSITServiceItemForm.propTypes = { + shipment: ShipmentShape.isRequired, + submission: PropTypes.func.isRequired, +}; + +export default InternationalDestinationSITServiceItemForm; diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.test.jsx new file mode 100644 index 00000000000..f4cce2860c3 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.test.jsx @@ -0,0 +1,156 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; + +import InternationalDestinationSITServiceItemForm from './InternationalDestinationSITServiceItemForm'; + +const approvedMoveTaskOrder = { + moveTaskOrder: { + id: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + moveCode: 'LR4T8V', + mtoShipments: [ + { + actualPickupDate: '2020-03-17', + agents: [], + approvedDate: '2021-10-20', + createdAt: '2021-10-21', + customerRemarks: 'Please treat gently', + destinationAddress: { + city: 'Fairfield', + id: 'bfe61147-5fd7-426e-b473-54ccf77bde35', + postalCode: '94535', + state: 'CA', + streetAddress1: '987 Any Avenue', + streetAddress2: 'P.O. Box 9876', + streetAddress3: 'c/o Some Person', + }, + eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNzc5Nzha', + firstAvailableDeliveryDate: null, + id: 'ce01a5b8-9b44-4511-8a8d-edb60f2a4aee', + moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + pickupAddress: { + city: 'Beverly Hills', + id: 'cf159eca-162c-4131-84a0-795e684416a6', + postalCode: '90210', + state: 'CA', + streetAddress1: '123 Any Street', + streetAddress2: 'P.O. Box 12345', + streetAddress3: 'c/o Some Person', + }, + primeActualWeight: 2000, + primeEstimatedWeight: 1400, + primeEstimatedWeightRecordedDate: null, + requestedPickupDate: '2020-03-15', + requiredDeliveryDate: null, + scheduledPickupDate: '2020-03-16', + secondaryDeliveryAddress: { + city: null, + postalCode: null, + state: null, + streetAddress1: null, + }, + shipmentType: 'HHG', + status: 'APPROVED', + updatedAt: '2021-10-22', + mtoServiceItems: null, + reweigh: { + id: '1234', + weight: 9000, + requestedAt: '2021-10-23', + }, + }, + ], + }, +}; + +describe('InternationalDestinationSITServiceItemForm component', () => { + it.each([ + ['Reason', 'reason'], + ['First available delivery date', 'firstAvailableDeliveryDate1'], + ['First date of attempted contact', 'dateOfContact1'], + ['First time of attempted contact', 'timeMilitary1'], + ['Second available delivery date', 'firstAvailableDeliveryDate2'], + ['Second date of attempted contact', 'dateOfContact2'], + ['Second time of attempted contact', 'timeMilitary2'], + ['SIT entry date', 'sitEntryDate'], + ['SIT departure date', 'sitDepartureDate'], + ])('renders field %s in form', (labelName) => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + render(); + + const field = screen.getByText(labelName); + expect(field).toBeInTheDocument(); + }); + + it('renders hint component at bottom of page - international', async () => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + render( + , + ); + + const hintInfo = screen.getByTestId('destinationSitInfo'); + expect(hintInfo).toBeInTheDocument(); + + expect(hintInfo).toHaveTextContent('The following service items will be created:'); + expect(hintInfo).toHaveTextContent('IDFSIT (Destination 1st day SIT)'); + expect(hintInfo).toHaveTextContent('IDASIT (Destination additional days SIT)'); + expect(hintInfo).toHaveTextContent('IDDSIT (Destination SIT delivery)'); + expect(hintInfo).toHaveTextContent('IDSFSC (Destination SIT fuel surcharge)'); + expect(hintInfo).toHaveTextContent( + 'NOTE: The above service items will use the current delivery address of the shipment as their final delivery address. Ensure the shipment address is accurate before creating these service items.', + ); + }); + + it('renders the Create Service Item button', async () => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + render(); + + // Check if the button renders + const createBtn = screen.getByRole('button', { name: 'Create service item' }); + expect(createBtn).toBeInTheDocument(); + }); + + it('submits values when create service item button is clicked for international destination SIT', async () => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + const submissionMock = jest.fn(); + + render( + , + ); + + await userEvent.type(screen.getByLabelText('Reason'), 'Testing'); + await userEvent.type(screen.getByLabelText('First available delivery date'), '01 Feb 2024'); + await userEvent.type(screen.getByLabelText('First date of attempted contact'), '28 Dec 2023'); + await userEvent.type(screen.getByLabelText('First time of attempted contact'), '1400Z'); + await userEvent.type(screen.getByLabelText('Second available delivery date'), '05 Feb 2024'); + await userEvent.type(screen.getByLabelText('Second date of attempted contact'), '05 Jan 2024'); + await userEvent.type(screen.getByLabelText('Second time of attempted contact'), '1400Z'); + await userEvent.type(screen.getByLabelText('SIT entry date'), '10 Jan 2024'); + await userEvent.type(screen.getByLabelText('SIT departure date'), '24 Jan 2024'); + + // Submit form + await userEvent.click(screen.getByRole('button', { name: 'Create service item' })); + expect(submissionMock).toHaveBeenCalledTimes(1); + expect(submissionMock).toHaveBeenCalledWith({ + body: { + reason: 'Testing', + dateOfContact1: '2023-12-28', + dateOfContact2: '2024-01-05', + firstAvailableDeliveryDate1: '2024-02-01', + firstAvailableDeliveryDate2: '2024-02-05', + modelType: 'MTOServiceItemInternationalDestSIT', + moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + mtoShipmentID: 'ce01a5b8-9b44-4511-8a8d-edb60f2a4aee', + reServiceCode: 'IDFSIT', + sitDepartureDate: '2024-01-24', + sitDestinationFinalAddress: null, + sitEntryDate: '2024-01-10', + timeMilitary1: '1400Z', + timeMilitary2: '1400Z', + }, + }); + }); +}); diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx new file mode 100644 index 00000000000..76db6a191d6 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx @@ -0,0 +1,110 @@ +import * as Yup from 'yup'; +import { Formik } from 'formik'; +import { Button } from '@trussworks/react-uswds'; +import React from 'react'; +import { useNavigate, useParams, generatePath } from 'react-router-dom'; +import PropTypes from 'prop-types'; + +import { requiredAddressSchema, ZIP_CODE_REGEX } from 'utils/validation'; +import { formatDateForSwagger } from 'shared/dates'; +import { formatAddressForPrimeAPI } from 'utils/formatters'; +import { Form } from 'components/form/Form'; +import TextField from 'components/form/fields/TextField/TextField'; +import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextField'; +import { DatePickerInput } from 'components/form/fields'; +import { AddressFields } from 'components/form/AddressFields/AddressFields'; +import { ShipmentShape } from 'types/shipment'; +import { primeSimulatorRoutes } from 'constants/routes'; + +const originSITValidationSchema = Yup.object().shape({ + reason: Yup.string().required('Required'), + sitPostalCode: Yup.string().matches(ZIP_CODE_REGEX, 'Must be valid zip code').required('Required'), + sitEntryDate: Yup.date() + .typeError('Enter a complete date in DD MMM YYYY format (day, month, year).') + .required('Required'), + sitDepartureDate: Yup.date().typeError('Enter a complete date in DD MMM YYYY format (day, month, year).'), + sitHHGActualOrigin: requiredAddressSchema, +}); + +const InternationalOriginSITServiceItemForm = ({ shipment, submission }) => { + const initialValues = { + moveTaskOrderID: shipment.moveTaskOrderID, + mtoShipmentID: shipment.id, + modelType: 'MTOServiceItemInternationalOriginSIT', + reServiceCode: 'IOFSIT', + reason: '', + sitPostalCode: '', + sitEntryDate: '', + sitDepartureDate: '', // The Prime API is currently ignoring origin SIT departure date on creation + sitHHGActualOrigin: { + streetAddress1: '', + streetAddress2: '', + streetAddress3: '', + city: '', + state: '', + postalCode: '', + county: '', + }, + }; + + const onSubmit = (values) => { + const { sitEntryDate, sitDepartureDate, sitHHGActualOrigin, ...serviceItemValues } = values; + const body = { + sitEntryDate: formatDateForSwagger(sitEntryDate), + sitDepartureDate: sitDepartureDate ? formatDateForSwagger(sitDepartureDate) : null, + sitHHGActualOrigin: sitHHGActualOrigin.streetAddress1 ? formatAddressForPrimeAPI(sitHHGActualOrigin) : null, + ...serviceItemValues, + }; + submission({ body }); + }; + + const { moveCodeOrID } = useParams(); + const navigate = useNavigate(); + const handleCancel = () => { + navigate(generatePath(primeSimulatorRoutes.VIEW_MOVE_PATH, { moveCodeOrID })); + }; + + return ( + + {({ isValid, isSubmitting, handleSubmit, ...formikProps }) => { + return ( +
+ + + + + + + + + + + + + ); + }} +
+ ); +}; + +InternationalOriginSITServiceItemForm.propTypes = { + shipment: ShipmentShape.isRequired, + submission: PropTypes.func.isRequired, +}; + +export default InternationalOriginSITServiceItemForm; diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.test.jsx new file mode 100644 index 00000000000..f7445e10751 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.test.jsx @@ -0,0 +1,96 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; + +import InternationalOriginSITServiceItemForm from './InternationalOriginSITServiceItemForm'; + +import { MockProviders } from 'testUtils'; + +const approvedMoveTaskOrder = { + moveTaskOrder: { + id: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + moveCode: 'LR4T8V', + mtoShipments: [ + { + actualPickupDate: '2020-03-17', + agents: [], + approvedDate: '2021-10-20', + createdAt: '2021-10-21', + customerRemarks: 'Please treat gently', + destinationAddress: { + city: 'Fairfield', + id: 'bfe61147-5fd7-426e-b473-54ccf77bde35', + postalCode: '94535', + state: 'CA', + streetAddress1: '987 Any Avenue', + streetAddress2: 'P.O. Box 9876', + streetAddress3: 'c/o Some Person', + }, + eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNzc5Nzha', + firstAvailableDeliveryDate: null, + id: 'ce01a5b8-9b44-4511-8a8d-edb60f2a4aee', + moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + pickupAddress: { + city: 'Beverly Hills', + id: 'cf159eca-162c-4131-84a0-795e684416a6', + postalCode: '90210', + state: 'CA', + streetAddress1: '123 Any Street', + streetAddress2: 'P.O. Box 12345', + streetAddress3: 'c/o Some Person', + }, + primeActualWeight: 2000, + primeEstimatedWeight: 1400, + primeEstimatedWeightRecordedDate: null, + requestedPickupDate: '2020-03-15', + requiredDeliveryDate: null, + scheduledPickupDate: '2020-03-16', + secondaryDeliveryAddress: { + city: null, + postalCode: null, + state: null, + streetAddress1: null, + }, + shipmentType: 'HHG', + status: 'APPROVED', + updatedAt: '2021-10-22', + mtoServiceItems: null, + reweigh: { + id: '1234', + weight: 9000, + requestedAt: '2021-10-23', + }, + }, + ], + }, +}; + +const renderWithProviders = (component) => { + render({component}); +}; + +describe('InternationalOriginSITServiceItemForm component', () => { + it.each([ + ['Reason', 'reason'], + ['SIT postal code', 'sitPostalCode'], + ['SIT entry Date', 'sitEntryDate'], + ['SIT departure Date', 'sitDepartureDate'], + ['SIT HHG actual origin', 'sitHHGActualOrigin'], + ])('renders field %s in form', (labelName) => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + renderWithProviders(); + + const field = screen.getByText(labelName); + expect(field).toBeInTheDocument(); + }); + + it('renders the Create Service Item button', async () => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + renderWithProviders(); + + // Check if the button renders + const createBtn = screen.getByRole('button', { name: 'Create service item' }); + expect(createBtn).toBeInTheDocument(); + }); +}); diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.test.jsx new file mode 100644 index 00000000000..5b261199a02 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.test.jsx @@ -0,0 +1,96 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; + +import OriginSITServiceItemForm from './OriginSITServiceItemForm'; + +import { MockProviders } from 'testUtils'; + +const approvedMoveTaskOrder = { + moveTaskOrder: { + id: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + moveCode: 'LR4T8V', + mtoShipments: [ + { + actualPickupDate: '2020-03-17', + agents: [], + approvedDate: '2021-10-20', + createdAt: '2021-10-21', + customerRemarks: 'Please treat gently', + destinationAddress: { + city: 'Fairfield', + id: 'bfe61147-5fd7-426e-b473-54ccf77bde35', + postalCode: '94535', + state: 'CA', + streetAddress1: '987 Any Avenue', + streetAddress2: 'P.O. Box 9876', + streetAddress3: 'c/o Some Person', + }, + eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNzc5Nzha', + firstAvailableDeliveryDate: null, + id: 'ce01a5b8-9b44-4511-8a8d-edb60f2a4aee', + moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + pickupAddress: { + city: 'Beverly Hills', + id: 'cf159eca-162c-4131-84a0-795e684416a6', + postalCode: '90210', + state: 'CA', + streetAddress1: '123 Any Street', + streetAddress2: 'P.O. Box 12345', + streetAddress3: 'c/o Some Person', + }, + primeActualWeight: 2000, + primeEstimatedWeight: 1400, + primeEstimatedWeightRecordedDate: null, + requestedPickupDate: '2020-03-15', + requiredDeliveryDate: null, + scheduledPickupDate: '2020-03-16', + secondaryDeliveryAddress: { + city: null, + postalCode: null, + state: null, + streetAddress1: null, + }, + shipmentType: 'HHG', + status: 'APPROVED', + updatedAt: '2021-10-22', + mtoServiceItems: null, + reweigh: { + id: '1234', + weight: 9000, + requestedAt: '2021-10-23', + }, + }, + ], + }, +}; + +const renderWithProviders = (component) => { + render({component}); +}; + +describe('OriginSITServiceItemForm component', () => { + it.each([ + ['Reason', 'reason'], + ['SIT postal code', 'sitPostalCode'], + ['SIT entry Date', 'sitEntryDate'], + ['SIT departure Date', 'sitDepartureDate'], + ['SIT HHG actual origin', 'sitHHGActualOrigin'], + ])('renders field %s in form', (labelName) => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + renderWithProviders(); + + const field = screen.getByText(labelName); + expect(field).toBeInTheDocument(); + }); + + it('renders the Create Service Item button', async () => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + renderWithProviders(); + + // Check if the button renders + const createBtn = screen.getByRole('button', { name: 'Create service item' }); + expect(createBtn).toBeInTheDocument(); + }); +}); diff --git a/src/constants/prime.js b/src/constants/prime.js index 358ea7508de..3316a91955a 100644 --- a/src/constants/prime.js +++ b/src/constants/prime.js @@ -4,6 +4,8 @@ import { serviceItemCodes } from 'content/serviceItems'; export const createServiceItemModelTypes = { MTOServiceItemOriginSIT: 'MTOServiceItemOriginSIT', MTOServiceItemDestSIT: 'MTOServiceItemDestSIT', + MTOServiceItemInternationalOriginSIT: 'MTOServiceItemInternationalOriginSIT', + MTOServiceItemInternationalDestSIT: 'MTOServiceItemInternationalDestSIT', MTOServiceItemDomesticShuttle: 'MTOServiceItemDomesticShuttle', MTOServiceItemDomesticCrating: 'MTOServiceItemDomesticCrating', MTOServiceItemInternationalCrating: 'MTOServiceItemInternationalCrating', diff --git a/src/constants/serviceItems.js b/src/constants/serviceItems.js index a5b7e850b3c..39f62d6511c 100644 --- a/src/constants/serviceItems.js +++ b/src/constants/serviceItems.js @@ -153,6 +153,7 @@ const SERVICE_ITEM_CODES = { FSC: 'FSC', DDSHUT: 'DDSHUT', IDSHUT: 'IDSHUT', + DCRTSA: 'DCRTSA', DCRT: 'DCRT', DUCRT: 'DUCRT', ICRT: 'ICRT', @@ -165,6 +166,17 @@ const SERVICE_ITEM_CODES = { IHPK: 'IHPK', IHUPK: 'IHUPK', ISLH: 'ISLH', + IDDSIT: 'IDDSIT', + IDASIT: 'IDASIT', + IOASIT: 'IOASIT', + IOFSIT: 'IOFSIT', + IOPSIT: 'IOPSIT', + IDFSIT: 'IDFSIT', + IOSFSC: 'IOSFSC', + IDSFSC: 'IDSFSC', + IUBPK: 'IUBPK', + IUBUPK: 'IUBUPK', + UBP: 'UBP', }; const SERVICE_ITEMS_ALLOWED_WEIGHT_BILLED_PARAM = [ @@ -196,6 +208,14 @@ const SERVICE_ITEMS_ALLOWED_UPDATE = [ SERVICE_ITEM_CODES.IOSHUT, SERVICE_ITEM_CODES.PODFSC, SERVICE_ITEM_CODES.POEFSC, + SERVICE_ITEM_CODES.IDDSIT, + SERVICE_ITEM_CODES.IDASIT, + SERVICE_ITEM_CODES.IOASIT, + SERVICE_ITEM_CODES.IOFSIT, + SERVICE_ITEM_CODES.IOPSIT, + SERVICE_ITEM_CODES.IDFSIT, + SERVICE_ITEM_CODES.IOSFSC, + SERVICE_ITEM_CODES.IDSFSC, ]; /** @@ -214,6 +234,18 @@ const SIT_SERVICE_ITEM_CODES = { DDASIT: 'DDASIT', /** Domestic destination SIT delivery */ DDDSIT: 'DDDSIT', + /** International origin 1st day SIT */ + IOFSIT: 'IOFSIT', + /** International origin Additional day SIT */ + IOASIT: 'IOASIT', + /** International origin SIT pickup */ + IOPSIT: 'IOPSIT', + /** International destination 1st day SIT */ + IDFSIT: 'IDFSIT', + /** International destination Additional day SIT */ + IDASIT: 'IDASIT', + /** International destination SIT delivery */ + IDDSIT: 'IDDSIT', }; // TODO - temporary, will remove once all service item calculations are implemented diff --git a/src/constants/sitUpdates.js b/src/constants/sitUpdates.js index 6a724b5e205..7e7bedb2fc2 100644 --- a/src/constants/sitUpdates.js +++ b/src/constants/sitUpdates.js @@ -1,6 +1,6 @@ // allowing edit of SIT entry date for Domestic destination 1st day SIT (DDFSIT) // allowing edit of SIT entry date for Domestic origin 1st day SIT (DOFSIT) -export const ALLOWED_SIT_UPDATE_SI_CODES = ['DOFSIT', 'DDFSIT']; +export const ALLOWED_SIT_UPDATE_SI_CODES = ['DOFSIT', 'DDFSIT', 'IOFSIT', 'IDFSIT']; // allowing display of old service item details for following SIT types which can be resubmitted export const ALLOWED_RESUBMISSION_SI_CODES = [ @@ -12,4 +12,12 @@ export const ALLOWED_RESUBMISSION_SI_CODES = [ 'DOSFSC', 'DDASIT', 'DDSFSC', + 'IDFSIT', + 'IDASIT', + 'IDDSIT', + 'IDSFSC', + 'IOFSIT', + 'IOASIT', + 'IOPSIT', + 'IOSFSC', ]; diff --git a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.jsx b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.jsx new file mode 100644 index 00000000000..4de27935ee3 --- /dev/null +++ b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.jsx @@ -0,0 +1,103 @@ +import React from 'react'; +import { Formik } from 'formik'; +import { useNavigate, useParams, generatePath } from 'react-router-dom'; +import { FormGroup } from '@trussworks/react-uswds'; +import classnames from 'classnames'; + +import styles from './PrimeUIUpdateSITForms.module.scss'; + +import SectionWrapper from 'components/Customer/SectionWrapper'; +import formStyles from 'styles/form.module.scss'; +import { Form } from 'components/form/Form'; +import TextField from 'components/form/fields/TextField/TextField'; +import WizardNavigation from 'components/Customer/WizardNavigation/WizardNavigation'; +import descriptionListStyles from 'styles/descriptionList.module.scss'; +import { primeSimulatorRoutes } from 'constants/routes'; +import { DatePickerInput } from 'components/form/fields'; +import { SERVICE_ITEM_STATUSES } from 'constants/serviceItems'; + +const PrimeUIUpdateInternationalDestSITForm = ({ initialValues, onSubmit, serviceItem }) => { + const { moveCodeOrID } = useParams(); + const navigate = useNavigate(); + + const handleClose = () => { + navigate(generatePath(primeSimulatorRoutes.VIEW_MOVE_PATH, { moveCodeOrID })); + }; + + return ( + + {({ handleSubmit }) => ( +
+ +
+

Update International Destination SIT Service Item

+ +
+ Here you can update specific fields for an international destination SIT service item.
+ At this time, only the following values can be updated:
{' '} + + SIT Departure Date
+ SIT Requested Delivery
+ SIT Customer Contacted
+ Update Reason +
+
+
+
+ +

+ {serviceItem.reServiceCode} - {serviceItem.reServiceName} +

+
+
+
ID:
+
{serviceItem.id}
+
+
+
MTO ID:
+
{serviceItem.moveTaskOrderID}
+
+
+
Shipment ID:
+
{serviceItem.mtoShipmentID}
+
+
+
Status:
+
{serviceItem.status}
+
+
+
+ + + +
+ {serviceItem.status === SERVICE_ITEM_STATUSES.REJECTED && ( + + )} +
+ +
+
+
+ )} +
+ ); +}; + +export default PrimeUIUpdateInternationalDestSITForm; diff --git a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.test.jsx b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.test.jsx new file mode 100644 index 00000000000..2286ccacac8 --- /dev/null +++ b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.test.jsx @@ -0,0 +1,99 @@ +import React from 'react'; +import { screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; + +import PrimeUIUpdateDestSITForm from './PrimeUIUpdateDestSITForm'; + +import { fromPrimeAPIAddressFormat } from 'utils/formatters'; +import { renderWithProviders } from 'testUtils'; +import { primeSimulatorRoutes } from 'constants/routes'; + +const shipmentAddress = { + streetAddress1: '444 Main Ave', + streetAddress2: 'Apartment 9000', + streetAddress3: 'Something else', + city: 'Anytown', + state: 'AL', + postalCode: '90210', +}; + +const serviceItem = { + reServiceCode: 'IDDSIT', + reServiceName: 'International destination SIT delivery', +}; + +const reformatPrimeApiSITDestinationAddress = fromPrimeAPIAddressFormat(shipmentAddress); + +const destSitInitialValues = { + sitDestinationFinalAddress: reformatPrimeApiSITDestinationAddress, + sitDepartureDate: '01 Nov 2023', + sitRequestedDelivery: '01 Dec 2023', + sitCustomerContacted: '15 Oct 2023', + mtoServiceItemID: '45fe9475-d592-48f5-896a-45d4d6eb7e76', + reServiceCode: 'IDDSIT', +}; + +// Mock the react-router-dom functions +const mockNavigate = jest.fn(); +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useNavigate: () => mockNavigate, + useParams: jest.fn().mockReturnValue({ moveCodeOrID: ':moveCodeOrID' }), +})); + +describe('PrimeUIRequestInternationalSITDestAddressChangeForm', () => { + it('renders the address change request form', async () => { + renderWithProviders( + , + ); + + expect(screen.getByRole('heading', { name: 'Update Destination SIT Service Item', level: 2 })).toBeInTheDocument(); + expect( + screen.getByRole('heading', { name: 'IDDSIT - International destination SIT delivery', level: 3 }), + ).toBeInTheDocument(); + expect(await screen.findByLabelText('SIT Departure Date')).toHaveValue('01 Nov 2023'); + expect(await screen.findByLabelText('SIT Requested Delivery')).toHaveValue('01 Dec 2023'); + expect(await screen.findByLabelText('SIT Customer Contacted')).toHaveValue('15 Oct 2023'); + expect(screen.getByRole('button', { name: 'Save' })).toBeEnabled(); + expect(screen.getByRole('button', { name: 'Cancel' })).toBeEnabled(); + }); + + it('fires off onSubmit function when save button is clicked', async () => { + const onSubmitMock = jest.fn(); + renderWithProviders( + , + ); + + const saveButton = await screen.findByRole('button', { name: 'Save' }); + + await userEvent.click(saveButton); + + expect(onSubmitMock).toHaveBeenCalled(); + }); + + it('directs the user back to the move page when cancel button is clicked', async () => { + renderWithProviders( + , + ); + + const cancelButton = await screen.findByRole('button', { name: 'Cancel' }); + + await userEvent.click(cancelButton); + + expect(mockNavigate).toHaveBeenCalledWith(primeSimulatorRoutes.VIEW_MOVE_PATH); + }); +}); diff --git a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.jsx b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.jsx new file mode 100644 index 00000000000..eead130eff2 --- /dev/null +++ b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.jsx @@ -0,0 +1,103 @@ +import React from 'react'; +import { Formik } from 'formik'; +import { useNavigate, useParams, generatePath } from 'react-router-dom'; +import { FormGroup } from '@trussworks/react-uswds'; +import classnames from 'classnames'; + +import styles from './PrimeUIUpdateSITForms.module.scss'; + +import SectionWrapper from 'components/Customer/SectionWrapper'; +import formStyles from 'styles/form.module.scss'; +import { Form } from 'components/form/Form'; +import TextField from 'components/form/fields/TextField/TextField'; +import WizardNavigation from 'components/Customer/WizardNavigation/WizardNavigation'; +import descriptionListStyles from 'styles/descriptionList.module.scss'; +import { primeSimulatorRoutes } from 'constants/routes'; +import { DatePickerInput } from 'components/form/fields'; +import { SERVICE_ITEM_STATUSES } from 'constants/serviceItems'; + +const PrimeUIUpdateInternationalOriginSITForm = ({ initialValues, onSubmit, serviceItem }) => { + const { moveCodeOrID } = useParams(); + const navigate = useNavigate(); + + const handleClose = () => { + navigate(generatePath(primeSimulatorRoutes.VIEW_MOVE_PATH, { moveCodeOrID })); + }; + + return ( + + {({ handleSubmit }) => ( +
+ +
+

Update International Origin SIT Service Item

+ +
+ Here you can update specific fields for an origin SIT service item.
+ At this time, only the following values can be updated:
{' '} + + SIT Departure Date
+ SIT Requested Delivery
+ SIT Customer Contacted
+ Update Reason +
+
+
+
+ +

+ {serviceItem.reServiceCode} - {serviceItem.reServiceName} +

+
+
+
ID:
+
{serviceItem.id}
+
+
+
MTO ID:
+
{serviceItem.moveTaskOrderID}
+
+
+
Shipment ID:
+
{serviceItem.mtoShipmentID}
+
+
+
Status:
+
{serviceItem.status}
+
+
+
+ + + +
+ {serviceItem.status === SERVICE_ITEM_STATUSES.REJECTED && ( + + )} +
+ +
+
+
+ )} +
+ ); +}; + +export default PrimeUIUpdateInternationalOriginSITForm; diff --git a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.test.jsx b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.test.jsx new file mode 100644 index 00000000000..cad194d17c6 --- /dev/null +++ b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.test.jsx @@ -0,0 +1,84 @@ +import React from 'react'; +import { screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; + +import PrimeUIUpdateOriginSITForm from './PrimeUIUpdateOriginSITForm'; + +import { renderWithProviders } from 'testUtils'; +import { primeSimulatorRoutes } from 'constants/routes'; + +const originSitInitialValues = { + sitDepartureDate: '01 Nov 2023', + sitRequestedDelivery: '01 Dec 2023', + sitCustomerContacted: '15 Oct 2023', + mtoServiceItemID: '45fe9475-d592-48f5-896a-45d4d6eb7e76', + reServiceCode: 'IOPSIT', +}; + +const serviceItem = { + reServiceCode: 'IOPSIT', + reServiceName: 'International origin SIT pickup', +}; + +// Mock the react-router-dom functions +const mockNavigate = jest.fn(); +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useNavigate: () => mockNavigate, + useParams: jest.fn().mockReturnValue({ moveCodeOrID: ':moveCodeOrID' }), +})); + +describe('PrimeUIRequestInternationalSITDestAddressChangeForm', () => { + it('renders the address change request form', async () => { + renderWithProviders( + , + ); + + expect(screen.getByRole('heading', { name: 'Update Origin SIT Service Item', level: 2 })).toBeInTheDocument(); + expect( + screen.getByRole('heading', { name: 'IOPSIT - International origin SIT pickup', level: 3 }), + ).toBeInTheDocument(); + expect(await screen.findByLabelText('SIT Departure Date')).toHaveValue('01 Nov 2023'); + expect(await screen.findByLabelText('SIT Requested Delivery')).toHaveValue('01 Dec 2023'); + expect(await screen.findByLabelText('SIT Customer Contacted')).toHaveValue('15 Oct 2023'); + expect(screen.getByRole('button', { name: 'Save' })).toBeEnabled(); + expect(screen.getByRole('button', { name: 'Cancel' })).toBeEnabled(); + }); + + it('fires off onSubmit function when save button is clicked', async () => { + const onSubmitMock = jest.fn(); + renderWithProviders( + , + ); + + const saveButton = await screen.findByRole('button', { name: 'Save' }); + + await userEvent.click(saveButton); + + expect(onSubmitMock).toHaveBeenCalled(); + }); + + it('directs the user back to the move page when cancel button is clicked', async () => { + renderWithProviders( + , + ); + + const cancelButton = await screen.findByRole('button', { name: 'Cancel' }); + + await userEvent.click(cancelButton); + + expect(mockNavigate).toHaveBeenCalledWith(primeSimulatorRoutes.VIEW_MOVE_PATH); + }); +}); diff --git a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateServiceItem.jsx b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateServiceItem.jsx index 307303284f2..de05308a0d6 100644 --- a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateServiceItem.jsx +++ b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateServiceItem.jsx @@ -6,6 +6,8 @@ import { connect } from 'react-redux'; import PrimeUIUpdateOriginSITForm from './PrimeUIUpdateOriginSITForm'; import PrimeUIUpdateDestSITForm from './PrimeUIUpdateDestSITForm'; +import PrimeUIUpdateInternationalOriginSITForm from './PrimeUIUpdateInternationalOriginSITForm'; +import PrimeUIUpdateInternationalDestSITForm from './PrimeUIUpdateInternationalDestSITForm'; import PrimeUIUpdateInternationalFuelSurchargeForm from './PrimeUIUpdateInternationalFuelSurchargeForm'; import PrimeUIUpdateInternationalShuttleForm from './PrimeUIUpdateInternationalShuttleForm'; @@ -72,7 +74,12 @@ const PrimeUIUpdateServiceItem = ({ setFlashMessage }) => { const { modelType } = serviceItem; let initialValues; let onSubmit; - if (modelType === 'MTOServiceItemOriginSIT' || modelType === 'MTOServiceItemDestSIT') { + if ( + modelType === 'MTOServiceItemOriginSIT' || + modelType === 'MTOServiceItemDestSIT' || + modelType === 'MTOServiceItemInternationalDestSIT' || + modelType === 'MTOServiceItemInternationalOriginSIT' + ) { initialValues = { sitEntryDate: formatDateWithUTC(serviceItem.sitEntryDate, 'YYYY-MM-DD', 'DD MMM YYYY') || '', sitDepartureDate: formatDateWithUTC(serviceItem.sitDepartureDate, 'YYYY-MM-DD', 'DD MMM YYYY') || '', @@ -145,6 +152,21 @@ const PrimeUIUpdateServiceItem = ({ setFlashMessage }) => { onSubmit={onSubmit} /> ) : null} + {modelType === 'MTOServiceItemInternationalDestSIT' ? ( + + ) : null} + {modelType === 'MTOServiceItemInternationalOriginSIT' ? ( + + ) : null} {modelType === 'MTOServiceItemInternationalFuelSurcharge' ? ( { expect(screen.getByRole('textbox', { name: 'SIT Customer Contacted' })).toBeInTheDocument(); expect(screen.getByRole('textbox', { name: 'Update Reason' })).toBeInTheDocument(); }); + + it('renders the destination sit service item form - international', async () => { + const routingParams = { + moveCodeOrID: 'bf2fc98f-3cb5-40a0-a125-4c222096c35b', + mtoServiceItemId: '45fe9475-d592-48f5-896a-45d4d6eb7e76', + }; + + const renderComponent = () => { + render( + + + + + , + ); + }; + + const moveTaskOrder = { + id: '1', + moveCode: 'LN4T89', + mtoShipments: [ + { + id: '2', + shipmentType: 'HHG', + requestedPickupDate: '2021-11-26', + pickupAddress: { streetAddress1: '100 1st Avenue', city: 'New York', state: 'NY', postalCode: '10001' }, + }, + ], + mtoServiceItems: [ + { + reServiceCode: 'IDDSIT', + modelType: 'MTOServiceItemInternationalDestSIT', + reason: 'Holiday break', + sitDestinationFinalAddress: { + streetAddress1: '444 Main Ave', + streetAddress2: 'Apartment 9000', + streetAddress3: 'c/o Some Person', + city: 'Anytown', + state: 'AL', + postalCode: '90210', + }, + id: '45fe9475-d592-48f5-896a-45d4d6eb7e76', + status: 'REJECTED', + }, + ], + }; + + const moveReturnValue = { + moveTaskOrder, + isLoading: false, + isError: false, + }; + usePrimeSimulatorGetMove.mockReturnValue(moveReturnValue); + + renderComponent(); + + expect( + screen.getByRole('heading', { name: 'Update International Destination SIT Service Item', level: 2 }), + ).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'SIT Departure Date' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'SIT Requested Delivery' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'SIT Customer Contacted' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'Update Reason' })).toBeInTheDocument(); + }); + + it('renders the origin sit service item form - international', async () => { + const routingParams = { + moveCodeOrID: 'bf2fc98f-3cb5-40a0-a125-4c222096c35b', + mtoServiceItemId: '45fe9475-d592-48f5-896a-45d4d6eb7e76', + }; + + const renderComponent = () => { + render( + + + + + , + ); + }; + + const moveTaskOrder = { + id: '1', + moveCode: 'LN4T89', + mtoShipments: [ + { + id: '2', + shipmentType: 'HHG', + requestedPickupDate: '2021-11-26', + pickupAddress: { streetAddress1: '100 1st Avenue', city: 'New York', state: 'NY', postalCode: '10001' }, + }, + ], + mtoServiceItems: [ + { + reServiceCode: 'IDDSIT', + modelType: 'MTOServiceItemInternationalOriginSIT', + reason: 'Holiday break', + sitDestinationFinalAddress: { + streetAddress1: '444 Main Ave', + streetAddress2: 'Apartment 9000', + streetAddress3: 'c/o Some Person', + city: 'Anytown', + state: 'AL', + postalCode: '90210', + }, + id: '45fe9475-d592-48f5-896a-45d4d6eb7e76', + status: 'REJECTED', + }, + ], + }; + + const moveReturnValue = { + moveTaskOrder, + isLoading: false, + isError: false, + }; + usePrimeSimulatorGetMove.mockReturnValue(moveReturnValue); + + renderComponent(); + + expect( + screen.getByRole('heading', { name: 'Update International Origin SIT Service Item', level: 2 }), + ).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'SIT Departure Date' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'SIT Requested Delivery' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'SIT Customer Contacted' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'Update Reason' })).toBeInTheDocument(); + }); }); diff --git a/swagger-def/definitions/prime/MTOServiceItemInternationalDestSIT.yaml b/swagger-def/definitions/prime/MTOServiceItemInternationalDestSIT.yaml new file mode 100644 index 00000000000..c356798e521 --- /dev/null +++ b/swagger-def/definitions/prime/MTOServiceItemInternationalDestSIT.yaml @@ -0,0 +1,74 @@ +description: Describes a international destination SIT service item. Subtype of a MTOServiceItem. +allOf: + - $ref: 'MTOServiceItem.yaml' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDFSIT # International Destination First Day SIT + - IDASIT # International Destination Additional SIT + dateOfContact1: + format: date + type: string + description: Date of attempted contact by the prime corresponding to `timeMilitary1`. + x-nullable: true + dateOfContact2: + format: date + type: string + description: Date of attempted contact by the prime corresponding to `timeMilitary2`. + x-nullable: true + timeMilitary1: + type: string + example: 1400Z + description: Time of attempted contact corresponding to `dateOfContact1`, in military format. + pattern: '\d{4}Z' + x-nullable: true + timeMilitary2: + type: string + example: 1400Z + description: Time of attempted contact corresponding to `dateOfContact2`, in military format. + pattern: '\d{4}Z' + x-nullable: true + firstAvailableDeliveryDate1: + format: date + type: string + description: First available date that Prime can deliver SIT service item. + x-nullable: true + firstAvailableDeliveryDate2: + format: date + type: string + description: Second available date that Prime can deliver SIT service item. + x-nullable: true + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + description: Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + x-nullable: true + sitDestinationFinalAddress: + $ref: '../Address.yaml' + reason: + type: string + description: > + The reason item has been placed in SIT. + x-nullable: true + x-omitempty: false + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: Date when the customer contacted the prime for a delivery out of SIT. + x-nullable: true + required: + - reServiceCode + - sitEntryDate + - reason diff --git a/swagger-def/definitions/prime/MTOServiceItemInternationalOriginSIT.yaml b/swagger-def/definitions/prime/MTOServiceItemInternationalOriginSIT.yaml new file mode 100644 index 00000000000..26843f1c6ec --- /dev/null +++ b/swagger-def/definitions/prime/MTOServiceItemInternationalOriginSIT.yaml @@ -0,0 +1,50 @@ +description: Describes a international origin SIT service item. Subtype of a MTOServiceItem. +allOf: + - $ref: 'MTOServiceItem.yaml' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IOFSIT # International Origin First Day SIT + - IOASIT # International Origin Additional SIT + reason: + type: string + example: Storage items need to be picked up + description: Explanation of why Prime is picking up SIT item. + sitPostalCode: + type: string + format: zip + example: '90210' + pattern: '^(\d{5}([\-]\d{4})?)$' + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + x-nullable: true + description: Departure date for SIT. This is the end date of the SIT at either origin or destination. This is optional as it can be updated using the UpdateMTOServiceItemSIT modelType at a later date. + sitHHGActualOrigin: + $ref: '../Address.yaml' + sitHHGOriginalOrigin: + $ref: '../Address.yaml' + requestApprovalsRequestedStatus: + type: boolean + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: Date when the customer contacted the prime for a delivery out of SIT. + x-nullable: true + required: + - reServiceCode + - reason + - sitPostalCode + - sitEntryDate diff --git a/swagger-def/definitions/prime/MTOServiceItemModelType.yaml b/swagger-def/definitions/prime/MTOServiceItemModelType.yaml index 402844ae3ea..cbaeb7d4afe 100644 --- a/swagger-def/definitions/prime/MTOServiceItemModelType.yaml +++ b/swagger-def/definitions/prime/MTOServiceItemModelType.yaml @@ -6,6 +6,8 @@ description: > corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -19,6 +21,8 @@ enum: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticShuttle - MTOServiceItemInternationalShuttle diff --git a/swagger-def/prime.yaml b/swagger-def/prime.yaml index a26a330da88..6bfaed1fa76 100644 --- a/swagger-def/prime.yaml +++ b/swagger-def/prime.yaml @@ -756,6 +756,82 @@ paths: **Addt'l days destination SIT service item**. This represents an additional day of storage for the same item. Additional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**. + + --- + + **`MTOServiceItemInternationalOriginSIT`** + + MTOServiceItemInternationalOriginSIT is a subtype of MTOServiceItem. + + This model type describes a international origin SIT service item. Items can be created using this + model type with the following codes: + + **IOFSIT** + + **1st day origin SIT service item**. When a IOFSIT is requested, the API will auto-create the following group of service items: + * IOFSIT - International origin 1st day SIT + * IOASIT - International origin Additional day SIT + * IOPSIT - International origin SIT pickup + * IOSFSC - International origin SIT fuel surcharge + + **IOASIT** + + **Addt'l days origin SIT service item**. This represents an additional day of storage for the same item. + Additional IOASIT service items can be created and added to an existing shipment that **includes a IOFSIT service item**. + + --- + + **`MTOServiceItemInternationalDestSIT`** + + MTOServiceItemInternationalDestSIT is a subtype of MTOServiceItem. + + This model type describes a international destination SIT service item. Items can be created using this + model type with the following codes: + + **IDFSIT** + + **1st day destination SIT service item**. + + These additional fields are optional for creating a IDFSIT: + * `firstAvailableDeliveryDate1` + * string + * First available date that Prime can deliver SIT service item. + * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together + * `dateOfContact1` + * string + * Date of attempted contact by the prime corresponding to `timeMilitary1` + * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together + * `timeMilitary1` + * string\d{4}Z + * Time of attempted contact corresponding to `dateOfContact1`, in military format. + * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together + * `firstAvailableDeliveryDate2` + * string + * Second available date that Prime can deliver SIT service item. + * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together + * `dateOfContact2` + * string + * Date of attempted contact delivery by the prime corresponding to `timeMilitary2` + * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together + * `timeMilitary2` + * string\d{4}Z + * Time of attempted contact corresponding to `dateOfContact2`, in military format. + * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together + + When a IDFSIT is requested, the API will auto-create the following group of service items: + * IDFSIT - International destination 1st day SIT + * IDASIT - International destination Additional day SIT + * IDDSIT - International destination SIT delivery + * IDSFSC - International destination SIT fuel surcharge + + **NOTE** When providing the `sitEntryDate` value in the payload, please ensure that the date is not BEFORE + `firstAvailableDeliveryDate1` or `firstAvailableDeliveryDate2`. If it is, you will receive an error response. + + **IDASIT** + + **Addt'l days destination SIT service item**. This represents an additional day of storage for the same item. + Additional IDASIT service items can be created and added to an existing shipment that **includes a IDFSIT service item**. + operationId: createMTOServiceItem tags: - mtoServiceItem @@ -822,6 +898,14 @@ paths: - DOFSIT - DDSFSC - DOSFSC + - IDASIT + - IDDSIT + - IDFSIT + - IOASIT + - IOPSIT + - IOFSIT + - IDSFSC + - IOSFSC The following Accessorial service items can be resubmitted following a rejection: - IOSHUT @@ -1758,12 +1842,16 @@ definitions: $ref: 'definitions/prime/MTOServiceItemBasic.yaml' MTOServiceItemDestSIT: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemDestSIT.yaml' + MTOServiceItemInternationalDestSIT: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalDestSIT.yaml' MTOServiceItemDomesticCrating: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemDomesticCrating.yaml' MTOServiceItemInternationalCrating: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemInternationalCrating.yaml' MTOServiceItemOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemOriginSIT.yaml' + MTOServiceItemInternationalOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalOriginSIT.yaml' MTOServiceItemShuttle: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemShuttle.yaml' MTOServiceItemDomesticShuttle: # spectral oas2-unused-definition is OK here due to polymorphism @@ -1808,6 +1896,8 @@ definitions: This should be populated for the following service items: * DOASIT(Domestic origin Additional day SIT) * DDASIT(Domestic destination Additional day SIT) + * IOASIT(International origin Additional day SIT) + * IDASIT(International destination Additional day SIT) Both take in the following param keys: * `SITPaymentRequestStart` @@ -1852,6 +1942,14 @@ definitions: * DOFSIT - UpdateMTOServiceItemSIT * DOSFSC - UpdateMTOServiceItemSIT * DDSFSC - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IDFSIT - UpdateMTOServiceItemSIT + * IDASIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT + * IOSFSC - UpdateMTOServiceItemSIT + * IDSFSC - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * PODFSC - UpdateMTOServiceItemInternationalPortFSC @@ -1942,6 +2040,14 @@ definitions: - DOASIT # Domestic Origin Add'l Days SIT - DOFSIT # Domestic Origin 1st Day SIT - DOSFSC # Domestic Origin Fuel Surcharge + - IDDSIT # International Destination SIT Delivery + - IDASIT # International Destination Add'l Days SIT + - IDFSIT # International Destination 1st Day SIT + - IDSFSC # International Destination Fuel Surcharge + - IOPSIT # International Origin SIT Pickup + - IOASIT # International Origin Add'l Days SIT + - IOFSIT # International Origin 1st Day SIT + - IOSFSC # International Origin Fuel Surcharge sitDepartureDate: format: date type: string diff --git a/swagger-def/prime_v2.yaml b/swagger-def/prime_v2.yaml index 7569e750568..1458d5036a2 100644 --- a/swagger-def/prime_v2.yaml +++ b/swagger-def/prime_v2.yaml @@ -349,12 +349,16 @@ definitions: $ref: 'definitions/prime/MTOServiceItemBasic.yaml' MTOServiceItemDestSIT: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemDestSIT.yaml' + MTOServiceItemInternationalDestSIT: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalDestSIT.yaml' MTOServiceItemDomesticCrating: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemDomesticCrating.yaml' MTOServiceItemInternationalCrating: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemInternationalCrating.yaml' MTOServiceItemOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemOriginSIT.yaml' + MTOServiceItemInternationalOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalOriginSIT.yaml' MTOServiceItemShuttle: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemShuttle.yaml' MTOServiceItemDomesticShuttle: # spectral oas2-unused-definition is OK here due to polymorphism @@ -613,6 +617,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -916,6 +924,10 @@ definitions: - DOPSIT # Domestic Origin SIT Pickup - DOASIT # Domestic Origin Add'l Days SIT - DOFSIT # Domestic Origin 1st Day SIT + - IDDSIT # International Destination SIT Delivery + - IOPSIT # International Origin SIT Pickup + - IOASIT # International Origin Add'l Days SIT + - IOFSIT # International Origin 1st Day SIT sitDepartureDate: format: date type: string diff --git a/swagger-def/prime_v3.yaml b/swagger-def/prime_v3.yaml index 23931d3b314..0ffaebeec04 100644 --- a/swagger-def/prime_v3.yaml +++ b/swagger-def/prime_v3.yaml @@ -340,12 +340,16 @@ definitions: $ref: 'definitions/prime/MTOServiceItemBasic.yaml' MTOServiceItemDestSIT: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemDestSIT.yaml' + MTOServiceItemInternationalDestSIT: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalDestSIT.yaml' MTOServiceItemDomesticCrating: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemDomesticCrating.yaml' MTOServiceItemInternationalCrating: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemInternationalCrating.yaml' MTOServiceItemOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemOriginSIT.yaml' + MTOServiceItemInternationalOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalOriginSIT.yaml' MTOServiceItemShuttle: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemShuttle.yaml' MTOServiceItemDomesticShuttle: # spectral oas2-unused-definition is OK here due to polymorphism @@ -640,6 +644,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -1003,6 +1011,10 @@ definitions: - DOPSIT # Domestic Origin SIT Pickup - DOASIT # Domestic Origin Add'l Days SIT - DOFSIT # Domestic Origin 1st Day SIT + - IDDSIT # International Destination SIT Delivery + - IOPSIT # International Origin SIT Pickup + - IOASIT # International Origin Add'l Days SIT + - IOFSIT # International Origin 1st Day SIT sitDepartureDate: format: date type: string diff --git a/swagger/prime.yaml b/swagger/prime.yaml index bb6f1579545..8254fec88af 100644 --- a/swagger/prime.yaml +++ b/swagger/prime.yaml @@ -956,6 +956,112 @@ paths: Additional DDASIT service items can be created and added to an existing shipment that **includes a DDFSIT service item**. + + + --- + + + **`MTOServiceItemInternationalOriginSIT`** + + + MTOServiceItemInternationalOriginSIT is a subtype of MTOServiceItem. + + + This model type describes a international origin SIT service item. Items + can be created using this + + model type with the following codes: + + + **IOFSIT** + + + **1st day origin SIT service item**. When a IOFSIT is requested, the API + will auto-create the following group of service items: + * IOFSIT - International origin 1st day SIT + * IOASIT - International origin Additional day SIT + * IOPSIT - International origin SIT pickup + * IOSFSC - International origin SIT fuel surcharge + + **IOASIT** + + + **Addt'l days origin SIT service item**. This represents an additional + day of storage for the same item. + + Additional IOASIT service items can be created and added to an existing + shipment that **includes a IOFSIT service item**. + + + --- + + + **`MTOServiceItemInternationalDestSIT`** + + + MTOServiceItemInternationalDestSIT is a subtype of MTOServiceItem. + + + This model type describes a international destination SIT service item. + Items can be created using this + + model type with the following codes: + + + **IDFSIT** + + + **1st day destination SIT service item**. + + + These additional fields are optional for creating a IDFSIT: + * `firstAvailableDeliveryDate1` + * string + * First available date that Prime can deliver SIT service item. + * firstAvailableDeliveryDate1, dateOfContact1, and timeMilitary1 are required together + * `dateOfContact1` + * string + * Date of attempted contact by the prime corresponding to `timeMilitary1` + * dateOfContact1, timeMilitary1, and firstAvailableDeliveryDate1 are required together + * `timeMilitary1` + * string\d{4}Z + * Time of attempted contact corresponding to `dateOfContact1`, in military format. + * timeMilitary1, dateOfContact1, and firstAvailableDeliveryDate1 are required together + * `firstAvailableDeliveryDate2` + * string + * Second available date that Prime can deliver SIT service item. + * firstAvailableDeliveryDate2, dateOfContact2, and timeMilitary2 are required together + * `dateOfContact2` + * string + * Date of attempted contact delivery by the prime corresponding to `timeMilitary2` + * dateOfContact2, timeMilitary2, and firstAvailableDeliveryDate2 are required together + * `timeMilitary2` + * string\d{4}Z + * Time of attempted contact corresponding to `dateOfContact2`, in military format. + * timeMilitary2, dateOfContact2, and firstAvailableDeliveryDate2 are required together + + When a IDFSIT is requested, the API will auto-create the following group + of service items: + * IDFSIT - International destination 1st day SIT + * IDASIT - International destination Additional day SIT + * IDDSIT - International destination SIT delivery + * IDSFSC - International destination SIT fuel surcharge + + **NOTE** When providing the `sitEntryDate` value in the payload, please + ensure that the date is not BEFORE + + `firstAvailableDeliveryDate1` or `firstAvailableDeliveryDate2`. If it + is, you will receive an error response. + + + **IDASIT** + + + **Addt'l days destination SIT service item**. This represents an + additional day of storage for the same item. + + Additional IDASIT service items can be created and added to an existing + shipment that **includes a IDFSIT service item**. operationId: createMTOServiceItem tags: - mtoServiceItem @@ -1059,6 +1165,22 @@ paths: - DOSFSC + - IDASIT + + - IDDSIT + + - IDFSIT + + - IOASIT + + - IOPSIT + + - IOFSIT + + - IDSFSC + + - IOSFSC + The following Accessorial service items can be resubmitted following a rejection: @@ -2382,6 +2504,96 @@ definitions: - reServiceCode - sitEntryDate - reason + MTOServiceItemInternationalDestSIT: + description: >- + Describes a international destination SIT service item. Subtype of a + MTOServiceItem. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDFSIT + - IDASIT + dateOfContact1: + format: date + type: string + description: >- + Date of attempted contact by the prime corresponding to + `timeMilitary1`. + x-nullable: true + dateOfContact2: + format: date + type: string + description: >- + Date of attempted contact by the prime corresponding to + `timeMilitary2`. + x-nullable: true + timeMilitary1: + type: string + example: 1400Z + description: >- + Time of attempted contact corresponding to `dateOfContact1`, in + military format. + pattern: \d{4}Z + x-nullable: true + timeMilitary2: + type: string + example: 1400Z + description: >- + Time of attempted contact corresponding to `dateOfContact2`, in + military format. + pattern: \d{4}Z + x-nullable: true + firstAvailableDeliveryDate1: + format: date + type: string + description: First available date that Prime can deliver SIT service item. + x-nullable: true + firstAvailableDeliveryDate2: + format: date + type: string + description: Second available date that Prime can deliver SIT service item. + x-nullable: true + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + description: >- + Departure date for SIT. This is the end date of the SIT at either + origin or destination. This is optional as it can be updated using + the UpdateMTOServiceItemSIT modelType at a later date. + x-nullable: true + sitDestinationFinalAddress: + $ref: '#/definitions/Address' + reason: + type: string + description: | + The reason item has been placed in SIT. + x-nullable: true + x-omitempty: false + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: >- + Date when the customer contacted the prime for a delivery out of + SIT. + x-nullable: true + required: + - reServiceCode + - sitEntryDate + - reason MTOServiceItemDomesticCrating: description: >- Describes a domestic crating/uncrating service item subtype of a @@ -2540,6 +2752,64 @@ definitions: - reason - sitPostalCode - sitEntryDate + MTOServiceItemInternationalOriginSIT: + description: >- + Describes a international origin SIT service item. Subtype of a + MTOServiceItem. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IOFSIT + - IOASIT + reason: + type: string + example: Storage items need to be picked up + description: Explanation of why Prime is picking up SIT item. + sitPostalCode: + type: string + format: zip + example: '90210' + pattern: ^(\d{5}([\-]\d{4})?)$ + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + x-nullable: true + description: >- + Departure date for SIT. This is the end date of the SIT at either + origin or destination. This is optional as it can be updated using + the UpdateMTOServiceItemSIT modelType at a later date. + sitHHGActualOrigin: + $ref: '#/definitions/Address' + sitHHGOriginalOrigin: + $ref: '#/definitions/Address' + requestApprovalsRequestedStatus: + type: boolean + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: >- + Date when the customer contacted the prime for a delivery out of + SIT. + x-nullable: true + required: + - reServiceCode + - reason + - sitPostalCode + - sitEntryDate MTOServiceItemShuttle: description: Describes a shuttle service item. allOf: @@ -2737,6 +3007,8 @@ definitions: This should be populated for the following service items: * DOASIT(Domestic origin Additional day SIT) * DDASIT(Domestic destination Additional day SIT) + * IOASIT(International origin Additional day SIT) + * IDASIT(International destination Additional day SIT) Both take in the following param keys: * `SITPaymentRequestStart` @@ -2785,6 +3057,14 @@ definitions: * DOFSIT - UpdateMTOServiceItemSIT * DOSFSC - UpdateMTOServiceItemSIT * DDSFSC - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IDFSIT - UpdateMTOServiceItemSIT + * IDASIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT + * IOSFSC - UpdateMTOServiceItemSIT + * IDSFSC - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * PODFSC - UpdateMTOServiceItemInternationalPortFSC @@ -2889,6 +3169,14 @@ definitions: - DOASIT - DOFSIT - DOSFSC + - IDDSIT + - IDASIT + - IDFSIT + - IDSFSC + - IOPSIT + - IOASIT + - IOFSIT + - IOSFSC sitDepartureDate: format: date type: string @@ -3966,6 +4254,8 @@ definitions: corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -3979,6 +4269,8 @@ definitions: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticShuttle - MTOServiceItemInternationalShuttle diff --git a/swagger/prime_v2.yaml b/swagger/prime_v2.yaml index da357c863cd..47c35e53f01 100644 --- a/swagger/prime_v2.yaml +++ b/swagger/prime_v2.yaml @@ -487,6 +487,96 @@ definitions: - reServiceCode - sitEntryDate - reason + MTOServiceItemInternationalDestSIT: + description: >- + Describes a international destination SIT service item. Subtype of a + MTOServiceItem. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDFSIT + - IDASIT + dateOfContact1: + format: date + type: string + description: >- + Date of attempted contact by the prime corresponding to + `timeMilitary1`. + x-nullable: true + dateOfContact2: + format: date + type: string + description: >- + Date of attempted contact by the prime corresponding to + `timeMilitary2`. + x-nullable: true + timeMilitary1: + type: string + example: 1400Z + description: >- + Time of attempted contact corresponding to `dateOfContact1`, in + military format. + pattern: \d{4}Z + x-nullable: true + timeMilitary2: + type: string + example: 1400Z + description: >- + Time of attempted contact corresponding to `dateOfContact2`, in + military format. + pattern: \d{4}Z + x-nullable: true + firstAvailableDeliveryDate1: + format: date + type: string + description: First available date that Prime can deliver SIT service item. + x-nullable: true + firstAvailableDeliveryDate2: + format: date + type: string + description: Second available date that Prime can deliver SIT service item. + x-nullable: true + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + description: >- + Departure date for SIT. This is the end date of the SIT at either + origin or destination. This is optional as it can be updated using + the UpdateMTOServiceItemSIT modelType at a later date. + x-nullable: true + sitDestinationFinalAddress: + $ref: '#/definitions/Address' + reason: + type: string + description: | + The reason item has been placed in SIT. + x-nullable: true + x-omitempty: false + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: >- + Date when the customer contacted the prime for a delivery out of + SIT. + x-nullable: true + required: + - reServiceCode + - sitEntryDate + - reason MTOServiceItemDomesticCrating: description: >- Describes a domestic crating/uncrating service item subtype of a @@ -645,6 +735,64 @@ definitions: - reason - sitPostalCode - sitEntryDate + MTOServiceItemInternationalOriginSIT: + description: >- + Describes a international origin SIT service item. Subtype of a + MTOServiceItem. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IOFSIT + - IOASIT + reason: + type: string + example: Storage items need to be picked up + description: Explanation of why Prime is picking up SIT item. + sitPostalCode: + type: string + format: zip + example: '90210' + pattern: ^(\d{5}([\-]\d{4})?)$ + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + x-nullable: true + description: >- + Departure date for SIT. This is the end date of the SIT at either + origin or destination. This is optional as it can be updated using + the UpdateMTOServiceItemSIT modelType at a later date. + sitHHGActualOrigin: + $ref: '#/definitions/Address' + sitHHGOriginalOrigin: + $ref: '#/definitions/Address' + requestApprovalsRequestedStatus: + type: boolean + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: >- + Date when the customer contacted the prime for a delivery out of + SIT. + x-nullable: true + required: + - reServiceCode + - reason + - sitPostalCode + - sitEntryDate MTOServiceItemShuttle: description: Describes a shuttle service item. allOf: @@ -1061,6 +1209,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -1429,6 +1581,10 @@ definitions: - DOPSIT - DOASIT - DOFSIT + - IDDSIT + - IOPSIT + - IOASIT + - IOFSIT sitDepartureDate: format: date type: string @@ -2221,6 +2377,8 @@ definitions: corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -2234,6 +2392,8 @@ definitions: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticShuttle - MTOServiceItemInternationalShuttle diff --git a/swagger/prime_v3.yaml b/swagger/prime_v3.yaml index 181d35913bc..ae85dbaa9a2 100644 --- a/swagger/prime_v3.yaml +++ b/swagger/prime_v3.yaml @@ -464,6 +464,96 @@ definitions: - reServiceCode - sitEntryDate - reason + MTOServiceItemInternationalDestSIT: + description: >- + Describes a international destination SIT service item. Subtype of a + MTOServiceItem. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDFSIT + - IDASIT + dateOfContact1: + format: date + type: string + description: >- + Date of attempted contact by the prime corresponding to + `timeMilitary1`. + x-nullable: true + dateOfContact2: + format: date + type: string + description: >- + Date of attempted contact by the prime corresponding to + `timeMilitary2`. + x-nullable: true + timeMilitary1: + type: string + example: 1400Z + description: >- + Time of attempted contact corresponding to `dateOfContact1`, in + military format. + pattern: \d{4}Z + x-nullable: true + timeMilitary2: + type: string + example: 1400Z + description: >- + Time of attempted contact corresponding to `dateOfContact2`, in + military format. + pattern: \d{4}Z + x-nullable: true + firstAvailableDeliveryDate1: + format: date + type: string + description: First available date that Prime can deliver SIT service item. + x-nullable: true + firstAvailableDeliveryDate2: + format: date + type: string + description: Second available date that Prime can deliver SIT service item. + x-nullable: true + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + description: >- + Departure date for SIT. This is the end date of the SIT at either + origin or destination. This is optional as it can be updated using + the UpdateMTOServiceItemSIT modelType at a later date. + x-nullable: true + sitDestinationFinalAddress: + $ref: '#/definitions/Address' + reason: + type: string + description: | + The reason item has been placed in SIT. + x-nullable: true + x-omitempty: false + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: >- + Date when the customer contacted the prime for a delivery out of + SIT. + x-nullable: true + required: + - reServiceCode + - sitEntryDate + - reason MTOServiceItemDomesticCrating: description: >- Describes a domestic crating/uncrating service item subtype of a @@ -622,6 +712,64 @@ definitions: - reason - sitPostalCode - sitEntryDate + MTOServiceItemInternationalOriginSIT: + description: >- + Describes a international origin SIT service item. Subtype of a + MTOServiceItem. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IOFSIT + - IOASIT + reason: + type: string + example: Storage items need to be picked up + description: Explanation of why Prime is picking up SIT item. + sitPostalCode: + type: string + format: zip + example: '90210' + pattern: ^(\d{5}([\-]\d{4})?)$ + sitEntryDate: + format: date + type: string + description: Entry date for the SIT + sitDepartureDate: + format: date + type: string + x-nullable: true + description: >- + Departure date for SIT. This is the end date of the SIT at either + origin or destination. This is optional as it can be updated using + the UpdateMTOServiceItemSIT modelType at a later date. + sitHHGActualOrigin: + $ref: '#/definitions/Address' + sitHHGOriginalOrigin: + $ref: '#/definitions/Address' + requestApprovalsRequestedStatus: + type: boolean + sitRequestedDelivery: + format: date + type: string + description: Date when the customer has requested delivery out of SIT. + x-nullable: true + sitCustomerContacted: + format: date + type: string + description: >- + Date when the customer contacted the prime for a delivery out of + SIT. + x-nullable: true + required: + - reServiceCode + - reason + - sitPostalCode + - sitEntryDate MTOServiceItemShuttle: description: Describes a shuttle service item. allOf: @@ -1099,6 +1247,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -1536,6 +1688,10 @@ definitions: - DOPSIT - DOASIT - DOFSIT + - IDDSIT + - IOPSIT + - IOASIT + - IOFSIT sitDepartureDate: format: date type: string @@ -2328,6 +2484,8 @@ definitions: corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DOSHUT, DDSHUT - MTOServiceItemDomesticShuttle * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle @@ -2341,6 +2499,8 @@ definitions: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticShuttle - MTOServiceItemInternationalShuttle