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-20947: SSW Actual Obligations 100% GCC Calculations #13705

Merged
merged 3 commits into from
Sep 12, 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
9 changes: 8 additions & 1 deletion cmd/generate-shipment-summary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import (
"github.com/transcom/mymove/pkg/cli"
"github.com/transcom/mymove/pkg/logging"
"github.com/transcom/mymove/pkg/paperwork"
paymentrequesthelper "github.com/transcom/mymove/pkg/payment_request"
"github.com/transcom/mymove/pkg/route"
ppmcloseout "github.com/transcom/mymove/pkg/services/ppm_closeout"
"github.com/transcom/mymove/pkg/services/ppmshipment"
shipmentsummaryworksheet "github.com/transcom/mymove/pkg/services/shipment_summary_worksheet"
"github.com/transcom/mymove/pkg/storage"
"github.com/transcom/mymove/pkg/uploader"
Expand Down Expand Up @@ -148,7 +151,11 @@ func main() {

// TODO: Future cleanup will need to remap to a different planner, but this command should remain for testing purposes
planner := route.NewHEREPlanner(hereClient, geocodeEndpoint, routingEndpoint, testAppID, testAppCode)
ppmComputer := shipmentsummaryworksheet.NewSSWPPMComputer()
ppmEstimator := ppmshipment.NewEstimatePPM(planner, &paymentrequesthelper.RequestPaymentHelper{})

ppmCloseoutFetcher := ppmcloseout.NewPPMCloseoutFetcher(planner, &paymentrequesthelper.RequestPaymentHelper{}, ppmEstimator)

ppmComputer := shipmentsummaryworksheet.NewSSWPPMComputer(ppmCloseoutFetcher)

ssfd, err := ppmComputer.FetchDataShipmentSummaryWorksheetFormData(appCtx, &auth.Session{}, parsedID)
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/handlers/ghcapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
moveRouter, signedCertificationCreator, signedCertificationUpdater,
)

SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer()
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})
ppmCloseoutFetcher := ppmcloseout.NewPPMCloseoutFetcher(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{}, ppmEstimator)
SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer(ppmCloseoutFetcher)
uploadCreator := upload.NewUploadCreator(handlerConfig.FileStorer())

userUploader, err := uploader.NewUserUploader(handlerConfig.FileStorer(), uploader.MaxCustomerUserUploadFileSizeLimit)
Expand Down Expand Up @@ -198,7 +200,6 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
)
paymentRequestShipmentRecalculator := paymentrequest.NewPaymentRequestShipmentRecalculator(paymentRequestRecalculator)
addressUpdater := address.NewAddressUpdater()
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})
ppmShipmentUpdater := ppmshipment.NewPPMShipmentUpdater(ppmEstimator, addressCreator, addressUpdater)
boatShipmentUpdater := boatshipment.NewBoatShipmentUpdater()
mobileHomeShipmentUpdater := mobileHomeShipment.NewMobileHomeShipmentUpdater()
Expand Down Expand Up @@ -569,8 +570,6 @@ func NewGhcAPIHandler(handlerConfig handlers.HandlerConfig) *ghcops.MymoveAPI {
ppmDocumentsFetcher,
}

ppmCloseoutFetcher := ppmcloseout.NewPPMCloseoutFetcher(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{}, ppmEstimator)

ghcAPI.PpmGetPPMCloseoutHandler = GetPPMCloseoutHandler{
handlerConfig,
ppmCloseoutFetcher,
Expand Down
6 changes: 4 additions & 2 deletions pkg/handlers/internalapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/transcom/mymove/pkg/services/paperwork"
paymentrequest "github.com/transcom/mymove/pkg/services/payment_request"
postalcodeservice "github.com/transcom/mymove/pkg/services/postal_codes"
ppmcloseout "github.com/transcom/mymove/pkg/services/ppm_closeout"
"github.com/transcom/mymove/pkg/services/ppmshipment"
progear "github.com/transcom/mymove/pkg/services/progear_weight_ticket"
"github.com/transcom/mymove/pkg/services/query"
Expand All @@ -57,7 +58,9 @@ func NewInternalAPI(handlerConfig handlers.HandlerConfig) *internalops.MymoveAPI
fetcher := fetch.NewFetcher(builder)
moveRouter := move.NewMoveRouter()
uploadCreator := upload.NewUploadCreator(handlerConfig.FileStorer())
SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer()
ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})
ppmCloseoutFetcher := ppmcloseout.NewPPMCloseoutFetcher(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{}, ppmEstimator)
SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer(ppmCloseoutFetcher)

