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

INT - B-22462 International SIT Pricing Fuel Surcharge Calculation #14960

Open
wants to merge 20 commits into
base: integrationTesting
Choose a base branch
from

Conversation

MInthavongsay
Copy link
Contributor

@MInthavongsay MInthavongsay commented Mar 5, 2025

B-22462

Summary

This PR implements actual/estimate pricing calculations for both international origin and destination fuel surcharges on the server side.

this article explains more about the approach used.

Verification Steps for the Author

These are to be checked by the author.

  • Tested in the Experimental environment (for changes to containers, app startup, or connection to data stores)
  • Have the Agility acceptance criteria been met for this change?

Verification Steps for Reviewers

These are to be checked by a reviewer.

  • Has the branch been pulled in and checked out?
  • Have the BL acceptance criteria been met for this change?
  • Was the CircleCI build successful?
  • Has the code been reviewed from a standards and best practices point of view?

Setup to Run the Code

How to test

NOTE: Got negative numbers and ZERO for pricing. Attributing it to bad data locally.

A) International Origin Fuel Surcharge:

  1. Login as customer and submit move containing HHG shipment. HHG must have an CONUS pickup address while destination address is OCONUS.
  2. Login as service counselor and move HHG to TOO.
  3. Login as TOO, select HHG and approve to add service items to move.
  4. Login as Prime. Update shipment to add weights and dates.
  5. Click on Add Service Items and add international origin SIT. Ensure both the address and standalone postcode input field are using the same ZIP code. Try to use a zip code you have a rough estimate the distance between the SIT postal code and the shipment pickup address. This distance between the two will be used in the pricing calculations.
  6. Login as TOO and APPROVE all 4 international SIT service items generated from step 5. This will calculate the estimated pricing for IOSFSC. This can be confirmed by querying the database:
select m.id, m.sit_delivery_miles, m.pricing_estimate, r.code 
 from mto_service_items m join re_services r on m.re_service_id = r.id
and m.mto_shipment_id in (select id from mto_shipments where shipment_locator = 'XXXXXX-01') 
and r.code = 'IOSFSC';

Estimated pricing is calculated by stored procedure. Execute stored procedure via Postgres client tool :

call update_service_item_pricing(SHIPMENT_ID_HERE, null); 
--- where SHIPMENT_ID_HERE => select id from mto_shipments where shipment_locator = 'XXXXXX-01';

Note: Stored procedure will output parameters used for estimated calculation
Screenshot 2025-03-05 at 2 01 27 PM

  1. Login as Prime and Create Payment Request for ONLY IOSFSC. This will calculate the actual pricing for IOSFSC. Note: Estimated pricing calculation is only done IF shipment pickup address is CONUS (see business rule below). This can be verified by querying the database or via TIO role:
select payment_service_items.status, 
payment_service_items.price_cents, re_services.code from moves, 
mto_shipments, 
payment_requests,
payment_service_items,
mto_service_items,
re_services
where moves.id = mto_shipments.move_id 
and mto_shipments.id = (select id from mto_shipments where shipment_locator = 'XXXXXX-01')
and moves.id = payment_requests.move_id
and payment_requests.id = payment_service_items.payment_request_id
and mto_service_items.id = payment_service_items.mto_service_item_id
and re_services.id = mto_service_items.re_service_id  and re_services.code = 'IOSFSC';

Via TIO:
A. Login as TIO. Enable web developer tool and goto payment request tab to view actual pricing for IOSFSC from the payment-requests request/response.
Screenshot 2025-03-05 at 1 50 40 PM

see "priceCents" and "paymentServiceItemParams"
Screenshot 2025-03-05 at 1 56 00 PM

NOTE: IOSFSC will not be calculated if shipment pickup address is OCONUS. It will only will result in 0.

Business Logic:
Screenshot 2025-03-05 at 10 53 29 AM

