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

INT B-22057 #14336

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1048,3 +1048,4 @@
20241127133504_add_indexes_speed_up_counseling_offices.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 @@ -869,12 +870,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 @@ -47,6 +49,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 @@ -214,7 +217,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 @@ -78,13 +78,13 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
newTransportaionOfficeAssignmentUpdater := transportaionofficeassignments.NewTransportaionOfficeAssignmentUpdater()
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
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,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