From dc9da01a04769c03aa9934414043245138ccbf38 Mon Sep 17 00:00:00 2001 From: Brooklyn Welsh Date: Mon, 13 Jan 2025 21:13:36 +0000 Subject: [PATCH 1/2] RemainingPPMEntitlement now subtracts the GTCC paid SIT and MemberPaidSit from the calculation. Disbursement now uses the finalIncentive value before this subtraction. Member disbursement still adds memberpaidsit --- .../shipment_summary_worksheet.go | 18 ++++++++---- .../shipment_summary_worksheet_test.go | 29 ++++++++++--------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go index a0d4ab3a421..910db28040b 100644 --- a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go +++ b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet.go @@ -208,7 +208,7 @@ func SSWGetEntitlement(grade internalmessages.OrderPayGrade, hasDependents bool, } // Calculates cost for the Remaining PPM Incentive (pre-tax) field on page 2 of SSW form. -func CalculateRemainingPPMEntitlement(finalIncentive *unit.Cents, sitMemberPaid float64, sitGTCCPaid float64, aoa *unit.Cents) float64 { +func CalculateRemainingPPMEntitlement(finalIncentive *unit.Cents, aoa *unit.Cents) float64 { // FinalIncentive var finalIncentiveFloat float64 = 0 if finalIncentive != nil { @@ -223,7 +223,7 @@ func CalculateRemainingPPMEntitlement(finalIncentive *unit.Cents, sitMemberPaid // This costing is computed by taking the Actual Obligations 100% GCC plus the // SIT cost calculated (if SIT was approved and accepted) minus any Advance // Operating Allowance (AOA) the customer identified as receiving in the Document upload process - return (finalIncentiveFloat + sitMemberPaid + sitGTCCPaid) - aoaFloat + return finalIncentiveFloat - aoaFloat } const ( @@ -328,7 +328,7 @@ func (s *SSWPPMComputer) FormatValuesShipmentSummaryWorksheetFormPage2(data mode if data.IsActualExpenseReimbursement { data.PPMRemainingEntitlement = 0.0 } else { - data.PPMRemainingEntitlement = CalculateRemainingPPMEntitlement(data.PPMShipment.FinalIncentive, expensesMap["StorageMemberPaid"], expensesMap["StorageGTCCPaid"], data.PPMShipment.AdvanceAmountReceived) + data.PPMRemainingEntitlement = CalculateRemainingPPMEntitlement(data.PPMShipment.FinalIncentive, data.PPMShipment.AdvanceAmountReceived) } page2.PPMRemainingEntitlement = FormatDollars(data.PPMRemainingEntitlement) @@ -336,7 +336,15 @@ func (s *SSWPPMComputer) FormatValuesShipmentSummaryWorksheetFormPage2(data mode if err != nil { return page2, err } - page2.Disbursement = formatDisbursement(expensesMap, data.PPMRemainingEntitlement) + var finalIncentiveFloat float64 = 0 + if data.PPMShipment.FinalIncentive != nil { + finalIncentiveFloat = float64(*data.PPMShipment.FinalIncentive) / 100 + } + var aoaFloat float64 = 0 + if data.PPMShipment.AdvanceAmountReceived != nil { + aoaFloat = float64(*data.PPMShipment.AdvanceAmountReceived) / 100 + } + page2.Disbursement = formatDisbursement(expensesMap, finalIncentiveFloat-aoaFloat) } else { page2.PreparationDate2 = formatAOADate(data.SignedCertifications, data.PPMShipment.ID) page2.Disbursement = "N/A" @@ -950,7 +958,7 @@ func formatDisbursement(expensesMap map[string]float64, ppmRemainingEntitlement disbursementGTCC = 0 } else { // Disbursement Member is remaining entitlement plus member SIT minus GTCC Disbursement, not less than 0. - disbursementMember = ppmRemainingEntitlement + expensesMap["StorageMemberPaid"] - disbursementGTCC + disbursementMember = ppmRemainingEntitlement + expensesMap["StorageMemberPaid"] } // Return formatted values in string diff --git a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go index 8f89327f6f2..c1e6396efd8 100644 --- a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go +++ b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go @@ -26,6 +26,11 @@ import ( "github.com/transcom/mymove/pkg/uploader" ) +// Helper function to format disbursement field for equal checks +var expectedDisbursementString = func(expectedGTCC int, expectedMember int) string { + return "GTCC: " + FormatDollars((models.CentPointer(unit.Cents(expectedGTCC)).ToMillicents().ToDollarFloat())) + "\nMember: " + FormatDollars(models.CentPointer(unit.Cents(expectedMember)).ToMillicents().ToDollarFloat()) +} + func (suite *ShipmentSummaryWorksheetServiceSuite) TestFetchDataShipmentSummaryWorksheet() { //advanceID, _ := uuid.NewV4() ordersType := internalmessages.OrdersTypePERMANENTCHANGEOFSTATION @@ -693,7 +698,8 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestMemberPaidRemainingPPMEnt sswPPMComputer := NewSSWPPMComputer(mockPPMCloseoutFetcher) expensesMap := SubTotalExpenses(ssd.MovingExpenses) sswPage2, _ := sswPPMComputer.FormatValuesShipmentSummaryWorksheetFormPage2(ssd, true, expensesMap) - suite.Equal("$4.00", sswPage2.PPMRemainingEntitlement) + suite.Equal("$3.00", sswPage2.PPMRemainingEntitlement) + suite.Equal(expectedDisbursementString(0, 400), sswPage2.Disbursement) } func (suite *ShipmentSummaryWorksheetServiceSuite) TestAOAPacketPPMEntitlementFormatValuesShipmentSummaryWorksheetFormPage2() { @@ -777,7 +783,8 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestNullCheckForFinalIncentiv sswPPMComputer := NewSSWPPMComputer(mockPPMCloseoutFetcher) expensesMap := SubTotalExpenses(ssd.MovingExpenses) sswPage2, _ := sswPPMComputer.FormatValuesShipmentSummaryWorksheetFormPage2(ssd, true, expensesMap) - suite.Equal("$1.00", sswPage2.PPMRemainingEntitlement) + suite.Equal("$0.00", sswPage2.PPMRemainingEntitlement) + suite.Equal(expectedDisbursementString(0, 100), sswPage2.Disbursement) } func (suite *ShipmentSummaryWorksheetServiceSuite) TestGTCCPaidRemainingPPMEntitlementFormatValuesShipmentSummaryWorksheetFormPage2() { @@ -827,7 +834,8 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestGTCCPaidRemainingPPMEntit mockPPMCloseoutFetcher := &mocks.PPMCloseoutFetcher{} sswPPMComputer := NewSSWPPMComputer(mockPPMCloseoutFetcher) sswPage2, _ := sswPPMComputer.FormatValuesShipmentSummaryWorksheetFormPage2(ssd, true, expensesMap) - suite.Equal("$105.00", sswPage2.PPMRemainingEntitlement) + suite.Equal("$5.00", sswPage2.PPMRemainingEntitlement) + suite.Equal(expectedDisbursementString(500, 500), sswPage2.Disbursement) } func (suite *ShipmentSummaryWorksheetServiceSuite) TestGroupExpenses() { paidWithGTCC := false @@ -1320,11 +1328,6 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestFillSSWPDFForm() { func (suite *ShipmentSummaryWorksheetServiceSuite) TestActualExpenseReimbursementCalculations() { - // Helper function to format disbursement field for equal checks - expectedDisbursementString := func(expectedGTCC int, expectedMember int) string { - return "GTCC: " + FormatDollars((models.CentPointer(unit.Cents(expectedGTCC)).ToMillicents().ToDollarFloat())) + "\nMember: " + FormatDollars(models.CentPointer(unit.Cents(expectedMember)).ToMillicents().ToDollarFloat()) - } - fakeS3 := storageTest.NewFakeS3Storage(true) userUploader, uploaderErr := uploader.NewUserUploader(fakeS3, 25*uploader.MB) suite.FatalNoError(uploaderErr) @@ -1950,23 +1953,23 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatDisbursement() { // Test case 1: GTCC calculation B is less than GTCC calculation A // Additionally, Member should not be less than 0 - expectedResult := "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(0) + expectedResult := "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(100.00) expensesMap["TotalGTCCPaid"] = 200.00 expensesMap["StorageGTCCPaid"] = 300.00 ppmRemainingEntitlement := 60.00 expensesMap["StorageMemberPaid"] = 40.00 result := formatDisbursement(expensesMap, ppmRemainingEntitlement) - suite.Equal(result, expectedResult) + suite.Equal(expectedResult, result) // Test case 2: GTCC calculation A is less than GTCC calculation B - expectedResult = "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(400.00) + expectedResult = "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(500.00) expensesMap = make(map[string]float64) expensesMap["TotalGTCCPaid"] = 60.00 expensesMap["StorageGTCCPaid"] = 40.00 ppmRemainingEntitlement = 300.00 expensesMap["StorageMemberPaid"] = 200.00 result = formatDisbursement(expensesMap, ppmRemainingEntitlement) - suite.Equal(result, expectedResult) + suite.Equal(expectedResult, result) // Test case 3: GTCC calculation is less than 0 expectedResult = "GTCC: " + FormatDollars(0) + "\nMember: " + FormatDollars(-250.00) @@ -1976,5 +1979,5 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatDisbursement() { ppmRemainingEntitlement = -300.00 expensesMap["StorageMemberPaid"] = 50.00 result = formatDisbursement(expensesMap, ppmRemainingEntitlement) - suite.Equal(result, expectedResult) + suite.Equal(expectedResult, result) } From 6535db7a0358b804e2324c4eed76077edbdf9b42 Mon Sep 17 00:00:00 2001 From: Brooklyn Welsh Date: Tue, 14 Jan 2025 21:33:13 +0000 Subject: [PATCH 2/2] Removed accidental change --- .../office/servicescounseling/servicesCounselingFlows.spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js index 5d8736e16e9..16db36fbc3c 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js @@ -323,8 +323,6 @@ test.describe('Services counselor user', () => { await expect(page.getByText(LocationLookup, { exact: true })).toBeVisible(); await page.keyboard.press('Enter'); await page.locator('select[name="destinationType"]').selectOption({ label: 'Home of selection (HOS)' }); - await page.getByLabel('Requested pickup date').fill('16 Mar 2022'); - await page.locator('[data-testid="submitForm"]').click(); await scPage.waitForLoading();