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-21054 Prime can add second/third addresses to existing shipments #13691

Merged
merged 7 commits into from
Sep 23, 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
84 changes: 84 additions & 0 deletions pkg/gen/primev3api/embedded_spec.go

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

52 changes: 52 additions & 0 deletions pkg/gen/primev3messages/update_m_t_o_shipment.go

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

60 changes: 60 additions & 0 deletions pkg/gen/primev3messages/update_p_p_m_shipment.go

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

34 changes: 34 additions & 0 deletions pkg/handlers/primeapiv3/payloads/payload_to_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ func MTOShipmentModelFromUpdate(mtoShipment *primev3messages.UpdateMTOShipment,
model.HasSecondaryPickupAddress = handlers.FmtBool(true)
}

addressModel = AddressModel(&mtoShipment.TertiaryPickupAddress.Address)
if addressModel != nil {
model.TertiaryPickupAddress = addressModel
tertiaryPickupAddressID := uuid.FromStringOrNil(addressModel.ID.String())
model.TertiaryPickupAddressID = &tertiaryPickupAddressID
model.HasTertiaryPickupAddress = handlers.FmtBool(true)
}

addressModel = AddressModel(&mtoShipment.SecondaryDeliveryAddress.Address)
if addressModel != nil {
model.SecondaryDeliveryAddress = addressModel
Expand All @@ -349,6 +357,14 @@ func MTOShipmentModelFromUpdate(mtoShipment *primev3messages.UpdateMTOShipment,
model.HasSecondaryDeliveryAddress = handlers.FmtBool(true)
}

addressModel = AddressModel(&mtoShipment.TertiaryDeliveryAddress.Address)
if addressModel != nil {
model.TertiaryDeliveryAddress = addressModel
tertiaryDeliveryAddressID := uuid.FromStringOrNil(addressModel.ID.String())
model.TertiaryDeliveryAddressID = &tertiaryDeliveryAddressID
model.HasTertiaryDeliveryAddress = handlers.FmtBool(true)
}

if mtoShipment.PpmShipment != nil {
model.PPMShipment = PPMShipmentModelFromUpdate(mtoShipment.PpmShipment)
model.PPMShipment.Shipment = *model
Expand Down Expand Up @@ -391,6 +407,15 @@ func PPMShipmentModelFromUpdate(ppmShipment *primev3messages.UpdatePPMShipment)
}
}

if ppmShipment.HasTertiaryPickupAddress != nil && *ppmShipment.HasTertiaryPickupAddress {
addressModel = AddressModel(&ppmShipment.TertiaryPickupAddress.Address)
if addressModel != nil {
model.TertiaryPickupAddress = addressModel
tertiaryPickupAddressID := uuid.FromStringOrNil(addressModel.ID.String())
model.TertiaryPickupAddressID = &tertiaryPickupAddressID
}
}

addressModel = AddressModel(&ppmShipment.DestinationAddress.Address)
if addressModel != nil {
model.DestinationAddress = addressModel
Expand All @@ -406,6 +431,15 @@ func PPMShipmentModelFromUpdate(ppmShipment *primev3messages.UpdatePPMShipment)
}
}

if ppmShipment.HasTertiaryDestinationAddress != nil && *ppmShipment.HasTertiaryDestinationAddress {
addressModel = AddressModel(&ppmShipment.TertiaryDestinationAddress.Address)
if addressModel != nil {
model.TertiaryDestinationAddress = addressModel
tertiaryDestinationAddressID := uuid.FromStringOrNil(addressModel.ID.String())
model.TertiaryDestinationAddressID = &tertiaryDestinationAddressID
}
}

expectedDepartureDate := handlers.FmtDatePtrToPopPtr(ppmShipment.ExpectedDepartureDate)
if expectedDepartureDate != nil && !expectedDepartureDate.IsZero() {
model.ExpectedDepartureDate = *expectedDepartureDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ test.describe('Prime simulator user', () => {
await page.locator('input[name="destinationAddress.city"]').fill('Joshua Tree');
await page.locator('select[name="destinationAddress.state"]').selectOption({ label: 'CA' });
await page.locator('input[name="destinationAddress.postalCode"]').fill('92252');
await page.getByTestId('dropdown').nth(1).selectOption('Home of record (HOR)');
await page.getByTestId('dropdown').nth(5).selectOption('Home of record (HOR)');

await page.getByText('Save').click();
await expect(page.getByText('Successfully updated shipment')).toHaveCount(1);
Expand Down
Loading
Loading