Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B 21557 INT find Estimated price when shipment is updated with an estimated weight where there isn't one previously #14448

Merged
merged 16 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,6 @@
20241204155919_update_ordering_proc.up.sql
20241204210208_retroactive_update_of_ppm_max_and_estimated_incentives_prd.up.sql
20241210143143_redefine_mto_shipment_audit_table.up.sql
20241217163231_update_duty_locations_bad_zips.up.sql
20241216170325_update_nts_enum_name.up.sql
20241217163231_update_duty_locations_bad_zips.up.sql
20241217180136_add_AK_zips_to_zip3_distances.up.sql
21 changes: 17 additions & 4 deletions pkg/handlers/ghcapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,22 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
signedCertificationCreator := signedcertification.NewSignedCertificationCreator()
signedCertificationUpdater := signedcertification.NewSignedCertificationUpdater()
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})

mtoServiceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(
handlerConfig.HHGPlanner(),
queryBuilder,
moveRouter,
ghcrateengine.NewDomesticUnpackPricer(),
ghcrateengine.NewDomesticPackPricer(),
ghcrateengine.NewDomesticLinehaulPricer(),
ghcrateengine.NewDomesticShorthaulPricer(),
ghcrateengine.NewDomesticOriginPricer(),
ghcrateengine.NewDomesticDestinationPricer(),
ghcrateengine.NewFuelSurchargePricer())

moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater(
queryBuilder,
mtoserviceitem.NewMTOServiceItemCreator(handlerConfig.HHGPlanner(), queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
mtoServiceItemCreator,
moveRouter, signedCertificationCreator, signedCertificationUpdater, ppmEstimator,
)

Expand Down Expand Up @@ -232,7 +245,7 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
paymentRequestShipmentRecalculator,
addressUpdater,
addressCreator)
sitExtensionShipmentUpdater := shipment.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
sitExtensionShipmentUpdater := shipment.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, mtoServiceItemCreator)

ghcAPI.MtoServiceItemUpdateServiceItemSitEntryDateHandler = UpdateServiceItemSitEntryDateHandler{
HandlerConfig: handlerConfig,
Expand Down Expand Up @@ -411,7 +424,7 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
handlerConfig,
mtoshipment.NewShipmentApprover(
mtoshipment.NewShipmentRouter(),
mtoserviceitem.NewMTOServiceItemCreator(handlerConfig.HHGPlanner(), queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
mtoServiceItemCreator,
handlerConfig.HHGPlanner(),
move.NewMoveWeights(mtoshipment.NewShipmentReweighRequester()),
),
Expand Down Expand Up @@ -479,7 +492,7 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
addressCreator,
)

shipmentUpdater := shipment.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipment.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, mtoServiceItemCreator)