userUploader, err := uploader.NewUserUploader(handlerConfig.FileStorer(), uploader.MaxCustomerUserUploadFileSizeLimit)
if err != nil {
Expand All @@ -81,7 +84,6 @@ func NewInternalAPI(handlerConfig handlers.HandlerConfig) *internalops.MymoveAPI
log.Fatalln(err)
}

ppmEstimator := ppmshipment.NewEstimatePPM(handlerConfig.DTODPlanner(), &paymentrequesthelper.RequestPaymentHelper{})
signedCertificationCreator := signedcertification.NewSignedCertificationCreator()
signedCertificationUpdater := signedcertification.NewSignedCertificationUpdater()
mtoShipmentRouter := mtoshipment.NewShipmentRouter()
Expand Down
72 changes: 72 additions & 0 deletions pkg/models/worksheet_shipment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package models

import (
"time"

"github.com/transcom/mymove/pkg/unit"
)

// WorkSheetShipments is an object representing shipment line items on Shipment Summary Worksheet
type WorkSheetShipments struct {
ShipmentNumberAndTypes string
PickUpDates string
ShipmentWeights string
ShipmentWeightForObligation string
CurrentShipmentStatuses string
}

// WorkSheetShipment is an object representing specific shipment items on Shipment Summary Worksheet
type WorkSheetShipment struct {
EstimatedIncentive string
MaxAdvance string
FinalIncentive string
AdvanceAmountReceived string
ShipmentNumberAndTypes string
PickUpDates string
ShipmentWeights string
ShipmentWeightForObligation string
CurrentShipmentStatuses string
}

// SSWMaxWeightEntitlement weight allotment for the shipment summary worksheet.
type SSWMaxWeightEntitlement struct {
Entitlement unit.Pound
ProGear unit.Pound
SpouseProGear unit.Pound
TotalWeight unit.Pound
}

// Obligations is an object representing the winning and non-winning Max Obligation and Actual Obligation sections of the shipment summary worksheet
type Obligations struct {
MaxObligation Obligation
ActualObligation Obligation
NonWinningMaxObligation Obligation
NonWinningActualObligation Obligation
}

// Obligation an object representing the obligations section on the shipment summary worksheet
type Obligation struct {
Gcc unit.Cents
SIT unit.Cents
Miles unit.Miles
}

// ShipmentSummaryFormData is a container for the various objects required for the a Shipment Summary Worksheet
type ShipmentSummaryFormData struct {
ServiceMember ServiceMember
Order Order
Move Move
CurrentDutyLocation DutyLocation
NewDutyLocation DutyLocation
WeightAllotment SSWMaxWeightEntitlement
PPMShipment PPMShipment
PPMShipments PPMShipments
PPMShipmentFinalWeight unit.Pound
W2Address *Address
PreparationDate time.Time
Obligations Obligations
MovingExpenses MovingExpenses
PPMRemainingEntitlement float64
SignedCertifications []*SignedCertification
MaxSITStorageEntitlement int
}
96 changes: 80 additions & 16 deletions pkg/services/mocks/SSWPPMComputer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/services/ppmshipment/aoa_packet_creator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ func (suite *PPMShipmentSuite) TestCreateAOAPacketFull() {
suite.FatalNil(err)
}

SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer()
mockPPMCloseoutFetcher := &mocks.PPMCloseoutFetcher{}
SSWPPMComputer := shipmentsummaryworksheet.NewSSWPPMComputer(mockPPMCloseoutFetcher)
ppmGenerator, err := shipmentsummaryworksheet.NewSSWPPMGenerator(generator)
suite.FatalNoError(err)

Expand Down
Loading