Skip to content

Commit

Permalink
Merge pull request #13594 from transcom/B-20947-GCC-Calculations-int
Browse files Browse the repository at this point in the history
B-20947: SSW Actual Obligations 100% GCC Calculations
  • Loading branch information
TevinAdams authored Aug 30, 2024
2 parents 03e159d + 71ccf28 commit c6684a4
Show file tree
Hide file tree
Showing 10 changed files with 289 additions and 132 deletions.
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
1 change: 0 additions & 1 deletion migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -997,4 +997,3 @@
20240820151043_add_gsr_role.up.sql
20240821180447_populating_locked_price_cents_for_ms_and_cs.up.sql
20240822180409_adding_locked_price_cents_service_param.up.sql
20240820151043_add_gsr_role.up.sql
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 @@ -199,7 +201,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 @@ -570,8 +571,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 unit.Pound
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

0 comments on commit c6684a4

Please sign in to comment.