B) International Destination Fuel Surcharge:

  1. Login as customer and submit move containing HHG shipment. HHG must have an OCONUS pickup address while destination address is CONUS.
  2. Login as service counselor and move HHG to TOO.
  3. Login as TOO, select HHG and approve to add service items to move.
  4. Login as Prime. Update shipment to add weights and dates.
  5. Click on Add Service Items and add international destination SIT.
  6. Login as TOO and APPROVE all 4 international destination SIT service items generated from step 5. This will calculate the estimated pricing for IDSFSC. This can be confirmed by querying the database:
select m.id, m.sit_delivery_miles, m.pricing_estimate, r.code 
 from mto_service_items m join re_services r on m.re_service_id = r.id
and m.mto_shipment_id in (select id from mto_shipments where shipment_locator = 'XXXXXX-01') 
and r.code = 'IDSFSC';

Estimated pricing is calculated by stored procedure. Execute stored procedure via Postgres client tool :

call update_service_item_pricing(SHIPMENT_ID_HERE, null); 
--- where SHIPMENT_ID_HERE => select id from mto_shipments where shipment_locator = 'XXXXXX-01';

Estimated pricing is calculated by stored procedure. Execute stored procedure via Postgres client tool :

call update_service_item_pricing(SHIPMENT_ID_HERE, null); 
--- where SHIPMENT_ID_HERE => select id from mto_shipments where shipment_locator = 'XXXXXX-01';

Note: Stored procedure will output parameters used for estimated calculation
Screenshot 2025-03-05 at 2 16 05 PM

  1. Login as Prime and Create Payment Request for ONLY IDSFSC. This will calculate the actual pricing for IDSFSC. Note: Estimated pricing calculation is only done IF shipment destination address is CONUS (see business rule below). This can be verified by querying the database or via TIO role:
select payment_service_items.status, 
payment_service_items.price_cents, re_services.code from moves, 
mto_shipments, 
payment_requests,
payment_service_items,
mto_service_items,
re_services
where moves.id = mto_shipments.move_id 
and mto_shipments.id = (select id from mto_shipments where shipment_locator = 'XXXXXX-01')
and moves.id = payment_requests.move_id
and payment_requests.id = payment_service_items.payment_request_id
and mto_service_items.id = payment_service_items.mto_service_item_id
and re_services.id = mto_service_items.re_service_id  and re_services.code = 'IDSFSC';

Via TIO:
A. Login as TIO. Enable web developer tool and goto payment request tab to view actual pricing for IDSFSC from the payment-requests request/response.
Screenshot 2025-03-05 at 1 50 40 PM

see "priceCents" and "paymentServiceItemParams"
Screenshot 2025-03-05 at 1 56 00 PM

NOTE: IDSFSC will not be calculated if shipment destination address is OCONUS. It will only will result in 0.

Business Logic:

Screenshot 2025-03-05 at 2 19 10 PM

Frontend

  • There are no aXe warnings for UI.
  • This works in Supported Browsers and their phone views (Chrome, Firefox, Edge).
  • There are no new console errors in the browser devtools.
  • There are no new console errors in the test output.
  • If this PR adds a new component to Storybook, it ensures the component is fully responsive, OR if it is intentionally not, a wrapping div using the officeApp class or custom min-width styling is used to hide any states the would not be visible to the user.
  • This change meets the standards for Section 508 compliance.

Backend

Database

Any new migrations/schema changes:

  • Follows our guidelines for Zero-Downtime Deploys.
  • Have been communicated to #g-database.
  • Secure migrations have been tested following the instructions in our docs.

Screenshots

@MInthavongsay MInthavongsay added Scrummy Bears Scrum Team H INTEGRATION Slated for Integration Testing labels Mar 5, 2025
@MInthavongsay MInthavongsay self-assigned this Mar 5, 2025
@MInthavongsay MInthavongsay changed the base branch from main to integrationTesting March 5, 2025 15:19
@MInthavongsay MInthavongsay marked this pull request as ready for review March 5, 2025 19:38
@MInthavongsay MInthavongsay requested review from a team as code owners March 5, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INTEGRATION Slated for Integration Testing Scrummy Bears Scrum Team H
Development

Successfully merging this pull request may close these issues.

5 participants