Skip to content

Commit

Permalink
Merge pull request #14262 from transcom/B-21367-INT3-Updated-third-ad…
Browse files Browse the repository at this point in the history
…dress-error-message

B 21367 INT3 updated third address error message
  • Loading branch information
joeydoyecaci authored Nov 21, 2024
2 parents 3b5b242 + b74a669 commit dccd6dd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions pkg/handlers/primeapiv3/mto_shipment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1396,8 +1396,8 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() {
suite.IsType(&mtoshipmentops.CreateMTOShipmentUnprocessableEntity{}, response)
errResponse := response.(*mtoshipmentops.CreateMTOShipmentUnprocessableEntity)

suite.Contains(*errResponse.Payload.Detail, "mto shipment is missing a secondary pickup/destination address")
suite.Contains(errResponse.Payload.InvalidFields["error validating mto shipment"][0], "MTO Shipment cannot have a tertiary address without a secondary address present")
suite.Contains(*errResponse.Payload.Detail, "Invalid input found while validating the MTO shipment")
suite.Contains(errResponse.Payload.InvalidFields["error validating mto shipment"][0], "Shipment cannot have a third address without a second address present")
})

suite.Run("POST failure - Error creating an mto shipment with ppm shipment contains tertiary pickup address no secondary pickup address.", func() {
Expand Down Expand Up @@ -1456,7 +1456,7 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() {
errResponse := response.(*mtoshipmentops.CreateMTOShipmentUnprocessableEntity)

suite.Contains(*errResponse.Payload.Detail, "Invalid input found while validating the PPM shipment.")
suite.Contains(errResponse.Payload.InvalidFields["error validating ppm shipment"][0], "PPM Shipment cannot have a tertiary address without a secondary address present")
suite.Contains(errResponse.Payload.InvalidFields["error validating ppm shipment"][0], "Shipment cannot have a third address without a second address present")
})

suite.Run("POST failure - Error creating mto shipment containing a ppm shipment contains tertiary destination address no secondary destination address.", func() {
Expand Down Expand Up @@ -1515,7 +1515,7 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() {
errResponse := response.(*mtoshipmentops.CreateMTOShipmentUnprocessableEntity)

suite.Contains(*errResponse.Payload.Detail, "Invalid input found while validating the PPM shipment.")
suite.Contains(errResponse.Payload.InvalidFields["error validating ppm shipment"][0], "PPM Shipment cannot have a tertiary address without a secondary address present")
suite.Contains(errResponse.Payload.InvalidFields["error validating ppm shipment"][0], "Shipment cannot have a third address without a second address present")
})
suite.Run("PATCH failure - Error updating an mto shipment contains tertiary pickup address no secondary pickup address.", func() {
// Under Test: UpdateMTOShipmentHandler
Expand Down Expand Up @@ -1587,8 +1587,8 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() {
}
patchResponse := patchHandler.Handle(patchParams)
errResponse := patchResponse.(*mtoshipmentops.UpdateMTOShipmentUnprocessableEntity)
suite.Contains(*errResponse.Payload.Detail, "mto shipment is missing a secondary pickup/destination address")
suite.Contains(errResponse.Payload.InvalidFields["error validating mto shipment"][0], "MTO Shipment cannot have a tertiary address without a secondary address present")
suite.Contains(*errResponse.Payload.Detail, "Invalid input found while validating the MTO shipment")
suite.Contains(errResponse.Payload.InvalidFields["error validating mto shipment"][0], "Shipment cannot have a third address without a second address present")

})
suite.Run("PATCH failure - Error updating an ppm shipment contains tertiary destination address no secondary destination address", func() {
Expand Down Expand Up @@ -1636,7 +1636,7 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() {
patchResponse := patchHandler.Handle(patchParams)
errResponse := patchResponse.(*mtoshipmentops.UpdateMTOShipmentUnprocessableEntity)
suite.Contains(*errResponse.Payload.Detail, "Invalid input found while validating the PPM shipment")
suite.Contains(errResponse.Payload.InvalidFields["error validating ppm shipment"][0], "PPM Shipment cannot have a tertiary address without a secondary address present")
suite.Contains(errResponse.Payload.InvalidFields["error validating ppm shipment"][0], "Shipment cannot have a third address without a second address present")

})

Expand Down
8 changes: 4 additions & 4 deletions pkg/services/mto_shipment/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ func MTOShipmentHasTertiaryAddressWithNoSecondaryAddressUpdate() validator {
if newer != nil && older != nil {
squenceIsValid := isMTOAddressUpdateSequenceValid(newer, older)
if !squenceIsValid {
verrs.Add("error validating mto shipment", "MTO Shipment cannot have a tertiary address without a secondary address present")
return apperror.NewInvalidInputError(newer.ID, nil, verrs, "mto shipment is missing a secondary pickup/destination address")
verrs.Add("error validating mto shipment", "Shipment cannot have a third address without a second address present")
return apperror.NewInvalidInputError(newer.ID, nil, verrs, "Invalid input found while validating the MTO shipment")
}
}
return nil
Expand All @@ -213,8 +213,8 @@ func MTOShipmentHasTertiaryAddressWithNoSecondaryAddressCreate() validator {
if newer != nil {
squenceIsValid := isMTOShipmentAddressCreateSequenceValid(*newer)
if !squenceIsValid {
verrs.Add("error validating mto shipment", "MTO Shipment cannot have a tertiary address without a secondary address present")
return apperror.NewInvalidInputError(newer.ID, nil, verrs, "mto shipment is missing a secondary pickup/destination address")
verrs.Add("error validating mto shipment", "Shipment cannot have a third address without a second address present")
return apperror.NewInvalidInputError(newer.ID, nil, verrs, "Invalid input found while validating the MTO shipment")
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/ppmshipment/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func checkPPMShipmentSequenceValidForCreate() ppmShipmentValidator {
verrs := validate.NewErrors()
squenceIsValid := isPPMShipmentAddressCreateSequenceValid(newer)
if !squenceIsValid {
verrs.Add("error validating ppm shipment", "PPM Shipment cannot have a tertiary address without a secondary address present")
verrs.Add("error validating ppm shipment", "Shipment cannot have a third address without a second address present")
return verrs
}
return nil
Expand All @@ -117,7 +117,7 @@ func checkPPMShipmentSequenceValidForUpdate() ppmShipmentValidator {
verrs := validate.NewErrors()
sequenceIsValid := isPPMAddressUpdateSequenceValid(&newer, older)
if !sequenceIsValid {
verrs.Add("error validating ppm shipment", "PPM Shipment cannot have a tertiary address without a secondary address present")
verrs.Add("error validating ppm shipment", "Shipment cannot have a third address without a second address present")
return verrs
}
return nil
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7187,9 +7187,9 @@ cross-fetch@^3.1.5:
node-fetch "2.6.7"

cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
version "7.0.6"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
Expand Down

0 comments on commit dccd6dd

Please sign in to comment.