From 33a5ac0ee66390483373a2bc845a66c90e01e8f8 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Wed, 22 Jan 2025 17:35:40 +0000 Subject: [PATCH 01/15] initial --- pkg/gen/primeapi/embedded_spec.go | 364 ++++++- pkg/gen/primemessages/m_t_o_service_item.go | 12 + ...o_service_item_international_dest_s_i_t.go | 987 ++++++++++++++++++ ...service_item_international_origin_s_i_t.go | 900 ++++++++++++++++ .../m_t_o_service_item_model_type.go | 10 +- .../update_m_t_o_service_item_model_type.go | 8 + .../update_m_t_o_service_item_s_i_t.go | 8 +- pkg/gen/primev2api/embedded_spec.go | 8 +- .../m_t_o_service_item_model_type.go | 10 +- pkg/gen/primev3api/embedded_spec.go | 8 +- .../m_t_o_service_item_model_type.go | 10 +- pkg/handlers/primeapi/mto_service_item.go | 12 +- .../primeapi/payloads/payload_to_model.go | 147 +++ .../primeapiv3/payloads/model_to_payload.go | 57 + pkg/models/re_service.go | 4 + .../mto_service_item_creator.go | 106 +- .../mto_service_item_validators.go | 8 + .../sit_entry_date_updater.go | 13 +- .../ServiceItemDetails/ServiceItemDetails.jsx | 98 +- .../ServiceItemsTable/ServiceItemsTable.jsx | 2 +- .../CreateShipmentServiceItemForm.jsx | 14 + ...rnationalDestinationSITServiceItemForm.jsx | 133 +++ .../InternationalOriginSITServiceItemForm.jsx | 110 ++ src/constants/prime.js | 2 + src/constants/serviceItems.js | 29 + src/constants/sitUpdates.js | 10 +- .../PrimeUIUpdateInternationalDestSITForm.jsx | 103 ++ ...rimeUIUpdateInternationalOriginSITForm.jsx | 103 ++ .../PrimeUIUpdateSitServiceItem.jsx | 17 + .../MTOServiceItemInternationalDestSIT.yaml | 74 ++ .../MTOServiceItemInternationalOriginSIT.yaml | 50 + .../prime/MTOServiceItemModelType.yaml | 4 + swagger-def/prime.yaml | 20 + swagger/prime.yaml | 168 +++ swagger/prime_v2.yaml | 4 + swagger/prime_v3.yaml | 4 + 36 files changed, 3561 insertions(+), 56 deletions(-) create mode 100644 pkg/gen/primemessages/m_t_o_service_item_international_dest_s_i_t.go create mode 100644 pkg/gen/primemessages/m_t_o_service_item_international_origin_s_i_t.go create mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx create mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx create mode 100644 src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalDestSITForm.jsx create mode 100644 src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateInternationalOriginSITForm.jsx create mode 100644 swagger-def/definitions/prime/MTOServiceItemInternationalDestSIT.yaml create mode 100644 swagger-def/definitions/prime/MTOServiceItemInternationalOriginSIT.yaml diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index 5ce22a16bfb..f176b90dda0 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -2358,6 +2358,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": [ @@ -2383,13 +2479,85 @@ 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 + } + } + } + ] + }, "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 * 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 * 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", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", @@ -3981,7 +4149,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\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\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -4033,7 +4201,15 @@ func init() { "DOPSIT", "DOASIT", "DOFSIT", - "DOSFSC" + "DOSFSC", + "IDDSIT", + "IDASIT", + "IDFSIT", + "IDSFSC", + "IOPSIT", + "IOASIT", + "IOFSIT", + "IOSFSC" ] }, "requestApprovalsRequestedStatus": { @@ -7277,6 +7453,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": [ @@ -7302,13 +7574,85 @@ 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 + } + } + } + ] + }, "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 * 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 * 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", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", @@ -8905,7 +9249,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\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\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", @@ -8957,7 +9301,15 @@ func init() { "DOPSIT", "DOASIT", "DOFSIT", - "DOSFSC" + "DOSFSC", + "IDDSIT", + "IDASIT", + "IDFSIT", + "IDSFSC", + "IOPSIT", + "IOASIT", + "IOFSIT", + "IOSFSC" ] }, "requestApprovalsRequestedStatus": { diff --git a/pkg/gen/primemessages/m_t_o_service_item.go b/pkg/gen/primemessages/m_t_o_service_item.go index 1db2b84d144..952e0cd6262 100644 --- a/pkg/gen/primemessages/m_t_o_service_item.go +++ b/pkg/gen/primemessages/m_t_o_service_item.go @@ -279,12 +279,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 "MTOServiceItemOriginSIT": var result MTOServiceItemOriginSIT 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 ffdea3d8c15..97a7fb5aa78 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 // - DCRT, DUCRT - MTOServiceItemDomesticCrating // - ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -49,6 +51,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" @@ -67,7 +75,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemInternationalOriginSIT","MTOServiceItemInternationalDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { 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 40e86f82729..0d32c178283 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 f907813b53b..ef97fe89ca4 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -1480,12 +1480,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 * 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 * 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", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", @@ -5102,12 +5104,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 * 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 * 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", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", 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 58755658344..6df5c56d616 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 // - DCRT, DUCRT - MTOServiceItemDomesticCrating // - ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -49,6 +51,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" @@ -67,7 +75,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemInternationalOriginSIT","MTOServiceItemInternationalDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &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 df6a51d3016..90e5c173345 100644 --- a/pkg/gen/primev3api/embedded_spec.go +++ b/pkg/gen/primev3api/embedded_spec.go @@ -1642,12 +1642,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 * 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 * 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", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", @@ -5949,12 +5951,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 * 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 * 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", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", 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 50a9d22e418..afb2b2d305b 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 // - DCRT, DUCRT - MTOServiceItemDomesticCrating // - ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -49,6 +51,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" @@ -67,7 +75,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemInternationalOriginSIT","MTOServiceItemInternationalDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &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 7dad26d373b..b51255d2e01 100644 --- a/pkg/handlers/primeapi/mto_service_item.go +++ b/pkg/handlers/primeapi/mto_service_item.go @@ -25,11 +25,13 @@ 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.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, - primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemOriginSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemDestSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalOriginSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalDestSIT: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemShuttle: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, } // CreateMTOServiceItemHandler is the handler to create MTO service items diff --git a/pkg/handlers/primeapi/payloads/payload_to_model.go b/pkg/handlers/primeapi/payloads/payload_to_model.go index 08a64b02b82..a53262533ca 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 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 + } + + 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 DDFSIT + if model.ReService.Code == models.ReServiceCodeDDFSIT { + 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 @@ -830,6 +932,31 @@ func validateDDFSITForCreate(m primemessages.MTOServiceItemDestSIT) *validate.Er return verrs } +// validateIDFSITForCreate validates DDFSIT 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("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 primemessages.UpdateMTOServiceItemSIT) *validate.Errors { verrs := validate.NewErrors() @@ -865,6 +992,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() @@ -874,3 +1011,13 @@ func validateReasonOriginSIT(m primemessages.MTOServiceItemOriginSIT) *validate. } return verrs } + +// 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/primeapiv3/payloads/model_to_payload.go b/pkg/handlers/primeapiv3/payloads/model_to_payload.go index fc11ef66bac..f3e438119a7 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload.go @@ -737,6 +737,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.MTOServiceItemOriginSIT{ + 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 @@ -781,7 +795,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.MTOServiceItemDestSIT{ + 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/models/re_service.go b/pkg/models/re_service.go index 5fc9d9b3e75..5822b7f312d 100644 --- a/pkg/models/re_service.go +++ b/pkg/models/re_service.go @@ -83,6 +83,8 @@ const ( ReServiceCodeIDDSIT ReServiceCode = "IDDSIT" // ReServiceCodeIDFSIT International destination 1st day SIT ReServiceCodeIDFSIT ReServiceCode = "IDFSIT" + // ReServiceCodeIDSFSC International destination SIT FSC + ReServiceCodeIDSFSC ReServiceCode = "IDSFSC" // ReServiceCodeIDSHUT International destination shuttle service ReServiceCodeIDSHUT ReServiceCode = "IDSHUT" // ReServiceCodeIHPK International HHG pack @@ -105,6 +107,8 @@ const ( ReServiceCodeIOOUB ReServiceCode = "IOOUB" // ReServiceCodeIOPSIT International origin SIT pickup ReServiceCodeIOPSIT ReServiceCode = "IOPSIT" + // ReServiceCodeIOSFSC International origin SIT FSC + ReServiceCodeIOSFSC ReServiceCode = "IOSFSC" // ReServiceCodeIOSHUT International origin shuttle service ReServiceCodeIOSHUT ReServiceCode = "IOSHUT" // ReServiceCodeIUBPK International UB pack 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 6bac7e4ec89..405e4d35076 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator.go +++ b/pkg/services/mto_service_item/mto_service_item_creator.go @@ -9,6 +9,7 @@ import ( "github.com/gobuffalo/validate/v3" "github.com/gofrs/uuid" "go.uber.org/zap" + "golang.org/x/exp/slices" "github.com/transcom/mymove/pkg/appcontext" "github.com/transcom/mymove/pkg/apperror" @@ -444,25 +445,43 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } } + err = validateSITServiceItem(mtoShipment, *serviceItem) + if err != nil { + return nil, nil, err + } + // 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 } @@ -477,7 +496,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, @@ -485,15 +506,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)) @@ -542,13 +567,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 @@ -558,12 +586,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 } @@ -917,6 +950,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)) @@ -937,3 +974,42 @@ func (o *mtoServiceItemCreator) validateFirstDaySITServiceItem(appCtx appcontext return &extraServiceItems, nil } + +func validateSITServiceItem(mtoShipment models.MTOShipment, serviceItem models.MTOServiceItem) error { + marketToAllowableReServiceCodesMap := make(map[models.MarketCode][]models.ReServiceCode) + marketToAllowableReServiceCodesMap[models.MarketCodeDomestic] = []models.ReServiceCode{ + models.ReServiceCodeDDDSIT, + models.ReServiceCodeDDASIT, + models.ReServiceCodeDDFSIT, + models.ReServiceCodeDDSFSC, + models.ReServiceCodeDOPSIT, + models.ReServiceCodeDOFSIT, + models.ReServiceCodeDOASIT, + models.ReServiceCodeDOSFSC, + } + marketToAllowableReServiceCodesMap[models.MarketCodeInternational] = []models.ReServiceCode{ + models.ReServiceCodeIDDSIT, + models.ReServiceCodeIDASIT, + models.ReServiceCodeIDFSIT, + models.ReServiceCodeIDSFSC, + models.ReServiceCodeIOPSIT, + models.ReServiceCodeIOFSIT, + models.ReServiceCodeIOASIT, + models.ReServiceCodeIOSFSC, + } + + values, contains := marketToAllowableReServiceCodesMap[mtoShipment.MarketCode] + if !contains { + return apperror.NewNotImplementedError(fmt.Sprintf("validateSITServiceItem - MarketCode: %s is not implemented", mtoShipment.MarketCode)) + } + + // check if there is miss match of ReServiceCode and marketCode of shipment(domestic or international). ie..cannot send in + // IOFSIT(international) when shipment is domestic. + if !slices.Contains(values, serviceItem.ReService.Code) { + return apperror.NewConflictError( + serviceItem.MoveTaskOrderID, + fmt.Sprintf("Cannot create service item due to mismatched market to provided ReServiceCode. Market:%s, ServiceItem.ReService.Code:%s", mtoShipment.MarketCode, serviceItem.ReService.Code), + ) + } + return nil +} 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 e6111caa531..af1c8783993 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 destSITServiceItems = []models.ReServiceCode{ 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 61bc78bb988..0e9d3d82397 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 @@ -52,9 +52,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.") } @@ -62,16 +63,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/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx index 689a790ca64..a1c3bd4a950 100644 --- a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx +++ b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx @@ -39,6 +39,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai 'Customer contact 1': '-', }); const numberOfDaysApprovedForDOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; + const numberOfDaysApprovedForIOASIT = 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 === 'DDFSIT' || code === 'IDFSIT' ? generateDetailText({ 'Original Delivery Address': originalDeliveryAddress ? formatCityStateAndPostalCode(originalDeliveryAddress) @@ -87,7 +88,36 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {code === 'DDSFSC' + {code === '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 ? `${numberOfDaysApprovedForIOASIT} days` : '-', + 'SIT expiration date': sitEndDate || '-', + }, + id, + )} + {!isEmpty(serviceRequestDocUploads) ? ( +
+

Download service item documentation:

+ {serviceRequestDocUploads.map((file) => ( +
+ + {trimFileName(file.filename)} + +
+ ))} +
+ ) : null} + + )} + {code === 'DDSFSC' || code === 'IDSFSC' ? generateDetailText( { 'Original Delivery Address': originalDeliveryAddress @@ -140,6 +170,44 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} + {code === 'IDDSIT' && ( + <> + {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) => ( +
+ + {trimFileName(file.filename)} + +
+ ))} +
+ ) : null} + + )} {code === 'DDFSIT' && ( <> {!isEmpty(sortedCustomerContacts) @@ -188,7 +256,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s let detailSection; switch (code) { - case 'DOFSIT': { + case 'DOFSIT': + case 'IOFSIT': { detailSection = (
@@ -221,8 +290,9 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOASIT': { - const numberOfDaysApprovedForDOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; + case 'DOASIT': + case 'IOASIT': { + const numberOfDaysApprovedForIOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; const sitEndDate = sitStatus && sitStatus.currentSIT?.sitAuthorizedEndDate && @@ -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 ? `${numberOfDaysApprovedForIOASIT} days` : '-', 'SIT expiration date': sitEndDate || '-', 'Customer contacted homesafe': details.sitCustomerContacted ? formatDateWithUTC(details.sitCustomerContacted, 'DD MMM YYYY') @@ -272,7 +342,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOPSIT': { + case 'DOPSIT': + case 'IOPSIT': { detailSection = (
@@ -307,7 +378,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOSFSC': { + case 'DOSFSC': + case 'IOSFSC': { detailSection = (
@@ -343,7 +415,9 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s break; } case 'DDFSIT': - case 'DDASIT': { + case 'DDASIT': + case 'IDFSIT': + case 'IDASIT': { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, @@ -354,7 +428,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DDDSIT': { + case 'DDDSIT': + case 'IDDSIT': { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, @@ -365,7 +440,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DDSFSC': { + case 'DDSFSC': + case 'IDSFSC': { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, diff --git a/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx b/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx index 1b8aeb3383c..2c10239a2a0 100644 --- a/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx +++ b/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx @@ -305,7 +305,7 @@ const ServiceItemsTable = ({ className="text-blue usa-button--unstyled margin-left-1" disabled={hasPaymentRequestBeenMade || isMoveLocked} onClick={() => { - if (code === 'DDFSIT' || code === 'DOFSIT') { + if (code === 'DDFSIT' || code === 'DOFSIT' || code === 'IDFSIT' || code === 'IOFSIT') { handleShowEditSitEntryDateModal(id, mtoShipmentID); } else { handleShowEditSitAddressModal(id, mtoShipmentID); diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx index 15ccedb7d41..b69ecdad380 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'; @@ -19,6 +21,8 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) const { MTOServiceItemOriginSIT, MTOServiceItemDestSIT, + MTOServiceItemInternationalOriginSIT, + MTOServiceItemInternationalDestSIT, MTOServiceItemShuttle, MTOServiceItemDomesticCrating, MTOServiceItemInternationalCrating, @@ -47,6 +51,8 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) <> + + {enableAlaskaFeatureFlag && } @@ -58,6 +64,14 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) {selectedServiceItemType === MTOServiceItemDestSIT && ( )} + + {selectedServiceItemType === MTOServiceItemInternationalOriginSIT && ( + + )} + {selectedServiceItemType === MTOServiceItemInternationalDestSIT && ( + + )} + {selectedServiceItemType === MTOServiceItemShuttle && ( )} diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx new file mode 100644 index 00000000000..14aab88084a --- /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:
+ DDFSIT (Destination 1st day SIT)
+ DDASIT (Destination additional days SIT)
+ DDDSIT (Destination SIT delivery)
+ DDSFSC (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/InternationalOriginSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx new file mode 100644 index 00000000000..dc0a094914f --- /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/constants/prime.js b/src/constants/prime.js index 098dfe54dc7..7dbb5998b23 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', MTOServiceItemShuttle: 'MTOServiceItemShuttle', MTOServiceItemDomesticCrating: 'MTOServiceItemDomesticCrating', MTOServiceItemInternationalCrating: 'MTOServiceItemInternationalCrating', diff --git a/src/constants/serviceItems.js b/src/constants/serviceItems.js index 01dad1c3eb0..fc23a504bb4 100644 --- a/src/constants/serviceItems.js +++ b/src/constants/serviceItems.js @@ -150,6 +150,14 @@ 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', }; const SERVICE_ITEMS_ALLOWED_WEIGHT_BILLED_PARAM = [ @@ -177,6 +185,15 @@ const SIT_SERVICE_ITEMS_ALLOWED_UPDATE = [ SERVICE_ITEM_CODES.DDFSIT, SERVICE_ITEM_CODES.DOSFSC, SERVICE_ITEM_CODES.DDSFSC, + + 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, ]; /** @@ -195,6 +212,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/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/PrimeUIUpdateSitServiceItem.jsx b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateSitServiceItem.jsx index 0a39bc1e6a3..86704af666c 100644 --- a/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateSitServiceItem.jsx +++ b/src/pages/PrimeUI/UpdateServiceItems/PrimeUIUpdateSitServiceItem.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 { updateMTOServiceItem } from 'services/primeApi'; import scrollToTop from 'shared/scrollToTop'; @@ -136,6 +138,21 @@ const PrimeUIUpdateSitServiceItem = ({ setFlashMessage }) => { onSubmit={onSubmit} /> ) : null} + {modelType === 'MTOServiceItemInternationalDestSIT' ? ( + + ) : null} + {modelType === 'MTOServiceItemInternationalOriginSIT' ? ( + + ) : null} 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 f96badf678a..96c05c0547c 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 * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -17,6 +19,8 @@ enum: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating diff --git a/swagger-def/prime.yaml b/swagger-def/prime.yaml index f34788446eb..0ee109cfb62 100644 --- a/swagger-def/prime.yaml +++ b/swagger-def/prime.yaml @@ -1683,12 +1683,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' MTOServiceItemInternationalFuelSurcharge: # spectral oas2-unused-definition is OK here due to polymorphism @@ -1773,6 +1777,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 @@ -1828,6 +1840,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/prime.yaml b/swagger/prime.yaml index bcd51fed89d..072df16fe6a 100644 --- a/swagger/prime.yaml +++ b/swagger/prime.yaml @@ -2269,6 +2269,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 @@ -2427,6 +2517,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: @@ -2577,6 +2725,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 @@ -2640,6 +2796,14 @@ definitions: - DOASIT - DOFSIT - DOSFSC + - IDDSIT + - IDASIT + - IDFSIT + - IDSFSC + - IOPSIT + - IOASIT + - IOFSIT + - IOSFSC sitDepartureDate: format: date type: string @@ -3651,6 +3815,8 @@ definitions: corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -3662,6 +3828,8 @@ definitions: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating diff --git a/swagger/prime_v2.yaml b/swagger/prime_v2.yaml index 53b2599b343..271d94ee262 100644 --- a/swagger/prime_v2.yaml +++ b/swagger/prime_v2.yaml @@ -2067,6 +2067,8 @@ definitions: corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -2078,6 +2080,8 @@ definitions: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating diff --git a/swagger/prime_v3.yaml b/swagger/prime_v3.yaml index 21a25cbfa99..1add954fb3c 100644 --- a/swagger/prime_v3.yaml +++ b/swagger/prime_v3.yaml @@ -2155,6 +2155,8 @@ definitions: corresponding to the service item type. * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT + * IOFSIT, IOASIT - MTOServiceItemInternationalOriginSIT + * IDFSIT, IDASIT - MTOServiceItemInternationalDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating @@ -2166,6 +2168,8 @@ definitions: - MTOServiceItemBasic - MTOServiceItemOriginSIT - MTOServiceItemDestSIT + - MTOServiceItemInternationalOriginSIT + - MTOServiceItemInternationalDestSIT - MTOServiceItemShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating From 22c7cdee805e4eb9517479baf1366a9d83e25931 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Thu, 23 Jan 2025 20:39:14 +0000 Subject: [PATCH 02/15] merge 21410 merge and deleted duplicate international Org/Dest create SIT forms --- pkg/models/mto_shipments.go | 2 + .../CreateShipmentServiceItemForm.jsx | 26 +++- .../DestinationSITServiceItemForm.jsx | 27 +++- ...rnationalDestinationSITServiceItemForm.jsx | 133 ------------------ .../InternationalOriginSITServiceItemForm.jsx | 110 --------------- .../OriginSITServiceItemForm.jsx | 7 +- 6 files changed, 46 insertions(+), 259 deletions(-) delete mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx delete mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx diff --git a/pkg/models/mto_shipments.go b/pkg/models/mto_shipments.go index 5fff5f66adc..eff540210ef 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/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx index ea83899c299..ba4008d6675 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx @@ -5,8 +5,6 @@ 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'; @@ -62,17 +60,33 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) {selectedServiceItemType === MTOServiceItemOriginSIT && ( - + )} {selectedServiceItemType === MTOServiceItemDestSIT && ( - + )} {selectedServiceItemType === MTOServiceItemInternationalOriginSIT && ( - + )} {selectedServiceItemType === MTOServiceItemInternationalDestSIT && ( - + )} {selectedServiceItemType === MTOServiceItemShuttle && ( diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx index 0eef9278cca..497d442205e 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx @@ -25,12 +25,12 @@ const destinationSITValidationSchema = Yup.object().shape({ sitDepartureDate: Yup.date().typeError('Enter a complete date in DD MMM YYYY format (day, month, year).'), }); -const DestinationSITServiceItemForm = ({ shipment, submission }) => { +const DestinationSITServiceItemForm = ({ shipment, submission, isDomestic }) => { const initialValues = { moveTaskOrderID: shipment.moveTaskOrderID, mtoShipmentID: shipment.id, - modelType: 'MTOServiceItemDestSIT', - reServiceCode: 'DDFSIT', + modelType: isDomestic ? 'MTOServiceItemDestSIT' : 'MTOServiceItemInternationalDestSIT', + reServiceCode: isDomestic ? 'DDFSIT' : 'IDFSIT', reason: '', firstAvailableDeliveryDate1: '', dateOfContact1: '', @@ -111,10 +111,22 @@ const DestinationSITServiceItemForm = ({ shipment, submission }) => { The following service items will be created:
- DDFSIT (Destination 1st day SIT)
- DDASIT (Destination additional days SIT)
- DDDSIT (Destination SIT delivery)
- DDSFSC (Destination SIT fuel surcharge)
+ {isDomestic && ( + <> + DDFSIT (Destination 1st day SIT)
+ DDASIT (Destination additional days SIT)
+ DDDSIT (Destination SIT delivery)
+ DDSFSC (Destination SIT fuel surcharge)
+ + )} + {!isDomestic && ( + <> + 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. @@ -128,6 +140,7 @@ const DestinationSITServiceItemForm = ({ shipment, submission }) => { DestinationSITServiceItemForm.propTypes = { shipment: ShipmentShape.isRequired, submission: PropTypes.func.isRequired, + isDomestic: PropTypes.bool.isRequired, }; export default DestinationSITServiceItemForm; diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx deleted file mode 100644 index 14aab88084a..00000000000 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx +++ /dev/null @@ -1,133 +0,0 @@ -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:
- DDFSIT (Destination 1st day SIT)
- DDASIT (Destination additional days SIT)
- DDDSIT (Destination SIT delivery)
- DDSFSC (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/InternationalOriginSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx deleted file mode 100644 index dc0a094914f..00000000000 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx +++ /dev/null @@ -1,110 +0,0 @@ -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/OriginSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.jsx index dc86b6ad5e1..f261bcbf372 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.jsx @@ -26,12 +26,12 @@ const originSITValidationSchema = Yup.object().shape({ sitHHGActualOrigin: requiredAddressSchema, }); -const OriginSITServiceItemForm = ({ shipment, submission }) => { +const OriginSITServiceItemForm = ({ shipment, submission, isDomestic }) => { const initialValues = { moveTaskOrderID: shipment.moveTaskOrderID, mtoShipmentID: shipment.id, - modelType: 'MTOServiceItemOriginSIT', - reServiceCode: 'DOFSIT', + modelType: isDomestic ? 'MTOServiceItemOriginSIT' : 'MTOServiceItemInternationalOriginSIT', + reServiceCode: isDomestic ? 'DOFSIT' : 'IOFSIT', reason: '', sitPostalCode: '', sitEntryDate: '', @@ -105,6 +105,7 @@ const OriginSITServiceItemForm = ({ shipment, submission }) => { OriginSITServiceItemForm.propTypes = { shipment: ShipmentShape.isRequired, submission: PropTypes.func.isRequired, + isDomestic: PropTypes.bool.isRequired, }; export default OriginSITServiceItemForm; From bc29b353d4d37233dc87d77d62a00cbcae08a6fe Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Tue, 28 Jan 2025 17:13:49 +0000 Subject: [PATCH 03/15] update yaml+description for international SITs --- pkg/gen/primeapi/embedded_spec.go | 12 +- .../create_m_t_o_service_item.go | 75 +++++++++++ .../update_m_t_o_service_item.go | 8 ++ .../mto_service_item_client.go | 83 ++++++++++++ pkg/gen/primemessages/service_item.go | 2 + pkg/gen/primev2api/embedded_spec.go | 16 ++- .../update_m_t_o_service_item_model_type.go | 4 + .../update_m_t_o_service_item_s_i_t.go | 8 +- pkg/gen/primev3api/embedded_spec.go | 16 ++- .../update_m_t_o_service_item_model_type.go | 4 + .../update_m_t_o_service_item_s_i_t.go | 8 +- .../mto_service_item_creator.go | 15 ++- swagger-def/prime.yaml | 86 ++++++++++++ swagger-def/prime_v2.yaml | 8 ++ swagger-def/prime_v3.yaml | 8 ++ swagger/prime.yaml | 124 ++++++++++++++++++ swagger/prime_v2.yaml | 8 ++ swagger/prime_v3.yaml | 8 ++ 18 files changed, 465 insertions(+), 28 deletions(-) diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index c7d1ea4f5af..8c8aaa233bb 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -298,7 +298,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" ], @@ -355,7 +355,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", + "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", "consumes": [ "application/json" ], @@ -3967,7 +3967,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", @@ -5249,7 +5249,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" ], @@ -5327,7 +5327,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", + "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", "consumes": [ "application/json" ], @@ -9214,7 +9214,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" 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 8bfdb75c0f7..c124cef0d61 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 9fe2fa1212d..f0ca03af5b5 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/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/primev2api/embedded_spec.go b/pkg/gen/primev2api/embedded_spec.go index 373d03b9d77..76af942d426 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -3341,7 +3341,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", @@ -3389,7 +3389,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { @@ -7269,7 +7273,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", @@ -7317,7 +7321,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { 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 ee50749ebd6..de8a61df0e4 100644 --- a/pkg/gen/primev3api/embedded_spec.go +++ b/pkg/gen/primev3api/embedded_spec.go @@ -3959,7 +3959,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", @@ -4007,7 +4007,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { @@ -8597,7 +8601,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", @@ -8645,7 +8649,11 @@ func init() { "DDDSIT", "DOPSIT", "DOASIT", - "DOFSIT" + "DOFSIT", + "IDDSIT", + "IOPSIT", + "IOASIT", + "IOFSIT" ] }, "requestApprovalsRequestedStatus": { 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/services/mto_service_item/mto_service_item_creator.go b/pkg/services/mto_service_item/mto_service_item_creator.go index da03da22907..a001e3cef2a 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator.go +++ b/pkg/services/mto_service_item/mto_service_item_creator.go @@ -601,11 +601,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 } @@ -614,11 +616,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 } diff --git a/swagger-def/prime.yaml b/swagger-def/prime.yaml index fc5a4f9217a..4b5b55df2cd 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 @@ -1762,6 +1846,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` diff --git a/swagger-def/prime_v2.yaml b/swagger-def/prime_v2.yaml index 9c6dbe33fd8..8563fdf576a 100644 --- a/swagger-def/prime_v2.yaml +++ b/swagger-def/prime_v2.yaml @@ -615,6 +615,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -918,6 +922,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 7f64d2718b3..14c9210b552 100644 --- a/swagger-def/prime_v3.yaml +++ b/swagger-def/prime_v3.yaml @@ -642,6 +642,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -1005,6 +1009,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 c384de87904..595f8083eae 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: @@ -2782,6 +2904,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` diff --git a/swagger/prime_v2.yaml b/swagger/prime_v2.yaml index 4e4e1e298e2..e81f75fcbad 100644 --- a/swagger/prime_v2.yaml +++ b/swagger/prime_v2.yaml @@ -1168,6 +1168,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -1536,6 +1540,10 @@ definitions: - DOPSIT - DOASIT - DOFSIT + - IDDSIT + - IOPSIT + - IOASIT + - IOFSIT sitDepartureDate: format: date type: string diff --git a/swagger/prime_v3.yaml b/swagger/prime_v3.yaml index 938800d01f4..f622639afb0 100644 --- a/swagger/prime_v3.yaml +++ b/swagger/prime_v3.yaml @@ -1206,6 +1206,10 @@ definitions: * DOPSIT - UpdateMTOServiceItemSIT * DOASIT - UpdateMTOServiceItemSIT * DOFSIT - UpdateMTOServiceItemSIT + * IDDSIT - UpdateMTOServiceItemSIT + * IOPSIT - UpdateMTOServiceItemSIT + * IOASIT - UpdateMTOServiceItemSIT + * IOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle * IDSHUT - UpdateMTOServiceItemInternationalShuttle @@ -1643,6 +1647,10 @@ definitions: - DOPSIT - DOASIT - DOFSIT + - IDDSIT + - IOPSIT + - IOASIT + - IOFSIT sitDepartureDate: format: date type: string From 8b6b2c2dee38239b369def41ae6a8448311cf7ce Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Tue, 28 Jan 2025 20:00:39 +0000 Subject: [PATCH 04/15] add more tests --- .../primeapi/mto_service_item_test.go | 81 ++++- .../payloads/payload_to_model_test.go | 64 ++++ .../payloads/payload_to_model_test.go | 64 ++++ .../mto_service_item_validators_test.go | 307 ++++++++++++++++++ .../sit_entry_date_updater_test.go | 76 +++++ 5 files changed, 580 insertions(+), 12 deletions(-) diff --git a/pkg/handlers/primeapi/mto_service_item_test.go b/pkg/handlers/primeapi/mto_service_item_test.go index ceae1b2bf65..85525fc9824 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() { @@ -144,6 +173,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{ @@ -506,7 +563,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", @@ -538,7 +595,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/primeapiv2/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go index 3df180b58ea..194f4211f1c 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/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go index fd9430379f0..1697fe78edd 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/services/mto_service_item/mto_service_item_validators_test.go b/pkg/services/mto_service_item/mto_service_item_validators_test.go index 888c094becd..e8932bee2ee 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 DOFSIT 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 + // DDDSIT or DOPSIT if the user is trying to update the + // SITDepartureDate + // Set up: Create an old and new DDDSIT, with a new date and try to update. + // Expected outcome: Success if both are DDDSIT + oldDDDSIT := factory.BuildMTOServiceItem(nil, []factory.Customization{ + { + Model: models.ReService{ + Code: models.ReServiceCodeIDDSIT, + }, + }, + }, nil) + newDDDSIT := oldDDDSIT + newDDDSIT.SITDepartureDate = &now + + serviceItemData := updateMTOServiceItemData{ + updatedServiceItem: newDDDSIT, + oldServiceItem: oldDDDSIT, + verrs: validate.NewErrors(), + } + err := serviceItemData.checkSITDeparture(suite.AppContextForTest()) + + suite.NoError(err) + suite.NoVerrs(serviceItemData.verrs) + }) + + // Test successful check for SIT departure service item - DDDSIT + 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 @@ -858,6 +1050,72 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { }) + 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{ { @@ -908,6 +1166,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_test.go b/pkg/services/sit_entry_date_update/sit_entry_date_updater_test.go index a6f45b1dcdc..4f11deab45d 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 @@ -48,6 +48,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() @@ -66,6 +104,23 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { suite.IsType(apperror.NotFoundError{}, err) }) + suite.Run("Not Found Error - international", func() { + ddfServiceItem, _ := setupInternationalModels() + notFoundServiceItem := models.SITEntryDateUpdate{ + ID: ddfServiceItem.ID, + SITEntryDate: ddfServiceItem.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() @@ -88,4 +143,25 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { suite.Equal(ddaServiceItem.SITEntryDate.Local(), newSitEntryDateNextDay.Local()) }) + suite.Run("Successful update of service items - international", func() { + ddfServiceItem, ddaServiceItem := setupInternationalModels() + updatedServiceItem := models.SITEntryDateUpdate{ + ID: ddfServiceItem.ID, + SITEntryDate: ddfServiceItem.SITEntryDate, + } + newSitEntryDate := time.Date(2020, time.December, 02, 0, 0, 0, 0, time.UTC) + newSitEntryDateNextDay := newSitEntryDate.Add(24 * time.Hour) + + updatedServiceItem.SITEntryDate = &newSitEntryDate + ddaServiceItem.SITEntryDate = &newSitEntryDateNextDay + + changedServiceItem, err := updater.UpdateSitEntryDate(suite.AppContextForTest(), &updatedServiceItem) + + suite.NoError(err) + suite.NotNil(updatedServiceItem) + suite.Equal(ddfServiceItem.ID, updatedServiceItem.ID) + suite.Equal(updatedServiceItem.SITEntryDate.Local(), changedServiceItem.SITEntryDate.Local()) + suite.Equal(ddaServiceItem.SITEntryDate.Local(), newSitEntryDateNextDay.Local()) + }) + } From 8e104c0740e2d30930de8eb169baccdf17a693ec Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Tue, 28 Jan 2025 16:14:39 -0500 Subject: [PATCH 05/15] create separate create forms for international SITs --- .../CreateShipmentServiceItemForm.jsx | 26 +-- .../CreateShipmentServiceItemForm.test.jsx | 2 + .../DestinationSITServiceItemForm.jsx | 31 +--- .../DestinationSITServiceItemForm.test.jsx | 57 ------- ...rnationalDestinationSITServiceItemForm.jsx | 133 +++++++++++++++ ...onalDestinationSITServiceItemForm.test.jsx | 156 ++++++++++++++++++ .../InternationalOriginSITServiceItemForm.jsx | 110 ++++++++++++ ...rnationalOriginSITServiceItemForm.test.jsx | 96 +++++++++++ .../OriginSITServiceItemForm.jsx | 11 +- 9 files changed, 513 insertions(+), 109 deletions(-) create mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.jsx create mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalDestinationSITServiceItemForm.test.jsx create mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.jsx create mode 100644 src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalOriginSITServiceItemForm.test.jsx diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx index c5b4a3a0f19..6dc1c96593b 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'; @@ -60,33 +62,17 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) {selectedServiceItemType === MTOServiceItemOriginSIT && ( - + )} {selectedServiceItemType === MTOServiceItemDestSIT && ( - + )} {selectedServiceItemType === MTOServiceItemInternationalOriginSIT && ( - + )} {selectedServiceItemType === MTOServiceItemInternationalDestSIT && ( - + )} {selectedServiceItemType === MTOServiceItemShuttle && ( diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx index f30c0b9f459..43868b6257c 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.MTOServiceItemShuttle], ['DomesticCratingForm', createServiceItemModelTypes.MTOServiceItemDomesticCrating], ['InternationalCratingForm', createServiceItemModelTypes.MTOServiceItemInternationalCrating], diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx index f2b9832fd00..0eef9278cca 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.jsx @@ -25,12 +25,12 @@ const destinationSITValidationSchema = Yup.object().shape({ sitDepartureDate: Yup.date().typeError('Enter a complete date in DD MMM YYYY format (day, month, year).'), }); -const DestinationSITServiceItemForm = ({ shipment, submission, isDomestic }) => { +const DestinationSITServiceItemForm = ({ shipment, submission }) => { const initialValues = { moveTaskOrderID: shipment.moveTaskOrderID, mtoShipmentID: shipment.id, - modelType: isDomestic ? 'MTOServiceItemDestSIT' : 'MTOServiceItemInternationalDestSIT', - reServiceCode: isDomestic ? 'DDFSIT' : 'IDFSIT', + modelType: 'MTOServiceItemDestSIT', + reServiceCode: 'DDFSIT', reason: '', firstAvailableDeliveryDate1: '', dateOfContact1: '', @@ -111,22 +111,10 @@ const DestinationSITServiceItemForm = ({ shipment, submission, isDomestic }) => The following service items will be created:
- {isDomestic && ( - <> - DDFSIT (Destination 1st day SIT)
- DDASIT (Destination additional days SIT)
- DDDSIT (Destination SIT delivery)
- DDSFSC (Destination SIT fuel surcharge)
- - )} - {!isDomestic && ( - <> - IDFSIT (Destination 1st day SIT)
- IDASIT (Destination additional days SIT)
- IDDSIT (Destination SIT delivery)
- IDSFSC (Destination SIT fuel surcharge)
- - )} + DDFSIT (Destination 1st day SIT)
+ DDASIT (Destination additional days SIT)
+ DDDSIT (Destination SIT delivery)
+ DDSFSC (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. @@ -140,11 +128,6 @@ const DestinationSITServiceItemForm = ({ shipment, submission, isDomestic }) => DestinationSITServiceItemForm.propTypes = { shipment: ShipmentShape.isRequired, submission: PropTypes.func.isRequired, - isDomestic: PropTypes.bool, -}; - -DestinationSITServiceItemForm.defaultProps = { - isDomestic: true, }; export default DestinationSITServiceItemForm; diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.test.jsx index 99fbbd18e7a..d87d31e54f2 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.test.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/DestinationSITServiceItemForm.test.jsx @@ -101,24 +101,6 @@ describe('DestinationSITServiceItemForm component', () => { ); }); - 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]; @@ -167,43 +149,4 @@ describe('DestinationSITServiceItemForm component', () => { }, }); }); - - 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/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.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.jsx index f2e2f9bd55b..dc86b6ad5e1 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/OriginSITServiceItemForm.jsx @@ -26,12 +26,12 @@ const originSITValidationSchema = Yup.object().shape({ sitHHGActualOrigin: requiredAddressSchema, }); -const OriginSITServiceItemForm = ({ shipment, submission, isDomestic }) => { +const OriginSITServiceItemForm = ({ shipment, submission }) => { const initialValues = { moveTaskOrderID: shipment.moveTaskOrderID, mtoShipmentID: shipment.id, - modelType: isDomestic ? 'MTOServiceItemOriginSIT' : 'MTOServiceItemInternationalOriginSIT', - reServiceCode: isDomestic ? 'DOFSIT' : 'IOFSIT', + modelType: 'MTOServiceItemOriginSIT', + reServiceCode: 'DOFSIT', reason: '', sitPostalCode: '', sitEntryDate: '', @@ -105,11 +105,6 @@ const OriginSITServiceItemForm = ({ shipment, submission, isDomestic }) => { OriginSITServiceItemForm.propTypes = { shipment: ShipmentShape.isRequired, submission: PropTypes.func.isRequired, - isDomestic: PropTypes.bool, -}; - -OriginSITServiceItemForm.defaultProps = { - isDomestic: true, }; export default OriginSITServiceItemForm; From 793beb95071191019af47523b657532cc7395682 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Wed, 29 Jan 2025 16:31:55 +0000 Subject: [PATCH 06/15] deleted function not used to increase code coverage and small changes per PR comments --- .../primeapi/payloads/payload_to_model.go | 6 +- .../primeapiv2/payloads/payload_to_model.go | 4 +- pkg/models/mto_shipments.go | 27 ------ .../ServiceItemDetails/ServiceItemDetails.jsx | 89 ++++++++++--------- src/constants/serviceItems.js | 1 + 5 files changed, 51 insertions(+), 76 deletions(-) diff --git a/pkg/handlers/primeapi/payloads/payload_to_model.go b/pkg/handlers/primeapi/payloads/payload_to_model.go index 65154580f1f..7de1066f70a 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model.go @@ -583,7 +583,7 @@ func MTOServiceItemModel(mtoServiceItem primemessages.MTOServiceItem) (*models.M model.Reason = destsit.Reason sitEntryDate := handlers.FmtDatePtrToPopPtr(destsit.SitEntryDate) - // Check for required fields on a DDFSIT + // Check for required fields on a IDFSIT if model.ReService.Code == models.ReServiceCodeIDFSIT { verrs := validateIDFSITForCreate(*destsit) reasonVerrs := validateReasonInternationalDestSIT(*destsit) @@ -954,7 +954,7 @@ func validateDDFSITForCreate(m primemessages.MTOServiceItemDestSIT) *validate.Er return verrs } -// validateIDFSITForCreate validates DDFSIT service item has all required fields +// validateIDFSITForCreate validates IDFSIT service item has all required fields func validateIDFSITForCreate(m primemessages.MTOServiceItemInternationalDestSIT) *validate.Errors { verrs := validate.NewErrors() @@ -971,7 +971,7 @@ func validateIDFSITForCreate(m primemessages.MTOServiceItemInternationalDestSIT) 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.") + 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.") diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model.go b/pkg/handlers/primeapiv2/payloads/payload_to_model.go index 17c662c958c..862a774ecc2 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model.go @@ -1019,7 +1019,7 @@ func validateDDFSITForCreate(m primev2messages.MTOServiceItemDestSIT) *validate. return verrs } -// validateIDFSITForCreate validates DDFSIT service item has all required fields +// validateIDFSITForCreate validates IDFSIT service item has all required fields func validateIDFSITForCreate(m primev2messages.MTOServiceItemInternationalDestSIT) *validate.Errors { verrs := validate.NewErrors() @@ -1036,7 +1036,7 @@ func validateIDFSITForCreate(m primev2messages.MTOServiceItemInternationalDestSI 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.") + 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.") diff --git a/pkg/models/mto_shipments.go b/pkg/models/mto_shipments.go index 53899c73eed..7b8d6b35db1 100644 --- a/pkg/models/mto_shipments.go +++ b/pkg/models/mto_shipments.go @@ -296,33 +296,6 @@ func GetCustomerFromShipment(db *pop.Connection, shipmentID uuid.UUID) (*Service return &serviceMember, nil } -func (m *MTOShipment) UpdateOrdersDestinationGBLOC(db *pop.Connection) error { - // Since this requires looking up the order in the DB, the order must have an ID. This means, the order has to have been created first. - if uuid.UUID.IsNil(m.ID) { - return fmt.Errorf("error updating orders destination GBLOC for shipment due to no shipment ID provided") - } - - var err error - var order Order - - err = db.Load(&m, "MoveTaskOrder.OrdersID") - if err != nil { - return fmt.Errorf("error loading orders for shipment ID: %s with error %w", m.ID, err) - } - - order, err = FetchOrder(db, m.MoveTaskOrder.OrdersID) - if err != nil { - return fmt.Errorf("error fetching order for shipment ID: %s with error %w", m.ID, err) - } - - err = order.UpdateDestinationGBLOC(db) - if err != nil { - return fmt.Errorf("error fetching GBLOC for postal code with error %w", err) - } - - return nil -} - // Helper function to check that an MTO Shipment contains a PPM Shipment func (m MTOShipment) ContainsAPPMShipment() bool { return m.PPMShipment != nil diff --git a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx index 2f6a90099c3..c406dff1c7b 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) => ( @@ -51,7 +52,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai return (
- {code === 'DDFSIT' || code === 'IDFSIT' + {code === SERVICE_ITEM_CODES.DDFSIT || code === SERVICE_ITEM_CODES.IDFSIT ? generateDetailText({ 'Original Delivery Address': originalDeliveryAddress ? formatCityStateAndPostalCode(originalDeliveryAddress) @@ -59,7 +60,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( { @@ -88,7 +89,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {code === 'IDASIT' && ( + {code === SERVICE_ITEM_CODES.IDASIT && ( <> {generateDetailText( { @@ -117,7 +118,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {code === 'DDSFSC' || code === 'IDSFSC' + {code === SERVICE_ITEM_CODES.DDSFSC || code === SERVICE_ITEM_CODES.IDSFSC ? generateDetailText( { 'Original Delivery Address': originalDeliveryAddress @@ -132,7 +133,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai id, ) : null} - {code === 'DDDSIT' && ( + {code === SERVICE_ITEM_CODES.DDDSIT && ( <> {generateDetailText( { @@ -170,7 +171,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {code === 'IDDSIT' && ( + {code === SERVICE_ITEM_CODES.IDDSIT && ( <> {generateDetailText( { @@ -208,7 +209,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai ) : null} )} - {(code === 'DDFSIT' || code === 'IDFSIT') && ( + {(code === SERVICE_ITEM_CODES.DDFSIT || code === SERVICE_ITEM_CODES.IDFSIT) && ( <> {!isEmpty(sortedCustomerContacts) ? sortedCustomerContacts.map((contact, index) => ( @@ -256,8 +257,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s let detailSection; switch (code) { - case 'DOFSIT': - case 'IOFSIT': { + case SERVICE_ITEM_CODES.DOFSIT: + case SERVICE_ITEM_CODES.IOFSIT: { detailSection = (
@@ -290,8 +291,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOASIT': - case 'IOASIT': { + case SERVICE_ITEM_CODES.DOASIT: + case SERVICE_ITEM_CODES.IOASIT: { const numberOfDaysApprovedForIOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; const sitEndDate = sitStatus && @@ -342,8 +343,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOPSIT': - case 'IOPSIT': { + case SERVICE_ITEM_CODES.DOPSIT: + case SERVICE_ITEM_CODES.IOPSIT: { detailSection = (
@@ -378,8 +379,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DOSFSC': - case 'IOSFSC': { + case SERVICE_ITEM_CODES.DOSFSC: + case SERVICE_ITEM_CODES.IOSFSC: { detailSection = (
@@ -414,10 +415,10 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DDFSIT': - case 'DDASIT': - case 'IDFSIT': - case 'IDASIT': { + case SERVICE_ITEM_CODES.DDFSIT: + case SERVICE_ITEM_CODES.DDASIT: + case SERVICE_ITEM_CODES.IDFSIT: + case SERVICE_ITEM_CODES.IDASIT: { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, @@ -428,8 +429,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DDDSIT': - case 'IDDSIT': { + case SERVICE_ITEM_CODES.DDDSIT: + case SERVICE_ITEM_CODES.IDDSIT: { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, @@ -440,8 +441,8 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s ); break; } - case 'DDSFSC': - case 'IDSFSC': { + case SERVICE_ITEM_CODES.DDSFSC: + case SERVICE_ITEM_CODES.IDSFSC: { detailSection = generateDestinationSITDetailSection( id, serviceRequestDocUploads, @@ -452,8 +453,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, @@ -491,7 +492,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, @@ -528,8 +529,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 = (
@@ -557,18 +558,18 @@ 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 'POEFSC': - case 'PODFSC': { + 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.POEFSC: + case SERVICE_ITEM_CODES.PODFSC: { detailSection = (
@@ -580,8 +581,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 = (
@@ -590,7 +591,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, @@ -630,7 +631,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/constants/serviceItems.js b/src/constants/serviceItems.js index 89fccf775bd..9aafadad1e4 100644 --- a/src/constants/serviceItems.js +++ b/src/constants/serviceItems.js @@ -146,6 +146,7 @@ const SERVICE_ITEM_CODES = { FSC: 'FSC', DDSHUT: 'DDSHUT', IDSHUT: 'IDSHUT', + DCRTSA: 'DCRTSA', DCRT: 'DCRT', DUCRT: 'DUCRT', ICRT: 'ICRT', From 7fc7b46b73f0bb722bcf28df37578080daef777c Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Fri, 31 Jan 2025 15:29:11 +0000 Subject: [PATCH 07/15] Fix comments --- pkg/handlers/primeapiv2/payloads/payload_to_model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model.go b/pkg/handlers/primeapiv2/payloads/payload_to_model.go index 862a774ecc2..1f99aa3a009 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model.go @@ -1079,7 +1079,7 @@ func validateReasonDestSIT(m primev2messages.MTOServiceItemDestSIT) *validate.Er return verrs } -// validateReasonDestSIT validates that International Destination SIT service items have required Reason field +// validateReasonInternationalDestSIT validates that International Destination SIT service items have required Reason field func validateReasonInternationalDestSIT(m primev2messages.MTOServiceItemInternationalDestSIT) *validate.Errors { verrs := validate.NewErrors() From fd6e17877d5d702c08982af7e02724bcd506f898 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Fri, 31 Jan 2025 16:27:15 +0000 Subject: [PATCH 08/15] fix comments and code cleanup per PR comments --- .../primeapiv3/payloads/payload_to_model.go | 2 +- .../mto_service_item_validators_test.go | 18 ++++----- .../sit_entry_date_updater_test.go | 18 ++++----- .../ServiceItemsTable/ServiceItemsTable.jsx | 38 ++++++++++++++++--- 4 files changed, 51 insertions(+), 25 deletions(-) diff --git a/pkg/handlers/primeapiv3/payloads/payload_to_model.go b/pkg/handlers/primeapiv3/payloads/payload_to_model.go index c31f96166f6..470d855095a 100644 --- a/pkg/handlers/primeapiv3/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv3/payloads/payload_to_model.go @@ -1244,7 +1244,7 @@ func validateReasonDestSIT(m primev3messages.MTOServiceItemDestSIT) *validate.Er return verrs } -// validateReasonDestSIT validates that International Destination SIT service items have required Reason field +// validateReasonInternationalDestSIT validates that International Destination SIT service items have required Reason field func validateReasonInternationalDestSIT(m primev3messages.MTOServiceItemInternationalDestSIT) *validate.Errors { verrs := validate.NewErrors() 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 e8932bee2ee..ca918f93650 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 @@ -296,23 +296,23 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { // 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 - // DDDSIT or DOPSIT if the user is trying to update the + // IDDSIT or IOPSIT if the user is trying to update the // SITDepartureDate - // Set up: Create an old and new DDDSIT, with a new date and try to update. - // Expected outcome: Success if both are DDDSIT - oldDDDSIT := factory.BuildMTOServiceItem(nil, []factory.Customization{ + // 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) - newDDDSIT := oldDDDSIT - newDDDSIT.SITDepartureDate = &now + newIDDSIT := oldIDDSIT + newIDDSIT.SITDepartureDate = &now serviceItemData := updateMTOServiceItemData{ - updatedServiceItem: newDDDSIT, - oldServiceItem: oldDDDSIT, + updatedServiceItem: newIDDSIT, + oldServiceItem: oldIDDSIT, verrs: validate.NewErrors(), } err := serviceItemData.checkSITDeparture(suite.AppContextForTest()) @@ -321,7 +321,7 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.NoVerrs(serviceItemData.verrs) }) - // Test successful check for SIT departure service item - DDDSIT + // 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 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 4f11deab45d..e9c0bb65de6 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 @@ -105,10 +105,10 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { }) suite.Run("Not Found Error - international", func() { - ddfServiceItem, _ := setupInternationalModels() + idfServiceItem, _ := setupInternationalModels() notFoundServiceItem := models.SITEntryDateUpdate{ - ID: ddfServiceItem.ID, - SITEntryDate: ddfServiceItem.SITEntryDate, + ID: idfServiceItem.ID, + SITEntryDate: idfServiceItem.SITEntryDate, } notFoundUUID, err := uuid.NewV4() suite.NoError(err) @@ -144,24 +144,24 @@ func (suite *UpdateSitEntryDateServiceSuite) TestUpdateSitEntryDate() { }) suite.Run("Successful update of service items - international", func() { - ddfServiceItem, ddaServiceItem := setupInternationalModels() + idfServiceItem, idaServiceItem := setupInternationalModels() updatedServiceItem := models.SITEntryDateUpdate{ - ID: ddfServiceItem.ID, - SITEntryDate: ddfServiceItem.SITEntryDate, + 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 - ddaServiceItem.SITEntryDate = &newSitEntryDateNextDay + idaServiceItem.SITEntryDate = &newSitEntryDateNextDay changedServiceItem, err := updater.UpdateSitEntryDate(suite.AppContextForTest(), &updatedServiceItem) suite.NoError(err) suite.NotNil(updatedServiceItem) - suite.Equal(ddfServiceItem.ID, updatedServiceItem.ID) + suite.Equal(idfServiceItem.ID, updatedServiceItem.ID) suite.Equal(updatedServiceItem.SITEntryDate.Local(), changedServiceItem.SITEntryDate.Local()) - suite.Equal(ddaServiceItem.SITEntryDate.Local(), newSitEntryDateNextDay.Local()) + suite.Equal(idaServiceItem.SITEntryDate.Local(), newSitEntryDateNextDay.Local()) }) } diff --git a/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx b/src/components/Office/ServiceItemsTable/ServiceItemsTable.jsx index 214e7f112a2..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', 'IDFSIT', 'IDASIT', 'IDDSIT', 'IDSFSC']; + 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', 'IOFSIT', 'IOASIT', 'IOPSIT', 'IOSFSC']; + 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' || code === 'IDFSIT' || code === 'IOFSIT') { + 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); From c6a8b88e3b817f2033003e2e775e9416b83a9596 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Fri, 31 Jan 2025 19:55:06 +0000 Subject: [PATCH 09/15] remove duplicate code per PR --- .../ServiceItemDetails/ServiceItemDetails.jsx | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx index a50fe5e03f5..f3ffcd1f16a 100644 --- a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx +++ b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx @@ -344,41 +344,7 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s break; } case SERVICE_ITEM_CODES.DOPSIT: - case SERVICE_ITEM_CODES.IOPSIT: { - 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 SERVICE_ITEM_CODES.IOPSIT: case SERVICE_ITEM_CODES.DOSFSC: case SERVICE_ITEM_CODES.IOSFSC: { detailSection = ( From dd11a7b351536e93e835e38c380b403ca67a495e Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Fri, 31 Jan 2025 20:02:26 +0000 Subject: [PATCH 10/15] consolidating/deleting per PR --- .../ServiceItemDetails/ServiceItemDetails.jsx | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx index f3ffcd1f16a..a8518a7bcc7 100644 --- a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx +++ b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx @@ -384,29 +384,9 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s case SERVICE_ITEM_CODES.DDFSIT: case SERVICE_ITEM_CODES.DDASIT: case SERVICE_ITEM_CODES.IDFSIT: - case SERVICE_ITEM_CODES.IDASIT: { - detailSection = generateDestinationSITDetailSection( - id, - serviceRequestDocUploads, - details, - code, - shipment, - sitStatus, - ); - break; - } + case SERVICE_ITEM_CODES.IDASIT: case SERVICE_ITEM_CODES.DDDSIT: - case SERVICE_ITEM_CODES.IDDSIT: { - detailSection = generateDestinationSITDetailSection( - id, - serviceRequestDocUploads, - details, - code, - shipment, - sitStatus, - ); - break; - } + case SERVICE_ITEM_CODES.IDDSIT: case SERVICE_ITEM_CODES.DDSFSC: case SERVICE_ITEM_CODES.IDSFSC: { detailSection = generateDestinationSITDetailSection( From d65fc26398bf37264d114a08e70078f3324e3d58 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Fri, 31 Jan 2025 20:28:31 +0000 Subject: [PATCH 11/15] code cleanup --- .../Office/ServiceItemDetails/ServiceItemDetails.jsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx index a8518a7bcc7..b77ce920e78 100644 --- a/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx +++ b/src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx @@ -39,8 +39,7 @@ const generateDestinationSITDetailSection = (id, serviceRequestDocUploads, detai 'First available delivery date 1': '-', 'Customer contact 1': '-', }); - const numberOfDaysApprovedForDOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; - const numberOfDaysApprovedForIOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; + const numberOfDaysApprovedForSIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; const sitEndDate = sitStatus && sitStatus.currentSIT?.sitAuthorizedEndDate && @@ -70,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, @@ -99,7 +98,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 ? `${numberOfDaysApprovedForIOASIT} days` : '-', + '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForSIT} days` : '-', 'SIT expiration date': sitEndDate || '-', }, id, @@ -293,11 +292,11 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s } case SERVICE_ITEM_CODES.DOASIT: case SERVICE_ITEM_CODES.IOASIT: { - const numberOfDaysApprovedForIOASIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; const sitEndDate = sitStatus && sitStatus.currentSIT?.sitAuthorizedEndDate && formatDateWithUTC(sitStatus.currentSIT.sitAuthorizedEndDate, 'DD MMM YYYY'); + const numberOfDaysApprovedForSIT = shipment.sitDaysAllowance ? shipment.sitDaysAllowance - 1 : 0; detailSection = (
@@ -310,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 ? `${numberOfDaysApprovedForIOASIT} days` : '-', + '# of days approved for': shipment.sitDaysAllowance ? `${numberOfDaysApprovedForSIT} days` : '-', 'SIT expiration date': sitEndDate || '-', 'Customer contacted homesafe': details.sitCustomerContacted ? formatDateWithUTC(details.sitCustomerContacted, 'DD MMM YYYY') From dda6ab58cfcfa2fecd515e6935b3359b54f183a7 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Tue, 4 Feb 2025 20:52:18 +0000 Subject: [PATCH 12/15] Fix comments per PR review --- pkg/handlers/primeapi/payloads/payload_to_model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/handlers/primeapi/payloads/payload_to_model.go b/pkg/handlers/primeapi/payloads/payload_to_model.go index 7de1066f70a..c3e352c9336 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model.go @@ -479,7 +479,7 @@ func MTOServiceItemModel(mtoServiceItem primemessages.MTOServiceItem) (*models.M } model.Reason = originsit.Reason - // Check for reason required field on a DDFSIT + // Check for reason required field on a IOASIT if model.ReService.Code == models.ReServiceCodeIOASIT { reasonVerrs := validateReasonInternationalOriginSIT(*originsit) From 6651098cdd7e8c15747029dded892fcb1b80a97b Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Wed, 5 Feb 2025 18:47:20 +0000 Subject: [PATCH 13/15] fix comments --- .../mto_service_item/mto_service_item_validators_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ca918f93650..95450a89c90 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 @@ -231,7 +231,7 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { oldServiceItem, newServiceItem := setupTestData() // Create old and new service item - // Make both service items of type DOFSIT because this type of service item will be checked by checkForSITItemChanges + // 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 From 5ed03cb2c21fb1fe77a87146f356f0b8d68a6c92 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Wed, 12 Feb 2025 19:37:47 +0000 Subject: [PATCH 14/15] add validation to prevent international SITs to be created for domestic shipments --- .../mto_service_item_creator.go | 23 ++++ .../mto_service_item_creator_test.go | 116 ++++++++++++++++++ 2 files changed, 139 insertions(+) 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 a88d644c94b..3f6db514039 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" @@ -708,6 +709,10 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex 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) @@ -986,3 +991,21 @@ func (o *mtoServiceItemCreator) validateFirstDaySITServiceItem(appCtx appcontext return &extraServiceItems, nil } + +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 66935f7b5e7..be8ffefc460 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 @@ -1920,4 +1920,120 @@ 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") + }) } From 1db1383aeee51d419d5882eadbeafe5205808599 Mon Sep 17 00:00:00 2001 From: Michael Inthavongsay Date: Thu, 13 Feb 2025 00:56:40 +0000 Subject: [PATCH 15/15] Fix failing unit tests related to new validation --- pkg/handlers/primeapi/mto_service_item_test.go | 6 ++++++ pkg/handlers/primeapiv2/mto_service_item_test.go | 5 +++++ pkg/handlers/primeapiv3/mto_service_item_test.go | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/pkg/handlers/primeapi/mto_service_item_test.go b/pkg/handlers/primeapi/mto_service_item_test.go index cc57bed0057..f987915642a 100644 --- a/pkg/handlers/primeapi/mto_service_item_test.go +++ b/pkg/handlers/primeapi/mto_service_item_test.go @@ -257,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" 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/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)