Skip to content

Commit

Permalink
Merge pull request #14339 from transcom/MAIN-B-22057
Browse files Browse the repository at this point in the history
MAIN B-22057
  • Loading branch information
deandreJones authored Dec 5, 2024
2 parents 6fb6ae6 + 7f3df71 commit 4f4aa24
Show file tree
Hide file tree
Showing 31 changed files with 219 additions and 57 deletions.
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1034,3 +1034,4 @@
20241111223224_change_international_sit_services_to_accessorials.up.sql
20241202163059_create_test_sequence_dev_env.up.sql
20241203024453_add_ppm_max_incentive_column.up.sql
20241204210208_retroactive_update_of_ppm_max_and_estimated_incentives_prd.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Local test migration.
-- This will be run on development environments.
-- It should mirror what you intend to apply on loadtest/demo/exp/stg/prd
-- DO NOT include any sensitive data.
3 changes: 3 additions & 0 deletions pkg/factory/ppm_shipment_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func buildPPMShipmentWithBuildType(db *pop.Connection, customs []Customization,
ppmShipment.ProGearWeight = models.PoundPointer(unit.Pound(1987))
ppmShipment.SpouseProGearWeight = models.PoundPointer(unit.Pound(498))
ppmShipment.EstimatedIncentive = models.CentPointer(unit.Cents(1000000))
ppmShipment.MaxIncentive = models.CentPointer(unit.Cents(2000000))
ppmShipment.HasRequestedAdvance = models.BoolPointer(true)
ppmShipment.AdvanceAmountRequested = models.CentPointer(unit.Cents(598700))
}
Expand Down Expand Up @@ -859,12 +860,14 @@ func AddSignedCertificationToPPMShipment(db *pop.Connection, ppmShipment *models
func GetTraitPPMShipmentReadyForPaymentRequest() []Customization {
estimatedWeight := unit.Pound(200)
estimateIncentive := unit.Cents(1000)
maxIncentive := unit.Cents(2000)
return []Customization{
{
Model: models.PPMShipment{
Status: models.PPMShipmentStatusWaitingOnCustomer,
EstimatedWeight: &estimatedWeight,
EstimatedIncentive: &estimateIncentive,
MaxIncentive: &maxIncentive,
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions pkg/factory/ppm_shipment_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func (suite *FactorySuite) TestBuildPPMShipment() {
ProGearWeight: models.PoundPointer(unit.Pound(1987)),
SpouseProGearWeight: models.PoundPointer(unit.Pound(498)),
EstimatedIncentive: models.CentPointer(unit.Cents(1000000)),
MaxIncentive: models.CentPointer(unit.Cents(2000000)),
HasRequestedAdvance: models.BoolPointer(true),
AdvanceAmountRequested: models.CentPointer(unit.Cents(598700)),
PickupAddress: &models.Address{
Expand Down Expand Up @@ -76,6 +77,7 @@ func (suite *FactorySuite) TestBuildPPMShipment() {
suite.Equal(defaultPPM.ProGearWeight, ppmShipment.ProGearWeight)
suite.Equal(defaultPPM.SpouseProGearWeight, ppmShipment.SpouseProGearWeight)
suite.Equal(defaultPPM.EstimatedIncentive, ppmShipment.EstimatedIncentive)
suite.Equal(defaultPPM.MaxIncentive, ppmShipment.MaxIncentive)
suite.Equal(defaultPPM.HasRequestedAdvance, ppmShipment.HasRequestedAdvance)
suite.Equal(defaultPPM.AdvanceAmountRequested, ppmShipment.AdvanceAmountRequested)
})
Expand Down Expand Up @@ -103,6 +105,7 @@ func (suite *FactorySuite) TestBuildPPMShipment() {
suite.Nil(ppmShipment.ProGearWeight)
suite.Nil(ppmShipment.SpouseProGearWeight)
suite.Nil(ppmShipment.EstimatedIncentive)
suite.Nil(ppmShipment.MaxIncentive)
suite.Nil(ppmShipment.HasRequestedAdvance)
suite.Nil(ppmShipment.AdvanceAmountRequested)
})
Expand All @@ -122,6 +125,7 @@ func (suite *FactorySuite) TestBuildPPMShipment() {
EstimatedWeight: models.PoundPointer(unit.Pound(3000)),
SpouseProGearWeight: models.PoundPointer(unit.Pound(123)),
EstimatedIncentive: models.CentPointer(unit.Cents(1005000)),
MaxIncentive: models.CentPointer(unit.Cents(2005000)),
HasRequestedAdvance: models.BoolPointer(true),
AdvanceAmountRequested: models.CentPointer(unit.Cents(600000)),
SITExpected: models.BoolPointer(true),
Expand Down Expand Up @@ -150,6 +154,7 @@ func (suite *FactorySuite) TestBuildPPMShipment() {
suite.Equal(customPPM.ProGearWeight, ppmShipment.ProGearWeight)
suite.Equal(customPPM.SpouseProGearWeight, ppmShipment.SpouseProGearWeight)
suite.Equal(customPPM.EstimatedIncentive, ppmShipment.EstimatedIncentive)
suite.Equal(customPPM.MaxIncentive, ppmShipment.MaxIncentive)
suite.Equal(customPPM.HasRequestedAdvance, ppmShipment.HasRequestedAdvance)
suite.Equal(customPPM.AdvanceAmountRequested, ppmShipment.AdvanceAmountRequested)
// Check that the address and phoneline were customized
Expand Down
5 changes: 4 additions & 1 deletion pkg/handlers/adminapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/transcom/mymove/pkg/gen/adminapi"
adminops "github.com/transcom/mymove/pkg/gen/adminapi/adminoperations"
"github.com/transcom/mymove/pkg/handlers"
paymentrequest "github.com/transcom/mymove/pkg/payment_request"
adminuser "github.com/transcom/mymove/pkg/services/admin_user"
"github.com/transcom/mymove/pkg/services/clientcert"
electronicorder "github.com/transcom/mymove/pkg/services/electronic_order"
Expand All @@ -21,6 +22,7 @@ import (
"github.com/transcom/mymove/pkg/services/organization"
"github.com/transcom/mymove/pkg/services/pagination"
prsff "github.com/transcom/mymove/pkg/services/payment_request"
"github.com/transcom/mymove/pkg/services/ppmshipment"
"github.com/transcom/mymove/pkg/services/query"
requestedofficeusers "github.com/transcom/mymove/pkg/services/requested_office_users"
"github.com/transcom/mymove/pkg/services/roles"
Expand All @@ -45,6 +47,7 @@ func NewAdminAPI(handlerConfig handlers.HandlerConfig) *adminops.MymoveAPI {
queryBuilder := query.NewQueryBuilder()
officeUpdater := officeuser.NewOfficeUserUpdater(queryBuilder)
adminUpdater := adminuser.NewAdminUserUpdater(queryBuilder)
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequest.RequestPaymentHelper{})

adminAPI.ServeError = handlers.ServeCustomError

Expand Down Expand Up @@ -202,7 +205,7 @@ func NewAdminAPI(handlerConfig handlers.HandlerConfig) *adminops.MymoveAPI {
movetaskorder.NewMoveTaskOrderUpdater(
queryBuilder,
mtoserviceitem.NewMTOServiceItemCreator(handlerConfig.HHGPlanner(), queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
moveRouter, signedCertificationCreator, signedCertificationUpdater,
moveRouter, signedCertificationCreator, signedCertificationUpdater, ppmEstimator,
),
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/handlers/adminapi/moves_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (suite *HandlerSuite) TestUpdateMoveHandler() {

return mockUpdater
}
ppmEstimator := &mocks.PPMEstimator{}
setupHandler := func() UpdateMoveHandler {
builder := query.NewQueryBuilder()
moveRouter := move.NewMoveRouter()
Expand All @@ -122,7 +123,7 @@ func (suite *HandlerSuite) TestUpdateMoveHandler() {
movetaskorder.NewMoveTaskOrderUpdater(
builder,
mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil),
moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator,
),
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/ghcapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
newRolesFetcher := roles.NewRolesFetcher()
signedCertificationCreator := signedcertification.NewSignedCertificationCreator()
signedCertificationUpdater := signedcertification.NewSignedCertificationUpdater()
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})
moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater(
queryBuilder,
mtoserviceitem.NewMTOServiceItemCreator(handlerConfig.HHGPlanner(), queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()),
moveRouter, signedCertificationCreator, signedCertificationUpdater,
moveRouter, signedCertificationCreator, signedCertificationUpdater, ppmEstimator,
)

ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})
ppmCloseoutFetcher := ppmcloseout.NewPPMCloseoutFetcher(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{}, ppmEstimator)
SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer(ppmCloseoutFetcher)
uploadCreator := upload.NewUploadCreator(handlerConfig.FileStorer())
Expand Down
1 change: 1 addition & 0 deletions pkg/handlers/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ func PPMShipment(_ storage.FileStorer, ppmShipment *models.PPMShipment) *ghcmess
ProGearWeight: handlers.FmtPoundPtr(ppmShipment.ProGearWeight),
SpouseProGearWeight: handlers.FmtPoundPtr(ppmShipment.SpouseProGearWeight),
EstimatedIncentive: handlers.FmtCost(ppmShipment.EstimatedIncentive),
MaxIncentive: handlers.FmtCost(ppmShipment.MaxIncentive),
HasRequestedAdvance: ppmShipment.HasRequestedAdvance,
AdvanceAmountRequested: handlers.FmtCost(ppmShipment.AdvanceAmountRequested),
HasReceivedAdvance: ppmShipment.HasReceivedAdvance,
Expand Down
12 changes: 8 additions & 4 deletions pkg/handlers/ghcapi/move_task_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (suite *HandlerSuite) TestGetMoveTaskOrderHandlerIntegration() {
}

func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationSuccess() {
ppmEstimator := &mocks.PPMEstimator{}
setupPricerData := func() {
contract := testdatagen.FetchOrMakeReContract(suite.DB(), testdatagen.Assertions{})

Expand Down Expand Up @@ -193,7 +194,7 @@ func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationSuccess() {

// setup the handler
handler := UpdateMoveTaskOrderStatusHandlerFunc{handlerConfig,
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil)),
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator),
}

// Validate incoming payload: no body to validate
Expand Down Expand Up @@ -306,6 +307,7 @@ func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationWithIncomple
handlerConfig := suite.HandlerConfig()
queryBuilder := query.NewQueryBuilder()
moveRouter := moverouter.NewMoveRouter()
ppmEstimator := &mocks.PPMEstimator{}
planner := &routemocks.Planner{}
planner.On("ZipTransitDistance",
mock.AnythingOfType("*appcontext.appContext"),
Expand Down Expand Up @@ -342,7 +344,7 @@ func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationWithIncomple

// make the request
handler := UpdateMoveTaskOrderStatusHandlerFunc{handlerConfig,
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil)),
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator),
}

// Validate incoming payload: no body to validate
Expand All @@ -364,6 +366,7 @@ func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationWithIncomple
}

func (suite *HandlerSuite) TestUpdateMTOStatusServiceCounselingCompletedHandler() {
ppmEstimator := &mocks.PPMEstimator{}
setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator {
mockCreator := &mocks.SignedCertificationCreator{}

Expand Down Expand Up @@ -402,7 +405,7 @@ func (suite *HandlerSuite) TestUpdateMTOStatusServiceCounselingCompletedHandler(
siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer())
handler := UpdateMTOStatusServiceCounselingCompletedHandlerFunc{
handlerConfig,
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil)),
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator),
}
return handler
}
Expand Down Expand Up @@ -599,6 +602,7 @@ func (suite *HandlerSuite) TestUpdateMTOStatusServiceCounselingCompletedHandler(
}

func (suite *HandlerSuite) TestUpdateMoveTIORemarksHandler() {
ppmEstimator := &mocks.PPMEstimator{}
setupTestData := func() (models.Move, UpdateMoveTIORemarksHandlerFunc, models.User) {
moveTaskOrder := factory.BuildMove(suite.DB(), []factory.Customization{
{
Expand Down Expand Up @@ -646,7 +650,7 @@ func (suite *HandlerSuite) TestUpdateMoveTIORemarksHandler() {
siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer())
handler := UpdateMoveTIORemarksHandlerFunc{
handlerConfig,
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil)),
movetaskorder.NewMoveTaskOrderUpdater(queryBuilder, siCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator),
}
return moveTaskOrder, handler, requestUser
}
Expand Down
Loading

0 comments on commit 4f4aa24

Please sign in to comment.