diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index fb2a94600a3..0e3df3c2b78 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -938,10 +938,10 @@ 20240515164336_ignore_locked_columns_in_moves_table_for_history_log.up.sql 20240516143952_add_pricing_estimate_to_mto_service_items.up.sql 20240516184021_import_pricing_data_ghc.up.sql -20240524214247_add_sit_location_moving_expenses.up.sql 20240521160335_backfill_LOA_FY_TX.up.sql 20240521184834_add_standalone_field_to_service_items.up.sql 20240522124339_add_csr_to_roles.up.sql +20240524214247_add_sit_location_moving_expenses.up.sql 20240530020648_adding_standalone_crate_service_param.up.sql 20240531050324_adding_standalone_crate_cap.up.sql 20240531152430_migrate_data_to_new_ppm_statuses.up.sql diff --git a/pkg/services/ppm_closeout/ppm_closeout.go b/pkg/services/ppm_closeout/ppm_closeout.go index db4ac4a3608..a0596151efa 100644 --- a/pkg/services/ppm_closeout/ppm_closeout.go +++ b/pkg/services/ppm_closeout/ppm_closeout.go @@ -212,6 +212,8 @@ func (p *ppmCloseoutFetcher) GetPPMShipment(appCtx appcontext.AppContext, ppmShi "FinalIncentive", "AdvanceAmountReceived", "Shipment.Distance", + "PickupAddress", + "DestinationAddress", ). Find(&ppmShipment, ppmShipmentID) diff --git a/pkg/services/ppm_closeout/ppm_closeout_test.go b/pkg/services/ppm_closeout/ppm_closeout_test.go index 558a6df4729..3b8996af2ba 100644 --- a/pkg/services/ppm_closeout/ppm_closeout_test.go +++ b/pkg/services/ppm_closeout/ppm_closeout_test.go @@ -71,6 +71,15 @@ func (suite *PPMCloseoutSuite) TestPPMShipmentCreator() { }, }) + testdatagen.FetchOrMakeReZip3(suite.AppContextForTest().DB(), testdatagen.Assertions{ + ReZip3: models.ReZip3{ + Contract: originDomesticServiceArea.Contract, + ContractID: originDomesticServiceArea.ContractID, + DomesticServiceArea: originDomesticServiceArea, + Zip3: "503", + }, + }) + testdatagen.FetchOrMakeReDomesticLinehaulPrice(suite.AppContextForTest().DB(), testdatagen.Assertions{ ReDomesticLinehaulPrice: models.ReDomesticLinehaulPrice{ Contract: originDomesticServiceArea.Contract, diff --git a/pkg/services/ppmshipment/ppm_estimator.go b/pkg/services/ppmshipment/ppm_estimator.go index 1182889cc5e..61f932684c2 100644 --- a/pkg/services/ppmshipment/ppm_estimator.go +++ b/pkg/services/ppmshipment/ppm_estimator.go @@ -50,8 +50,8 @@ func (f *estimatePPM) FinalIncentiveWithDefaultChecks(appCtx appcontext.AppConte func shouldSkipEstimatingIncentive(newPPMShipment *models.PPMShipment, oldPPMShipment *models.PPMShipment) bool { return oldPPMShipment.ExpectedDepartureDate.Equal(newPPMShipment.ExpectedDepartureDate) && - newPPMShipment.PickupPostalCode == oldPPMShipment.PickupPostalCode && - newPPMShipment.DestinationPostalCode == oldPPMShipment.DestinationPostalCode && + newPPMShipment.PickupAddress.PostalCode == oldPPMShipment.PickupAddress.PostalCode && + newPPMShipment.DestinationAddress.PostalCode == oldPPMShipment.DestinationAddress.PostalCode && ((newPPMShipment.EstimatedWeight == nil && oldPPMShipment.EstimatedWeight == nil) || (oldPPMShipment.EstimatedWeight != nil && newPPMShipment.EstimatedWeight.Int() == oldPPMShipment.EstimatedWeight.Int())) } @@ -97,8 +97,8 @@ func shouldCalculateSITCost(newPPMShipment *models.PPMShipment, oldPPMShipment * *newPPMShipment.SITEstimatedWeight != *oldPPMShipment.SITEstimatedWeight || *newPPMShipment.SITEstimatedEntryDate != *oldPPMShipment.SITEstimatedEntryDate || *newPPMShipment.SITEstimatedDepartureDate != *oldPPMShipment.SITEstimatedDepartureDate || - newPPMShipment.PickupPostalCode != oldPPMShipment.PickupPostalCode || - newPPMShipment.DestinationPostalCode != oldPPMShipment.DestinationPostalCode || + newPPMShipment.PickupAddress.PostalCode != oldPPMShipment.PickupAddress.PostalCode || + newPPMShipment.DestinationAddress.PostalCode != oldPPMShipment.DestinationAddress.PostalCode || newPPMShipment.ExpectedDepartureDate != oldPPMShipment.ExpectedDepartureDate } @@ -394,9 +394,9 @@ func priceFirstDaySIT(appCtx appcontext.AppContext, pricer services.ParamsPricer return nil, errors.New("ppm estimate pricer for SIT service item does not implement the first day pricer interface") } - serviceAreaPostalCode := ppmShipment.PickupPostalCode + serviceAreaPostalCode := ppmShipment.PickupAddress.PostalCode if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT { - serviceAreaPostalCode = ppmShipment.DestinationPostalCode + serviceAreaPostalCode = ppmShipment.DestinationAddress.PostalCode } serviceAreaLookup := serviceparamvaluelookups.ServiceAreaLookup{ @@ -433,9 +433,9 @@ func priceAdditionalDaySIT(appCtx appcontext.AppContext, pricer services.ParamsP return nil, errors.New("ppm estimate pricer for SIT service item does not implement the additional days pricer interface") } - serviceAreaPostalCode := ppmShipment.PickupPostalCode + serviceAreaPostalCode := ppmShipment.PickupAddress.PostalCode if serviceItem.ReService.Code == models.ReServiceCodeDDASIT { - serviceAreaPostalCode = ppmShipment.DestinationPostalCode + serviceAreaPostalCode = ppmShipment.DestinationAddress.PostalCode } serviceAreaLookup := serviceparamvaluelookups.ServiceAreaLookup{ Address: models.Address{PostalCode: serviceAreaPostalCode}, @@ -462,8 +462,8 @@ func MapPPMShipmentEstimatedFields(ppmShipment models.PPMShipment) models.MTOShi ppmShipment.Shipment.ActualPickupDate = &ppmShipment.ExpectedDepartureDate ppmShipment.Shipment.RequestedPickupDate = &ppmShipment.ExpectedDepartureDate - ppmShipment.Shipment.PickupAddress = &models.Address{PostalCode: ppmShipment.PickupPostalCode} - ppmShipment.Shipment.DestinationAddress = &models.Address{PostalCode: ppmShipment.DestinationPostalCode} + ppmShipment.Shipment.PickupAddress = &models.Address{PostalCode: ppmShipment.PickupAddress.PostalCode} + ppmShipment.Shipment.DestinationAddress = &models.Address{PostalCode: ppmShipment.DestinationAddress.PostalCode} ppmShipment.Shipment.PrimeActualWeight = ppmShipment.EstimatedWeight return ppmShipment.Shipment diff --git a/pkg/services/ppmshipment/ppm_estimator_test.go b/pkg/services/ppmshipment/ppm_estimator_test.go index 92c115349ce..ef1c3a4262c 100644 --- a/pkg/services/ppmshipment/ppm_estimator_test.go +++ b/pkg/services/ppmshipment/ppm_estimator_test.go @@ -180,6 +180,15 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, }) + testdatagen.FetchOrMakeReZip3(suite.DB(), testdatagen.Assertions{ + ReZip3: models.ReZip3{ + Contract: originDomesticServiceArea.Contract, + ContractID: originDomesticServiceArea.ContractID, + DomesticServiceArea: originDomesticServiceArea, + Zip3: "503", + }, + }) + testdatagen.FetchOrMakeReZip3(suite.DB(), testdatagen.Assertions{ ReZip3: models.ReZip3{ Contract: originDomesticServiceArea.Contract, @@ -488,16 +497,16 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) ppmEstimate, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813") + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) - suite.Equal(oldPPMShipment.PickupPostalCode, newPPM.PickupPostalCode) + suite.Equal(oldPPMShipment.PickupAddress.PostalCode, newPPM.PickupAddress.PostalCode) suite.Equal(unit.Pound(5000), *newPPM.EstimatedWeight) suite.Equal(unit.Cents(70064364), *ppmEstimate) }) @@ -524,7 +533,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil).Once() + "50309", "30813").Return(2294, nil).Once() ppmEstimate, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) @@ -547,9 +556,9 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { estimatedIncentive, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) - suite.Equal(oldPPMShipment.PickupPostalCode, newPPM.PickupPostalCode) + suite.Equal(oldPPMShipment.PickupAddress.PostalCode, newPPM.PickupAddress.PostalCode) suite.Equal(*oldPPMShipment.EstimatedWeight, *newPPM.EstimatedWeight) - suite.Equal(oldPPMShipment.DestinationPostalCode, newPPM.DestinationPostalCode) + suite.Equal(oldPPMShipment.DestinationAddress.PostalCode, newPPM.DestinationAddress.PostalCode) suite.True(oldPPMShipment.ExpectedDepartureDate.Equal(newPPM.ExpectedDepartureDate)) suite.Equal(*oldPPMShipment.EstimatedIncentive, *estimatedIncentive) suite.Equal(models.BoolPointer(true), newPPM.HasRequestedAdvance) @@ -564,13 +573,16 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, }, }, nil) + + pickupAddress := models.Address{PostalCode: oldPPMShipment.PickupAddress.PostalCode} + destinationAddress := models.Address{PostalCode: "94040"} newPPM := models.PPMShipment{ ID: uuid.FromStringOrNil("575c25aa-b4eb-4024-9597-43483003c773"), ShipmentID: oldPPMShipment.ShipmentID, Status: models.PPMShipmentStatusCloseoutComplete, ExpectedDepartureDate: oldPPMShipment.ExpectedDepartureDate, - PickupPostalCode: oldPPMShipment.PickupPostalCode, - DestinationPostalCode: "94040", + PickupAddress: &pickupAddress, + DestinationAddress: &destinationAddress, EstimatedWeight: oldPPMShipment.EstimatedWeight, SITExpected: oldPPMShipment.SITExpected, EstimatedIncentive: models.CentPointer(unit.Cents(600000)), @@ -585,7 +597,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { oldPPMShipment := factory.BuildMinimalPPMShipment(suite.DB(), nil, nil) newPPM := oldPPMShipment - newPPM.DestinationPostalCode = "94040" + newPPM.DestinationAddress.PostalCode = "94040" _, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NoError(err) suite.Nil(newPPM.EstimatedIncentive) @@ -600,7 +612,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { oldPPMShipment := factory.BuildPPMShipment(suite.DB(), []factory.Customization{ { Model: models.PPMShipment{ - ActualPickupPostalCode: models.StringPointer("90210"), + ActualPickupPostalCode: models.StringPointer("50309"), ActualDestinationPostalCode: models.StringPointer("30813"), ActualMoveDate: models.TimePointer(actualMoveDate), Status: models.PPMShipmentStatusWaitingOnCustomer, @@ -629,13 +641,13 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) ppmFinal, err := ppmEstimator.FinalIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813") + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.ActualPickupPostalCode, newPPM.ActualPickupPostalCode) @@ -652,7 +664,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { oldPPMShipment := factory.BuildPPMShipment(suite.DB(), []factory.Customization{ { Model: models.PPMShipment{ - ActualPickupPostalCode: models.StringPointer("90210"), + ActualPickupPostalCode: models.StringPointer("50309"), ActualDestinationPostalCode: models.StringPointer("30813"), ActualMoveDate: models.TimePointer(moveDate), Status: models.PPMShipmentStatusWaitingOnCustomer, @@ -683,13 +695,13 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) ppmFinal, err := ppmEstimator.FinalIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813") + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.ActualPickupPostalCode, newPPM.ActualPickupPostalCode) @@ -708,7 +720,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { oldPPMShipment := factory.BuildPPMShipmentThatNeedsCloseout(suite.DB(), nil, []factory.Customization{ { Model: models.PPMShipment{ - ActualPickupPostalCode: models.StringPointer("90210"), + ActualPickupPostalCode: models.StringPointer("50309"), ActualDestinationPostalCode: models.StringPointer("30813"), ActualMoveDate: models.TimePointer(moveDate), }, @@ -740,13 +752,13 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) ppmFinal, err := ppmEstimator.FinalIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813") + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) originalWeight, newWeight := SumWeightTickets(oldPPMShipment, newPPM) @@ -1349,6 +1361,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, }, }, nil) + shipmentOriginSIT := factory.BuildPPMShipment(nil, []factory.Customization{ { Model: models.PPMShipment{ @@ -1367,7 +1380,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) _, estimatedSITCost, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), models.PPMShipment{}, &shipmentOriginSIT) @@ -1406,7 +1419,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) _, estimatedSITCost, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), models.PPMShipment{}, &shipmentOriginSIT) @@ -1427,6 +1440,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, }, }, nil) + shipmentOriginSIT := factory.BuildPPMShipment(nil, []factory.Customization{ { Model: models.PPMShipment{ @@ -1444,7 +1458,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, }, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813").Return(2294, nil) + "50309", "30813").Return(2294, nil) _, estimatedSITCost, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), models.PPMShipment{}, &shipmentOriginSIT) @@ -1591,10 +1605,26 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, nil) // PPM base shipment field changes will affect SIT pricing shipmentDifferentPickup := originalShipment - shipmentDifferentPickup.PickupPostalCode = "90211" + pickupAddress := models.Address{ + StreetAddress1: originalShipment.PickupAddress.StreetAddress1, + StreetAddress2: originalShipment.PickupAddress.StreetAddress2, + StreetAddress3: originalShipment.PickupAddress.StreetAddress3, + City: originalShipment.PickupAddress.City, + State: originalShipment.PickupAddress.State, + PostalCode: "90211", + } + shipmentDifferentPickup.PickupAddress = &pickupAddress shipmentDifferentDestination := originalShipment - shipmentDifferentDestination.DestinationPostalCode = "30814" + destinationAddress := models.Address{ + StreetAddress1: originalShipment.PickupAddress.StreetAddress1, + StreetAddress2: originalShipment.PickupAddress.StreetAddress2, + StreetAddress3: originalShipment.PickupAddress.StreetAddress3, + City: originalShipment.PickupAddress.City, + State: originalShipment.PickupAddress.State, + PostalCode: "30814", + } + shipmentDifferentDestination.DestinationAddress = &destinationAddress shipmentDifferentDeparture := originalShipment // original date was Mar 15th so adding 3 months should affect the date peak period pricing @@ -1604,7 +1634,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { "90211", "30813").Return(2294, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30814").Return(2290, nil) + "50309", "30814").Return(2290, nil) // SIT specific field changes will likely cause the price to change, although adjusting dates may not change // the total number of days in SIT. diff --git a/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.jsx b/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.jsx index d41008125a1..25d4960bcf5 100644 --- a/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.jsx +++ b/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.jsx @@ -2,15 +2,18 @@ import React from 'react'; import styles from 'components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.module.scss'; import { ShipmentShape } from 'types/shipment'; +import { formatAddress } from 'utils/shipmentDisplay'; import { formatCentsTruncateWhole, formatCustomerDate, formatWeight } from 'utils/formatters'; const EstimatedIncentiveDetails = ({ shipment }) => { const { estimatedWeight, - pickupPostalCode, - secondaryPickupPostalCode, - destinationPostalCode, - secondaryDestinationPostalCode, + pickupAddress, + hasSecondaryPickupAddress, + secondaryPickupAddress, + destinationAddress, + hasSecondaryDestinationAddress, + secondaryDestinationAddress, expectedDepartureDate, estimatedIncentive, } = shipment?.ppmShipment || {}; @@ -23,10 +26,12 @@ const EstimatedIncentiveDetails = ({ shipment }) => {

This is an estimate of how much you could earn by moving your PPM, based on what you have entered:

diff --git a/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.stories.jsx b/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.stories.jsx index d37026f5269..e5d8bb22861 100644 --- a/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.stories.jsx +++ b/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.stories.jsx @@ -25,8 +25,20 @@ export const WithoutSecondaryPostalCodes = Template.bind({}); WithoutSecondaryPostalCodes.args = { shipment: { ppmShipment: { - pickupPostalCode: '10001', - destinationPostalCode: '10002', + pickupAddress: { + streetAddress1: '812 S 129th St', + streetAddress2: '#123', + city: 'San Antonio', + state: 'TX', + postalCode: '10001', + }, + destinationAddress: { + streetAddress1: '813 S 129th St', + streetAddress2: '#124', + city: 'San Antonio', + state: 'TX', + postalCode: '10002', + }, expectedDepartureDate: '2022-07-04', estimatedWeight: 4999, estimatedIncentive: 123499, @@ -38,10 +50,36 @@ export const WithSecondaryPostalCodes = Template.bind({}); WithSecondaryPostalCodes.args = { shipment: { ppmShipment: { - pickupPostalCode: '10001', - secondaryPickupPostalCode: '10003', - destinationPostalCode: '10002', - secondaryDestinationPostalCode: '10004', + pickupAddress: { + streetAddress1: '812 S 129th St', + streetAddress2: '#123', + city: 'San Antonio', + state: 'TX', + postalCode: '10001', + }, + destinationAddress: { + streetAddress1: '813 S 129th St', + streetAddress2: '#124', + city: 'San Antonio', + state: 'TX', + postalCode: '10002', + }, + secondaryPickupAddress: { + streetAddress1: '814 S 129th St', + streetAddress2: '#125', + city: 'San Antonio', + state: 'TX', + postalCode: '10001', + }, + secondaryDestinationAddress: { + streetAddress1: '815 S 129th St', + streetAddress2: '#126', + city: 'San Antonio', + state: 'TX', + postalCode: '10002', + }, + hasSecondaryDestinationAddress: true, + hasSecondaryPickupAddress: true, expectedDepartureDate: '2022-07-04', estimatedWeight: 4999, estimatedIncentive: 123499, diff --git a/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.test.jsx b/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.test.jsx index b3e7d48355b..cf95a1de63a 100644 --- a/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.test.jsx +++ b/src/components/Customer/PPM/Booking/EstimatedIncentiveDetails/EstimatedIncentiveDetails.test.jsx @@ -7,8 +7,20 @@ const defaultProps = { shipment: { id: '1234', ppmShipment: { - pickupPostalCode: '10001', - destinationPostalCode: '10002', + pickupAddress: { + streetAddress1: '812 S 129th St', + streetAddress2: '#123', + city: 'San Antonio', + state: 'TX', + postalCode: '10001', + }, + destinationAddress: { + streetAddress1: '813 S 129th St', + streetAddress2: '#124', + city: 'San Antonio', + state: 'TX', + postalCode: '10002', + }, expectedDepartureDate: '2022-07-04', estimatedWeight: 3456, proGearWeight: 1333, @@ -22,10 +34,36 @@ const optionalSecondaryProps = { shipment: { id: '1234', ppmShipment: { - pickupPostalCode: '10001', - destinationPostalCode: '10002', - secondaryPickupPostalCode: '10003', - secondaryDestinationPostalCode: '10004', + pickupAddress: { + streetAddress1: '812 S 129th St', + streetAddress2: '#123', + city: 'San Antonio', + state: 'TX', + postalCode: '10001', + }, + destinationAddress: { + streetAddress1: '813 S 129th St', + streetAddress2: '#124', + city: 'San Antonio', + state: 'TX', + postalCode: '10002', + }, + secondaryPickupAddress: { + streetAddress1: '813 S 129th St', + streetAddress2: '#125', + city: 'San Antonio', + state: 'TX', + postalCode: '10003', + }, + secondaryDestinationAddress: { + streetAddress1: '814 S 129th St', + streetAddress2: '#126', + city: 'San Antonio', + state: 'TX', + postalCode: '10004', + }, + hasSecondaryPickupAddress: true, + hasSecondaryDestinationAddress: true, expectedDepartureDate: '2022-07-04', estimatedWeight: 3456, proGearWeight: 1333, @@ -49,8 +87,8 @@ describe('EstimatedIncentiveDetails component', () => { const incentiveListItems = screen.getAllByRole('listitem'); expect(incentiveListItems).toHaveLength(4); expect(incentiveListItems[0]).toHaveTextContent('3,456 lbs estimated weight'); - expect(incentiveListItems[1]).toHaveTextContent('Starting from 10001'); - expect(incentiveListItems[2]).toHaveTextContent('Ending in 10002'); + expect(incentiveListItems[1]).toHaveTextContent('Starting from 812 S 129th St, #123, San Antonio, TX 10001'); + expect(incentiveListItems[2]).toHaveTextContent('Ending at 813 S 129th St, #124, San Antonio, TX 10002'); expect(incentiveListItems[3]).toHaveTextContent('Starting your PPM on 04 Jul 2022'); expect(screen.getByRole('heading', { level: 3 })).toHaveTextContent('Your actual incentive amount will vary'); @@ -74,10 +112,12 @@ describe('EstimatedIncentiveDetails component', () => { const incentiveListItems = screen.getAllByRole('listitem'); expect(incentiveListItems).toHaveLength(6); expect(incentiveListItems[0]).toHaveTextContent('3,456 lbs estimated weight'); - expect(incentiveListItems[1]).toHaveTextContent('Starting from 10001'); - expect(incentiveListItems[2]).toHaveTextContent('Picking up things in 10003'); - expect(incentiveListItems[3]).toHaveTextContent('Dropping off things in 10004'); - expect(incentiveListItems[4]).toHaveTextContent('Ending in 10002'); + expect(incentiveListItems[1]).toHaveTextContent('Starting from 812 S 129th St, #123, San Antonio, TX 10001'); + expect(incentiveListItems[2]).toHaveTextContent('Picking up things at 813 S 129th St, #125, San Antonio, TX 10003'); + expect(incentiveListItems[3]).toHaveTextContent( + 'Dropping off things at 814 S 129th St, #126, San Antonio, TX 10004', + ); + expect(incentiveListItems[4]).toHaveTextContent('Ending at 813 S 129th St, #124, San Antonio, TX 10002'); expect(incentiveListItems[5]).toHaveTextContent('Starting your PPM on 04 Jul 2022'); }); }); diff --git a/src/pages/MyMove/PPM/Booking/EstimatedIncentive/EstimatedIncentive.test.jsx b/src/pages/MyMove/PPM/Booking/EstimatedIncentive/EstimatedIncentive.test.jsx index 52f1e54ae8d..d4424c99b90 100644 --- a/src/pages/MyMove/PPM/Booking/EstimatedIncentive/EstimatedIncentive.test.jsx +++ b/src/pages/MyMove/PPM/Booking/EstimatedIncentive/EstimatedIncentive.test.jsx @@ -36,8 +36,20 @@ beforeEach(() => { const shipmentEntity = { id: 'shipment123', ppmShipment: { - pickupPostalCode: '10001', - destinationPostalCode: '10002', + pickupAddress: { + streetAddress1: '812 S 129th St', + streetAddress2: '#123', + city: 'San Antonio', + state: 'TX', + postalCode: '10001', + }, + destinationAddress: { + streetAddress1: '813 S 129th St', + streetAddress2: '#124', + city: 'San Antonio', + state: 'TX', + postalCode: '10002', + }, expectedDepartureDate: '2022-04-01', estimatedWeight: 4567, estimatedIncentive: 789000,