ghcAPI.MoveSearchMovesHandler = SearchMovesHandler{
HandlerConfig: handlerConfig,
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/ghcapi/mto_service_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (h UpdateServiceItemSitEntryDateHandler) Handle(params mtoserviceitemop.Upd

existingETag := etag.GenerateEtag(shipment.UpdatedAt)

shipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc")
shipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc", nil)
if err != nil {
appCtx.Logger().Error(fmt.Sprintf("Could not update the shipment SIT auth end date for shipment ID: %s: %s", shipment.ID, err))
}
Expand Down Expand Up @@ -266,7 +266,7 @@ func (h UpdateMTOServiceItemStatusHandler) Handle(params mtoserviceitemop.Update

existingETag := etag.GenerateEtag(shipment.UpdatedAt)

shipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc")
shipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc", nil)
if err != nil {
appCtx.Logger().Error(fmt.Sprintf("Could not update the shipment SIT auth end date for shipment ID: %s: %s", shipment.ID, err))
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/ghcapi/mto_service_items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandler() {
ppmShipmentUpdater := ppmshipment.NewPPMShipmentUpdater(&ppmEstimator, addressCreator, addressUpdater)
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
shipmentFetcher := mtoshipment.NewMTOShipmentFetcher()

moveTaskOrderID, _ := uuid.NewV4()
Expand Down Expand Up @@ -777,7 +777,7 @@ func (suite *HandlerSuite) TestUpdateServiceItemSitEntryDateHandler() {
ppmShipmentUpdater := ppmshipment.NewPPMShipmentUpdater(&ppmEstimator, addressCreator, addressUpdater)
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
shipmentFetcher := mtoshipment.NewMTOShipmentFetcher()

suite.Run("200 - success response", func() {
Expand Down
6 changes: 3 additions & 3 deletions pkg/handlers/ghcapi/mto_shipment.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (h UpdateShipmentHandler) Handle(params mtoshipmentops.UpdateMTOShipmentPar
mtoShipment.PrimeEstimatedWeight = &previouslyRecordedWeight
}

updatedMtoShipment, err := h.ShipmentUpdater.UpdateShipment(appCtx, mtoShipment, params.IfMatch, "ghc")
updatedMtoShipment, err := h.ShipmentUpdater.UpdateShipment(appCtx, mtoShipment, params.IfMatch, "ghc", nil)
if err != nil {
return handleError(err)
}
Expand Down Expand Up @@ -1112,7 +1112,7 @@ func (h ApproveSITExtensionHandler) Handle(params shipmentops.ApproveSITExtensio

existingETag := etag.GenerateEtag(updatedShipment.UpdatedAt)

updatedShipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc")
updatedShipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc", nil)
if err != nil {
return handleError(err)
}
Expand Down Expand Up @@ -1359,7 +1359,7 @@ func (h CreateApprovedSITDurationUpdateHandler) Handle(params shipmentops.Create

existingETag := etag.GenerateEtag(shipment.UpdatedAt)

shipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc")
shipment, err = h.UpdateShipment(appCtx, &shipmentWithSITInfo, existingETag, "ghc", nil)
if err != nil {
return handleError(err)
}
Expand Down
23 changes: 12 additions & 11 deletions pkg/handlers/ghcapi/mto_shipment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@ func (suite *HandlerSuite) TestApproveSITExtensionHandler() {
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()

sitExtensionShipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
sitExtensionShipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)

handler := ApproveSITExtensionHandler{
handlerConfig,
Expand Down Expand Up @@ -2903,7 +2903,7 @@ func (suite *HandlerSuite) CreateApprovedSITDurationUpdate() {
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()

sitExtensionShipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
sitExtensionShipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)

handler := CreateApprovedSITDurationUpdateHandler{
handlerConfig,
Expand Down Expand Up @@ -2988,7 +2988,7 @@ func (suite *HandlerSuite) CreateApprovedSITDurationUpdate() {

mobilehomeshipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()

sitExtensionShipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobilehomeshipmentUpdater)
sitExtensionShipmentUpdater := shipmentorchestrator.NewShipmentUpdater(noCheckUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobilehomeshipmentUpdater, nil)

handler := CreateApprovedSITDurationUpdateHandler{
handlerConfig,
Expand Down Expand Up @@ -4048,7 +4048,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {
ppmShipmentUpdater := ppmshipment.NewPPMShipmentUpdater(&ppmEstimator, addressCreator, addressUpdater)
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4116,7 +4116,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4304,7 +4304,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4384,7 +4384,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4464,7 +4464,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4502,7 +4502,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4542,7 +4542,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4583,7 +4583,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {

boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)
handler := UpdateShipmentHandler{
suite.HandlerConfig(),
shipmentUpdater,
Expand Down Expand Up @@ -4627,6 +4627,7 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() {
mock.Anything,
mock.Anything,
mock.Anything,
nil,
).Return(nil, err)

oldShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{
Expand Down
15 changes: 14 additions & 1 deletion pkg/handlers/internalapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,23 @@ func NewInternalAPI(handlerConfig handlers.HandlerConfig) *internalops.MymoveAPI
postalcodeservice.NewPostalCodeValidator(clock.New()),
}

mtoServiceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(
handlerConfig.HHGPlanner(),
builder,
moveRouter,
ghcrateengine.NewDomesticUnpackPricer(),
ghcrateengine.NewDomesticPackPricer(),
ghcrateengine.NewDomesticLinehaulPricer(),
ghcrateengine.NewDomesticShorthaulPricer(),
ghcrateengine.NewDomesticOriginPricer(),
ghcrateengine.NewDomesticDestinationPricer(),
ghcrateengine.NewFuelSurchargePricer())

mtoShipmentCreator := mtoshipment.NewMTOShipmentCreatorV1(builder, fetcher, moveRouter, addressCreator)
shipmentRouter := mtoshipment.NewShipmentRouter()
moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater(
builder,
mtoserviceitem.NewMTOServiceItemCreator(handlerConfig.HHGPlanner(), builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
mtoServiceItemCreator,
moveRouter, signedCertificationCreator, signedCertificationUpdater, ppmEstimator,
)
boatShipmentCreator := boatshipment.NewBoatShipmentCreator()
Expand Down Expand Up @@ -232,6 +244,7 @@ func NewInternalAPI(handlerConfig handlers.HandlerConfig) *internalops.MymoveAPI
ppmShipmentUpdater,
boatShipmentUpdater,
mobileHomeShipmentUpdater,
mtoServiceItemCreator,
)

internalAPI.MtoShipmentUpdateMTOShipmentHandler = UpdateMTOShipmentHandler{
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/internalapi/mto_shipment.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (h UpdateMTOShipmentHandler) Handle(params mtoshipmentops.UpdateMTOShipment
h.GetTraceIDFromRequest(params.HTTPRequest))), invalidShipmentStatusErr
}

updatedMTOShipment, err := h.shipmentUpdater.UpdateShipment(appCtx, mtoShipment, params.IfMatch, "internal")
updatedMTOShipment, err := h.shipmentUpdater.UpdateShipment(appCtx, mtoShipment, params.IfMatch, "internal", nil)

if err != nil {
appCtx.Logger().Error("internalapi.UpdateMTOShipmentHandler", zap.Error(err))
Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/internalapi/mto_shipment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func (suite *HandlerSuite) TestUpdateMTOShipmentHandler() {
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()

shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipmentorchestrator.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, nil)

authRequestAndSetUpHandlerAndParams := func(originalShipment models.MTOShipment, mockShipmentUpdater *mocks.ShipmentUpdater) (UpdateMTOShipmentHandler, mtoshipmentops.UpdateMTOShipmentParams) {
endpoint := fmt.Sprintf("/mto-shipments/%s", originalShipment.ID.String())
Expand Down Expand Up @@ -1484,6 +1484,7 @@ func (suite *HandlerSuite) TestUpdateMTOShipmentHandler() {
mock.AnythingOfType("*models.MTOShipment"),
mock.AnythingOfType("string"),
mock.AnythingOfType("string"),
nil,
).Return(nil, err)

subtestData := getDefaultMTOShipmentAndParams(&mockUpdater)
Expand Down
17 changes: 15 additions & 2 deletions pkg/handlers/primeapiv2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,21 @@ func NewPrimeAPI(handlerConfig handlers.HandlerConfig) *primev2operations.Mymove
signedCertificationUpdater := signedcertification.NewSignedCertificationUpdater()
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})

mtoServiceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(
handlerConfig.HHGPlanner(),
queryBuilder,
moveRouter,
ghcrateengine.NewDomesticUnpackPricer(),
ghcrateengine.NewDomesticPackPricer(),
ghcrateengine.NewDomesticLinehaulPricer(),
ghcrateengine.NewDomesticShorthaulPricer(),
ghcrateengine.NewDomesticOriginPricer(),
ghcrateengine.NewDomesticDestinationPricer(),
ghcrateengine.NewFuelSurchargePricer())

moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater(
queryBuilder,
mtoserviceitem.NewMTOServiceItemCreator(handlerConfig.HHGPlanner(), queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
mtoServiceItemCreator,
moveRouter, signedCertificationCreator, signedCertificationUpdater, ppmEstimator,
)

Expand Down Expand Up @@ -95,10 +107,11 @@ func NewPrimeAPI(handlerConfig handlers.HandlerConfig) *primev2operations.Mymove
ppmShipmentUpdater := ppmshipment.NewPPMShipmentUpdater(ppmEstimator, addressCreator, addressUpdater)
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobilehomeshipment.NewMobileHomeShipmentUpdater()
shipmentUpdater := shipment.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater)
shipmentUpdater := shipment.NewShipmentUpdater(mtoShipmentUpdater, ppmShipmentUpdater, boatShipmentUpdater, mobileHomeShipmentUpdater, mtoServiceItemCreator)
primeAPIV2.MtoShipmentUpdateMTOShipmentHandler = UpdateMTOShipmentHandler{
handlerConfig,
shipmentUpdater,
handlerConfig.DTODPlanner(),
}

return primeAPIV2
Expand Down
Loading
Loading