From 9d928229391781d19d8f8a60843fff88104597e7 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 25 Feb 2025 16:35:10 +0000 Subject: [PATCH 01/13] remove ghcimport --- .../ghcimport/fixtures/re_services_data.sql | 53 - .../ghcimport/fixtures/stage_ghc_pricing.sql | 968 ------------------ .../ghcimport/ghc_rateengine_importer.go | 78 -- .../ghcimport/ghc_rateengine_importer_test.go | 82 -- pkg/services/ghcimport/import_re_contract.go | 48 - .../ghcimport/import_re_contract_test.go | 63 -- .../ghcimport/import_re_contract_years.go | 58 -- .../import_re_contract_years_test.go | 78 -- .../import_re_domestic_accessorial_prices.go | 77 -- ...ort_re_domestic_accessorial_prices_test.go | 91 -- .../import_re_domestic_linehaul_prices.go | 80 -- ...import_re_domestic_linehaul_prices_test.go | 79 -- .../import_re_domestic_other_prices.go | 199 ---- .../import_re_domestic_other_prices_test.go | 120 --- .../import_re_domestic_service_area.go | 259 ----- .../import_re_domestic_service_area_prices.go | 80 -- ...rt_re_domestic_service_area_prices_test.go | 125 --- .../import_re_domestic_service_area_test.go | 165 --- .../import_re_intl_accessorial_prices.go | 76 -- .../import_re_intl_accessorial_prices_test.go | 90 -- .../ghcimport/import_re_intl_other_prices.go | 84 -- .../import_re_intl_other_prices_test.go | 102 -- .../ghcimport/import_re_intl_prices.go | 388 ------- .../ghcimport/import_re_intl_prices_test.go | 188 ---- pkg/services/ghcimport/import_re_rate_area.go | 261 ----- .../ghcimport/import_re_rate_area_test.go | 223 ---- .../import_re_shipment_type_prices.go | 74 -- .../import_re_shipment_type_prices_test.go | 66 -- .../ghcimport/import_re_task_order_fees.go | 94 -- .../import_re_task_order_fees_test.go | 83 -- pkg/services/ghcimport/load_service_map.go | 25 - .../ghcimport/load_service_map_test.go | 31 - .../map_zip_codes_to_re_rate_areas.go | 95 -- .../map_zip_codes_to_re_rate_areas_test.go | 140 --- pkg/services/ghcimport/shared.go | 107 -- pkg/services/ghcimport/shared_test.go | 219 ---- .../ghcimport/zip3_to_rate_area_mappings.go | 913 ----------------- .../ghcimport/zip5_to_rate_area_mappings.go | 927 ----------------- 38 files changed, 6889 deletions(-) delete mode 100644 pkg/services/ghcimport/fixtures/re_services_data.sql delete mode 100644 pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql delete mode 100644 pkg/services/ghcimport/ghc_rateengine_importer.go delete mode 100644 pkg/services/ghcimport/ghc_rateengine_importer_test.go delete mode 100644 pkg/services/ghcimport/import_re_contract.go delete mode 100644 pkg/services/ghcimport/import_re_contract_test.go delete mode 100644 pkg/services/ghcimport/import_re_contract_years.go delete mode 100644 pkg/services/ghcimport/import_re_contract_years_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_accessorial_prices.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_linehaul_prices.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_other_prices.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_other_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_service_area.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_prices.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_test.go delete mode 100644 pkg/services/ghcimport/import_re_intl_accessorial_prices.go delete mode 100644 pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_intl_other_prices.go delete mode 100644 pkg/services/ghcimport/import_re_intl_other_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_intl_prices.go delete mode 100644 pkg/services/ghcimport/import_re_intl_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_rate_area.go delete mode 100644 pkg/services/ghcimport/import_re_rate_area_test.go delete mode 100644 pkg/services/ghcimport/import_re_shipment_type_prices.go delete mode 100644 pkg/services/ghcimport/import_re_shipment_type_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_task_order_fees.go delete mode 100644 pkg/services/ghcimport/import_re_task_order_fees_test.go delete mode 100644 pkg/services/ghcimport/load_service_map.go delete mode 100644 pkg/services/ghcimport/load_service_map_test.go delete mode 100644 pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go delete mode 100644 pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go delete mode 100644 pkg/services/ghcimport/shared.go delete mode 100644 pkg/services/ghcimport/shared_test.go delete mode 100644 pkg/services/ghcimport/zip3_to_rate_area_mappings.go delete mode 100644 pkg/services/ghcimport/zip5_to_rate_area_mappings.go diff --git a/pkg/services/ghcimport/fixtures/re_services_data.sql b/pkg/services/ghcimport/fixtures/re_services_data.sql deleted file mode 100644 index 9e1d3ae23f7..00000000000 --- a/pkg/services/ghcimport/fixtures/re_services_data.sql +++ /dev/null @@ -1,53 +0,0 @@ -INSERT INTO re_services -(id, code, name, created_at, updated_at) -VALUES -('9dc919da-9b66-407b-9f17-05c0f03fcb50', 'CS', 'Counseling', now(), now()), -('2471cc2d-6ed5-4ecc-9d43-db9711c8645b', 'DBHF', 'Domestic haul away boat factor', now(), now()), -('0e45b6f5-f2f5-4235-94e4-7b4cb899eb5d', 'DBTF', 'Domestic tow away boat factor', now(), now()), -('68417bd7-4a9d-4472-941e-2ba6aeaf15f4', 'DCRT', 'Domestic crating', now(), now()), -('84d53f9a-ad54-4d79-87ad-68a5e7af6912', 'DCRTSA', 'Domestic crating - standalone', now(), now()), -('a0ead168-7469-4cb6-bc5b-2ebef5a38f92', 'DDASIT', 'Domestic destination add''l SIT', now(), now()), -('5c80f3b5-548e-4077-9b8e-8d0390e73668', 'DDDSIT', 'Domestic destination SIT delivery', now(), now()), -('d0561c49-e1a9-40b8-a739-3e639a9d77af', 'DDFSIT', 'Domestic destination 1st day SIT', now(), now()), -('50f1179a-3b72-4fa1-a951-fe5bcc70bd14', 'DDP', 'Domestic destination price', now(), now()), -('556663e3-675a-4b06-8da3-e4f1e9a9d3cd', 'DDSHUT', 'Domestic destination shuttle service', now(), now()), -('8d600f25-1def-422d-b159-617c7d59156e', 'DLH', 'Domestic linehaul', now(), now()), -('dbd3a39a-6bb9-42da-b81a-9229df7019cf', 'DMHF', 'Domestic mobile home factor', now(), now()), -('3cc83af7-ecb9-4b33-bbc6-ff1459f001e2', 'DNPK', 'Domestic NTS packing', now(), now()), -('05eb6ff1-5cf6-4918-b887-8260dda6b9fe', 'DOASIT', 'Domestic origin add''l SIT', now(), now()), -('998beda7-e390-4a83-b15e-578a24326937', 'DOFSIT', 'Domestic origin 1st day SIT', now(), now()), -('2bc3e5cb-adef-46b1-bde9-55570bfdd43e', 'DOP', 'Domestic origin price', now(), now()), -('d1a4f062-0ca3-4387-8f8e-3dd20493d0b7', 'DOPSIT', 'Domestic origin SIT pickup', now(), now()), -('d979e8af-501a-44bb-8532-2799753a5810', 'DOSHUT', 'Domestic origin shuttle service', now(), now()), -('bdea5a8d-f15f-47d2-85c9-bba5694802ce', 'DPK', 'Domestic packing', now(), now()), -('4b85962e-25d3-4485-b43c-2497c4365598', 'DSH', 'Domestic shorthaul', now(), now()), -('fc14935b-ebd3-4df3-940b-f30e71b6a56c', 'DUCRT', 'Domestic uncrating', now(), now()), -('15f01bc1-0754-4341-8e0f-25c8f04d5a77', 'DUPK', 'Domestic unpacking', now(), now()), -('4780b30c-e846-437a-b39a-c499a6b09872', 'FSC', 'Fuel surcharge', now(), now()), -('387b9654-5685-4ac9-b213-81962be9c145', 'IBHF', 'International haul away boat factor', now(), now()), -('20998cfd-bfc7-410b-a3c5-d709ead4f94e', 'IBTF', 'International tow away boat factor', now(), now()), -('07051352-4715-49b5-88e7-045b7541919d', 'ICOLH', 'International C->O shipping & LH', now(), now()), -('16949697-6171-47aa-bcd4-479995cc5206', 'ICOUB', 'International C->O UB', now(), now()), -('86203d72-7f7c-49ff-82f0-5b95e4958f60', 'ICRT', 'International crating', now(), now()), -('021791b8-26ca-4494-a3d1-6945e4dde387', 'ICRTSA', 'International crating - standalone', now(), now()), -('806c6d59-57ff-4a3f-9518-ebf29ba9cb10', 'IDASIT', 'International destination add''l day SIT', now(), now()), -('28389ee1-56cf-400c-aa52-1501ecdd7c69', 'IDDSIT', 'International destination SIT delivery', now(), now()), -('bd6064ca-e780-4ab4-a37b-0ae98eebb244', 'IDFSIT', 'International destination 1st day SIT', now(), now()), -('22fc07ed-be15-4f50-b941-cbd38153b378', 'IDSHUT', 'International destination shuttle service', now(), now()), -('67ba1eaf-6ffd-49de-9a69-497be7789877', 'IHPK', 'International HHG pack', now(), now()), -('56e91c2d-015d-4243-9657-3ed34867abaa', 'IHUPK', 'International HHG unpack', now(), now()), -('874cb86a-bc39-4f57-a614-53ee3fcacf14', 'INPK', 'International NTS packing', now(), now()), -('bd424e45-397b-4766-9712-de4ae3a2da36', 'IOASIT', 'International origin add''l day SIT', now(), now()), -('d0bb2cae-838a-4fc7-8efc-f7c6ad57431d', 'IOCLH', 'International O->C shipping & LH', now(), now()), -('7f14f357-f2ae-42b9-b834-5ab24c2cd2af', 'IOCUB', 'International O->C UB', now(), now()), -('b488bf85-ea5e-49c8-ba5c-e2fa278ac806', 'IOFSIT', 'International origin 1st day SIT', now(), now()), -('56bb94cd-f160-4239-a028-b31ffc641eb7', 'IOOLH', 'International O->O shipping & LH', now(), now()), -('133bc44a-2c0f-4ff9-a61d-9f2dad349d14', 'IOOUB', 'International O->O UB', now(), now()), -('6f4f6e31-0675-4051-b659-89832259f390', 'IOPSIT', 'International origin SIT pickup', now(), now()), -('624a97c5-dfbf-4da9-a6e9-526b4f95af8d', 'IOSHUT', 'International origin shuttle service', now(), now()), -('ae84d292-f885-4138-86e2-b451855ffbf2', 'IUBPK', 'International UB pack', now(), now()), -('f2739142-97d1-40f3-a8f4-6a9daf390806', 'IUBUPK', 'International UB unpack', now(), now()), -('4132416b-b1aa-42e7-98f2-0ac0a03e8a31', 'IUCRT', 'International uncrating', now(), now()), -('1130e612-94eb-49a7-973d-72f33685e551', 'MS', 'Move management', now(), now()), -('7e1c4f99-0054-4fac-a302-1a07a1daf58e', 'NSTH', 'Nonstandard HHG', now(), now()), -('a68fa051-b09d-43f3-8290-f56fc89a4fe8', 'NSTUB', 'Nonstandard UB', now(), now()); diff --git a/pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql b/pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql deleted file mode 100644 index dfc2830e8f7..00000000000 --- a/pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql +++ /dev/null @@ -1,968 +0,0 @@ --- --- PostgreSQL database dump --- - --- Dumped from database version 10.9 (Debian 10.9-1.pgdg90+1) --- Dumped by pg_dump version 11.5 - - --- --- Name: stage_conus_to_oconus_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_conus_to_oconus_prices; -CREATE TABLE public.stage_conus_to_oconus_prices ( - origin_domestic_price_area_code text NOT NULL, - origin_domestic_price_area text NOT NULL, - destination_intl_price_area_id text NOT NULL, - destination_intl_price_area text NOT NULL, - season text NOT NULL, - hhg_shipping_linehaul_price text NOT NULL, - ub_price text NOT NULL -); - - --- --- Name: stage_counseling_services_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_counseling_services_prices; -CREATE TABLE public.stage_counseling_services_prices ( - contract_year text NOT NULL, - price_per_task_order text NOT NULL -); - - --- --- Name: stage_domestic_international_additional_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_domestic_international_additional_prices; -CREATE TABLE public.stage_domestic_international_additional_prices ( - market text NOT NULL, - shipment_type text NOT NULL, - factor text NOT NULL -); - - --- --- Name: stage_domestic_linehaul_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_domestic_linehaul_prices; -CREATE TABLE public.stage_domestic_linehaul_prices ( - service_area_number text NOT NULL, - origin_service_area text NOT NULL, - services_schedule text NOT NULL, - season text NOT NULL, - weight_lower text NOT NULL, - weight_upper text NOT NULL, - miles_lower text NOT NULL, - miles_upper text NOT NULL, - escalation_number text NOT NULL, - rate text NOT NULL -); - - --- --- Name: stage_domestic_move_accessorial_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_domestic_move_accessorial_prices; -CREATE TABLE public.stage_domestic_move_accessorial_prices ( - services_schedule text NOT NULL, - service_provided text NOT NULL, - price_per_unit text NOT NULL -); - - --- --- Name: stage_domestic_service_area_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_domestic_service_area_prices; -CREATE TABLE public.stage_domestic_service_area_prices ( - service_area_number text NOT NULL, - service_area_name text NOT NULL, - services_schedule text NOT NULL, - sit_pickup_delivery_schedule text NOT NULL, - season text NOT NULL, - shorthaul_price text NOT NULL, - origin_destination_price text NOT NULL, - origin_destination_sit_first_day_warehouse text NOT NULL, - origin_destination_sit_addl_days text NOT NULL -); - - --- --- Name: stage_domestic_service_areas; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_domestic_service_areas; -CREATE TABLE public.stage_domestic_service_areas ( - base_point_city text NOT NULL, - state text NOT NULL, - service_area_number text NOT NULL, - zip3s text NOT NULL -); - - --- --- Name: stage_domestic_other_pack_prices; Type: TABLE; Schema: public; Owner: - --- -DROP TABLE IF EXISTS public.stage_domestic_other_pack_prices; -CREATE TABLE public.stage_domestic_other_pack_prices ( - services_schedule text NOT NULL, - service_provided text NOT NULL, - non_peak_price_per_cwt text NOT NULL, - peak_price_per_cwt text NOT NULL -); - - --- --- Name: stage_domestic_other_sit_prices; Type: TABLE; Schema: public; Owner: - --- -DROP TABLE IF EXISTS public.stage_domestic_other_sit_prices; -CREATE TABLE public.stage_domestic_other_sit_prices ( - sit_pickup_delivery_schedule text NOT NULL, - service_provided text NOT NULL, - non_peak_price_per_cwt text NOT NULL, - peak_price_per_cwt text NOT NULL -); - - --- --- Name: stage_international_move_accessorial_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_international_move_accessorial_prices; -CREATE TABLE public.stage_international_move_accessorial_prices ( - market text NOT NULL, - service_provided text NOT NULL, - price_per_unit text NOT NULL -); - - --- --- Name: stage_international_service_areas; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_international_service_areas; -CREATE TABLE public.stage_international_service_areas ( - rate_area text NOT NULL, - rate_area_id text NOT NULL -); - - --- --- Name: stage_non_standard_locn_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_non_standard_locn_prices; -CREATE TABLE public.stage_non_standard_locn_prices ( - origin_id text NOT NULL, - origin_area text NOT NULL, - destination_id text NOT NULL, - destination_area text NOT NULL, - move_type text NOT NULL, - season text NOT NULL, - hhg_price text NOT NULL, - ub_price text NOT NULL -); - - --- --- Name: stage_oconus_to_conus_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_oconus_to_conus_prices; -CREATE TABLE public.stage_oconus_to_conus_prices ( - origin_intl_price_area_id text NOT NULL, - origin_intl_price_area text NOT NULL, - destination_domestic_price_area_area text NOT NULL, - destination_domestic_price_area text NOT NULL, - season text NOT NULL, - hhg_shipping_linehaul_price text NOT NULL, - ub_price text NOT NULL -); - - --- --- Name: stage_oconus_to_oconus_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_oconus_to_oconus_prices; -CREATE TABLE public.stage_oconus_to_oconus_prices ( - origin_intl_price_area_id text NOT NULL, - origin_intl_price_area text NOT NULL, - destination_intl_price_area_id text NOT NULL, - destination_intl_price_area text NOT NULL, - season text NOT NULL, - hhg_shipping_linehaul_price text NOT NULL, - ub_price text NOT NULL -); - - --- --- Name: stage_other_intl_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_other_intl_prices; -CREATE TABLE public.stage_other_intl_prices ( - rate_area_code text NOT NULL, - rate_area_name text NOT NULL, - hhg_origin_pack_price text NOT NULL, - hhg_destination_unpack_price text NOT NULL, - ub_origin_pack_price text NOT NULL, - ub_destination_unpack_price text NOT NULL, - origin_destination_sit_first_day_warehouse text NOT NULL, - origin_destination_sit_addl_days text NOT NULL, - sit_lte_50_miles text NOT NULL, - sit_gt_50_miles text NOT NULL, - season text NOT NULL -); - - --- --- Name: stage_price_escalation_discounts; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_price_escalation_discounts; -CREATE TABLE public.stage_price_escalation_discounts ( - contract_year text NOT NULL, - forecasting_adjustment text NOT NULL, - discount text NOT NULL, - price_escalation text NOT NULL -); - - --- --- Name: stage_shipment_management_services_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_shipment_management_services_prices; -CREATE TABLE public.stage_shipment_management_services_prices ( - contract_year text NOT NULL, - price_per_task_order text NOT NULL -); - - --- --- Name: stage_transition_prices; Type: TABLE; Schema: public; Owner: - --- - -DROP TABLE IF EXISTS public.stage_transition_prices; -CREATE TABLE public.stage_transition_prices ( - contract_year text NOT NULL, - price_total_cost text NOT NULL -); - - --- --- Data for Name: stage_conus_to_oconus_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$16.05', '$44.74'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$18.94', '$52.79'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'GE', 'Germany', 'NonPeak', '$24.38', '$31.40'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'GE', 'Germany', 'Peak', '$28.77', '$37.05'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$27.63', '$34.11'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'US8101000', 'Alaska (Zone) I', 'Peak', '$32.60', '$40.25'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$30.90', '$33.98'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$36.46', '$40.10'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'GE', 'Germany', 'NonPeak', '$17.57', '$44.91'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'GE', 'Germany', 'Peak', '$20.73', '$52.99'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$24.38', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'US8101000', 'Alaska (Zone) I', 'Peak', '$28.77', '$38.28'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$32.60', '$38.28'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'GE', 'Germany', 'NonPeak', '$16.05', '$34.33'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'GE', 'Germany', 'Peak', '$18.94', '$40.51'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$17.57', '$44.74'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'US8101000', 'Alaska (Zone) I', 'Peak', '$20.73', '$52.79'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$16.05', '$31.29'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$18.94', '$36.92'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'GE', 'Germany', 'NonPeak', '$24.38', '$34.45'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'GE', 'Germany', 'Peak', '$28.77', '$40.65'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$27.63', '$44.91'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'US8101000', 'Alaska (Zone) I', 'Peak', '$32.60', '$52.99'); - --- Data for Test_mapZipCodesToReRateAreas -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US34', 'Ohio', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$16.05', '$44.74'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US49', 'Florida', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4964400', 'Florida', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US51', 'North Dakota', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$30.90', '$33.98'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US56', 'Missouri', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US66', 'Texas', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US87', 'California', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); -INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US88', 'California', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); - --- --- Data for Name: stage_counseling_services_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 1', '222.63'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 2', '223.53'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 3', '224.69'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 1', '224.88'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 2', '226.77'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 1', '227.59'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 2', '227.99'); -INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 3', '228.17'); - - --- --- Data for Name: stage_domestic_international_additional_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'Mobile Homes', '1.20'); -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'Tow Away Boat Service', '1.10'); -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'Haul Away Boat Service', '1.30'); -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('OCONUS', 'Tow Away Boat Service', '1.32'); -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('OCONUS', 'Haul Away Boat Service', '1.40'); -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'NTS Packing Factor', '1.32'); -INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('OCONUS', 'NTS Packing Factor', '1.45'); - - --- --- Data for Name: stage_domestic_linehaul_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '0', '250', '0', '$2.477'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '251', '500', '0', '$2.727'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '501', '1000', '0', '$3.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.728'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '1501', '2000', '0', '$4.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.728'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '2501', '3000', '0', '$5.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '3001', '3500', '0', '$5.728'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '3501', '4000', '0', '$6.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '4001', '999999', '0', '$27.132'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.705'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.955'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '501', '1000', '0', '$5.455'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.955'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$6.455'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.956'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$7.456'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$7.956'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$8.456'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$29.360'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '0', '250', '0', '$11.389'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '251', '500', '0', '$11.639'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '501', '1000', '0', '$12.139'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$12.639'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$13.139'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$13.639'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$14.139'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$14.640'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$15.140'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$36.044'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '0', '250', '0', '$2.583'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '251', '500', '0', '$2.843'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '501', '1000', '0', '$3.365'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '1001', '1500', '0', '$3.886'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '1501', '2000', '0', '$4.408'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '2001', '2500', '0', '$4.929'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '2501', '3000', '0', '$5.450'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '3001', '3500', '0', '$5.972'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '3501', '4000', '0', '$6.493'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '4001', '999999', '0', '$28.287'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '0', '250', '0', '$4.905'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '251', '500', '0', '$5.166'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '501', '1000', '0', '$5.687'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '1001', '1500', '0', '$6.209'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '1501', '2000', '0', '$6.730'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '2001', '2500', '0', '$7.252'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '2501', '3000', '0', '$7.773'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '3001', '3500', '0', '$8.294'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '3501', '4000', '0', '$8.816'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '4001', '999999', '0', '$30.610'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '0', '250', '0', '$11.874'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '251', '500', '0', '$12.134'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '501', '1000', '0', '$12.656'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '1001', '1500', '0', '$13.177'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '1501', '2000', '0', '$13.698'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '2001', '2500', '0', '$14.220'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '2501', '3000', '0', '$14.741'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '3001', '3500', '0', '$15.263'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '3501', '4000', '0', '$15.784'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '4001', '999999', '0', '$37.578'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '0', '250', '0', '$2.477'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '251', '500', '0', '$2.727'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '501', '1000', '0', '$3.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.728'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '1501', '2000', '0', '$4.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.728'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '2501', '3000', '0', '$5.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '3001', '3500', '0', '$5.728'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '3501', '4000', '0', '$6.228'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '4001', '999999', '0', '$27.132'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.705'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.955'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '501', '1000', '0', '$5.455'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.955'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$6.455'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.956'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$7.456'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$7.956'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$8.456'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$29.360'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '0', '250', '0', '$11.389'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '251', '500', '0', '$11.639'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '501', '1000', '0', '$12.139'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$12.639'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$13.139'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$13.639'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$14.139'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$14.640'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$15.140'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$36.044'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '0', '250', '0', '$2.583'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '251', '500', '0', '$2.843'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '501', '1000', '0', '$3.365'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '1001', '1500', '0', '$3.886'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '1501', '2000', '0', '$4.408'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '2001', '2500', '0', '$4.929'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '2501', '3000', '0', '$5.450'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '3001', '3500', '0', '$5.972'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '3501', '4000', '0', '$6.493'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '4001', '999999', '0', '$28.287'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '0', '250', '0', '$4.905'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '251', '500', '0', '$5.166'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '501', '1000', '0', '$5.687'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '1001', '1500', '0', '$6.209'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '1501', '2000', '0', '$6.730'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '2001', '2500', '0', '$7.252'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '2501', '3000', '0', '$7.773'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '3001', '3500', '0', '$8.294'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '3501', '4000', '0', '$8.816'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '4001', '999999', '0', '$30.610'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '0', '250', '0', '$11.874'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '251', '500', '0', '$12.134'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '501', '1000', '0', '$12.656'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '1001', '1500', '0', '$13.177'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '1501', '2000', '0', '$13.698'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '2001', '2500', '0', '$14.220'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '2501', '3000', '0', '$14.741'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '3001', '3500', '0', '$15.263'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '3501', '4000', '0', '$15.784'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '4001', '999999', '0', '$37.578'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '0', '250', '0', '$2.161'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '251', '500', '0', '$2.379'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '501', '1000', '0', '$2.815'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.252'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '1501', '2000', '0', '$3.688'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.124'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '2501', '3000', '0', '$4.560'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '3001', '3500', '0', '$4.997'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '3501', '4000', '0', '$5.433'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '4001', '999999', '0', '$23.669'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.105'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.323'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '501', '1000', '0', '$4.759'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.195'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$5.631'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.068'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$6.504'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$6.940'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$7.376'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$25.612'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '0', '250', '0', '$9.935'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '251', '500', '0', '$10.153'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '501', '1000', '0', '$10.589'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$11.026'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$11.462'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$11.898'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$12.334'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$12.771'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$13.207'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$31.443'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '0', '250', '0', '$2.293'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '251', '500', '0', '$2.524'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '501', '1000', '0', '$2.987'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '1001', '1500', '0', '$3.450'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '1501', '2000', '0', '$3.913'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '2001', '2500', '0', '$4.376'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '2501', '3000', '0', '$4.839'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '3001', '3500', '0', '$5.301'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '3501', '4000', '0', '$5.764'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '4001', '999999', '0', '$25.112'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '0', '250', '0', '$4.355'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '251', '500', '0', '$4.586'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '501', '1000', '0', '$5.049'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '1001', '1500', '0', '$5.512'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '1501', '2000', '0', '$5.975'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '2001', '2500', '0', '$6.438'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '2501', '3000', '0', '$6.900'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '3001', '3500', '0', '$7.363'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '3501', '4000', '0', '$7.826'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '4001', '999999', '0', '$27.174'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '0', '250', '0', '$10.541'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '251', '500', '0', '$10.772'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '501', '1000', '0', '$11.235'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '1001', '1500', '0', '$11.698'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '1501', '2000', '0', '$12.161'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '2001', '2500', '0', '$12.624'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '2501', '3000', '0', '$13.087'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '3001', '3500', '0', '$13.549'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '3501', '4000', '0', '$14.012'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '4001', '999999', '0', '$33.360'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '0', '250', '0', '$2.161'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '251', '500', '0', '$2.379'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '501', '1000', '0', '$2.815'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.252'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '1501', '2000', '0', '$3.688'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.124'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '2501', '3000', '0', '$4.560'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '3001', '3500', '0', '$4.997'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '3501', '4000', '0', '$5.433'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '4001', '999999', '0', '$23.669'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.105'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.323'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '501', '1000', '0', '$4.759'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.195'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$5.631'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.068'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$6.504'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$6.940'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$7.376'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$25.612'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '0', '250', '0', '$9.935'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '251', '500', '0', '$10.153'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '501', '1000', '0', '$10.589'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$11.026'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$11.462'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$11.898'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$12.334'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$12.771'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$13.207'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$31.443'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '0', '250', '0', '$2.293'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '251', '500', '0', '$2.524'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '501', '1000', '0', '$2.987'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '1001', '1500', '0', '$3.450'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '1501', '2000', '0', '$3.913'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '2001', '2500', '0', '$4.376'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '2501', '3000', '0', '$4.839'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '3001', '3500', '0', '$5.301'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '3501', '4000', '0', '$5.764'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '4001', '999999', '0', '$25.112'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '0', '250', '0', '$4.355'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '251', '500', '0', '$4.586'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '501', '1000', '0', '$5.049'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '1001', '1500', '0', '$5.512'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '1501', '2000', '0', '$5.975'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '2001', '2500', '0', '$6.438'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '2501', '3000', '0', '$6.900'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '3001', '3500', '0', '$7.363'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '3501', '4000', '0', '$7.826'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '4001', '999999', '0', '$27.174'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '0', '250', '0', '$10.541'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '251', '500', '0', '$10.772'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '501', '1000', '0', '$11.235'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '1001', '1500', '0', '$11.698'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '1501', '2000', '0', '$12.161'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '2001', '2500', '0', '$12.624'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '2501', '3000', '0', '$13.087'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '3001', '3500', '0', '$13.549'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '3501', '4000', '0', '$14.012'); -INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '4001', '999999', '0', '$33.360'); - - --- --- Data for Name: stage_domestic_move_accessorial_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('1', 'Crating (per cubic ft.)', '23.69'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('2', 'Crating (per cubic ft.)', '23.69'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('3', 'Crating (per cubic ft.)', '23.69'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('1', 'Uncrating (per cubic ft.)', '5.95'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('2', 'Uncrating (per cubic ft.)', '5.95'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('3', 'Uncrating (per cubic ft.)', '5.95'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('1', 'Shuttle Service (per cwt)', '5.05'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('2', 'Shuttle Service (per cwt)', '5.41'); -INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('3', 'Shuttle Service (per cwt)', '5.76'); - - --- --- Data for Name: stage_domestic_service_area_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('184.0', 'Sanford, FL', '2', '2', 'NonPeak', '$1.27', '$6.89', '$19.31', '$0.68'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('184.0', 'Sanford, FL', '2', '2', 'Peak', '$1.28', '$8.28', '$22.31', '$0.75'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('4.0', 'Birmingham, AL', '2', '2', 'NonPeak', '$1.27', '$6.89', '$19.31', '$0.68'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('4.0', 'Birmingham, AL', '2', '2', 'Peak', '$1.46', '$7.92', '$22.21', '$0.78'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('452.0', 'Springfield, MO', '1', '3', 'NonPeak', '$1.08', '$7.20', '$14.27', '$0.55'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('452.0', 'Springfield, MO', '1', '3', 'Peak', '$1.24', '$8.28', '$16.41', '$0.63'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('592.0', 'Dickinson, ND', '3', '3', 'NonPeak', '$0.16', '$5.81', '$15.97', '$0.62'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('592.0', 'Dickinson, ND', '3', '3', 'Peak', '$0.18', '$6.68', '$18.37', '$0.71'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('616.0', 'Columbus, OH', '2', '2', 'NonPeak', '$2.44', '$9.55', '$15.81', '$0.62'); -INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('616.0', 'Columbus, OH', '2', '2', 'Peak', '$2.81', '$10.98', '$18.18', '$0.71'); - - --- --- Data for Name: stage_domestic_service_areas; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Sanford', 'FL', '184', '327.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Birmingham', 'AL', '004', '352.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Butler', 'MO', '452.0', '647.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Carbon Hill', 'AL', '004', '355.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Chulafinnee', 'AL', '004', '362.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Collinsville', 'AL', '004', '359.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Columbus', 'OH', '616.0', '432.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Cumberland', 'OH', '616.0', '437.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Dickinson', 'ND', '592.0', '586.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('La Rue', 'OH', '616.0', '433.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Leeds', 'AL', '004', '350,351'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Neosho', 'MO', '452.0', '648.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('South Bloomfield', 'OH', '616.0', '431.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Springfield', 'MO', '452.0', '656,657,658'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Tuscaloosa', 'AL', '004', '354.0'); -INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Worthington', 'OH', '616.0', '430.0'); - - --- --- Data for Name: stage_domestic_other_pack_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('1','Packing (per cwt)','$63.33','$65.44'); -INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('2','Packing (per cwt)','$72.50','$73.20'); -INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('3','Packing (per cwt)','$73.95','$80.00'); -INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('1','Unpack (per cwt)','$83.34','$85.44'); -INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('2','Unpack (per cwt)','$5.97','$6.50'); -INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('3','Unpack (per cwt)','$5.97','$6.50'); - - --- --- Data for Name: stage_domestic_other_sit_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_domestic_other_sit_prices (sit_pickup_delivery_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('1','SIT Pickup / Delivery ≤50 miles (per cwt)','$217.96','$220.11'); -INSERT INTO public.stage_domestic_other_sit_prices (sit_pickup_delivery_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('2','SIT Pickup / Delivery ≤50 miles (per cwt)','$234.40','$241.22'); -INSERT INTO public.stage_domestic_other_sit_prices (sit_pickup_delivery_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('3','SIT Pickup / Delivery ≤50 miles (per cwt)','$246.25','$250.30'); - - --- --- Data for Name: stage_international_move_accessorial_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('CONUS', 'Crating (per cubic ft.)', '25.61'); -INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('OCONUS', 'Crating (per cubic ft.)', '28.59'); -INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('CONUS', 'Uncrating (per cubic ft.)', '6.54'); -INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('OCONUS', 'Uncrating (per cubic ft.)', '6.54'); -INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('CONUS', 'Shuttle Service (per cwt)', '145.29'); -INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('OCONUS', 'Shuttle Service (per cwt)', '156.23'); - - --- --- Data for Name: stage_international_service_areas; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Alaska (Zone) I', 'US8101000'); -INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Germany', 'GE'); -INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('New South Wales/Australian Capital Territory', 'AS11'); -INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Canada Central', 'NSRA2'); -INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Pacific Islands', 'NSRA13'); - - --- --- Data for Name: stage_non_standard_locn_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'NonPeak', '$9.77', '$44.58'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'Peak', '$11.53', '$52.60'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'NonPeak', '$48.49', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'Peak', '$57.22', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'NonPeak', '$9.77', '$11.66'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'Peak', '$11.53', '$13.76'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'NonPeak', '$48.49', '$12.03'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'Peak', '$57.22', '$14.20'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'NonPeak', '$51.21', '$61.80'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'Peak', '$60.43', '$72.92'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'GE', 'Germany', 'NSRA to OCONUS', 'NonPeak', '$16.05', '$31.29'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'GE', 'Germany', 'NSRA to OCONUS', 'Peak', '$18.94', '$36.92'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'NonPeak', '$15.28', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'Peak', '$18.03', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'NonPeak', '$51.72', '$11.75'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'Peak', '$61.03', '$13.86'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'GE', 'Germany', 'NSRA to OCONUS', 'NonPeak', '$17.57', '$47.76'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'GE', 'Germany', 'NSRA to OCONUS', 'Peak', '$20.73', '$56.36'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'NonPeak', '$16.80', '$61.92'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'Peak', '$19.82', '$73.07'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'NonPeak', '$9.77', '$44.58'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'Peak', '$11.53', '$52.60'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'NonPeak', '$48.49', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'Peak', '$57.22', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'NonPeak', '$48.72', '$10.50'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'Peak', '$57.49', '$12.39'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'NonPeak', '$16.00', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'Peak', '$18.88', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'NonPeak', '$51.01', '$44.58'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'Peak', '$60.19', '$52.60'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'NonPeak', '$71.61', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'Peak', '$84.50', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US16', 'Connecticut', 'NSRA to CONUS', 'NonPeak', '$47.42', '$44.58'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US16', 'Connecticut', 'NSRA to CONUS', 'Peak', '$55.96', '$52.60'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US47', 'Alabama', 'NSRA to CONUS', 'NonPeak', '$10.83', '$10.25'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US47', 'Alabama', 'NSRA to CONUS', 'Peak', '$12.78', '$12.09'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'NonPeak', '$9.31', '$17.17'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'Peak', '$10.99', '$20.26'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US68', 'Texas-South', 'NSRA to CONUS', 'NonPeak', '$48.49', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US68', 'Texas-South', 'NSRA to CONUS', 'Peak', '$57.22', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US16', 'Connecticut', 'NSRA to CONUS', 'NonPeak', '$8.88', '$43.94'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US16', 'Connecticut', 'NSRA to CONUS', 'Peak', '$10.48', '$51.85'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US47', 'Alabama', 'NSRA to CONUS', 'NonPeak', '$15.28', '$12.03'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US47', 'Alabama', 'NSRA to CONUS', 'Peak', '$18.03', '$14.20'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'NonPeak', '$18.33', '$44.58'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'Peak', '$21.63', '$52.60'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US68', 'Texas-South', 'NSRA to CONUS', 'NonPeak', '$9.77', '$44.58'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US68', 'Texas-South', 'NSRA to CONUS', 'Peak', '$11.53', '$52.60'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$10.35', '$11.75'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$12.21', '$13.86'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$51.55', '$47.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$60.83', '$56.56'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$71.89', '$11.66'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$84.83', '$13.76'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$30.90', '$12.03'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$36.46', '$14.20'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$47.42', '$44.24'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$55.96', '$52.20'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$17.57', '$16.89'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$20.73', '$19.93'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$27.63', '$44.24'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$32.60', '$52.20'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$10.65', '$16.89'); -INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$12.57', '$19.93'); - - --- --- Data for Name: stage_oconus_to_conus_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US16', 'Connecticut', 'NonPeak', '$29.28', '$33.75'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US16', 'Connecticut', 'Peak', '$34.55', '$39.82'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US47', 'Alabama', 'NonPeak', '$27.63', '$32.26'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US47', 'Alabama', 'Peak', '$32.60', '$38.07'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US4965500', 'Florida Keys', 'NonPeak', '$16.05', '$43.94'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US4965500', 'Florida Keys', 'Peak', '$18.94', '$51.85'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US68', 'Texas-South', 'NonPeak', '$17.57', '$44.51'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US68', 'Texas-South', 'Peak', '$20.73', '$52.52'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US16', 'Connecticut', 'NonPeak', '$15.28', '$31.91'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US16', 'Connecticut', 'Peak', '$18.03', '$37.65'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US47', 'Alabama', 'NonPeak', '$30.90', '$44.28'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US47', 'Alabama', 'Peak', '$36.46', '$52.25'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US4965500', 'Florida Keys', 'NonPeak', '$17.57', '$34.33'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US4965500', 'Florida Keys', 'Peak', '$20.73', '$40.51'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US68', 'Texas-South', 'NonPeak', '$24.38', '$34.90'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US68', 'Texas-South', 'Peak', '$28.77', '$41.18'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US4965500', 'Florida Keys', 'NonPeak', '$27.63', '$33.98'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US4965500', 'Florida Keys', 'Peak', '$32.60', '$40.10'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US16', 'Connecticut', 'NonPeak', '$24.38', '$44.62'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US16', 'Connecticut', 'Peak', '$28.77', '$52.65'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US47', 'Alabama', 'NonPeak', '$16.05', '$33.75'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US47', 'Alabama', 'Peak', '$18.94', '$39.82'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US68', 'Texas-South', 'NonPeak', '$17.57', '$34.45'); -INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US68', 'Texas-South', 'Peak', '$20.73', '$40.65'); - - --- --- Data for Name: stage_oconus_to_oconus_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$10.65', '$11.86'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$12.57', '$13.99'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'GE', 'Germany', 'NonPeak', '$8.88', '$12.99'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'GE', 'Germany', 'Peak', '$10.48', '$15.33'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$10.35', '$11.86'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US8101000', 'Alaska (Zone) I', 'Peak', '$12.21', '$13.99'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$9.77', '$17.17'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$11.53', '$20.26'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'GE', 'Germany', 'NonPeak', '$11.35', '$16.89'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'GE', 'Germany', 'Peak', '$13.39', '$19.93'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$10.21', '$17.17'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US8101000', 'Alaska (Zone) I', 'Peak', '$12.05', '$20.26'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$11.35', '$11.66'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$13.39', '$13.76'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'GE', 'Germany', 'NonPeak', '$10.21', '$12.36'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'GE', 'Germany', 'Peak', '$12.05', '$14.58'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$11.35', '$17.59'); -INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US8101000', 'Alaska (Zone) I', 'Peak', '$13.39', '$19.93'); - - --- --- Data for Name: stage_other_intl_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('AS11', 'New South Wales/Australian Capital Territory', '$63.33', '$7.52', '$61.05', '$7.24', '$3.42', '$0.10', '$156.26', '$234.40', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('AS11', 'New South Wales/Australian Capital Territory', '$74.10', '$9.15', '$71.43', '$8.47', '$4.00', '$0.12', '$182.82', '$274.25', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('GE', 'Germany', '$57.76', '$7.52', '$86.31', '$7.24', '$4.85', '$0.16', '$172.00', '$258.00', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('GE', 'Germany', '$67.58', '$9.15', '$100.98', '$8.47', '$5.67', '$0.19', '$201.24', '$301.86', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US16', 'Connecticut', '$67.48', '$7.52', '$63.88', '$7.24', '$5.39', '$0.18', '$156.26', '$217.96', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US16', 'Connecticut', '$78.95', '$9.15', '$74.74', '$8.47', '$6.31', '$0.21', '$182.82', '$255.01', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US47', 'Alabama', '$69.97', '$7.52', '$72.50', '$7.24', '$3.28', '$0.16', '$156.26', '$258.00', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US47', 'Alabama', '$81.86', '$9.15', '$84.82', '$8.47', '$3.84', '$0.19', '$182.82', '$301.86', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US4965500', 'Florida Keys', '$76.04', '$7.52', '$79.40', '$7.24', '$4.85', '$0.26', '$156.26', '$258.00', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US4965500', 'Florida Keys', '$88.97', '$9.15', '$92.90', '$8.47', '$5.67', '$0.30', '$182.82', '$301.86', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US68', 'Texas-South', '$69.97', '$7.52', '$72.50', '$7.24', '$4.33', '$0.12', '$145.31', '$258.00', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US68', 'Texas-South', '$81.86', '$9.15', '$84.82', '$8.47', '$5.07', '$0.14', '$170.01', '$301.86', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US8101000', 'Alaska (Zone) I', '$61.05', '$7.52', '$57.76', '$7.24', '$6.07', '$0.14', '$164.17', '$217.96', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US8101000', 'Alaska (Zone) I', '$71.43', '$9.15', '$67.58', '$8.47', '$7.10', '$0.16', '$192.08', '$255.01', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA2', 'Canada Central', '$79.40', '$7.52', '$76.66', '$7.24', '$6.07', '$0.17', '$156.26', '$246.25', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA2', 'Canada Central', '$92.90', '$9.15', '$89.69', '$8.47', '$7.10', '$0.20', '$182.82', '$288.11', 'Peak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA13', 'Pacific Islands', '$86.31', '$7.52', '$83.34', '$7.24', '$5.62', '$0.28', '$164.17', '$246.25', 'NonPeak'); -INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA13', 'Pacific Islands', '$100.98', '$9.15', '$97.51', '$8.47', '$6.58', '$0.33', '$192.08', '$288.11', 'Peak'); - - --- --- Data for Name: stage_price_escalation_discounts; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Base Period Year 1', '1.0000', '', '1'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Base Period Year 2', '1.0206', '', '1.0206'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Base Period Year 3', '1.0197', '', '1.0197'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Option Period 1', '1.0214', '', '1.0214'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Option Period 2', '1.0211', '', '1.0211'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Award Term 1', '1.0199', '', '1.0199'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Award Term 2', '1.0194', '', '1.0194'); -INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Option Period 3', '1.0202', '', '1.0202'); - - --- --- Data for Name: stage_shipment_management_services_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 1', '451.15'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 2', '454.23'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 3', '457.98'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 1', '459.85'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 2', '500.23'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 1', '500.69'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 2', '501.15'); -INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 3', '502.19'); - - --- --- Data for Name: stage_transition_prices; Type: TABLE DATA; Schema: public; Owner: - --- - -INSERT INTO public.stage_transition_prices (contract_year, price_total_cost) VALUES ('One-time Amount (applied in Base Period Year 1)', '$ 450.18'); - - --- --- Name: TABLE stage_conus_to_oconus_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_conus_to_oconus_prices TO master; - - --- --- Name: TABLE stage_counseling_services_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_counseling_services_prices TO master; - - --- --- Name: TABLE stage_domestic_international_additional_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_domestic_international_additional_prices TO master; - - --- --- Name: TABLE stage_domestic_linehaul_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_domestic_linehaul_prices TO master; - - --- --- Name: TABLE stage_domestic_move_accessorial_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_domestic_move_accessorial_prices TO master; - - --- --- Name: TABLE stage_domestic_service_area_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_domestic_service_area_prices TO master; - - --- --- Name: TABLE stage_domestic_service_areas; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_domestic_service_areas TO master; - - --- --- Name: TABLE stage_international_move_accessorial_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_international_move_accessorial_prices TO master; - - --- --- Name: TABLE stage_international_service_areas; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_international_service_areas TO master; - - --- --- Name: TABLE stage_non_standard_locn_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_non_standard_locn_prices TO master; - - --- --- Name: TABLE stage_oconus_to_conus_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_oconus_to_conus_prices TO master; - - --- --- Name: TABLE stage_oconus_to_oconus_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_oconus_to_oconus_prices TO master; - - --- --- Name: TABLE stage_other_intl_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_other_intl_prices TO master; - - --- --- Name: TABLE stage_price_escalation_discounts; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_price_escalation_discounts TO master; - - --- --- Name: TABLE stage_shipment_management_services_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_shipment_management_services_prices TO master; - - --- --- Name: TABLE stage_transition_prices; Type: ACL; Schema: public; Owner: - --- - -GRANT ALL ON TABLE public.stage_transition_prices TO master; - - --- --- PostgreSQL database dump complete --- - diff --git a/pkg/services/ghcimport/ghc_rateengine_importer.go b/pkg/services/ghcimport/ghc_rateengine_importer.go deleted file mode 100644 index 1cbc05c5aa6..00000000000 --- a/pkg/services/ghcimport/ghc_rateengine_importer.go +++ /dev/null @@ -1,78 +0,0 @@ -package ghcimport - -import ( - "fmt" - "time" - - "github.com/gofrs/uuid" - "github.com/pterm/pterm" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -// GHCRateEngineImporter is the rate engine importer for GHC -type GHCRateEngineImporter struct { - ContractCode string - ContractName string - ContractStartDate time.Time - ContractID uuid.UUID - serviceAreaToIDMap map[string]uuid.UUID - domesticRateAreaToIDMap map[string]uuid.UUID - internationalRateAreaToIDMap map[string]uuid.UUID - serviceToIDMap map[models.ReServiceCode]uuid.UUID - contractYearToIDMap map[string]uuid.UUID -} - -func (gre *GHCRateEngineImporter) runImports(appCtx appcontext.AppContext) error { - importers := []struct { - importFunction func(appcontext.AppContext) error - action string - }{ - // NOTE: Ordering is significant as these functions must run in this order. - - // Reference tables - {gre.importREContract, "Importing contract"}, // Also populates gre.ContractID - {gre.importREContractYears, "Importing contract years"}, // Populates gre.contractYearToIDMap - {gre.importREDomesticServiceArea, "Importing domestic service areas"}, // Also populates gre.serviceAreaToIDMap - {gre.importRERateArea, "Importing rate areas"}, // Also populates gre.domesticRateAreaToIDMap and gre.internationalRateAreaToIDMap - {gre.mapZipCodesToRERateAreas, "Mapping zip3s and zip5s to rate areas"}, - {gre.loadServiceMap, "Loading service map"}, // Populates gre.serviceToIDMap - - // Non-reference tables - {gre.importREDomesticLinehaulPrices, "Importing domestic linehaul prices"}, - {gre.importREDomesticServiceAreaPrices, "Importing domestic service area prices"}, - {gre.importREDomesticOtherPrices, "Importing domestic other prices"}, - {gre.importREInternationalPrices, "Importing international prices"}, - {gre.importREInternationalOtherPrices, "Importing international other prices"}, - {gre.importRETaskOrderFees, "Importing task order fees"}, - {gre.importREDomesticAccessorialPrices, "Importing domestic accessorial prices"}, - {gre.importREIntlAccessorialPrices, "Importing international accessorial prices"}, - {gre.importREShipmentTypePrices, "Importing shipment type prices"}, - } - - for _, importer := range importers { - pterm.Println(pterm.BgGray.Sprint(importer.action)) - - err := importer.importFunction(appCtx) - if err != nil { - return fmt.Errorf("importer failed: %s: %w", importer.action, err) - } - - pterm.Println(pterm.BgGray.Sprint(fmt.Sprintf("Finished %s", importer.action))) - } - - return nil -} - -// Import runs the import -func (gre *GHCRateEngineImporter) Import(appCtx appcontext.AppContext) error { - err := appCtx.NewTransaction(func(txnAppCtx appcontext.AppContext) error { - dbTxError := gre.runImports(txnAppCtx) - return dbTxError - }) - if err != nil { - return fmt.Errorf("transaction failed during GHC Rate Engine Import(): %w", err) - } - return nil -} diff --git a/pkg/services/ghcimport/ghc_rateengine_importer_test.go b/pkg/services/ghcimport/ghc_rateengine_importer_test.go deleted file mode 100644 index 74aa80f9b59..00000000000 --- a/pkg/services/ghcimport/ghc_rateengine_importer_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package ghcimport - -import ( - "os" - "path/filepath" - "testing" - "time" - - "github.com/stretchr/testify/suite" - - "github.com/transcom/mymove/pkg/testingsuite" -) - -const testContractCode = "TEST" -const testContractCode2 = "TEST2" -const testContractName = "Test Contract" - -var testContractStartDate = time.Date(2021, time.February, 01, 0, 0, 0, 0, time.UTC) - -type GHCRateEngineImportSuite struct { - *testingsuite.PopTestSuite -} - -func (suite *GHCRateEngineImportSuite) SetupSuite() { - suite.PreloadData(func() { - suite.helperSetupStagingTables() - }) -} - -func (suite *GHCRateEngineImportSuite) TearDownSuite() { - suite.PopTestSuite.TearDown() -} - -func (suite *GHCRateEngineImportSuite) helperLoadSQLFixture(fileName string) { - path := filepath.Join("fixtures", fileName) - _, err := os.Stat(path) - suite.NoError(err) - - c, ioErr := os.ReadFile(filepath.Clean(path)) - suite.NoError(ioErr) - - sql := string(c) - err = suite.DB().RawQuery(sql).Exec() - suite.NoError(err) -} - -func (suite *GHCRateEngineImportSuite) helperSetupStagingTables() { - suite.helperLoadSQLFixture("stage_ghc_pricing.sql") -} - -func TestGHCRateEngineImportSuite(t *testing.T) { - hs := &GHCRateEngineImportSuite{ - PopTestSuite: testingsuite.NewPopTestSuite(testingsuite.CurrentPackage(), testingsuite.WithPerTestTransaction()), - } - - suite.Run(t, hs) -} - -func (suite *GHCRateEngineImportSuite) TestGHCRateEngineImporter_Import() { - tests := []struct { - name string - gre *GHCRateEngineImporter - wantErr bool - }{ - { - name: "Run GHC Rate Engine Importer", - gre: &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractName: testContractName, - ContractStartDate: testContractStartDate, - }, - wantErr: false, - }, - } - for _, tt := range tests { - suite.Run(tt.name, func() { - if err := tt.gre.Import(suite.AppContextForTest()); (err != nil) != tt.wantErr { - suite.T().Errorf("GHCRateEngineImporter.Import() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/pkg/services/ghcimport/import_re_contract.go b/pkg/services/ghcimport/import_re_contract.go deleted file mode 100644 index 68f4b835fbc..00000000000 --- a/pkg/services/ghcimport/import_re_contract.go +++ /dev/null @@ -1,48 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/pkg/errors" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -func (gre *GHCRateEngineImporter) importREContract(appCtx appcontext.AppContext) error { - if gre.ContractCode == "" { - return errors.New("no contract code provided") - } - - // If no contract name is provided, default to the contract code. - contractName := gre.ContractName - if contractName == "" { - contractName = gre.ContractCode - } - - // See if contract code already exists. - exists, err := appCtx.DB().Where("code = ?", gre.ContractCode).Exists(&models.ReContract{}) - if err != nil { - return fmt.Errorf("could not determine if contract code [%s] existed: %w", gre.ContractCode, err) - } - if exists { - return fmt.Errorf("the provided contract code [%s] already exists", gre.ContractCode) - } - - // Contract code is new; insert it. - contract := models.ReContract{ - Code: gre.ContractCode, - Name: contractName, - } - verrs, err := appCtx.DB().ValidateAndSave(&contract) - if verrs.HasAny() { - return fmt.Errorf("validation errors when saving contract [%+v]: %w", contract, verrs) - } - if err != nil { - return fmt.Errorf("could not save contract [%+v]: %w", contract, err) - } - - gre.ContractID = contract.ID - - return nil -} diff --git a/pkg/services/ghcimport/import_re_contract_test.go b/pkg/services/ghcimport/import_re_contract_test.go deleted file mode 100644 index 7107e7ebbf2..00000000000 --- a/pkg/services/ghcimport/import_re_contract_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREContract() { - suite.Run("import success", func() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractName: testContractName, - } - - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - suite.helperCheckContractName(testContractName) - suite.NotNil(gre.ContractID) - }) - - suite.Run("no contract code", func() { - gre := &GHCRateEngineImporter{} - - err := gre.importREContract(suite.AppContextForTest()) - if suite.Error(err) { - suite.Equal("no contract code provided", err.Error()) - } - }) -} - -func (suite *GHCRateEngineImportSuite) Test_importREContract_runTwice() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success, but no contract name", func() { - setupTestData() - suite.helperCheckContractName(testContractCode) - suite.NotNil(gre.ContractID) - }) - - suite.Run("run twice with same contract code - should fail the second time", func() { - setupTestData() - err := gre.importREContract(suite.AppContextForTest()) - if suite.Error(err) { - expected := fmt.Sprintf("the provided contract code [%s] already exists", testContractCode) - suite.Equal(expected, err.Error()) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperCheckContractName(expectedName string) { - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - suite.Equal(expectedName, contract.Name) -} diff --git a/pkg/services/ghcimport/import_re_contract_years.go b/pkg/services/ghcimport/import_re_contract_years.go deleted file mode 100644 index c12cdd76c13..00000000000 --- a/pkg/services/ghcimport/import_re_contract_years.go +++ /dev/null @@ -1,58 +0,0 @@ -package ghcimport - -import ( - "fmt" - "strconv" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -func (gre *GHCRateEngineImporter) importREContractYears(appCtx appcontext.AppContext) error { - // populate contractYearsToIDMap - var priceEscalationDiscounts []models.StagePriceEscalationDiscount - err := appCtx.DB().All(&priceEscalationDiscounts) - if err != nil { - return fmt.Errorf("could not read staged price escalation discounts: %w", err) - } - - gre.contractYearToIDMap = make(map[string]uuid.UUID) - incrementYear := 0 - compoundedEscalation := 1.00000 - - basePeriodEndDateForPrimeContract1 := gre.ContractStartDate.AddDate(1, 0, -1) - - //loop through the price escalation discounts data and pull contract year and escalations - for _, stagePriceEscalationDiscount := range priceEscalationDiscounts { - escalation, err := strconv.ParseFloat(stagePriceEscalationDiscount.PriceEscalation, 64) - if err != nil { - return fmt.Errorf("could not process price escalation [%s]: %w", stagePriceEscalationDiscount.PriceEscalation, err) - } - compoundedEscalation *= escalation - - contractYear := models.ReContractYear{ - ContractID: gre.ContractID, - Name: stagePriceEscalationDiscount.ContractYear, - StartDate: gre.ContractStartDate.AddDate(incrementYear, 0, 0), - EndDate: basePeriodEndDateForPrimeContract1.AddDate(incrementYear, 0, 0), - Escalation: escalation, - EscalationCompounded: compoundedEscalation, - } - incrementYear++ - - verrs, dbErr := appCtx.DB().ValidateAndSave(&contractYear) - if dbErr != nil { - return fmt.Errorf("error saving ReContractYears: %+v with error: %w", contractYear, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReContractYears: %+v with validation errors: %w", contractYear, verrs) - } - - //add to map - gre.contractYearToIDMap[contractYear.Name] = contractYear.ID - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_contract_years_test.go b/pkg/services/ghcimport/import_re_contract_years_test.go deleted file mode 100644 index b33584d8656..00000000000 --- a/pkg/services/ghcimport/import_re_contract_years_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREContractYears() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractStartDate: testContractStartDate, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREContractYears(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyContractYears() - suite.helperCheckContractYearValue() - }) - - suite.Run("run a second time; should fail immediately due to date range constraint", func() { - setupTestData() - err := gre.importREContractYears(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.ExclusionViolation, "re_contract_years_daterange_excl")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyContractYears() { - count, err := suite.DB().Count(&models.ReContractYear{}) - suite.NoError(err) - suite.Equal(8, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckContractYearValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - var basePeriod1 models.ReContractYear - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("name = $2", "Base Period Year 1"). - First(&basePeriod1) - suite.NoError(err) - suite.Equal(1.0000, basePeriod1.Escalation) - suite.Equal(1.0000, basePeriod1.EscalationCompounded) - - var optionPeriod1 models.ReContractYear - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("name = $2", "Option Period 1"). - First(&optionPeriod1) - suite.NoError(err) - suite.Equal(1.02140, optionPeriod1.Escalation) - suite.Equal(1.06298, optionPeriod1.EscalationCompounded) - - var awardTerm2 models.ReContractYear - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("name = $2", "Award Term 2"). - First(&awardTerm2) - suite.NoError(err) - suite.Equal(1.01940, awardTerm2.Escalation) - suite.Equal(1.12848, awardTerm2.EscalationCompounded) -} diff --git a/pkg/services/ghcimport/import_re_domestic_accessorial_prices.go b/pkg/services/ghcimport/import_re_domestic_accessorial_prices.go deleted file mode 100644 index b30f1f75ccd..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_accessorial_prices.go +++ /dev/null @@ -1,77 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importREDomesticAccessorialPrices(appCtx appcontext.AppContext) error { - //tab 5a) Access. and Add. Prices - var domesticAccessorialPrices []models.StageDomesticMoveAccessorialPrice - err := appCtx.DB().All(&domesticAccessorialPrices) - if err != nil { - return fmt.Errorf("could not read staged domestic accessorial prices: %w", err) - } - - services := []struct { - serviceCode models.ReServiceCode - serviceProvided string - }{ - {models.ReServiceCodeDCRT, "Crating (per cubic ft.)"}, - {models.ReServiceCodeDCRTSA, "Crating (per cubic ft.)"}, - {models.ReServiceCodeDUCRT, "Uncrating (per cubic ft.)"}, - {models.ReServiceCodeDDSHUT, "Shuttle Service (per cwt)"}, - {models.ReServiceCodeDOSHUT, "Shuttle Service (per cwt)"}, - } - - //loop through the domestic accessorial price data and store in db - for _, stageDomesticAccessorialPrice := range domesticAccessorialPrices { - servicesSchedule, err := stringToInteger(stageDomesticAccessorialPrice.ServicesSchedule) - if err != nil { - return fmt.Errorf("could not process services schedule [%s]: %w", stageDomesticAccessorialPrice.ServicesSchedule, err) - } - - var perUnitCentsService int - perUnitCentsService, err = priceToCents(stageDomesticAccessorialPrice.PricePerUnit) - if err != nil { - return fmt.Errorf("could not process price per unit [%s]: %w", stageDomesticAccessorialPrice.PricePerUnit, err) - } - - serviceProvidedFound := false - for _, service := range services { - serviceCode := service.serviceCode - serviceProvided := service.serviceProvided - - if stageDomesticAccessorialPrice.ServiceProvided == serviceProvided { - serviceProvidedFound = true - serviceID, found := gre.serviceToIDMap[serviceCode] - if !found { - return fmt.Errorf("missing service [%s] in map of services", serviceCode) - } - - domesticAccessorial := models.ReDomesticAccessorialPrice{ - ContractID: gre.ContractID, - ServicesSchedule: servicesSchedule, - ServiceID: serviceID, - PerUnitCents: unit.Cents(perUnitCentsService), - } - - verrs, dbErr := appCtx.DB().ValidateAndSave(&domesticAccessorial) - if dbErr != nil { - return fmt.Errorf("error saving ReDomesticAccessorialPrices: %+v with error: %w", domesticAccessorial, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReDomesticAccessorialPrices: %+v with validation errors: %w", domesticAccessorial, verrs) - } - } - } - if !serviceProvidedFound { - return fmt.Errorf("service [%s] not found", stageDomesticAccessorialPrice.ServiceProvided) - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go b/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go deleted file mode 100644 index 5f75bbd55a4..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticAccessorialPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticAccessorialPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticAccessorialPrices() - suite.helperCheckDomesticAccessorialPrices() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticAccessorialPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_accessorial_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticAccessorialPrices() { - count, err := suite.DB().Count(&models.ReDomesticAccessorialPrice{}) - suite.NoError(err) - suite.Equal(15, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticAccessorialPrices() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - testCases := []struct { - serviceCode models.ReServiceCode - schedule int - expectedPrice int - isError bool - }{ - {models.ReServiceCodeDCRT, 1, 2369, false}, - {models.ReServiceCodeDCRTSA, 1, 2369, false}, - {models.ReServiceCodeDUCRT, 1, 595, false}, - {models.ReServiceCodeDDSHUT, 1, 505, false}, - {models.ReServiceCodeDDSHUT, 3, 576, false}, - {models.ReServiceCodeDOSHUT, 1, 505, false}, - {models.ReServiceCodeMS, 3, 0, true}, - {models.ReServiceCodeDCRT, 5, 0, true}, - } - - for _, testCase := range testCases { - // Get service UUID. - var service models.ReService - err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) - suite.NoError(err) - - var domesticAccessorialPrice models.ReDomesticAccessorialPrice - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("service_id = $2", service.ID). - Where("services_schedule = $3", testCase.schedule). - First(&domesticAccessorialPrice) - - if testCase.isError { - suite.Error(err) - } else { - suite.NoError(err) - suite.Equal(unit.Cents(testCase.expectedPrice), domesticAccessorialPrice.PerUnitCents, "test case: %+v", testCase) - } - } -} diff --git a/pkg/services/ghcimport/import_re_domestic_linehaul_prices.go b/pkg/services/ghcimport/import_re_domestic_linehaul_prices.go deleted file mode 100644 index 9b24f78ae02..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_linehaul_prices.go +++ /dev/null @@ -1,80 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importREDomesticLinehaulPrices(appCtx appcontext.AppContext) error { - // Read all the staged prices - var stageDomesticLinehaulPrices []models.StageDomesticLinehaulPrice - err := appCtx.DB().All(&stageDomesticLinehaulPrices) - if err != nil { - return fmt.Errorf("could not read staged domestic linehaul prices: %w", err) - } - - for _, stagePrice := range stageDomesticLinehaulPrices { - weightLowerInt, err := stringToInteger(stagePrice.WeightLower) - if err != nil { - return fmt.Errorf("could not process weight lower [%s]: %w", stagePrice.WeightLower, err) - } - - weightUpperInt, err := stringToInteger(stagePrice.WeightUpper) - if err != nil { - return fmt.Errorf("could not process weight upper [%s]: %w", stagePrice.WeightUpper, err) - } - - milesLowerInt, err := stringToInteger(stagePrice.MilesLower) - if err != nil { - return fmt.Errorf("could not process miles lower [%s]: %w", stagePrice.MilesLower, err) - } - - milesUpperInt, err := stringToInteger(stagePrice.MilesUpper) - if err != nil { - return fmt.Errorf("could not process miles upper [%s]: %w", stagePrice.MilesUpper, err) - } - - isPeakPeriod, err := isPeakPeriod(stagePrice.Season) - if err != nil { - return fmt.Errorf("could not process season [%s]: %w", stagePrice.Season, err) - } - - serviceArea, err := cleanServiceAreaNumber(stagePrice.ServiceAreaNumber) - if err != nil { - return fmt.Errorf("could not process service area number [%s]: %w", stagePrice.ServiceAreaNumber, err) - } - serviceAreaID, found := gre.serviceAreaToIDMap[serviceArea] - if !found { - return fmt.Errorf("could not find service area [%s] in map", stagePrice.ServiceAreaNumber) - } - - priceMillicents, err := priceToMillicents(stagePrice.Rate) - if err != nil { - return fmt.Errorf("could not process rate [%s]: %w", stagePrice.Rate, err) - } - - domesticLinehaulPrice := models.ReDomesticLinehaulPrice{ - ContractID: gre.ContractID, - WeightLower: unit.Pound(weightLowerInt), - WeightUpper: unit.Pound(weightUpperInt), - MilesLower: milesLowerInt, - MilesUpper: milesUpperInt, - IsPeakPeriod: isPeakPeriod, - DomesticServiceAreaID: serviceAreaID, - PriceMillicents: unit.Millicents(priceMillicents), - } - - verrs, err := appCtx.DB().ValidateAndSave(&domesticLinehaulPrice) - if verrs.HasAny() { - return fmt.Errorf("validation errors when saving domestic linehaul price [%+v]: %w", domesticLinehaulPrice, verrs) - } - if err != nil { - return fmt.Errorf("could not save domestic linehaul price [%+v]: %w", domesticLinehaulPrice, err) - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go b/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go deleted file mode 100644 index 32b16b4fced..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticLinehaulPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticLinehaulPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticLinehaulCount() - - // Spot check a linehaul price - suite.helperCheckDomesticLinehaulValue() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticLinehaulPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_linehaul_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticLinehaulCount() { - count, err := suite.DB().Count(&models.ReDomesticLinehaulPrice{}) - suite.NoError(err) - suite.Equal(13800, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticLinehaulValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Get domestic service area UUID. - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '452'"). - First(&serviceArea) - suite.NoError(err) - - // Get linehaul price. - var linehaul models.ReDomesticLinehaulPrice - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("weight_lower = 5000"). - Where("weight_upper = 9999"). - Where("miles_lower = 2501"). - Where("miles_upper = 3000"). - Where("is_peak_period = false"). - Where("domestic_service_area_id = ?", serviceArea.ID). - First(&linehaul) - suite.NoError(err) - - suite.Equal(unit.Millicents(745600), linehaul.PriceMillicents) -} diff --git a/pkg/services/ghcimport/import_re_domestic_other_prices.go b/pkg/services/ghcimport/import_re_domestic_other_prices.go deleted file mode 100644 index 7b47722e74f..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_other_prices.go +++ /dev/null @@ -1,199 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -// DomOtherPriceToInsert is the domestic other price to insert -type DomOtherPriceToInsert struct { - model models.ReDomesticOtherPrice - message string -} - -func importPackUnpackPrices(appCtx appcontext.AppContext, serviceToIDMap map[models.ReServiceCode]uuid.UUID, contractID uuid.UUID) ([]DomOtherPriceToInsert, error) { - var stagePackPrices []models.StageDomesticOtherPackPrice - var modelsToSave []DomOtherPriceToInsert - - if err := appCtx.DB().All(&stagePackPrices); err != nil { - return nil, fmt.Errorf("error looking up StageDomesticOtherPackPrice data: %w", err) - } - - // DPK Dom. Packing - packServiceID, found := serviceToIDMap[models.ReServiceCodeDPK] - if !found { - return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDPK) - } - - // DUPK Dom. Unpacking - unpackServiceID, found := serviceToIDMap[models.ReServiceCodeDUPK] - if !found { - return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDUPK) - } - - for _, stagePackPrice := range stagePackPrices { - peakCents, err := priceToCents(stagePackPrice.PeakPricePerCwt) - if err != nil { - return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDPK, stagePackPrice.PeakPricePerCwt, err) - } - - nonPeakCents, err := priceToCents(stagePackPrice.NonPeakPricePerCwt) - if err != nil { - return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDUPK, stagePackPrice.NonPeakPricePerCwt, err) - } - - servicesSchedule, err := stringToInteger(stagePackPrice.ServicesSchedule) - if err != nil { - return nil, fmt.Errorf("failed to parse ServicesSchedule for pack/unpack: %+v error: %w", stagePackPrice.ServicesSchedule, err) - } - - packNonPeakPriceModel := models.ReDomesticOtherPrice{ - ContractID: contractID, - Schedule: servicesSchedule, - IsPeakPeriod: false, - PriceCents: unit.Cents(nonPeakCents), - } - packPeakPriceModel := models.ReDomesticOtherPrice{ - ContractID: contractID, - Schedule: servicesSchedule, - IsPeakPeriod: true, - PriceCents: unit.Cents(peakCents), - } - - if stagePackPrice.ServiceProvided == "Packing (per cwt)" { - packNonPeakPriceModel.ServiceID = packServiceID - packPeakPriceModel.ServiceID = packServiceID - } else if stagePackPrice.ServiceProvided == "Unpack (per cwt)" { - packNonPeakPriceModel.ServiceID = unpackServiceID - packPeakPriceModel.ServiceID = unpackServiceID - } else { - return nil, fmt.Errorf("failed to import pack/unpack prices receieved unexpected ServiceProvided: %s in %+v", stagePackPrice.ServiceProvided, stagePackPrice) - } - - modelsToSave = append(modelsToSave, DomOtherPriceToInsert{model: packNonPeakPriceModel, message: "Non-Peak Pack/Unpack"}) - modelsToSave = append(modelsToSave, DomOtherPriceToInsert{model: packPeakPriceModel, message: "Peak Pack/Unpack"}) - } - - return modelsToSave, nil -} - -func importSitPrices(appCtx appcontext.AppContext, serviceToIDMap map[models.ReServiceCode]uuid.UUID, contractID uuid.UUID) ([]DomOtherPriceToInsert, error) { - var stageSitPrices []models.StageDomesticOtherSitPrice - var modelsToSave []DomOtherPriceToInsert - - if err := appCtx.DB().All(&stageSitPrices); err != nil { - return nil, fmt.Errorf("error looking up StageDomesticOtherSitPrice data: %w", err) - } - - // DOPSIT Dom. Origin SIT Pickup - originSitPickupID, found := serviceToIDMap[models.ReServiceCodeDOPSIT] - if !found { - return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDOPSIT) - } - - // DDDSIT Dom. Destination SIT Delivery - destSitDeliveryID, found := serviceToIDMap[models.ReServiceCodeDDDSIT] - if !found { - return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDDDSIT) - } - - for _, stageSitPrice := range stageSitPrices { - peakCents, err := priceToCents(stageSitPrice.PeakPricePerCwt) - if err != nil { - return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDOPSIT, stageSitPrice.PeakPricePerCwt, err) - } - - nonPeakCents, err := priceToCents(stageSitPrice.NonPeakPricePerCwt) - if err != nil { - return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDDDSIT, stageSitPrice.NonPeakPricePerCwt, err) - } - - schedule, err := stringToInteger(stageSitPrice.SITPickupDeliverySchedule) - if err != nil { - return nil, fmt.Errorf("failed to parse SITPickupDeliverySchedule: %+v error: %w", stageSitPrice.SITPickupDeliverySchedule, err) - } - - modelsToSave = append( - modelsToSave, - DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ - ContractID: contractID, - ServiceID: originSitPickupID, - Schedule: schedule, - IsPeakPeriod: false, - PriceCents: unit.Cents(nonPeakCents), - }, message: "SIT Non Peak Pickup"}) - modelsToSave = append( - modelsToSave, - DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ - ContractID: contractID, - ServiceID: destSitDeliveryID, - Schedule: schedule, - IsPeakPeriod: false, - PriceCents: unit.Cents(nonPeakCents), - }, message: "SIT Non Peak Delivery"}) - modelsToSave = append( - modelsToSave, - DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ - ContractID: contractID, - ServiceID: originSitPickupID, - Schedule: schedule, - IsPeakPeriod: true, - PriceCents: unit.Cents(peakCents), - }, message: "SIT Peak Pickup"}) - modelsToSave = append( - modelsToSave, - DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ - ContractID: contractID, - ServiceID: destSitDeliveryID, - Schedule: schedule, - IsPeakPeriod: true, - PriceCents: unit.Cents(peakCents), - }, message: "SIT Peak Delivery"}) - } - - return modelsToSave, nil -} - -func saveModel(appCtx appcontext.AppContext, message string, model *models.ReDomesticOtherPrice) error { - verrs, err := appCtx.DB().ValidateAndSave(model) - if verrs.HasAny() { - return fmt.Errorf("error saving ReDomesticOtherPrice %s: %+v with validation errors: %w", message, model, verrs) - } - if err != nil { - return fmt.Errorf("error saving ReDomesticOtherPrice %s: %+v with error: %w", message, model, err) - } - - return nil -} - -func (gre *GHCRateEngineImporter) importREDomesticOtherPrices(appCtx appcontext.AppContext) error { - - var modelsToSavePack []DomOtherPriceToInsert - var modelsToSaveSit []DomOtherPriceToInsert - - var err error - modelsToSavePack, err = importPackUnpackPrices(appCtx, gre.serviceToIDMap, gre.ContractID) - if err != nil { - return err - } - - modelsToSaveSit, err = importSitPrices(appCtx, gre.serviceToIDMap, gre.ContractID) - if err != nil { - return err - } - - modelsToSave := append(modelsToSavePack, modelsToSaveSit...) - for _, modelToSave := range modelsToSave { - //nolint:gosec - if err := saveModel(appCtx, modelToSave.message, &modelToSave.model); err != nil { - return err - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_domestic_other_prices_test.go b/pkg/services/ghcimport/import_re_domestic_other_prices_test.go deleted file mode 100644 index ca14e7f4ad9..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_other_prices_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticOtherPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticOtherPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticOtherPrices() - suite.helperCheckDomesticOtherPriceValue() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_other_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticOtherPricesFailures() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - setupTestData := func() { - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - suite.NotNil(gre.ContractID) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("stage_domestic_other_sit_prices table missing", func() { - setupTestData() - renameQuery := "ALTER TABLE stage_domestic_other_sit_prices RENAME TO missing_stage_domestic_other_sit_prices" - renameErr := suite.DB().RawQuery(renameQuery).Exec() - suite.NoError(renameErr) - - err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) - } - }) - - suite.Run("stage_domestic_other_pack_prices table missing", func() { - setupTestData() - // drop a staging table that we are depending on to do import - dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS %s;", "stage_domestic_other_pack_prices") - dropErr := suite.DB().RawQuery(dropQuery).Exec() - suite.NoError(dropErr) - - err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticOtherPrices() { - count, err := suite.DB().Count(&models.ReDomesticOtherPrice{}) - suite.NoError(err) - suite.Equal(48, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticOtherPriceValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - suite.verifyDomesticOtherPrice(unit.Cents(7395), contract.ID, false, models.ReServiceCodeDPK, 3) - suite.verifyDomesticOtherPrice(unit.Cents(8000), contract.ID, true, models.ReServiceCodeDPK, 3) - suite.verifyDomesticOtherPrice(unit.Cents(597), contract.ID, false, models.ReServiceCodeDUPK, 2) - suite.verifyDomesticOtherPrice(unit.Cents(650), contract.ID, true, models.ReServiceCodeDUPK, 2) - suite.verifyDomesticOtherPrice(unit.Cents(23440), contract.ID, false, models.ReServiceCodeDOPSIT, 2) - suite.verifyDomesticOtherPrice(unit.Cents(24122), contract.ID, true, models.ReServiceCodeDOPSIT, 2) - suite.verifyDomesticOtherPrice(unit.Cents(24625), contract.ID, false, models.ReServiceCodeDDDSIT, 3) - suite.verifyDomesticOtherPrice(unit.Cents(25030), contract.ID, true, models.ReServiceCodeDDDSIT, 3) -} - -func (suite *GHCRateEngineImportSuite) verifyDomesticOtherPrice(expected unit.Cents, contractID uuid.UUID, isPeakPeriod bool, serviceCode models.ReServiceCode, schedule int) { - var service models.ReService - err := suite.DB().Where("code = ?", serviceCode).First(&service) - suite.NoError(err) - - var domesticOtherPrice models.ReDomesticOtherPrice - err = suite.DB(). - Where("contract_id = ?", contractID). - Where("service_id = ?", service.ID). - Where("is_peak_period = ?", isPeakPeriod). - Where("schedule = ?", schedule).First(&domesticOtherPrice) - suite.NoError(err) - suite.Equal(expected, domesticOtherPrice.PriceCents) -} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area.go b/pkg/services/ghcimport/import_re_domestic_service_area.go deleted file mode 100644 index ed68176314d..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_service_area.go +++ /dev/null @@ -1,259 +0,0 @@ -package ghcimport - -import ( - "fmt" - "strings" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -// A set of service area strings and their associated data -type serviceAreasSet map[string]domesticServiceAreaData - -// The ReDomesticServiceArea model and the related zip3 set -type domesticServiceAreaData struct { - serviceArea *models.ReDomesticServiceArea - zip3s zip3Set -} - -// A set of zip3s and their associated city/state -type zip3Set map[string]cityState - -// City/state data we need for each zip3 -type cityState struct { - city string - state string -} - -func (gre *GHCRateEngineImporter) importREDomesticServiceArea(appCtx appcontext.AppContext) error { - // Build a data structure that we'll walk for inserting rows into the DB (we have - // duplicate service areas that we need to handle). - serviceAreasData, err := gre.buildServiceAreasData(appCtx) - if err != nil { - return err - } - - // Insert the service area and zip3 records; store a map of service area UUIDs to use - // in later imports. - gre.serviceAreaToIDMap, err = gre.saveServiceAreasAndZip3s(appCtx, serviceAreasData) - if err != nil { - return err - } - - return nil -} - -func (gre *GHCRateEngineImporter) buildServiceAreasData(appCtx appcontext.AppContext) (serviceAreasSet, error) { - // Read all the staged domestic service areas - var stageDomesticServiceAreas []models.StageDomesticServiceArea - stageErr := appCtx.DB().All(&stageDomesticServiceAreas) - if stageErr != nil { - return nil, fmt.Errorf("could not read staged domestic service areas: %w", stageErr) - } - - // Since we appear to have duplicate service areas (and possibly zips too), consolidate data to - // insert in a separate data structure that we'll then walk for inserting rows into the DB. - serviceAreasData := make(serviceAreasSet) - for _, stageArea := range stageDomesticServiceAreas { - serviceAreaNumber, err := cleanServiceAreaNumber(stageArea.ServiceAreaNumber) - if err != nil { - return nil, fmt.Errorf("could not process service area number [%s]: %w", stageArea.ServiceAreaNumber, err) - } - - splitZip3s := strings.Split(stageArea.Zip3s, ",") - for i, zip3 := range splitZip3s { - splitZip3s[i], err = cleanZip3(zip3) - if err != nil { - return nil, fmt.Errorf("could not process zip3 [%s]: %w", zip3, err) - } - } - - foundServiceAreaData, serviceAreaFound := serviceAreasData[serviceAreaNumber] - if serviceAreaFound { - // Service area already encountered; merge new zips into data structure - zip3sSet := foundServiceAreaData.zip3s - for _, zip3 := range splitZip3s { - if _, zipFound := zip3sSet[zip3]; !zipFound { - zip3sSet[zip3] = cityState{ - city: stageArea.BasePointCity, - state: stageArea.State, - } - } - } - } else { - // Service area has not been seen yet; create entire data structure - zip3sSet := make(zip3Set) - for _, zip3 := range splitZip3s { - zip3sSet[zip3] = cityState{ - city: stageArea.BasePointCity, - state: stageArea.State, - } - } - - serviceAreasData[serviceAreaNumber] = domesticServiceAreaData{ - serviceArea: &models.ReDomesticServiceArea{ - ContractID: gre.ContractID, - ServiceArea: serviceAreaNumber, - // Fill in services schedule and SIT PD schedule later from other tab. - }, - zip3s: zip3sSet, - } - } - } - - // Now add schedule data (which comes from a different tab) to our service area structure. - err := gre.addScheduleData(appCtx, serviceAreasData) - if err != nil { - return nil, err - } - - return serviceAreasData, nil -} - -func (gre *GHCRateEngineImporter) addScheduleData(appCtx appcontext.AppContext, serviceAreasData serviceAreasSet) error { - // Now walk tab 2b and record the two schedule values. - var stageDomesticServiceAreaPrices []models.StageDomesticServiceAreaPrice - stageErr := appCtx.DB().All(&stageDomesticServiceAreaPrices) - if stageErr != nil { - return fmt.Errorf("could not read staged domestic service area prices: %w", stageErr) - } - - for _, stagePrice := range stageDomesticServiceAreaPrices { - serviceAreaNumber, err := cleanServiceAreaNumber(stagePrice.ServiceAreaNumber) - if err != nil { - return fmt.Errorf("could not process service area number [%s]: %w", stagePrice.ServiceAreaNumber, err) - } - - foundServiceAreaData, serviceAreaFound := serviceAreasData[serviceAreaNumber] - if !serviceAreaFound { - return fmt.Errorf("missing service area [%s] in list of service areas", serviceAreaNumber) - } - - servicesSchedule, err := stringToInteger(stagePrice.ServicesSchedule) - if err != nil { - return fmt.Errorf("could not process services schedule [%s]: %w", stagePrice.ServicesSchedule, err) - } - - sitSchedule, err := stringToInteger(stagePrice.SITPickupDeliverySchedule) - if err != nil { - return fmt.Errorf("could not process SIT P/D schedule [%s]: %w", stagePrice.SITPickupDeliverySchedule, err) - } - - serviceArea := foundServiceAreaData.serviceArea - serviceArea.ServicesSchedule = servicesSchedule - serviceArea.SITPDSchedule = sitSchedule - } - - return nil -} - -func (gre *GHCRateEngineImporter) saveServiceAreasAndZip3s(appCtx appcontext.AppContext, serviceAreasData serviceAreasSet) (map[string]uuid.UUID, error) { - serviceAreaToIDMap := make(map[string]uuid.UUID) - for _, serviceAreaData := range serviceAreasData { - reServiceArea := serviceAreaData.serviceArea - - // See if there is an existing service area record. If so, we may need to update it. - var existingServiceAreas models.ReDomesticServiceAreas - err := appCtx.DB(). - Where("contract_id = ?", gre.ContractID). - Where("service_area = ?", reServiceArea.ServiceArea). - All(&existingServiceAreas) - if err != nil { - return nil, fmt.Errorf("could not lookup existing service area [%s]: %w", reServiceArea.ServiceArea, err) - } - doSaveServiceArea := true - if len(existingServiceAreas) > 0 { - // Update existing service area with new data. - existingServiceArea := existingServiceAreas[0] - doSaveServiceArea = updateExistingServiceArea(&existingServiceArea, *reServiceArea) - reServiceArea = &existingServiceArea - } - - if doSaveServiceArea { - verrs, saveErr := appCtx.DB().ValidateAndSave(reServiceArea) - if verrs.HasAny() { - return nil, fmt.Errorf("validation errors when saving service area [%+v]: %w", *reServiceArea, verrs) - } - if saveErr != nil { - return nil, fmt.Errorf("could not save service area [%+v]: %w", *reServiceArea, saveErr) - } - } - serviceAreaToIDMap[reServiceArea.ServiceArea] = reServiceArea.ID - - err = gre.saveZip3sForServiceArea(appCtx, serviceAreaData.zip3s, reServiceArea.ID) - if err != nil { - return nil, err - } - } - - return serviceAreaToIDMap, nil -} - -func (gre *GHCRateEngineImporter) saveZip3sForServiceArea(appCtx appcontext.AppContext, zip3s zip3Set, serviceAreaID uuid.UUID) error { - // Save the associated zips. - for zip3, cityState := range zip3s { - reZip3 := models.ReZip3{ - ContractID: gre.ContractID, - Zip3: zip3, - BasePointCity: cityState.city, - State: cityState.state, - DomesticServiceAreaID: serviceAreaID, - } - - // See if there is an existing zip3 record. If so, we need to update it. - var existingZip3s models.ReZip3s - err := appCtx.DB(). - Where("contract_id = ?", gre.ContractID). - Where("zip3 = ?", reZip3.Zip3). - All(&existingZip3s) - if err != nil { - return fmt.Errorf("could not lookup existing zip3 [%s]: %w", reZip3.Zip3, err) - } - doSaveZip3 := true - if len(existingZip3s) > 0 { - // Update existing zip3 with new data. - existingZip3 := existingZip3s[0] - doSaveZip3 = updateExistingZip3(&existingZip3, reZip3) - reZip3 = existingZip3 - } - - if doSaveZip3 { - verrs, saveErr := appCtx.DB().ValidateAndSave(&reZip3) - if verrs.HasAny() { - return fmt.Errorf("validation errors when saving zip3 [%+v]: %w", reZip3, verrs) - } - if saveErr != nil { - return fmt.Errorf("could not save zip3 [%+v]: %w", reZip3, saveErr) - } - } - } - - return nil -} - -func updateExistingServiceArea(existing *models.ReDomesticServiceArea, new models.ReDomesticServiceArea) bool { - if existing.ServicesSchedule == new.ServicesSchedule && - existing.SITPDSchedule == new.SITPDSchedule { - return false - } - - existing.ServicesSchedule = new.ServicesSchedule - existing.SITPDSchedule = new.SITPDSchedule - return true -} - -func updateExistingZip3(existing *models.ReZip3, new models.ReZip3) bool { - if existing.BasePointCity == new.BasePointCity && - existing.State == new.State && - existing.DomesticServiceAreaID == new.DomesticServiceAreaID { - return false - } - - existing.BasePointCity = new.BasePointCity - existing.State = new.State - existing.DomesticServiceAreaID = new.DomesticServiceAreaID - return true -} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_prices.go b/pkg/services/ghcimport/import_re_domestic_service_area_prices.go deleted file mode 100644 index b806b18f86e..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_service_area_prices.go +++ /dev/null @@ -1,80 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importREDomesticServiceAreaPrices(appCtx appcontext.AppContext) error { - var stageDomPricingModels []models.StageDomesticServiceAreaPrice - - if err := appCtx.DB().All(&stageDomPricingModels); err != nil { - return fmt.Errorf("error looking up StageDomesticServiceAreaPrice data: %w", err) - } - - for _, stageDomPricingModel := range stageDomPricingModels { - isPeakPeriod, ippErr := isPeakPeriod(stageDomPricingModel.Season) - if ippErr != nil { - return ippErr - } - - serviceAreaNumber, csaErr := cleanServiceAreaNumber(stageDomPricingModel.ServiceAreaNumber) - if csaErr != nil { - return csaErr - } - - serviceAreaID, found := gre.serviceAreaToIDMap[serviceAreaNumber] - if !found { - return fmt.Errorf("could not find service area [%s] in map", serviceAreaNumber) - } - - servicesToInsert := []struct { - service models.ReServiceCode - price string - }{ - {models.ReServiceCodeDSH, stageDomPricingModel.ShorthaulPrice}, - {models.ReServiceCodeDOP, stageDomPricingModel.OriginDestinationPrice}, - {models.ReServiceCodeDDP, stageDomPricingModel.OriginDestinationPrice}, - {models.ReServiceCodeDOFSIT, stageDomPricingModel.OriginDestinationSITFirstDayWarehouse}, - {models.ReServiceCodeDDFSIT, stageDomPricingModel.OriginDestinationSITFirstDayWarehouse}, - {models.ReServiceCodeDOASIT, stageDomPricingModel.OriginDestinationSITAddlDays}, - {models.ReServiceCodeDDASIT, stageDomPricingModel.OriginDestinationSITAddlDays}, - } - - for _, serviceToInsert := range servicesToInsert { - service := serviceToInsert.service - price := serviceToInsert.price - - serviceID, found := gre.serviceToIDMap[service] - if !found { - return fmt.Errorf("missing service [%s] in map of services", service) - } - - cents, convErr := priceToCents(price) - if convErr != nil { - return fmt.Errorf("failed to parse price for service code %s: %+v error: %w", service, price, convErr) - } - - domPricingModel := models.ReDomesticServiceAreaPrice{ - ContractID: gre.ContractID, - ServiceID: serviceID, - IsPeakPeriod: isPeakPeriod, - DomesticServiceAreaID: serviceAreaID, - PriceCents: unit.Cents(cents), - } - - verrs, err := appCtx.DB().ValidateAndSave(&domPricingModel) - if verrs.HasAny() { - return fmt.Errorf("error saving ReDomesticServiceAreaPrices: %+v with validation errors: %w", domPricingModel, verrs) - } - if err != nil { - return fmt.Errorf("error saving ReDomesticServiceAreaPrices: %+v with error: %w", domPricingModel, err) - } - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go b/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go deleted file mode 100644 index 955a5ed3e63..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go +++ /dev/null @@ -1,125 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceAreaPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticServiceAreaPrices() - - // Spot check domestic service area prices for one row - suite.helperCheckDomesticServiceAreaPriceValue() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_service_area_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceAreaPricesFailures() { - suite.Run("stage_domestic_service_area_prices table missing", func() { - renameQuery := "ALTER TABLE stage_domestic_service_area_prices RENAME TO missing_stage_domestic_service_area_prices" - renameErr := suite.DB().RawQuery(renameQuery).Exec() - suite.NoError(renameErr) - - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - suite.NotNil(gre.ContractID) - - err = gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticServiceAreaPrices() { - count, err := suite.DB().Count(&models.ReDomesticServiceAreaPrice{}) - suite.NoError(err) - suite.Equal(3234, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticServiceAreaPriceValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Get domestic service area UUID. - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '592'"). - First(&serviceArea) - suite.NoError(err) - - // Get domestic service area price DSH - suite.verifyDomesticServiceAreaPrice(unit.Cents(16), contract.ID, models.ReServiceCodeDSH, serviceArea.ID) - - // Get domestic service area price DOP - suite.verifyDomesticServiceAreaPrice(unit.Cents(581), contract.ID, models.ReServiceCodeDOP, serviceArea.ID) - - // Get domestic service area price DDP - suite.verifyDomesticServiceAreaPrice(unit.Cents(581), contract.ID, models.ReServiceCodeDDP, serviceArea.ID) - - // Get domestic service area price DOFSIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(1597), contract.ID, models.ReServiceCodeDOFSIT, serviceArea.ID) - - // Get domestic service area price DDFSIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(1597), contract.ID, models.ReServiceCodeDDFSIT, serviceArea.ID) - - // Get domestic service area price DOASIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(62), contract.ID, models.ReServiceCodeDOASIT, serviceArea.ID) - - // Get domestic service area price DDASIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(62), contract.ID, models.ReServiceCodeDDASIT, serviceArea.ID) -} - -func (suite *GHCRateEngineImportSuite) verifyDomesticServiceAreaPrice(expected unit.Cents, contractID uuid.UUID, serviceCode models.ReServiceCode, serviceAreaID uuid.UUID) { - var service models.ReService - err := suite.DB().Where("code = ?", serviceCode).First(&service) - suite.NoError(err) - - var domesticServiceAreaPrice models.ReDomesticServiceAreaPrice - err = suite.DB(). - Where("contract_id = ?", contractID). - Where("service_id = ?", service.ID). - Where("domestic_service_area_id = ?", serviceAreaID). - Where("is_peak_period = false").First(&domesticServiceAreaPrice) - suite.NoError(err) - suite.Equal(expected, domesticServiceAreaPrice.PriceCents) -} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_test.go b/pkg/services/ghcimport/import_re_domestic_service_area_test.go deleted file mode 100644 index 774f96534b8..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_service_area_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package ghcimport - -import ( - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceArea() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyServiceAreaCount(testContractCode) - suite.NotNil(gre.serviceAreaToIDMap) - - // Spot check a service area - suite.helperCheckServiceAreaValue(testContractCode) - }) - - suite.Run("Run a second time with changed data, should still succeed", func() { - setupTestData() - - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Change a service area and remove/change a zip and see if they return as they were before. - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '452'"). - First(&serviceArea) - suite.NoError(err) - serviceArea.ServicesSchedule = 2 - serviceArea.SITPDSchedule = 2 - suite.MustSave(&serviceArea) - - var zip3ToDelete models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("zip3 = '647'"). - First(&zip3ToDelete) - suite.NoError(err) - suite.MustDestroy(&zip3ToDelete) - - var zip3ToUpdate models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("zip3 = '657'"). - First(&zip3ToUpdate) - suite.NoError(err) - zip3ToUpdate.BasePointCity = "New City" - zip3ToUpdate.State = "XX" - suite.MustSave(&zip3ToUpdate) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperVerifyServiceAreaCount(testContractCode) - suite.NotNil(gre.serviceAreaToIDMap) - - // Check to see if data changed above has been reverted. - suite.helperCheckServiceAreaValue(testContractCode) - }) - - suite.Run("Run with a different contract code, should add new records", func() { - setupTestData() - - gre2 := &GHCRateEngineImporter{ - ContractCode: testContractCode2, - } - - // Prerequisite tables must be loaded. - err := gre2.importREContract(suite.AppContextForTest()) - suite.NoError(err) - err = gre2.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - suite.NoError(err) - suite.helperVerifyServiceAreaCount(testContractCode2) - suite.NotNil(gre2.serviceAreaToIDMap) - - // Spot check a service area - suite.helperCheckServiceAreaValue(testContractCode2) - - // Make sure the other contract's records are still there too. - suite.helperVerifyServiceAreaCount(testContractCode) - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyServiceAreaCount(contractCode string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - // Domestic service areas count - count, err := suite.DB().Where("contract_id = ?", contract.ID).Count(&models.ReDomesticServiceArea{}) - suite.NoError(err) - suite.Equal(5, count) - - // Zip3s count - count, err = suite.DB().Where("contract_id = ?", contract.ID).Count(&models.ReZip3{}) - suite.NoError(err) - suite.Equal(19, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckServiceAreaValue(contractCode string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '452'"). - First(&serviceArea) - suite.NoError(err) - - suite.Equal(1, serviceArea.ServicesSchedule) - suite.Equal(3, serviceArea.SITPDSchedule) - - expectedZip3s := []struct { - zip3 string - city string - state string - }{ - {"647", "Butler", "MO"}, - {"648", "Neosho", "MO"}, - {"656", "Springfield", "MO"}, - {"657", "Springfield", "MO"}, - {"658", "Springfield", "MO"}, - } - - var zip3s models.ReZip3s - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("domestic_service_area_id = ?", serviceArea.ID). - All(&zip3s) - suite.NoError(err) - for _, zip3 := range zip3s { - found := false - for _, expectedZip3 := range expectedZip3s { - if zip3.Zip3 == expectedZip3.zip3 { - found = true - suite.Equal(expectedZip3.city, zip3.BasePointCity) - suite.Equal(expectedZip3.state, zip3.State) - } - } - suite.True(found, "Could not find zip3 [%s]", zip3.Zip3) - } - - suite.Len(zip3s, len(expectedZip3s), "Zip3 lengths did not match") -} diff --git a/pkg/services/ghcimport/import_re_intl_accessorial_prices.go b/pkg/services/ghcimport/import_re_intl_accessorial_prices.go deleted file mode 100644 index 6fb1a2a04d7..00000000000 --- a/pkg/services/ghcimport/import_re_intl_accessorial_prices.go +++ /dev/null @@ -1,76 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importREIntlAccessorialPrices(appCtx appcontext.AppContext) error { - //tab 5a) Access. and Add. Prices - var intlAccessorialPrices []models.StageInternationalMoveAccessorialPrice - err := appCtx.DB().All(&intlAccessorialPrices) - if err != nil { - return fmt.Errorf("could not read staged intl accessorial prices: %w", err) - } - - services := []struct { - serviceCode models.ReServiceCode - serviceProvided string - }{ - {models.ReServiceCodeICRT, "Crating (per cubic ft.)"}, - {models.ReServiceCodeIUCRT, "Uncrating (per cubic ft.)"}, - {models.ReServiceCodeIDSHUT, "Shuttle Service (per cwt)"}, - {models.ReServiceCodeIOSHUT, "Shuttle Service (per cwt)"}, - } - - //loop through the intl accessorial price data and store in db - for _, stageIntlAccessorialPrice := range intlAccessorialPrices { - var perUnitCentsService int - perUnitCentsService, err = priceToCents(stageIntlAccessorialPrice.PricePerUnit) - if err != nil { - return fmt.Errorf("could not process per unit price [%s]: %w", stageIntlAccessorialPrice.PricePerUnit, err) - } - - market, err := getMarket(stageIntlAccessorialPrice.Market) - if err != nil { - return fmt.Errorf("could not process market [%s]: %w", stageIntlAccessorialPrice.Market, err) - } - - serviceProvidedFound := false - for _, service := range services { - serviceCode := service.serviceCode - serviceProvided := service.serviceProvided - - if stageIntlAccessorialPrice.ServiceProvided == serviceProvided { - serviceProvidedFound = true - serviceID, found := gre.serviceToIDMap[serviceCode] - if !found { - return fmt.Errorf("missing service [%s] in map of services", serviceCode) - } - - intlAccessorial := models.ReIntlAccessorialPrice{ - ContractID: gre.ContractID, - Market: market, - ServiceID: serviceID, - PerUnitCents: unit.Cents(perUnitCentsService), - } - - verrs, dbErr := appCtx.DB().ValidateAndSave(&intlAccessorial) - if dbErr != nil { - return fmt.Errorf("error saving ReIntlAccessorialPrices: %+v with error: %w", intlAccessorial, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReIntlAccessorialPrices: %+v with validation errors: %w", intlAccessorial, verrs) - } - } - } - if !serviceProvidedFound { - return fmt.Errorf("service [%s] not found", stageIntlAccessorialPrice.ServiceProvided) - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go b/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go deleted file mode 100644 index e9311817530..00000000000 --- a/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREIntlAccessorialPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREIntlAccessorialPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyIntlAccessorialPrices() - suite.helperCheckIntlAccessorialPrices() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREIntlAccessorialPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_accessorial_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyIntlAccessorialPrices() { - count, err := suite.DB().Count(&models.ReIntlAccessorialPrice{}) - suite.NoError(err) - suite.Equal(8, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckIntlAccessorialPrices() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - testCases := []struct { - serviceCode models.ReServiceCode - market string - expectedPrice int - isError bool - }{ - {models.ReServiceCodeICRT, "C", 2561, false}, - {models.ReServiceCodeIUCRT, "C", 654, false}, - {models.ReServiceCodeIDSHUT, "C", 14529, false}, - {models.ReServiceCodeIDSHUT, "O", 15623, false}, - {models.ReServiceCodeIOSHUT, "O", 15623, false}, - {models.ReServiceCodeMS, "O", 0, true}, - {models.ReServiceCodeICRT, "R", 0, true}, - } - - for _, testCase := range testCases { - // Get service UUID. - var service models.ReService - err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) - suite.NoError(err) - - var intlAccessorialPrice models.ReIntlAccessorialPrice - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("service_id = $2", service.ID). - Where("market = $3", testCase.market). - First(&intlAccessorialPrice) - - if testCase.isError { - suite.Error(err) - } else { - suite.NoError(err) - suite.Equal(unit.Cents(testCase.expectedPrice), intlAccessorialPrice.PerUnitCents, "test case: %+v", testCase) - } - } -} diff --git a/pkg/services/ghcimport/import_re_intl_other_prices.go b/pkg/services/ghcimport/import_re_intl_other_prices.go deleted file mode 100644 index 6d70b935b93..00000000000 --- a/pkg/services/ghcimport/import_re_intl_other_prices.go +++ /dev/null @@ -1,84 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importREInternationalOtherPrices(appCtx appcontext.AppContext) error { - // Tab 3d: Other International Prices - var stageOtherIntlPrices []models.StageOtherIntlPrice - err := appCtx.DB().All(&stageOtherIntlPrices) - if err != nil { - return fmt.Errorf("could not read staged other international prices: %w", err) - } - - for _, stagePrice := range stageOtherIntlPrices { - isPeakPeriod, err := isPeakPeriod(stagePrice.Season) - if err != nil { - return fmt.Errorf("could not process season [%s]: %w", stagePrice.Season, err) - } - - // First look in the international rate area map; if not found, try the domestic rate - // area map. Both international and domestic are possibilities for this column. - rateAreaCode := stagePrice.RateAreaCode - rateAreaID, found := gre.internationalRateAreaToIDMap[rateAreaCode] - if !found { - rateAreaID, found = gre.domesticRateAreaToIDMap[rateAreaCode] - if !found { - return fmt.Errorf("could not find rate area [%s] in map", rateAreaCode) - } - } - - servicesToInsert := []struct { - service models.ReServiceCode - price string - }{ - {models.ReServiceCodeIHPK, stagePrice.HHGOriginPackPrice}, - {models.ReServiceCodeIHUPK, stagePrice.HHGDestinationUnPackPrice}, - {models.ReServiceCodeIUBPK, stagePrice.UBOriginPackPrice}, - {models.ReServiceCodeIUBUPK, stagePrice.UBDestinationUnPackPrice}, - {models.ReServiceCodeIOFSIT, stagePrice.OriginDestinationSITFirstDayWarehouse}, - {models.ReServiceCodeIDFSIT, stagePrice.OriginDestinationSITFirstDayWarehouse}, - {models.ReServiceCodeIOASIT, stagePrice.OriginDestinationSITAddlDays}, - {models.ReServiceCodeIDASIT, stagePrice.OriginDestinationSITAddlDays}, - {models.ReServiceCodeIOPSIT, stagePrice.SITLte50Miles}, - {models.ReServiceCodeIDDSIT, stagePrice.SITGt50Miles}, - } - - for _, serviceToInsert := range servicesToInsert { - service := serviceToInsert.service - price := serviceToInsert.price - - priceCents, err := priceToCents(price) - if err != nil { - return fmt.Errorf("could not process price [%s] for service [%s]: %w", price, service, err) - } - serviceID, found := gre.serviceToIDMap[service] - if !found { - return fmt.Errorf("missing service [%s] in map of services", service) - } - - intlOtherPrice := models.ReIntlOtherPrice{ - ContractID: gre.ContractID, - ServiceID: serviceID, - RateAreaID: rateAreaID, - IsPeakPeriod: isPeakPeriod, - PerUnitCents: unit.Cents(priceCents), - } - - verrs, err := appCtx.DB().ValidateAndSave(&intlOtherPrice) - if verrs.HasAny() { - return fmt.Errorf("validation errors when saving other international price [%+v]: %w", intlOtherPrice, verrs) - } - if err != nil { - return fmt.Errorf("could not save other international price [%+v]: %w", intlOtherPrice, err) - } - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_intl_other_prices_test.go b/pkg/services/ghcimport/import_re_intl_other_prices_test.go deleted file mode 100644 index 8dc6fd4ce47..00000000000 --- a/pkg/services/ghcimport/import_re_intl_other_prices_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREInternationalOtherPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREInternationalOtherPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyInternationalOtherPrices() - - // Spot check a staging row's prices - suite.helperCheckInternationalOtherPriceRecords() - }) - - suite.Run("run twice; should immediately fail the second time due to constraint violation", func() { - setupTestData() - err := gre.importREInternationalOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_other_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyInternationalOtherPrices() { - count, err := suite.DB().Count(&models.ReIntlOtherPrice{}) - suite.NoError(err) - suite.Equal(2580, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckInternationalOtherPriceRecords() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Get rate area UUID. - var rateArea *models.ReRateArea - rateArea, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") - suite.NoError(err) - - // Get service UUID. - testServices := []struct { - service models.ReServiceCode - expectedPrice int - }{ - {models.ReServiceCodeIHPK, 8186}, - {models.ReServiceCodeIHUPK, 915}, - {models.ReServiceCodeIUBPK, 8482}, - {models.ReServiceCodeIUBUPK, 847}, - {models.ReServiceCodeIOFSIT, 507}, - {models.ReServiceCodeIDFSIT, 507}, - {models.ReServiceCodeIOASIT, 14}, - {models.ReServiceCodeIDASIT, 14}, - {models.ReServiceCodeIOPSIT, 17001}, - {models.ReServiceCodeIDDSIT, 30186}, - } - - for _, test := range testServices { - suite.helperCheckOneOtherInternationalPriceRecord(test.expectedPrice, contract.ID, test.service, rateArea.ID) - } -} - -func (suite *GHCRateEngineImportSuite) helperCheckOneOtherInternationalPriceRecord(expected int, contractID uuid.UUID, serviceCode models.ReServiceCode, rateAreaID uuid.UUID) { - var service models.ReService - err := suite.DB().Where("code = ?", serviceCode).First(&service) - suite.NoError(err) - - var intlOtherPrice models.ReIntlOtherPrice - err = suite.DB(). - Where("contract_id = ?", contractID). - Where("service_id = ?", service.ID). - Where("is_peak_period = true"). - Where("rate_area_id = ?", rateAreaID). - First(&intlOtherPrice) - suite.NoError(err) - suite.Equal(unit.Cents(expected), intlOtherPrice.PerUnitCents) -} diff --git a/pkg/services/ghcimport/import_re_intl_prices.go b/pkg/services/ghcimport/import_re_intl_prices.go deleted file mode 100644 index 0baff7602ca..00000000000 --- a/pkg/services/ghcimport/import_re_intl_prices.go +++ /dev/null @@ -1,388 +0,0 @@ -package ghcimport - -import ( - "fmt" - "strings" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importREInternationalPrices(appCtx appcontext.AppContext) error { - if err := gre.importOconusToOconusPrices(appCtx); err != nil { - return fmt.Errorf("could not import OCONUS to OCONUS prices: %w", err) - } - - if err := gre.importConusToOconusPrices(appCtx); err != nil { - return fmt.Errorf("could not import CONUS to OCONUS prices: %w", err) - } - - if err := gre.importOconusToConusPrices(appCtx); err != nil { - return fmt.Errorf("could not import OCONUS to CONUS prices: %w", err) - } - - if err := gre.importNonStandardLocationPrices(appCtx); err != nil { - return fmt.Errorf("could not import non-standard location prices: %w", err) - } - return nil -} - -func (gre *GHCRateEngineImporter) importOconusToOconusPrices(appCtx appcontext.AppContext) error { - // tab 3a) OCONUS to OCONUS data - var oconusToOconusPrices []models.StageOconusToOconusPrice - err := appCtx.DB().All(&oconusToOconusPrices) - if err != nil { - return fmt.Errorf("could not read staged OCONUS to OCONUS prices: %w", err) - } - - // Int'l O->O Shipping & LH - serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) - } - - // Int'l O->O UB - serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) - } - - // loop through the OCONUS to OCONUS data and store in db - for _, stageOconusToOconusPrice := range oconusToOconusPrices { - var intlPricingModels models.ReIntlPrices - peakPeriod, err := isPeakPeriod(stageOconusToOconusPrice.Season) - if err != nil { - return fmt.Errorf("could not process season [%s]: %w", stageOconusToOconusPrice.Season, err) - } - - originRateAreaID, found := gre.internationalRateAreaToIDMap[stageOconusToOconusPrice.OriginIntlPriceAreaID] - if !found { - return fmt.Errorf("could not find origin rate area [%s] in map", stageOconusToOconusPrice.OriginIntlPriceAreaID) - } - - destinationRateAreaID, found := gre.internationalRateAreaToIDMap[stageOconusToOconusPrice.DestinationIntlPriceAreaID] - if !found { - return fmt.Errorf("could not find destination rate area [%s] in map", stageOconusToOconusPrice.DestinationIntlPriceAreaID) - } - - perUnitCentsHHG, err := priceToCents(stageOconusToOconusPrice.HHGShippingLinehaulPrice) - if err != nil { - return fmt.Errorf("could not process linehaul price [%s]: %w", stageOconusToOconusPrice.HHGShippingLinehaulPrice, err) - } - - perUnitCentsUB, err := priceToCents(stageOconusToOconusPrice.UBPrice) - if err != nil { - return fmt.Errorf("could not process UB price [%s]: %w", stageOconusToOconusPrice.UBPrice, err) - } - - intlPricingModelISLH := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceISLH, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: peakPeriod, - PerUnitCents: unit.Cents(perUnitCentsHHG), - } - intlPricingModels = append(intlPricingModels, intlPricingModelISLH) - - intlPricingModelUBP := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceUBP, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: peakPeriod, - PerUnitCents: unit.Cents(perUnitCentsUB), - } - intlPricingModels = append(intlPricingModels, intlPricingModelUBP) - - for _, model := range intlPricingModels { - copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. - verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) - if dbErr != nil { - return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) - } - } - } - - return nil -} - -func (gre *GHCRateEngineImporter) importConusToOconusPrices(appCtx appcontext.AppContext) error { - // tab 3b CONUS to OCONUS data - var conusToOconusPrices []models.StageConusToOconusPrice - err := appCtx.DB().All(&conusToOconusPrices) - if err != nil { - return fmt.Errorf("could not read staged CONUS to OCONUS prices: %w", err) - } - - // Int'l C->O Shipping & LH - serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) - } - - // Int'l C->O UB - serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) - } - - // loop through the CONUS to OCONUS data and store in db - for _, stageConusToOconusPrice := range conusToOconusPrices { - var intlPricingModels models.ReIntlPrices - - peakPeriod, err := isPeakPeriod(stageConusToOconusPrice.Season) - if err != nil { - return fmt.Errorf("could not process season [%s]: %w", stageConusToOconusPrice.Season, err) - } - - originRateAreaID, found := gre.domesticRateAreaToIDMap[stageConusToOconusPrice.OriginDomesticPriceAreaCode] - if !found { - return fmt.Errorf("could not find domestic rate area [%s] in map", stageConusToOconusPrice.OriginDomesticPriceAreaCode) - } - - destinationRateAreaID, found := gre.internationalRateAreaToIDMap[stageConusToOconusPrice.DestinationIntlPriceAreaID] - if !found { - return fmt.Errorf("could not find international rate area [%s] in map", stageConusToOconusPrice.DestinationIntlPriceAreaID) - } - - perUnitCentsHHG, err := priceToCents(stageConusToOconusPrice.HHGShippingLinehaulPrice) - if err != nil { - return fmt.Errorf("could not process linehaul price [%s]: %w", stageConusToOconusPrice.HHGShippingLinehaulPrice, err) - } - - perUnitCentsUB, err := priceToCents(stageConusToOconusPrice.UBPrice) - if err != nil { - return fmt.Errorf("could not process UB price [%s]: %w", stageConusToOconusPrice.UBPrice, err) - } - - intlPricingModelISLH := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceISLH, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: peakPeriod, - PerUnitCents: unit.Cents(perUnitCentsHHG), - } - intlPricingModels = append(intlPricingModels, intlPricingModelISLH) - - intlPricingModelUBP := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceUBP, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: peakPeriod, - PerUnitCents: unit.Cents(perUnitCentsUB), - } - intlPricingModels = append(intlPricingModels, intlPricingModelUBP) - - for _, model := range intlPricingModels { - copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. - verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) - if dbErr != nil { - return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) - } - } - } - - return nil -} - -func (gre *GHCRateEngineImporter) importOconusToConusPrices(appCtx appcontext.AppContext) error { - // tab 3c OCONUS to CONUS data - var oconusToConusPrices []models.StageOconusToConusPrice - err := appCtx.DB().All(&oconusToConusPrices) - if err != nil { - return fmt.Errorf("could not read staged OCONUS to CONUS prices: %w", err) - } - - // Int'l O->C Shipping & LH - serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) - } - - // Int'l O->C UB - serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) - } - - // loop through the OCONUS to CONUS data and store in db - for _, stageOconusToConusPrice := range oconusToConusPrices { - var intlPricingModels models.ReIntlPrices - - isPeakPeriod, err := isPeakPeriod(stageOconusToConusPrice.Season) - if err != nil { - return fmt.Errorf("could not process season [%s]: %w", stageOconusToConusPrice.Season, err) - } - - originRateAreaID, found := gre.internationalRateAreaToIDMap[stageOconusToConusPrice.OriginIntlPriceAreaID] - if !found { - return fmt.Errorf("could not find international rate area [%s] in map", stageOconusToConusPrice.OriginIntlPriceAreaID) - } - - destinationRateAreaID, found := gre.domesticRateAreaToIDMap[stageOconusToConusPrice.DestinationDomesticPriceAreaCode] - if !found { - return fmt.Errorf("could not find domestic rate area [%s] in map", stageOconusToConusPrice.DestinationDomesticPriceAreaCode) - } - - perUnitCentsHHG, err := priceToCents(stageOconusToConusPrice.HHGShippingLinehaulPrice) - if err != nil { - return fmt.Errorf("could not process linehaul price [%s]: %w", stageOconusToConusPrice.HHGShippingLinehaulPrice, err) - } - - perUnitCentsUB, err := priceToCents(stageOconusToConusPrice.UBPrice) - if err != nil { - return fmt.Errorf("could not process UB price [%s]: %w", stageOconusToConusPrice.UBPrice, err) - } - - intlPricingModelISLH := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceISLH, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: isPeakPeriod, - PerUnitCents: unit.Cents(perUnitCentsHHG), - } - intlPricingModels = append(intlPricingModels, intlPricingModelISLH) - - intlPricingModelUBP := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceUBP, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: isPeakPeriod, - PerUnitCents: unit.Cents(perUnitCentsUB), - } - intlPricingModels = append(intlPricingModels, intlPricingModelUBP) - - for _, model := range intlPricingModels { - copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. - verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) - if dbErr != nil { - return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) - } - } - } - - return nil -} - -func (gre *GHCRateEngineImporter) importNonStandardLocationPrices(appCtx appcontext.AppContext) error { - // tab 3e) Non-standard location prices - var nonStandardLocnPrices []models.StageNonStandardLocnPrice - err := appCtx.DB().All(&nonStandardLocnPrices) - if err != nil { - return fmt.Errorf("could not read staged non-standard location prices: %w", err) - } - - // Int'l non-standard HHG - serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) - } - - // Int'l non-standard UB - serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) - } - - // loop through the non-standard location data and store in db - for _, stageNonStandardLocnPrice := range nonStandardLocnPrices { - var intlPricingModels models.ReIntlPrices - - peakPeriod, err := isPeakPeriod(stageNonStandardLocnPrice.Season) - if err != nil { - return fmt.Errorf("could not process season [%s]: %w", stageNonStandardLocnPrice.Season, err) - } - - moveToAndFromKind := strings.Split(stageNonStandardLocnPrice.MoveType, " to ") - if len(moveToAndFromKind) != 2 { - return fmt.Errorf("could not parse move type [%s]", stageNonStandardLocnPrice.MoveType) - } - - originRateAreaID, err := gre.getRateAreaIDForKind(stageNonStandardLocnPrice.OriginID, moveToAndFromKind[0]) - if err != nil { - return err - } - - destinationRateAreaID, err := gre.getRateAreaIDForKind(stageNonStandardLocnPrice.DestinationID, moveToAndFromKind[1]) - if err != nil { - return err - } - - perUnitCentsHHG, err := priceToCents(stageNonStandardLocnPrice.HHGPrice) - if err != nil { - return fmt.Errorf("could not process linehaul price [%s]: %w", stageNonStandardLocnPrice.HHGPrice, err) - } - - perUnitCentsUB, err := priceToCents(stageNonStandardLocnPrice.UBPrice) - if err != nil { - return fmt.Errorf("could not process UB price [%s]: %w", stageNonStandardLocnPrice.UBPrice, err) - } - - intlPricingModelISLH := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceISLH, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: peakPeriod, - PerUnitCents: unit.Cents(perUnitCentsHHG), - } - intlPricingModels = append(intlPricingModels, intlPricingModelISLH) - - intlPricingModelUBP := models.ReIntlPrice{ - ContractID: gre.ContractID, - ServiceID: serviceUBP, - OriginRateAreaID: originRateAreaID, - DestinationRateAreaID: destinationRateAreaID, - IsPeakPeriod: peakPeriod, - PerUnitCents: unit.Cents(perUnitCentsUB), - } - intlPricingModels = append(intlPricingModels, intlPricingModelUBP) - - for _, model := range intlPricingModels { - copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. - verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) - if dbErr != nil { - return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) - } - } - } - return nil -} -func (gre *GHCRateEngineImporter) getRateAreaIDForKind(rateArea string, kind string) (uuid.UUID, error) { - switch kind { - case "NSRA", "OCONUS": - intlRateAreaID, found := gre.internationalRateAreaToIDMap[rateArea] - if !found { - return uuid.Nil, fmt.Errorf("could not find rate area [%s] in international rate area map", rateArea) - } - return intlRateAreaID, nil - case "CONUS": - domesticRateAreaID, found := gre.domesticRateAreaToIDMap[rateArea] - if !found { - return uuid.Nil, fmt.Errorf("could not find rate area [%s] in domestic rate area map", rateArea) - } - return domesticRateAreaID, nil - } - - return uuid.Nil, fmt.Errorf("unexpected rate area kind [%s]", kind) -} diff --git a/pkg/services/ghcimport/import_re_intl_prices_test.go b/pkg/services/ghcimport/import_re_intl_prices_test.go deleted file mode 100644 index ae159e3197d..00000000000 --- a/pkg/services/ghcimport/import_re_intl_prices_test.go +++ /dev/null @@ -1,188 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREInternationalPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREInternationalPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyInternationalPrices() - - // Spot check prices - suite.helperCheckInternationalPriceValues() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREInternationalPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_prices_unique_key")) - } - }) -} -func (suite *GHCRateEngineImportSuite) Test_getRateAreaIDForKind() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - } - // Doing this here instead of a separate test function so we don't have to reload prerequisite tables - suite.Run("tests for getRateAreaIDForKind", func() { - setupTestData() - testCases := []struct { - name string - rateArea string - kind string - shouldError bool - }{ - {"good NSRA", "NSRA2", "NSRA", false}, - {"good OCONUS", "US8101000", "OCONUS", false}, - {"good CONUS", "US47", "CONUS", false}, - {"bad NSRA", "XYZ", "NSRA", true}, - {"bad OCONUS", "US47", "OCONUS", true}, - {"bad CONUS", "NSRA13", "CONUS", true}, - {"bad kind", "NSRA2", "NNNN", true}, - } - - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - for _, testCase := range testCases { - suite.Run(testCase.name, func() { - id, err := gre.getRateAreaIDForKind(testCase.rateArea, testCase.kind) - if testCase.shouldError { - suite.Error(err) - suite.Equal(uuid.Nil, id) - } else { - suite.NoError(err) - - // Fetch the UUID from the database and see if it matches - origin, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.rateArea) - suite.NoError(err) - suite.Equal(origin.ID, id) - } - }) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyInternationalPrices() { - count, err := suite.DB().Count(&models.ReIntlPrice{}) - suite.NoError(err) - suite.Equal(46640, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckInternationalPriceValues() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Spot check one non-peak/peak record of each type - testCases := []struct { - serviceCode models.ReServiceCode - originRateArea string - destinationRateArea string - isPeakPeriod bool - expectedPrice int - }{ - // 3a: OCONUS to OCONUS - {models.ReServiceCodeISLH, "GE", "US8101000", false, 1021}, - {models.ReServiceCodeUBP, "GE", "US8101000", false, 1717}, - {models.ReServiceCodeISLH, "GE", "US8101000", true, 1205}, - {models.ReServiceCodeUBP, "GE", "US8101000", true, 2026}, - // 3b: CONUS to OCONUS - {models.ReServiceCodeISLH, "US47", "AS11", false, 3090}, - {models.ReServiceCodeUBP, "US47", "AS11", false, 3398}, - {models.ReServiceCodeISLH, "US47", "AS11", true, 3646}, - {models.ReServiceCodeUBP, "US47", "AS11", true, 4010}, - // 3c: OCONUS to CONUS - {models.ReServiceCodeISLH, "US8101000", "US68", false, 1757}, - {models.ReServiceCodeUBP, "US8101000", "US68", false, 3445}, - {models.ReServiceCodeISLH, "US8101000", "US68", true, 2073}, - {models.ReServiceCodeUBP, "US8101000", "US68", true, 4065}, - // 3e: NSRA to NSRA - {models.ReServiceCodeISLH, "NSRA2", "NSRA13", false, 4849}, - {models.ReServiceCodeUBP, "NSRA2", "NSRA13", false, 4793}, - {models.ReServiceCodeISLH, "NSRA2", "NSRA13", true, 5722}, - {models.ReServiceCodeUBP, "NSRA2", "NSRA13", true, 5656}, - // 3e: NSRA to OCONUS - {models.ReServiceCodeISLH, "NSRA13", "AS11", false, 5172}, - {models.ReServiceCodeUBP, "NSRA13", "AS11", false, 1175}, - {models.ReServiceCodeISLH, "NSRA13", "AS11", true, 6103}, - {models.ReServiceCodeUBP, "NSRA13", "AS11", true, 1386}, - // 3e: OCONUS to NSRA - {models.ReServiceCodeISLH, "GE", "NSRA2", false, 4872}, - {models.ReServiceCodeUBP, "GE", "NSRA2", false, 1050}, - {models.ReServiceCodeISLH, "GE", "NSRA2", true, 5749}, - {models.ReServiceCodeUBP, "GE", "NSRA2", true, 1239}, - // 3e: NSRA to CONUS - {models.ReServiceCodeISLH, "NSRA2", "US4965500", false, 931}, - {models.ReServiceCodeUBP, "NSRA2", "US4965500", false, 1717}, - {models.ReServiceCodeISLH, "NSRA2", "US4965500", true, 1099}, - {models.ReServiceCodeUBP, "NSRA2", "US4965500", true, 2026}, - // 3e: CONUS to NSRA - {models.ReServiceCodeISLH, "US68", "NSRA13", false, 1065}, - {models.ReServiceCodeUBP, "US68", "NSRA13", false, 1689}, - {models.ReServiceCodeISLH, "US68", "NSRA13", true, 1257}, - {models.ReServiceCodeUBP, "US68", "NSRA13", true, 1993}, - } - - for _, testCase := range testCases { - var service models.ReService - err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) - suite.NoError(err) - - // Get origin rate area UUID. - origin, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.originRateArea) - suite.NoError(err) - - // Get destination rate area UUID. - destination, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.destinationRateArea) - suite.NoError(err) - - var intlPrice models.ReIntlPrice - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_id = ?", service.ID). - Where("origin_rate_area_id = ?", origin.ID). - Where("destination_rate_area_id = ?", destination.ID). - Where("is_peak_period = ?", testCase.isPeakPeriod). - First(&intlPrice) - suite.NoError(err) - suite.Equal(unit.Cents(testCase.expectedPrice), intlPrice.PerUnitCents, "test case: %+v", testCase) - } -} diff --git a/pkg/services/ghcimport/import_re_rate_area.go b/pkg/services/ghcimport/import_re_rate_area.go deleted file mode 100644 index f613f02c61c..00000000000 --- a/pkg/services/ghcimport/import_re_rate_area.go +++ /dev/null @@ -1,261 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/gobuffalo/validate/v3" - "github.com/gofrs/uuid" - "github.com/pkg/errors" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -func (gre *GHCRateEngineImporter) importRERateArea(appCtx appcontext.AppContext) error { - var err error - //maps the domestic rate areas to a UUID - gre.domesticRateAreaToIDMap, err = gre.importDomesticRateAreas(appCtx) - if err != nil { - return fmt.Errorf("importRERateArea failed to import: %w", err) - } - //maps the international rate areas to a UUID - gre.internationalRateAreaToIDMap, err = gre.importInternationalRateAreas(appCtx) - if err != nil { - return fmt.Errorf("importRERateArea failed to import: %w", err) - } - return nil -} - -func (gre *GHCRateEngineImporter) importDomesticRateAreas(appCtx appcontext.AppContext) (map[string]uuid.UUID, error) { - rateAreaToIDMap := make(map[string]uuid.UUID) - - // have to read international tables to get the domestic rate areas - - // models.StageConusToOconusPrice - var conusToOconus []models.StageConusToOconusPrice - err := appCtx.DB().All(&conusToOconus) - - if err != nil { - return nil, fmt.Errorf("failed to query all StageConusToOconusPrice: %w", err) - } - for _, ra := range conusToOconus { - if _, found := rateAreaToIDMap[ra.OriginDomesticPriceAreaCode]; !found { - // does the rate area already exist in the rate engine - var rateArea *models.ReRateArea - rateArea, err = models.FetchReRateAreaItem(appCtx.DB(), gre.ContractID, ra.OriginDomesticPriceAreaCode) - if err != nil { - if err.Error() != models.RecordNotFoundErrorString { - return nil, fmt.Errorf("failed importing re_rate_area from StageConusToOconusPrice with code: <%s> error: %w", ra.OriginDomesticPriceAreaCode, err) - } - } - - // if it does exist, compare and update information if different - if rateArea != nil { - update := false - - if rateArea.Name != ra.OriginDomesticPriceArea { - rateArea.Name = ra.OriginDomesticPriceArea - update = true - } - - // these are domestic rates - if rateArea.IsOconus { - rateArea.IsOconus = false - update = true - } - - if update { - var verrs *validate.Errors - verrs, err = appCtx.DB().ValidateAndSave(rateArea) - if err != nil || verrs.HasAny() { - var dbError string - if err != nil { - dbError = err.Error() - } - if verrs.HasAny() { - dbError = dbError + verrs.Error() - } - return nil, fmt.Errorf("error saving ReRateArea from StageConusToOconusPrice with rate are ID: %s error: %w", ra.OriginDomesticPriceAreaCode, errors.New(dbError)) - } - } - // add to map - rateAreaToIDMap[ra.OriginDomesticPriceAreaCode] = rateArea.ID - - // if it does not exist, insert into ReRateArea - } else if rateArea == nil { - // insert into re_rate_area - newRateArea := models.ReRateArea{ - ContractID: gre.ContractID, - IsOconus: false, - Code: ra.OriginDomesticPriceAreaCode, - Name: ra.OriginDomesticPriceArea, - } - var verrs *validate.Errors - verrs, err = appCtx.DB().ValidateAndCreate(&newRateArea) - if err != nil || verrs.HasAny() { - var dbError string - if err != nil { - dbError = err.Error() - } - if verrs.HasAny() { - dbError = dbError + verrs.Error() - } - return nil, fmt.Errorf("error creating ReRateArea from StageConusToOconusPrice with rate are ID: %s error: %w", ra.OriginDomesticPriceAreaCode, errors.New(dbError)) - } - // add to map - rateAreaToIDMap[ra.OriginDomesticPriceAreaCode] = newRateArea.ID - } - } - } - - // models.StageOconusToConusPrice - var oconusToConus []models.StageOconusToConusPrice - err = appCtx.DB().All(&oconusToConus) - if err != nil { - return nil, fmt.Errorf("failed to query all StageOconusToConusPrice error: %w", err) - } - for _, ra := range oconusToConus { - if _, found := rateAreaToIDMap[ra.DestinationDomesticPriceAreaCode]; !found { - // does the rate area already exist in the rate engine - rateArea, err := models.FetchReRateAreaItem(appCtx.DB(), gre.ContractID, ra.DestinationDomesticPriceAreaCode) - if err != nil { - if err.Error() != models.RecordNotFoundErrorString { - return nil, fmt.Errorf("failed importing re_rate_area from StageOconusToConusPrice with code <%s> error: %w", ra.DestinationDomesticPriceAreaCode, err) - } - } - - // if it does exist, compare and update information if different - if rateArea != nil { - update := false - - if rateArea.Name != ra.DestinationDomesticPriceArea { - rateArea.Name = ra.DestinationDomesticPriceArea - update = true - } - - // these are domestic rates - if rateArea.IsOconus { - rateArea.IsOconus = false - update = true - } - - if update { - verrs, err := appCtx.DB().ValidateAndSave(rateArea) - if err != nil || verrs.HasAny() { - var dbError string - if err != nil { - dbError = err.Error() - } - if verrs.HasAny() { - dbError = dbError + verrs.Error() - } - return nil, fmt.Errorf("error saving ReRateArea from StageOconusToConusPrice with rate are ID: %s error: %w", ra.DestinationDomesticPriceAreaCode, errors.New(dbError)) - } - } - - // add to map - rateAreaToIDMap[ra.DestinationDomesticPriceAreaCode] = rateArea.ID - - // if it does not exist, insert into ReRateArea - } else if rateArea == nil { - // insert into re_rate_area - newRateArea := models.ReRateArea{ - ContractID: gre.ContractID, - IsOconus: false, - Code: ra.DestinationDomesticPriceAreaCode, - Name: ra.DestinationDomesticPriceArea, - } - verrs, err := appCtx.DB().ValidateAndCreate(&newRateArea) - if err != nil || verrs.HasAny() { - var dbError string - if err != nil { - dbError = err.Error() - } - if verrs.HasAny() { - dbError = dbError + verrs.Error() - } - return nil, fmt.Errorf("error creating ReRateArea from StageOconusToConusPrice with rate are ID: %s error: %w", ra.DestinationDomesticPriceAreaCode, errors.New(dbError)) - } - // add to map - rateAreaToIDMap[ra.DestinationDomesticPriceAreaCode] = newRateArea.ID - } - } - } - - return rateAreaToIDMap, nil -} - -func (gre *GHCRateEngineImporter) importInternationalRateAreas(appCtx appcontext.AppContext) (map[string]uuid.UUID, error) { - var serviceAreas []models.StageInternationalServiceArea - - err := appCtx.DB().All(&serviceAreas) - if err != nil { - return nil, fmt.Errorf("failed to query all StageInternationalServiceArea: %w", err) - } - - rateAreaToIDMap := make(map[string]uuid.UUID) - for _, sa := range serviceAreas { - if _, found := rateAreaToIDMap[sa.RateAreaID]; !found { - // query for ReRateArea - rateArea, err := models.FetchReRateAreaItem(appCtx.DB(), gre.ContractID, sa.RateAreaID) - if err != nil { - if err.Error() != models.RecordNotFoundErrorString { - return nil, fmt.Errorf("failed importing re_rate_area from StageInternationalServiceArea with code <%s> error: %w", sa.RateAreaID, err) - } - } - // if it does exist, compare and update information if different - if rateArea != nil { - update := false - - if !rateArea.IsOconus { - rateArea.IsOconus = true - update = true - } - if rateArea.Name != sa.RateArea { - rateArea.Name = sa.RateArea - update = true - } - if update { - verrs, err := appCtx.DB().ValidateAndSave(rateArea) - if err != nil || verrs.HasAny() { - var dbError string - if err != nil { - dbError = err.Error() - } - if verrs.HasAny() { - dbError = dbError + verrs.Error() - } - return nil, fmt.Errorf("error saving ReRateArea from StageInternationalServiceArea with rate are ID: %s error: %w", sa.RateAreaID, errors.New(dbError)) - } - } - // add to map - rateAreaToIDMap[sa.RateAreaID] = rateArea.ID - - // if it does not exist, insert into ReRateArea - } else if rateArea == nil { - // insert into re_rate_area - newRateArea := models.ReRateArea{ - ContractID: gre.ContractID, - IsOconus: true, - Code: sa.RateAreaID, - Name: sa.RateArea, - } - verrs, err := appCtx.DB().ValidateAndCreate(&newRateArea) - if err != nil || verrs.HasAny() { - var dbError string - if err != nil { - dbError = err.Error() - } - if verrs.HasAny() { - dbError = dbError + verrs.Error() - } - return nil, fmt.Errorf("error creating ReRateArea from StageInternationalServiceArea with rate are ID: %s error: %w", sa.RateAreaID, errors.New(dbError)) - } - // add to map - rateAreaToIDMap[sa.RateAreaID] = newRateArea.ID - } - } - } - - return rateAreaToIDMap, nil -} diff --git a/pkg/services/ghcimport/import_re_rate_area_test.go b/pkg/services/ghcimport/import_re_rate_area_test.go deleted file mode 100644 index 37e047349fe..00000000000 --- a/pkg/services/ghcimport/import_re_rate_area_test.go +++ /dev/null @@ -1,223 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) helperImportRERateArea(action string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Update domestic US6B name "Texas-South" to something else and verify it was changed back when done - var texas *models.ReRateArea - texas, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") - suite.NoError(err) - suite.Equal(true, suite.NotNil(texas)) - suite.Equal("Texas-South", texas.Name) - - // Update oconus US8101000 name "Alaska (Zone) I" to something else and verify it was changed back when done - var alaska *models.ReRateArea - alaska, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US8101000") - suite.NoError(err) - suite.Equal(true, suite.NotNil(alaska)) - suite.Equal("Alaska (Zone) I", alaska.Name) - - // Update oconus AS11 name "New South Wales/Australian Capital Territory" - var wales *models.ReRateArea - wales, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "AS11") - suite.NoError(err) - suite.Equal(true, suite.NotNil(wales)) - suite.Equal("New South Wales/Australian Capital Territory", wales.Name) - - if action == "setup" { - modifiedName := "New name" - texas.Name = modifiedName - suite.MustSave(texas) - texas, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") - suite.NoError(err) - suite.Equal(modifiedName, texas.Name) - - modifiedName = "New name 2" - alaska.Name = modifiedName - suite.MustSave(alaska) - alaska, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US8101000") - suite.NoError(err) - suite.Equal(modifiedName, alaska.Name) - - modifiedName = "New name 3" - wales.Name = modifiedName - suite.MustSave(wales) - wales, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "AS11") - suite.NoError(err) - suite.Equal(modifiedName, wales.Name) - } -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticRateAreaToIDMap(contractCode string, domesticRateAreaToIDMap map[string]uuid.UUID) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - suite.NotEqual(map[string]uuid.UUID(nil), domesticRateAreaToIDMap) - count, dbErr := suite.DB(). - Where("contract_id = ?", contract.ID). - Where("is_oconus = 'false'"). - Count(models.ReRateArea{}) - suite.NoError(dbErr) - - suite.Equal(12, count) - suite.Equal(count, len(domesticRateAreaToIDMap)) - - var rateArea models.ReRateArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'US68'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Texas-South", rateArea.Name) - suite.Equal(rateArea.ID, domesticRateAreaToIDMap["US68"]) - - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'US47'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Alabama", rateArea.Name) - suite.Equal(rateArea.ID, domesticRateAreaToIDMap["US47"]) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyInternationalRateAreaToIDMap(contractCode string, internationalRateAreaToIDMap map[string]uuid.UUID) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - suite.NotEqual(map[string]uuid.UUID(nil), internationalRateAreaToIDMap) - count, dbErr := suite.DB(). - Where("contract_id = ?", contract.ID). - Where("is_oconus = 'true'"). - Count(models.ReRateArea{}) - suite.NoError(dbErr) - - suite.Equal(5, count) - suite.Equal(count, len(internationalRateAreaToIDMap)) - - var rateArea models.ReRateArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'GE'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Germany", rateArea.Name) - suite.Equal(rateArea.ID, internationalRateAreaToIDMap["GE"]) - - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'US8101000'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Alaska (Zone) I", rateArea.Name) - suite.Equal(rateArea.ID, internationalRateAreaToIDMap["US8101000"]) -} - -func (suite *GHCRateEngineImportSuite) helperImportRERateAreaVerifyImportComplete(contractCode string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - var rateArea models.ReRateArea - count, countErr := suite.DB().Where("contract_id = ?", contract.ID).Count(&rateArea) - - suite.NoError(countErr) - suite.Equal(17, count) -} - -func (suite *GHCRateEngineImportSuite) TestGHCRateEngineImporter_importRERateArea() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - //Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("Successfully run import with staged staging data (empty RE tables)", func() { - setupTestData() - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) - }) - - suite.Run("Successfully run import, 2nd time, with staged staging data and filled in RE tables", func() { - setupTestData() - - err := gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) - }) - - suite.Run("Successfully run import, prefilled re_rate_areas, update existing rate area from import", func() { - setupTestData() - suite.helperImportRERateArea("setup") - - err := gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) - suite.helperImportRERateArea("verify") - }) - - suite.Run("Fail to run import, missing staging table", func() { - renameQuery := "ALTER TABLE stage_conus_to_oconus_prices RENAME TO missing_stage_conus_to_oconus_prices" - renameErr := suite.DB().RawQuery(renameQuery).Exec() - suite.NoError(renameErr) - - err := gre.importRERateArea(suite.AppContextForTest()) - suite.Error(err) - }) - - suite.Run("Run with 2 different contract codes, should add new records both times", func() { - setupTestData() - err := gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - - gre2 := &GHCRateEngineImporter{ - ContractCode: testContractCode2, - } - - // Prerequisite tables must be loaded. - err = gre2.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre2.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperImportRERateAreaVerifyImportComplete(testContractCode2) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode2, gre2.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode2, gre2.internationalRateAreaToIDMap) - - // Make sure the other contract's records are still there too. - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - }) -} diff --git a/pkg/services/ghcimport/import_re_shipment_type_prices.go b/pkg/services/ghcimport/import_re_shipment_type_prices.go deleted file mode 100644 index eb7d6c79894..00000000000 --- a/pkg/services/ghcimport/import_re_shipment_type_prices.go +++ /dev/null @@ -1,74 +0,0 @@ -package ghcimport - -import ( - "fmt" - "strconv" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -func (gre *GHCRateEngineImporter) importREShipmentTypePrices(appCtx appcontext.AppContext) error { - //tab 5a) Access. and Add. Prices - var domesticIntlAddlPrices []models.StageDomesticInternationalAdditionalPrice - err := appCtx.DB().All(&domesticIntlAddlPrices) - if err != nil { - return fmt.Errorf("could not read staged domestic international additional prices: %w", err) - } - - var serviceToCodeMap = map[string]models.ReServiceCode{ - //concatenating market with shipment type so that keys in map are unique - "CONUS:Mobile Homes": models.ReServiceCodeDMHF, - "CONUS:Tow Away Boat Service": models.ReServiceCodeDBTF, - "OCONUS:Tow Away Boat Service": models.ReServiceCodeIBTF, - "CONUS:Haul Away Boat Service": models.ReServiceCodeDBHF, - "OCONUS:Haul Away Boat Service": models.ReServiceCodeIBHF, - "CONUS:NTS Packing Factor": models.ReServiceCodeDNPK, - "OCONUS:NTS Packing Factor": models.ReServiceCodeINPK, - } - - //loop through the domestic international additional prices data and store in db - for _, stageDomesticIntlAddlPrices := range domesticIntlAddlPrices { - //shipment codes stored in the re_services table - factor, err := strconv.ParseFloat(stageDomesticIntlAddlPrices.Factor, 64) - if err != nil { - return fmt.Errorf("could not process factor [%s]: %w", stageDomesticIntlAddlPrices.Factor, err) - } - - market, err := getMarket(stageDomesticIntlAddlPrices.Market) - if err != nil { - return fmt.Errorf("could not process market [%s]: %w", stageDomesticIntlAddlPrices.Market, err) - } - - shipmentTypeFound := false - for shipmentType, serviceCode := range serviceToCodeMap { - if shipmentType == stageDomesticIntlAddlPrices.Market+":"+stageDomesticIntlAddlPrices.ShipmentType { - shipmentTypeFound = true - serviceID, found := gre.serviceToIDMap[serviceCode] - if !found { - return fmt.Errorf("missing service [%s] in map of services", serviceCode) - } - - shipmentTypePrice := models.ReShipmentTypePrice{ - ContractID: gre.ContractID, - Market: market, - ServiceID: serviceID, - Factor: factor, - } - - verrs, dbErr := appCtx.DB().ValidateAndSave(&shipmentTypePrice) - if dbErr != nil { - return fmt.Errorf("error saving ReShipmentTypePrices: %+v with error: %w", shipmentTypePrice, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReShipmentTypePrices: %+v with validation errors: %w", shipmentTypePrice, verrs) - } - } - } - if !shipmentTypeFound { - return fmt.Errorf("shipment type [%s] not found", stageDomesticIntlAddlPrices.ShipmentType) - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_shipment_type_prices_test.go b/pkg/services/ghcimport/import_re_shipment_type_prices_test.go deleted file mode 100644 index adc6f6907b1..00000000000 --- a/pkg/services/ghcimport/import_re_shipment_type_prices_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREShipmentTypePrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREShipmentTypePrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyShipmentTypePrices() - suite.helperCheckShipmentTypePrices() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREShipmentTypePrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_shipment_type_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyShipmentTypePrices() { - count, err := suite.DB().Count(&models.ReShipmentTypePrice{}) - suite.NoError(err) - suite.Equal(7, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckShipmentTypePrices() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - // Get service UUID for shipment type - var service models.ReService - err = suite.DB().Where("code = $1", models.ReServiceCodeDMHF).First(&service) - suite.NoError(err) - - var shipmentTypePrices models.ReShipmentTypePrice - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("service_id = $2", service.ID). - First(&shipmentTypePrices) - suite.NoError(err) - suite.Equal(1.20, shipmentTypePrices.Factor) -} diff --git a/pkg/services/ghcimport/import_re_task_order_fees.go b/pkg/services/ghcimport/import_re_task_order_fees.go deleted file mode 100644 index 3a0df39766c..00000000000 --- a/pkg/services/ghcimport/import_re_task_order_fees.go +++ /dev/null @@ -1,94 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (gre *GHCRateEngineImporter) importRETaskOrderFees(appCtx appcontext.AppContext) error { - //tab 4a) Mgmt., Coun., Trans. Prices - var shipmentManagementServices []models.StageShipmentManagementServicesPrice - err := appCtx.DB().All(&shipmentManagementServices) - if err != nil { - return fmt.Errorf("could not read staged shipment management service prices: %w", err) - } - - //loop through the shipment management service data, pull data for management services and save in db - for _, stageShipmentManagementServicePrice := range shipmentManagementServices { - shipmentManagementService, foundService := gre.serviceToIDMap[models.ReServiceCodeMS] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeMS) - } - - contractYear := stageShipmentManagementServicePrice.ContractYear - contractYearID, found := gre.contractYearToIDMap[contractYear] - if !found { - return fmt.Errorf("could not find contract year %s in map", stageShipmentManagementServicePrice.ContractYear) - } - - var perUnitCentsService int - perUnitCentsService, err = priceToCents(stageShipmentManagementServicePrice.PricePerTaskOrder) - if err != nil { - return fmt.Errorf("could not process shipment management service price [%s]: %w", stageShipmentManagementServicePrice.PricePerTaskOrder, err) - } - - taskOrderFee := models.ReTaskOrderFee{ - ContractYearID: contractYearID, - ServiceID: shipmentManagementService, - PriceCents: unit.Cents(perUnitCentsService), - } - - verrs, dbErr := appCtx.DB().ValidateAndSave(&taskOrderFee) - if dbErr != nil { - return fmt.Errorf("error saving ReTaskOrderFees: %+v with error: %w", taskOrderFee, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReTaskOrderFees: %+v with validation errors: %w", taskOrderFee, verrs) - } - } - - var shipmentCounselingServices []models.StageCounselingServicesPrice - err = appCtx.DB().All(&shipmentCounselingServices) - if err != nil { - return fmt.Errorf("could not read staged shipment counseling service prices: %w", err) - } - - //loop through the shipment management service data, pull data for counseling services and save in db - for _, stageShipmentCounselingServicePrice := range shipmentCounselingServices { - shipmentCounselingService, foundService := gre.serviceToIDMap[models.ReServiceCodeCS] - if !foundService { - return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeCS) - } - - contractYear := stageShipmentCounselingServicePrice.ContractYear - contractYearID, found := gre.contractYearToIDMap[contractYear] - if !found { - return fmt.Errorf("could not find contract year %s in map", stageShipmentCounselingServicePrice.ContractYear) - } - - var perUnitCentsService int - perUnitCentsService, err = priceToCents(stageShipmentCounselingServicePrice.PricePerTaskOrder) - if err != nil { - return fmt.Errorf("could not process shipment counseling service price [%s]: %w", stageShipmentCounselingServicePrice.PricePerTaskOrder, err) - } - - taskOrderFee := models.ReTaskOrderFee{ - ContractYearID: contractYearID, - ServiceID: shipmentCounselingService, - PriceCents: unit.Cents(perUnitCentsService), - } - - verrs, dbErr := appCtx.DB().ValidateAndSave(&taskOrderFee) - if dbErr != nil { - return fmt.Errorf("error saving ReTaskOrderFees: %+v with error: %w", taskOrderFee, dbErr) - } - if verrs.HasAny() { - return fmt.Errorf("error saving ReTaskOrderFees: %+v with validation errors: %w", taskOrderFee, verrs) - } - } - - return nil -} diff --git a/pkg/services/ghcimport/import_re_task_order_fees_test.go b/pkg/services/ghcimport/import_re_task_order_fees_test.go deleted file mode 100644 index 365f125f08c..00000000000 --- a/pkg/services/ghcimport/import_re_task_order_fees_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importRETaskOrderFees() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractStartDate: testContractStartDate, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREContractYears(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRETaskOrderFees(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyTaskOrderFees() - suite.helperCheckTaskOrderFees() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importRETaskOrderFees(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_task_order_fees_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyTaskOrderFees() { - count, err := suite.DB().Count(&models.ReTaskOrderFee{}) - suite.NoError(err) - suite.Equal(16, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckTaskOrderFees() { - // Get service UUID. - var serviceMS models.ReService - err := suite.DB().Where("code = $1", models.ReServiceCodeMS).First(&serviceMS) - suite.NoError(err) - - var serviceCS models.ReService - err = suite.DB().Where("code = $1", models.ReServiceCodeCS).First(&serviceCS) - suite.NoError(err) - - // Get contract year UUID. - var contractYear models.ReContractYear - err = suite.DB().Where("name = 'Base Period Year 1'").First(&contractYear) - suite.NoError(err) - - var taskOrderFeeMS models.ReTaskOrderFee - err = suite.DB(). - Where("service_id = $1", serviceMS.ID). - Where("contract_year_id = $2", contractYear.ID). - First(&taskOrderFeeMS) - suite.NoError(err) - suite.Equal(unit.Cents(45115), taskOrderFeeMS.PriceCents) - - var taskOrderFeeCS models.ReTaskOrderFee - err = suite.DB(). - Where("service_id = $1", serviceCS.ID). - Where("contract_year_id = $2", contractYear.ID). - First(&taskOrderFeeCS) - suite.NoError(err) - suite.Equal(unit.Cents(22263), taskOrderFeeCS.PriceCents) -} diff --git a/pkg/services/ghcimport/load_service_map.go b/pkg/services/ghcimport/load_service_map.go deleted file mode 100644 index 28969d25677..00000000000 --- a/pkg/services/ghcimport/load_service_map.go +++ /dev/null @@ -1,25 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -func (gre *GHCRateEngineImporter) loadServiceMap(appCtx appcontext.AppContext) error { - var services models.ReServices - err := appCtx.DB().Select("id", "code").All(&services) - if err != nil { - return fmt.Errorf("could not read services: %w", err) - } - - gre.serviceToIDMap = make(map[models.ReServiceCode]uuid.UUID) - for _, service := range services { - gre.serviceToIDMap[service.Code] = service.ID - } - - return nil -} diff --git a/pkg/services/ghcimport/load_service_map_test.go b/pkg/services/ghcimport/load_service_map_test.go deleted file mode 100644 index 840505fbbe4..00000000000 --- a/pkg/services/ghcimport/load_service_map_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_loadServiceMap() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - suite.Run("load success", func() { - err := gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - suite.NotNil(gre.serviceToIDMap) - - count, err := suite.DB().Count(&models.ReService{}) - suite.NoError(err) - suite.Greater(count, 0) - suite.Equal(count, len(gre.serviceToIDMap)) - - // Spot-check a service code - testServiceCode := models.ReServiceCodeDOASIT - if suite.Contains(gre.serviceToIDMap, testServiceCode) { - suite.NotEqual(uuid.Nil, gre.serviceToIDMap[testServiceCode]) - } - }) -} diff --git a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go deleted file mode 100644 index 1e39e41041c..00000000000 --- a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go +++ /dev/null @@ -1,95 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" -) - -func (gre *GHCRateEngineImporter) mapZipCodesToRERateAreas(appCtx appcontext.AppContext) error { - err := gre.mapREZip3sToRERateAreas(appCtx) - if err != nil { - return fmt.Errorf("mapREZip3sToRERateAreas failed: %w", err) - } - - err = gre.createAndMapREZip5sToRERateAreas(appCtx) - if err != nil { - return fmt.Errorf("createAndMapREZip5sToRERateAreas failed: %w", err) - } - - return nil -} - -func (gre *GHCRateEngineImporter) mapREZip3sToRERateAreas(appCtx appcontext.AppContext) error { - var reZip3s []models.ReZip3 - - err := appCtx.DB().Where("contract_id = ?", gre.ContractID).All(&reZip3s) - if err != nil { - return fmt.Errorf("failed to collect all ReZip3 records: %w", err) - } - - for _, reZip3 := range reZip3s { - copyOfReZip3 := reZip3 // Make copy to avoid implicit memory aliasing of items from a range statement. - rateArea, found := zip3ToRateAreaMappings[copyOfReZip3.Zip3] - if !found { - return fmt.Errorf("failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", copyOfReZip3.Zip3) - } - - if rateArea == "ZIP" { - copyOfReZip3.RateAreaID = nil - copyOfReZip3.HasMultipleRateAreas = true - - verrs, err := appCtx.DB().ValidateAndUpdate(©OfReZip3) - if err != nil { - return fmt.Errorf("failed to update ReZip3 %v: %w", copyOfReZip3.Zip3, err) - } - if verrs.HasAny() { - return fmt.Errorf("failed to validate ReZip3 %v: %w", copyOfReZip3.Zip3, verrs) - } - } else { - rateAreaID, found := gre.domesticRateAreaToIDMap[rateArea] - if !found { - return fmt.Errorf("failed to find ID for rate area %s in domesticRateAreaToIDMap", rateArea) - } - - copyOfReZip3.RateAreaID = &rateAreaID - copyOfReZip3.HasMultipleRateAreas = false - - verrs, err := appCtx.DB().ValidateAndUpdate(©OfReZip3) - if err != nil { - return fmt.Errorf("failed to update ReZip3: %v: %w", copyOfReZip3.Zip3, err) - } - if verrs.HasAny() { - return fmt.Errorf("failed to validate ReZip3: %v: %w", copyOfReZip3.Zip3, verrs) - } - } - } - - return nil -} - -func (gre *GHCRateEngineImporter) createAndMapREZip5sToRERateAreas(appCtx appcontext.AppContext) error { - for zip5, rateArea := range zip5ToRateAreaMappings { - var reZip5RateArea models.ReZip5RateArea - - rateAreaID, found := gre.domesticRateAreaToIDMap[rateArea] - if !found { - return fmt.Errorf("failed to find ID for rate area %s in domesticRateAreaToIDMap", rateArea) - } - - reZip5RateArea.ContractID = gre.ContractID - reZip5RateArea.Zip5 = zip5 - reZip5RateArea.RateAreaID = rateAreaID - - verrs, err := appCtx.DB().ValidateAndCreate(&reZip5RateArea) - if err != nil { - return fmt.Errorf("failed to update ReZip5RateArea: %v: %w", reZip5RateArea.Zip5, err) - } - if verrs.HasAny() { - return fmt.Errorf("failed to validate ReZip5RateArea: %v: %w", reZip5RateArea.Zip5, verrs) - } - } - - return nil -} diff --git a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go deleted file mode 100644 index 6252cb0e8df..00000000000 --- a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go +++ /dev/null @@ -1,140 +0,0 @@ -package ghcimport - -import ( - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_mapZipCodesToReRateAreas() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("map ReZip3 records to correct ReRateArea records", func() { - setupTestData() - reContract, err := suite.helperFetchReContract() - suite.NoError(err) - - var reZip3 models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", reContract.ID). - Where("zip3 = ?", "352"). - First(&reZip3) - suite.NoError(err) - - var reZip3WithMultipleReRateAreas models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", reContract.ID). - Where("zip3 = ?", "327"). - First(&reZip3WithMultipleReRateAreas) - suite.NoError(err) - - suite.Nil(reZip3.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", reZip3.ID) - suite.Nil(reZip3WithMultipleReRateAreas.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", reZip3WithMultipleReRateAreas.ID) - - rateAreaCode, found := zip3ToRateAreaMappings[reZip3.Zip3] - suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip3.Zip3) - - zipRateAreaCode, found := zip3ToRateAreaMappings[reZip3WithMultipleReRateAreas.Zip3] - suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip3WithMultipleReRateAreas.Zip3) - suite.Equal(zipRateAreaCode, "ZIP", "expected rate area code to be ZIP but got %s", zipRateAreaCode) - - reRateArea, err := suite.helperFetchReRateArea(reContract, rateAreaCode) - suite.NoError(err) - - err = gre.mapREZip3sToRERateAreas(suite.AppContextForTest()) - suite.NoError(err) - - var updatedReZip3 models.ReZip3 - err = suite.DB(). - Where("id = ?", reZip3.ID). - First(&updatedReZip3) - suite.NoError(err) - - suite.NotNil(updatedReZip3.RateAreaID, "expected ReZip3 record %s to not have nil rate_area_id", updatedReZip3.ID) - suite.Equal(*updatedReZip3.RateAreaID, reRateArea.ID, "expected ReZip3 %s record to be mapped to ReRateArea record %s, but got %s", reRateArea.ID, updatedReZip3.RateAreaID) - - var updatedReZip3WithMultipleReRateAreas models.ReZip3 - err = suite.DB(). - Where("id = ?", reZip3WithMultipleReRateAreas.ID). - First(&updatedReZip3WithMultipleReRateAreas) - suite.NoError(err) - - suite.Nil(updatedReZip3WithMultipleReRateAreas.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", updatedReZip3WithMultipleReRateAreas.ID) - suite.True(updatedReZip3WithMultipleReRateAreas.HasMultipleRateAreas) - }) - - suite.Run("create ReZip5RateArea records and map to correct ReRateArea records", func() { - setupTestData() - reContract, err := suite.helperFetchReContract() - suite.NoError(err) - - reZip5RateAreasCount, err := suite.DB(). - Where("contract_id = ?", reContract.ID). - Count(&models.ReZip5RateArea{}) - suite.NoError(err) - - suite.Equal(0, reZip5RateAreasCount) - - err = gre.createAndMapREZip5sToRERateAreas(suite.AppContextForTest()) - suite.NoError(err) - - var reZip5RateArea models.ReZip5RateArea - err = suite.DB(). - Where("contract_id = ?", reContract.ID). - First(&reZip5RateArea) - suite.NoError(err) - - rateAreaCode, found := zip5ToRateAreaMappings[reZip5RateArea.Zip5] - suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip5RateArea.Zip5) - - reRateArea, err := suite.helperFetchReRateArea(reContract, rateAreaCode) - suite.NoError(err) - - suite.Equal(reZip5RateArea.RateAreaID, reRateArea.ID, "expected ReZip3 %s record to be mapped to ReRateArea record %s, but got %s", reRateArea.ID, reZip5RateArea.RateAreaID) - suite.helperVerifyNumberOfReZip5RateAreasCreated() - }) -} - -func (suite *GHCRateEngineImportSuite) helperFetchReContract() (models.ReContract, error) { - var reContract models.ReContract - err := suite.DB(). - Where("code = ?", testContractCode). - First(&reContract) - - return reContract, err -} - -func (suite *GHCRateEngineImportSuite) helperFetchReRateArea(reContract models.ReContract, rateAreaCode string) (models.ReRateArea, error) { - var reRateArea models.ReRateArea - - err := suite.DB(). - Where("contract_id = ?", reContract.ID). - Where("code = ?", rateAreaCode). - First(&reRateArea) - - return reRateArea, err -} - -func (suite *GHCRateEngineImportSuite) helperVerifyNumberOfReZip5RateAreasCreated() { - reContract, err := suite.helperFetchReContract() - suite.NoError(err) - - reZip5RateAreasCount, err := suite.DB(). - Where("contract_id = ?", reContract.ID). - Count(&models.ReZip5RateArea{}) - suite.NoError(err) - - suite.Equal(922, reZip5RateAreasCount) -} diff --git a/pkg/services/ghcimport/shared.go b/pkg/services/ghcimport/shared.go deleted file mode 100644 index 3db67603b62..00000000000 --- a/pkg/services/ghcimport/shared.go +++ /dev/null @@ -1,107 +0,0 @@ -package ghcimport - -import ( - "fmt" - "strconv" - "strings" - - "github.com/transcom/mymove/pkg/models" -) - -func stringToInteger(rawString string) (int, error) { - // Get rid of any decimal point - baseString := strings.Split(rawString, ".")[0] - - // Verify that it's an integer - asInteger, err := strconv.Atoi(baseString) - if err != nil { - return 0, err - } - - return asInteger, nil -} - -func cleanServiceAreaNumber(rawServiceArea string) (string, error) { - serviceAreaInt, err := stringToInteger(rawServiceArea) - if err != nil { - return "", err - } - - return fmt.Sprintf("%03d", serviceAreaInt), nil -} - -func cleanZip3(rawZip3 string) (string, error) { - zip3Int, err := stringToInteger(rawZip3) - if err != nil { - return "", err - } - - return fmt.Sprintf("%03d", zip3Int), nil -} - -func isPeakPeriod(season string) (bool, error) { - if strings.EqualFold(season, "Peak") { - return true, nil - } else if strings.EqualFold(season, "NonPeak") { - return false, nil - } - - return false, fmt.Errorf("invalid season [%s]", season) -} - -func getPriceParts(rawPrice string, expectedDecimalPlaces int) (int, int, error) { - // Get rid of a dollar sign if there is one. - basePrice := strings.Replace(rawPrice, "$", "", -1) - - // Split the string on the decimal point. - priceParts := strings.Split(basePrice, ".") - if len(priceParts) != 2 { - return 0, 0, fmt.Errorf("expected 2 price parts but found %d for price [%s]", len(priceParts), rawPrice) - } - - integerPart, err := strconv.Atoi(priceParts[0]) - if err != nil { - return 0, 0, fmt.Errorf("could not convert integer part of price [%s]", rawPrice) - } - - if len(priceParts[1]) != expectedDecimalPlaces { - return 0, 0, fmt.Errorf("expected %d decimal places but found %d for price [%s]", expectedDecimalPlaces, - len(priceParts[1]), rawPrice) - } - - fractionalPart, err := strconv.Atoi(priceParts[1]) - if err != nil { - return 0, 0, fmt.Errorf("could not convert fractional part of price [%s]", rawPrice) - } - - return integerPart, fractionalPart, nil -} - -func priceToMillicents(rawPrice string) (int, error) { - integerPart, fractionalPart, err := getPriceParts(rawPrice, 3) - if err != nil { - return 0, fmt.Errorf("could not parse price [%s]: %w", rawPrice, err) - } - - millicents := (integerPart * 100000) + (fractionalPart * 100) - return millicents, nil -} - -func priceToCents(rawPrice string) (int, error) { - integerPart, fractionalPart, err := getPriceParts(rawPrice, 2) - if err != nil { - return 0, fmt.Errorf("could not parse price [%s]: %w", rawPrice, err) - } - - cents := (integerPart * 100) + fractionalPart - return cents, nil -} - -func getMarket(market string) (models.Market, error) { - if strings.EqualFold(market, "CONUS") { - return models.MarketConus, nil - } else if strings.EqualFold(market, "OCONUS") { - return models.MarketOconus, nil - } - return "invalid market", fmt.Errorf("invalid market [%s]", market) -} diff --git a/pkg/services/ghcimport/shared_test.go b/pkg/services/ghcimport/shared_test.go deleted file mode 100644 index 51fb83001d2..00000000000 --- a/pkg/services/ghcimport/shared_test.go +++ /dev/null @@ -1,219 +0,0 @@ -package ghcimport - -import ( - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_stringToInteger() { - tests := []struct { - name string - input string - expected int - shouldError bool - }{ - {"with decimal point", "25.0", 25, false}, - {"no decimal point", "25", 25, false}, - {"not a number", "2A", 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := stringToInteger(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_cleanServiceAreaNumber() { - tests := []struct { - name string - input string - expected string - shouldError bool - }{ - {"with decimal point, needs leading zeros", "4.0", "004", false}, - {"no decimal point", "225", "225", false}, - {"not a number", "B3", "", true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := cleanServiceAreaNumber(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_cleanZip3() { - tests := []struct { - name string - input string - expected string - shouldError bool - }{ - {"with decimal point, needs leading zeros", "15.0", "015", false}, - {"no decimal point", "309", "309", false}, - {"not a number", "30L", "", true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := cleanZip3(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_isPeakPeriod() { - tests := []struct { - name string - input string - expected bool - shouldError bool - }{ - {"peak", "Peak", true, false}, - {"peak, upper case", "PEAK", true, false}, - {"non-peak", "NonPeak", false, false}, - {"non-peak, upper case", "NONPEAK", false, false}, - {"invalid period", "Non-Peak", false, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := isPeakPeriod(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_getPriceParts() { - tests := []struct { - name string - rawPrice string - decimalPlaces int - expectedIntegerPart int - expectedFractionalPart int - shouldError bool - }{ - {"at expected decimal places", "$3.557", 3, 3, 557, false}, - {"less than max decimal places", "$3.5", 3, 0, 0, true}, - {"more than max decimal places", "$3.5777", 3, 0, 0, true}, - {"no dollar sign", "2.001", 3, 2, 1, false}, - {"very small, no dollar sign", "0.005", 3, 0, 5, false}, - {"no decimal point", "1", 3, 0, 0, true}, - {"invalid price", "$3.ABC", 3, 0, 0, true}, - {"empty string", "", 4, 0, 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - integerPart, fractionalPart, err := getPriceParts(test.rawPrice, test.decimalPlaces) - suite.Equal(test.expectedIntegerPart, integerPart) - suite.Equal(test.expectedFractionalPart, fractionalPart) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_priceToMillicents() { - tests := []struct { - name string - input string - expected int - shouldError bool - }{ - {"price with dollar sign", "$3.557", 355700, false}, - {"leading zeros in decimal part", "$3.005", 300500, false}, - {"two decimal places", "$3.55", 0, true}, - {"more than expected decimal places", "$3.5571", 0, true}, - {"input of zero", "0", 0, true}, - {"empty string", "", 0, true}, - {"price without dollar sign", "0.001", 100, false}, - {"price as integer", "3", 0, true}, - {"not a number", "3.53X", 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := priceToMillicents(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_priceToCents() { - tests := []struct { - name string - input string - expected int - shouldError bool - }{ - {"price with dollar sign", "$3.55", 355, false}, - {"leading zeros in decimal part", "$3.01", 301, false}, - {"more than expected decimal places", "$3.551", 0, true}, - {"input of zero", "0", 0, true}, - {"empty string", "", 0, true}, - {"price without dollar sign", "0.01", 1, false}, - {"price as integer", "3", 0, true}, - {"not a number", "3.5X", 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := priceToCents(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_getMarket() { - tests := []struct { - name string - input string - expected models.Market - shouldError bool - }{ - {"CONUS", "CONUS", "C", false}, - {"OCONUS", "OCONUS", "O", false}, - {"XONUS", "XONUS", "invalid market", true}, - } - - for _, test := range tests { - suite.Run(test.name, func() { - result, err := getMarket(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} diff --git a/pkg/services/ghcimport/zip3_to_rate_area_mappings.go b/pkg/services/ghcimport/zip3_to_rate_area_mappings.go deleted file mode 100644 index 1212576fbec..00000000000 --- a/pkg/services/ghcimport/zip3_to_rate_area_mappings.go +++ /dev/null @@ -1,913 +0,0 @@ -package ghcimport - -var zip3ToRateAreaMappings = map[string]string{ - // Zip3 Rate Area - "010": "US14", - "011": "US14", - "012": "US14", - "013": "US14", - "014": "US14", - "015": "US14", - "016": "US14", - "017": "US14", - "018": "US14", - "019": "US14", - "020": "US14", - "021": "US14", - "022": "US14", - "023": "US14", - "024": "US14", - "025": "US14", - "026": "US14", - "027": "US14", - "028": "US15", - "029": "US15", - "030": "US12", - "031": "US12", - "032": "US12", - "033": "US12", - "034": "US12", - "035": "US12", - "036": "US12", - "037": "US12", - "038": "US12", - "039": "US11", - "040": "US11", - "041": "US11", - "042": "US11", - "043": "US11", - "044": "US11", - "045": "US11", - "046": "US11", - "047": "US11", - "048": "US11", - "049": "US11", - "050": "US13", - "051": "US13", - "052": "US13", - "053": "US13", - "054": "US13", - "055": "US14", - "056": "US13", - "057": "US13", - "058": "US13", - "059": "US12", - "060": "US16", - "061": "US16", - "062": "US16", - "063": "US16", - "064": "US16", - "065": "US16", - "066": "US16", - "067": "US16", - "068": "US16", - "069": "US16", - "070": "US19", - "071": "US19", - "072": "US19", - "073": "US19", - "074": "US19", - "075": "US19", - "076": "US19", - "077": "US19", - "078": "US19", - "079": "US19", - "080": "US19", - "081": "US19", - "082": "US19", - "083": "US19", - "084": "US19", - "085": "US19", - "086": "US19", - "087": "US19", - "088": "US19", - "089": "US19", - "100": "US17", - "101": "US17", - "102": "US17", - "103": "US17", - "104": "US17", - "105": "US17", - "106": "US17", - "107": "US17", - "108": "US17", - "109": "US17", - "110": "US17", - "111": "US17", - "112": "US17", - "113": "US17", - "114": "US17", - "115": "US17", - "116": "US17", - "117": "US17", - "118": "US17", - "119": "US17", - "120": "US17", - "121": "US17", - "122": "US17", - "123": "US17", - "124": "US17", - "125": "US17", - "126": "US17", - "127": "US17", - "128": "US17", - "129": "US17", - "130": "US17", - "131": "US17", - "132": "US17", - "133": "US17", - "134": "US17", - "135": "US17", - "136": "US17", - "137": "US17", - "138": "US17", - "139": "US17", - "140": "US17", - "141": "US17", - "142": "US17", - "143": "US17", - "144": "US17", - "145": "US17", - "146": "US17", - "147": "US17", - "148": "US17", - "149": "US17", - "150": "US20", - "151": "US20", - "152": "US20", - "153": "US20", - "154": "US20", - "155": "US20", - "156": "US20", - "157": "US20", - "158": "US20", - "159": "US20", - "160": "US20", - "161": "US20", - "162": "US20", - "163": "US20", - "164": "US20", - "165": "US20", - "166": "US20", - "167": "US20", - "168": "US20", - "169": "US20", - "170": "US20", - "171": "US20", - "172": "US20", - "173": "US20", - "174": "US20", - "175": "US20", - "176": "US20", - "177": "US20", - "178": "US20", - "179": "US20", - "180": "US20", - "181": "US20", - "182": "US20", - "183": "US20", - "184": "US20", - "185": "US20", - "186": "US20", - "187": "US20", - "188": "US20", - "189": "US20", - "190": "US20", - "191": "US20", - "192": "US20", - "193": "US20", - "194": "US20", - "195": "US20", - "196": "US20", - "197": "US22", - "198": "US22", - "199": "US22", - "200": "US24", - "201": "US25", - "202": "US24", - "203": "US24", - "204": "US24", - "205": "US24", - "206": "US23", - "207": "US23", - "208": "US23", - "209": "US23", - "210": "US23", - "211": "US23", - "212": "US23", - "213": "US23", - "214": "US23", - "215": "US23", - "216": "US23", - "217": "US23", - "218": "US23", - "219": "US23", - "220": "US25", - "221": "US25", - "222": "US25", - "223": "US25", - "224": "US25", - "225": "US25", - "226": "US25", - "227": "US25", - "228": "US25", - "229": "US25", - "230": "US25", - "231": "US25", - "232": "US25", - "233": "US25", - "234": "US25", - "235": "US25", - "236": "US25", - "237": "US25", - "238": "US25", - "239": "US25", - "240": "US25", - "241": "US25", - "242": "US25", - "243": "US25", - "244": "US25", - "245": "US25", - "246": "US25", - "247": "US27", - "248": "US27", - "249": "US27", - "250": "US27", - "251": "US27", - "252": "US27", - "253": "US27", - "254": "US27", - "255": "US27", - "256": "US27", - "257": "US27", - "258": "US27", - "259": "US27", - "260": "US27", - "261": "US27", - "262": "US27", - "263": "US27", - "264": "US27", - "265": "US27", - "266": "US27", - "267": "US27", - "268": "US27", - "270": "US40", - "271": "US40", - "272": "US40", - "273": "US40", - "274": "US40", - "275": "US40", - "276": "US40", - "277": "US40", - "278": "US40", - "279": "US40", - "280": "US40", - "281": "US40", - "282": "US40", - "283": "US40", - "284": "US40", - "285": "US40", - "286": "US40", - "287": "US40", - "288": "US40", - "289": "US40", - "290": "US44", - "291": "US44", - "292": "US44", - "293": "US44", - "294": "US44", - "295": "US44", - "296": "US44", - "297": "US44", - "298": "US44", - "299": "US44", - "300": "US45", - "301": "US45", - "302": "US45", - "303": "US45", - "304": "US45", - "305": "US45", - "306": "US45", - "307": "US45", - "308": "US45", - "309": "US45", - "310": "US45", - "311": "US45", - "312": "US45", - "313": "US45", - "314": "US45", - "315": "US45", - "316": "US45", - "317": "US45", - "318": "US45", - "319": "US45", - "320": "US49", - "321": "ZIP", - "322": "US49", - "323": "US49", - "324": "US49", - "325": "US49", - "326": "US49", - "327": "ZIP", - "328": "US4964400", - "329": "US4964400", - "330": "US4965500", - "331": "US4964400", - "332": "US4964400", - "333": "US4964400", - "334": "US4964400", - "335": "US4964400", - "336": "US4964400", - "337": "US4964400", - "338": "US4964400", - "339": "US4964400", - "341": "US4964400", - "342": "US4964400", - "344": "ZIP", - "346": "US4964400", - "347": "US4964400", - "349": "US4964400", - "350": "US47", - "351": "US47", - "352": "US47", - "354": "US47", - "355": "US47", - "356": "US47", - "357": "US47", - "358": "US47", - "359": "US47", - "360": "US47", - "361": "US47", - "362": "US47", - "363": "US47", - "364": "US47", - "365": "US47", - "366": "US47", - "367": "US47", - "368": "US47", - "369": "US47", - "370": "US42", - "371": "US42", - "372": "US42", - "373": "US42", - "374": "US42", - "375": "US42", - "376": "US42", - "377": "US42", - "378": "US42", - "379": "US42", - "380": "US42", - "381": "US42", - "382": "US42", - "383": "US42", - "384": "US42", - "385": "US42", - "386": "US48", - "387": "US48", - "388": "US48", - "389": "US48", - "390": "US48", - "391": "US48", - "392": "US48", - "393": "US48", - "394": "US48", - "395": "US48", - "396": "US48", - "397": "US48", - "398": "US45", - "399": "US45", - "400": "US28", - "401": "US28", - "402": "US28", - "403": "US28", - "404": "US28", - "405": "US28", - "406": "US28", - "407": "US28", - "408": "US28", - "409": "US28", - "410": "US28", - "411": "US28", - "412": "US28", - "413": "US28", - "414": "US28", - "415": "US28", - "416": "US28", - "417": "US28", - "418": "US28", - "420": "US28", - "421": "US28", - "422": "US28", - "423": "US28", - "424": "US28", - "425": "US28", - "426": "US28", - "427": "US28", - "430": "US34", - "431": "US34", - "432": "US34", - "433": "US34", - "434": "US34", - "435": "US34", - "436": "US34", - "437": "US34", - "438": "US34", - "439": "US34", - "440": "US34", - "441": "US34", - "442": "US34", - "443": "US34", - "444": "US34", - "445": "US34", - "446": "US34", - "447": "US34", - "448": "US34", - "449": "US34", - "450": "US34", - "451": "US34", - "452": "US34", - "453": "US34", - "454": "US34", - "455": "US34", - "456": "US34", - "457": "US34", - "458": "US34", - "459": "US34", - "460": "US36", - "461": "US36", - "462": "US36", - "463": "US36", - "464": "US36", - "465": "US36", - "466": "US36", - "467": "US36", - "468": "US36", - "469": "US36", - "470": "US36", - "471": "US36", - "472": "US36", - "473": "US36", - "474": "US36", - "475": "US36", - "476": "US36", - "477": "US36", - "478": "US36", - "479": "US36", - "480": "US30", - "481": "US30", - "482": "US30", - "483": "US30", - "484": "US30", - "485": "US30", - "486": "US30", - "487": "US30", - "488": "US30", - "489": "US30", - "490": "US30", - "491": "US30", - "492": "US30", - "493": "US30", - "494": "US30", - "495": "US30", - "496": "US30", - "497": "US30", - "498": "US30", - "499": "US30", - "500": "US53", - "501": "US53", - "502": "US53", - "503": "US53", - "504": "US53", - "505": "US53", - "506": "US53", - "507": "US53", - "508": "US53", - "509": "US53", - "510": "US53", - "511": "US53", - "512": "US53", - "513": "US53", - "514": "US53", - "515": "US53", - "516": "US53", - "520": "US53", - "521": "US53", - "522": "US53", - "523": "US53", - "524": "US53", - "525": "US53", - "526": "US53", - "527": "US53", - "528": "US53", - "530": "US32", - "531": "US32", - "532": "US32", - "533": "US32", - "534": "US32", - "535": "US32", - "536": "US32", - "537": "US32", - "538": "US32", - "539": "US32", - "540": "US32", - "541": "US32", - "542": "US32", - "543": "US32", - "544": "US32", - "545": "US32", - "546": "US32", - "547": "US32", - "548": "US32", - "549": "US32", - "550": "US50", - "551": "US50", - "553": "US50", - "554": "US50", - "555": "US50", - "556": "US50", - "557": "US50", - "558": "US50", - "559": "US50", - "560": "US50", - "561": "US50", - "562": "US50", - "563": "US50", - "564": "US50", - "565": "US50", - "566": "US50", - "567": "US50", - "570": "US52", - "571": "US52", - "572": "US52", - "573": "US52", - "574": "US52", - "575": "US52", - "576": "US52", - "577": "US52", - "580": "US51", - "581": "US51", - "582": "US51", - "583": "US51", - "584": "US51", - "585": "US51", - "586": "US51", - "587": "US51", - "588": "US51", - "590": "US70", - "591": "US70", - "592": "US70", - "593": "US70", - "594": "US70", - "595": "US70", - "596": "US70", - "597": "US70", - "598": "US70", - "599": "US70", - "600": "US38", - "601": "US38", - "602": "US38", - "603": "US38", - "604": "US38", - "605": "US38", - "606": "US38", - "607": "US38", - "608": "US38", - "609": "US38", - "610": "US38", - "611": "US38", - "612": "US38", - "613": "US38", - "614": "US38", - "615": "US38", - "616": "US38", - "617": "US38", - "618": "US38", - "619": "US38", - "620": "US38", - "622": "US38", - "623": "US38", - "624": "US38", - "625": "US38", - "626": "US38", - "627": "US38", - "628": "US38", - "629": "US38", - "630": "US56", - "631": "US56", - "633": "US56", - "634": "US56", - "635": "US56", - "636": "US56", - "637": "US56", - "638": "US56", - "639": "US56", - "640": "US56", - "641": "US56", - "644": "US56", - "645": "US56", - "646": "US56", - "647": "US56", - "648": "US56", - "649": "US56", - "650": "US56", - "651": "US56", - "652": "US56", - "653": "US56", - "654": "US56", - "655": "US56", - "656": "US56", - "657": "US56", - "658": "US56", - "660": "US58", - "661": "US58", - "662": "US58", - "664": "US58", - "665": "US58", - "666": "US58", - "667": "US58", - "668": "US58", - "669": "US58", - "670": "US58", - "671": "US58", - "672": "US58", - "673": "US58", - "674": "US58", - "675": "US58", - "676": "US58", - "677": "US58", - "678": "US58", - "679": "US58", - "680": "US55", - "681": "US55", - "683": "US55", - "684": "US55", - "685": "US55", - "686": "US55", - "687": "US55", - "688": "US55", - "689": "US55", - "690": "US55", - "691": "US55", - "692": "US55", - "693": "US55", - "700": "US64", - "701": "US64", - "703": "US64", - "704": "US64", - "705": "US64", - "706": "US64", - "707": "US64", - "708": "US64", - "710": "US64", - "711": "US64", - "712": "US64", - "713": "US64", - "714": "US64", - "716": "US60", - "717": "US60", - "718": "US60", - "719": "US60", - "720": "US60", - "721": "US60", - "722": "US60", - "723": "US60", - "724": "US60", - "725": "US60", - "726": "US60", - "727": "US60", - "728": "US60", - "729": "US60", - "730": "US62", - "731": "US62", - "733": "US68", - "734": "US62", - "735": "US62", - "736": "US62", - "737": "US62", - "738": "US62", - "739": "US62", - "740": "US62", - "741": "US62", - "743": "US62", - "744": "US62", - "745": "US62", - "746": "US62", - "747": "US62", - "748": "US62", - "749": "US62", - "750": "US66", - "751": "US66", - "752": "US66", - "753": "US66", - "754": "US66", - "755": "US66", - "756": "US66", - "757": "ZIP", - "758": "ZIP", - "759": "ZIP", - "760": "US66", - "761": "US66", - "762": "US66", - "763": "US66", - "764": "US66", - "765": "ZIP", - "766": "ZIP", - "767": "US66", - "768": "ZIP", - "769": "ZIP", - "770": "US68", - "771": "US68", - "772": "US68", - "773": "US68", - "774": "US68", - "775": "US68", - "776": "US68", - "777": "US68", - "778": "US68", - "779": "US68", - "780": "US68", - "781": "US68", - "782": "US68", - "783": "US68", - "784": "US68", - "785": "US68", - "786": "ZIP", - "787": "US68", - "788": "ZIP", - "789": "US68", - "790": "US66", - "791": "US66", - "792": "US66", - "793": "US66", - "794": "US66", - "795": "US66", - "796": "US66", - "797": "US66", - "798": "US66", - "799": "US66", - "800": "US74", - "801": "US74", - "802": "US74", - "803": "US74", - "804": "US74", - "805": "US74", - "806": "US74", - "807": "US74", - "808": "US74", - "809": "US74", - "810": "US74", - "811": "US74", - "812": "US74", - "813": "US74", - "814": "US74", - "815": "US74", - "816": "US74", - "820": "US72", - "821": "US72", - "822": "US72", - "823": "US72", - "824": "US72", - "825": "US72", - "826": "US72", - "827": "US72", - "828": "US72", - "829": "US72", - "830": "US72", - "831": "US72", - "832": "US83", - "833": "US83", - "834": "US83", - "835": "US83", - "836": "US83", - "837": "US83", - "838": "US83", - "840": "US76", - "841": "US76", - "842": "US76", - "843": "US76", - "844": "US76", - "845": "US76", - "846": "US76", - "847": "US76", - "850": "US79", - "851": "US79", - "852": "US79", - "853": "US79", - "855": "US79", - "856": "US79", - "857": "US79", - "859": "US79", - "860": "US79", - "863": "US79", - "864": "US79", - "865": "US79", - "870": "US77", - "871": "US77", - "872": "US77", - "873": "US77", - "874": "US77", - "875": "US77", - "877": "US77", - "878": "US77", - "879": "US77", - "880": "US77", - "881": "US77", - "882": "US77", - "883": "US77", - "884": "US77", - "885": "US66", - "889": "US86", - "890": "US86", - "891": "US86", - "893": "US86", - "894": "US86", - "895": "US86", - "896": "US86", - "897": "US86", - "898": "US86", - "900": "US88", - "901": "US88", - "902": "US88", - "903": "US88", - "904": "US88", - "905": "US88", - "906": "US88", - "907": "US88", - "908": "US88", - "909": "US88", - "910": "US88", - "911": "US88", - "912": "US88", - "913": "US88", - "914": "US88", - "915": "US88", - "916": "US88", - "917": "US88", - "918": "US88", - "919": "US88", - "920": "US88", - "921": "US88", - "922": "US88", - "923": "ZIP", - "924": "US88", - "925": "US88", - "926": "US88", - "927": "US88", - "928": "US88", - "930": "US88", - "931": "US88", - "932": "ZIP", - "933": "US88", - "934": "US88", - "935": "ZIP", - "936": "US87", - "937": "US87", - "938": "US87", - "939": "US87", - "940": "US87", - "941": "US87", - "942": "US87", - "943": "US87", - "944": "US87", - "945": "US87", - "946": "US87", - "947": "US87", - "948": "US87", - "949": "US87", - "950": "US87", - "951": "US87", - "952": "US87", - "953": "US87", - "954": "US87", - "955": "US87", - "956": "US87", - "957": "US87", - "958": "US87", - "959": "US87", - "960": "US87", - "961": "US87", - "970": "US85", - "971": "US85", - "972": "US85", - "973": "US85", - "974": "US85", - "975": "US85", - "976": "US85", - "977": "US85", - "978": "US85", - "979": "US85", - "980": "US84", - "981": "US84", - "982": "US84", - "983": "US84", - "984": "US84", - "985": "US84", - "986": "US84", - "988": "US84", - "989": "US84", - "990": "US84", - "991": "US84", - "992": "US84", - "993": "US84", - "994": "US84", -} diff --git a/pkg/services/ghcimport/zip5_to_rate_area_mappings.go b/pkg/services/ghcimport/zip5_to_rate_area_mappings.go deleted file mode 100644 index ec2da0d2244..00000000000 --- a/pkg/services/ghcimport/zip5_to_rate_area_mappings.go +++ /dev/null @@ -1,927 +0,0 @@ -package ghcimport - -var zip5ToRateAreaMappings = map[string]string{ - // Zip5 Rate Area - "32102": "US4964400", - "32105": "US4964400", - "32110": "US49", - "32111": "US49", - "32112": "US49", - "32113": "US49", - "32114": "US4964400", - "32115": "US4964400", - "32116": "US4964400", - "32117": "US4964400", - "32118": "US4964400", - "32119": "US4964400", - "32120": "US4964400", - "32121": "US4964400", - "32122": "US4964400", - "32123": "US4964400", - "32124": "US4964400", - "32125": "US4964400", - "32126": "US4964400", - "32127": "US4964400", - "32128": "US4964400", - "32129": "US4964400", - "32130": "US4964400", - "32131": "US49", - "32132": "US4964400", - "32133": "US49", - "32134": "US49", - "32135": "US49", - "32136": "US49", - "32137": "US49", - "32138": "US49", - "32139": "US49", - "32140": "US49", - "32141": "US4964400", - "32142": "US49", - "32143": "US49", - "32145": "US49", - "32147": "US49", - "32148": "US49", - "32149": "US49", - "32157": "US49", - "32158": "US4964400", - "32159": "US4964400", - "32160": "US49", - "32162": "US4964400", - "32163": "US4964400", - "32164": "US49", - "32168": "US4964400", - "32169": "US4964400", - "32170": "US4964400", - "32173": "US4964400", - "32174": "US4964400", - "32175": "US4964400", - "32176": "US4964400", - "32177": "US49", - "32178": "US49", - "32179": "US49", - "32180": "US4964400", - "32181": "US49", - "32182": "US49", - "32183": "US49", - "32185": "US49", - "32187": "US49", - "32189": "US49", - "32190": "US4964400", - "32192": "US49", - "32193": "US49", - "32195": "US49", - "32198": "US4964400", - "32701": "US49", - "32702": "US4964400", - "32703": "US49", - "32704": "US49", - "32706": "US4964400", - "32707": "US49", - "32708": "US49", - "32709": "US49", - "32710": "US49", - "32712": "US49", - "32713": "US4964400", - "32714": "US49", - "32715": "US49", - "32716": "US49", - "32718": "US49", - "32719": "US49", - "32720": "US4964400", - "32721": "US4964400", - "32722": "US4964400", - "32723": "US4964400", - "32724": "US4964400", - "32725": "US4964400", - "32726": "US4964400", - "32727": "US4964400", - "32728": "US4964400", - "32730": "US49", - "32732": "US49", - "32733": "US49", - "32735": "US4964400", - "32736": "US4964400", - "32738": "US4964400", - "32739": "US4964400", - "32744": "US4964400", - "32745": "US49", - "32746": "US49", - "32747": "US49", - "32750": "US49", - "32751": "US49", - "32752": "US49", - "32753": "US4964400", - "32754": "US4964400", - "32756": "US4964400", - "32757": "US4964400", - "32759": "US4964400", - "32762": "US49", - "32763": "US4964400", - "32764": "US4964400", - "32765": "US49", - "32766": "US49", - "32767": "US4964400", - "32768": "US49", - "32771": "US49", - "32772": "US49", - "32773": "US49", - "32774": "US4964400", - "32776": "US4964400", - "32777": "US49", - "32778": "US4964400", - "32779": "US49", - "32784": "US4964400", - "32789": "US49", - "32790": "US49", - "32791": "US49", - "32792": "US49", - "32793": "US49", - "32794": "US49", - "32795": "US49", - "32798": "US49", - "32799": "US49", - "33101": "US4964400", - "33102": "US4964400", - "33106": "US4964400", - "33109": "US4964400", - "33111": "US4964400", - "33112": "US4964400", - "33114": "US4964400", - "33116": "US4964400", - "33119": "US4964400", - "33122": "US4964400", - "33124": "US4964400", - "33125": "US4964400", - "33126": "US4964400", - "33127": "US4964400", - "33128": "US4964400", - "33129": "US4964400", - "33130": "US4964400", - "33131": "US4964400", - "33132": "US4964400", - "33133": "US4964400", - "33134": "US4964400", - "33135": "US4964400", - "33136": "US4964400", - "33137": "US4964400", - "33138": "US4964400", - "33139": "US4964400", - "33140": "US4964400", - "33141": "US4964400", - "33142": "US4964400", - "33143": "US4964400", - "33144": "US4964400", - "33145": "US4964400", - "33146": "US4964400", - "33147": "US4964400", - "33149": "US4964400", - "33150": "US4964400", - "33151": "US4964400", - "33152": "US4964400", - "33153": "US4964400", - "33154": "US4964400", - "33155": "US4964400", - "33156": "US4964400", - "33157": "US4964400", - "33158": "US4964400", - "33160": "US4964400", - "33161": "US4964400", - "33162": "US4964400", - "33163": "US4964400", - "33164": "US4964400", - "33165": "US4964400", - "33166": "US4964400", - "33167": "US4964400", - "33168": "US4964400", - "33169": "US4964400", - "33170": "US4964400", - "33172": "US4964400", - "33173": "US4964400", - "33174": "US4964400", - "33175": "US4964400", - "33176": "US4964400", - "33177": "US4964400", - "33178": "US4964400", - "33179": "US4964400", - "33180": "US4964400", - "33181": "US4964400", - "33182": "US4964400", - "33183": "US4964400", - "33184": "US4964400", - "33185": "US4964400", - "33186": "US4964400", - "33187": "US4964400", - "33188": "US4964400", - "33189": "US4964400", - "33190": "US4964400", - "33191": "US4964400", - "33192": "US4964400", - "33193": "US4964400", - "33194": "US4964400", - "33195": "US4964400", - "33196": "US4964400", - "33197": "US4964400", - "33198": "US4964400", - "33199": "US4964400", - "33206": "US4964400", - "33222": "US4964400", - "33231": "US4964400", - "33233": "US4964400", - "33234": "US4964400", - "33238": "US4964400", - "33239": "US4964400", - "33242": "US4964400", - "33243": "US4964400", - "33245": "US4964400", - "33247": "US4964400", - "33255": "US4964400", - "33256": "US4964400", - "33257": "US4964400", - "33261": "US4964400", - "33265": "US4964400", - "33266": "US4964400", - "33269": "US4964400", - "33280": "US4964400", - "33283": "US4964400", - "33296": "US4964400", - "33299": "US4964400", - "34420": "US49", - "34421": "US49", - "34423": "US4964400", - "34428": "US4964400", - "34429": "US4964400", - "34430": "US49", - "34431": "US49", - "34432": "US49", - "34433": "US4964400", - "34434": "US4964400", - "34436": "US4964400", - "34442": "US4964400", - "34445": "US4964400", - "34446": "US4964400", - "34447": "US4964400", - "34448": "US4964400", - "34449": "US49", - "34450": "US4964400", - "34451": "US4964400", - "34452": "US4964400", - "34453": "US4964400", - "34460": "US4964400", - "34461": "US4964400", - "34464": "US4964400", - "34465": "US4964400", - "34470": "US49", - "34471": "US49", - "34472": "US49", - "34473": "US49", - "34474": "US49", - "34475": "US49", - "34476": "US49", - "34477": "US49", - "34478": "US49", - "34479": "US49", - "34480": "US49", - "34481": "US49", - "34482": "US49", - "34483": "US49", - "34484": "US4964400", - "34487": "US4964400", - "34488": "US49", - "34489": "US49", - "34491": "US49", - "34492": "US49", - "34498": "US49", - "75701": "US66", - "75702": "US66", - "75703": "US66", - "75704": "US66", - "75705": "US66", - "75706": "US66", - "75707": "US66", - "75708": "US66", - "75709": "US66", - "75710": "US66", - "75711": "US66", - "75712": "US66", - "75713": "US66", - "75750": "US66", - "75751": "US66", - "75752": "US66", - "75754": "US66", - "75755": "US66", - "75756": "US66", - "75757": "US66", - "75758": "US66", - "75759": "US66", - "75760": "US68", - "75762": "US66", - "75763": "US66", - "75764": "US66", - "75765": "US66", - "75766": "US66", - "75770": "US66", - "75771": "US66", - "75772": "US66", - "75773": "US66", - "75778": "US66", - "75779": "US66", - "75780": "US66", - "75782": "US66", - "75783": "US66", - "75784": "US66", - "75785": "US66", - "75788": "US68", - "75789": "US66", - "75790": "US66", - "75791": "US66", - "75792": "US66", - "75797": "US66", - "75798": "US66", - "75799": "US66", - "75801": "US66", - "75802": "US66", - "75803": "US66", - "75831": "US68", - "75832": "US66", - "75833": "US68", - "75834": "US68", - "75835": "US68", - "75838": "US66", - "75839": "US66", - "75840": "US66", - "75844": "US68", - "75845": "US68", - "75846": "US68", - "75847": "US68", - "75848": "US66", - "75849": "US68", - "75850": "US68", - "75851": "US68", - "75852": "US68", - "75853": "US66", - "75855": "US68", - "75856": "US68", - "75858": "US68", - "75859": "US66", - "75860": "US66", - "75861": "US66", - "75862": "US68", - "75865": "US68", - "75880": "US66", - "75882": "US66", - "75884": "US66", - "75886": "US66", - "75901": "US68", - "75902": "US68", - "75903": "US68", - "75904": "US68", - "75915": "US68", - "75925": "US66", - "75926": "US68", - "75928": "US68", - "75929": "US68", - "75930": "US68", - "75931": "US68", - "75932": "US68", - "75933": "US68", - "75934": "US68", - "75935": "US68", - "75936": "US68", - "75937": "US68", - "75938": "US68", - "75939": "US68", - "75941": "US68", - "75942": "US68", - "75943": "US68", - "75944": "US68", - "75946": "US68", - "75948": "US68", - "75949": "US68", - "75951": "US68", - "75954": "US68", - "75956": "US68", - "75958": "US68", - "75959": "US68", - "75960": "US68", - "75961": "US68", - "75962": "US68", - "75963": "US68", - "75964": "US68", - "75965": "US68", - "75966": "US68", - "75968": "US68", - "75969": "US68", - "75972": "US68", - "75973": "US68", - "75974": "US68", - "75975": "US68", - "75976": "US66", - "75977": "US68", - "75978": "US68", - "75979": "US68", - "75980": "US68", - "75990": "US68", - "76501": "US66", - "76502": "US66", - "76503": "US66", - "76504": "US66", - "76505": "US66", - "76508": "US66", - "76511": "US66", - "76513": "US66", - "76518": "US68", - "76519": "US68", - "76520": "US68", - "76522": "US66", - "76523": "US68", - "76524": "US66", - "76525": "US66", - "76526": "US66", - "76527": "US68", - "76528": "US66", - "76530": "US68", - "76531": "US66", - "76533": "US66", - "76534": "US66", - "76537": "US68", - "76538": "US66", - "76539": "US66", - "76540": "US66", - "76541": "US66", - "76542": "US66", - "76543": "US66", - "76544": "US66", - "76547": "US66", - "76548": "US66", - "76549": "US66", - "76550": "US66", - "76554": "US66", - "76556": "US68", - "76557": "US66", - "76558": "US66", - "76559": "US66", - "76561": "US66", - "76564": "US66", - "76565": "US66", - "76566": "US66", - "76567": "US68", - "76569": "US66", - "76570": "US66", - "76571": "US66", - "76573": "US68", - "76574": "US68", - "76577": "US68", - "76578": "US68", - "76579": "US66", - "76596": "US66", - "76597": "US66", - "76598": "US66", - "76599": "US66", - "76621": "US66", - "76622": "US66", - "76623": "US66", - "76624": "US66", - "76626": "US66", - "76627": "US66", - "76628": "US66", - "76629": "US68", - "76630": "US66", - "76631": "US66", - "76632": "US66", - "76633": "US66", - "76634": "US66", - "76635": "US66", - "76636": "US66", - "76637": "US66", - "76638": "US66", - "76639": "US66", - "76640": "US66", - "76641": "US66", - "76642": "US66", - "76643": "US66", - "76644": "US66", - "76645": "US66", - "76648": "US66", - "76649": "US66", - "76650": "US66", - "76651": "US66", - "76652": "US66", - "76653": "US66", - "76654": "US66", - "76655": "US66", - "76656": "US66", - "76657": "US66", - "76660": "US66", - "76661": "US66", - "76664": "US66", - "76665": "US66", - "76666": "US66", - "76667": "US66", - "76670": "US66", - "76671": "US66", - "76673": "US66", - "76676": "US66", - "76678": "US66", - "76679": "US66", - "76680": "US66", - "76681": "US66", - "76682": "US66", - "76684": "US66", - "76685": "US66", - "76686": "US66", - "76687": "US66", - "76689": "US66", - "76690": "US66", - "76691": "US66", - "76692": "US66", - "76693": "US66", - "76801": "US66", - "76802": "US66", - "76803": "US66", - "76804": "US66", - "76820": "US66", - "76821": "US66", - "76823": "US66", - "76824": "US66", - "76825": "US66", - "76827": "US66", - "76828": "US66", - "76831": "US66", - "76832": "US66", - "76834": "US66", - "76836": "US66", - "76837": "US66", - "76841": "US66", - "76842": "US66", - "76844": "US66", - "76845": "US66", - "76848": "US66", - "76849": "US66", - "76852": "US66", - "76853": "US66", - "76854": "US66", - "76855": "US66", - "76856": "US66", - "76857": "US66", - "76858": "US66", - "76859": "US66", - "76861": "US66", - "76862": "US66", - "76864": "US66", - "76865": "US66", - "76866": "US66", - "76869": "US66", - "76870": "US66", - "76871": "US66", - "76872": "US66", - "76873": "US66", - "76874": "US66", - "76875": "US66", - "76877": "US66", - "76878": "US66", - "76880": "US66", - "76882": "US66", - "76883": "US68", - "76884": "US66", - "76885": "US66", - "76886": "US66", - "76887": "US66", - "76888": "US66", - "76890": "US66", - "76901": "US66", - "76902": "US66", - "76903": "US66", - "76904": "US66", - "76905": "US66", - "76906": "US66", - "76908": "US66", - "76909": "US66", - "76930": "US66", - "76932": "US66", - "76933": "US66", - "76934": "US66", - "76935": "US66", - "76936": "US66", - "76937": "US66", - "76939": "US66", - "76940": "US66", - "76941": "US66", - "76943": "US66", - "76945": "US66", - "76949": "US66", - "76950": "US66", - "76951": "US66", - "76953": "US66", - "76955": "US66", - "76957": "US66", - "76958": "US66", - "78602": "US68", - "78604": "US68", - "78605": "US66", - "78606": "US68", - "78607": "US66", - "78608": "US66", - "78609": "US66", - "78610": "US68", - "78611": "US66", - "78612": "US68", - "78613": "US68", - "78614": "US68", - "78615": "US68", - "78616": "US68", - "78617": "US68", - "78618": "US68", - "78619": "US68", - "78620": "US68", - "78621": "US68", - "78622": "US68", - "78623": "US68", - "78624": "US68", - "78626": "US68", - "78627": "US68", - "78628": "US68", - "78629": "US68", - "78630": "US68", - "78631": "US68", - "78632": "US68", - "78633": "US68", - "78634": "US68", - "78635": "US68", - "78636": "US68", - "78638": "US68", - "78639": "US66", - "78640": "US68", - "78641": "US68", - "78642": "US68", - "78643": "US66", - "78644": "US68", - "78645": "US68", - "78646": "US68", - "78648": "US68", - "78650": "US68", - "78651": "US68", - "78652": "US68", - "78653": "US68", - "78654": "US66", - "78655": "US68", - "78656": "US68", - "78657": "US66", - "78658": "US68", - "78659": "US68", - "78660": "US68", - "78661": "US68", - "78662": "US68", - "78663": "US68", - "78664": "US68", - "78665": "US68", - "78666": "US68", - "78667": "US68", - "78669": "US68", - "78670": "US68", - "78671": "US68", - "78672": "US66", - "78673": "US68", - "78674": "US68", - "78675": "US68", - "78676": "US68", - "78677": "US68", - "78680": "US68", - "78681": "US68", - "78682": "US68", - "78683": "US68", - "78691": "US68", - "78801": "US68", - "78802": "US68", - "78827": "US68", - "78828": "US68", - "78829": "US68", - "78830": "US68", - "78832": "US68", - "78833": "US68", - "78834": "US68", - "78836": "US68", - "78837": "US68", - "78838": "US68", - "78839": "US68", - "78840": "US68", - "78841": "US68", - "78842": "US68", - "78843": "US68", - "78847": "US68", - "78850": "US68", - "78851": "US66", - "78852": "US68", - "78853": "US68", - "78860": "US68", - "78861": "US68", - "78870": "US68", - "78871": "US68", - "78872": "US68", - "78873": "US68", - "78877": "US68", - "78879": "US68", - "78880": "US68", - "78881": "US68", - "78883": "US68", - "78884": "US68", - "78885": "US68", - "78886": "US68", - "92301": "US88", - "92304": "US88", - "92305": "US88", - "92307": "US88", - "92308": "US88", - "92309": "US88", - "92310": "US88", - "92311": "US88", - "92312": "US88", - "92313": "US88", - "92314": "US88", - "92315": "US88", - "92316": "US88", - "92317": "US88", - "92318": "US88", - "92321": "US88", - "92322": "US88", - "92323": "US88", - "92324": "US88", - "92325": "US88", - "92326": "US88", - "92327": "US88", - "92328": "US87", - "92329": "US88", - "92331": "US88", - "92332": "US88", - "92333": "US88", - "92334": "US88", - "92335": "US88", - "92336": "US88", - "92337": "US88", - "92338": "US88", - "92339": "US88", - "92340": "US88", - "92341": "US88", - "92342": "US88", - "92344": "US88", - "92345": "US88", - "92346": "US88", - "92347": "US88", - "92350": "US88", - "92352": "US88", - "92354": "US88", - "92356": "US88", - "92357": "US88", - "92358": "US88", - "92359": "US88", - "92363": "US88", - "92364": "US88", - "92365": "US88", - "92366": "US88", - "92368": "US88", - "92369": "US88", - "92371": "US88", - "92372": "US88", - "92373": "US88", - "92374": "US88", - "92375": "US88", - "92376": "US88", - "92377": "US88", - "92378": "US88", - "92382": "US88", - "92384": "US87", - "92385": "US88", - "92386": "US88", - "92389": "US87", - "92391": "US88", - "92392": "US88", - "92393": "US88", - "92394": "US88", - "92395": "US88", - "92397": "US88", - "92398": "US88", - "92399": "US88", - "93201": "US87", - "93202": "US87", - "93203": "US88", - "93204": "US87", - "93205": "US88", - "93206": "US88", - "93207": "US87", - "93208": "US87", - "93210": "US87", - "93212": "US87", - "93215": "US88", - "93216": "US88", - "93218": "US87", - "93219": "US87", - "93220": "US88", - "93221": "US87", - "93222": "US88", - "93223": "US87", - "93224": "US88", - "93225": "US88", - "93226": "US88", - "93227": "US87", - "93230": "US87", - "93232": "US87", - "93234": "US87", - "93235": "US87", - "93237": "US87", - "93238": "US88", - "93239": "US87", - "93240": "US88", - "93241": "US88", - "93242": "US87", - "93243": "US88", - "93244": "US87", - "93245": "US87", - "93246": "US87", - "93247": "US87", - "93249": "US88", - "93250": "US88", - "93251": "US88", - "93252": "US88", - "93255": "US88", - "93256": "US87", - "93257": "US87", - "93258": "US87", - "93260": "US87", - "93261": "US87", - "93262": "US87", - "93263": "US88", - "93265": "US87", - "93267": "US87", - "93268": "US88", - "93270": "US87", - "93271": "US87", - "93272": "US87", - "93274": "US87", - "93275": "US87", - "93276": "US88", - "93277": "US87", - "93278": "US87", - "93279": "US87", - "93280": "US88", - "93282": "US87", - "93283": "US88", - "93285": "US88", - "93286": "US87", - "93287": "US88", - "93290": "US87", - "93291": "US87", - "93292": "US87", - "93501": "US88", - "93502": "US88", - "93504": "US88", - "93505": "US88", - "93510": "US88", - "93512": "US87", - "93513": "US87", - "93514": "US87", - "93515": "US87", - "93516": "US88", - "93517": "US87", - "93518": "US88", - "93519": "US88", - "93522": "US87", - "93523": "US88", - "93524": "US88", - "93526": "US87", - "93527": "US88", - "93528": "US88", - "93529": "US87", - "93530": "US87", - "93531": "US88", - "93532": "US88", - "93534": "US88", - "93535": "US88", - "93536": "US88", - "93539": "US88", - "93541": "US87", - "93542": "US87", - "93543": "US88", - "93544": "US88", - "93545": "US87", - "93546": "US87", - "93549": "US87", - "93550": "US88", - "93551": "US88", - "93552": "US88", - "93553": "US88", - "93554": "US88", - "93555": "US88", - "93556": "US88", - "93558": "US88", - "93560": "US88", - "93561": "US88", - "93562": "US88", - "93563": "US88", - "93581": "US88", - "93584": "US88", - "93586": "US88", - "93590": "US88", - "93591": "US88", - "93592": "US88", - "93596": "US88", - "93599": "US88", -} From 06d58221859fc48e7093cdedcf8d5df9aa2cc0db Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 25 Feb 2025 17:24:33 +0000 Subject: [PATCH 02/13] Revert "remove ghcimport" This reverts commit 9d928229391781d19d8f8a60843fff88104597e7. --- .../ghcimport/fixtures/re_services_data.sql | 53 + .../ghcimport/fixtures/stage_ghc_pricing.sql | 968 ++++++++++++++++++ .../ghcimport/ghc_rateengine_importer.go | 78 ++ .../ghcimport/ghc_rateengine_importer_test.go | 82 ++ pkg/services/ghcimport/import_re_contract.go | 48 + .../ghcimport/import_re_contract_test.go | 63 ++ .../ghcimport/import_re_contract_years.go | 58 ++ .../import_re_contract_years_test.go | 78 ++ .../import_re_domestic_accessorial_prices.go | 77 ++ ...ort_re_domestic_accessorial_prices_test.go | 91 ++ .../import_re_domestic_linehaul_prices.go | 80 ++ ...import_re_domestic_linehaul_prices_test.go | 79 ++ .../import_re_domestic_other_prices.go | 199 ++++ .../import_re_domestic_other_prices_test.go | 120 +++ .../import_re_domestic_service_area.go | 259 +++++ .../import_re_domestic_service_area_prices.go | 80 ++ ...rt_re_domestic_service_area_prices_test.go | 125 +++ .../import_re_domestic_service_area_test.go | 165 +++ .../import_re_intl_accessorial_prices.go | 76 ++ .../import_re_intl_accessorial_prices_test.go | 90 ++ .../ghcimport/import_re_intl_other_prices.go | 84 ++ .../import_re_intl_other_prices_test.go | 102 ++ .../ghcimport/import_re_intl_prices.go | 388 +++++++ .../ghcimport/import_re_intl_prices_test.go | 188 ++++ pkg/services/ghcimport/import_re_rate_area.go | 261 +++++ .../ghcimport/import_re_rate_area_test.go | 223 ++++ .../import_re_shipment_type_prices.go | 74 ++ .../import_re_shipment_type_prices_test.go | 66 ++ .../ghcimport/import_re_task_order_fees.go | 94 ++ .../import_re_task_order_fees_test.go | 83 ++ pkg/services/ghcimport/load_service_map.go | 25 + .../ghcimport/load_service_map_test.go | 31 + .../map_zip_codes_to_re_rate_areas.go | 95 ++ .../map_zip_codes_to_re_rate_areas_test.go | 140 +++ pkg/services/ghcimport/shared.go | 107 ++ pkg/services/ghcimport/shared_test.go | 219 ++++ .../ghcimport/zip3_to_rate_area_mappings.go | 913 +++++++++++++++++ .../ghcimport/zip5_to_rate_area_mappings.go | 927 +++++++++++++++++ 38 files changed, 6889 insertions(+) create mode 100644 pkg/services/ghcimport/fixtures/re_services_data.sql create mode 100644 pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql create mode 100644 pkg/services/ghcimport/ghc_rateengine_importer.go create mode 100644 pkg/services/ghcimport/ghc_rateengine_importer_test.go create mode 100644 pkg/services/ghcimport/import_re_contract.go create mode 100644 pkg/services/ghcimport/import_re_contract_test.go create mode 100644 pkg/services/ghcimport/import_re_contract_years.go create mode 100644 pkg/services/ghcimport/import_re_contract_years_test.go create mode 100644 pkg/services/ghcimport/import_re_domestic_accessorial_prices.go create mode 100644 pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_domestic_linehaul_prices.go create mode 100644 pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_domestic_other_prices.go create mode 100644 pkg/services/ghcimport/import_re_domestic_other_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_domestic_service_area.go create mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_prices.go create mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_test.go create mode 100644 pkg/services/ghcimport/import_re_intl_accessorial_prices.go create mode 100644 pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_intl_other_prices.go create mode 100644 pkg/services/ghcimport/import_re_intl_other_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_intl_prices.go create mode 100644 pkg/services/ghcimport/import_re_intl_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_rate_area.go create mode 100644 pkg/services/ghcimport/import_re_rate_area_test.go create mode 100644 pkg/services/ghcimport/import_re_shipment_type_prices.go create mode 100644 pkg/services/ghcimport/import_re_shipment_type_prices_test.go create mode 100644 pkg/services/ghcimport/import_re_task_order_fees.go create mode 100644 pkg/services/ghcimport/import_re_task_order_fees_test.go create mode 100644 pkg/services/ghcimport/load_service_map.go create mode 100644 pkg/services/ghcimport/load_service_map_test.go create mode 100644 pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go create mode 100644 pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go create mode 100644 pkg/services/ghcimport/shared.go create mode 100644 pkg/services/ghcimport/shared_test.go create mode 100644 pkg/services/ghcimport/zip3_to_rate_area_mappings.go create mode 100644 pkg/services/ghcimport/zip5_to_rate_area_mappings.go diff --git a/pkg/services/ghcimport/fixtures/re_services_data.sql b/pkg/services/ghcimport/fixtures/re_services_data.sql new file mode 100644 index 00000000000..9e1d3ae23f7 --- /dev/null +++ b/pkg/services/ghcimport/fixtures/re_services_data.sql @@ -0,0 +1,53 @@ +INSERT INTO re_services +(id, code, name, created_at, updated_at) +VALUES +('9dc919da-9b66-407b-9f17-05c0f03fcb50', 'CS', 'Counseling', now(), now()), +('2471cc2d-6ed5-4ecc-9d43-db9711c8645b', 'DBHF', 'Domestic haul away boat factor', now(), now()), +('0e45b6f5-f2f5-4235-94e4-7b4cb899eb5d', 'DBTF', 'Domestic tow away boat factor', now(), now()), +('68417bd7-4a9d-4472-941e-2ba6aeaf15f4', 'DCRT', 'Domestic crating', now(), now()), +('84d53f9a-ad54-4d79-87ad-68a5e7af6912', 'DCRTSA', 'Domestic crating - standalone', now(), now()), +('a0ead168-7469-4cb6-bc5b-2ebef5a38f92', 'DDASIT', 'Domestic destination add''l SIT', now(), now()), +('5c80f3b5-548e-4077-9b8e-8d0390e73668', 'DDDSIT', 'Domestic destination SIT delivery', now(), now()), +('d0561c49-e1a9-40b8-a739-3e639a9d77af', 'DDFSIT', 'Domestic destination 1st day SIT', now(), now()), +('50f1179a-3b72-4fa1-a951-fe5bcc70bd14', 'DDP', 'Domestic destination price', now(), now()), +('556663e3-675a-4b06-8da3-e4f1e9a9d3cd', 'DDSHUT', 'Domestic destination shuttle service', now(), now()), +('8d600f25-1def-422d-b159-617c7d59156e', 'DLH', 'Domestic linehaul', now(), now()), +('dbd3a39a-6bb9-42da-b81a-9229df7019cf', 'DMHF', 'Domestic mobile home factor', now(), now()), +('3cc83af7-ecb9-4b33-bbc6-ff1459f001e2', 'DNPK', 'Domestic NTS packing', now(), now()), +('05eb6ff1-5cf6-4918-b887-8260dda6b9fe', 'DOASIT', 'Domestic origin add''l SIT', now(), now()), +('998beda7-e390-4a83-b15e-578a24326937', 'DOFSIT', 'Domestic origin 1st day SIT', now(), now()), +('2bc3e5cb-adef-46b1-bde9-55570bfdd43e', 'DOP', 'Domestic origin price', now(), now()), +('d1a4f062-0ca3-4387-8f8e-3dd20493d0b7', 'DOPSIT', 'Domestic origin SIT pickup', now(), now()), +('d979e8af-501a-44bb-8532-2799753a5810', 'DOSHUT', 'Domestic origin shuttle service', now(), now()), +('bdea5a8d-f15f-47d2-85c9-bba5694802ce', 'DPK', 'Domestic packing', now(), now()), +('4b85962e-25d3-4485-b43c-2497c4365598', 'DSH', 'Domestic shorthaul', now(), now()), +('fc14935b-ebd3-4df3-940b-f30e71b6a56c', 'DUCRT', 'Domestic uncrating', now(), now()), +('15f01bc1-0754-4341-8e0f-25c8f04d5a77', 'DUPK', 'Domestic unpacking', now(), now()), +('4780b30c-e846-437a-b39a-c499a6b09872', 'FSC', 'Fuel surcharge', now(), now()), +('387b9654-5685-4ac9-b213-81962be9c145', 'IBHF', 'International haul away boat factor', now(), now()), +('20998cfd-bfc7-410b-a3c5-d709ead4f94e', 'IBTF', 'International tow away boat factor', now(), now()), +('07051352-4715-49b5-88e7-045b7541919d', 'ICOLH', 'International C->O shipping & LH', now(), now()), +('16949697-6171-47aa-bcd4-479995cc5206', 'ICOUB', 'International C->O UB', now(), now()), +('86203d72-7f7c-49ff-82f0-5b95e4958f60', 'ICRT', 'International crating', now(), now()), +('021791b8-26ca-4494-a3d1-6945e4dde387', 'ICRTSA', 'International crating - standalone', now(), now()), +('806c6d59-57ff-4a3f-9518-ebf29ba9cb10', 'IDASIT', 'International destination add''l day SIT', now(), now()), +('28389ee1-56cf-400c-aa52-1501ecdd7c69', 'IDDSIT', 'International destination SIT delivery', now(), now()), +('bd6064ca-e780-4ab4-a37b-0ae98eebb244', 'IDFSIT', 'International destination 1st day SIT', now(), now()), +('22fc07ed-be15-4f50-b941-cbd38153b378', 'IDSHUT', 'International destination shuttle service', now(), now()), +('67ba1eaf-6ffd-49de-9a69-497be7789877', 'IHPK', 'International HHG pack', now(), now()), +('56e91c2d-015d-4243-9657-3ed34867abaa', 'IHUPK', 'International HHG unpack', now(), now()), +('874cb86a-bc39-4f57-a614-53ee3fcacf14', 'INPK', 'International NTS packing', now(), now()), +('bd424e45-397b-4766-9712-de4ae3a2da36', 'IOASIT', 'International origin add''l day SIT', now(), now()), +('d0bb2cae-838a-4fc7-8efc-f7c6ad57431d', 'IOCLH', 'International O->C shipping & LH', now(), now()), +('7f14f357-f2ae-42b9-b834-5ab24c2cd2af', 'IOCUB', 'International O->C UB', now(), now()), +('b488bf85-ea5e-49c8-ba5c-e2fa278ac806', 'IOFSIT', 'International origin 1st day SIT', now(), now()), +('56bb94cd-f160-4239-a028-b31ffc641eb7', 'IOOLH', 'International O->O shipping & LH', now(), now()), +('133bc44a-2c0f-4ff9-a61d-9f2dad349d14', 'IOOUB', 'International O->O UB', now(), now()), +('6f4f6e31-0675-4051-b659-89832259f390', 'IOPSIT', 'International origin SIT pickup', now(), now()), +('624a97c5-dfbf-4da9-a6e9-526b4f95af8d', 'IOSHUT', 'International origin shuttle service', now(), now()), +('ae84d292-f885-4138-86e2-b451855ffbf2', 'IUBPK', 'International UB pack', now(), now()), +('f2739142-97d1-40f3-a8f4-6a9daf390806', 'IUBUPK', 'International UB unpack', now(), now()), +('4132416b-b1aa-42e7-98f2-0ac0a03e8a31', 'IUCRT', 'International uncrating', now(), now()), +('1130e612-94eb-49a7-973d-72f33685e551', 'MS', 'Move management', now(), now()), +('7e1c4f99-0054-4fac-a302-1a07a1daf58e', 'NSTH', 'Nonstandard HHG', now(), now()), +('a68fa051-b09d-43f3-8290-f56fc89a4fe8', 'NSTUB', 'Nonstandard UB', now(), now()); diff --git a/pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql b/pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql new file mode 100644 index 00000000000..dfc2830e8f7 --- /dev/null +++ b/pkg/services/ghcimport/fixtures/stage_ghc_pricing.sql @@ -0,0 +1,968 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 10.9 (Debian 10.9-1.pgdg90+1) +-- Dumped by pg_dump version 11.5 + + +-- +-- Name: stage_conus_to_oconus_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_conus_to_oconus_prices; +CREATE TABLE public.stage_conus_to_oconus_prices ( + origin_domestic_price_area_code text NOT NULL, + origin_domestic_price_area text NOT NULL, + destination_intl_price_area_id text NOT NULL, + destination_intl_price_area text NOT NULL, + season text NOT NULL, + hhg_shipping_linehaul_price text NOT NULL, + ub_price text NOT NULL +); + + +-- +-- Name: stage_counseling_services_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_counseling_services_prices; +CREATE TABLE public.stage_counseling_services_prices ( + contract_year text NOT NULL, + price_per_task_order text NOT NULL +); + + +-- +-- Name: stage_domestic_international_additional_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_domestic_international_additional_prices; +CREATE TABLE public.stage_domestic_international_additional_prices ( + market text NOT NULL, + shipment_type text NOT NULL, + factor text NOT NULL +); + + +-- +-- Name: stage_domestic_linehaul_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_domestic_linehaul_prices; +CREATE TABLE public.stage_domestic_linehaul_prices ( + service_area_number text NOT NULL, + origin_service_area text NOT NULL, + services_schedule text NOT NULL, + season text NOT NULL, + weight_lower text NOT NULL, + weight_upper text NOT NULL, + miles_lower text NOT NULL, + miles_upper text NOT NULL, + escalation_number text NOT NULL, + rate text NOT NULL +); + + +-- +-- Name: stage_domestic_move_accessorial_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_domestic_move_accessorial_prices; +CREATE TABLE public.stage_domestic_move_accessorial_prices ( + services_schedule text NOT NULL, + service_provided text NOT NULL, + price_per_unit text NOT NULL +); + + +-- +-- Name: stage_domestic_service_area_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_domestic_service_area_prices; +CREATE TABLE public.stage_domestic_service_area_prices ( + service_area_number text NOT NULL, + service_area_name text NOT NULL, + services_schedule text NOT NULL, + sit_pickup_delivery_schedule text NOT NULL, + season text NOT NULL, + shorthaul_price text NOT NULL, + origin_destination_price text NOT NULL, + origin_destination_sit_first_day_warehouse text NOT NULL, + origin_destination_sit_addl_days text NOT NULL +); + + +-- +-- Name: stage_domestic_service_areas; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_domestic_service_areas; +CREATE TABLE public.stage_domestic_service_areas ( + base_point_city text NOT NULL, + state text NOT NULL, + service_area_number text NOT NULL, + zip3s text NOT NULL +); + + +-- +-- Name: stage_domestic_other_pack_prices; Type: TABLE; Schema: public; Owner: - +-- +DROP TABLE IF EXISTS public.stage_domestic_other_pack_prices; +CREATE TABLE public.stage_domestic_other_pack_prices ( + services_schedule text NOT NULL, + service_provided text NOT NULL, + non_peak_price_per_cwt text NOT NULL, + peak_price_per_cwt text NOT NULL +); + + +-- +-- Name: stage_domestic_other_sit_prices; Type: TABLE; Schema: public; Owner: - +-- +DROP TABLE IF EXISTS public.stage_domestic_other_sit_prices; +CREATE TABLE public.stage_domestic_other_sit_prices ( + sit_pickup_delivery_schedule text NOT NULL, + service_provided text NOT NULL, + non_peak_price_per_cwt text NOT NULL, + peak_price_per_cwt text NOT NULL +); + + +-- +-- Name: stage_international_move_accessorial_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_international_move_accessorial_prices; +CREATE TABLE public.stage_international_move_accessorial_prices ( + market text NOT NULL, + service_provided text NOT NULL, + price_per_unit text NOT NULL +); + + +-- +-- Name: stage_international_service_areas; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_international_service_areas; +CREATE TABLE public.stage_international_service_areas ( + rate_area text NOT NULL, + rate_area_id text NOT NULL +); + + +-- +-- Name: stage_non_standard_locn_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_non_standard_locn_prices; +CREATE TABLE public.stage_non_standard_locn_prices ( + origin_id text NOT NULL, + origin_area text NOT NULL, + destination_id text NOT NULL, + destination_area text NOT NULL, + move_type text NOT NULL, + season text NOT NULL, + hhg_price text NOT NULL, + ub_price text NOT NULL +); + + +-- +-- Name: stage_oconus_to_conus_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_oconus_to_conus_prices; +CREATE TABLE public.stage_oconus_to_conus_prices ( + origin_intl_price_area_id text NOT NULL, + origin_intl_price_area text NOT NULL, + destination_domestic_price_area_area text NOT NULL, + destination_domestic_price_area text NOT NULL, + season text NOT NULL, + hhg_shipping_linehaul_price text NOT NULL, + ub_price text NOT NULL +); + + +-- +-- Name: stage_oconus_to_oconus_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_oconus_to_oconus_prices; +CREATE TABLE public.stage_oconus_to_oconus_prices ( + origin_intl_price_area_id text NOT NULL, + origin_intl_price_area text NOT NULL, + destination_intl_price_area_id text NOT NULL, + destination_intl_price_area text NOT NULL, + season text NOT NULL, + hhg_shipping_linehaul_price text NOT NULL, + ub_price text NOT NULL +); + + +-- +-- Name: stage_other_intl_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_other_intl_prices; +CREATE TABLE public.stage_other_intl_prices ( + rate_area_code text NOT NULL, + rate_area_name text NOT NULL, + hhg_origin_pack_price text NOT NULL, + hhg_destination_unpack_price text NOT NULL, + ub_origin_pack_price text NOT NULL, + ub_destination_unpack_price text NOT NULL, + origin_destination_sit_first_day_warehouse text NOT NULL, + origin_destination_sit_addl_days text NOT NULL, + sit_lte_50_miles text NOT NULL, + sit_gt_50_miles text NOT NULL, + season text NOT NULL +); + + +-- +-- Name: stage_price_escalation_discounts; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_price_escalation_discounts; +CREATE TABLE public.stage_price_escalation_discounts ( + contract_year text NOT NULL, + forecasting_adjustment text NOT NULL, + discount text NOT NULL, + price_escalation text NOT NULL +); + + +-- +-- Name: stage_shipment_management_services_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_shipment_management_services_prices; +CREATE TABLE public.stage_shipment_management_services_prices ( + contract_year text NOT NULL, + price_per_task_order text NOT NULL +); + + +-- +-- Name: stage_transition_prices; Type: TABLE; Schema: public; Owner: - +-- + +DROP TABLE IF EXISTS public.stage_transition_prices; +CREATE TABLE public.stage_transition_prices ( + contract_year text NOT NULL, + price_total_cost text NOT NULL +); + + +-- +-- Data for Name: stage_conus_to_oconus_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$16.05', '$44.74'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$18.94', '$52.79'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'GE', 'Germany', 'NonPeak', '$24.38', '$31.40'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'GE', 'Germany', 'Peak', '$28.77', '$37.05'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$27.63', '$34.11'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US16', 'Connecticut', 'US8101000', 'Alaska (Zone) I', 'Peak', '$32.60', '$40.25'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$30.90', '$33.98'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$36.46', '$40.10'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'GE', 'Germany', 'NonPeak', '$17.57', '$44.91'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'GE', 'Germany', 'Peak', '$20.73', '$52.99'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$24.38', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US47', 'Alabama', 'US8101000', 'Alaska (Zone) I', 'Peak', '$28.77', '$38.28'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$32.60', '$38.28'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'GE', 'Germany', 'NonPeak', '$16.05', '$34.33'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'GE', 'Germany', 'Peak', '$18.94', '$40.51'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$17.57', '$44.74'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'US8101000', 'Alaska (Zone) I', 'Peak', '$20.73', '$52.79'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$16.05', '$31.29'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$18.94', '$36.92'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'GE', 'Germany', 'NonPeak', '$24.38', '$34.45'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'GE', 'Germany', 'Peak', '$28.77', '$40.65'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$27.63', '$44.91'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US68', 'Texas-South', 'US8101000', 'Alaska (Zone) I', 'Peak', '$32.60', '$52.99'); + +-- Data for Test_mapZipCodesToReRateAreas +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US34', 'Ohio', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$16.05', '$44.74'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US49', 'Florida', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US4964400', 'Florida', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US51', 'North Dakota', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$30.90', '$33.98'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US56', 'Missouri', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US66', 'Texas', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US87', 'California', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); +INSERT INTO public.stage_conus_to_oconus_prices (origin_domestic_price_area_code, origin_domestic_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US88', 'California', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$27.63', '$32.44'); + +-- +-- Data for Name: stage_counseling_services_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 1', '222.63'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 2', '223.53'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 3', '224.69'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 1', '224.88'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 2', '226.77'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 1', '227.59'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 2', '227.99'); +INSERT INTO public.stage_counseling_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 3', '228.17'); + + +-- +-- Data for Name: stage_domestic_international_additional_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'Mobile Homes', '1.20'); +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'Tow Away Boat Service', '1.10'); +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'Haul Away Boat Service', '1.30'); +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('OCONUS', 'Tow Away Boat Service', '1.32'); +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('OCONUS', 'Haul Away Boat Service', '1.40'); +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('CONUS', 'NTS Packing Factor', '1.32'); +INSERT INTO public.stage_domestic_international_additional_prices (market, shipment_type, factor) VALUES ('OCONUS', 'NTS Packing Factor', '1.45'); + + +-- +-- Data for Name: stage_domestic_linehaul_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '0', '250', '0', '$2.477'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '251', '500', '0', '$2.727'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '501', '1000', '0', '$3.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.728'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '1501', '2000', '0', '$4.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.728'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '2501', '3000', '0', '$5.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '3001', '3500', '0', '$5.728'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '3501', '4000', '0', '$6.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '500', '4999', '4001', '999999', '0', '$27.132'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.705'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.955'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '501', '1000', '0', '$5.455'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.955'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$6.455'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.956'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$7.456'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$7.956'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$8.456'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$29.360'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '0', '250', '0', '$11.389'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '251', '500', '0', '$11.639'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '501', '1000', '0', '$12.139'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$12.639'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$13.139'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$13.639'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$14.139'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$14.640'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$15.140'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$36.044'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '0', '250', '0', '$2.583'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '251', '500', '0', '$2.843'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '501', '1000', '0', '$3.365'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '1001', '1500', '0', '$3.886'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '1501', '2000', '0', '$4.408'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '2001', '2500', '0', '$4.929'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '2501', '3000', '0', '$5.450'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '3001', '3500', '0', '$5.972'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '3501', '4000', '0', '$6.493'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '500', '4999', '4001', '999999', '0', '$28.287'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '0', '250', '0', '$4.905'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '251', '500', '0', '$5.166'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '501', '1000', '0', '$5.687'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '1001', '1500', '0', '$6.209'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '1501', '2000', '0', '$6.730'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '2001', '2500', '0', '$7.252'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '2501', '3000', '0', '$7.773'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '3001', '3500', '0', '$8.294'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '3501', '4000', '0', '$8.816'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '5000', '9999', '4001', '999999', '0', '$30.610'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '0', '250', '0', '$11.874'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '251', '500', '0', '$12.134'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '501', '1000', '0', '$12.656'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '1001', '1500', '0', '$13.177'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '1501', '2000', '0', '$13.698'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '2001', '2500', '0', '$14.220'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '2501', '3000', '0', '$14.741'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '3001', '3500', '0', '$15.263'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '3501', '4000', '0', '$15.784'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('4.0', 'Birmingham, AL', '2', 'Peak', '10000', '999999', '4001', '999999', '0', '$37.578'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '0', '250', '0', '$2.477'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '251', '500', '0', '$2.727'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '501', '1000', '0', '$3.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.728'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '1501', '2000', '0', '$4.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.728'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '2501', '3000', '0', '$5.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '3001', '3500', '0', '$5.728'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '3501', '4000', '0', '$6.228'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '500', '4999', '4001', '999999', '0', '$27.132'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.705'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.955'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '501', '1000', '0', '$5.455'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.955'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$6.455'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.956'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$7.456'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$7.956'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$8.456'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$29.360'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '0', '250', '0', '$11.389'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '251', '500', '0', '$11.639'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '501', '1000', '0', '$12.139'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$12.639'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$13.139'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$13.639'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$14.139'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$14.640'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$15.140'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$36.044'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '0', '250', '0', '$2.583'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '251', '500', '0', '$2.843'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '501', '1000', '0', '$3.365'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '1001', '1500', '0', '$3.886'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '1501', '2000', '0', '$4.408'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '2001', '2500', '0', '$4.929'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '2501', '3000', '0', '$5.450'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '3001', '3500', '0', '$5.972'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '3501', '4000', '0', '$6.493'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '500', '4999', '4001', '999999', '0', '$28.287'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '0', '250', '0', '$4.905'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '251', '500', '0', '$5.166'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '501', '1000', '0', '$5.687'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '1001', '1500', '0', '$6.209'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '1501', '2000', '0', '$6.730'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '2001', '2500', '0', '$7.252'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '2501', '3000', '0', '$7.773'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '3001', '3500', '0', '$8.294'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '3501', '4000', '0', '$8.816'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '5000', '9999', '4001', '999999', '0', '$30.610'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '0', '250', '0', '$11.874'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '251', '500', '0', '$12.134'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '501', '1000', '0', '$12.656'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '1001', '1500', '0', '$13.177'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '1501', '2000', '0', '$13.698'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '2001', '2500', '0', '$14.220'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '2501', '3000', '0', '$14.741'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '3001', '3500', '0', '$15.263'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '3501', '4000', '0', '$15.784'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('452.0', 'Springfield, MO', '1', 'Peak', '10000', '999999', '4001', '999999', '0', '$37.578'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '0', '250', '0', '$2.161'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '251', '500', '0', '$2.379'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '501', '1000', '0', '$2.815'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.252'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '1501', '2000', '0', '$3.688'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.124'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '2501', '3000', '0', '$4.560'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '3001', '3500', '0', '$4.997'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '3501', '4000', '0', '$5.433'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '500', '4999', '4001', '999999', '0', '$23.669'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.105'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.323'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '501', '1000', '0', '$4.759'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.195'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$5.631'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.068'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$6.504'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$6.940'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$7.376'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$25.612'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '0', '250', '0', '$9.935'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '251', '500', '0', '$10.153'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '501', '1000', '0', '$10.589'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$11.026'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$11.462'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$11.898'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$12.334'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$12.771'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$13.207'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$31.443'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '0', '250', '0', '$2.293'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '251', '500', '0', '$2.524'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '501', '1000', '0', '$2.987'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '1001', '1500', '0', '$3.450'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '1501', '2000', '0', '$3.913'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '2001', '2500', '0', '$4.376'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '2501', '3000', '0', '$4.839'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '3001', '3500', '0', '$5.301'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '3501', '4000', '0', '$5.764'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '500', '4999', '4001', '999999', '0', '$25.112'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '0', '250', '0', '$4.355'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '251', '500', '0', '$4.586'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '501', '1000', '0', '$5.049'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '1001', '1500', '0', '$5.512'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '1501', '2000', '0', '$5.975'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '2001', '2500', '0', '$6.438'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '2501', '3000', '0', '$6.900'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '3001', '3500', '0', '$7.363'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '3501', '4000', '0', '$7.826'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '5000', '9999', '4001', '999999', '0', '$27.174'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '0', '250', '0', '$10.541'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '251', '500', '0', '$10.772'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '501', '1000', '0', '$11.235'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '1001', '1500', '0', '$11.698'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '1501', '2000', '0', '$12.161'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '2001', '2500', '0', '$12.624'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '2501', '3000', '0', '$13.087'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '3001', '3500', '0', '$13.549'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '3501', '4000', '0', '$14.012'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('592.0', 'Dickinson, ND', '3', 'Peak', '10000', '999999', '4001', '999999', '0', '$33.360'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '0', '250', '0', '$2.161'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '251', '500', '0', '$2.379'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '501', '1000', '0', '$2.815'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '1001', '1500', '0', '$3.252'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '1501', '2000', '0', '$3.688'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '2001', '2500', '0', '$4.124'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '2501', '3000', '0', '$4.560'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '3001', '3500', '0', '$4.997'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '3501', '4000', '0', '$5.433'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '500', '4999', '4001', '999999', '0', '$23.669'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '0', '250', '0', '$4.105'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '251', '500', '0', '$4.323'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '501', '1000', '0', '$4.759'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '1001', '1500', '0', '$5.195'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '1501', '2000', '0', '$5.631'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '2001', '2500', '0', '$6.068'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '2501', '3000', '0', '$6.504'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '3001', '3500', '0', '$6.940'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '3501', '4000', '0', '$7.376'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '5000', '9999', '4001', '999999', '0', '$25.612'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '0', '250', '0', '$9.935'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '251', '500', '0', '$10.153'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '501', '1000', '0', '$10.589'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '1001', '1500', '0', '$11.026'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '1501', '2000', '0', '$11.462'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '2001', '2500', '0', '$11.898'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '2501', '3000', '0', '$12.334'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '3001', '3500', '0', '$12.771'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '3501', '4000', '0', '$13.207'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'NonPeak', '10000', '999999', '4001', '999999', '0', '$31.443'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '0', '250', '0', '$2.293'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '251', '500', '0', '$2.524'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '501', '1000', '0', '$2.987'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '1001', '1500', '0', '$3.450'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '1501', '2000', '0', '$3.913'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '2001', '2500', '0', '$4.376'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '2501', '3000', '0', '$4.839'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '3001', '3500', '0', '$5.301'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '3501', '4000', '0', '$5.764'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '500', '4999', '4001', '999999', '0', '$25.112'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '0', '250', '0', '$4.355'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '251', '500', '0', '$4.586'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '501', '1000', '0', '$5.049'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '1001', '1500', '0', '$5.512'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '1501', '2000', '0', '$5.975'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '2001', '2500', '0', '$6.438'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '2501', '3000', '0', '$6.900'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '3001', '3500', '0', '$7.363'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '3501', '4000', '0', '$7.826'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '5000', '9999', '4001', '999999', '0', '$27.174'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '0', '250', '0', '$10.541'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '251', '500', '0', '$10.772'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '501', '1000', '0', '$11.235'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '1001', '1500', '0', '$11.698'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '1501', '2000', '0', '$12.161'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '2001', '2500', '0', '$12.624'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '2501', '3000', '0', '$13.087'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '3001', '3500', '0', '$13.549'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '3501', '4000', '0', '$14.012'); +INSERT INTO public.stage_domestic_linehaul_prices (service_area_number, origin_service_area, services_schedule, season, weight_lower, weight_upper, miles_lower, miles_upper, escalation_number, rate) VALUES ('616.0', 'Columbus, OH', '2', 'Peak', '10000', '999999', '4001', '999999', '0', '$33.360'); + + +-- +-- Data for Name: stage_domestic_move_accessorial_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('1', 'Crating (per cubic ft.)', '23.69'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('2', 'Crating (per cubic ft.)', '23.69'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('3', 'Crating (per cubic ft.)', '23.69'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('1', 'Uncrating (per cubic ft.)', '5.95'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('2', 'Uncrating (per cubic ft.)', '5.95'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('3', 'Uncrating (per cubic ft.)', '5.95'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('1', 'Shuttle Service (per cwt)', '5.05'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('2', 'Shuttle Service (per cwt)', '5.41'); +INSERT INTO public.stage_domestic_move_accessorial_prices (services_schedule, service_provided, price_per_unit) VALUES ('3', 'Shuttle Service (per cwt)', '5.76'); + + +-- +-- Data for Name: stage_domestic_service_area_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('184.0', 'Sanford, FL', '2', '2', 'NonPeak', '$1.27', '$6.89', '$19.31', '$0.68'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('184.0', 'Sanford, FL', '2', '2', 'Peak', '$1.28', '$8.28', '$22.31', '$0.75'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('4.0', 'Birmingham, AL', '2', '2', 'NonPeak', '$1.27', '$6.89', '$19.31', '$0.68'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('4.0', 'Birmingham, AL', '2', '2', 'Peak', '$1.46', '$7.92', '$22.21', '$0.78'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('452.0', 'Springfield, MO', '1', '3', 'NonPeak', '$1.08', '$7.20', '$14.27', '$0.55'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('452.0', 'Springfield, MO', '1', '3', 'Peak', '$1.24', '$8.28', '$16.41', '$0.63'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('592.0', 'Dickinson, ND', '3', '3', 'NonPeak', '$0.16', '$5.81', '$15.97', '$0.62'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('592.0', 'Dickinson, ND', '3', '3', 'Peak', '$0.18', '$6.68', '$18.37', '$0.71'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('616.0', 'Columbus, OH', '2', '2', 'NonPeak', '$2.44', '$9.55', '$15.81', '$0.62'); +INSERT INTO public.stage_domestic_service_area_prices (service_area_number, service_area_name, services_schedule, sit_pickup_delivery_schedule, season, shorthaul_price, origin_destination_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days) VALUES ('616.0', 'Columbus, OH', '2', '2', 'Peak', '$2.81', '$10.98', '$18.18', '$0.71'); + + +-- +-- Data for Name: stage_domestic_service_areas; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Sanford', 'FL', '184', '327.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Birmingham', 'AL', '004', '352.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Butler', 'MO', '452.0', '647.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Carbon Hill', 'AL', '004', '355.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Chulafinnee', 'AL', '004', '362.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Collinsville', 'AL', '004', '359.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Columbus', 'OH', '616.0', '432.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Cumberland', 'OH', '616.0', '437.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Dickinson', 'ND', '592.0', '586.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('La Rue', 'OH', '616.0', '433.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Leeds', 'AL', '004', '350,351'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Neosho', 'MO', '452.0', '648.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('South Bloomfield', 'OH', '616.0', '431.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Springfield', 'MO', '452.0', '656,657,658'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Tuscaloosa', 'AL', '004', '354.0'); +INSERT INTO public.stage_domestic_service_areas (base_point_city, state, service_area_number, zip3s) VALUES ('Worthington', 'OH', '616.0', '430.0'); + + +-- +-- Data for Name: stage_domestic_other_pack_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('1','Packing (per cwt)','$63.33','$65.44'); +INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('2','Packing (per cwt)','$72.50','$73.20'); +INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('3','Packing (per cwt)','$73.95','$80.00'); +INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('1','Unpack (per cwt)','$83.34','$85.44'); +INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('2','Unpack (per cwt)','$5.97','$6.50'); +INSERT INTO public.stage_domestic_other_pack_prices (services_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('3','Unpack (per cwt)','$5.97','$6.50'); + + +-- +-- Data for Name: stage_domestic_other_sit_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_domestic_other_sit_prices (sit_pickup_delivery_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('1','SIT Pickup / Delivery ≤50 miles (per cwt)','$217.96','$220.11'); +INSERT INTO public.stage_domestic_other_sit_prices (sit_pickup_delivery_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('2','SIT Pickup / Delivery ≤50 miles (per cwt)','$234.40','$241.22'); +INSERT INTO public.stage_domestic_other_sit_prices (sit_pickup_delivery_schedule, service_provided, non_peak_price_per_cwt, peak_price_per_cwt) VALUES ('3','SIT Pickup / Delivery ≤50 miles (per cwt)','$246.25','$250.30'); + + +-- +-- Data for Name: stage_international_move_accessorial_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('CONUS', 'Crating (per cubic ft.)', '25.61'); +INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('OCONUS', 'Crating (per cubic ft.)', '28.59'); +INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('CONUS', 'Uncrating (per cubic ft.)', '6.54'); +INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('OCONUS', 'Uncrating (per cubic ft.)', '6.54'); +INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('CONUS', 'Shuttle Service (per cwt)', '145.29'); +INSERT INTO public.stage_international_move_accessorial_prices (market, service_provided, price_per_unit) VALUES ('OCONUS', 'Shuttle Service (per cwt)', '156.23'); + + +-- +-- Data for Name: stage_international_service_areas; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Alaska (Zone) I', 'US8101000'); +INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Germany', 'GE'); +INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('New South Wales/Australian Capital Territory', 'AS11'); +INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Canada Central', 'NSRA2'); +INSERT INTO public.stage_international_service_areas (rate_area, rate_area_id) VALUES ('Pacific Islands', 'NSRA13'); + + +-- +-- Data for Name: stage_non_standard_locn_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'NonPeak', '$9.77', '$44.58'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'Peak', '$11.53', '$52.60'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'NonPeak', '$48.49', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'Peak', '$57.22', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'NonPeak', '$9.77', '$11.66'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA2', 'Canada Central', 'NSRA to NSRA', 'Peak', '$11.53', '$13.76'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'NonPeak', '$48.49', '$12.03'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'NSRA13', 'Pacific Islands', 'NSRA to NSRA', 'Peak', '$57.22', '$14.20'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'NonPeak', '$51.21', '$61.80'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'Peak', '$60.43', '$72.92'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'GE', 'Germany', 'NSRA to OCONUS', 'NonPeak', '$16.05', '$31.29'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'GE', 'Germany', 'NSRA to OCONUS', 'Peak', '$18.94', '$36.92'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'NonPeak', '$15.28', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'Peak', '$18.03', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'NonPeak', '$51.72', '$11.75'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'AS11', 'New South Wales/Australian Capital Territory', 'NSRA to OCONUS', 'Peak', '$61.03', '$13.86'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'GE', 'Germany', 'NSRA to OCONUS', 'NonPeak', '$17.57', '$47.76'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'GE', 'Germany', 'NSRA to OCONUS', 'Peak', '$20.73', '$56.36'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'NonPeak', '$16.80', '$61.92'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US8101000', 'Alaska (Zone) I', 'NSRA to OCONUS', 'Peak', '$19.82', '$73.07'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'NonPeak', '$9.77', '$44.58'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'Peak', '$11.53', '$52.60'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'NonPeak', '$48.49', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'Peak', '$57.22', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'NonPeak', '$48.72', '$10.50'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'Peak', '$57.49', '$12.39'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'NonPeak', '$16.00', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('GE', 'Germany', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'Peak', '$18.88', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'NonPeak', '$51.01', '$44.58'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA2', 'Canada Central', 'OCONUS to NSRA', 'Peak', '$60.19', '$52.60'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'NonPeak', '$71.61', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'NSRA13', 'Pacific Islands', 'OCONUS to NSRA', 'Peak', '$84.50', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US16', 'Connecticut', 'NSRA to CONUS', 'NonPeak', '$47.42', '$44.58'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US16', 'Connecticut', 'NSRA to CONUS', 'Peak', '$55.96', '$52.60'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US47', 'Alabama', 'NSRA to CONUS', 'NonPeak', '$10.83', '$10.25'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US47', 'Alabama', 'NSRA to CONUS', 'Peak', '$12.78', '$12.09'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'NonPeak', '$9.31', '$17.17'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'Peak', '$10.99', '$20.26'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US68', 'Texas-South', 'NSRA to CONUS', 'NonPeak', '$48.49', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA2', 'Canada Central', 'US68', 'Texas-South', 'NSRA to CONUS', 'Peak', '$57.22', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US16', 'Connecticut', 'NSRA to CONUS', 'NonPeak', '$8.88', '$43.94'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US16', 'Connecticut', 'NSRA to CONUS', 'Peak', '$10.48', '$51.85'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US47', 'Alabama', 'NSRA to CONUS', 'NonPeak', '$15.28', '$12.03'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US47', 'Alabama', 'NSRA to CONUS', 'Peak', '$18.03', '$14.20'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'NonPeak', '$18.33', '$44.58'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US4965500', 'Florida Keys', 'NSRA to CONUS', 'Peak', '$21.63', '$52.60'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US68', 'Texas-South', 'NSRA to CONUS', 'NonPeak', '$9.77', '$44.58'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('NSRA13', 'Pacific Islands', 'US68', 'Texas-South', 'NSRA to CONUS', 'Peak', '$11.53', '$52.60'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$10.35', '$11.75'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$12.21', '$13.86'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$51.55', '$47.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US16', 'Connecticut', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$60.83', '$56.56'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$71.89', '$11.66'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$84.83', '$13.76'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$30.90', '$12.03'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US47', 'Alabama', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$36.46', '$14.20'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$47.42', '$44.24'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$55.96', '$52.20'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$17.57', '$16.89'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US4965500', 'Florida Keys', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$20.73', '$19.93'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'NonPeak', '$27.63', '$44.24'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA2', 'Canada Central', 'CONUS to NSRA', 'Peak', '$32.60', '$52.20'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'NonPeak', '$10.65', '$16.89'); +INSERT INTO public.stage_non_standard_locn_prices (origin_id, origin_area, destination_id, destination_area, move_type, season, hhg_price, ub_price) VALUES ('US68', 'Texas-South', 'NSRA13', 'Pacific Islands', 'CONUS to NSRA', 'Peak', '$12.57', '$19.93'); + + +-- +-- Data for Name: stage_oconus_to_conus_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US16', 'Connecticut', 'NonPeak', '$29.28', '$33.75'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US16', 'Connecticut', 'Peak', '$34.55', '$39.82'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US47', 'Alabama', 'NonPeak', '$27.63', '$32.26'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US47', 'Alabama', 'Peak', '$32.60', '$38.07'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US4965500', 'Florida Keys', 'NonPeak', '$16.05', '$43.94'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US4965500', 'Florida Keys', 'Peak', '$18.94', '$51.85'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US68', 'Texas-South', 'NonPeak', '$17.57', '$44.51'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US68', 'Texas-South', 'Peak', '$20.73', '$52.52'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US16', 'Connecticut', 'NonPeak', '$15.28', '$31.91'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US16', 'Connecticut', 'Peak', '$18.03', '$37.65'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US47', 'Alabama', 'NonPeak', '$30.90', '$44.28'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US47', 'Alabama', 'Peak', '$36.46', '$52.25'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US4965500', 'Florida Keys', 'NonPeak', '$17.57', '$34.33'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US4965500', 'Florida Keys', 'Peak', '$20.73', '$40.51'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US68', 'Texas-South', 'NonPeak', '$24.38', '$34.90'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US68', 'Texas-South', 'Peak', '$28.77', '$41.18'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US4965500', 'Florida Keys', 'NonPeak', '$27.63', '$33.98'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US4965500', 'Florida Keys', 'Peak', '$32.60', '$40.10'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US16', 'Connecticut', 'NonPeak', '$24.38', '$44.62'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US16', 'Connecticut', 'Peak', '$28.77', '$52.65'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US47', 'Alabama', 'NonPeak', '$16.05', '$33.75'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US47', 'Alabama', 'Peak', '$18.94', '$39.82'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US68', 'Texas-South', 'NonPeak', '$17.57', '$34.45'); +INSERT INTO public.stage_oconus_to_conus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_domestic_price_area_area, destination_domestic_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US68', 'Texas-South', 'Peak', '$20.73', '$40.65'); + + +-- +-- Data for Name: stage_oconus_to_oconus_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$10.65', '$11.86'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$12.57', '$13.99'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'GE', 'Germany', 'NonPeak', '$8.88', '$12.99'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'GE', 'Germany', 'Peak', '$10.48', '$15.33'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$10.35', '$11.86'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('AS11', 'New South Wales/Australian Capital Territory', 'US8101000', 'Alaska (Zone) I', 'Peak', '$12.21', '$13.99'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$9.77', '$17.17'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$11.53', '$20.26'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'GE', 'Germany', 'NonPeak', '$11.35', '$16.89'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'GE', 'Germany', 'Peak', '$13.39', '$19.93'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$10.21', '$17.17'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('GE', 'Germany', 'US8101000', 'Alaska (Zone) I', 'Peak', '$12.05', '$20.26'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'AS11', 'New South Wales/Australian Capital Territory', 'NonPeak', '$11.35', '$11.66'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'AS11', 'New South Wales/Australian Capital Territory', 'Peak', '$13.39', '$13.76'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'GE', 'Germany', 'NonPeak', '$10.21', '$12.36'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'GE', 'Germany', 'Peak', '$12.05', '$14.58'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US8101000', 'Alaska (Zone) I', 'NonPeak', '$11.35', '$17.59'); +INSERT INTO public.stage_oconus_to_oconus_prices (origin_intl_price_area_id, origin_intl_price_area, destination_intl_price_area_id, destination_intl_price_area, season, hhg_shipping_linehaul_price, ub_price) VALUES ('US8101000', 'Alaska (Zone) I', 'US8101000', 'Alaska (Zone) I', 'Peak', '$13.39', '$19.93'); + + +-- +-- Data for Name: stage_other_intl_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('AS11', 'New South Wales/Australian Capital Territory', '$63.33', '$7.52', '$61.05', '$7.24', '$3.42', '$0.10', '$156.26', '$234.40', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('AS11', 'New South Wales/Australian Capital Territory', '$74.10', '$9.15', '$71.43', '$8.47', '$4.00', '$0.12', '$182.82', '$274.25', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('GE', 'Germany', '$57.76', '$7.52', '$86.31', '$7.24', '$4.85', '$0.16', '$172.00', '$258.00', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('GE', 'Germany', '$67.58', '$9.15', '$100.98', '$8.47', '$5.67', '$0.19', '$201.24', '$301.86', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US16', 'Connecticut', '$67.48', '$7.52', '$63.88', '$7.24', '$5.39', '$0.18', '$156.26', '$217.96', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US16', 'Connecticut', '$78.95', '$9.15', '$74.74', '$8.47', '$6.31', '$0.21', '$182.82', '$255.01', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US47', 'Alabama', '$69.97', '$7.52', '$72.50', '$7.24', '$3.28', '$0.16', '$156.26', '$258.00', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US47', 'Alabama', '$81.86', '$9.15', '$84.82', '$8.47', '$3.84', '$0.19', '$182.82', '$301.86', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US4965500', 'Florida Keys', '$76.04', '$7.52', '$79.40', '$7.24', '$4.85', '$0.26', '$156.26', '$258.00', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US4965500', 'Florida Keys', '$88.97', '$9.15', '$92.90', '$8.47', '$5.67', '$0.30', '$182.82', '$301.86', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US68', 'Texas-South', '$69.97', '$7.52', '$72.50', '$7.24', '$4.33', '$0.12', '$145.31', '$258.00', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US68', 'Texas-South', '$81.86', '$9.15', '$84.82', '$8.47', '$5.07', '$0.14', '$170.01', '$301.86', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US8101000', 'Alaska (Zone) I', '$61.05', '$7.52', '$57.76', '$7.24', '$6.07', '$0.14', '$164.17', '$217.96', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('US8101000', 'Alaska (Zone) I', '$71.43', '$9.15', '$67.58', '$8.47', '$7.10', '$0.16', '$192.08', '$255.01', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA2', 'Canada Central', '$79.40', '$7.52', '$76.66', '$7.24', '$6.07', '$0.17', '$156.26', '$246.25', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA2', 'Canada Central', '$92.90', '$9.15', '$89.69', '$8.47', '$7.10', '$0.20', '$182.82', '$288.11', 'Peak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA13', 'Pacific Islands', '$86.31', '$7.52', '$83.34', '$7.24', '$5.62', '$0.28', '$164.17', '$246.25', 'NonPeak'); +INSERT INTO public.stage_other_intl_prices (rate_area_code, rate_area_name, hhg_origin_pack_price, hhg_destination_unpack_price, ub_origin_pack_price, ub_destination_unpack_price, origin_destination_sit_first_day_warehouse, origin_destination_sit_addl_days, sit_lte_50_miles, sit_gt_50_miles, season) VALUES ('NSRA13', 'Pacific Islands', '$100.98', '$9.15', '$97.51', '$8.47', '$6.58', '$0.33', '$192.08', '$288.11', 'Peak'); + + +-- +-- Data for Name: stage_price_escalation_discounts; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Base Period Year 1', '1.0000', '', '1'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Base Period Year 2', '1.0206', '', '1.0206'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Base Period Year 3', '1.0197', '', '1.0197'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Option Period 1', '1.0214', '', '1.0214'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Option Period 2', '1.0211', '', '1.0211'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Award Term 1', '1.0199', '', '1.0199'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Award Term 2', '1.0194', '', '1.0194'); +INSERT INTO public.stage_price_escalation_discounts (contract_year, forecasting_adjustment, discount, price_escalation) VALUES ('Option Period 3', '1.0202', '', '1.0202'); + + +-- +-- Data for Name: stage_shipment_management_services_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 1', '451.15'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 2', '454.23'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Base Period Year 3', '457.98'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 1', '459.85'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 2', '500.23'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 1', '500.69'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Award Term 2', '501.15'); +INSERT INTO public.stage_shipment_management_services_prices (contract_year, price_per_task_order) VALUES ('Option Period 3', '502.19'); + + +-- +-- Data for Name: stage_transition_prices; Type: TABLE DATA; Schema: public; Owner: - +-- + +INSERT INTO public.stage_transition_prices (contract_year, price_total_cost) VALUES ('One-time Amount (applied in Base Period Year 1)', '$ 450.18'); + + +-- +-- Name: TABLE stage_conus_to_oconus_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_conus_to_oconus_prices TO master; + + +-- +-- Name: TABLE stage_counseling_services_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_counseling_services_prices TO master; + + +-- +-- Name: TABLE stage_domestic_international_additional_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_domestic_international_additional_prices TO master; + + +-- +-- Name: TABLE stage_domestic_linehaul_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_domestic_linehaul_prices TO master; + + +-- +-- Name: TABLE stage_domestic_move_accessorial_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_domestic_move_accessorial_prices TO master; + + +-- +-- Name: TABLE stage_domestic_service_area_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_domestic_service_area_prices TO master; + + +-- +-- Name: TABLE stage_domestic_service_areas; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_domestic_service_areas TO master; + + +-- +-- Name: TABLE stage_international_move_accessorial_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_international_move_accessorial_prices TO master; + + +-- +-- Name: TABLE stage_international_service_areas; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_international_service_areas TO master; + + +-- +-- Name: TABLE stage_non_standard_locn_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_non_standard_locn_prices TO master; + + +-- +-- Name: TABLE stage_oconus_to_conus_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_oconus_to_conus_prices TO master; + + +-- +-- Name: TABLE stage_oconus_to_oconus_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_oconus_to_oconus_prices TO master; + + +-- +-- Name: TABLE stage_other_intl_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_other_intl_prices TO master; + + +-- +-- Name: TABLE stage_price_escalation_discounts; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_price_escalation_discounts TO master; + + +-- +-- Name: TABLE stage_shipment_management_services_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_shipment_management_services_prices TO master; + + +-- +-- Name: TABLE stage_transition_prices; Type: ACL; Schema: public; Owner: - +-- + +GRANT ALL ON TABLE public.stage_transition_prices TO master; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/pkg/services/ghcimport/ghc_rateengine_importer.go b/pkg/services/ghcimport/ghc_rateengine_importer.go new file mode 100644 index 00000000000..1cbc05c5aa6 --- /dev/null +++ b/pkg/services/ghcimport/ghc_rateengine_importer.go @@ -0,0 +1,78 @@ +package ghcimport + +import ( + "fmt" + "time" + + "github.com/gofrs/uuid" + "github.com/pterm/pterm" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +// GHCRateEngineImporter is the rate engine importer for GHC +type GHCRateEngineImporter struct { + ContractCode string + ContractName string + ContractStartDate time.Time + ContractID uuid.UUID + serviceAreaToIDMap map[string]uuid.UUID + domesticRateAreaToIDMap map[string]uuid.UUID + internationalRateAreaToIDMap map[string]uuid.UUID + serviceToIDMap map[models.ReServiceCode]uuid.UUID + contractYearToIDMap map[string]uuid.UUID +} + +func (gre *GHCRateEngineImporter) runImports(appCtx appcontext.AppContext) error { + importers := []struct { + importFunction func(appcontext.AppContext) error + action string + }{ + // NOTE: Ordering is significant as these functions must run in this order. + + // Reference tables + {gre.importREContract, "Importing contract"}, // Also populates gre.ContractID + {gre.importREContractYears, "Importing contract years"}, // Populates gre.contractYearToIDMap + {gre.importREDomesticServiceArea, "Importing domestic service areas"}, // Also populates gre.serviceAreaToIDMap + {gre.importRERateArea, "Importing rate areas"}, // Also populates gre.domesticRateAreaToIDMap and gre.internationalRateAreaToIDMap + {gre.mapZipCodesToRERateAreas, "Mapping zip3s and zip5s to rate areas"}, + {gre.loadServiceMap, "Loading service map"}, // Populates gre.serviceToIDMap + + // Non-reference tables + {gre.importREDomesticLinehaulPrices, "Importing domestic linehaul prices"}, + {gre.importREDomesticServiceAreaPrices, "Importing domestic service area prices"}, + {gre.importREDomesticOtherPrices, "Importing domestic other prices"}, + {gre.importREInternationalPrices, "Importing international prices"}, + {gre.importREInternationalOtherPrices, "Importing international other prices"}, + {gre.importRETaskOrderFees, "Importing task order fees"}, + {gre.importREDomesticAccessorialPrices, "Importing domestic accessorial prices"}, + {gre.importREIntlAccessorialPrices, "Importing international accessorial prices"}, + {gre.importREShipmentTypePrices, "Importing shipment type prices"}, + } + + for _, importer := range importers { + pterm.Println(pterm.BgGray.Sprint(importer.action)) + + err := importer.importFunction(appCtx) + if err != nil { + return fmt.Errorf("importer failed: %s: %w", importer.action, err) + } + + pterm.Println(pterm.BgGray.Sprint(fmt.Sprintf("Finished %s", importer.action))) + } + + return nil +} + +// Import runs the import +func (gre *GHCRateEngineImporter) Import(appCtx appcontext.AppContext) error { + err := appCtx.NewTransaction(func(txnAppCtx appcontext.AppContext) error { + dbTxError := gre.runImports(txnAppCtx) + return dbTxError + }) + if err != nil { + return fmt.Errorf("transaction failed during GHC Rate Engine Import(): %w", err) + } + return nil +} diff --git a/pkg/services/ghcimport/ghc_rateengine_importer_test.go b/pkg/services/ghcimport/ghc_rateengine_importer_test.go new file mode 100644 index 00000000000..74aa80f9b59 --- /dev/null +++ b/pkg/services/ghcimport/ghc_rateengine_importer_test.go @@ -0,0 +1,82 @@ +package ghcimport + +import ( + "os" + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/suite" + + "github.com/transcom/mymove/pkg/testingsuite" +) + +const testContractCode = "TEST" +const testContractCode2 = "TEST2" +const testContractName = "Test Contract" + +var testContractStartDate = time.Date(2021, time.February, 01, 0, 0, 0, 0, time.UTC) + +type GHCRateEngineImportSuite struct { + *testingsuite.PopTestSuite +} + +func (suite *GHCRateEngineImportSuite) SetupSuite() { + suite.PreloadData(func() { + suite.helperSetupStagingTables() + }) +} + +func (suite *GHCRateEngineImportSuite) TearDownSuite() { + suite.PopTestSuite.TearDown() +} + +func (suite *GHCRateEngineImportSuite) helperLoadSQLFixture(fileName string) { + path := filepath.Join("fixtures", fileName) + _, err := os.Stat(path) + suite.NoError(err) + + c, ioErr := os.ReadFile(filepath.Clean(path)) + suite.NoError(ioErr) + + sql := string(c) + err = suite.DB().RawQuery(sql).Exec() + suite.NoError(err) +} + +func (suite *GHCRateEngineImportSuite) helperSetupStagingTables() { + suite.helperLoadSQLFixture("stage_ghc_pricing.sql") +} + +func TestGHCRateEngineImportSuite(t *testing.T) { + hs := &GHCRateEngineImportSuite{ + PopTestSuite: testingsuite.NewPopTestSuite(testingsuite.CurrentPackage(), testingsuite.WithPerTestTransaction()), + } + + suite.Run(t, hs) +} + +func (suite *GHCRateEngineImportSuite) TestGHCRateEngineImporter_Import() { + tests := []struct { + name string + gre *GHCRateEngineImporter + wantErr bool + }{ + { + name: "Run GHC Rate Engine Importer", + gre: &GHCRateEngineImporter{ + ContractCode: testContractCode, + ContractName: testContractName, + ContractStartDate: testContractStartDate, + }, + wantErr: false, + }, + } + for _, tt := range tests { + suite.Run(tt.name, func() { + if err := tt.gre.Import(suite.AppContextForTest()); (err != nil) != tt.wantErr { + suite.T().Errorf("GHCRateEngineImporter.Import() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/services/ghcimport/import_re_contract.go b/pkg/services/ghcimport/import_re_contract.go new file mode 100644 index 00000000000..68f4b835fbc --- /dev/null +++ b/pkg/services/ghcimport/import_re_contract.go @@ -0,0 +1,48 @@ +package ghcimport + +import ( + "fmt" + + "github.com/pkg/errors" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (gre *GHCRateEngineImporter) importREContract(appCtx appcontext.AppContext) error { + if gre.ContractCode == "" { + return errors.New("no contract code provided") + } + + // If no contract name is provided, default to the contract code. + contractName := gre.ContractName + if contractName == "" { + contractName = gre.ContractCode + } + + // See if contract code already exists. + exists, err := appCtx.DB().Where("code = ?", gre.ContractCode).Exists(&models.ReContract{}) + if err != nil { + return fmt.Errorf("could not determine if contract code [%s] existed: %w", gre.ContractCode, err) + } + if exists { + return fmt.Errorf("the provided contract code [%s] already exists", gre.ContractCode) + } + + // Contract code is new; insert it. + contract := models.ReContract{ + Code: gre.ContractCode, + Name: contractName, + } + verrs, err := appCtx.DB().ValidateAndSave(&contract) + if verrs.HasAny() { + return fmt.Errorf("validation errors when saving contract [%+v]: %w", contract, verrs) + } + if err != nil { + return fmt.Errorf("could not save contract [%+v]: %w", contract, err) + } + + gre.ContractID = contract.ID + + return nil +} diff --git a/pkg/services/ghcimport/import_re_contract_test.go b/pkg/services/ghcimport/import_re_contract_test.go new file mode 100644 index 00000000000..7107e7ebbf2 --- /dev/null +++ b/pkg/services/ghcimport/import_re_contract_test.go @@ -0,0 +1,63 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_importREContract() { + suite.Run("import success", func() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + ContractName: testContractName, + } + + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + suite.helperCheckContractName(testContractName) + suite.NotNil(gre.ContractID) + }) + + suite.Run("no contract code", func() { + gre := &GHCRateEngineImporter{} + + err := gre.importREContract(suite.AppContextForTest()) + if suite.Error(err) { + suite.Equal("no contract code provided", err.Error()) + } + }) +} + +func (suite *GHCRateEngineImportSuite) Test_importREContract_runTwice() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success, but no contract name", func() { + setupTestData() + suite.helperCheckContractName(testContractCode) + suite.NotNil(gre.ContractID) + }) + + suite.Run("run twice with same contract code - should fail the second time", func() { + setupTestData() + err := gre.importREContract(suite.AppContextForTest()) + if suite.Error(err) { + expected := fmt.Sprintf("the provided contract code [%s] already exists", testContractCode) + suite.Equal(expected, err.Error()) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperCheckContractName(expectedName string) { + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + suite.Equal(expectedName, contract.Name) +} diff --git a/pkg/services/ghcimport/import_re_contract_years.go b/pkg/services/ghcimport/import_re_contract_years.go new file mode 100644 index 00000000000..c12cdd76c13 --- /dev/null +++ b/pkg/services/ghcimport/import_re_contract_years.go @@ -0,0 +1,58 @@ +package ghcimport + +import ( + "fmt" + "strconv" + + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (gre *GHCRateEngineImporter) importREContractYears(appCtx appcontext.AppContext) error { + // populate contractYearsToIDMap + var priceEscalationDiscounts []models.StagePriceEscalationDiscount + err := appCtx.DB().All(&priceEscalationDiscounts) + if err != nil { + return fmt.Errorf("could not read staged price escalation discounts: %w", err) + } + + gre.contractYearToIDMap = make(map[string]uuid.UUID) + incrementYear := 0 + compoundedEscalation := 1.00000 + + basePeriodEndDateForPrimeContract1 := gre.ContractStartDate.AddDate(1, 0, -1) + + //loop through the price escalation discounts data and pull contract year and escalations + for _, stagePriceEscalationDiscount := range priceEscalationDiscounts { + escalation, err := strconv.ParseFloat(stagePriceEscalationDiscount.PriceEscalation, 64) + if err != nil { + return fmt.Errorf("could not process price escalation [%s]: %w", stagePriceEscalationDiscount.PriceEscalation, err) + } + compoundedEscalation *= escalation + + contractYear := models.ReContractYear{ + ContractID: gre.ContractID, + Name: stagePriceEscalationDiscount.ContractYear, + StartDate: gre.ContractStartDate.AddDate(incrementYear, 0, 0), + EndDate: basePeriodEndDateForPrimeContract1.AddDate(incrementYear, 0, 0), + Escalation: escalation, + EscalationCompounded: compoundedEscalation, + } + incrementYear++ + + verrs, dbErr := appCtx.DB().ValidateAndSave(&contractYear) + if dbErr != nil { + return fmt.Errorf("error saving ReContractYears: %+v with error: %w", contractYear, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReContractYears: %+v with validation errors: %w", contractYear, verrs) + } + + //add to map + gre.contractYearToIDMap[contractYear.Name] = contractYear.ID + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_contract_years_test.go b/pkg/services/ghcimport/import_re_contract_years_test.go new file mode 100644 index 00000000000..b33584d8656 --- /dev/null +++ b/pkg/services/ghcimport/import_re_contract_years_test.go @@ -0,0 +1,78 @@ +package ghcimport + +import ( + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_importREContractYears() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + ContractStartDate: testContractStartDate, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREContractYears(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyContractYears() + suite.helperCheckContractYearValue() + }) + + suite.Run("run a second time; should fail immediately due to date range constraint", func() { + setupTestData() + err := gre.importREContractYears(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.ExclusionViolation, "re_contract_years_daterange_excl")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyContractYears() { + count, err := suite.DB().Count(&models.ReContractYear{}) + suite.NoError(err) + suite.Equal(8, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckContractYearValue() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = $1", testContractCode).First(&contract) + suite.NoError(err) + + var basePeriod1 models.ReContractYear + err = suite.DB(). + Where("contract_id = $1", contract.ID). + Where("name = $2", "Base Period Year 1"). + First(&basePeriod1) + suite.NoError(err) + suite.Equal(1.0000, basePeriod1.Escalation) + suite.Equal(1.0000, basePeriod1.EscalationCompounded) + + var optionPeriod1 models.ReContractYear + err = suite.DB(). + Where("contract_id = $1", contract.ID). + Where("name = $2", "Option Period 1"). + First(&optionPeriod1) + suite.NoError(err) + suite.Equal(1.02140, optionPeriod1.Escalation) + suite.Equal(1.06298, optionPeriod1.EscalationCompounded) + + var awardTerm2 models.ReContractYear + err = suite.DB(). + Where("contract_id = $1", contract.ID). + Where("name = $2", "Award Term 2"). + First(&awardTerm2) + suite.NoError(err) + suite.Equal(1.01940, awardTerm2.Escalation) + suite.Equal(1.12848, awardTerm2.EscalationCompounded) +} diff --git a/pkg/services/ghcimport/import_re_domestic_accessorial_prices.go b/pkg/services/ghcimport/import_re_domestic_accessorial_prices.go new file mode 100644 index 00000000000..b30f1f75ccd --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_accessorial_prices.go @@ -0,0 +1,77 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importREDomesticAccessorialPrices(appCtx appcontext.AppContext) error { + //tab 5a) Access. and Add. Prices + var domesticAccessorialPrices []models.StageDomesticMoveAccessorialPrice + err := appCtx.DB().All(&domesticAccessorialPrices) + if err != nil { + return fmt.Errorf("could not read staged domestic accessorial prices: %w", err) + } + + services := []struct { + serviceCode models.ReServiceCode + serviceProvided string + }{ + {models.ReServiceCodeDCRT, "Crating (per cubic ft.)"}, + {models.ReServiceCodeDCRTSA, "Crating (per cubic ft.)"}, + {models.ReServiceCodeDUCRT, "Uncrating (per cubic ft.)"}, + {models.ReServiceCodeDDSHUT, "Shuttle Service (per cwt)"}, + {models.ReServiceCodeDOSHUT, "Shuttle Service (per cwt)"}, + } + + //loop through the domestic accessorial price data and store in db + for _, stageDomesticAccessorialPrice := range domesticAccessorialPrices { + servicesSchedule, err := stringToInteger(stageDomesticAccessorialPrice.ServicesSchedule) + if err != nil { + return fmt.Errorf("could not process services schedule [%s]: %w", stageDomesticAccessorialPrice.ServicesSchedule, err) + } + + var perUnitCentsService int + perUnitCentsService, err = priceToCents(stageDomesticAccessorialPrice.PricePerUnit) + if err != nil { + return fmt.Errorf("could not process price per unit [%s]: %w", stageDomesticAccessorialPrice.PricePerUnit, err) + } + + serviceProvidedFound := false + for _, service := range services { + serviceCode := service.serviceCode + serviceProvided := service.serviceProvided + + if stageDomesticAccessorialPrice.ServiceProvided == serviceProvided { + serviceProvidedFound = true + serviceID, found := gre.serviceToIDMap[serviceCode] + if !found { + return fmt.Errorf("missing service [%s] in map of services", serviceCode) + } + + domesticAccessorial := models.ReDomesticAccessorialPrice{ + ContractID: gre.ContractID, + ServicesSchedule: servicesSchedule, + ServiceID: serviceID, + PerUnitCents: unit.Cents(perUnitCentsService), + } + + verrs, dbErr := appCtx.DB().ValidateAndSave(&domesticAccessorial) + if dbErr != nil { + return fmt.Errorf("error saving ReDomesticAccessorialPrices: %+v with error: %w", domesticAccessorial, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReDomesticAccessorialPrices: %+v with validation errors: %w", domesticAccessorial, verrs) + } + } + } + if !serviceProvidedFound { + return fmt.Errorf("service [%s] not found", stageDomesticAccessorialPrice.ServiceProvided) + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go b/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go new file mode 100644 index 00000000000..5f75bbd55a4 --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go @@ -0,0 +1,91 @@ +package ghcimport + +import ( + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticAccessorialPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticAccessorialPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyDomesticAccessorialPrices() + suite.helperCheckDomesticAccessorialPrices() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREDomesticAccessorialPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_accessorial_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyDomesticAccessorialPrices() { + count, err := suite.DB().Count(&models.ReDomesticAccessorialPrice{}) + suite.NoError(err) + suite.Equal(15, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckDomesticAccessorialPrices() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = $1", testContractCode).First(&contract) + suite.NoError(err) + + testCases := []struct { + serviceCode models.ReServiceCode + schedule int + expectedPrice int + isError bool + }{ + {models.ReServiceCodeDCRT, 1, 2369, false}, + {models.ReServiceCodeDCRTSA, 1, 2369, false}, + {models.ReServiceCodeDUCRT, 1, 595, false}, + {models.ReServiceCodeDDSHUT, 1, 505, false}, + {models.ReServiceCodeDDSHUT, 3, 576, false}, + {models.ReServiceCodeDOSHUT, 1, 505, false}, + {models.ReServiceCodeMS, 3, 0, true}, + {models.ReServiceCodeDCRT, 5, 0, true}, + } + + for _, testCase := range testCases { + // Get service UUID. + var service models.ReService + err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) + suite.NoError(err) + + var domesticAccessorialPrice models.ReDomesticAccessorialPrice + err = suite.DB(). + Where("contract_id = $1", contract.ID). + Where("service_id = $2", service.ID). + Where("services_schedule = $3", testCase.schedule). + First(&domesticAccessorialPrice) + + if testCase.isError { + suite.Error(err) + } else { + suite.NoError(err) + suite.Equal(unit.Cents(testCase.expectedPrice), domesticAccessorialPrice.PerUnitCents, "test case: %+v", testCase) + } + } +} diff --git a/pkg/services/ghcimport/import_re_domestic_linehaul_prices.go b/pkg/services/ghcimport/import_re_domestic_linehaul_prices.go new file mode 100644 index 00000000000..9b24f78ae02 --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_linehaul_prices.go @@ -0,0 +1,80 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importREDomesticLinehaulPrices(appCtx appcontext.AppContext) error { + // Read all the staged prices + var stageDomesticLinehaulPrices []models.StageDomesticLinehaulPrice + err := appCtx.DB().All(&stageDomesticLinehaulPrices) + if err != nil { + return fmt.Errorf("could not read staged domestic linehaul prices: %w", err) + } + + for _, stagePrice := range stageDomesticLinehaulPrices { + weightLowerInt, err := stringToInteger(stagePrice.WeightLower) + if err != nil { + return fmt.Errorf("could not process weight lower [%s]: %w", stagePrice.WeightLower, err) + } + + weightUpperInt, err := stringToInteger(stagePrice.WeightUpper) + if err != nil { + return fmt.Errorf("could not process weight upper [%s]: %w", stagePrice.WeightUpper, err) + } + + milesLowerInt, err := stringToInteger(stagePrice.MilesLower) + if err != nil { + return fmt.Errorf("could not process miles lower [%s]: %w", stagePrice.MilesLower, err) + } + + milesUpperInt, err := stringToInteger(stagePrice.MilesUpper) + if err != nil { + return fmt.Errorf("could not process miles upper [%s]: %w", stagePrice.MilesUpper, err) + } + + isPeakPeriod, err := isPeakPeriod(stagePrice.Season) + if err != nil { + return fmt.Errorf("could not process season [%s]: %w", stagePrice.Season, err) + } + + serviceArea, err := cleanServiceAreaNumber(stagePrice.ServiceAreaNumber) + if err != nil { + return fmt.Errorf("could not process service area number [%s]: %w", stagePrice.ServiceAreaNumber, err) + } + serviceAreaID, found := gre.serviceAreaToIDMap[serviceArea] + if !found { + return fmt.Errorf("could not find service area [%s] in map", stagePrice.ServiceAreaNumber) + } + + priceMillicents, err := priceToMillicents(stagePrice.Rate) + if err != nil { + return fmt.Errorf("could not process rate [%s]: %w", stagePrice.Rate, err) + } + + domesticLinehaulPrice := models.ReDomesticLinehaulPrice{ + ContractID: gre.ContractID, + WeightLower: unit.Pound(weightLowerInt), + WeightUpper: unit.Pound(weightUpperInt), + MilesLower: milesLowerInt, + MilesUpper: milesUpperInt, + IsPeakPeriod: isPeakPeriod, + DomesticServiceAreaID: serviceAreaID, + PriceMillicents: unit.Millicents(priceMillicents), + } + + verrs, err := appCtx.DB().ValidateAndSave(&domesticLinehaulPrice) + if verrs.HasAny() { + return fmt.Errorf("validation errors when saving domestic linehaul price [%+v]: %w", domesticLinehaulPrice, verrs) + } + if err != nil { + return fmt.Errorf("could not save domestic linehaul price [%+v]: %w", domesticLinehaulPrice, err) + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go b/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go new file mode 100644 index 00000000000..32b16b4fced --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go @@ -0,0 +1,79 @@ +package ghcimport + +import ( + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticLinehaulPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticServiceArea(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticLinehaulPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyDomesticLinehaulCount() + + // Spot check a linehaul price + suite.helperCheckDomesticLinehaulValue() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREDomesticLinehaulPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_linehaul_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyDomesticLinehaulCount() { + count, err := suite.DB().Count(&models.ReDomesticLinehaulPrice{}) + suite.NoError(err) + suite.Equal(13800, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckDomesticLinehaulValue() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + // Get domestic service area UUID. + var serviceArea models.ReDomesticServiceArea + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("service_area = '452'"). + First(&serviceArea) + suite.NoError(err) + + // Get linehaul price. + var linehaul models.ReDomesticLinehaulPrice + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("weight_lower = 5000"). + Where("weight_upper = 9999"). + Where("miles_lower = 2501"). + Where("miles_upper = 3000"). + Where("is_peak_period = false"). + Where("domestic_service_area_id = ?", serviceArea.ID). + First(&linehaul) + suite.NoError(err) + + suite.Equal(unit.Millicents(745600), linehaul.PriceMillicents) +} diff --git a/pkg/services/ghcimport/import_re_domestic_other_prices.go b/pkg/services/ghcimport/import_re_domestic_other_prices.go new file mode 100644 index 00000000000..7b47722e74f --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_other_prices.go @@ -0,0 +1,199 @@ +package ghcimport + +import ( + "fmt" + + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +// DomOtherPriceToInsert is the domestic other price to insert +type DomOtherPriceToInsert struct { + model models.ReDomesticOtherPrice + message string +} + +func importPackUnpackPrices(appCtx appcontext.AppContext, serviceToIDMap map[models.ReServiceCode]uuid.UUID, contractID uuid.UUID) ([]DomOtherPriceToInsert, error) { + var stagePackPrices []models.StageDomesticOtherPackPrice + var modelsToSave []DomOtherPriceToInsert + + if err := appCtx.DB().All(&stagePackPrices); err != nil { + return nil, fmt.Errorf("error looking up StageDomesticOtherPackPrice data: %w", err) + } + + // DPK Dom. Packing + packServiceID, found := serviceToIDMap[models.ReServiceCodeDPK] + if !found { + return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDPK) + } + + // DUPK Dom. Unpacking + unpackServiceID, found := serviceToIDMap[models.ReServiceCodeDUPK] + if !found { + return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDUPK) + } + + for _, stagePackPrice := range stagePackPrices { + peakCents, err := priceToCents(stagePackPrice.PeakPricePerCwt) + if err != nil { + return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDPK, stagePackPrice.PeakPricePerCwt, err) + } + + nonPeakCents, err := priceToCents(stagePackPrice.NonPeakPricePerCwt) + if err != nil { + return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDUPK, stagePackPrice.NonPeakPricePerCwt, err) + } + + servicesSchedule, err := stringToInteger(stagePackPrice.ServicesSchedule) + if err != nil { + return nil, fmt.Errorf("failed to parse ServicesSchedule for pack/unpack: %+v error: %w", stagePackPrice.ServicesSchedule, err) + } + + packNonPeakPriceModel := models.ReDomesticOtherPrice{ + ContractID: contractID, + Schedule: servicesSchedule, + IsPeakPeriod: false, + PriceCents: unit.Cents(nonPeakCents), + } + packPeakPriceModel := models.ReDomesticOtherPrice{ + ContractID: contractID, + Schedule: servicesSchedule, + IsPeakPeriod: true, + PriceCents: unit.Cents(peakCents), + } + + if stagePackPrice.ServiceProvided == "Packing (per cwt)" { + packNonPeakPriceModel.ServiceID = packServiceID + packPeakPriceModel.ServiceID = packServiceID + } else if stagePackPrice.ServiceProvided == "Unpack (per cwt)" { + packNonPeakPriceModel.ServiceID = unpackServiceID + packPeakPriceModel.ServiceID = unpackServiceID + } else { + return nil, fmt.Errorf("failed to import pack/unpack prices receieved unexpected ServiceProvided: %s in %+v", stagePackPrice.ServiceProvided, stagePackPrice) + } + + modelsToSave = append(modelsToSave, DomOtherPriceToInsert{model: packNonPeakPriceModel, message: "Non-Peak Pack/Unpack"}) + modelsToSave = append(modelsToSave, DomOtherPriceToInsert{model: packPeakPriceModel, message: "Peak Pack/Unpack"}) + } + + return modelsToSave, nil +} + +func importSitPrices(appCtx appcontext.AppContext, serviceToIDMap map[models.ReServiceCode]uuid.UUID, contractID uuid.UUID) ([]DomOtherPriceToInsert, error) { + var stageSitPrices []models.StageDomesticOtherSitPrice + var modelsToSave []DomOtherPriceToInsert + + if err := appCtx.DB().All(&stageSitPrices); err != nil { + return nil, fmt.Errorf("error looking up StageDomesticOtherSitPrice data: %w", err) + } + + // DOPSIT Dom. Origin SIT Pickup + originSitPickupID, found := serviceToIDMap[models.ReServiceCodeDOPSIT] + if !found { + return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDOPSIT) + } + + // DDDSIT Dom. Destination SIT Delivery + destSitDeliveryID, found := serviceToIDMap[models.ReServiceCodeDDDSIT] + if !found { + return nil, fmt.Errorf("missing service [%s] in map of services", models.ReServiceCodeDDDSIT) + } + + for _, stageSitPrice := range stageSitPrices { + peakCents, err := priceToCents(stageSitPrice.PeakPricePerCwt) + if err != nil { + return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDOPSIT, stageSitPrice.PeakPricePerCwt, err) + } + + nonPeakCents, err := priceToCents(stageSitPrice.NonPeakPricePerCwt) + if err != nil { + return nil, fmt.Errorf("failed to parse price for service code %s: %+v error: %w", models.ReServiceCodeDDDSIT, stageSitPrice.NonPeakPricePerCwt, err) + } + + schedule, err := stringToInteger(stageSitPrice.SITPickupDeliverySchedule) + if err != nil { + return nil, fmt.Errorf("failed to parse SITPickupDeliverySchedule: %+v error: %w", stageSitPrice.SITPickupDeliverySchedule, err) + } + + modelsToSave = append( + modelsToSave, + DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ + ContractID: contractID, + ServiceID: originSitPickupID, + Schedule: schedule, + IsPeakPeriod: false, + PriceCents: unit.Cents(nonPeakCents), + }, message: "SIT Non Peak Pickup"}) + modelsToSave = append( + modelsToSave, + DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ + ContractID: contractID, + ServiceID: destSitDeliveryID, + Schedule: schedule, + IsPeakPeriod: false, + PriceCents: unit.Cents(nonPeakCents), + }, message: "SIT Non Peak Delivery"}) + modelsToSave = append( + modelsToSave, + DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ + ContractID: contractID, + ServiceID: originSitPickupID, + Schedule: schedule, + IsPeakPeriod: true, + PriceCents: unit.Cents(peakCents), + }, message: "SIT Peak Pickup"}) + modelsToSave = append( + modelsToSave, + DomOtherPriceToInsert{model: models.ReDomesticOtherPrice{ + ContractID: contractID, + ServiceID: destSitDeliveryID, + Schedule: schedule, + IsPeakPeriod: true, + PriceCents: unit.Cents(peakCents), + }, message: "SIT Peak Delivery"}) + } + + return modelsToSave, nil +} + +func saveModel(appCtx appcontext.AppContext, message string, model *models.ReDomesticOtherPrice) error { + verrs, err := appCtx.DB().ValidateAndSave(model) + if verrs.HasAny() { + return fmt.Errorf("error saving ReDomesticOtherPrice %s: %+v with validation errors: %w", message, model, verrs) + } + if err != nil { + return fmt.Errorf("error saving ReDomesticOtherPrice %s: %+v with error: %w", message, model, err) + } + + return nil +} + +func (gre *GHCRateEngineImporter) importREDomesticOtherPrices(appCtx appcontext.AppContext) error { + + var modelsToSavePack []DomOtherPriceToInsert + var modelsToSaveSit []DomOtherPriceToInsert + + var err error + modelsToSavePack, err = importPackUnpackPrices(appCtx, gre.serviceToIDMap, gre.ContractID) + if err != nil { + return err + } + + modelsToSaveSit, err = importSitPrices(appCtx, gre.serviceToIDMap, gre.ContractID) + if err != nil { + return err + } + + modelsToSave := append(modelsToSavePack, modelsToSaveSit...) + for _, modelToSave := range modelsToSave { + //nolint:gosec + if err := saveModel(appCtx, modelToSave.message, &modelToSave.model); err != nil { + return err + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_domestic_other_prices_test.go b/pkg/services/ghcimport/import_re_domestic_other_prices_test.go new file mode 100644 index 00000000000..ca14e7f4ad9 --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_other_prices_test.go @@ -0,0 +1,120 @@ +package ghcimport + +import ( + "fmt" + + "github.com/gofrs/uuid" + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticOtherPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticOtherPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyDomesticOtherPrices() + suite.helperCheckDomesticOtherPriceValue() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_other_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticOtherPricesFailures() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + setupTestData := func() { + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + suite.NotNil(gre.ContractID) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("stage_domestic_other_sit_prices table missing", func() { + setupTestData() + renameQuery := "ALTER TABLE stage_domestic_other_sit_prices RENAME TO missing_stage_domestic_other_sit_prices" + renameErr := suite.DB().RawQuery(renameQuery).Exec() + suite.NoError(renameErr) + + err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) + } + }) + + suite.Run("stage_domestic_other_pack_prices table missing", func() { + setupTestData() + // drop a staging table that we are depending on to do import + dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS %s;", "stage_domestic_other_pack_prices") + dropErr := suite.DB().RawQuery(dropQuery).Exec() + suite.NoError(dropErr) + + err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyDomesticOtherPrices() { + count, err := suite.DB().Count(&models.ReDomesticOtherPrice{}) + suite.NoError(err) + suite.Equal(48, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckDomesticOtherPriceValue() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + suite.verifyDomesticOtherPrice(unit.Cents(7395), contract.ID, false, models.ReServiceCodeDPK, 3) + suite.verifyDomesticOtherPrice(unit.Cents(8000), contract.ID, true, models.ReServiceCodeDPK, 3) + suite.verifyDomesticOtherPrice(unit.Cents(597), contract.ID, false, models.ReServiceCodeDUPK, 2) + suite.verifyDomesticOtherPrice(unit.Cents(650), contract.ID, true, models.ReServiceCodeDUPK, 2) + suite.verifyDomesticOtherPrice(unit.Cents(23440), contract.ID, false, models.ReServiceCodeDOPSIT, 2) + suite.verifyDomesticOtherPrice(unit.Cents(24122), contract.ID, true, models.ReServiceCodeDOPSIT, 2) + suite.verifyDomesticOtherPrice(unit.Cents(24625), contract.ID, false, models.ReServiceCodeDDDSIT, 3) + suite.verifyDomesticOtherPrice(unit.Cents(25030), contract.ID, true, models.ReServiceCodeDDDSIT, 3) +} + +func (suite *GHCRateEngineImportSuite) verifyDomesticOtherPrice(expected unit.Cents, contractID uuid.UUID, isPeakPeriod bool, serviceCode models.ReServiceCode, schedule int) { + var service models.ReService + err := suite.DB().Where("code = ?", serviceCode).First(&service) + suite.NoError(err) + + var domesticOtherPrice models.ReDomesticOtherPrice + err = suite.DB(). + Where("contract_id = ?", contractID). + Where("service_id = ?", service.ID). + Where("is_peak_period = ?", isPeakPeriod). + Where("schedule = ?", schedule).First(&domesticOtherPrice) + suite.NoError(err) + suite.Equal(expected, domesticOtherPrice.PriceCents) +} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area.go b/pkg/services/ghcimport/import_re_domestic_service_area.go new file mode 100644 index 00000000000..ed68176314d --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_service_area.go @@ -0,0 +1,259 @@ +package ghcimport + +import ( + "fmt" + "strings" + + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +// A set of service area strings and their associated data +type serviceAreasSet map[string]domesticServiceAreaData + +// The ReDomesticServiceArea model and the related zip3 set +type domesticServiceAreaData struct { + serviceArea *models.ReDomesticServiceArea + zip3s zip3Set +} + +// A set of zip3s and their associated city/state +type zip3Set map[string]cityState + +// City/state data we need for each zip3 +type cityState struct { + city string + state string +} + +func (gre *GHCRateEngineImporter) importREDomesticServiceArea(appCtx appcontext.AppContext) error { + // Build a data structure that we'll walk for inserting rows into the DB (we have + // duplicate service areas that we need to handle). + serviceAreasData, err := gre.buildServiceAreasData(appCtx) + if err != nil { + return err + } + + // Insert the service area and zip3 records; store a map of service area UUIDs to use + // in later imports. + gre.serviceAreaToIDMap, err = gre.saveServiceAreasAndZip3s(appCtx, serviceAreasData) + if err != nil { + return err + } + + return nil +} + +func (gre *GHCRateEngineImporter) buildServiceAreasData(appCtx appcontext.AppContext) (serviceAreasSet, error) { + // Read all the staged domestic service areas + var stageDomesticServiceAreas []models.StageDomesticServiceArea + stageErr := appCtx.DB().All(&stageDomesticServiceAreas) + if stageErr != nil { + return nil, fmt.Errorf("could not read staged domestic service areas: %w", stageErr) + } + + // Since we appear to have duplicate service areas (and possibly zips too), consolidate data to + // insert in a separate data structure that we'll then walk for inserting rows into the DB. + serviceAreasData := make(serviceAreasSet) + for _, stageArea := range stageDomesticServiceAreas { + serviceAreaNumber, err := cleanServiceAreaNumber(stageArea.ServiceAreaNumber) + if err != nil { + return nil, fmt.Errorf("could not process service area number [%s]: %w", stageArea.ServiceAreaNumber, err) + } + + splitZip3s := strings.Split(stageArea.Zip3s, ",") + for i, zip3 := range splitZip3s { + splitZip3s[i], err = cleanZip3(zip3) + if err != nil { + return nil, fmt.Errorf("could not process zip3 [%s]: %w", zip3, err) + } + } + + foundServiceAreaData, serviceAreaFound := serviceAreasData[serviceAreaNumber] + if serviceAreaFound { + // Service area already encountered; merge new zips into data structure + zip3sSet := foundServiceAreaData.zip3s + for _, zip3 := range splitZip3s { + if _, zipFound := zip3sSet[zip3]; !zipFound { + zip3sSet[zip3] = cityState{ + city: stageArea.BasePointCity, + state: stageArea.State, + } + } + } + } else { + // Service area has not been seen yet; create entire data structure + zip3sSet := make(zip3Set) + for _, zip3 := range splitZip3s { + zip3sSet[zip3] = cityState{ + city: stageArea.BasePointCity, + state: stageArea.State, + } + } + + serviceAreasData[serviceAreaNumber] = domesticServiceAreaData{ + serviceArea: &models.ReDomesticServiceArea{ + ContractID: gre.ContractID, + ServiceArea: serviceAreaNumber, + // Fill in services schedule and SIT PD schedule later from other tab. + }, + zip3s: zip3sSet, + } + } + } + + // Now add schedule data (which comes from a different tab) to our service area structure. + err := gre.addScheduleData(appCtx, serviceAreasData) + if err != nil { + return nil, err + } + + return serviceAreasData, nil +} + +func (gre *GHCRateEngineImporter) addScheduleData(appCtx appcontext.AppContext, serviceAreasData serviceAreasSet) error { + // Now walk tab 2b and record the two schedule values. + var stageDomesticServiceAreaPrices []models.StageDomesticServiceAreaPrice + stageErr := appCtx.DB().All(&stageDomesticServiceAreaPrices) + if stageErr != nil { + return fmt.Errorf("could not read staged domestic service area prices: %w", stageErr) + } + + for _, stagePrice := range stageDomesticServiceAreaPrices { + serviceAreaNumber, err := cleanServiceAreaNumber(stagePrice.ServiceAreaNumber) + if err != nil { + return fmt.Errorf("could not process service area number [%s]: %w", stagePrice.ServiceAreaNumber, err) + } + + foundServiceAreaData, serviceAreaFound := serviceAreasData[serviceAreaNumber] + if !serviceAreaFound { + return fmt.Errorf("missing service area [%s] in list of service areas", serviceAreaNumber) + } + + servicesSchedule, err := stringToInteger(stagePrice.ServicesSchedule) + if err != nil { + return fmt.Errorf("could not process services schedule [%s]: %w", stagePrice.ServicesSchedule, err) + } + + sitSchedule, err := stringToInteger(stagePrice.SITPickupDeliverySchedule) + if err != nil { + return fmt.Errorf("could not process SIT P/D schedule [%s]: %w", stagePrice.SITPickupDeliverySchedule, err) + } + + serviceArea := foundServiceAreaData.serviceArea + serviceArea.ServicesSchedule = servicesSchedule + serviceArea.SITPDSchedule = sitSchedule + } + + return nil +} + +func (gre *GHCRateEngineImporter) saveServiceAreasAndZip3s(appCtx appcontext.AppContext, serviceAreasData serviceAreasSet) (map[string]uuid.UUID, error) { + serviceAreaToIDMap := make(map[string]uuid.UUID) + for _, serviceAreaData := range serviceAreasData { + reServiceArea := serviceAreaData.serviceArea + + // See if there is an existing service area record. If so, we may need to update it. + var existingServiceAreas models.ReDomesticServiceAreas + err := appCtx.DB(). + Where("contract_id = ?", gre.ContractID). + Where("service_area = ?", reServiceArea.ServiceArea). + All(&existingServiceAreas) + if err != nil { + return nil, fmt.Errorf("could not lookup existing service area [%s]: %w", reServiceArea.ServiceArea, err) + } + doSaveServiceArea := true + if len(existingServiceAreas) > 0 { + // Update existing service area with new data. + existingServiceArea := existingServiceAreas[0] + doSaveServiceArea = updateExistingServiceArea(&existingServiceArea, *reServiceArea) + reServiceArea = &existingServiceArea + } + + if doSaveServiceArea { + verrs, saveErr := appCtx.DB().ValidateAndSave(reServiceArea) + if verrs.HasAny() { + return nil, fmt.Errorf("validation errors when saving service area [%+v]: %w", *reServiceArea, verrs) + } + if saveErr != nil { + return nil, fmt.Errorf("could not save service area [%+v]: %w", *reServiceArea, saveErr) + } + } + serviceAreaToIDMap[reServiceArea.ServiceArea] = reServiceArea.ID + + err = gre.saveZip3sForServiceArea(appCtx, serviceAreaData.zip3s, reServiceArea.ID) + if err != nil { + return nil, err + } + } + + return serviceAreaToIDMap, nil +} + +func (gre *GHCRateEngineImporter) saveZip3sForServiceArea(appCtx appcontext.AppContext, zip3s zip3Set, serviceAreaID uuid.UUID) error { + // Save the associated zips. + for zip3, cityState := range zip3s { + reZip3 := models.ReZip3{ + ContractID: gre.ContractID, + Zip3: zip3, + BasePointCity: cityState.city, + State: cityState.state, + DomesticServiceAreaID: serviceAreaID, + } + + // See if there is an existing zip3 record. If so, we need to update it. + var existingZip3s models.ReZip3s + err := appCtx.DB(). + Where("contract_id = ?", gre.ContractID). + Where("zip3 = ?", reZip3.Zip3). + All(&existingZip3s) + if err != nil { + return fmt.Errorf("could not lookup existing zip3 [%s]: %w", reZip3.Zip3, err) + } + doSaveZip3 := true + if len(existingZip3s) > 0 { + // Update existing zip3 with new data. + existingZip3 := existingZip3s[0] + doSaveZip3 = updateExistingZip3(&existingZip3, reZip3) + reZip3 = existingZip3 + } + + if doSaveZip3 { + verrs, saveErr := appCtx.DB().ValidateAndSave(&reZip3) + if verrs.HasAny() { + return fmt.Errorf("validation errors when saving zip3 [%+v]: %w", reZip3, verrs) + } + if saveErr != nil { + return fmt.Errorf("could not save zip3 [%+v]: %w", reZip3, saveErr) + } + } + } + + return nil +} + +func updateExistingServiceArea(existing *models.ReDomesticServiceArea, new models.ReDomesticServiceArea) bool { + if existing.ServicesSchedule == new.ServicesSchedule && + existing.SITPDSchedule == new.SITPDSchedule { + return false + } + + existing.ServicesSchedule = new.ServicesSchedule + existing.SITPDSchedule = new.SITPDSchedule + return true +} + +func updateExistingZip3(existing *models.ReZip3, new models.ReZip3) bool { + if existing.BasePointCity == new.BasePointCity && + existing.State == new.State && + existing.DomesticServiceAreaID == new.DomesticServiceAreaID { + return false + } + + existing.BasePointCity = new.BasePointCity + existing.State = new.State + existing.DomesticServiceAreaID = new.DomesticServiceAreaID + return true +} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_prices.go b/pkg/services/ghcimport/import_re_domestic_service_area_prices.go new file mode 100644 index 00000000000..b806b18f86e --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_service_area_prices.go @@ -0,0 +1,80 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importREDomesticServiceAreaPrices(appCtx appcontext.AppContext) error { + var stageDomPricingModels []models.StageDomesticServiceAreaPrice + + if err := appCtx.DB().All(&stageDomPricingModels); err != nil { + return fmt.Errorf("error looking up StageDomesticServiceAreaPrice data: %w", err) + } + + for _, stageDomPricingModel := range stageDomPricingModels { + isPeakPeriod, ippErr := isPeakPeriod(stageDomPricingModel.Season) + if ippErr != nil { + return ippErr + } + + serviceAreaNumber, csaErr := cleanServiceAreaNumber(stageDomPricingModel.ServiceAreaNumber) + if csaErr != nil { + return csaErr + } + + serviceAreaID, found := gre.serviceAreaToIDMap[serviceAreaNumber] + if !found { + return fmt.Errorf("could not find service area [%s] in map", serviceAreaNumber) + } + + servicesToInsert := []struct { + service models.ReServiceCode + price string + }{ + {models.ReServiceCodeDSH, stageDomPricingModel.ShorthaulPrice}, + {models.ReServiceCodeDOP, stageDomPricingModel.OriginDestinationPrice}, + {models.ReServiceCodeDDP, stageDomPricingModel.OriginDestinationPrice}, + {models.ReServiceCodeDOFSIT, stageDomPricingModel.OriginDestinationSITFirstDayWarehouse}, + {models.ReServiceCodeDDFSIT, stageDomPricingModel.OriginDestinationSITFirstDayWarehouse}, + {models.ReServiceCodeDOASIT, stageDomPricingModel.OriginDestinationSITAddlDays}, + {models.ReServiceCodeDDASIT, stageDomPricingModel.OriginDestinationSITAddlDays}, + } + + for _, serviceToInsert := range servicesToInsert { + service := serviceToInsert.service + price := serviceToInsert.price + + serviceID, found := gre.serviceToIDMap[service] + if !found { + return fmt.Errorf("missing service [%s] in map of services", service) + } + + cents, convErr := priceToCents(price) + if convErr != nil { + return fmt.Errorf("failed to parse price for service code %s: %+v error: %w", service, price, convErr) + } + + domPricingModel := models.ReDomesticServiceAreaPrice{ + ContractID: gre.ContractID, + ServiceID: serviceID, + IsPeakPeriod: isPeakPeriod, + DomesticServiceAreaID: serviceAreaID, + PriceCents: unit.Cents(cents), + } + + verrs, err := appCtx.DB().ValidateAndSave(&domPricingModel) + if verrs.HasAny() { + return fmt.Errorf("error saving ReDomesticServiceAreaPrices: %+v with validation errors: %w", domPricingModel, verrs) + } + if err != nil { + return fmt.Errorf("error saving ReDomesticServiceAreaPrices: %+v with error: %w", domPricingModel, err) + } + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go b/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go new file mode 100644 index 00000000000..955a5ed3e63 --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go @@ -0,0 +1,125 @@ +package ghcimport + +import ( + "github.com/gofrs/uuid" + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceAreaPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticServiceArea(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyDomesticServiceAreaPrices() + + // Spot check domestic service area prices for one row + suite.helperCheckDomesticServiceAreaPriceValue() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_service_area_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceAreaPricesFailures() { + suite.Run("stage_domestic_service_area_prices table missing", func() { + renameQuery := "ALTER TABLE stage_domestic_service_area_prices RENAME TO missing_stage_domestic_service_area_prices" + renameErr := suite.DB().RawQuery(renameQuery).Exec() + suite.NoError(renameErr) + + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + suite.NotNil(gre.ContractID) + + err = gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyDomesticServiceAreaPrices() { + count, err := suite.DB().Count(&models.ReDomesticServiceAreaPrice{}) + suite.NoError(err) + suite.Equal(3234, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckDomesticServiceAreaPriceValue() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + // Get domestic service area UUID. + var serviceArea models.ReDomesticServiceArea + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("service_area = '592'"). + First(&serviceArea) + suite.NoError(err) + + // Get domestic service area price DSH + suite.verifyDomesticServiceAreaPrice(unit.Cents(16), contract.ID, models.ReServiceCodeDSH, serviceArea.ID) + + // Get domestic service area price DOP + suite.verifyDomesticServiceAreaPrice(unit.Cents(581), contract.ID, models.ReServiceCodeDOP, serviceArea.ID) + + // Get domestic service area price DDP + suite.verifyDomesticServiceAreaPrice(unit.Cents(581), contract.ID, models.ReServiceCodeDDP, serviceArea.ID) + + // Get domestic service area price DOFSIT + suite.verifyDomesticServiceAreaPrice(unit.Cents(1597), contract.ID, models.ReServiceCodeDOFSIT, serviceArea.ID) + + // Get domestic service area price DDFSIT + suite.verifyDomesticServiceAreaPrice(unit.Cents(1597), contract.ID, models.ReServiceCodeDDFSIT, serviceArea.ID) + + // Get domestic service area price DOASIT + suite.verifyDomesticServiceAreaPrice(unit.Cents(62), contract.ID, models.ReServiceCodeDOASIT, serviceArea.ID) + + // Get domestic service area price DDASIT + suite.verifyDomesticServiceAreaPrice(unit.Cents(62), contract.ID, models.ReServiceCodeDDASIT, serviceArea.ID) +} + +func (suite *GHCRateEngineImportSuite) verifyDomesticServiceAreaPrice(expected unit.Cents, contractID uuid.UUID, serviceCode models.ReServiceCode, serviceAreaID uuid.UUID) { + var service models.ReService + err := suite.DB().Where("code = ?", serviceCode).First(&service) + suite.NoError(err) + + var domesticServiceAreaPrice models.ReDomesticServiceAreaPrice + err = suite.DB(). + Where("contract_id = ?", contractID). + Where("service_id = ?", service.ID). + Where("domestic_service_area_id = ?", serviceAreaID). + Where("is_peak_period = false").First(&domesticServiceAreaPrice) + suite.NoError(err) + suite.Equal(expected, domesticServiceAreaPrice.PriceCents) +} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_test.go b/pkg/services/ghcimport/import_re_domestic_service_area_test.go new file mode 100644 index 00000000000..774f96534b8 --- /dev/null +++ b/pkg/services/ghcimport/import_re_domestic_service_area_test.go @@ -0,0 +1,165 @@ +package ghcimport + +import ( + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceArea() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticServiceArea(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyServiceAreaCount(testContractCode) + suite.NotNil(gre.serviceAreaToIDMap) + + // Spot check a service area + suite.helperCheckServiceAreaValue(testContractCode) + }) + + suite.Run("Run a second time with changed data, should still succeed", func() { + setupTestData() + + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + // Change a service area and remove/change a zip and see if they return as they were before. + var serviceArea models.ReDomesticServiceArea + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("service_area = '452'"). + First(&serviceArea) + suite.NoError(err) + serviceArea.ServicesSchedule = 2 + serviceArea.SITPDSchedule = 2 + suite.MustSave(&serviceArea) + + var zip3ToDelete models.ReZip3 + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("zip3 = '647'"). + First(&zip3ToDelete) + suite.NoError(err) + suite.MustDestroy(&zip3ToDelete) + + var zip3ToUpdate models.ReZip3 + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("zip3 = '657'"). + First(&zip3ToUpdate) + suite.NoError(err) + zip3ToUpdate.BasePointCity = "New City" + zip3ToUpdate.State = "XX" + suite.MustSave(&zip3ToUpdate) + + err = gre.importREDomesticServiceArea(suite.AppContextForTest()) + suite.NoError(err) + suite.helperVerifyServiceAreaCount(testContractCode) + suite.NotNil(gre.serviceAreaToIDMap) + + // Check to see if data changed above has been reverted. + suite.helperCheckServiceAreaValue(testContractCode) + }) + + suite.Run("Run with a different contract code, should add new records", func() { + setupTestData() + + gre2 := &GHCRateEngineImporter{ + ContractCode: testContractCode2, + } + + // Prerequisite tables must be loaded. + err := gre2.importREContract(suite.AppContextForTest()) + suite.NoError(err) + err = gre2.importREDomesticServiceArea(suite.AppContextForTest()) + suite.NoError(err) + + suite.NoError(err) + suite.helperVerifyServiceAreaCount(testContractCode2) + suite.NotNil(gre2.serviceAreaToIDMap) + + // Spot check a service area + suite.helperCheckServiceAreaValue(testContractCode2) + + // Make sure the other contract's records are still there too. + suite.helperVerifyServiceAreaCount(testContractCode) + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyServiceAreaCount(contractCode string) { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", contractCode).First(&contract) + suite.NoError(err) + + // Domestic service areas count + count, err := suite.DB().Where("contract_id = ?", contract.ID).Count(&models.ReDomesticServiceArea{}) + suite.NoError(err) + suite.Equal(5, count) + + // Zip3s count + count, err = suite.DB().Where("contract_id = ?", contract.ID).Count(&models.ReZip3{}) + suite.NoError(err) + suite.Equal(19, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckServiceAreaValue(contractCode string) { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", contractCode).First(&contract) + suite.NoError(err) + + var serviceArea models.ReDomesticServiceArea + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("service_area = '452'"). + First(&serviceArea) + suite.NoError(err) + + suite.Equal(1, serviceArea.ServicesSchedule) + suite.Equal(3, serviceArea.SITPDSchedule) + + expectedZip3s := []struct { + zip3 string + city string + state string + }{ + {"647", "Butler", "MO"}, + {"648", "Neosho", "MO"}, + {"656", "Springfield", "MO"}, + {"657", "Springfield", "MO"}, + {"658", "Springfield", "MO"}, + } + + var zip3s models.ReZip3s + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("domestic_service_area_id = ?", serviceArea.ID). + All(&zip3s) + suite.NoError(err) + for _, zip3 := range zip3s { + found := false + for _, expectedZip3 := range expectedZip3s { + if zip3.Zip3 == expectedZip3.zip3 { + found = true + suite.Equal(expectedZip3.city, zip3.BasePointCity) + suite.Equal(expectedZip3.state, zip3.State) + } + } + suite.True(found, "Could not find zip3 [%s]", zip3.Zip3) + } + + suite.Len(zip3s, len(expectedZip3s), "Zip3 lengths did not match") +} diff --git a/pkg/services/ghcimport/import_re_intl_accessorial_prices.go b/pkg/services/ghcimport/import_re_intl_accessorial_prices.go new file mode 100644 index 00000000000..6fb1a2a04d7 --- /dev/null +++ b/pkg/services/ghcimport/import_re_intl_accessorial_prices.go @@ -0,0 +1,76 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importREIntlAccessorialPrices(appCtx appcontext.AppContext) error { + //tab 5a) Access. and Add. Prices + var intlAccessorialPrices []models.StageInternationalMoveAccessorialPrice + err := appCtx.DB().All(&intlAccessorialPrices) + if err != nil { + return fmt.Errorf("could not read staged intl accessorial prices: %w", err) + } + + services := []struct { + serviceCode models.ReServiceCode + serviceProvided string + }{ + {models.ReServiceCodeICRT, "Crating (per cubic ft.)"}, + {models.ReServiceCodeIUCRT, "Uncrating (per cubic ft.)"}, + {models.ReServiceCodeIDSHUT, "Shuttle Service (per cwt)"}, + {models.ReServiceCodeIOSHUT, "Shuttle Service (per cwt)"}, + } + + //loop through the intl accessorial price data and store in db + for _, stageIntlAccessorialPrice := range intlAccessorialPrices { + var perUnitCentsService int + perUnitCentsService, err = priceToCents(stageIntlAccessorialPrice.PricePerUnit) + if err != nil { + return fmt.Errorf("could not process per unit price [%s]: %w", stageIntlAccessorialPrice.PricePerUnit, err) + } + + market, err := getMarket(stageIntlAccessorialPrice.Market) + if err != nil { + return fmt.Errorf("could not process market [%s]: %w", stageIntlAccessorialPrice.Market, err) + } + + serviceProvidedFound := false + for _, service := range services { + serviceCode := service.serviceCode + serviceProvided := service.serviceProvided + + if stageIntlAccessorialPrice.ServiceProvided == serviceProvided { + serviceProvidedFound = true + serviceID, found := gre.serviceToIDMap[serviceCode] + if !found { + return fmt.Errorf("missing service [%s] in map of services", serviceCode) + } + + intlAccessorial := models.ReIntlAccessorialPrice{ + ContractID: gre.ContractID, + Market: market, + ServiceID: serviceID, + PerUnitCents: unit.Cents(perUnitCentsService), + } + + verrs, dbErr := appCtx.DB().ValidateAndSave(&intlAccessorial) + if dbErr != nil { + return fmt.Errorf("error saving ReIntlAccessorialPrices: %+v with error: %w", intlAccessorial, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReIntlAccessorialPrices: %+v with validation errors: %w", intlAccessorial, verrs) + } + } + } + if !serviceProvidedFound { + return fmt.Errorf("service [%s] not found", stageIntlAccessorialPrice.ServiceProvided) + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go b/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go new file mode 100644 index 00000000000..e9311817530 --- /dev/null +++ b/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go @@ -0,0 +1,90 @@ +package ghcimport + +import ( + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREIntlAccessorialPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREIntlAccessorialPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyIntlAccessorialPrices() + suite.helperCheckIntlAccessorialPrices() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREIntlAccessorialPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_accessorial_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyIntlAccessorialPrices() { + count, err := suite.DB().Count(&models.ReIntlAccessorialPrice{}) + suite.NoError(err) + suite.Equal(8, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckIntlAccessorialPrices() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = $1", testContractCode).First(&contract) + suite.NoError(err) + + testCases := []struct { + serviceCode models.ReServiceCode + market string + expectedPrice int + isError bool + }{ + {models.ReServiceCodeICRT, "C", 2561, false}, + {models.ReServiceCodeIUCRT, "C", 654, false}, + {models.ReServiceCodeIDSHUT, "C", 14529, false}, + {models.ReServiceCodeIDSHUT, "O", 15623, false}, + {models.ReServiceCodeIOSHUT, "O", 15623, false}, + {models.ReServiceCodeMS, "O", 0, true}, + {models.ReServiceCodeICRT, "R", 0, true}, + } + + for _, testCase := range testCases { + // Get service UUID. + var service models.ReService + err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) + suite.NoError(err) + + var intlAccessorialPrice models.ReIntlAccessorialPrice + err = suite.DB(). + Where("contract_id = $1", contract.ID). + Where("service_id = $2", service.ID). + Where("market = $3", testCase.market). + First(&intlAccessorialPrice) + + if testCase.isError { + suite.Error(err) + } else { + suite.NoError(err) + suite.Equal(unit.Cents(testCase.expectedPrice), intlAccessorialPrice.PerUnitCents, "test case: %+v", testCase) + } + } +} diff --git a/pkg/services/ghcimport/import_re_intl_other_prices.go b/pkg/services/ghcimport/import_re_intl_other_prices.go new file mode 100644 index 00000000000..6d70b935b93 --- /dev/null +++ b/pkg/services/ghcimport/import_re_intl_other_prices.go @@ -0,0 +1,84 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importREInternationalOtherPrices(appCtx appcontext.AppContext) error { + // Tab 3d: Other International Prices + var stageOtherIntlPrices []models.StageOtherIntlPrice + err := appCtx.DB().All(&stageOtherIntlPrices) + if err != nil { + return fmt.Errorf("could not read staged other international prices: %w", err) + } + + for _, stagePrice := range stageOtherIntlPrices { + isPeakPeriod, err := isPeakPeriod(stagePrice.Season) + if err != nil { + return fmt.Errorf("could not process season [%s]: %w", stagePrice.Season, err) + } + + // First look in the international rate area map; if not found, try the domestic rate + // area map. Both international and domestic are possibilities for this column. + rateAreaCode := stagePrice.RateAreaCode + rateAreaID, found := gre.internationalRateAreaToIDMap[rateAreaCode] + if !found { + rateAreaID, found = gre.domesticRateAreaToIDMap[rateAreaCode] + if !found { + return fmt.Errorf("could not find rate area [%s] in map", rateAreaCode) + } + } + + servicesToInsert := []struct { + service models.ReServiceCode + price string + }{ + {models.ReServiceCodeIHPK, stagePrice.HHGOriginPackPrice}, + {models.ReServiceCodeIHUPK, stagePrice.HHGDestinationUnPackPrice}, + {models.ReServiceCodeIUBPK, stagePrice.UBOriginPackPrice}, + {models.ReServiceCodeIUBUPK, stagePrice.UBDestinationUnPackPrice}, + {models.ReServiceCodeIOFSIT, stagePrice.OriginDestinationSITFirstDayWarehouse}, + {models.ReServiceCodeIDFSIT, stagePrice.OriginDestinationSITFirstDayWarehouse}, + {models.ReServiceCodeIOASIT, stagePrice.OriginDestinationSITAddlDays}, + {models.ReServiceCodeIDASIT, stagePrice.OriginDestinationSITAddlDays}, + {models.ReServiceCodeIOPSIT, stagePrice.SITLte50Miles}, + {models.ReServiceCodeIDDSIT, stagePrice.SITGt50Miles}, + } + + for _, serviceToInsert := range servicesToInsert { + service := serviceToInsert.service + price := serviceToInsert.price + + priceCents, err := priceToCents(price) + if err != nil { + return fmt.Errorf("could not process price [%s] for service [%s]: %w", price, service, err) + } + serviceID, found := gre.serviceToIDMap[service] + if !found { + return fmt.Errorf("missing service [%s] in map of services", service) + } + + intlOtherPrice := models.ReIntlOtherPrice{ + ContractID: gre.ContractID, + ServiceID: serviceID, + RateAreaID: rateAreaID, + IsPeakPeriod: isPeakPeriod, + PerUnitCents: unit.Cents(priceCents), + } + + verrs, err := appCtx.DB().ValidateAndSave(&intlOtherPrice) + if verrs.HasAny() { + return fmt.Errorf("validation errors when saving other international price [%+v]: %w", intlOtherPrice, verrs) + } + if err != nil { + return fmt.Errorf("could not save other international price [%+v]: %w", intlOtherPrice, err) + } + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_intl_other_prices_test.go b/pkg/services/ghcimport/import_re_intl_other_prices_test.go new file mode 100644 index 00000000000..8dc6fd4ce47 --- /dev/null +++ b/pkg/services/ghcimport/import_re_intl_other_prices_test.go @@ -0,0 +1,102 @@ +package ghcimport + +import ( + "github.com/gofrs/uuid" + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREInternationalOtherPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREInternationalOtherPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyInternationalOtherPrices() + + // Spot check a staging row's prices + suite.helperCheckInternationalOtherPriceRecords() + }) + + suite.Run("run twice; should immediately fail the second time due to constraint violation", func() { + setupTestData() + err := gre.importREInternationalOtherPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_other_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyInternationalOtherPrices() { + count, err := suite.DB().Count(&models.ReIntlOtherPrice{}) + suite.NoError(err) + suite.Equal(2580, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckInternationalOtherPriceRecords() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + // Get rate area UUID. + var rateArea *models.ReRateArea + rateArea, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") + suite.NoError(err) + + // Get service UUID. + testServices := []struct { + service models.ReServiceCode + expectedPrice int + }{ + {models.ReServiceCodeIHPK, 8186}, + {models.ReServiceCodeIHUPK, 915}, + {models.ReServiceCodeIUBPK, 8482}, + {models.ReServiceCodeIUBUPK, 847}, + {models.ReServiceCodeIOFSIT, 507}, + {models.ReServiceCodeIDFSIT, 507}, + {models.ReServiceCodeIOASIT, 14}, + {models.ReServiceCodeIDASIT, 14}, + {models.ReServiceCodeIOPSIT, 17001}, + {models.ReServiceCodeIDDSIT, 30186}, + } + + for _, test := range testServices { + suite.helperCheckOneOtherInternationalPriceRecord(test.expectedPrice, contract.ID, test.service, rateArea.ID) + } +} + +func (suite *GHCRateEngineImportSuite) helperCheckOneOtherInternationalPriceRecord(expected int, contractID uuid.UUID, serviceCode models.ReServiceCode, rateAreaID uuid.UUID) { + var service models.ReService + err := suite.DB().Where("code = ?", serviceCode).First(&service) + suite.NoError(err) + + var intlOtherPrice models.ReIntlOtherPrice + err = suite.DB(). + Where("contract_id = ?", contractID). + Where("service_id = ?", service.ID). + Where("is_peak_period = true"). + Where("rate_area_id = ?", rateAreaID). + First(&intlOtherPrice) + suite.NoError(err) + suite.Equal(unit.Cents(expected), intlOtherPrice.PerUnitCents) +} diff --git a/pkg/services/ghcimport/import_re_intl_prices.go b/pkg/services/ghcimport/import_re_intl_prices.go new file mode 100644 index 00000000000..0baff7602ca --- /dev/null +++ b/pkg/services/ghcimport/import_re_intl_prices.go @@ -0,0 +1,388 @@ +package ghcimport + +import ( + "fmt" + "strings" + + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importREInternationalPrices(appCtx appcontext.AppContext) error { + if err := gre.importOconusToOconusPrices(appCtx); err != nil { + return fmt.Errorf("could not import OCONUS to OCONUS prices: %w", err) + } + + if err := gre.importConusToOconusPrices(appCtx); err != nil { + return fmt.Errorf("could not import CONUS to OCONUS prices: %w", err) + } + + if err := gre.importOconusToConusPrices(appCtx); err != nil { + return fmt.Errorf("could not import OCONUS to CONUS prices: %w", err) + } + + if err := gre.importNonStandardLocationPrices(appCtx); err != nil { + return fmt.Errorf("could not import non-standard location prices: %w", err) + } + return nil +} + +func (gre *GHCRateEngineImporter) importOconusToOconusPrices(appCtx appcontext.AppContext) error { + // tab 3a) OCONUS to OCONUS data + var oconusToOconusPrices []models.StageOconusToOconusPrice + err := appCtx.DB().All(&oconusToOconusPrices) + if err != nil { + return fmt.Errorf("could not read staged OCONUS to OCONUS prices: %w", err) + } + + // Int'l O->O Shipping & LH + serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) + } + + // Int'l O->O UB + serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) + } + + // loop through the OCONUS to OCONUS data and store in db + for _, stageOconusToOconusPrice := range oconusToOconusPrices { + var intlPricingModels models.ReIntlPrices + peakPeriod, err := isPeakPeriod(stageOconusToOconusPrice.Season) + if err != nil { + return fmt.Errorf("could not process season [%s]: %w", stageOconusToOconusPrice.Season, err) + } + + originRateAreaID, found := gre.internationalRateAreaToIDMap[stageOconusToOconusPrice.OriginIntlPriceAreaID] + if !found { + return fmt.Errorf("could not find origin rate area [%s] in map", stageOconusToOconusPrice.OriginIntlPriceAreaID) + } + + destinationRateAreaID, found := gre.internationalRateAreaToIDMap[stageOconusToOconusPrice.DestinationIntlPriceAreaID] + if !found { + return fmt.Errorf("could not find destination rate area [%s] in map", stageOconusToOconusPrice.DestinationIntlPriceAreaID) + } + + perUnitCentsHHG, err := priceToCents(stageOconusToOconusPrice.HHGShippingLinehaulPrice) + if err != nil { + return fmt.Errorf("could not process linehaul price [%s]: %w", stageOconusToOconusPrice.HHGShippingLinehaulPrice, err) + } + + perUnitCentsUB, err := priceToCents(stageOconusToOconusPrice.UBPrice) + if err != nil { + return fmt.Errorf("could not process UB price [%s]: %w", stageOconusToOconusPrice.UBPrice, err) + } + + intlPricingModelISLH := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceISLH, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: peakPeriod, + PerUnitCents: unit.Cents(perUnitCentsHHG), + } + intlPricingModels = append(intlPricingModels, intlPricingModelISLH) + + intlPricingModelUBP := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceUBP, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: peakPeriod, + PerUnitCents: unit.Cents(perUnitCentsUB), + } + intlPricingModels = append(intlPricingModels, intlPricingModelUBP) + + for _, model := range intlPricingModels { + copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. + verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) + if dbErr != nil { + return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) + } + } + } + + return nil +} + +func (gre *GHCRateEngineImporter) importConusToOconusPrices(appCtx appcontext.AppContext) error { + // tab 3b CONUS to OCONUS data + var conusToOconusPrices []models.StageConusToOconusPrice + err := appCtx.DB().All(&conusToOconusPrices) + if err != nil { + return fmt.Errorf("could not read staged CONUS to OCONUS prices: %w", err) + } + + // Int'l C->O Shipping & LH + serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) + } + + // Int'l C->O UB + serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) + } + + // loop through the CONUS to OCONUS data and store in db + for _, stageConusToOconusPrice := range conusToOconusPrices { + var intlPricingModels models.ReIntlPrices + + peakPeriod, err := isPeakPeriod(stageConusToOconusPrice.Season) + if err != nil { + return fmt.Errorf("could not process season [%s]: %w", stageConusToOconusPrice.Season, err) + } + + originRateAreaID, found := gre.domesticRateAreaToIDMap[stageConusToOconusPrice.OriginDomesticPriceAreaCode] + if !found { + return fmt.Errorf("could not find domestic rate area [%s] in map", stageConusToOconusPrice.OriginDomesticPriceAreaCode) + } + + destinationRateAreaID, found := gre.internationalRateAreaToIDMap[stageConusToOconusPrice.DestinationIntlPriceAreaID] + if !found { + return fmt.Errorf("could not find international rate area [%s] in map", stageConusToOconusPrice.DestinationIntlPriceAreaID) + } + + perUnitCentsHHG, err := priceToCents(stageConusToOconusPrice.HHGShippingLinehaulPrice) + if err != nil { + return fmt.Errorf("could not process linehaul price [%s]: %w", stageConusToOconusPrice.HHGShippingLinehaulPrice, err) + } + + perUnitCentsUB, err := priceToCents(stageConusToOconusPrice.UBPrice) + if err != nil { + return fmt.Errorf("could not process UB price [%s]: %w", stageConusToOconusPrice.UBPrice, err) + } + + intlPricingModelISLH := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceISLH, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: peakPeriod, + PerUnitCents: unit.Cents(perUnitCentsHHG), + } + intlPricingModels = append(intlPricingModels, intlPricingModelISLH) + + intlPricingModelUBP := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceUBP, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: peakPeriod, + PerUnitCents: unit.Cents(perUnitCentsUB), + } + intlPricingModels = append(intlPricingModels, intlPricingModelUBP) + + for _, model := range intlPricingModels { + copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. + verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) + if dbErr != nil { + return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) + } + } + } + + return nil +} + +func (gre *GHCRateEngineImporter) importOconusToConusPrices(appCtx appcontext.AppContext) error { + // tab 3c OCONUS to CONUS data + var oconusToConusPrices []models.StageOconusToConusPrice + err := appCtx.DB().All(&oconusToConusPrices) + if err != nil { + return fmt.Errorf("could not read staged OCONUS to CONUS prices: %w", err) + } + + // Int'l O->C Shipping & LH + serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) + } + + // Int'l O->C UB + serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) + } + + // loop through the OCONUS to CONUS data and store in db + for _, stageOconusToConusPrice := range oconusToConusPrices { + var intlPricingModels models.ReIntlPrices + + isPeakPeriod, err := isPeakPeriod(stageOconusToConusPrice.Season) + if err != nil { + return fmt.Errorf("could not process season [%s]: %w", stageOconusToConusPrice.Season, err) + } + + originRateAreaID, found := gre.internationalRateAreaToIDMap[stageOconusToConusPrice.OriginIntlPriceAreaID] + if !found { + return fmt.Errorf("could not find international rate area [%s] in map", stageOconusToConusPrice.OriginIntlPriceAreaID) + } + + destinationRateAreaID, found := gre.domesticRateAreaToIDMap[stageOconusToConusPrice.DestinationDomesticPriceAreaCode] + if !found { + return fmt.Errorf("could not find domestic rate area [%s] in map", stageOconusToConusPrice.DestinationDomesticPriceAreaCode) + } + + perUnitCentsHHG, err := priceToCents(stageOconusToConusPrice.HHGShippingLinehaulPrice) + if err != nil { + return fmt.Errorf("could not process linehaul price [%s]: %w", stageOconusToConusPrice.HHGShippingLinehaulPrice, err) + } + + perUnitCentsUB, err := priceToCents(stageOconusToConusPrice.UBPrice) + if err != nil { + return fmt.Errorf("could not process UB price [%s]: %w", stageOconusToConusPrice.UBPrice, err) + } + + intlPricingModelISLH := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceISLH, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: isPeakPeriod, + PerUnitCents: unit.Cents(perUnitCentsHHG), + } + intlPricingModels = append(intlPricingModels, intlPricingModelISLH) + + intlPricingModelUBP := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceUBP, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: isPeakPeriod, + PerUnitCents: unit.Cents(perUnitCentsUB), + } + intlPricingModels = append(intlPricingModels, intlPricingModelUBP) + + for _, model := range intlPricingModels { + copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. + verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) + if dbErr != nil { + return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) + } + } + } + + return nil +} + +func (gre *GHCRateEngineImporter) importNonStandardLocationPrices(appCtx appcontext.AppContext) error { + // tab 3e) Non-standard location prices + var nonStandardLocnPrices []models.StageNonStandardLocnPrice + err := appCtx.DB().All(&nonStandardLocnPrices) + if err != nil { + return fmt.Errorf("could not read staged non-standard location prices: %w", err) + } + + // Int'l non-standard HHG + serviceISLH, foundService := gre.serviceToIDMap[models.ReServiceCodeISLH] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeISLH) + } + + // Int'l non-standard UB + serviceUBP, foundService := gre.serviceToIDMap[models.ReServiceCodeUBP] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeUBP) + } + + // loop through the non-standard location data and store in db + for _, stageNonStandardLocnPrice := range nonStandardLocnPrices { + var intlPricingModels models.ReIntlPrices + + peakPeriod, err := isPeakPeriod(stageNonStandardLocnPrice.Season) + if err != nil { + return fmt.Errorf("could not process season [%s]: %w", stageNonStandardLocnPrice.Season, err) + } + + moveToAndFromKind := strings.Split(stageNonStandardLocnPrice.MoveType, " to ") + if len(moveToAndFromKind) != 2 { + return fmt.Errorf("could not parse move type [%s]", stageNonStandardLocnPrice.MoveType) + } + + originRateAreaID, err := gre.getRateAreaIDForKind(stageNonStandardLocnPrice.OriginID, moveToAndFromKind[0]) + if err != nil { + return err + } + + destinationRateAreaID, err := gre.getRateAreaIDForKind(stageNonStandardLocnPrice.DestinationID, moveToAndFromKind[1]) + if err != nil { + return err + } + + perUnitCentsHHG, err := priceToCents(stageNonStandardLocnPrice.HHGPrice) + if err != nil { + return fmt.Errorf("could not process linehaul price [%s]: %w", stageNonStandardLocnPrice.HHGPrice, err) + } + + perUnitCentsUB, err := priceToCents(stageNonStandardLocnPrice.UBPrice) + if err != nil { + return fmt.Errorf("could not process UB price [%s]: %w", stageNonStandardLocnPrice.UBPrice, err) + } + + intlPricingModelISLH := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceISLH, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: peakPeriod, + PerUnitCents: unit.Cents(perUnitCentsHHG), + } + intlPricingModels = append(intlPricingModels, intlPricingModelISLH) + + intlPricingModelUBP := models.ReIntlPrice{ + ContractID: gre.ContractID, + ServiceID: serviceUBP, + OriginRateAreaID: originRateAreaID, + DestinationRateAreaID: destinationRateAreaID, + IsPeakPeriod: peakPeriod, + PerUnitCents: unit.Cents(perUnitCentsUB), + } + intlPricingModels = append(intlPricingModels, intlPricingModelUBP) + + for _, model := range intlPricingModels { + copyOfModel := model // Make copy to avoid implicit memory aliasing of items from a range statement. + verrs, dbErr := appCtx.DB().ValidateAndSave(©OfModel) + if dbErr != nil { + return fmt.Errorf("error saving ReIntlPrices: %+v with error: %w", model, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReIntlPrices: %+v with validation errors: %w", model, verrs) + } + } + } + return nil +} +func (gre *GHCRateEngineImporter) getRateAreaIDForKind(rateArea string, kind string) (uuid.UUID, error) { + switch kind { + case "NSRA", "OCONUS": + intlRateAreaID, found := gre.internationalRateAreaToIDMap[rateArea] + if !found { + return uuid.Nil, fmt.Errorf("could not find rate area [%s] in international rate area map", rateArea) + } + return intlRateAreaID, nil + case "CONUS": + domesticRateAreaID, found := gre.domesticRateAreaToIDMap[rateArea] + if !found { + return uuid.Nil, fmt.Errorf("could not find rate area [%s] in domestic rate area map", rateArea) + } + return domesticRateAreaID, nil + } + + return uuid.Nil, fmt.Errorf("unexpected rate area kind [%s]", kind) +} diff --git a/pkg/services/ghcimport/import_re_intl_prices_test.go b/pkg/services/ghcimport/import_re_intl_prices_test.go new file mode 100644 index 00000000000..ae159e3197d --- /dev/null +++ b/pkg/services/ghcimport/import_re_intl_prices_test.go @@ -0,0 +1,188 @@ +package ghcimport + +import ( + "github.com/gofrs/uuid" + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importREInternationalPrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREInternationalPrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyInternationalPrices() + + // Spot check prices + suite.helperCheckInternationalPriceValues() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREInternationalPrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_prices_unique_key")) + } + }) +} +func (suite *GHCRateEngineImportSuite) Test_getRateAreaIDForKind() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + } + // Doing this here instead of a separate test function so we don't have to reload prerequisite tables + suite.Run("tests for getRateAreaIDForKind", func() { + setupTestData() + testCases := []struct { + name string + rateArea string + kind string + shouldError bool + }{ + {"good NSRA", "NSRA2", "NSRA", false}, + {"good OCONUS", "US8101000", "OCONUS", false}, + {"good CONUS", "US47", "CONUS", false}, + {"bad NSRA", "XYZ", "NSRA", true}, + {"bad OCONUS", "US47", "OCONUS", true}, + {"bad CONUS", "NSRA13", "CONUS", true}, + {"bad kind", "NSRA2", "NNNN", true}, + } + + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + for _, testCase := range testCases { + suite.Run(testCase.name, func() { + id, err := gre.getRateAreaIDForKind(testCase.rateArea, testCase.kind) + if testCase.shouldError { + suite.Error(err) + suite.Equal(uuid.Nil, id) + } else { + suite.NoError(err) + + // Fetch the UUID from the database and see if it matches + origin, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.rateArea) + suite.NoError(err) + suite.Equal(origin.ID, id) + } + }) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyInternationalPrices() { + count, err := suite.DB().Count(&models.ReIntlPrice{}) + suite.NoError(err) + suite.Equal(46640, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckInternationalPriceValues() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + // Spot check one non-peak/peak record of each type + testCases := []struct { + serviceCode models.ReServiceCode + originRateArea string + destinationRateArea string + isPeakPeriod bool + expectedPrice int + }{ + // 3a: OCONUS to OCONUS + {models.ReServiceCodeISLH, "GE", "US8101000", false, 1021}, + {models.ReServiceCodeUBP, "GE", "US8101000", false, 1717}, + {models.ReServiceCodeISLH, "GE", "US8101000", true, 1205}, + {models.ReServiceCodeUBP, "GE", "US8101000", true, 2026}, + // 3b: CONUS to OCONUS + {models.ReServiceCodeISLH, "US47", "AS11", false, 3090}, + {models.ReServiceCodeUBP, "US47", "AS11", false, 3398}, + {models.ReServiceCodeISLH, "US47", "AS11", true, 3646}, + {models.ReServiceCodeUBP, "US47", "AS11", true, 4010}, + // 3c: OCONUS to CONUS + {models.ReServiceCodeISLH, "US8101000", "US68", false, 1757}, + {models.ReServiceCodeUBP, "US8101000", "US68", false, 3445}, + {models.ReServiceCodeISLH, "US8101000", "US68", true, 2073}, + {models.ReServiceCodeUBP, "US8101000", "US68", true, 4065}, + // 3e: NSRA to NSRA + {models.ReServiceCodeISLH, "NSRA2", "NSRA13", false, 4849}, + {models.ReServiceCodeUBP, "NSRA2", "NSRA13", false, 4793}, + {models.ReServiceCodeISLH, "NSRA2", "NSRA13", true, 5722}, + {models.ReServiceCodeUBP, "NSRA2", "NSRA13", true, 5656}, + // 3e: NSRA to OCONUS + {models.ReServiceCodeISLH, "NSRA13", "AS11", false, 5172}, + {models.ReServiceCodeUBP, "NSRA13", "AS11", false, 1175}, + {models.ReServiceCodeISLH, "NSRA13", "AS11", true, 6103}, + {models.ReServiceCodeUBP, "NSRA13", "AS11", true, 1386}, + // 3e: OCONUS to NSRA + {models.ReServiceCodeISLH, "GE", "NSRA2", false, 4872}, + {models.ReServiceCodeUBP, "GE", "NSRA2", false, 1050}, + {models.ReServiceCodeISLH, "GE", "NSRA2", true, 5749}, + {models.ReServiceCodeUBP, "GE", "NSRA2", true, 1239}, + // 3e: NSRA to CONUS + {models.ReServiceCodeISLH, "NSRA2", "US4965500", false, 931}, + {models.ReServiceCodeUBP, "NSRA2", "US4965500", false, 1717}, + {models.ReServiceCodeISLH, "NSRA2", "US4965500", true, 1099}, + {models.ReServiceCodeUBP, "NSRA2", "US4965500", true, 2026}, + // 3e: CONUS to NSRA + {models.ReServiceCodeISLH, "US68", "NSRA13", false, 1065}, + {models.ReServiceCodeUBP, "US68", "NSRA13", false, 1689}, + {models.ReServiceCodeISLH, "US68", "NSRA13", true, 1257}, + {models.ReServiceCodeUBP, "US68", "NSRA13", true, 1993}, + } + + for _, testCase := range testCases { + var service models.ReService + err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) + suite.NoError(err) + + // Get origin rate area UUID. + origin, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.originRateArea) + suite.NoError(err) + + // Get destination rate area UUID. + destination, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.destinationRateArea) + suite.NoError(err) + + var intlPrice models.ReIntlPrice + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("service_id = ?", service.ID). + Where("origin_rate_area_id = ?", origin.ID). + Where("destination_rate_area_id = ?", destination.ID). + Where("is_peak_period = ?", testCase.isPeakPeriod). + First(&intlPrice) + suite.NoError(err) + suite.Equal(unit.Cents(testCase.expectedPrice), intlPrice.PerUnitCents, "test case: %+v", testCase) + } +} diff --git a/pkg/services/ghcimport/import_re_rate_area.go b/pkg/services/ghcimport/import_re_rate_area.go new file mode 100644 index 00000000000..f613f02c61c --- /dev/null +++ b/pkg/services/ghcimport/import_re_rate_area.go @@ -0,0 +1,261 @@ +package ghcimport + +import ( + "fmt" + + "github.com/gobuffalo/validate/v3" + "github.com/gofrs/uuid" + "github.com/pkg/errors" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (gre *GHCRateEngineImporter) importRERateArea(appCtx appcontext.AppContext) error { + var err error + //maps the domestic rate areas to a UUID + gre.domesticRateAreaToIDMap, err = gre.importDomesticRateAreas(appCtx) + if err != nil { + return fmt.Errorf("importRERateArea failed to import: %w", err) + } + //maps the international rate areas to a UUID + gre.internationalRateAreaToIDMap, err = gre.importInternationalRateAreas(appCtx) + if err != nil { + return fmt.Errorf("importRERateArea failed to import: %w", err) + } + return nil +} + +func (gre *GHCRateEngineImporter) importDomesticRateAreas(appCtx appcontext.AppContext) (map[string]uuid.UUID, error) { + rateAreaToIDMap := make(map[string]uuid.UUID) + + // have to read international tables to get the domestic rate areas + + // models.StageConusToOconusPrice + var conusToOconus []models.StageConusToOconusPrice + err := appCtx.DB().All(&conusToOconus) + + if err != nil { + return nil, fmt.Errorf("failed to query all StageConusToOconusPrice: %w", err) + } + for _, ra := range conusToOconus { + if _, found := rateAreaToIDMap[ra.OriginDomesticPriceAreaCode]; !found { + // does the rate area already exist in the rate engine + var rateArea *models.ReRateArea + rateArea, err = models.FetchReRateAreaItem(appCtx.DB(), gre.ContractID, ra.OriginDomesticPriceAreaCode) + if err != nil { + if err.Error() != models.RecordNotFoundErrorString { + return nil, fmt.Errorf("failed importing re_rate_area from StageConusToOconusPrice with code: <%s> error: %w", ra.OriginDomesticPriceAreaCode, err) + } + } + + // if it does exist, compare and update information if different + if rateArea != nil { + update := false + + if rateArea.Name != ra.OriginDomesticPriceArea { + rateArea.Name = ra.OriginDomesticPriceArea + update = true + } + + // these are domestic rates + if rateArea.IsOconus { + rateArea.IsOconus = false + update = true + } + + if update { + var verrs *validate.Errors + verrs, err = appCtx.DB().ValidateAndSave(rateArea) + if err != nil || verrs.HasAny() { + var dbError string + if err != nil { + dbError = err.Error() + } + if verrs.HasAny() { + dbError = dbError + verrs.Error() + } + return nil, fmt.Errorf("error saving ReRateArea from StageConusToOconusPrice with rate are ID: %s error: %w", ra.OriginDomesticPriceAreaCode, errors.New(dbError)) + } + } + // add to map + rateAreaToIDMap[ra.OriginDomesticPriceAreaCode] = rateArea.ID + + // if it does not exist, insert into ReRateArea + } else if rateArea == nil { + // insert into re_rate_area + newRateArea := models.ReRateArea{ + ContractID: gre.ContractID, + IsOconus: false, + Code: ra.OriginDomesticPriceAreaCode, + Name: ra.OriginDomesticPriceArea, + } + var verrs *validate.Errors + verrs, err = appCtx.DB().ValidateAndCreate(&newRateArea) + if err != nil || verrs.HasAny() { + var dbError string + if err != nil { + dbError = err.Error() + } + if verrs.HasAny() { + dbError = dbError + verrs.Error() + } + return nil, fmt.Errorf("error creating ReRateArea from StageConusToOconusPrice with rate are ID: %s error: %w", ra.OriginDomesticPriceAreaCode, errors.New(dbError)) + } + // add to map + rateAreaToIDMap[ra.OriginDomesticPriceAreaCode] = newRateArea.ID + } + } + } + + // models.StageOconusToConusPrice + var oconusToConus []models.StageOconusToConusPrice + err = appCtx.DB().All(&oconusToConus) + if err != nil { + return nil, fmt.Errorf("failed to query all StageOconusToConusPrice error: %w", err) + } + for _, ra := range oconusToConus { + if _, found := rateAreaToIDMap[ra.DestinationDomesticPriceAreaCode]; !found { + // does the rate area already exist in the rate engine + rateArea, err := models.FetchReRateAreaItem(appCtx.DB(), gre.ContractID, ra.DestinationDomesticPriceAreaCode) + if err != nil { + if err.Error() != models.RecordNotFoundErrorString { + return nil, fmt.Errorf("failed importing re_rate_area from StageOconusToConusPrice with code <%s> error: %w", ra.DestinationDomesticPriceAreaCode, err) + } + } + + // if it does exist, compare and update information if different + if rateArea != nil { + update := false + + if rateArea.Name != ra.DestinationDomesticPriceArea { + rateArea.Name = ra.DestinationDomesticPriceArea + update = true + } + + // these are domestic rates + if rateArea.IsOconus { + rateArea.IsOconus = false + update = true + } + + if update { + verrs, err := appCtx.DB().ValidateAndSave(rateArea) + if err != nil || verrs.HasAny() { + var dbError string + if err != nil { + dbError = err.Error() + } + if verrs.HasAny() { + dbError = dbError + verrs.Error() + } + return nil, fmt.Errorf("error saving ReRateArea from StageOconusToConusPrice with rate are ID: %s error: %w", ra.DestinationDomesticPriceAreaCode, errors.New(dbError)) + } + } + + // add to map + rateAreaToIDMap[ra.DestinationDomesticPriceAreaCode] = rateArea.ID + + // if it does not exist, insert into ReRateArea + } else if rateArea == nil { + // insert into re_rate_area + newRateArea := models.ReRateArea{ + ContractID: gre.ContractID, + IsOconus: false, + Code: ra.DestinationDomesticPriceAreaCode, + Name: ra.DestinationDomesticPriceArea, + } + verrs, err := appCtx.DB().ValidateAndCreate(&newRateArea) + if err != nil || verrs.HasAny() { + var dbError string + if err != nil { + dbError = err.Error() + } + if verrs.HasAny() { + dbError = dbError + verrs.Error() + } + return nil, fmt.Errorf("error creating ReRateArea from StageOconusToConusPrice with rate are ID: %s error: %w", ra.DestinationDomesticPriceAreaCode, errors.New(dbError)) + } + // add to map + rateAreaToIDMap[ra.DestinationDomesticPriceAreaCode] = newRateArea.ID + } + } + } + + return rateAreaToIDMap, nil +} + +func (gre *GHCRateEngineImporter) importInternationalRateAreas(appCtx appcontext.AppContext) (map[string]uuid.UUID, error) { + var serviceAreas []models.StageInternationalServiceArea + + err := appCtx.DB().All(&serviceAreas) + if err != nil { + return nil, fmt.Errorf("failed to query all StageInternationalServiceArea: %w", err) + } + + rateAreaToIDMap := make(map[string]uuid.UUID) + for _, sa := range serviceAreas { + if _, found := rateAreaToIDMap[sa.RateAreaID]; !found { + // query for ReRateArea + rateArea, err := models.FetchReRateAreaItem(appCtx.DB(), gre.ContractID, sa.RateAreaID) + if err != nil { + if err.Error() != models.RecordNotFoundErrorString { + return nil, fmt.Errorf("failed importing re_rate_area from StageInternationalServiceArea with code <%s> error: %w", sa.RateAreaID, err) + } + } + // if it does exist, compare and update information if different + if rateArea != nil { + update := false + + if !rateArea.IsOconus { + rateArea.IsOconus = true + update = true + } + if rateArea.Name != sa.RateArea { + rateArea.Name = sa.RateArea + update = true + } + if update { + verrs, err := appCtx.DB().ValidateAndSave(rateArea) + if err != nil || verrs.HasAny() { + var dbError string + if err != nil { + dbError = err.Error() + } + if verrs.HasAny() { + dbError = dbError + verrs.Error() + } + return nil, fmt.Errorf("error saving ReRateArea from StageInternationalServiceArea with rate are ID: %s error: %w", sa.RateAreaID, errors.New(dbError)) + } + } + // add to map + rateAreaToIDMap[sa.RateAreaID] = rateArea.ID + + // if it does not exist, insert into ReRateArea + } else if rateArea == nil { + // insert into re_rate_area + newRateArea := models.ReRateArea{ + ContractID: gre.ContractID, + IsOconus: true, + Code: sa.RateAreaID, + Name: sa.RateArea, + } + verrs, err := appCtx.DB().ValidateAndCreate(&newRateArea) + if err != nil || verrs.HasAny() { + var dbError string + if err != nil { + dbError = err.Error() + } + if verrs.HasAny() { + dbError = dbError + verrs.Error() + } + return nil, fmt.Errorf("error creating ReRateArea from StageInternationalServiceArea with rate are ID: %s error: %w", sa.RateAreaID, errors.New(dbError)) + } + // add to map + rateAreaToIDMap[sa.RateAreaID] = newRateArea.ID + } + } + } + + return rateAreaToIDMap, nil +} diff --git a/pkg/services/ghcimport/import_re_rate_area_test.go b/pkg/services/ghcimport/import_re_rate_area_test.go new file mode 100644 index 00000000000..37e047349fe --- /dev/null +++ b/pkg/services/ghcimport/import_re_rate_area_test.go @@ -0,0 +1,223 @@ +package ghcimport + +import ( + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) helperImportRERateArea(action string) { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", testContractCode).First(&contract) + suite.NoError(err) + + // Update domestic US6B name "Texas-South" to something else and verify it was changed back when done + var texas *models.ReRateArea + texas, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") + suite.NoError(err) + suite.Equal(true, suite.NotNil(texas)) + suite.Equal("Texas-South", texas.Name) + + // Update oconus US8101000 name "Alaska (Zone) I" to something else and verify it was changed back when done + var alaska *models.ReRateArea + alaska, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US8101000") + suite.NoError(err) + suite.Equal(true, suite.NotNil(alaska)) + suite.Equal("Alaska (Zone) I", alaska.Name) + + // Update oconus AS11 name "New South Wales/Australian Capital Territory" + var wales *models.ReRateArea + wales, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "AS11") + suite.NoError(err) + suite.Equal(true, suite.NotNil(wales)) + suite.Equal("New South Wales/Australian Capital Territory", wales.Name) + + if action == "setup" { + modifiedName := "New name" + texas.Name = modifiedName + suite.MustSave(texas) + texas, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") + suite.NoError(err) + suite.Equal(modifiedName, texas.Name) + + modifiedName = "New name 2" + alaska.Name = modifiedName + suite.MustSave(alaska) + alaska, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US8101000") + suite.NoError(err) + suite.Equal(modifiedName, alaska.Name) + + modifiedName = "New name 3" + wales.Name = modifiedName + suite.MustSave(wales) + wales, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "AS11") + suite.NoError(err) + suite.Equal(modifiedName, wales.Name) + } +} + +func (suite *GHCRateEngineImportSuite) helperVerifyDomesticRateAreaToIDMap(contractCode string, domesticRateAreaToIDMap map[string]uuid.UUID) { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", contractCode).First(&contract) + suite.NoError(err) + + suite.NotEqual(map[string]uuid.UUID(nil), domesticRateAreaToIDMap) + count, dbErr := suite.DB(). + Where("contract_id = ?", contract.ID). + Where("is_oconus = 'false'"). + Count(models.ReRateArea{}) + suite.NoError(dbErr) + + suite.Equal(12, count) + suite.Equal(count, len(domesticRateAreaToIDMap)) + + var rateArea models.ReRateArea + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("code = 'US68'"). + First(&rateArea) + suite.NoError(err) + + suite.Equal("Texas-South", rateArea.Name) + suite.Equal(rateArea.ID, domesticRateAreaToIDMap["US68"]) + + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("code = 'US47'"). + First(&rateArea) + suite.NoError(err) + + suite.Equal("Alabama", rateArea.Name) + suite.Equal(rateArea.ID, domesticRateAreaToIDMap["US47"]) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyInternationalRateAreaToIDMap(contractCode string, internationalRateAreaToIDMap map[string]uuid.UUID) { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", contractCode).First(&contract) + suite.NoError(err) + + suite.NotEqual(map[string]uuid.UUID(nil), internationalRateAreaToIDMap) + count, dbErr := suite.DB(). + Where("contract_id = ?", contract.ID). + Where("is_oconus = 'true'"). + Count(models.ReRateArea{}) + suite.NoError(dbErr) + + suite.Equal(5, count) + suite.Equal(count, len(internationalRateAreaToIDMap)) + + var rateArea models.ReRateArea + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("code = 'GE'"). + First(&rateArea) + suite.NoError(err) + + suite.Equal("Germany", rateArea.Name) + suite.Equal(rateArea.ID, internationalRateAreaToIDMap["GE"]) + + err = suite.DB(). + Where("contract_id = ?", contract.ID). + Where("code = 'US8101000'"). + First(&rateArea) + suite.NoError(err) + + suite.Equal("Alaska (Zone) I", rateArea.Name) + suite.Equal(rateArea.ID, internationalRateAreaToIDMap["US8101000"]) +} + +func (suite *GHCRateEngineImportSuite) helperImportRERateAreaVerifyImportComplete(contractCode string) { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = ?", contractCode).First(&contract) + suite.NoError(err) + + var rateArea models.ReRateArea + count, countErr := suite.DB().Where("contract_id = ?", contract.ID).Count(&rateArea) + + suite.NoError(countErr) + suite.Equal(17, count) +} + +func (suite *GHCRateEngineImportSuite) TestGHCRateEngineImporter_importRERateArea() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + //Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("Successfully run import with staged staging data (empty RE tables)", func() { + setupTestData() + suite.helperImportRERateAreaVerifyImportComplete(testContractCode) + + suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) + suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) + }) + + suite.Run("Successfully run import, 2nd time, with staged staging data and filled in RE tables", func() { + setupTestData() + + err := gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + suite.helperImportRERateAreaVerifyImportComplete(testContractCode) + + suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) + suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) + }) + + suite.Run("Successfully run import, prefilled re_rate_areas, update existing rate area from import", func() { + setupTestData() + suite.helperImportRERateArea("setup") + + err := gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + suite.helperImportRERateAreaVerifyImportComplete(testContractCode) + + suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) + suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) + suite.helperImportRERateArea("verify") + }) + + suite.Run("Fail to run import, missing staging table", func() { + renameQuery := "ALTER TABLE stage_conus_to_oconus_prices RENAME TO missing_stage_conus_to_oconus_prices" + renameErr := suite.DB().RawQuery(renameQuery).Exec() + suite.NoError(renameErr) + + err := gre.importRERateArea(suite.AppContextForTest()) + suite.Error(err) + }) + + suite.Run("Run with 2 different contract codes, should add new records both times", func() { + setupTestData() + err := gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + + gre2 := &GHCRateEngineImporter{ + ContractCode: testContractCode2, + } + + // Prerequisite tables must be loaded. + err = gre2.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre2.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + suite.helperImportRERateAreaVerifyImportComplete(testContractCode2) + + suite.helperVerifyDomesticRateAreaToIDMap(testContractCode2, gre2.domesticRateAreaToIDMap) + suite.helperVerifyInternationalRateAreaToIDMap(testContractCode2, gre2.internationalRateAreaToIDMap) + + // Make sure the other contract's records are still there too. + suite.helperImportRERateAreaVerifyImportComplete(testContractCode) + }) +} diff --git a/pkg/services/ghcimport/import_re_shipment_type_prices.go b/pkg/services/ghcimport/import_re_shipment_type_prices.go new file mode 100644 index 00000000000..eb7d6c79894 --- /dev/null +++ b/pkg/services/ghcimport/import_re_shipment_type_prices.go @@ -0,0 +1,74 @@ +package ghcimport + +import ( + "fmt" + "strconv" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (gre *GHCRateEngineImporter) importREShipmentTypePrices(appCtx appcontext.AppContext) error { + //tab 5a) Access. and Add. Prices + var domesticIntlAddlPrices []models.StageDomesticInternationalAdditionalPrice + err := appCtx.DB().All(&domesticIntlAddlPrices) + if err != nil { + return fmt.Errorf("could not read staged domestic international additional prices: %w", err) + } + + var serviceToCodeMap = map[string]models.ReServiceCode{ + //concatenating market with shipment type so that keys in map are unique + "CONUS:Mobile Homes": models.ReServiceCodeDMHF, + "CONUS:Tow Away Boat Service": models.ReServiceCodeDBTF, + "OCONUS:Tow Away Boat Service": models.ReServiceCodeIBTF, + "CONUS:Haul Away Boat Service": models.ReServiceCodeDBHF, + "OCONUS:Haul Away Boat Service": models.ReServiceCodeIBHF, + "CONUS:NTS Packing Factor": models.ReServiceCodeDNPK, + "OCONUS:NTS Packing Factor": models.ReServiceCodeINPK, + } + + //loop through the domestic international additional prices data and store in db + for _, stageDomesticIntlAddlPrices := range domesticIntlAddlPrices { + //shipment codes stored in the re_services table + factor, err := strconv.ParseFloat(stageDomesticIntlAddlPrices.Factor, 64) + if err != nil { + return fmt.Errorf("could not process factor [%s]: %w", stageDomesticIntlAddlPrices.Factor, err) + } + + market, err := getMarket(stageDomesticIntlAddlPrices.Market) + if err != nil { + return fmt.Errorf("could not process market [%s]: %w", stageDomesticIntlAddlPrices.Market, err) + } + + shipmentTypeFound := false + for shipmentType, serviceCode := range serviceToCodeMap { + if shipmentType == stageDomesticIntlAddlPrices.Market+":"+stageDomesticIntlAddlPrices.ShipmentType { + shipmentTypeFound = true + serviceID, found := gre.serviceToIDMap[serviceCode] + if !found { + return fmt.Errorf("missing service [%s] in map of services", serviceCode) + } + + shipmentTypePrice := models.ReShipmentTypePrice{ + ContractID: gre.ContractID, + Market: market, + ServiceID: serviceID, + Factor: factor, + } + + verrs, dbErr := appCtx.DB().ValidateAndSave(&shipmentTypePrice) + if dbErr != nil { + return fmt.Errorf("error saving ReShipmentTypePrices: %+v with error: %w", shipmentTypePrice, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReShipmentTypePrices: %+v with validation errors: %w", shipmentTypePrice, verrs) + } + } + } + if !shipmentTypeFound { + return fmt.Errorf("shipment type [%s] not found", stageDomesticIntlAddlPrices.ShipmentType) + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_shipment_type_prices_test.go b/pkg/services/ghcimport/import_re_shipment_type_prices_test.go new file mode 100644 index 00000000000..adc6f6907b1 --- /dev/null +++ b/pkg/services/ghcimport/import_re_shipment_type_prices_test.go @@ -0,0 +1,66 @@ +package ghcimport + +import ( + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_importREShipmentTypePrices() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREShipmentTypePrices(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyShipmentTypePrices() + suite.helperCheckShipmentTypePrices() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importREShipmentTypePrices(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_shipment_type_prices_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyShipmentTypePrices() { + count, err := suite.DB().Count(&models.ReShipmentTypePrice{}) + suite.NoError(err) + suite.Equal(7, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckShipmentTypePrices() { + // Get contract UUID. + var contract models.ReContract + err := suite.DB().Where("code = $1", testContractCode).First(&contract) + suite.NoError(err) + + // Get service UUID for shipment type + var service models.ReService + err = suite.DB().Where("code = $1", models.ReServiceCodeDMHF).First(&service) + suite.NoError(err) + + var shipmentTypePrices models.ReShipmentTypePrice + err = suite.DB(). + Where("contract_id = $1", contract.ID). + Where("service_id = $2", service.ID). + First(&shipmentTypePrices) + suite.NoError(err) + suite.Equal(1.20, shipmentTypePrices.Factor) +} diff --git a/pkg/services/ghcimport/import_re_task_order_fees.go b/pkg/services/ghcimport/import_re_task_order_fees.go new file mode 100644 index 00000000000..3a0df39766c --- /dev/null +++ b/pkg/services/ghcimport/import_re_task_order_fees.go @@ -0,0 +1,94 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (gre *GHCRateEngineImporter) importRETaskOrderFees(appCtx appcontext.AppContext) error { + //tab 4a) Mgmt., Coun., Trans. Prices + var shipmentManagementServices []models.StageShipmentManagementServicesPrice + err := appCtx.DB().All(&shipmentManagementServices) + if err != nil { + return fmt.Errorf("could not read staged shipment management service prices: %w", err) + } + + //loop through the shipment management service data, pull data for management services and save in db + for _, stageShipmentManagementServicePrice := range shipmentManagementServices { + shipmentManagementService, foundService := gre.serviceToIDMap[models.ReServiceCodeMS] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeMS) + } + + contractYear := stageShipmentManagementServicePrice.ContractYear + contractYearID, found := gre.contractYearToIDMap[contractYear] + if !found { + return fmt.Errorf("could not find contract year %s in map", stageShipmentManagementServicePrice.ContractYear) + } + + var perUnitCentsService int + perUnitCentsService, err = priceToCents(stageShipmentManagementServicePrice.PricePerTaskOrder) + if err != nil { + return fmt.Errorf("could not process shipment management service price [%s]: %w", stageShipmentManagementServicePrice.PricePerTaskOrder, err) + } + + taskOrderFee := models.ReTaskOrderFee{ + ContractYearID: contractYearID, + ServiceID: shipmentManagementService, + PriceCents: unit.Cents(perUnitCentsService), + } + + verrs, dbErr := appCtx.DB().ValidateAndSave(&taskOrderFee) + if dbErr != nil { + return fmt.Errorf("error saving ReTaskOrderFees: %+v with error: %w", taskOrderFee, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReTaskOrderFees: %+v with validation errors: %w", taskOrderFee, verrs) + } + } + + var shipmentCounselingServices []models.StageCounselingServicesPrice + err = appCtx.DB().All(&shipmentCounselingServices) + if err != nil { + return fmt.Errorf("could not read staged shipment counseling service prices: %w", err) + } + + //loop through the shipment management service data, pull data for counseling services and save in db + for _, stageShipmentCounselingServicePrice := range shipmentCounselingServices { + shipmentCounselingService, foundService := gre.serviceToIDMap[models.ReServiceCodeCS] + if !foundService { + return fmt.Errorf("missing service %s in map of services", models.ReServiceCodeCS) + } + + contractYear := stageShipmentCounselingServicePrice.ContractYear + contractYearID, found := gre.contractYearToIDMap[contractYear] + if !found { + return fmt.Errorf("could not find contract year %s in map", stageShipmentCounselingServicePrice.ContractYear) + } + + var perUnitCentsService int + perUnitCentsService, err = priceToCents(stageShipmentCounselingServicePrice.PricePerTaskOrder) + if err != nil { + return fmt.Errorf("could not process shipment counseling service price [%s]: %w", stageShipmentCounselingServicePrice.PricePerTaskOrder, err) + } + + taskOrderFee := models.ReTaskOrderFee{ + ContractYearID: contractYearID, + ServiceID: shipmentCounselingService, + PriceCents: unit.Cents(perUnitCentsService), + } + + verrs, dbErr := appCtx.DB().ValidateAndSave(&taskOrderFee) + if dbErr != nil { + return fmt.Errorf("error saving ReTaskOrderFees: %+v with error: %w", taskOrderFee, dbErr) + } + if verrs.HasAny() { + return fmt.Errorf("error saving ReTaskOrderFees: %+v with validation errors: %w", taskOrderFee, verrs) + } + } + + return nil +} diff --git a/pkg/services/ghcimport/import_re_task_order_fees_test.go b/pkg/services/ghcimport/import_re_task_order_fees_test.go new file mode 100644 index 00000000000..365f125f08c --- /dev/null +++ b/pkg/services/ghcimport/import_re_task_order_fees_test.go @@ -0,0 +1,83 @@ +package ghcimport + +import ( + "github.com/jackc/pgerrcode" + + "github.com/transcom/mymove/pkg/db/dberr" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/unit" +) + +func (suite *GHCRateEngineImportSuite) Test_importRETaskOrderFees() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + ContractStartDate: testContractStartDate, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREContractYears(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importRETaskOrderFees(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("import success", func() { + setupTestData() + suite.helperVerifyTaskOrderFees() + suite.helperCheckTaskOrderFees() + }) + + suite.Run("run a second time; should fail immediately due to constraint violation", func() { + setupTestData() + err := gre.importRETaskOrderFees(suite.AppContextForTest()) + if suite.Error(err) { + suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_task_order_fees_unique_key")) + } + }) +} + +func (suite *GHCRateEngineImportSuite) helperVerifyTaskOrderFees() { + count, err := suite.DB().Count(&models.ReTaskOrderFee{}) + suite.NoError(err) + suite.Equal(16, count) +} + +func (suite *GHCRateEngineImportSuite) helperCheckTaskOrderFees() { + // Get service UUID. + var serviceMS models.ReService + err := suite.DB().Where("code = $1", models.ReServiceCodeMS).First(&serviceMS) + suite.NoError(err) + + var serviceCS models.ReService + err = suite.DB().Where("code = $1", models.ReServiceCodeCS).First(&serviceCS) + suite.NoError(err) + + // Get contract year UUID. + var contractYear models.ReContractYear + err = suite.DB().Where("name = 'Base Period Year 1'").First(&contractYear) + suite.NoError(err) + + var taskOrderFeeMS models.ReTaskOrderFee + err = suite.DB(). + Where("service_id = $1", serviceMS.ID). + Where("contract_year_id = $2", contractYear.ID). + First(&taskOrderFeeMS) + suite.NoError(err) + suite.Equal(unit.Cents(45115), taskOrderFeeMS.PriceCents) + + var taskOrderFeeCS models.ReTaskOrderFee + err = suite.DB(). + Where("service_id = $1", serviceCS.ID). + Where("contract_year_id = $2", contractYear.ID). + First(&taskOrderFeeCS) + suite.NoError(err) + suite.Equal(unit.Cents(22263), taskOrderFeeCS.PriceCents) +} diff --git a/pkg/services/ghcimport/load_service_map.go b/pkg/services/ghcimport/load_service_map.go new file mode 100644 index 00000000000..28969d25677 --- /dev/null +++ b/pkg/services/ghcimport/load_service_map.go @@ -0,0 +1,25 @@ +package ghcimport + +import ( + "fmt" + + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (gre *GHCRateEngineImporter) loadServiceMap(appCtx appcontext.AppContext) error { + var services models.ReServices + err := appCtx.DB().Select("id", "code").All(&services) + if err != nil { + return fmt.Errorf("could not read services: %w", err) + } + + gre.serviceToIDMap = make(map[models.ReServiceCode]uuid.UUID) + for _, service := range services { + gre.serviceToIDMap[service.Code] = service.ID + } + + return nil +} diff --git a/pkg/services/ghcimport/load_service_map_test.go b/pkg/services/ghcimport/load_service_map_test.go new file mode 100644 index 00000000000..840505fbbe4 --- /dev/null +++ b/pkg/services/ghcimport/load_service_map_test.go @@ -0,0 +1,31 @@ +package ghcimport + +import ( + "github.com/gofrs/uuid" + + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_loadServiceMap() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + suite.Run("load success", func() { + err := gre.loadServiceMap(suite.AppContextForTest()) + suite.NoError(err) + + suite.NotNil(gre.serviceToIDMap) + + count, err := suite.DB().Count(&models.ReService{}) + suite.NoError(err) + suite.Greater(count, 0) + suite.Equal(count, len(gre.serviceToIDMap)) + + // Spot-check a service code + testServiceCode := models.ReServiceCodeDOASIT + if suite.Contains(gre.serviceToIDMap, testServiceCode) { + suite.NotEqual(uuid.Nil, gre.serviceToIDMap[testServiceCode]) + } + }) +} diff --git a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go new file mode 100644 index 00000000000..1e39e41041c --- /dev/null +++ b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas.go @@ -0,0 +1,95 @@ +package ghcimport + +import ( + "fmt" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" +) + +func (gre *GHCRateEngineImporter) mapZipCodesToRERateAreas(appCtx appcontext.AppContext) error { + err := gre.mapREZip3sToRERateAreas(appCtx) + if err != nil { + return fmt.Errorf("mapREZip3sToRERateAreas failed: %w", err) + } + + err = gre.createAndMapREZip5sToRERateAreas(appCtx) + if err != nil { + return fmt.Errorf("createAndMapREZip5sToRERateAreas failed: %w", err) + } + + return nil +} + +func (gre *GHCRateEngineImporter) mapREZip3sToRERateAreas(appCtx appcontext.AppContext) error { + var reZip3s []models.ReZip3 + + err := appCtx.DB().Where("contract_id = ?", gre.ContractID).All(&reZip3s) + if err != nil { + return fmt.Errorf("failed to collect all ReZip3 records: %w", err) + } + + for _, reZip3 := range reZip3s { + copyOfReZip3 := reZip3 // Make copy to avoid implicit memory aliasing of items from a range statement. + rateArea, found := zip3ToRateAreaMappings[copyOfReZip3.Zip3] + if !found { + return fmt.Errorf("failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", copyOfReZip3.Zip3) + } + + if rateArea == "ZIP" { + copyOfReZip3.RateAreaID = nil + copyOfReZip3.HasMultipleRateAreas = true + + verrs, err := appCtx.DB().ValidateAndUpdate(©OfReZip3) + if err != nil { + return fmt.Errorf("failed to update ReZip3 %v: %w", copyOfReZip3.Zip3, err) + } + if verrs.HasAny() { + return fmt.Errorf("failed to validate ReZip3 %v: %w", copyOfReZip3.Zip3, verrs) + } + } else { + rateAreaID, found := gre.domesticRateAreaToIDMap[rateArea] + if !found { + return fmt.Errorf("failed to find ID for rate area %s in domesticRateAreaToIDMap", rateArea) + } + + copyOfReZip3.RateAreaID = &rateAreaID + copyOfReZip3.HasMultipleRateAreas = false + + verrs, err := appCtx.DB().ValidateAndUpdate(©OfReZip3) + if err != nil { + return fmt.Errorf("failed to update ReZip3: %v: %w", copyOfReZip3.Zip3, err) + } + if verrs.HasAny() { + return fmt.Errorf("failed to validate ReZip3: %v: %w", copyOfReZip3.Zip3, verrs) + } + } + } + + return nil +} + +func (gre *GHCRateEngineImporter) createAndMapREZip5sToRERateAreas(appCtx appcontext.AppContext) error { + for zip5, rateArea := range zip5ToRateAreaMappings { + var reZip5RateArea models.ReZip5RateArea + + rateAreaID, found := gre.domesticRateAreaToIDMap[rateArea] + if !found { + return fmt.Errorf("failed to find ID for rate area %s in domesticRateAreaToIDMap", rateArea) + } + + reZip5RateArea.ContractID = gre.ContractID + reZip5RateArea.Zip5 = zip5 + reZip5RateArea.RateAreaID = rateAreaID + + verrs, err := appCtx.DB().ValidateAndCreate(&reZip5RateArea) + if err != nil { + return fmt.Errorf("failed to update ReZip5RateArea: %v: %w", reZip5RateArea.Zip5, err) + } + if verrs.HasAny() { + return fmt.Errorf("failed to validate ReZip5RateArea: %v: %w", reZip5RateArea.Zip5, verrs) + } + } + + return nil +} diff --git a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go new file mode 100644 index 00000000000..6252cb0e8df --- /dev/null +++ b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go @@ -0,0 +1,140 @@ +package ghcimport + +import ( + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_mapZipCodesToReRateAreas() { + gre := &GHCRateEngineImporter{ + ContractCode: testContractCode, + } + + setupTestData := func() { + // Prerequisite tables must be loaded. + err := gre.importREContract(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importREDomesticServiceArea(suite.AppContextForTest()) + suite.NoError(err) + + err = gre.importRERateArea(suite.AppContextForTest()) + suite.NoError(err) + } + + suite.Run("map ReZip3 records to correct ReRateArea records", func() { + setupTestData() + reContract, err := suite.helperFetchReContract() + suite.NoError(err) + + var reZip3 models.ReZip3 + err = suite.DB(). + Where("contract_id = ?", reContract.ID). + Where("zip3 = ?", "352"). + First(&reZip3) + suite.NoError(err) + + var reZip3WithMultipleReRateAreas models.ReZip3 + err = suite.DB(). + Where("contract_id = ?", reContract.ID). + Where("zip3 = ?", "327"). + First(&reZip3WithMultipleReRateAreas) + suite.NoError(err) + + suite.Nil(reZip3.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", reZip3.ID) + suite.Nil(reZip3WithMultipleReRateAreas.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", reZip3WithMultipleReRateAreas.ID) + + rateAreaCode, found := zip3ToRateAreaMappings[reZip3.Zip3] + suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip3.Zip3) + + zipRateAreaCode, found := zip3ToRateAreaMappings[reZip3WithMultipleReRateAreas.Zip3] + suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip3WithMultipleReRateAreas.Zip3) + suite.Equal(zipRateAreaCode, "ZIP", "expected rate area code to be ZIP but got %s", zipRateAreaCode) + + reRateArea, err := suite.helperFetchReRateArea(reContract, rateAreaCode) + suite.NoError(err) + + err = gre.mapREZip3sToRERateAreas(suite.AppContextForTest()) + suite.NoError(err) + + var updatedReZip3 models.ReZip3 + err = suite.DB(). + Where("id = ?", reZip3.ID). + First(&updatedReZip3) + suite.NoError(err) + + suite.NotNil(updatedReZip3.RateAreaID, "expected ReZip3 record %s to not have nil rate_area_id", updatedReZip3.ID) + suite.Equal(*updatedReZip3.RateAreaID, reRateArea.ID, "expected ReZip3 %s record to be mapped to ReRateArea record %s, but got %s", reRateArea.ID, updatedReZip3.RateAreaID) + + var updatedReZip3WithMultipleReRateAreas models.ReZip3 + err = suite.DB(). + Where("id = ?", reZip3WithMultipleReRateAreas.ID). + First(&updatedReZip3WithMultipleReRateAreas) + suite.NoError(err) + + suite.Nil(updatedReZip3WithMultipleReRateAreas.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", updatedReZip3WithMultipleReRateAreas.ID) + suite.True(updatedReZip3WithMultipleReRateAreas.HasMultipleRateAreas) + }) + + suite.Run("create ReZip5RateArea records and map to correct ReRateArea records", func() { + setupTestData() + reContract, err := suite.helperFetchReContract() + suite.NoError(err) + + reZip5RateAreasCount, err := suite.DB(). + Where("contract_id = ?", reContract.ID). + Count(&models.ReZip5RateArea{}) + suite.NoError(err) + + suite.Equal(0, reZip5RateAreasCount) + + err = gre.createAndMapREZip5sToRERateAreas(suite.AppContextForTest()) + suite.NoError(err) + + var reZip5RateArea models.ReZip5RateArea + err = suite.DB(). + Where("contract_id = ?", reContract.ID). + First(&reZip5RateArea) + suite.NoError(err) + + rateAreaCode, found := zip5ToRateAreaMappings[reZip5RateArea.Zip5] + suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip5RateArea.Zip5) + + reRateArea, err := suite.helperFetchReRateArea(reContract, rateAreaCode) + suite.NoError(err) + + suite.Equal(reZip5RateArea.RateAreaID, reRateArea.ID, "expected ReZip3 %s record to be mapped to ReRateArea record %s, but got %s", reRateArea.ID, reZip5RateArea.RateAreaID) + suite.helperVerifyNumberOfReZip5RateAreasCreated() + }) +} + +func (suite *GHCRateEngineImportSuite) helperFetchReContract() (models.ReContract, error) { + var reContract models.ReContract + err := suite.DB(). + Where("code = ?", testContractCode). + First(&reContract) + + return reContract, err +} + +func (suite *GHCRateEngineImportSuite) helperFetchReRateArea(reContract models.ReContract, rateAreaCode string) (models.ReRateArea, error) { + var reRateArea models.ReRateArea + + err := suite.DB(). + Where("contract_id = ?", reContract.ID). + Where("code = ?", rateAreaCode). + First(&reRateArea) + + return reRateArea, err +} + +func (suite *GHCRateEngineImportSuite) helperVerifyNumberOfReZip5RateAreasCreated() { + reContract, err := suite.helperFetchReContract() + suite.NoError(err) + + reZip5RateAreasCount, err := suite.DB(). + Where("contract_id = ?", reContract.ID). + Count(&models.ReZip5RateArea{}) + suite.NoError(err) + + suite.Equal(922, reZip5RateAreasCount) +} diff --git a/pkg/services/ghcimport/shared.go b/pkg/services/ghcimport/shared.go new file mode 100644 index 00000000000..3db67603b62 --- /dev/null +++ b/pkg/services/ghcimport/shared.go @@ -0,0 +1,107 @@ +package ghcimport + +import ( + "fmt" + "strconv" + "strings" + + "github.com/transcom/mymove/pkg/models" +) + +func stringToInteger(rawString string) (int, error) { + // Get rid of any decimal point + baseString := strings.Split(rawString, ".")[0] + + // Verify that it's an integer + asInteger, err := strconv.Atoi(baseString) + if err != nil { + return 0, err + } + + return asInteger, nil +} + +func cleanServiceAreaNumber(rawServiceArea string) (string, error) { + serviceAreaInt, err := stringToInteger(rawServiceArea) + if err != nil { + return "", err + } + + return fmt.Sprintf("%03d", serviceAreaInt), nil +} + +func cleanZip3(rawZip3 string) (string, error) { + zip3Int, err := stringToInteger(rawZip3) + if err != nil { + return "", err + } + + return fmt.Sprintf("%03d", zip3Int), nil +} + +func isPeakPeriod(season string) (bool, error) { + if strings.EqualFold(season, "Peak") { + return true, nil + } else if strings.EqualFold(season, "NonPeak") { + return false, nil + } + + return false, fmt.Errorf("invalid season [%s]", season) +} + +func getPriceParts(rawPrice string, expectedDecimalPlaces int) (int, int, error) { + // Get rid of a dollar sign if there is one. + basePrice := strings.Replace(rawPrice, "$", "", -1) + + // Split the string on the decimal point. + priceParts := strings.Split(basePrice, ".") + if len(priceParts) != 2 { + return 0, 0, fmt.Errorf("expected 2 price parts but found %d for price [%s]", len(priceParts), rawPrice) + } + + integerPart, err := strconv.Atoi(priceParts[0]) + if err != nil { + return 0, 0, fmt.Errorf("could not convert integer part of price [%s]", rawPrice) + } + + if len(priceParts[1]) != expectedDecimalPlaces { + return 0, 0, fmt.Errorf("expected %d decimal places but found %d for price [%s]", expectedDecimalPlaces, + len(priceParts[1]), rawPrice) + } + + fractionalPart, err := strconv.Atoi(priceParts[1]) + if err != nil { + return 0, 0, fmt.Errorf("could not convert fractional part of price [%s]", rawPrice) + } + + return integerPart, fractionalPart, nil +} + +func priceToMillicents(rawPrice string) (int, error) { + integerPart, fractionalPart, err := getPriceParts(rawPrice, 3) + if err != nil { + return 0, fmt.Errorf("could not parse price [%s]: %w", rawPrice, err) + } + + millicents := (integerPart * 100000) + (fractionalPart * 100) + return millicents, nil +} + +func priceToCents(rawPrice string) (int, error) { + integerPart, fractionalPart, err := getPriceParts(rawPrice, 2) + if err != nil { + return 0, fmt.Errorf("could not parse price [%s]: %w", rawPrice, err) + } + + cents := (integerPart * 100) + fractionalPart + return cents, nil +} + +func getMarket(market string) (models.Market, error) { + if strings.EqualFold(market, "CONUS") { + return models.MarketConus, nil + } else if strings.EqualFold(market, "OCONUS") { + return models.MarketOconus, nil + } + return "invalid market", fmt.Errorf("invalid market [%s]", market) +} diff --git a/pkg/services/ghcimport/shared_test.go b/pkg/services/ghcimport/shared_test.go new file mode 100644 index 00000000000..51fb83001d2 --- /dev/null +++ b/pkg/services/ghcimport/shared_test.go @@ -0,0 +1,219 @@ +package ghcimport + +import ( + "github.com/transcom/mymove/pkg/models" +) + +func (suite *GHCRateEngineImportSuite) Test_stringToInteger() { + tests := []struct { + name string + input string + expected int + shouldError bool + }{ + {"with decimal point", "25.0", 25, false}, + {"no decimal point", "25", 25, false}, + {"not a number", "2A", 0, true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + result, err := stringToInteger(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_cleanServiceAreaNumber() { + tests := []struct { + name string + input string + expected string + shouldError bool + }{ + {"with decimal point, needs leading zeros", "4.0", "004", false}, + {"no decimal point", "225", "225", false}, + {"not a number", "B3", "", true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + result, err := cleanServiceAreaNumber(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_cleanZip3() { + tests := []struct { + name string + input string + expected string + shouldError bool + }{ + {"with decimal point, needs leading zeros", "15.0", "015", false}, + {"no decimal point", "309", "309", false}, + {"not a number", "30L", "", true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + result, err := cleanZip3(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_isPeakPeriod() { + tests := []struct { + name string + input string + expected bool + shouldError bool + }{ + {"peak", "Peak", true, false}, + {"peak, upper case", "PEAK", true, false}, + {"non-peak", "NonPeak", false, false}, + {"non-peak, upper case", "NONPEAK", false, false}, + {"invalid period", "Non-Peak", false, true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + result, err := isPeakPeriod(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_getPriceParts() { + tests := []struct { + name string + rawPrice string + decimalPlaces int + expectedIntegerPart int + expectedFractionalPart int + shouldError bool + }{ + {"at expected decimal places", "$3.557", 3, 3, 557, false}, + {"less than max decimal places", "$3.5", 3, 0, 0, true}, + {"more than max decimal places", "$3.5777", 3, 0, 0, true}, + {"no dollar sign", "2.001", 3, 2, 1, false}, + {"very small, no dollar sign", "0.005", 3, 0, 5, false}, + {"no decimal point", "1", 3, 0, 0, true}, + {"invalid price", "$3.ABC", 3, 0, 0, true}, + {"empty string", "", 4, 0, 0, true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + integerPart, fractionalPart, err := getPriceParts(test.rawPrice, test.decimalPlaces) + suite.Equal(test.expectedIntegerPart, integerPart) + suite.Equal(test.expectedFractionalPart, fractionalPart) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_priceToMillicents() { + tests := []struct { + name string + input string + expected int + shouldError bool + }{ + {"price with dollar sign", "$3.557", 355700, false}, + {"leading zeros in decimal part", "$3.005", 300500, false}, + {"two decimal places", "$3.55", 0, true}, + {"more than expected decimal places", "$3.5571", 0, true}, + {"input of zero", "0", 0, true}, + {"empty string", "", 0, true}, + {"price without dollar sign", "0.001", 100, false}, + {"price as integer", "3", 0, true}, + {"not a number", "3.53X", 0, true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + result, err := priceToMillicents(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_priceToCents() { + tests := []struct { + name string + input string + expected int + shouldError bool + }{ + {"price with dollar sign", "$3.55", 355, false}, + {"leading zeros in decimal part", "$3.01", 301, false}, + {"more than expected decimal places", "$3.551", 0, true}, + {"input of zero", "0", 0, true}, + {"empty string", "", 0, true}, + {"price without dollar sign", "0.01", 1, false}, + {"price as integer", "3", 0, true}, + {"not a number", "3.5X", 0, true}, + } + for _, test := range tests { + suite.Run(test.name, func() { + result, err := priceToCents(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} + +func (suite *GHCRateEngineImportSuite) Test_getMarket() { + tests := []struct { + name string + input string + expected models.Market + shouldError bool + }{ + {"CONUS", "CONUS", "C", false}, + {"OCONUS", "OCONUS", "O", false}, + {"XONUS", "XONUS", "invalid market", true}, + } + + for _, test := range tests { + suite.Run(test.name, func() { + result, err := getMarket(test.input) + suite.Equal(test.expected, result) + if test.shouldError { + suite.Error(err) + } else { + suite.NoError(err) + } + }) + } +} diff --git a/pkg/services/ghcimport/zip3_to_rate_area_mappings.go b/pkg/services/ghcimport/zip3_to_rate_area_mappings.go new file mode 100644 index 00000000000..1212576fbec --- /dev/null +++ b/pkg/services/ghcimport/zip3_to_rate_area_mappings.go @@ -0,0 +1,913 @@ +package ghcimport + +var zip3ToRateAreaMappings = map[string]string{ + // Zip3 Rate Area + "010": "US14", + "011": "US14", + "012": "US14", + "013": "US14", + "014": "US14", + "015": "US14", + "016": "US14", + "017": "US14", + "018": "US14", + "019": "US14", + "020": "US14", + "021": "US14", + "022": "US14", + "023": "US14", + "024": "US14", + "025": "US14", + "026": "US14", + "027": "US14", + "028": "US15", + "029": "US15", + "030": "US12", + "031": "US12", + "032": "US12", + "033": "US12", + "034": "US12", + "035": "US12", + "036": "US12", + "037": "US12", + "038": "US12", + "039": "US11", + "040": "US11", + "041": "US11", + "042": "US11", + "043": "US11", + "044": "US11", + "045": "US11", + "046": "US11", + "047": "US11", + "048": "US11", + "049": "US11", + "050": "US13", + "051": "US13", + "052": "US13", + "053": "US13", + "054": "US13", + "055": "US14", + "056": "US13", + "057": "US13", + "058": "US13", + "059": "US12", + "060": "US16", + "061": "US16", + "062": "US16", + "063": "US16", + "064": "US16", + "065": "US16", + "066": "US16", + "067": "US16", + "068": "US16", + "069": "US16", + "070": "US19", + "071": "US19", + "072": "US19", + "073": "US19", + "074": "US19", + "075": "US19", + "076": "US19", + "077": "US19", + "078": "US19", + "079": "US19", + "080": "US19", + "081": "US19", + "082": "US19", + "083": "US19", + "084": "US19", + "085": "US19", + "086": "US19", + "087": "US19", + "088": "US19", + "089": "US19", + "100": "US17", + "101": "US17", + "102": "US17", + "103": "US17", + "104": "US17", + "105": "US17", + "106": "US17", + "107": "US17", + "108": "US17", + "109": "US17", + "110": "US17", + "111": "US17", + "112": "US17", + "113": "US17", + "114": "US17", + "115": "US17", + "116": "US17", + "117": "US17", + "118": "US17", + "119": "US17", + "120": "US17", + "121": "US17", + "122": "US17", + "123": "US17", + "124": "US17", + "125": "US17", + "126": "US17", + "127": "US17", + "128": "US17", + "129": "US17", + "130": "US17", + "131": "US17", + "132": "US17", + "133": "US17", + "134": "US17", + "135": "US17", + "136": "US17", + "137": "US17", + "138": "US17", + "139": "US17", + "140": "US17", + "141": "US17", + "142": "US17", + "143": "US17", + "144": "US17", + "145": "US17", + "146": "US17", + "147": "US17", + "148": "US17", + "149": "US17", + "150": "US20", + "151": "US20", + "152": "US20", + "153": "US20", + "154": "US20", + "155": "US20", + "156": "US20", + "157": "US20", + "158": "US20", + "159": "US20", + "160": "US20", + "161": "US20", + "162": "US20", + "163": "US20", + "164": "US20", + "165": "US20", + "166": "US20", + "167": "US20", + "168": "US20", + "169": "US20", + "170": "US20", + "171": "US20", + "172": "US20", + "173": "US20", + "174": "US20", + "175": "US20", + "176": "US20", + "177": "US20", + "178": "US20", + "179": "US20", + "180": "US20", + "181": "US20", + "182": "US20", + "183": "US20", + "184": "US20", + "185": "US20", + "186": "US20", + "187": "US20", + "188": "US20", + "189": "US20", + "190": "US20", + "191": "US20", + "192": "US20", + "193": "US20", + "194": "US20", + "195": "US20", + "196": "US20", + "197": "US22", + "198": "US22", + "199": "US22", + "200": "US24", + "201": "US25", + "202": "US24", + "203": "US24", + "204": "US24", + "205": "US24", + "206": "US23", + "207": "US23", + "208": "US23", + "209": "US23", + "210": "US23", + "211": "US23", + "212": "US23", + "213": "US23", + "214": "US23", + "215": "US23", + "216": "US23", + "217": "US23", + "218": "US23", + "219": "US23", + "220": "US25", + "221": "US25", + "222": "US25", + "223": "US25", + "224": "US25", + "225": "US25", + "226": "US25", + "227": "US25", + "228": "US25", + "229": "US25", + "230": "US25", + "231": "US25", + "232": "US25", + "233": "US25", + "234": "US25", + "235": "US25", + "236": "US25", + "237": "US25", + "238": "US25", + "239": "US25", + "240": "US25", + "241": "US25", + "242": "US25", + "243": "US25", + "244": "US25", + "245": "US25", + "246": "US25", + "247": "US27", + "248": "US27", + "249": "US27", + "250": "US27", + "251": "US27", + "252": "US27", + "253": "US27", + "254": "US27", + "255": "US27", + "256": "US27", + "257": "US27", + "258": "US27", + "259": "US27", + "260": "US27", + "261": "US27", + "262": "US27", + "263": "US27", + "264": "US27", + "265": "US27", + "266": "US27", + "267": "US27", + "268": "US27", + "270": "US40", + "271": "US40", + "272": "US40", + "273": "US40", + "274": "US40", + "275": "US40", + "276": "US40", + "277": "US40", + "278": "US40", + "279": "US40", + "280": "US40", + "281": "US40", + "282": "US40", + "283": "US40", + "284": "US40", + "285": "US40", + "286": "US40", + "287": "US40", + "288": "US40", + "289": "US40", + "290": "US44", + "291": "US44", + "292": "US44", + "293": "US44", + "294": "US44", + "295": "US44", + "296": "US44", + "297": "US44", + "298": "US44", + "299": "US44", + "300": "US45", + "301": "US45", + "302": "US45", + "303": "US45", + "304": "US45", + "305": "US45", + "306": "US45", + "307": "US45", + "308": "US45", + "309": "US45", + "310": "US45", + "311": "US45", + "312": "US45", + "313": "US45", + "314": "US45", + "315": "US45", + "316": "US45", + "317": "US45", + "318": "US45", + "319": "US45", + "320": "US49", + "321": "ZIP", + "322": "US49", + "323": "US49", + "324": "US49", + "325": "US49", + "326": "US49", + "327": "ZIP", + "328": "US4964400", + "329": "US4964400", + "330": "US4965500", + "331": "US4964400", + "332": "US4964400", + "333": "US4964400", + "334": "US4964400", + "335": "US4964400", + "336": "US4964400", + "337": "US4964400", + "338": "US4964400", + "339": "US4964400", + "341": "US4964400", + "342": "US4964400", + "344": "ZIP", + "346": "US4964400", + "347": "US4964400", + "349": "US4964400", + "350": "US47", + "351": "US47", + "352": "US47", + "354": "US47", + "355": "US47", + "356": "US47", + "357": "US47", + "358": "US47", + "359": "US47", + "360": "US47", + "361": "US47", + "362": "US47", + "363": "US47", + "364": "US47", + "365": "US47", + "366": "US47", + "367": "US47", + "368": "US47", + "369": "US47", + "370": "US42", + "371": "US42", + "372": "US42", + "373": "US42", + "374": "US42", + "375": "US42", + "376": "US42", + "377": "US42", + "378": "US42", + "379": "US42", + "380": "US42", + "381": "US42", + "382": "US42", + "383": "US42", + "384": "US42", + "385": "US42", + "386": "US48", + "387": "US48", + "388": "US48", + "389": "US48", + "390": "US48", + "391": "US48", + "392": "US48", + "393": "US48", + "394": "US48", + "395": "US48", + "396": "US48", + "397": "US48", + "398": "US45", + "399": "US45", + "400": "US28", + "401": "US28", + "402": "US28", + "403": "US28", + "404": "US28", + "405": "US28", + "406": "US28", + "407": "US28", + "408": "US28", + "409": "US28", + "410": "US28", + "411": "US28", + "412": "US28", + "413": "US28", + "414": "US28", + "415": "US28", + "416": "US28", + "417": "US28", + "418": "US28", + "420": "US28", + "421": "US28", + "422": "US28", + "423": "US28", + "424": "US28", + "425": "US28", + "426": "US28", + "427": "US28", + "430": "US34", + "431": "US34", + "432": "US34", + "433": "US34", + "434": "US34", + "435": "US34", + "436": "US34", + "437": "US34", + "438": "US34", + "439": "US34", + "440": "US34", + "441": "US34", + "442": "US34", + "443": "US34", + "444": "US34", + "445": "US34", + "446": "US34", + "447": "US34", + "448": "US34", + "449": "US34", + "450": "US34", + "451": "US34", + "452": "US34", + "453": "US34", + "454": "US34", + "455": "US34", + "456": "US34", + "457": "US34", + "458": "US34", + "459": "US34", + "460": "US36", + "461": "US36", + "462": "US36", + "463": "US36", + "464": "US36", + "465": "US36", + "466": "US36", + "467": "US36", + "468": "US36", + "469": "US36", + "470": "US36", + "471": "US36", + "472": "US36", + "473": "US36", + "474": "US36", + "475": "US36", + "476": "US36", + "477": "US36", + "478": "US36", + "479": "US36", + "480": "US30", + "481": "US30", + "482": "US30", + "483": "US30", + "484": "US30", + "485": "US30", + "486": "US30", + "487": "US30", + "488": "US30", + "489": "US30", + "490": "US30", + "491": "US30", + "492": "US30", + "493": "US30", + "494": "US30", + "495": "US30", + "496": "US30", + "497": "US30", + "498": "US30", + "499": "US30", + "500": "US53", + "501": "US53", + "502": "US53", + "503": "US53", + "504": "US53", + "505": "US53", + "506": "US53", + "507": "US53", + "508": "US53", + "509": "US53", + "510": "US53", + "511": "US53", + "512": "US53", + "513": "US53", + "514": "US53", + "515": "US53", + "516": "US53", + "520": "US53", + "521": "US53", + "522": "US53", + "523": "US53", + "524": "US53", + "525": "US53", + "526": "US53", + "527": "US53", + "528": "US53", + "530": "US32", + "531": "US32", + "532": "US32", + "533": "US32", + "534": "US32", + "535": "US32", + "536": "US32", + "537": "US32", + "538": "US32", + "539": "US32", + "540": "US32", + "541": "US32", + "542": "US32", + "543": "US32", + "544": "US32", + "545": "US32", + "546": "US32", + "547": "US32", + "548": "US32", + "549": "US32", + "550": "US50", + "551": "US50", + "553": "US50", + "554": "US50", + "555": "US50", + "556": "US50", + "557": "US50", + "558": "US50", + "559": "US50", + "560": "US50", + "561": "US50", + "562": "US50", + "563": "US50", + "564": "US50", + "565": "US50", + "566": "US50", + "567": "US50", + "570": "US52", + "571": "US52", + "572": "US52", + "573": "US52", + "574": "US52", + "575": "US52", + "576": "US52", + "577": "US52", + "580": "US51", + "581": "US51", + "582": "US51", + "583": "US51", + "584": "US51", + "585": "US51", + "586": "US51", + "587": "US51", + "588": "US51", + "590": "US70", + "591": "US70", + "592": "US70", + "593": "US70", + "594": "US70", + "595": "US70", + "596": "US70", + "597": "US70", + "598": "US70", + "599": "US70", + "600": "US38", + "601": "US38", + "602": "US38", + "603": "US38", + "604": "US38", + "605": "US38", + "606": "US38", + "607": "US38", + "608": "US38", + "609": "US38", + "610": "US38", + "611": "US38", + "612": "US38", + "613": "US38", + "614": "US38", + "615": "US38", + "616": "US38", + "617": "US38", + "618": "US38", + "619": "US38", + "620": "US38", + "622": "US38", + "623": "US38", + "624": "US38", + "625": "US38", + "626": "US38", + "627": "US38", + "628": "US38", + "629": "US38", + "630": "US56", + "631": "US56", + "633": "US56", + "634": "US56", + "635": "US56", + "636": "US56", + "637": "US56", + "638": "US56", + "639": "US56", + "640": "US56", + "641": "US56", + "644": "US56", + "645": "US56", + "646": "US56", + "647": "US56", + "648": "US56", + "649": "US56", + "650": "US56", + "651": "US56", + "652": "US56", + "653": "US56", + "654": "US56", + "655": "US56", + "656": "US56", + "657": "US56", + "658": "US56", + "660": "US58", + "661": "US58", + "662": "US58", + "664": "US58", + "665": "US58", + "666": "US58", + "667": "US58", + "668": "US58", + "669": "US58", + "670": "US58", + "671": "US58", + "672": "US58", + "673": "US58", + "674": "US58", + "675": "US58", + "676": "US58", + "677": "US58", + "678": "US58", + "679": "US58", + "680": "US55", + "681": "US55", + "683": "US55", + "684": "US55", + "685": "US55", + "686": "US55", + "687": "US55", + "688": "US55", + "689": "US55", + "690": "US55", + "691": "US55", + "692": "US55", + "693": "US55", + "700": "US64", + "701": "US64", + "703": "US64", + "704": "US64", + "705": "US64", + "706": "US64", + "707": "US64", + "708": "US64", + "710": "US64", + "711": "US64", + "712": "US64", + "713": "US64", + "714": "US64", + "716": "US60", + "717": "US60", + "718": "US60", + "719": "US60", + "720": "US60", + "721": "US60", + "722": "US60", + "723": "US60", + "724": "US60", + "725": "US60", + "726": "US60", + "727": "US60", + "728": "US60", + "729": "US60", + "730": "US62", + "731": "US62", + "733": "US68", + "734": "US62", + "735": "US62", + "736": "US62", + "737": "US62", + "738": "US62", + "739": "US62", + "740": "US62", + "741": "US62", + "743": "US62", + "744": "US62", + "745": "US62", + "746": "US62", + "747": "US62", + "748": "US62", + "749": "US62", + "750": "US66", + "751": "US66", + "752": "US66", + "753": "US66", + "754": "US66", + "755": "US66", + "756": "US66", + "757": "ZIP", + "758": "ZIP", + "759": "ZIP", + "760": "US66", + "761": "US66", + "762": "US66", + "763": "US66", + "764": "US66", + "765": "ZIP", + "766": "ZIP", + "767": "US66", + "768": "ZIP", + "769": "ZIP", + "770": "US68", + "771": "US68", + "772": "US68", + "773": "US68", + "774": "US68", + "775": "US68", + "776": "US68", + "777": "US68", + "778": "US68", + "779": "US68", + "780": "US68", + "781": "US68", + "782": "US68", + "783": "US68", + "784": "US68", + "785": "US68", + "786": "ZIP", + "787": "US68", + "788": "ZIP", + "789": "US68", + "790": "US66", + "791": "US66", + "792": "US66", + "793": "US66", + "794": "US66", + "795": "US66", + "796": "US66", + "797": "US66", + "798": "US66", + "799": "US66", + "800": "US74", + "801": "US74", + "802": "US74", + "803": "US74", + "804": "US74", + "805": "US74", + "806": "US74", + "807": "US74", + "808": "US74", + "809": "US74", + "810": "US74", + "811": "US74", + "812": "US74", + "813": "US74", + "814": "US74", + "815": "US74", + "816": "US74", + "820": "US72", + "821": "US72", + "822": "US72", + "823": "US72", + "824": "US72", + "825": "US72", + "826": "US72", + "827": "US72", + "828": "US72", + "829": "US72", + "830": "US72", + "831": "US72", + "832": "US83", + "833": "US83", + "834": "US83", + "835": "US83", + "836": "US83", + "837": "US83", + "838": "US83", + "840": "US76", + "841": "US76", + "842": "US76", + "843": "US76", + "844": "US76", + "845": "US76", + "846": "US76", + "847": "US76", + "850": "US79", + "851": "US79", + "852": "US79", + "853": "US79", + "855": "US79", + "856": "US79", + "857": "US79", + "859": "US79", + "860": "US79", + "863": "US79", + "864": "US79", + "865": "US79", + "870": "US77", + "871": "US77", + "872": "US77", + "873": "US77", + "874": "US77", + "875": "US77", + "877": "US77", + "878": "US77", + "879": "US77", + "880": "US77", + "881": "US77", + "882": "US77", + "883": "US77", + "884": "US77", + "885": "US66", + "889": "US86", + "890": "US86", + "891": "US86", + "893": "US86", + "894": "US86", + "895": "US86", + "896": "US86", + "897": "US86", + "898": "US86", + "900": "US88", + "901": "US88", + "902": "US88", + "903": "US88", + "904": "US88", + "905": "US88", + "906": "US88", + "907": "US88", + "908": "US88", + "909": "US88", + "910": "US88", + "911": "US88", + "912": "US88", + "913": "US88", + "914": "US88", + "915": "US88", + "916": "US88", + "917": "US88", + "918": "US88", + "919": "US88", + "920": "US88", + "921": "US88", + "922": "US88", + "923": "ZIP", + "924": "US88", + "925": "US88", + "926": "US88", + "927": "US88", + "928": "US88", + "930": "US88", + "931": "US88", + "932": "ZIP", + "933": "US88", + "934": "US88", + "935": "ZIP", + "936": "US87", + "937": "US87", + "938": "US87", + "939": "US87", + "940": "US87", + "941": "US87", + "942": "US87", + "943": "US87", + "944": "US87", + "945": "US87", + "946": "US87", + "947": "US87", + "948": "US87", + "949": "US87", + "950": "US87", + "951": "US87", + "952": "US87", + "953": "US87", + "954": "US87", + "955": "US87", + "956": "US87", + "957": "US87", + "958": "US87", + "959": "US87", + "960": "US87", + "961": "US87", + "970": "US85", + "971": "US85", + "972": "US85", + "973": "US85", + "974": "US85", + "975": "US85", + "976": "US85", + "977": "US85", + "978": "US85", + "979": "US85", + "980": "US84", + "981": "US84", + "982": "US84", + "983": "US84", + "984": "US84", + "985": "US84", + "986": "US84", + "988": "US84", + "989": "US84", + "990": "US84", + "991": "US84", + "992": "US84", + "993": "US84", + "994": "US84", +} diff --git a/pkg/services/ghcimport/zip5_to_rate_area_mappings.go b/pkg/services/ghcimport/zip5_to_rate_area_mappings.go new file mode 100644 index 00000000000..ec2da0d2244 --- /dev/null +++ b/pkg/services/ghcimport/zip5_to_rate_area_mappings.go @@ -0,0 +1,927 @@ +package ghcimport + +var zip5ToRateAreaMappings = map[string]string{ + // Zip5 Rate Area + "32102": "US4964400", + "32105": "US4964400", + "32110": "US49", + "32111": "US49", + "32112": "US49", + "32113": "US49", + "32114": "US4964400", + "32115": "US4964400", + "32116": "US4964400", + "32117": "US4964400", + "32118": "US4964400", + "32119": "US4964400", + "32120": "US4964400", + "32121": "US4964400", + "32122": "US4964400", + "32123": "US4964400", + "32124": "US4964400", + "32125": "US4964400", + "32126": "US4964400", + "32127": "US4964400", + "32128": "US4964400", + "32129": "US4964400", + "32130": "US4964400", + "32131": "US49", + "32132": "US4964400", + "32133": "US49", + "32134": "US49", + "32135": "US49", + "32136": "US49", + "32137": "US49", + "32138": "US49", + "32139": "US49", + "32140": "US49", + "32141": "US4964400", + "32142": "US49", + "32143": "US49", + "32145": "US49", + "32147": "US49", + "32148": "US49", + "32149": "US49", + "32157": "US49", + "32158": "US4964400", + "32159": "US4964400", + "32160": "US49", + "32162": "US4964400", + "32163": "US4964400", + "32164": "US49", + "32168": "US4964400", + "32169": "US4964400", + "32170": "US4964400", + "32173": "US4964400", + "32174": "US4964400", + "32175": "US4964400", + "32176": "US4964400", + "32177": "US49", + "32178": "US49", + "32179": "US49", + "32180": "US4964400", + "32181": "US49", + "32182": "US49", + "32183": "US49", + "32185": "US49", + "32187": "US49", + "32189": "US49", + "32190": "US4964400", + "32192": "US49", + "32193": "US49", + "32195": "US49", + "32198": "US4964400", + "32701": "US49", + "32702": "US4964400", + "32703": "US49", + "32704": "US49", + "32706": "US4964400", + "32707": "US49", + "32708": "US49", + "32709": "US49", + "32710": "US49", + "32712": "US49", + "32713": "US4964400", + "32714": "US49", + "32715": "US49", + "32716": "US49", + "32718": "US49", + "32719": "US49", + "32720": "US4964400", + "32721": "US4964400", + "32722": "US4964400", + "32723": "US4964400", + "32724": "US4964400", + "32725": "US4964400", + "32726": "US4964400", + "32727": "US4964400", + "32728": "US4964400", + "32730": "US49", + "32732": "US49", + "32733": "US49", + "32735": "US4964400", + "32736": "US4964400", + "32738": "US4964400", + "32739": "US4964400", + "32744": "US4964400", + "32745": "US49", + "32746": "US49", + "32747": "US49", + "32750": "US49", + "32751": "US49", + "32752": "US49", + "32753": "US4964400", + "32754": "US4964400", + "32756": "US4964400", + "32757": "US4964400", + "32759": "US4964400", + "32762": "US49", + "32763": "US4964400", + "32764": "US4964400", + "32765": "US49", + "32766": "US49", + "32767": "US4964400", + "32768": "US49", + "32771": "US49", + "32772": "US49", + "32773": "US49", + "32774": "US4964400", + "32776": "US4964400", + "32777": "US49", + "32778": "US4964400", + "32779": "US49", + "32784": "US4964400", + "32789": "US49", + "32790": "US49", + "32791": "US49", + "32792": "US49", + "32793": "US49", + "32794": "US49", + "32795": "US49", + "32798": "US49", + "32799": "US49", + "33101": "US4964400", + "33102": "US4964400", + "33106": "US4964400", + "33109": "US4964400", + "33111": "US4964400", + "33112": "US4964400", + "33114": "US4964400", + "33116": "US4964400", + "33119": "US4964400", + "33122": "US4964400", + "33124": "US4964400", + "33125": "US4964400", + "33126": "US4964400", + "33127": "US4964400", + "33128": "US4964400", + "33129": "US4964400", + "33130": "US4964400", + "33131": "US4964400", + "33132": "US4964400", + "33133": "US4964400", + "33134": "US4964400", + "33135": "US4964400", + "33136": "US4964400", + "33137": "US4964400", + "33138": "US4964400", + "33139": "US4964400", + "33140": "US4964400", + "33141": "US4964400", + "33142": "US4964400", + "33143": "US4964400", + "33144": "US4964400", + "33145": "US4964400", + "33146": "US4964400", + "33147": "US4964400", + "33149": "US4964400", + "33150": "US4964400", + "33151": "US4964400", + "33152": "US4964400", + "33153": "US4964400", + "33154": "US4964400", + "33155": "US4964400", + "33156": "US4964400", + "33157": "US4964400", + "33158": "US4964400", + "33160": "US4964400", + "33161": "US4964400", + "33162": "US4964400", + "33163": "US4964400", + "33164": "US4964400", + "33165": "US4964400", + "33166": "US4964400", + "33167": "US4964400", + "33168": "US4964400", + "33169": "US4964400", + "33170": "US4964400", + "33172": "US4964400", + "33173": "US4964400", + "33174": "US4964400", + "33175": "US4964400", + "33176": "US4964400", + "33177": "US4964400", + "33178": "US4964400", + "33179": "US4964400", + "33180": "US4964400", + "33181": "US4964400", + "33182": "US4964400", + "33183": "US4964400", + "33184": "US4964400", + "33185": "US4964400", + "33186": "US4964400", + "33187": "US4964400", + "33188": "US4964400", + "33189": "US4964400", + "33190": "US4964400", + "33191": "US4964400", + "33192": "US4964400", + "33193": "US4964400", + "33194": "US4964400", + "33195": "US4964400", + "33196": "US4964400", + "33197": "US4964400", + "33198": "US4964400", + "33199": "US4964400", + "33206": "US4964400", + "33222": "US4964400", + "33231": "US4964400", + "33233": "US4964400", + "33234": "US4964400", + "33238": "US4964400", + "33239": "US4964400", + "33242": "US4964400", + "33243": "US4964400", + "33245": "US4964400", + "33247": "US4964400", + "33255": "US4964400", + "33256": "US4964400", + "33257": "US4964400", + "33261": "US4964400", + "33265": "US4964400", + "33266": "US4964400", + "33269": "US4964400", + "33280": "US4964400", + "33283": "US4964400", + "33296": "US4964400", + "33299": "US4964400", + "34420": "US49", + "34421": "US49", + "34423": "US4964400", + "34428": "US4964400", + "34429": "US4964400", + "34430": "US49", + "34431": "US49", + "34432": "US49", + "34433": "US4964400", + "34434": "US4964400", + "34436": "US4964400", + "34442": "US4964400", + "34445": "US4964400", + "34446": "US4964400", + "34447": "US4964400", + "34448": "US4964400", + "34449": "US49", + "34450": "US4964400", + "34451": "US4964400", + "34452": "US4964400", + "34453": "US4964400", + "34460": "US4964400", + "34461": "US4964400", + "34464": "US4964400", + "34465": "US4964400", + "34470": "US49", + "34471": "US49", + "34472": "US49", + "34473": "US49", + "34474": "US49", + "34475": "US49", + "34476": "US49", + "34477": "US49", + "34478": "US49", + "34479": "US49", + "34480": "US49", + "34481": "US49", + "34482": "US49", + "34483": "US49", + "34484": "US4964400", + "34487": "US4964400", + "34488": "US49", + "34489": "US49", + "34491": "US49", + "34492": "US49", + "34498": "US49", + "75701": "US66", + "75702": "US66", + "75703": "US66", + "75704": "US66", + "75705": "US66", + "75706": "US66", + "75707": "US66", + "75708": "US66", + "75709": "US66", + "75710": "US66", + "75711": "US66", + "75712": "US66", + "75713": "US66", + "75750": "US66", + "75751": "US66", + "75752": "US66", + "75754": "US66", + "75755": "US66", + "75756": "US66", + "75757": "US66", + "75758": "US66", + "75759": "US66", + "75760": "US68", + "75762": "US66", + "75763": "US66", + "75764": "US66", + "75765": "US66", + "75766": "US66", + "75770": "US66", + "75771": "US66", + "75772": "US66", + "75773": "US66", + "75778": "US66", + "75779": "US66", + "75780": "US66", + "75782": "US66", + "75783": "US66", + "75784": "US66", + "75785": "US66", + "75788": "US68", + "75789": "US66", + "75790": "US66", + "75791": "US66", + "75792": "US66", + "75797": "US66", + "75798": "US66", + "75799": "US66", + "75801": "US66", + "75802": "US66", + "75803": "US66", + "75831": "US68", + "75832": "US66", + "75833": "US68", + "75834": "US68", + "75835": "US68", + "75838": "US66", + "75839": "US66", + "75840": "US66", + "75844": "US68", + "75845": "US68", + "75846": "US68", + "75847": "US68", + "75848": "US66", + "75849": "US68", + "75850": "US68", + "75851": "US68", + "75852": "US68", + "75853": "US66", + "75855": "US68", + "75856": "US68", + "75858": "US68", + "75859": "US66", + "75860": "US66", + "75861": "US66", + "75862": "US68", + "75865": "US68", + "75880": "US66", + "75882": "US66", + "75884": "US66", + "75886": "US66", + "75901": "US68", + "75902": "US68", + "75903": "US68", + "75904": "US68", + "75915": "US68", + "75925": "US66", + "75926": "US68", + "75928": "US68", + "75929": "US68", + "75930": "US68", + "75931": "US68", + "75932": "US68", + "75933": "US68", + "75934": "US68", + "75935": "US68", + "75936": "US68", + "75937": "US68", + "75938": "US68", + "75939": "US68", + "75941": "US68", + "75942": "US68", + "75943": "US68", + "75944": "US68", + "75946": "US68", + "75948": "US68", + "75949": "US68", + "75951": "US68", + "75954": "US68", + "75956": "US68", + "75958": "US68", + "75959": "US68", + "75960": "US68", + "75961": "US68", + "75962": "US68", + "75963": "US68", + "75964": "US68", + "75965": "US68", + "75966": "US68", + "75968": "US68", + "75969": "US68", + "75972": "US68", + "75973": "US68", + "75974": "US68", + "75975": "US68", + "75976": "US66", + "75977": "US68", + "75978": "US68", + "75979": "US68", + "75980": "US68", + "75990": "US68", + "76501": "US66", + "76502": "US66", + "76503": "US66", + "76504": "US66", + "76505": "US66", + "76508": "US66", + "76511": "US66", + "76513": "US66", + "76518": "US68", + "76519": "US68", + "76520": "US68", + "76522": "US66", + "76523": "US68", + "76524": "US66", + "76525": "US66", + "76526": "US66", + "76527": "US68", + "76528": "US66", + "76530": "US68", + "76531": "US66", + "76533": "US66", + "76534": "US66", + "76537": "US68", + "76538": "US66", + "76539": "US66", + "76540": "US66", + "76541": "US66", + "76542": "US66", + "76543": "US66", + "76544": "US66", + "76547": "US66", + "76548": "US66", + "76549": "US66", + "76550": "US66", + "76554": "US66", + "76556": "US68", + "76557": "US66", + "76558": "US66", + "76559": "US66", + "76561": "US66", + "76564": "US66", + "76565": "US66", + "76566": "US66", + "76567": "US68", + "76569": "US66", + "76570": "US66", + "76571": "US66", + "76573": "US68", + "76574": "US68", + "76577": "US68", + "76578": "US68", + "76579": "US66", + "76596": "US66", + "76597": "US66", + "76598": "US66", + "76599": "US66", + "76621": "US66", + "76622": "US66", + "76623": "US66", + "76624": "US66", + "76626": "US66", + "76627": "US66", + "76628": "US66", + "76629": "US68", + "76630": "US66", + "76631": "US66", + "76632": "US66", + "76633": "US66", + "76634": "US66", + "76635": "US66", + "76636": "US66", + "76637": "US66", + "76638": "US66", + "76639": "US66", + "76640": "US66", + "76641": "US66", + "76642": "US66", + "76643": "US66", + "76644": "US66", + "76645": "US66", + "76648": "US66", + "76649": "US66", + "76650": "US66", + "76651": "US66", + "76652": "US66", + "76653": "US66", + "76654": "US66", + "76655": "US66", + "76656": "US66", + "76657": "US66", + "76660": "US66", + "76661": "US66", + "76664": "US66", + "76665": "US66", + "76666": "US66", + "76667": "US66", + "76670": "US66", + "76671": "US66", + "76673": "US66", + "76676": "US66", + "76678": "US66", + "76679": "US66", + "76680": "US66", + "76681": "US66", + "76682": "US66", + "76684": "US66", + "76685": "US66", + "76686": "US66", + "76687": "US66", + "76689": "US66", + "76690": "US66", + "76691": "US66", + "76692": "US66", + "76693": "US66", + "76801": "US66", + "76802": "US66", + "76803": "US66", + "76804": "US66", + "76820": "US66", + "76821": "US66", + "76823": "US66", + "76824": "US66", + "76825": "US66", + "76827": "US66", + "76828": "US66", + "76831": "US66", + "76832": "US66", + "76834": "US66", + "76836": "US66", + "76837": "US66", + "76841": "US66", + "76842": "US66", + "76844": "US66", + "76845": "US66", + "76848": "US66", + "76849": "US66", + "76852": "US66", + "76853": "US66", + "76854": "US66", + "76855": "US66", + "76856": "US66", + "76857": "US66", + "76858": "US66", + "76859": "US66", + "76861": "US66", + "76862": "US66", + "76864": "US66", + "76865": "US66", + "76866": "US66", + "76869": "US66", + "76870": "US66", + "76871": "US66", + "76872": "US66", + "76873": "US66", + "76874": "US66", + "76875": "US66", + "76877": "US66", + "76878": "US66", + "76880": "US66", + "76882": "US66", + "76883": "US68", + "76884": "US66", + "76885": "US66", + "76886": "US66", + "76887": "US66", + "76888": "US66", + "76890": "US66", + "76901": "US66", + "76902": "US66", + "76903": "US66", + "76904": "US66", + "76905": "US66", + "76906": "US66", + "76908": "US66", + "76909": "US66", + "76930": "US66", + "76932": "US66", + "76933": "US66", + "76934": "US66", + "76935": "US66", + "76936": "US66", + "76937": "US66", + "76939": "US66", + "76940": "US66", + "76941": "US66", + "76943": "US66", + "76945": "US66", + "76949": "US66", + "76950": "US66", + "76951": "US66", + "76953": "US66", + "76955": "US66", + "76957": "US66", + "76958": "US66", + "78602": "US68", + "78604": "US68", + "78605": "US66", + "78606": "US68", + "78607": "US66", + "78608": "US66", + "78609": "US66", + "78610": "US68", + "78611": "US66", + "78612": "US68", + "78613": "US68", + "78614": "US68", + "78615": "US68", + "78616": "US68", + "78617": "US68", + "78618": "US68", + "78619": "US68", + "78620": "US68", + "78621": "US68", + "78622": "US68", + "78623": "US68", + "78624": "US68", + "78626": "US68", + "78627": "US68", + "78628": "US68", + "78629": "US68", + "78630": "US68", + "78631": "US68", + "78632": "US68", + "78633": "US68", + "78634": "US68", + "78635": "US68", + "78636": "US68", + "78638": "US68", + "78639": "US66", + "78640": "US68", + "78641": "US68", + "78642": "US68", + "78643": "US66", + "78644": "US68", + "78645": "US68", + "78646": "US68", + "78648": "US68", + "78650": "US68", + "78651": "US68", + "78652": "US68", + "78653": "US68", + "78654": "US66", + "78655": "US68", + "78656": "US68", + "78657": "US66", + "78658": "US68", + "78659": "US68", + "78660": "US68", + "78661": "US68", + "78662": "US68", + "78663": "US68", + "78664": "US68", + "78665": "US68", + "78666": "US68", + "78667": "US68", + "78669": "US68", + "78670": "US68", + "78671": "US68", + "78672": "US66", + "78673": "US68", + "78674": "US68", + "78675": "US68", + "78676": "US68", + "78677": "US68", + "78680": "US68", + "78681": "US68", + "78682": "US68", + "78683": "US68", + "78691": "US68", + "78801": "US68", + "78802": "US68", + "78827": "US68", + "78828": "US68", + "78829": "US68", + "78830": "US68", + "78832": "US68", + "78833": "US68", + "78834": "US68", + "78836": "US68", + "78837": "US68", + "78838": "US68", + "78839": "US68", + "78840": "US68", + "78841": "US68", + "78842": "US68", + "78843": "US68", + "78847": "US68", + "78850": "US68", + "78851": "US66", + "78852": "US68", + "78853": "US68", + "78860": "US68", + "78861": "US68", + "78870": "US68", + "78871": "US68", + "78872": "US68", + "78873": "US68", + "78877": "US68", + "78879": "US68", + "78880": "US68", + "78881": "US68", + "78883": "US68", + "78884": "US68", + "78885": "US68", + "78886": "US68", + "92301": "US88", + "92304": "US88", + "92305": "US88", + "92307": "US88", + "92308": "US88", + "92309": "US88", + "92310": "US88", + "92311": "US88", + "92312": "US88", + "92313": "US88", + "92314": "US88", + "92315": "US88", + "92316": "US88", + "92317": "US88", + "92318": "US88", + "92321": "US88", + "92322": "US88", + "92323": "US88", + "92324": "US88", + "92325": "US88", + "92326": "US88", + "92327": "US88", + "92328": "US87", + "92329": "US88", + "92331": "US88", + "92332": "US88", + "92333": "US88", + "92334": "US88", + "92335": "US88", + "92336": "US88", + "92337": "US88", + "92338": "US88", + "92339": "US88", + "92340": "US88", + "92341": "US88", + "92342": "US88", + "92344": "US88", + "92345": "US88", + "92346": "US88", + "92347": "US88", + "92350": "US88", + "92352": "US88", + "92354": "US88", + "92356": "US88", + "92357": "US88", + "92358": "US88", + "92359": "US88", + "92363": "US88", + "92364": "US88", + "92365": "US88", + "92366": "US88", + "92368": "US88", + "92369": "US88", + "92371": "US88", + "92372": "US88", + "92373": "US88", + "92374": "US88", + "92375": "US88", + "92376": "US88", + "92377": "US88", + "92378": "US88", + "92382": "US88", + "92384": "US87", + "92385": "US88", + "92386": "US88", + "92389": "US87", + "92391": "US88", + "92392": "US88", + "92393": "US88", + "92394": "US88", + "92395": "US88", + "92397": "US88", + "92398": "US88", + "92399": "US88", + "93201": "US87", + "93202": "US87", + "93203": "US88", + "93204": "US87", + "93205": "US88", + "93206": "US88", + "93207": "US87", + "93208": "US87", + "93210": "US87", + "93212": "US87", + "93215": "US88", + "93216": "US88", + "93218": "US87", + "93219": "US87", + "93220": "US88", + "93221": "US87", + "93222": "US88", + "93223": "US87", + "93224": "US88", + "93225": "US88", + "93226": "US88", + "93227": "US87", + "93230": "US87", + "93232": "US87", + "93234": "US87", + "93235": "US87", + "93237": "US87", + "93238": "US88", + "93239": "US87", + "93240": "US88", + "93241": "US88", + "93242": "US87", + "93243": "US88", + "93244": "US87", + "93245": "US87", + "93246": "US87", + "93247": "US87", + "93249": "US88", + "93250": "US88", + "93251": "US88", + "93252": "US88", + "93255": "US88", + "93256": "US87", + "93257": "US87", + "93258": "US87", + "93260": "US87", + "93261": "US87", + "93262": "US87", + "93263": "US88", + "93265": "US87", + "93267": "US87", + "93268": "US88", + "93270": "US87", + "93271": "US87", + "93272": "US87", + "93274": "US87", + "93275": "US87", + "93276": "US88", + "93277": "US87", + "93278": "US87", + "93279": "US87", + "93280": "US88", + "93282": "US87", + "93283": "US88", + "93285": "US88", + "93286": "US87", + "93287": "US88", + "93290": "US87", + "93291": "US87", + "93292": "US87", + "93501": "US88", + "93502": "US88", + "93504": "US88", + "93505": "US88", + "93510": "US88", + "93512": "US87", + "93513": "US87", + "93514": "US87", + "93515": "US87", + "93516": "US88", + "93517": "US87", + "93518": "US88", + "93519": "US88", + "93522": "US87", + "93523": "US88", + "93524": "US88", + "93526": "US87", + "93527": "US88", + "93528": "US88", + "93529": "US87", + "93530": "US87", + "93531": "US88", + "93532": "US88", + "93534": "US88", + "93535": "US88", + "93536": "US88", + "93539": "US88", + "93541": "US87", + "93542": "US87", + "93543": "US88", + "93544": "US88", + "93545": "US87", + "93546": "US87", + "93549": "US87", + "93550": "US88", + "93551": "US88", + "93552": "US88", + "93553": "US88", + "93554": "US88", + "93555": "US88", + "93556": "US88", + "93558": "US88", + "93560": "US88", + "93561": "US88", + "93562": "US88", + "93563": "US88", + "93581": "US88", + "93584": "US88", + "93586": "US88", + "93590": "US88", + "93591": "US88", + "93592": "US88", + "93596": "US88", + "93599": "US88", +} From 4e08a30b6245e40a610800d6cdfa67c6a747cc4f Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 25 Feb 2025 17:28:10 +0000 Subject: [PATCH 03/13] alright fine just the tests then --- .../ghcimport/ghc_rateengine_importer_test.go | 82 ------- .../ghcimport/import_re_contract_test.go | 63 ----- .../import_re_contract_years_test.go | 78 ------ ...ort_re_domestic_accessorial_prices_test.go | 91 ------- ...import_re_domestic_linehaul_prices_test.go | 79 ------- .../import_re_domestic_other_prices_test.go | 120 ---------- ...rt_re_domestic_service_area_prices_test.go | 125 ---------- .../import_re_domestic_service_area_test.go | 165 ------------- .../import_re_intl_accessorial_prices_test.go | 90 ------- .../import_re_intl_other_prices_test.go | 102 -------- .../ghcimport/import_re_intl_prices_test.go | 188 --------------- .../ghcimport/import_re_rate_area_test.go | 223 ------------------ .../import_re_shipment_type_prices_test.go | 66 ------ .../import_re_task_order_fees_test.go | 83 ------- .../ghcimport/load_service_map_test.go | 31 --- .../map_zip_codes_to_re_rate_areas_test.go | 140 ----------- pkg/services/ghcimport/shared_test.go | 219 ----------------- 17 files changed, 1945 deletions(-) delete mode 100644 pkg/services/ghcimport/ghc_rateengine_importer_test.go delete mode 100644 pkg/services/ghcimport/import_re_contract_test.go delete mode 100644 pkg/services/ghcimport/import_re_contract_years_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_other_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_domestic_service_area_test.go delete mode 100644 pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_intl_other_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_intl_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_rate_area_test.go delete mode 100644 pkg/services/ghcimport/import_re_shipment_type_prices_test.go delete mode 100644 pkg/services/ghcimport/import_re_task_order_fees_test.go delete mode 100644 pkg/services/ghcimport/load_service_map_test.go delete mode 100644 pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go delete mode 100644 pkg/services/ghcimport/shared_test.go diff --git a/pkg/services/ghcimport/ghc_rateengine_importer_test.go b/pkg/services/ghcimport/ghc_rateengine_importer_test.go deleted file mode 100644 index 74aa80f9b59..00000000000 --- a/pkg/services/ghcimport/ghc_rateengine_importer_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package ghcimport - -import ( - "os" - "path/filepath" - "testing" - "time" - - "github.com/stretchr/testify/suite" - - "github.com/transcom/mymove/pkg/testingsuite" -) - -const testContractCode = "TEST" -const testContractCode2 = "TEST2" -const testContractName = "Test Contract" - -var testContractStartDate = time.Date(2021, time.February, 01, 0, 0, 0, 0, time.UTC) - -type GHCRateEngineImportSuite struct { - *testingsuite.PopTestSuite -} - -func (suite *GHCRateEngineImportSuite) SetupSuite() { - suite.PreloadData(func() { - suite.helperSetupStagingTables() - }) -} - -func (suite *GHCRateEngineImportSuite) TearDownSuite() { - suite.PopTestSuite.TearDown() -} - -func (suite *GHCRateEngineImportSuite) helperLoadSQLFixture(fileName string) { - path := filepath.Join("fixtures", fileName) - _, err := os.Stat(path) - suite.NoError(err) - - c, ioErr := os.ReadFile(filepath.Clean(path)) - suite.NoError(ioErr) - - sql := string(c) - err = suite.DB().RawQuery(sql).Exec() - suite.NoError(err) -} - -func (suite *GHCRateEngineImportSuite) helperSetupStagingTables() { - suite.helperLoadSQLFixture("stage_ghc_pricing.sql") -} - -func TestGHCRateEngineImportSuite(t *testing.T) { - hs := &GHCRateEngineImportSuite{ - PopTestSuite: testingsuite.NewPopTestSuite(testingsuite.CurrentPackage(), testingsuite.WithPerTestTransaction()), - } - - suite.Run(t, hs) -} - -func (suite *GHCRateEngineImportSuite) TestGHCRateEngineImporter_Import() { - tests := []struct { - name string - gre *GHCRateEngineImporter - wantErr bool - }{ - { - name: "Run GHC Rate Engine Importer", - gre: &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractName: testContractName, - ContractStartDate: testContractStartDate, - }, - wantErr: false, - }, - } - for _, tt := range tests { - suite.Run(tt.name, func() { - if err := tt.gre.Import(suite.AppContextForTest()); (err != nil) != tt.wantErr { - suite.T().Errorf("GHCRateEngineImporter.Import() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/pkg/services/ghcimport/import_re_contract_test.go b/pkg/services/ghcimport/import_re_contract_test.go deleted file mode 100644 index 7107e7ebbf2..00000000000 --- a/pkg/services/ghcimport/import_re_contract_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREContract() { - suite.Run("import success", func() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractName: testContractName, - } - - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - suite.helperCheckContractName(testContractName) - suite.NotNil(gre.ContractID) - }) - - suite.Run("no contract code", func() { - gre := &GHCRateEngineImporter{} - - err := gre.importREContract(suite.AppContextForTest()) - if suite.Error(err) { - suite.Equal("no contract code provided", err.Error()) - } - }) -} - -func (suite *GHCRateEngineImportSuite) Test_importREContract_runTwice() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success, but no contract name", func() { - setupTestData() - suite.helperCheckContractName(testContractCode) - suite.NotNil(gre.ContractID) - }) - - suite.Run("run twice with same contract code - should fail the second time", func() { - setupTestData() - err := gre.importREContract(suite.AppContextForTest()) - if suite.Error(err) { - expected := fmt.Sprintf("the provided contract code [%s] already exists", testContractCode) - suite.Equal(expected, err.Error()) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperCheckContractName(expectedName string) { - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - suite.Equal(expectedName, contract.Name) -} diff --git a/pkg/services/ghcimport/import_re_contract_years_test.go b/pkg/services/ghcimport/import_re_contract_years_test.go deleted file mode 100644 index b33584d8656..00000000000 --- a/pkg/services/ghcimport/import_re_contract_years_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREContractYears() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractStartDate: testContractStartDate, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREContractYears(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyContractYears() - suite.helperCheckContractYearValue() - }) - - suite.Run("run a second time; should fail immediately due to date range constraint", func() { - setupTestData() - err := gre.importREContractYears(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.ExclusionViolation, "re_contract_years_daterange_excl")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyContractYears() { - count, err := suite.DB().Count(&models.ReContractYear{}) - suite.NoError(err) - suite.Equal(8, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckContractYearValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - var basePeriod1 models.ReContractYear - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("name = $2", "Base Period Year 1"). - First(&basePeriod1) - suite.NoError(err) - suite.Equal(1.0000, basePeriod1.Escalation) - suite.Equal(1.0000, basePeriod1.EscalationCompounded) - - var optionPeriod1 models.ReContractYear - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("name = $2", "Option Period 1"). - First(&optionPeriod1) - suite.NoError(err) - suite.Equal(1.02140, optionPeriod1.Escalation) - suite.Equal(1.06298, optionPeriod1.EscalationCompounded) - - var awardTerm2 models.ReContractYear - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("name = $2", "Award Term 2"). - First(&awardTerm2) - suite.NoError(err) - suite.Equal(1.01940, awardTerm2.Escalation) - suite.Equal(1.12848, awardTerm2.EscalationCompounded) -} diff --git a/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go b/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go deleted file mode 100644 index 5f75bbd55a4..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_accessorial_prices_test.go +++ /dev/null @@ -1,91 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticAccessorialPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticAccessorialPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticAccessorialPrices() - suite.helperCheckDomesticAccessorialPrices() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticAccessorialPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_accessorial_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticAccessorialPrices() { - count, err := suite.DB().Count(&models.ReDomesticAccessorialPrice{}) - suite.NoError(err) - suite.Equal(15, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticAccessorialPrices() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - testCases := []struct { - serviceCode models.ReServiceCode - schedule int - expectedPrice int - isError bool - }{ - {models.ReServiceCodeDCRT, 1, 2369, false}, - {models.ReServiceCodeDCRTSA, 1, 2369, false}, - {models.ReServiceCodeDUCRT, 1, 595, false}, - {models.ReServiceCodeDDSHUT, 1, 505, false}, - {models.ReServiceCodeDDSHUT, 3, 576, false}, - {models.ReServiceCodeDOSHUT, 1, 505, false}, - {models.ReServiceCodeMS, 3, 0, true}, - {models.ReServiceCodeDCRT, 5, 0, true}, - } - - for _, testCase := range testCases { - // Get service UUID. - var service models.ReService - err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) - suite.NoError(err) - - var domesticAccessorialPrice models.ReDomesticAccessorialPrice - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("service_id = $2", service.ID). - Where("services_schedule = $3", testCase.schedule). - First(&domesticAccessorialPrice) - - if testCase.isError { - suite.Error(err) - } else { - suite.NoError(err) - suite.Equal(unit.Cents(testCase.expectedPrice), domesticAccessorialPrice.PerUnitCents, "test case: %+v", testCase) - } - } -} diff --git a/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go b/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go deleted file mode 100644 index 32b16b4fced..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_linehaul_prices_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticLinehaulPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticLinehaulPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticLinehaulCount() - - // Spot check a linehaul price - suite.helperCheckDomesticLinehaulValue() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticLinehaulPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_linehaul_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticLinehaulCount() { - count, err := suite.DB().Count(&models.ReDomesticLinehaulPrice{}) - suite.NoError(err) - suite.Equal(13800, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticLinehaulValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Get domestic service area UUID. - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '452'"). - First(&serviceArea) - suite.NoError(err) - - // Get linehaul price. - var linehaul models.ReDomesticLinehaulPrice - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("weight_lower = 5000"). - Where("weight_upper = 9999"). - Where("miles_lower = 2501"). - Where("miles_upper = 3000"). - Where("is_peak_period = false"). - Where("domestic_service_area_id = ?", serviceArea.ID). - First(&linehaul) - suite.NoError(err) - - suite.Equal(unit.Millicents(745600), linehaul.PriceMillicents) -} diff --git a/pkg/services/ghcimport/import_re_domestic_other_prices_test.go b/pkg/services/ghcimport/import_re_domestic_other_prices_test.go deleted file mode 100644 index ca14e7f4ad9..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_other_prices_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package ghcimport - -import ( - "fmt" - - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticOtherPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticOtherPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticOtherPrices() - suite.helperCheckDomesticOtherPriceValue() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_other_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticOtherPricesFailures() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - setupTestData := func() { - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - suite.NotNil(gre.ContractID) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("stage_domestic_other_sit_prices table missing", func() { - setupTestData() - renameQuery := "ALTER TABLE stage_domestic_other_sit_prices RENAME TO missing_stage_domestic_other_sit_prices" - renameErr := suite.DB().RawQuery(renameQuery).Exec() - suite.NoError(renameErr) - - err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) - } - }) - - suite.Run("stage_domestic_other_pack_prices table missing", func() { - setupTestData() - // drop a staging table that we are depending on to do import - dropQuery := fmt.Sprintf("DROP TABLE IF EXISTS %s;", "stage_domestic_other_pack_prices") - dropErr := suite.DB().RawQuery(dropQuery).Exec() - suite.NoError(dropErr) - - err := gre.importREDomesticOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticOtherPrices() { - count, err := suite.DB().Count(&models.ReDomesticOtherPrice{}) - suite.NoError(err) - suite.Equal(48, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticOtherPriceValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - suite.verifyDomesticOtherPrice(unit.Cents(7395), contract.ID, false, models.ReServiceCodeDPK, 3) - suite.verifyDomesticOtherPrice(unit.Cents(8000), contract.ID, true, models.ReServiceCodeDPK, 3) - suite.verifyDomesticOtherPrice(unit.Cents(597), contract.ID, false, models.ReServiceCodeDUPK, 2) - suite.verifyDomesticOtherPrice(unit.Cents(650), contract.ID, true, models.ReServiceCodeDUPK, 2) - suite.verifyDomesticOtherPrice(unit.Cents(23440), contract.ID, false, models.ReServiceCodeDOPSIT, 2) - suite.verifyDomesticOtherPrice(unit.Cents(24122), contract.ID, true, models.ReServiceCodeDOPSIT, 2) - suite.verifyDomesticOtherPrice(unit.Cents(24625), contract.ID, false, models.ReServiceCodeDDDSIT, 3) - suite.verifyDomesticOtherPrice(unit.Cents(25030), contract.ID, true, models.ReServiceCodeDDDSIT, 3) -} - -func (suite *GHCRateEngineImportSuite) verifyDomesticOtherPrice(expected unit.Cents, contractID uuid.UUID, isPeakPeriod bool, serviceCode models.ReServiceCode, schedule int) { - var service models.ReService - err := suite.DB().Where("code = ?", serviceCode).First(&service) - suite.NoError(err) - - var domesticOtherPrice models.ReDomesticOtherPrice - err = suite.DB(). - Where("contract_id = ?", contractID). - Where("service_id = ?", service.ID). - Where("is_peak_period = ?", isPeakPeriod). - Where("schedule = ?", schedule).First(&domesticOtherPrice) - suite.NoError(err) - suite.Equal(expected, domesticOtherPrice.PriceCents) -} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go b/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go deleted file mode 100644 index 955a5ed3e63..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_service_area_prices_test.go +++ /dev/null @@ -1,125 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceAreaPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyDomesticServiceAreaPrices() - - // Spot check domestic service area prices for one row - suite.helperCheckDomesticServiceAreaPriceValue() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_domestic_service_area_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceAreaPricesFailures() { - suite.Run("stage_domestic_service_area_prices table missing", func() { - renameQuery := "ALTER TABLE stage_domestic_service_area_prices RENAME TO missing_stage_domestic_service_area_prices" - renameErr := suite.DB().RawQuery(renameQuery).Exec() - suite.NoError(renameErr) - - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - suite.NotNil(gre.ContractID) - - err = gre.importREDomesticServiceAreaPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBError(err, pgerrcode.UndefinedTable)) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticServiceAreaPrices() { - count, err := suite.DB().Count(&models.ReDomesticServiceAreaPrice{}) - suite.NoError(err) - suite.Equal(3234, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckDomesticServiceAreaPriceValue() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Get domestic service area UUID. - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '592'"). - First(&serviceArea) - suite.NoError(err) - - // Get domestic service area price DSH - suite.verifyDomesticServiceAreaPrice(unit.Cents(16), contract.ID, models.ReServiceCodeDSH, serviceArea.ID) - - // Get domestic service area price DOP - suite.verifyDomesticServiceAreaPrice(unit.Cents(581), contract.ID, models.ReServiceCodeDOP, serviceArea.ID) - - // Get domestic service area price DDP - suite.verifyDomesticServiceAreaPrice(unit.Cents(581), contract.ID, models.ReServiceCodeDDP, serviceArea.ID) - - // Get domestic service area price DOFSIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(1597), contract.ID, models.ReServiceCodeDOFSIT, serviceArea.ID) - - // Get domestic service area price DDFSIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(1597), contract.ID, models.ReServiceCodeDDFSIT, serviceArea.ID) - - // Get domestic service area price DOASIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(62), contract.ID, models.ReServiceCodeDOASIT, serviceArea.ID) - - // Get domestic service area price DDASIT - suite.verifyDomesticServiceAreaPrice(unit.Cents(62), contract.ID, models.ReServiceCodeDDASIT, serviceArea.ID) -} - -func (suite *GHCRateEngineImportSuite) verifyDomesticServiceAreaPrice(expected unit.Cents, contractID uuid.UUID, serviceCode models.ReServiceCode, serviceAreaID uuid.UUID) { - var service models.ReService - err := suite.DB().Where("code = ?", serviceCode).First(&service) - suite.NoError(err) - - var domesticServiceAreaPrice models.ReDomesticServiceAreaPrice - err = suite.DB(). - Where("contract_id = ?", contractID). - Where("service_id = ?", service.ID). - Where("domestic_service_area_id = ?", serviceAreaID). - Where("is_peak_period = false").First(&domesticServiceAreaPrice) - suite.NoError(err) - suite.Equal(expected, domesticServiceAreaPrice.PriceCents) -} diff --git a/pkg/services/ghcimport/import_re_domestic_service_area_test.go b/pkg/services/ghcimport/import_re_domestic_service_area_test.go deleted file mode 100644 index 774f96534b8..00000000000 --- a/pkg/services/ghcimport/import_re_domestic_service_area_test.go +++ /dev/null @@ -1,165 +0,0 @@ -package ghcimport - -import ( - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREDomesticServiceArea() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyServiceAreaCount(testContractCode) - suite.NotNil(gre.serviceAreaToIDMap) - - // Spot check a service area - suite.helperCheckServiceAreaValue(testContractCode) - }) - - suite.Run("Run a second time with changed data, should still succeed", func() { - setupTestData() - - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Change a service area and remove/change a zip and see if they return as they were before. - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '452'"). - First(&serviceArea) - suite.NoError(err) - serviceArea.ServicesSchedule = 2 - serviceArea.SITPDSchedule = 2 - suite.MustSave(&serviceArea) - - var zip3ToDelete models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("zip3 = '647'"). - First(&zip3ToDelete) - suite.NoError(err) - suite.MustDestroy(&zip3ToDelete) - - var zip3ToUpdate models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("zip3 = '657'"). - First(&zip3ToUpdate) - suite.NoError(err) - zip3ToUpdate.BasePointCity = "New City" - zip3ToUpdate.State = "XX" - suite.MustSave(&zip3ToUpdate) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperVerifyServiceAreaCount(testContractCode) - suite.NotNil(gre.serviceAreaToIDMap) - - // Check to see if data changed above has been reverted. - suite.helperCheckServiceAreaValue(testContractCode) - }) - - suite.Run("Run with a different contract code, should add new records", func() { - setupTestData() - - gre2 := &GHCRateEngineImporter{ - ContractCode: testContractCode2, - } - - // Prerequisite tables must be loaded. - err := gre2.importREContract(suite.AppContextForTest()) - suite.NoError(err) - err = gre2.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - suite.NoError(err) - suite.helperVerifyServiceAreaCount(testContractCode2) - suite.NotNil(gre2.serviceAreaToIDMap) - - // Spot check a service area - suite.helperCheckServiceAreaValue(testContractCode2) - - // Make sure the other contract's records are still there too. - suite.helperVerifyServiceAreaCount(testContractCode) - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyServiceAreaCount(contractCode string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - // Domestic service areas count - count, err := suite.DB().Where("contract_id = ?", contract.ID).Count(&models.ReDomesticServiceArea{}) - suite.NoError(err) - suite.Equal(5, count) - - // Zip3s count - count, err = suite.DB().Where("contract_id = ?", contract.ID).Count(&models.ReZip3{}) - suite.NoError(err) - suite.Equal(19, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckServiceAreaValue(contractCode string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - var serviceArea models.ReDomesticServiceArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_area = '452'"). - First(&serviceArea) - suite.NoError(err) - - suite.Equal(1, serviceArea.ServicesSchedule) - suite.Equal(3, serviceArea.SITPDSchedule) - - expectedZip3s := []struct { - zip3 string - city string - state string - }{ - {"647", "Butler", "MO"}, - {"648", "Neosho", "MO"}, - {"656", "Springfield", "MO"}, - {"657", "Springfield", "MO"}, - {"658", "Springfield", "MO"}, - } - - var zip3s models.ReZip3s - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("domestic_service_area_id = ?", serviceArea.ID). - All(&zip3s) - suite.NoError(err) - for _, zip3 := range zip3s { - found := false - for _, expectedZip3 := range expectedZip3s { - if zip3.Zip3 == expectedZip3.zip3 { - found = true - suite.Equal(expectedZip3.city, zip3.BasePointCity) - suite.Equal(expectedZip3.state, zip3.State) - } - } - suite.True(found, "Could not find zip3 [%s]", zip3.Zip3) - } - - suite.Len(zip3s, len(expectedZip3s), "Zip3 lengths did not match") -} diff --git a/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go b/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go deleted file mode 100644 index e9311817530..00000000000 --- a/pkg/services/ghcimport/import_re_intl_accessorial_prices_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREIntlAccessorialPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREIntlAccessorialPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyIntlAccessorialPrices() - suite.helperCheckIntlAccessorialPrices() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREIntlAccessorialPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_accessorial_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyIntlAccessorialPrices() { - count, err := suite.DB().Count(&models.ReIntlAccessorialPrice{}) - suite.NoError(err) - suite.Equal(8, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckIntlAccessorialPrices() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - testCases := []struct { - serviceCode models.ReServiceCode - market string - expectedPrice int - isError bool - }{ - {models.ReServiceCodeICRT, "C", 2561, false}, - {models.ReServiceCodeIUCRT, "C", 654, false}, - {models.ReServiceCodeIDSHUT, "C", 14529, false}, - {models.ReServiceCodeIDSHUT, "O", 15623, false}, - {models.ReServiceCodeIOSHUT, "O", 15623, false}, - {models.ReServiceCodeMS, "O", 0, true}, - {models.ReServiceCodeICRT, "R", 0, true}, - } - - for _, testCase := range testCases { - // Get service UUID. - var service models.ReService - err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) - suite.NoError(err) - - var intlAccessorialPrice models.ReIntlAccessorialPrice - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("service_id = $2", service.ID). - Where("market = $3", testCase.market). - First(&intlAccessorialPrice) - - if testCase.isError { - suite.Error(err) - } else { - suite.NoError(err) - suite.Equal(unit.Cents(testCase.expectedPrice), intlAccessorialPrice.PerUnitCents, "test case: %+v", testCase) - } - } -} diff --git a/pkg/services/ghcimport/import_re_intl_other_prices_test.go b/pkg/services/ghcimport/import_re_intl_other_prices_test.go deleted file mode 100644 index 8dc6fd4ce47..00000000000 --- a/pkg/services/ghcimport/import_re_intl_other_prices_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREInternationalOtherPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREInternationalOtherPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyInternationalOtherPrices() - - // Spot check a staging row's prices - suite.helperCheckInternationalOtherPriceRecords() - }) - - suite.Run("run twice; should immediately fail the second time due to constraint violation", func() { - setupTestData() - err := gre.importREInternationalOtherPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_other_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyInternationalOtherPrices() { - count, err := suite.DB().Count(&models.ReIntlOtherPrice{}) - suite.NoError(err) - suite.Equal(2580, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckInternationalOtherPriceRecords() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Get rate area UUID. - var rateArea *models.ReRateArea - rateArea, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") - suite.NoError(err) - - // Get service UUID. - testServices := []struct { - service models.ReServiceCode - expectedPrice int - }{ - {models.ReServiceCodeIHPK, 8186}, - {models.ReServiceCodeIHUPK, 915}, - {models.ReServiceCodeIUBPK, 8482}, - {models.ReServiceCodeIUBUPK, 847}, - {models.ReServiceCodeIOFSIT, 507}, - {models.ReServiceCodeIDFSIT, 507}, - {models.ReServiceCodeIOASIT, 14}, - {models.ReServiceCodeIDASIT, 14}, - {models.ReServiceCodeIOPSIT, 17001}, - {models.ReServiceCodeIDDSIT, 30186}, - } - - for _, test := range testServices { - suite.helperCheckOneOtherInternationalPriceRecord(test.expectedPrice, contract.ID, test.service, rateArea.ID) - } -} - -func (suite *GHCRateEngineImportSuite) helperCheckOneOtherInternationalPriceRecord(expected int, contractID uuid.UUID, serviceCode models.ReServiceCode, rateAreaID uuid.UUID) { - var service models.ReService - err := suite.DB().Where("code = ?", serviceCode).First(&service) - suite.NoError(err) - - var intlOtherPrice models.ReIntlOtherPrice - err = suite.DB(). - Where("contract_id = ?", contractID). - Where("service_id = ?", service.ID). - Where("is_peak_period = true"). - Where("rate_area_id = ?", rateAreaID). - First(&intlOtherPrice) - suite.NoError(err) - suite.Equal(unit.Cents(expected), intlOtherPrice.PerUnitCents) -} diff --git a/pkg/services/ghcimport/import_re_intl_prices_test.go b/pkg/services/ghcimport/import_re_intl_prices_test.go deleted file mode 100644 index ae159e3197d..00000000000 --- a/pkg/services/ghcimport/import_re_intl_prices_test.go +++ /dev/null @@ -1,188 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importREInternationalPrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREInternationalPrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyInternationalPrices() - - // Spot check prices - suite.helperCheckInternationalPriceValues() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREInternationalPrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_intl_prices_unique_key")) - } - }) -} -func (suite *GHCRateEngineImportSuite) Test_getRateAreaIDForKind() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - } - // Doing this here instead of a separate test function so we don't have to reload prerequisite tables - suite.Run("tests for getRateAreaIDForKind", func() { - setupTestData() - testCases := []struct { - name string - rateArea string - kind string - shouldError bool - }{ - {"good NSRA", "NSRA2", "NSRA", false}, - {"good OCONUS", "US8101000", "OCONUS", false}, - {"good CONUS", "US47", "CONUS", false}, - {"bad NSRA", "XYZ", "NSRA", true}, - {"bad OCONUS", "US47", "OCONUS", true}, - {"bad CONUS", "NSRA13", "CONUS", true}, - {"bad kind", "NSRA2", "NNNN", true}, - } - - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - for _, testCase := range testCases { - suite.Run(testCase.name, func() { - id, err := gre.getRateAreaIDForKind(testCase.rateArea, testCase.kind) - if testCase.shouldError { - suite.Error(err) - suite.Equal(uuid.Nil, id) - } else { - suite.NoError(err) - - // Fetch the UUID from the database and see if it matches - origin, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.rateArea) - suite.NoError(err) - suite.Equal(origin.ID, id) - } - }) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyInternationalPrices() { - count, err := suite.DB().Count(&models.ReIntlPrice{}) - suite.NoError(err) - suite.Equal(46640, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckInternationalPriceValues() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Spot check one non-peak/peak record of each type - testCases := []struct { - serviceCode models.ReServiceCode - originRateArea string - destinationRateArea string - isPeakPeriod bool - expectedPrice int - }{ - // 3a: OCONUS to OCONUS - {models.ReServiceCodeISLH, "GE", "US8101000", false, 1021}, - {models.ReServiceCodeUBP, "GE", "US8101000", false, 1717}, - {models.ReServiceCodeISLH, "GE", "US8101000", true, 1205}, - {models.ReServiceCodeUBP, "GE", "US8101000", true, 2026}, - // 3b: CONUS to OCONUS - {models.ReServiceCodeISLH, "US47", "AS11", false, 3090}, - {models.ReServiceCodeUBP, "US47", "AS11", false, 3398}, - {models.ReServiceCodeISLH, "US47", "AS11", true, 3646}, - {models.ReServiceCodeUBP, "US47", "AS11", true, 4010}, - // 3c: OCONUS to CONUS - {models.ReServiceCodeISLH, "US8101000", "US68", false, 1757}, - {models.ReServiceCodeUBP, "US8101000", "US68", false, 3445}, - {models.ReServiceCodeISLH, "US8101000", "US68", true, 2073}, - {models.ReServiceCodeUBP, "US8101000", "US68", true, 4065}, - // 3e: NSRA to NSRA - {models.ReServiceCodeISLH, "NSRA2", "NSRA13", false, 4849}, - {models.ReServiceCodeUBP, "NSRA2", "NSRA13", false, 4793}, - {models.ReServiceCodeISLH, "NSRA2", "NSRA13", true, 5722}, - {models.ReServiceCodeUBP, "NSRA2", "NSRA13", true, 5656}, - // 3e: NSRA to OCONUS - {models.ReServiceCodeISLH, "NSRA13", "AS11", false, 5172}, - {models.ReServiceCodeUBP, "NSRA13", "AS11", false, 1175}, - {models.ReServiceCodeISLH, "NSRA13", "AS11", true, 6103}, - {models.ReServiceCodeUBP, "NSRA13", "AS11", true, 1386}, - // 3e: OCONUS to NSRA - {models.ReServiceCodeISLH, "GE", "NSRA2", false, 4872}, - {models.ReServiceCodeUBP, "GE", "NSRA2", false, 1050}, - {models.ReServiceCodeISLH, "GE", "NSRA2", true, 5749}, - {models.ReServiceCodeUBP, "GE", "NSRA2", true, 1239}, - // 3e: NSRA to CONUS - {models.ReServiceCodeISLH, "NSRA2", "US4965500", false, 931}, - {models.ReServiceCodeUBP, "NSRA2", "US4965500", false, 1717}, - {models.ReServiceCodeISLH, "NSRA2", "US4965500", true, 1099}, - {models.ReServiceCodeUBP, "NSRA2", "US4965500", true, 2026}, - // 3e: CONUS to NSRA - {models.ReServiceCodeISLH, "US68", "NSRA13", false, 1065}, - {models.ReServiceCodeUBP, "US68", "NSRA13", false, 1689}, - {models.ReServiceCodeISLH, "US68", "NSRA13", true, 1257}, - {models.ReServiceCodeUBP, "US68", "NSRA13", true, 1993}, - } - - for _, testCase := range testCases { - var service models.ReService - err = suite.DB().Where("code = ?", testCase.serviceCode).First(&service) - suite.NoError(err) - - // Get origin rate area UUID. - origin, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.originRateArea) - suite.NoError(err) - - // Get destination rate area UUID. - destination, err := models.FetchReRateAreaItem(suite.DB(), contract.ID, testCase.destinationRateArea) - suite.NoError(err) - - var intlPrice models.ReIntlPrice - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("service_id = ?", service.ID). - Where("origin_rate_area_id = ?", origin.ID). - Where("destination_rate_area_id = ?", destination.ID). - Where("is_peak_period = ?", testCase.isPeakPeriod). - First(&intlPrice) - suite.NoError(err) - suite.Equal(unit.Cents(testCase.expectedPrice), intlPrice.PerUnitCents, "test case: %+v", testCase) - } -} diff --git a/pkg/services/ghcimport/import_re_rate_area_test.go b/pkg/services/ghcimport/import_re_rate_area_test.go deleted file mode 100644 index 37e047349fe..00000000000 --- a/pkg/services/ghcimport/import_re_rate_area_test.go +++ /dev/null @@ -1,223 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) helperImportRERateArea(action string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", testContractCode).First(&contract) - suite.NoError(err) - - // Update domestic US6B name "Texas-South" to something else and verify it was changed back when done - var texas *models.ReRateArea - texas, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") - suite.NoError(err) - suite.Equal(true, suite.NotNil(texas)) - suite.Equal("Texas-South", texas.Name) - - // Update oconus US8101000 name "Alaska (Zone) I" to something else and verify it was changed back when done - var alaska *models.ReRateArea - alaska, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US8101000") - suite.NoError(err) - suite.Equal(true, suite.NotNil(alaska)) - suite.Equal("Alaska (Zone) I", alaska.Name) - - // Update oconus AS11 name "New South Wales/Australian Capital Territory" - var wales *models.ReRateArea - wales, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "AS11") - suite.NoError(err) - suite.Equal(true, suite.NotNil(wales)) - suite.Equal("New South Wales/Australian Capital Territory", wales.Name) - - if action == "setup" { - modifiedName := "New name" - texas.Name = modifiedName - suite.MustSave(texas) - texas, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US68") - suite.NoError(err) - suite.Equal(modifiedName, texas.Name) - - modifiedName = "New name 2" - alaska.Name = modifiedName - suite.MustSave(alaska) - alaska, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "US8101000") - suite.NoError(err) - suite.Equal(modifiedName, alaska.Name) - - modifiedName = "New name 3" - wales.Name = modifiedName - suite.MustSave(wales) - wales, err = models.FetchReRateAreaItem(suite.DB(), contract.ID, "AS11") - suite.NoError(err) - suite.Equal(modifiedName, wales.Name) - } -} - -func (suite *GHCRateEngineImportSuite) helperVerifyDomesticRateAreaToIDMap(contractCode string, domesticRateAreaToIDMap map[string]uuid.UUID) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - suite.NotEqual(map[string]uuid.UUID(nil), domesticRateAreaToIDMap) - count, dbErr := suite.DB(). - Where("contract_id = ?", contract.ID). - Where("is_oconus = 'false'"). - Count(models.ReRateArea{}) - suite.NoError(dbErr) - - suite.Equal(12, count) - suite.Equal(count, len(domesticRateAreaToIDMap)) - - var rateArea models.ReRateArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'US68'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Texas-South", rateArea.Name) - suite.Equal(rateArea.ID, domesticRateAreaToIDMap["US68"]) - - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'US47'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Alabama", rateArea.Name) - suite.Equal(rateArea.ID, domesticRateAreaToIDMap["US47"]) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyInternationalRateAreaToIDMap(contractCode string, internationalRateAreaToIDMap map[string]uuid.UUID) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - suite.NotEqual(map[string]uuid.UUID(nil), internationalRateAreaToIDMap) - count, dbErr := suite.DB(). - Where("contract_id = ?", contract.ID). - Where("is_oconus = 'true'"). - Count(models.ReRateArea{}) - suite.NoError(dbErr) - - suite.Equal(5, count) - suite.Equal(count, len(internationalRateAreaToIDMap)) - - var rateArea models.ReRateArea - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'GE'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Germany", rateArea.Name) - suite.Equal(rateArea.ID, internationalRateAreaToIDMap["GE"]) - - err = suite.DB(). - Where("contract_id = ?", contract.ID). - Where("code = 'US8101000'"). - First(&rateArea) - suite.NoError(err) - - suite.Equal("Alaska (Zone) I", rateArea.Name) - suite.Equal(rateArea.ID, internationalRateAreaToIDMap["US8101000"]) -} - -func (suite *GHCRateEngineImportSuite) helperImportRERateAreaVerifyImportComplete(contractCode string) { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = ?", contractCode).First(&contract) - suite.NoError(err) - - var rateArea models.ReRateArea - count, countErr := suite.DB().Where("contract_id = ?", contract.ID).Count(&rateArea) - - suite.NoError(countErr) - suite.Equal(17, count) -} - -func (suite *GHCRateEngineImportSuite) TestGHCRateEngineImporter_importRERateArea() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - //Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("Successfully run import with staged staging data (empty RE tables)", func() { - setupTestData() - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) - }) - - suite.Run("Successfully run import, 2nd time, with staged staging data and filled in RE tables", func() { - setupTestData() - - err := gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) - }) - - suite.Run("Successfully run import, prefilled re_rate_areas, update existing rate area from import", func() { - setupTestData() - suite.helperImportRERateArea("setup") - - err := gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode, gre.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode, gre.internationalRateAreaToIDMap) - suite.helperImportRERateArea("verify") - }) - - suite.Run("Fail to run import, missing staging table", func() { - renameQuery := "ALTER TABLE stage_conus_to_oconus_prices RENAME TO missing_stage_conus_to_oconus_prices" - renameErr := suite.DB().RawQuery(renameQuery).Exec() - suite.NoError(renameErr) - - err := gre.importRERateArea(suite.AppContextForTest()) - suite.Error(err) - }) - - suite.Run("Run with 2 different contract codes, should add new records both times", func() { - setupTestData() - err := gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - - gre2 := &GHCRateEngineImporter{ - ContractCode: testContractCode2, - } - - // Prerequisite tables must be loaded. - err = gre2.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre2.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - suite.helperImportRERateAreaVerifyImportComplete(testContractCode2) - - suite.helperVerifyDomesticRateAreaToIDMap(testContractCode2, gre2.domesticRateAreaToIDMap) - suite.helperVerifyInternationalRateAreaToIDMap(testContractCode2, gre2.internationalRateAreaToIDMap) - - // Make sure the other contract's records are still there too. - suite.helperImportRERateAreaVerifyImportComplete(testContractCode) - }) -} diff --git a/pkg/services/ghcimport/import_re_shipment_type_prices_test.go b/pkg/services/ghcimport/import_re_shipment_type_prices_test.go deleted file mode 100644 index adc6f6907b1..00000000000 --- a/pkg/services/ghcimport/import_re_shipment_type_prices_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_importREShipmentTypePrices() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREShipmentTypePrices(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyShipmentTypePrices() - suite.helperCheckShipmentTypePrices() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importREShipmentTypePrices(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_shipment_type_prices_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyShipmentTypePrices() { - count, err := suite.DB().Count(&models.ReShipmentTypePrice{}) - suite.NoError(err) - suite.Equal(7, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckShipmentTypePrices() { - // Get contract UUID. - var contract models.ReContract - err := suite.DB().Where("code = $1", testContractCode).First(&contract) - suite.NoError(err) - - // Get service UUID for shipment type - var service models.ReService - err = suite.DB().Where("code = $1", models.ReServiceCodeDMHF).First(&service) - suite.NoError(err) - - var shipmentTypePrices models.ReShipmentTypePrice - err = suite.DB(). - Where("contract_id = $1", contract.ID). - Where("service_id = $2", service.ID). - First(&shipmentTypePrices) - suite.NoError(err) - suite.Equal(1.20, shipmentTypePrices.Factor) -} diff --git a/pkg/services/ghcimport/import_re_task_order_fees_test.go b/pkg/services/ghcimport/import_re_task_order_fees_test.go deleted file mode 100644 index 365f125f08c..00000000000 --- a/pkg/services/ghcimport/import_re_task_order_fees_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package ghcimport - -import ( - "github.com/jackc/pgerrcode" - - "github.com/transcom/mymove/pkg/db/dberr" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -func (suite *GHCRateEngineImportSuite) Test_importRETaskOrderFees() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - ContractStartDate: testContractStartDate, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREContractYears(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRETaskOrderFees(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("import success", func() { - setupTestData() - suite.helperVerifyTaskOrderFees() - suite.helperCheckTaskOrderFees() - }) - - suite.Run("run a second time; should fail immediately due to constraint violation", func() { - setupTestData() - err := gre.importRETaskOrderFees(suite.AppContextForTest()) - if suite.Error(err) { - suite.True(dberr.IsDBErrorForConstraint(err, pgerrcode.UniqueViolation, "re_task_order_fees_unique_key")) - } - }) -} - -func (suite *GHCRateEngineImportSuite) helperVerifyTaskOrderFees() { - count, err := suite.DB().Count(&models.ReTaskOrderFee{}) - suite.NoError(err) - suite.Equal(16, count) -} - -func (suite *GHCRateEngineImportSuite) helperCheckTaskOrderFees() { - // Get service UUID. - var serviceMS models.ReService - err := suite.DB().Where("code = $1", models.ReServiceCodeMS).First(&serviceMS) - suite.NoError(err) - - var serviceCS models.ReService - err = suite.DB().Where("code = $1", models.ReServiceCodeCS).First(&serviceCS) - suite.NoError(err) - - // Get contract year UUID. - var contractYear models.ReContractYear - err = suite.DB().Where("name = 'Base Period Year 1'").First(&contractYear) - suite.NoError(err) - - var taskOrderFeeMS models.ReTaskOrderFee - err = suite.DB(). - Where("service_id = $1", serviceMS.ID). - Where("contract_year_id = $2", contractYear.ID). - First(&taskOrderFeeMS) - suite.NoError(err) - suite.Equal(unit.Cents(45115), taskOrderFeeMS.PriceCents) - - var taskOrderFeeCS models.ReTaskOrderFee - err = suite.DB(). - Where("service_id = $1", serviceCS.ID). - Where("contract_year_id = $2", contractYear.ID). - First(&taskOrderFeeCS) - suite.NoError(err) - suite.Equal(unit.Cents(22263), taskOrderFeeCS.PriceCents) -} diff --git a/pkg/services/ghcimport/load_service_map_test.go b/pkg/services/ghcimport/load_service_map_test.go deleted file mode 100644 index 840505fbbe4..00000000000 --- a/pkg/services/ghcimport/load_service_map_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package ghcimport - -import ( - "github.com/gofrs/uuid" - - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_loadServiceMap() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - suite.Run("load success", func() { - err := gre.loadServiceMap(suite.AppContextForTest()) - suite.NoError(err) - - suite.NotNil(gre.serviceToIDMap) - - count, err := suite.DB().Count(&models.ReService{}) - suite.NoError(err) - suite.Greater(count, 0) - suite.Equal(count, len(gre.serviceToIDMap)) - - // Spot-check a service code - testServiceCode := models.ReServiceCodeDOASIT - if suite.Contains(gre.serviceToIDMap, testServiceCode) { - suite.NotEqual(uuid.Nil, gre.serviceToIDMap[testServiceCode]) - } - }) -} diff --git a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go b/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go deleted file mode 100644 index 6252cb0e8df..00000000000 --- a/pkg/services/ghcimport/map_zip_codes_to_re_rate_areas_test.go +++ /dev/null @@ -1,140 +0,0 @@ -package ghcimport - -import ( - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_mapZipCodesToReRateAreas() { - gre := &GHCRateEngineImporter{ - ContractCode: testContractCode, - } - - setupTestData := func() { - // Prerequisite tables must be loaded. - err := gre.importREContract(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importREDomesticServiceArea(suite.AppContextForTest()) - suite.NoError(err) - - err = gre.importRERateArea(suite.AppContextForTest()) - suite.NoError(err) - } - - suite.Run("map ReZip3 records to correct ReRateArea records", func() { - setupTestData() - reContract, err := suite.helperFetchReContract() - suite.NoError(err) - - var reZip3 models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", reContract.ID). - Where("zip3 = ?", "352"). - First(&reZip3) - suite.NoError(err) - - var reZip3WithMultipleReRateAreas models.ReZip3 - err = suite.DB(). - Where("contract_id = ?", reContract.ID). - Where("zip3 = ?", "327"). - First(&reZip3WithMultipleReRateAreas) - suite.NoError(err) - - suite.Nil(reZip3.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", reZip3.ID) - suite.Nil(reZip3WithMultipleReRateAreas.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", reZip3WithMultipleReRateAreas.ID) - - rateAreaCode, found := zip3ToRateAreaMappings[reZip3.Zip3] - suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip3.Zip3) - - zipRateAreaCode, found := zip3ToRateAreaMappings[reZip3WithMultipleReRateAreas.Zip3] - suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip3WithMultipleReRateAreas.Zip3) - suite.Equal(zipRateAreaCode, "ZIP", "expected rate area code to be ZIP but got %s", zipRateAreaCode) - - reRateArea, err := suite.helperFetchReRateArea(reContract, rateAreaCode) - suite.NoError(err) - - err = gre.mapREZip3sToRERateAreas(suite.AppContextForTest()) - suite.NoError(err) - - var updatedReZip3 models.ReZip3 - err = suite.DB(). - Where("id = ?", reZip3.ID). - First(&updatedReZip3) - suite.NoError(err) - - suite.NotNil(updatedReZip3.RateAreaID, "expected ReZip3 record %s to not have nil rate_area_id", updatedReZip3.ID) - suite.Equal(*updatedReZip3.RateAreaID, reRateArea.ID, "expected ReZip3 %s record to be mapped to ReRateArea record %s, but got %s", reRateArea.ID, updatedReZip3.RateAreaID) - - var updatedReZip3WithMultipleReRateAreas models.ReZip3 - err = suite.DB(). - Where("id = ?", reZip3WithMultipleReRateAreas.ID). - First(&updatedReZip3WithMultipleReRateAreas) - suite.NoError(err) - - suite.Nil(updatedReZip3WithMultipleReRateAreas.RateAreaID, "expected ReZip3 record %s to have nil rate_area_id", updatedReZip3WithMultipleReRateAreas.ID) - suite.True(updatedReZip3WithMultipleReRateAreas.HasMultipleRateAreas) - }) - - suite.Run("create ReZip5RateArea records and map to correct ReRateArea records", func() { - setupTestData() - reContract, err := suite.helperFetchReContract() - suite.NoError(err) - - reZip5RateAreasCount, err := suite.DB(). - Where("contract_id = ?", reContract.ID). - Count(&models.ReZip5RateArea{}) - suite.NoError(err) - - suite.Equal(0, reZip5RateAreasCount) - - err = gre.createAndMapREZip5sToRERateAreas(suite.AppContextForTest()) - suite.NoError(err) - - var reZip5RateArea models.ReZip5RateArea - err = suite.DB(). - Where("contract_id = ?", reContract.ID). - First(&reZip5RateArea) - suite.NoError(err) - - rateAreaCode, found := zip5ToRateAreaMappings[reZip5RateArea.Zip5] - suite.True(found, "failed to find rate area map for zip3 %s in zip3ToRateAreaMappings", reZip5RateArea.Zip5) - - reRateArea, err := suite.helperFetchReRateArea(reContract, rateAreaCode) - suite.NoError(err) - - suite.Equal(reZip5RateArea.RateAreaID, reRateArea.ID, "expected ReZip3 %s record to be mapped to ReRateArea record %s, but got %s", reRateArea.ID, reZip5RateArea.RateAreaID) - suite.helperVerifyNumberOfReZip5RateAreasCreated() - }) -} - -func (suite *GHCRateEngineImportSuite) helperFetchReContract() (models.ReContract, error) { - var reContract models.ReContract - err := suite.DB(). - Where("code = ?", testContractCode). - First(&reContract) - - return reContract, err -} - -func (suite *GHCRateEngineImportSuite) helperFetchReRateArea(reContract models.ReContract, rateAreaCode string) (models.ReRateArea, error) { - var reRateArea models.ReRateArea - - err := suite.DB(). - Where("contract_id = ?", reContract.ID). - Where("code = ?", rateAreaCode). - First(&reRateArea) - - return reRateArea, err -} - -func (suite *GHCRateEngineImportSuite) helperVerifyNumberOfReZip5RateAreasCreated() { - reContract, err := suite.helperFetchReContract() - suite.NoError(err) - - reZip5RateAreasCount, err := suite.DB(). - Where("contract_id = ?", reContract.ID). - Count(&models.ReZip5RateArea{}) - suite.NoError(err) - - suite.Equal(922, reZip5RateAreasCount) -} diff --git a/pkg/services/ghcimport/shared_test.go b/pkg/services/ghcimport/shared_test.go deleted file mode 100644 index 51fb83001d2..00000000000 --- a/pkg/services/ghcimport/shared_test.go +++ /dev/null @@ -1,219 +0,0 @@ -package ghcimport - -import ( - "github.com/transcom/mymove/pkg/models" -) - -func (suite *GHCRateEngineImportSuite) Test_stringToInteger() { - tests := []struct { - name string - input string - expected int - shouldError bool - }{ - {"with decimal point", "25.0", 25, false}, - {"no decimal point", "25", 25, false}, - {"not a number", "2A", 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := stringToInteger(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_cleanServiceAreaNumber() { - tests := []struct { - name string - input string - expected string - shouldError bool - }{ - {"with decimal point, needs leading zeros", "4.0", "004", false}, - {"no decimal point", "225", "225", false}, - {"not a number", "B3", "", true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := cleanServiceAreaNumber(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_cleanZip3() { - tests := []struct { - name string - input string - expected string - shouldError bool - }{ - {"with decimal point, needs leading zeros", "15.0", "015", false}, - {"no decimal point", "309", "309", false}, - {"not a number", "30L", "", true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := cleanZip3(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_isPeakPeriod() { - tests := []struct { - name string - input string - expected bool - shouldError bool - }{ - {"peak", "Peak", true, false}, - {"peak, upper case", "PEAK", true, false}, - {"non-peak", "NonPeak", false, false}, - {"non-peak, upper case", "NONPEAK", false, false}, - {"invalid period", "Non-Peak", false, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := isPeakPeriod(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_getPriceParts() { - tests := []struct { - name string - rawPrice string - decimalPlaces int - expectedIntegerPart int - expectedFractionalPart int - shouldError bool - }{ - {"at expected decimal places", "$3.557", 3, 3, 557, false}, - {"less than max decimal places", "$3.5", 3, 0, 0, true}, - {"more than max decimal places", "$3.5777", 3, 0, 0, true}, - {"no dollar sign", "2.001", 3, 2, 1, false}, - {"very small, no dollar sign", "0.005", 3, 0, 5, false}, - {"no decimal point", "1", 3, 0, 0, true}, - {"invalid price", "$3.ABC", 3, 0, 0, true}, - {"empty string", "", 4, 0, 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - integerPart, fractionalPart, err := getPriceParts(test.rawPrice, test.decimalPlaces) - suite.Equal(test.expectedIntegerPart, integerPart) - suite.Equal(test.expectedFractionalPart, fractionalPart) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_priceToMillicents() { - tests := []struct { - name string - input string - expected int - shouldError bool - }{ - {"price with dollar sign", "$3.557", 355700, false}, - {"leading zeros in decimal part", "$3.005", 300500, false}, - {"two decimal places", "$3.55", 0, true}, - {"more than expected decimal places", "$3.5571", 0, true}, - {"input of zero", "0", 0, true}, - {"empty string", "", 0, true}, - {"price without dollar sign", "0.001", 100, false}, - {"price as integer", "3", 0, true}, - {"not a number", "3.53X", 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := priceToMillicents(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_priceToCents() { - tests := []struct { - name string - input string - expected int - shouldError bool - }{ - {"price with dollar sign", "$3.55", 355, false}, - {"leading zeros in decimal part", "$3.01", 301, false}, - {"more than expected decimal places", "$3.551", 0, true}, - {"input of zero", "0", 0, true}, - {"empty string", "", 0, true}, - {"price without dollar sign", "0.01", 1, false}, - {"price as integer", "3", 0, true}, - {"not a number", "3.5X", 0, true}, - } - for _, test := range tests { - suite.Run(test.name, func() { - result, err := priceToCents(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} - -func (suite *GHCRateEngineImportSuite) Test_getMarket() { - tests := []struct { - name string - input string - expected models.Market - shouldError bool - }{ - {"CONUS", "CONUS", "C", false}, - {"OCONUS", "OCONUS", "O", false}, - {"XONUS", "XONUS", "invalid market", true}, - } - - for _, test := range tests { - suite.Run(test.name, func() { - result, err := getMarket(test.input) - suite.Equal(test.expected, result) - if test.shouldError { - suite.Error(err) - } else { - suite.NoError(err) - } - }) - } -} From 6d50ee60a1f490e472975feb89dc1a50164016f5 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 25 Feb 2025 19:53:17 +0000 Subject: [PATCH 04/13] fix some tests that were hiding behind the import fail --- pkg/handlers/ghcapi/mto_shipment_test.go | 2 -- pkg/handlers/primeapi/mto_service_item_test.go | 3 +++ pkg/handlers/primeapiv2/mto_service_item_test.go | 3 +++ pkg/handlers/primeapiv3/mto_service_item_test.go | 3 +++ pkg/services/move_task_order/move_task_order_updater_test.go | 1 + pkg/services/mto_service_item/mto_service_item_updater_test.go | 1 + pkg/services/mto_shipment/mto_shipment_updater_test.go | 1 + pkg/services/orchestrators/shipment/shipment_updater_test.go | 1 - 8 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/handlers/ghcapi/mto_shipment_test.go b/pkg/handlers/ghcapi/mto_shipment_test.go index 247ef1ae1fb..32ed948040f 100644 --- a/pkg/handlers/ghcapi/mto_shipment_test.go +++ b/pkg/handlers/ghcapi/mto_shipment_test.go @@ -615,7 +615,6 @@ func (suite *HandlerSuite) TestApproveShipmentHandler() { mock.Anything, mock.Anything, false, - false, ).Return(400, nil) ppmEstimator := mocks.PPMEstimator{} planner.On("ZipTransitDistance", @@ -976,7 +975,6 @@ func (suite *HandlerSuite) TestApproveShipmentsHandler() { mock.Anything, mock.Anything, false, - false, ).Return(400, nil) ppmEstimator := mocks.PPMEstimator{} diff --git a/pkg/handlers/primeapi/mto_service_item_test.go b/pkg/handlers/primeapi/mto_service_item_test.go index 8f58d9a096b..7f3163f6cfe 100644 --- a/pkg/handlers/primeapi/mto_service_item_test.go +++ b/pkg/handlers/primeapi/mto_service_item_test.go @@ -223,6 +223,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -509,6 +510,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -541,6 +543,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ diff --git a/pkg/handlers/primeapiv2/mto_service_item_test.go b/pkg/handlers/primeapiv2/mto_service_item_test.go index a48c9bfe87d..be3bd3f26cb 100644 --- a/pkg/handlers/primeapiv2/mto_service_item_test.go +++ b/pkg/handlers/primeapiv2/mto_service_item_test.go @@ -218,6 +218,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -504,6 +505,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -536,6 +538,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ diff --git a/pkg/handlers/primeapiv3/mto_service_item_test.go b/pkg/handlers/primeapiv3/mto_service_item_test.go index b0b02a71aca..1109ecfb752 100644 --- a/pkg/handlers/primeapiv3/mto_service_item_test.go +++ b/pkg/handlers/primeapiv3/mto_service_item_test.go @@ -219,6 +219,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -505,6 +506,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -537,6 +539,7 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ diff --git a/pkg/services/move_task_order/move_task_order_updater_test.go b/pkg/services/move_task_order/move_task_order_updater_test.go index 8795b151aae..61c4207b7ad 100644 --- a/pkg/services/move_task_order/move_task_order_updater_test.go +++ b/pkg/services/move_task_order/move_task_order_updater_test.go @@ -859,6 +859,7 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_ApproveMoveAndC mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) officeUser := setupTestData() move := factory.BuildApprovalsRequestedMove(suite.DB(), []factory.Customization{ diff --git a/pkg/services/mto_service_item/mto_service_item_updater_test.go b/pkg/services/mto_service_item/mto_service_item_updater_test.go index a1192cc39fe..9ade4045d9b 100644 --- a/pkg/services/mto_service_item/mto_service_item_updater_test.go +++ b/pkg/services/mto_service_item/mto_service_item_updater_test.go @@ -2856,6 +2856,7 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemPricingEstimate mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) updater := NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portlocation.NewPortLocationFetcher(), ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) diff --git a/pkg/services/mto_shipment/mto_shipment_updater_test.go b/pkg/services/mto_shipment/mto_shipment_updater_test.go index e408c246cd0..69e31511975 100644 --- a/pkg/services/mto_shipment/mto_shipment_updater_test.go +++ b/pkg/services/mto_shipment/mto_shipment_updater_test.go @@ -3633,6 +3633,7 @@ func (suite *MTOShipmentServiceSuite) TestUpdateDomesticServiceItems() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, + false, ).Return(400, nil) siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) updater := NewMTOShipmentStatusUpdater(builder, siCreator, planner) diff --git a/pkg/services/orchestrators/shipment/shipment_updater_test.go b/pkg/services/orchestrators/shipment/shipment_updater_test.go index 3b9fec24cac..aebc4f1ce29 100644 --- a/pkg/services/orchestrators/shipment/shipment_updater_test.go +++ b/pkg/services/orchestrators/shipment/shipment_updater_test.go @@ -581,7 +581,6 @@ func (suite *ShipmentSuite) TestUpdateShipment() { mock.Anything, mock.Anything, false, - false, ).Return(800, nil) returnCents := unit.Cents(123) From ffa5bb88fa56fb22dd12cf17207421beab296a91 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 25 Feb 2025 20:07:38 +0000 Subject: [PATCH 05/13] woohoo another fix for pkg/services/mtoshipment --- .../mto_shipment/mto_shipment_address_updater_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/services/mto_shipment/mto_shipment_address_updater_test.go b/pkg/services/mto_shipment/mto_shipment_address_updater_test.go index 4eace1a7413..13d5f04299f 100644 --- a/pkg/services/mto_shipment/mto_shipment_address_updater_test.go +++ b/pkg/services/mto_shipment/mto_shipment_address_updater_test.go @@ -91,6 +91,11 @@ func (suite *MTOShipmentServiceSuite) TestUpdateMTOShipmentAddress() { Type: &factory.Addresses.DeliveryAddress, LinkOnly: true, }, + { + Model: address, + LinkOnly: true, + Type: &factory.Addresses.PickupAddress, + }, }, nil) threeMonthsAgo := time.Now().AddDate(0, -3, 0) @@ -143,6 +148,11 @@ func (suite *MTOShipmentServiceSuite) TestUpdateMTOShipmentAddress() { Type: &factory.Addresses.DeliveryAddress, LinkOnly: true, }, + { + Model: address, + Type: &factory.Addresses.PickupAddress, + LinkOnly: true, + }, }, nil) threeMonthsAgo := time.Now().AddDate(0, -3, 0) From ca7566effb798bf49ad2963731b0167bd1ac2f34 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 26 Feb 2025 17:41:04 +0000 Subject: [PATCH 06/13] fix ssw gtcc calc test --- .../shipment_summary_worksheet_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 4e608703d55..ed5b468a091 100644 --- a/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go +++ b/pkg/services/shipment_summary_worksheet/shipment_summary_worksheet_test.go @@ -1964,7 +1964,7 @@ 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(100.00) + expectedResult := "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(0.00) expensesMap["TotalGTCCPaid"] = 200.00 expensesMap["StorageGTCCPaid"] = 300.00 ppmRemainingEntitlement := 60.00 @@ -1973,7 +1973,7 @@ func (suite *ShipmentSummaryWorksheetServiceSuite) TestFormatDisbursement() { suite.Equal(expectedResult, result) // Test case 2: GTCC calculation A is less than GTCC calculation B - expectedResult = "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(500.00) + expectedResult = "GTCC: " + FormatDollars(100.00) + "\nMember: " + FormatDollars(400.00) expensesMap = make(map[string]float64) expensesMap["TotalGTCCPaid"] = 60.00 expensesMap["StorageGTCCPaid"] = 40.00 From 21e52489d88e1b8f29510757dabd84fc0b70cbd8 Mon Sep 17 00:00:00 2001 From: Alex Lusk Date: Tue, 4 Mar 2025 22:45:29 +0000 Subject: [PATCH 07/13] primev3 move_task_order handler test fixes --- pkg/handlers/primeapiv3/move_task_order_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/handlers/primeapiv3/move_task_order_test.go b/pkg/handlers/primeapiv3/move_task_order_test.go index 06880f84230..e118c808c4b 100644 --- a/pkg/handlers/primeapiv3/move_task_order_test.go +++ b/pkg/handlers/primeapiv3/move_task_order_test.go @@ -32,8 +32,12 @@ func (suite *HandlerSuite) TestGetMoveTaskOrder() { verifyAddressFields := func(address *models.Address, payload *primev3messages.Address) { suite.Equal(address.ID.String(), payload.ID.String()) suite.Equal(address.StreetAddress1, *payload.StreetAddress1) - suite.Equal(*address.StreetAddress2, *payload.StreetAddress2) - suite.Equal(*address.StreetAddress3, *payload.StreetAddress3) + if address.StreetAddress2 != nil { + suite.Equal(*address.StreetAddress2, *payload.StreetAddress2) + } + if address.StreetAddress3 != nil { + suite.Equal(*address.StreetAddress3, *payload.StreetAddress3) + } suite.Equal(address.City, *payload.City) suite.Equal(address.State, *payload.State) suite.Equal(address.PostalCode, *payload.PostalCode) @@ -1484,6 +1488,7 @@ func (suite *HandlerSuite) TestGetMoveTaskOrder() { PrimeEstimatedWeightRecordedDate: &aWeekAgo, RequiredDeliveryDate: &nowDate, ScheduledDeliveryDate: &nowDate, + MarketCode: models.MarketCodeInternational, }, }, { From 7473015ca0c358088d3b7c1443535bac98b63bc2 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 5 Mar 2025 16:35:12 +0000 Subject: [PATCH 08/13] test fixes in service item validators --- .../mto_service_item_validators_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/services/mto_service_item/mto_service_item_validators_test.go b/pkg/services/mto_service_item/mto_service_item_validators_test.go index e53dc6738a4..da734163729 100644 --- a/pkg/services/mto_service_item/mto_service_item_validators_test.go +++ b/pkg/services/mto_service_item/mto_service_item_validators_test.go @@ -1141,6 +1141,9 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { reServiceCode: models.ReServiceCodeIDDSIT, }, } + now := time.Now() + nowDate := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.UTC) + later := nowDate.AddDate(0, 0, 3) for _, tc := range testCases { oldSITServiceItem := factory.BuildMTOServiceItem(nil, []factory.Customization{ { @@ -1154,7 +1157,7 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { }, { Model: models.MTOServiceItem{ - SITEntryDate: &later, + SITEntryDate: &nowDate, }, }, }, nil) @@ -1175,11 +1178,11 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.NoError(err) if tc.reServiceCode == models.ReServiceCodeIOPSIT { suite.True(mtoShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour).Equal(postUpdateShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour))) - suite.True(newSITServiceItem.SITEntryDate.Truncate(24 * time.Hour).After(postUpdateShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour))) + suite.True(newSITServiceItem.SITDepartureDate.Truncate(24 * time.Hour).After(postUpdateShipment.OriginSITAuthEndDate.Truncate(24 * time.Hour))) } if tc.reServiceCode == models.ReServiceCodeIDDSIT { suite.True(mtoShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour).Equal(postUpdateShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour))) - suite.True(newSITServiceItem.SITEntryDate.Truncate(24 * time.Hour).After(postUpdateShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour))) + suite.True(newSITServiceItem.SITDepartureDate.Truncate(24 * time.Hour).After(postUpdateShipment.DestinationSITAuthEndDate.Truncate(24 * time.Hour))) } } }) @@ -1428,7 +1431,7 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemData() { suite.NoError(err) // Just verrs suite.True(serviceItemData.verrs.HasAny()) suite.Contains(serviceItemData.verrs.Keys(), "SITDepartureDate") - suite.Contains(serviceItemData.verrs.Get("SITDepartureDate"), "SIT departure date cannot be set before the SIT entry date.") + suite.Contains(serviceItemData.verrs.Get("SITDepartureDate"), "SIT departure date cannot be set before or equal to the SIT entry date.") } }) From e4d5aa92a593f6ab6ad6e24bbbd4d5ad6fbc311f Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 5 Mar 2025 17:50:56 +0000 Subject: [PATCH 09/13] don't need to skip this anymore --- scripts/run-server-test | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/run-server-test b/scripts/run-server-test index 497039f6186..785d163f79b 100755 --- a/scripts/run-server-test +++ b/scripts/run-server-test @@ -48,11 +48,6 @@ else gotest_args+=("-failfast") fi -## Add SKIP_FAIL_TESTS on dev machine within .envrc.local file -if [ -n "${SKIP_FAIL_TESTS+x}" ]; then - gotest_args+=("-skip" "TestGHCRateEngineImportSuite") -fi - ## mac users uncomment the following line to run tests with the classic linker, which clears a lot of warnings that fill the console, do not commit to repo uncommented #gotest_args+=("-ldflags=-extldflags=-Wl,-ld_classic") From b98d762dadedf8555fb61051f810677b08fb5e7f Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 5 Mar 2025 20:33:36 +0000 Subject: [PATCH 10/13] script updates --- .gitlab-ci.yml | 2 +- scripts/run-server-test | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6b5f6f54fd1..d146eb6b765 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -834,7 +834,7 @@ server_test: - make bin/swagger - echo "server test -- build gotestsum and run scripts for report" - make -j 2 bin/milmove bin/gotestsum - - make server_test for app + - make server_test allow_failure: true #leaving true until 5 tests failing tests are working artifacts: paths: diff --git a/scripts/run-server-test b/scripts/run-server-test index 785d163f79b..2b5a13cfe95 100755 --- a/scripts/run-server-test +++ b/scripts/run-server-test @@ -22,14 +22,7 @@ set -eu -o pipefail RED='\033[0;31m' NC='\033[0m' # No Color -if [ "${APPLICATION}" == "app" ]; then - readarray -t package_list < <(go list ./... | grep -E -v '(ordersapi|/pkg/gen/|/cmd|mocks|/pkg/testdatagen)') -elif [ "${APPLICATION}" == "orders" ]; then - readarray -t package_list < <(go list ./pkg/handlers/ordersapi) -else - echo "Must provider the environment variable APPLICATION and set to 'app' or 'orders'" - exit 1 -fi +readarray -t package_list < <(go list ./... | grep -E -v '(ordersapi|/pkg/gen/|/cmd|mocks|/pkg/testdatagen)') gotest_args=("-count" "1") if [ -z "${NO_RACE+x}" ]; then From 568f59360d8651f6c31567fab3f1d59408396e1e Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 5 Mar 2025 22:22:28 +0000 Subject: [PATCH 11/13] set server_test to be required --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d146eb6b765..e54d8ac9c75 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -835,7 +835,7 @@ server_test: - echo "server test -- build gotestsum and run scripts for report" - make -j 2 bin/milmove bin/gotestsum - make server_test - allow_failure: true #leaving true until 5 tests failing tests are working + allow_failure: false artifacts: paths: - /builds/milmove/mymove/bin/gotestsum From e193872f352f35840857fade80d0bd37ee7f559e Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 5 Mar 2025 22:38:19 +0000 Subject: [PATCH 12/13] updates based on golang linter findings --- pkg/handlers/internalapi/service_members.go | 2 +- pkg/services/ppmshipment/payment_packet_creator_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/handlers/internalapi/service_members.go b/pkg/handlers/internalapi/service_members.go index cd257025cef..100e1801974 100644 --- a/pkg/handlers/internalapi/service_members.go +++ b/pkg/handlers/internalapi/service_members.go @@ -148,7 +148,7 @@ type PatchServiceMemberHandler struct { // Check to see if a move is in draft state. If there are no orders, then the // move still counts as in draft state. func (h PatchServiceMemberHandler) isDraftMove(serviceMember *models.ServiceMember) bool { - if serviceMember.Orders == nil || len(serviceMember.Orders) <= 0 { + if len(serviceMember.Orders) == 0 { return true } diff --git a/pkg/services/ppmshipment/payment_packet_creator_test.go b/pkg/services/ppmshipment/payment_packet_creator_test.go index 5eb7e03aafc..420377ff04b 100644 --- a/pkg/services/ppmshipment/payment_packet_creator_test.go +++ b/pkg/services/ppmshipment/payment_packet_creator_test.go @@ -586,10 +586,10 @@ func (suite *PPMShipmentSuite) TestCreatePaymentPacket() { setUpMockPPMShipmentFetcherForPayment(appCtx, ppmShipment.ID, &ppmShipment, nil) // enable bookmark, disable watermark + // nolint:staticcheck pdf, dirPath, err := paymentPacketCreator.Generate(appCtx, ppmShipment.ID, true, false) suite.FatalNil(err) - - //nolint:staticcheck + // nolint:staticcheck bookmarks := extractBookmarks(suite, *generator, pdf) suite.T().Skip(`Skipping test - after HDT 2617 patched negative seeking this now errors due to the context not having outlines which is likely from the From 619691bad6ff780f4adecff461a24524b207c657 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Wed, 5 Mar 2025 23:54:56 +0000 Subject: [PATCH 13/13] Merge remote-tracking branch 'origin/MAIN-B-22267' into remove-ghcimport-test-suite-with-22267 --- pkg/handlers/adminapi/moves_test.go | 1 - pkg/handlers/ghcapi/move_task_order_test.go | 4 - pkg/handlers/ghcapi/mto_service_items_test.go | 4 - pkg/handlers/ghcapi/mto_shipment_test.go | 25 --- pkg/handlers/ghcapi/orders_test.go | 1 - pkg/handlers/ghcapi/ppm_shipment_test.go | 2 +- pkg/handlers/internalapi/mto_shipment_test.go | 1 - pkg/handlers/ordersapi/post_revision_test.go | 148 ------------------ .../ordersapi/post_revision_to_orders_test.go | 95 ----------- pkg/handlers/primeapi/move_task_order_test.go | 2 - .../primeapi/mto_service_item_test.go | 23 --- .../primeapi/mto_shipment_address_test.go | 1 - pkg/handlers/primeapi/mto_shipment_test.go | 3 - pkg/handlers/primeapi/payment_request_test.go | 3 - pkg/handlers/primeapi/reweigh_test.go | 2 - .../primeapiv2/move_task_order_test.go | 26 ++- .../primeapiv2/mto_service_item_test.go | 19 --- pkg/handlers/primeapiv2/mto_shipment_test.go | 1 - .../primeapiv3/move_task_order_test.go | 26 ++- .../primeapiv3/mto_service_item_test.go | 20 --- pkg/handlers/primeapiv3/mto_shipment_test.go | 1 - .../supportapi/move_task_order_test.go | 2 - .../supportapi/mto_service_item_test.go | 3 - pkg/handlers/supportapi/mto_shipment_test.go | 1 - .../distance_zip_lookup.go | 6 +- .../distance_zip_lookup_test.go | 10 +- .../distance_zip_sit_dest_lookup.go | 2 +- .../distance_zip_sit_dest_lookup_test.go | 1 - .../distance_zip_sit_origin_lookup.go | 2 +- .../distance_zip_sit_origin_lookup_test.go | 1 - .../service_param_value_lookups_test.go | 2 - pkg/route/dtod_planner.go | 2 +- pkg/route/dtod_planner_test.go | 4 +- pkg/route/here_planner.go | 2 +- pkg/route/hhg_planner.go | 7 +- pkg/route/hhg_planner_test.go | 27 +++- pkg/route/mocks/Planner.go | 18 +-- pkg/route/planner.go | 2 +- pkg/route/planner_test.go | 2 +- .../move_history/move_history_fetcher_test.go | 3 - .../move_task_order_updater_test.go | 7 - .../mto_service_item_creator.go | 10 +- .../mto_service_item_creator_test.go | 17 -- .../mto_service_item_updater.go | 15 +- .../mto_service_item_updater_test.go | 14 -- .../mto_shipment_address_updater.go | 4 +- .../mto_shipment_address_updater_test.go | 2 - .../mto_shipment/mto_shipment_updater.go | 10 +- .../mto_shipment/mto_shipment_updater_test.go | 7 - .../mto_shipment/shipment_approver.go | 4 +- .../mto_shipment/shipment_approver_test.go | 7 - .../mto_shipment/shipment_deleter_test.go | 2 - .../shipment/shipment_updater_test.go | 1 - .../payment_request_creator_test.go | 3 - .../payment_request_recalculator_test.go | 2 - ...yment_request_shipment_recalculate_test.go | 2 - .../ppm_closeout/ppm_closeout_test.go | 4 +- pkg/services/ppmshipment/ppm_estimator.go | 4 +- .../ppmshipment/ppm_estimator_test.go | 88 +++++------ .../ppmshipment/ppm_shipment_updater_test.go | 8 +- pkg/services/reweigh/reweigh_updater_test.go | 1 - .../shipment_address_update_requester.go | 19 +-- .../shipment_address_update_requester_test.go | 37 ----- .../sit_extension/sit_extension_denier.go | 1 - pkg/testdatagen/scenario/shared.go | 28 ++-- pkg/testdatagen/testharness/make_move.go | 4 +- 66 files changed, 186 insertions(+), 620 deletions(-) diff --git a/pkg/handlers/adminapi/moves_test.go b/pkg/handlers/adminapi/moves_test.go index 0534395fa67..222c396d434 100644 --- a/pkg/handlers/adminapi/moves_test.go +++ b/pkg/handlers/adminapi/moves_test.go @@ -118,7 +118,6 @@ func (suite *HandlerSuite) TestUpdateMoveHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) return UpdateMoveHandler{ suite.HandlerConfig(), diff --git a/pkg/handlers/ghcapi/move_task_order_test.go b/pkg/handlers/ghcapi/move_task_order_test.go index 8efd6c23115..736a0bd9bf4 100644 --- a/pkg/handlers/ghcapi/move_task_order_test.go +++ b/pkg/handlers/ghcapi/move_task_order_test.go @@ -191,7 +191,6 @@ func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationSuccess() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -314,7 +313,6 @@ func (suite *HandlerSuite) TestUpdateMoveTaskOrderHandlerIntegrationWithIncomple mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { @@ -403,7 +401,6 @@ func (suite *HandlerSuite) TestUpdateMTOStatusServiceCounselingCompletedHandler( mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := UpdateMTOStatusServiceCounselingCompletedHandlerFunc{ @@ -623,7 +620,6 @@ func (suite *HandlerSuite) TestUpdateMoveTIORemarksHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/handlers/ghcapi/mto_service_items_test.go b/pkg/handlers/ghcapi/mto_service_items_test.go index 175e643defa..a01b3f7b8fc 100644 --- a/pkg/handlers/ghcapi/mto_service_items_test.go +++ b/pkg/handlers/ghcapi/mto_service_items_test.go @@ -407,7 +407,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -660,7 +659,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) mtoServiceItemStatusUpdater := mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -722,7 +720,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) mtoServiceItemStatusUpdater := mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -859,7 +856,6 @@ func (suite *HandlerSuite) TestUpdateServiceItemSitEntryDateHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) diff --git a/pkg/handlers/ghcapi/mto_shipment_test.go b/pkg/handlers/ghcapi/mto_shipment_test.go index aa4d72afc51..353f4c655e0 100644 --- a/pkg/handlers/ghcapi/mto_shipment_test.go +++ b/pkg/handlers/ghcapi/mto_shipment_test.go @@ -615,14 +615,12 @@ func (suite *HandlerSuite) TestApproveShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) ppmEstimator := mocks.PPMEstimator{} planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -660,7 +658,6 @@ func (suite *HandlerSuite) TestApproveShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) approver := mtoshipment.NewShipmentApprover( mtoshipment.NewShipmentRouter(), @@ -978,7 +975,6 @@ func (suite *HandlerSuite) TestApproveShipmentsHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) ppmEstimator := mocks.PPMEstimator{} @@ -986,7 +982,6 @@ func (suite *HandlerSuite) TestApproveShipmentsHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -2647,7 +2642,6 @@ func (suite *HandlerSuite) TestRequestShipmentReweighHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -2706,7 +2700,6 @@ func (suite *HandlerSuite) TestRequestShipmentReweighHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -2762,7 +2755,6 @@ func (suite *HandlerSuite) TestRequestShipmentReweighHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -2819,7 +2811,6 @@ func (suite *HandlerSuite) TestRequestShipmentReweighHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -2877,7 +2868,6 @@ func (suite *HandlerSuite) TestRequestShipmentReweighHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -2934,7 +2924,6 @@ func (suite *HandlerSuite) TestRequestShipmentReweighHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -3275,7 +3264,6 @@ func (suite *HandlerSuite) TestApproveSITExtensionHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -3418,7 +3406,6 @@ func (suite *HandlerSuite) CreateApprovedSITDurationUpdate() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -3502,7 +3489,6 @@ func (suite *HandlerSuite) CreateApprovedSITDurationUpdate() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -3676,7 +3662,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -3761,7 +3746,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -3818,7 +3802,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -3871,7 +3854,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -3919,7 +3901,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -4004,7 +3985,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandlerUsingPPM() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( @@ -4216,7 +4196,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandlerUsingPPM() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -4367,7 +4346,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandlerUsingPPM() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveTaskOrderUpdater := movetaskorder.NewMoveTaskOrderUpdater( builder, @@ -4574,7 +4552,6 @@ func (suite *HandlerSuite) TestUpdateShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) moveWeights := moveservices.NewMoveWeights(mtoshipment.NewShipmentReweighRequester(), waf) @@ -5243,7 +5220,6 @@ func (suite *HandlerSuite) TestUpdateSITServiceItemCustomerExpenseHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) updater := mtoserviceitem.NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) req := httptest.NewRequest("PATCH", fmt.Sprintf("/shipments/%s/sit-service-item/convert-to-customer-expense", approvedShipment.ID.String()), nil) @@ -5320,7 +5296,6 @@ func (suite *HandlerSuite) TestUpdateSITServiceItemCustomerExpenseHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) updater := mtoserviceitem.NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) req := httptest.NewRequest("PATCH", fmt.Sprintf("/shipments/%s/sit-service-item/convert-to-customer-expense", approvedShipment.ID.String()), nil) diff --git a/pkg/handlers/ghcapi/orders_test.go b/pkg/handlers/ghcapi/orders_test.go index 55181598151..9b653329fb3 100644 --- a/pkg/handlers/ghcapi/orders_test.go +++ b/pkg/handlers/ghcapi/orders_test.go @@ -456,7 +456,6 @@ func (suite *HandlerSuite) TestUpdateOrderHandlerWithAmendedUploads() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/handlers/ghcapi/ppm_shipment_test.go b/pkg/handlers/ghcapi/ppm_shipment_test.go index c4a2bbc0834..a635a4f1a3b 100644 --- a/pkg/handlers/ghcapi/ppm_shipment_test.go +++ b/pkg/handlers/ghcapi/ppm_shipment_test.go @@ -386,7 +386,7 @@ func (suite *HandlerSuite) TestGetPPMSITEstimatedCostHandler() { ppmShipment.DestinationAddress = destinationAddress mockedPlanner := &routemocks.Planner{} - mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "30813", false).Return(2294, nil) + mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "30813").Return(2294, nil) } setupData() diff --git a/pkg/handlers/internalapi/mto_shipment_test.go b/pkg/handlers/internalapi/mto_shipment_test.go index be712ea4d5c..e4d6f0cd3a1 100644 --- a/pkg/handlers/internalapi/mto_shipment_test.go +++ b/pkg/handlers/internalapi/mto_shipment_test.go @@ -79,7 +79,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandlerV1() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/handlers/ordersapi/post_revision_test.go b/pkg/handlers/ordersapi/post_revision_test.go index a3cdc206db5..6b9fc9032d6 100644 --- a/pkg/handlers/ordersapi/post_revision_test.go +++ b/pkg/handlers/ordersapi/post_revision_test.go @@ -4,9 +4,6 @@ import ( "net/http" "net/http/httptest" "testing" - "time" - - "github.com/gofrs/uuid" "github.com/transcom/mymove/pkg/gen/ordersapi/ordersoperations" "github.com/transcom/mymove/pkg/gen/ordersmessages" @@ -14,151 +11,6 @@ import ( "github.com/transcom/mymove/pkg/models" ) -func (suite *HandlerSuite) TestPostRevision() { - req := httptest.NewRequest("POST", "/orders/v1/orders", nil) - clientCert := models.ClientCert{ - AllowOrdersAPI: true, - AllowAirForceOrdersWrite: true, - } - req = suite.AuthenticateClientCertRequest(req, &clientCert) - - seqNum := int64(0) - hasDependents := true - rev := ordersmessages.Revision{ - SeqNum: &seqNum, - Member: &ordersmessages.Member{ - GivenName: "First", - FamilyName: "Last", - Affiliation: ordersmessages.NewAffiliation(ordersmessages.AffiliationAIRFORCE), - Rank: ordersmessages.NewRank(ordersmessages.RankWDash1), - }, - Status: ordersmessages.NewStatus(ordersmessages.StatusAuthorized), - DateIssued: handlers.FmtDateTime(time.Now()), - NoCostMove: false, - TdyEnRoute: false, - TourType: ordersmessages.TourTypeAccompanied, - OrdersType: ordersmessages.NewOrdersType(ordersmessages.OrdersTypeSeparation), - HasDependents: &hasDependents, - LosingUnit: &ordersmessages.Unit{ - Uic: handlers.FmtString("FFFS00"), - Name: handlers.FmtString("SPC721 COMMUNICATIONS SQ"), - City: handlers.FmtString("CHEYENNE MTN"), - Locality: handlers.FmtString("CO"), - PostalCode: handlers.FmtString("80914"), - }, - PcsAccounting: &ordersmessages.Accounting{ - Tac: handlers.FmtString("F67C"), - }, - } - - params := ordersoperations.PostRevisionParams{ - HTTPRequest: req, - Issuer: string(ordersmessages.IssuerAirDashForce), - MemberID: "1234567890", - OrdersNum: "8675309", - Revision: &rev, - } - - handler := PostRevisionHandler{suite.HandlerConfig()} - suite.T().Run("NewSuccess", func(_ *testing.T) { - response := handler.Handle(params) - - suite.IsType(&ordersoperations.PostRevisionCreated{}, response) - createdResponse, ok := response.(*ordersoperations.PostRevisionCreated) - if !ok { - return - } - id, err := uuid.FromString(createdResponse.Payload.UUID.String()) - suite.NoError(err) - - // check that the order and its revision are actually in the DB - order, err := models.FetchElectronicOrderByID(suite.DB(), id) - suite.NoError(err) - suite.NotNil(order) - suite.Equal(params.Issuer, string(order.Issuer)) - suite.Equal(params.MemberID, order.Edipi) - suite.Equal(params.OrdersNum, order.OrdersNumber) - suite.Len(order.Revisions, 1) - storedRev := order.Revisions[0] - suite.EqualValues(*rev.SeqNum, storedRev.SeqNum) - suite.Equal(rev.Member.GivenName, storedRev.GivenName) - suite.Equal(rev.Member.FamilyName, storedRev.FamilyName) - suite.Equal(string(*rev.Member.Rank), string(storedRev.Paygrade)) - suite.Equal(rev.PcsAccounting.Tac, storedRev.HhgTAC) - suite.Equal(string(*rev.Status), string(storedRev.Status)) - suite.Equal(string(rev.TourType), string(storedRev.TourType)) - suite.Equal(string(*rev.OrdersType), string(storedRev.OrdersType)) - suite.Equal(*rev.HasDependents, storedRev.HasDependents) - suite.Equal(rev.NoCostMove, storedRev.NoCostMove) - suite.Equal(rev.LosingUnit.Uic, storedRev.LosingUIC) - suite.Equal(rev.LosingUnit.Name, storedRev.LosingUnitName) - suite.Equal(rev.LosingUnit.City, storedRev.LosingUnitCity) - suite.Equal(rev.LosingUnit.Locality, storedRev.LosingUnitLocality) - suite.Equal(rev.LosingUnit.PostalCode, storedRev.LosingUnitPostalCode) - }) - - suite.T().Run("AmendmentSuccess", func(_ *testing.T) { - seqNum = int64(1) - response := handler.Handle(params) - - suite.IsType(&ordersoperations.PostRevisionCreated{}, response) - createdResponse, ok := response.(*ordersoperations.PostRevisionCreated) - if !ok { - return - } - id, err := uuid.FromString(createdResponse.Payload.UUID.String()) - suite.NoError(err) - - // check that the order and its new revision are actually in the DB - order, err := models.FetchElectronicOrderByID(suite.DB(), id) - suite.NoError(err) - suite.NotNil(order) - suite.Equal(params.Issuer, string(order.Issuer)) - suite.Equal(params.MemberID, order.Edipi) - suite.Equal(params.OrdersNum, order.OrdersNumber) - suite.Len(order.Revisions, 2) - storedRev := order.Revisions[1] - suite.EqualValues(*rev.SeqNum, storedRev.SeqNum) - suite.Equal(rev.Member.GivenName, storedRev.GivenName) - suite.Equal(rev.Member.FamilyName, storedRev.FamilyName) - suite.Equal(string(*rev.Member.Rank), string(storedRev.Paygrade)) - suite.Equal(rev.PcsAccounting.Tac, storedRev.HhgTAC) - suite.Equal(string(*rev.Status), string(storedRev.Status)) - suite.Equal(string(rev.TourType), string(storedRev.TourType)) - suite.Equal(string(*rev.OrdersType), string(storedRev.OrdersType)) - suite.Equal(*rev.HasDependents, storedRev.HasDependents) - suite.Equal(rev.NoCostMove, storedRev.NoCostMove) - suite.Equal(rev.LosingUnit.Uic, storedRev.LosingUIC) - suite.Equal(rev.LosingUnit.Name, storedRev.LosingUnitName) - suite.Equal(rev.LosingUnit.City, storedRev.LosingUnitCity) - suite.Equal(rev.LosingUnit.Locality, storedRev.LosingUnitLocality) - suite.Equal(rev.LosingUnit.PostalCode, storedRev.LosingUnitPostalCode) - }) - - suite.T().Run("SeqNumConflict", func(_ *testing.T) { - // Sending the amendment again should result in a conflict because the SeqNum will be taken - response := handler.Handle(params) - suite.IsType(&handlers.ErrResponse{}, response) - errResponse, ok := response.(*handlers.ErrResponse) - if !ok { - return - } - suite.Equal(http.StatusConflict, errResponse.Code) - }) - - suite.T().Run("EdipiConflict", func(_ *testing.T) { - params.MemberID = "9999999999" - seqNum = int64(99999) - response := handler.Handle(params) - suite.IsType(&handlers.ErrResponse{}, response) - errResponse, ok := response.(*handlers.ErrResponse) - if !ok { - return - } - suite.Equal(http.StatusConflict, errResponse.Code) - }) -} - func (suite *HandlerSuite) TestPostRevisionNoApiPerm() { req := httptest.NewRequest("POST", "/orders/v1/orders", nil) clientCert := models.ClientCert{} diff --git a/pkg/handlers/ordersapi/post_revision_to_orders_test.go b/pkg/handlers/ordersapi/post_revision_to_orders_test.go index fbc5adf666c..c6f2a84cafe 100644 --- a/pkg/handlers/ordersapi/post_revision_to_orders_test.go +++ b/pkg/handlers/ordersapi/post_revision_to_orders_test.go @@ -5,111 +5,16 @@ import ( "net/http" "net/http/httptest" "testing" - "time" "github.com/go-openapi/strfmt" "github.com/gofrs/uuid" "github.com/transcom/mymove/pkg/gen/ordersapi/ordersoperations" - "github.com/transcom/mymove/pkg/gen/ordersmessages" "github.com/transcom/mymove/pkg/handlers" "github.com/transcom/mymove/pkg/models" "github.com/transcom/mymove/pkg/testdatagen" ) -func (suite *HandlerSuite) TestPostRevisionToOrders() { - // prime the DB with an order with 1 revision - origOrder := testdatagen.MakeDefaultElectronicOrder(suite.DB()) - - req := httptest.NewRequest("POST", fmt.Sprintf("/orders/v1/orders/%s", origOrder.ID), nil) - clientCert := models.ClientCert{ - AllowOrdersAPI: true, - AllowAirForceOrdersWrite: true, - } - req = suite.AuthenticateClientCertRequest(req, &clientCert) - - seqNum := int64(1) - hasDependents := true - rev := ordersmessages.Revision{ - SeqNum: &seqNum, - Member: &ordersmessages.Member{ - GivenName: "First", - FamilyName: "Last", - Affiliation: ordersmessages.NewAffiliation(ordersmessages.AffiliationAIRFORCE), - Rank: ordersmessages.NewRank(ordersmessages.RankWDash1), - }, - Status: ordersmessages.NewStatus(ordersmessages.StatusAuthorized), - DateIssued: handlers.FmtDateTime(time.Now()), - NoCostMove: false, - TdyEnRoute: false, - TourType: ordersmessages.TourTypeAccompanied, - OrdersType: ordersmessages.NewOrdersType(ordersmessages.OrdersTypeSeparation), - HasDependents: &hasDependents, - LosingUnit: &ordersmessages.Unit{ - Uic: handlers.FmtString("FFFS00"), - Name: handlers.FmtString("SPC721 COMMUNICATIONS SQ"), - City: handlers.FmtString("CHEYENNE MTN"), - Locality: handlers.FmtString("CO"), - PostalCode: handlers.FmtString("80914"), - }, - PcsAccounting: &ordersmessages.Accounting{ - Tac: handlers.FmtString("F67C"), - }, - } - - params := ordersoperations.PostRevisionToOrdersParams{ - HTTPRequest: req, - UUID: strfmt.UUID(origOrder.ID.String()), - Revision: &rev, - } - - handler := PostRevisionToOrdersHandler{suite.HandlerConfig()} - suite.T().Run("Success", func(_ *testing.T) { - response := handler.Handle(params) - - suite.IsType(&ordersoperations.PostRevisionToOrdersCreated{}, response) - createdResponse, ok := response.(*ordersoperations.PostRevisionToOrdersCreated) - if !ok { - return - } - id, err := uuid.FromString(createdResponse.Payload.UUID.String()) - suite.NoError(err) - - // check that the order and its new revision are actually in the DB - order, err := models.FetchElectronicOrderByID(suite.DB(), id) - suite.NoError(err) - suite.NotNil(order) - suite.Len(order.Revisions, 2) - storedRev := order.Revisions[1] - suite.EqualValues(*rev.SeqNum, storedRev.SeqNum) - suite.Equal(rev.Member.GivenName, storedRev.GivenName) - suite.Equal(rev.Member.FamilyName, storedRev.FamilyName) - suite.Equal(string(*rev.Member.Rank), string(storedRev.Paygrade)) - suite.Equal(rev.PcsAccounting.Tac, storedRev.HhgTAC) - suite.Equal(string(*rev.Status), string(storedRev.Status)) - suite.Equal(string(rev.TourType), string(storedRev.TourType)) - suite.Equal(string(*rev.OrdersType), string(storedRev.OrdersType)) - suite.Equal(*rev.HasDependents, storedRev.HasDependents) - suite.Equal(rev.NoCostMove, storedRev.NoCostMove) - suite.Equal(rev.LosingUnit.Uic, storedRev.LosingUIC) - suite.Equal(rev.LosingUnit.Name, storedRev.LosingUnitName) - suite.Equal(rev.LosingUnit.City, storedRev.LosingUnitCity) - suite.Equal(rev.LosingUnit.Locality, storedRev.LosingUnitLocality) - suite.Equal(rev.LosingUnit.PostalCode, storedRev.LosingUnitPostalCode) - }) - - suite.T().Run("SeqNumConflict", func(_ *testing.T) { - // Sending the amendment again should result in a conflict because the SeqNum will be taken - response := handler.Handle(params) - suite.IsType(&handlers.ErrResponse{}, response) - errResponse, ok := response.(*handlers.ErrResponse) - if !ok { - return - } - suite.Equal(http.StatusConflict, errResponse.Code) - }) -} - func (suite *HandlerSuite) TestPostRevisionToOrdersNoApiPerm() { id, _ := uuid.NewV4() req := httptest.NewRequest("POST", fmt.Sprintf("/orders/v1/orders/%s", id.String()), nil) diff --git a/pkg/handlers/primeapi/move_task_order_test.go b/pkg/handlers/primeapi/move_task_order_test.go index 58a58a2cb07..a25a898c963 100644 --- a/pkg/handlers/primeapi/move_task_order_test.go +++ b/pkg/handlers/primeapi/move_task_order_test.go @@ -1737,7 +1737,6 @@ func (suite *HandlerSuite) TestUpdateMTOPostCounselingInfo() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { @@ -1822,7 +1821,6 @@ func (suite *HandlerSuite) TestUpdateMTOPostCounselingInfo() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/handlers/primeapi/mto_service_item_test.go b/pkg/handlers/primeapi/mto_service_item_test.go index b70edace8b1..365e1e9d785 100644 --- a/pkg/handlers/primeapi/mto_service_item_test.go +++ b/pkg/handlers/primeapi/mto_service_item_test.go @@ -145,7 +145,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -181,8 +180,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -232,7 +229,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -287,7 +283,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -426,7 +421,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -471,7 +465,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -574,7 +567,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -607,7 +599,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -687,7 +678,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDomesticCratingHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -725,7 +715,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDomesticCratingHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -849,7 +838,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -896,7 +884,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -966,7 +953,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1051,7 +1037,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandlerWithDOFSITNoA mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1162,7 +1147,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandlerWithDOFSITWit mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1336,7 +1320,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1411,7 +1394,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1445,7 +1427,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1502,7 +1483,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1557,7 +1537,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1756,7 +1735,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemDDDSIT() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) subtestData.handler = UpdateMTOServiceItemHandler{ suite.HandlerConfig(), @@ -2040,7 +2018,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemDOPSIT() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) subtestData.handler = UpdateMTOServiceItemHandler{ suite.HandlerConfig(), diff --git a/pkg/handlers/primeapi/mto_shipment_address_test.go b/pkg/handlers/primeapi/mto_shipment_address_test.go index cca597695c7..c85dbaac0c1 100644 --- a/pkg/handlers/primeapi/mto_shipment_address_test.go +++ b/pkg/handlers/primeapi/mto_shipment_address_test.go @@ -50,7 +50,6 @@ func (suite *HandlerSuite) TestUpdateMTOShipmentAddressHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) // Create handler diff --git a/pkg/handlers/primeapi/mto_shipment_test.go b/pkg/handlers/primeapi/mto_shipment_test.go index f33b6c755ca..7cf0064d991 100644 --- a/pkg/handlers/primeapi/mto_shipment_test.go +++ b/pkg/handlers/primeapi/mto_shipment_test.go @@ -329,7 +329,6 @@ func (suite *HandlerSuite) TestUpdateMTOShipmentStatusHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) addressUpdater := address.NewAddressUpdater() @@ -350,7 +349,6 @@ func (suite *HandlerSuite) TestUpdateMTOShipmentStatusHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) handler := UpdateMTOShipmentStatusHandler{ handlerConfig, @@ -542,7 +540,6 @@ func (suite *HandlerSuite) TestDeleteMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/handlers/primeapi/payment_request_test.go b/pkg/handlers/primeapi/payment_request_test.go index 1ca4f2965e7..d6001e7ccea 100644 --- a/pkg/handlers/primeapi/payment_request_test.go +++ b/pkg/handlers/primeapi/payment_request_test.go @@ -746,7 +746,6 @@ func (suite *HandlerSuite) TestCreatePaymentRequestHandlerNewPaymentRequestCreat mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(defaultZipDistance, nil) paymentRequestCreator := paymentrequest.NewPaymentRequestCreator( @@ -906,7 +905,6 @@ func (suite *HandlerSuite) TestCreatePaymentRequestHandlerInvalidMTOReferenceID( mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(defaultZipDistance, nil) paymentRequestCreator := paymentrequest.NewPaymentRequestCreator( @@ -965,7 +963,6 @@ func (suite *HandlerSuite) TestCreatePaymentRequestHandlerInvalidMTOReferenceID( mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(defaultZipDistance, nil) paymentRequestCreator := paymentrequest.NewPaymentRequestCreator( diff --git a/pkg/handlers/primeapi/reweigh_test.go b/pkg/handlers/primeapi/reweigh_test.go index d97b7f78d22..baa363a5d8a 100644 --- a/pkg/handlers/primeapi/reweigh_test.go +++ b/pkg/handlers/primeapi/reweigh_test.go @@ -36,8 +36,6 @@ func (suite *HandlerSuite) TestUpdateReweighHandler() { mockPlanner.On("ZipTransitDistance", recalculateTestPickupZip, recalculateTestDestinationZip, - false, - false, ).Return(recalculateTestZip3Distance, nil) // Get shipment payment request recalculator service diff --git a/pkg/handlers/primeapiv2/move_task_order_test.go b/pkg/handlers/primeapiv2/move_task_order_test.go index f173af34bda..6d954c1bf80 100644 --- a/pkg/handlers/primeapiv2/move_task_order_test.go +++ b/pkg/handlers/primeapiv2/move_task_order_test.go @@ -824,14 +824,24 @@ func (suite *HandlerSuite) TestGetMoveTaskOrder() { suite.NoError(movePayload.Validate(strfmt.Default)) suite.Len(movePayload.PaymentRequests, 2) - paymentRequestPayload := movePayload.PaymentRequests[0] - suite.Equal(paymentRequest.ID.String(), paymentRequestPayload.ID.String()) - suite.Equal(successMove.ID.String(), paymentRequestPayload.MoveTaskOrderID.String()) - suite.Equal(paymentRequest.IsFinal, *paymentRequestPayload.IsFinal) - suite.Equal(*paymentRequest.RejectionReason, *paymentRequestPayload.RejectionReason) - suite.Equal(paymentRequest.Status.String(), string(paymentRequestPayload.Status)) - suite.Equal(paymentRequest.PaymentRequestNumber, paymentRequestPayload.PaymentRequestNumber) - suite.Equal(paymentRequest.RecalculationOfPaymentRequestID.String(), paymentRequestPayload.RecalculationOfPaymentRequestID.String()) + var matchingPR *primev2messages.PaymentRequest + for i := range movePayload.PaymentRequests { + pr := movePayload.PaymentRequests[i] + if pr.ID.String() == paymentRequest.ID.String() { + matchingPR = pr + break + } + } + paymentRequestPayload := matchingPR + + suite.NotNil(matchingPR, "expected to find a payment request payload matching paymentRequest.ID") + suite.Equal(paymentRequest.ID.String(), matchingPR.ID.String()) + suite.Equal(successMove.ID.String(), matchingPR.MoveTaskOrderID.String()) + suite.Equal(paymentRequest.IsFinal, *matchingPR.IsFinal) + suite.Equal(*paymentRequest.RejectionReason, *matchingPR.RejectionReason) + suite.Equal(paymentRequest.Status.String(), string(matchingPR.Status)) + suite.Equal(paymentRequest.PaymentRequestNumber, matchingPR.PaymentRequestNumber) + suite.Equal(paymentRequest.RecalculationOfPaymentRequestID.String(), matchingPR.RecalculationOfPaymentRequestID.String()) // verify paymentServiceItems suite.Len(paymentRequestPayload.PaymentServiceItems, 2) diff --git a/pkg/handlers/primeapiv2/mto_service_item_test.go b/pkg/handlers/primeapiv2/mto_service_item_test.go index cbc14a64fc3..82581f6d077 100644 --- a/pkg/handlers/primeapiv2/mto_service_item_test.go +++ b/pkg/handlers/primeapiv2/mto_service_item_test.go @@ -110,7 +110,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -169,7 +168,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -224,7 +222,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -363,7 +360,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -408,7 +404,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -511,7 +506,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -544,7 +538,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -624,7 +617,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDomesticCratingHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -662,7 +654,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDomesticCratingHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -786,7 +777,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -833,7 +823,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -903,7 +892,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -988,7 +976,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandlerWithDOFSITNoA mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1097,7 +1084,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandlerWithDOFSITWit mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1265,7 +1251,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1340,7 +1325,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1374,7 +1358,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1431,7 +1414,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1496,7 +1478,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ diff --git a/pkg/handlers/primeapiv2/mto_shipment_test.go b/pkg/handlers/primeapiv2/mto_shipment_test.go index 5419582eca4..89a5fedde4c 100644 --- a/pkg/handlers/primeapiv2/mto_shipment_test.go +++ b/pkg/handlers/primeapiv2/mto_shipment_test.go @@ -53,7 +53,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) vLocationServices := address.NewVLocation() diff --git a/pkg/handlers/primeapiv3/move_task_order_test.go b/pkg/handlers/primeapiv3/move_task_order_test.go index e118c808c4b..8ae01cc96b6 100644 --- a/pkg/handlers/primeapiv3/move_task_order_test.go +++ b/pkg/handlers/primeapiv3/move_task_order_test.go @@ -816,14 +816,24 @@ func (suite *HandlerSuite) TestGetMoveTaskOrder() { suite.NoError(movePayload.Validate(strfmt.Default)) suite.Len(movePayload.PaymentRequests, 2) - paymentRequestPayload := movePayload.PaymentRequests[0] - suite.Equal(paymentRequest.ID.String(), paymentRequestPayload.ID.String()) - suite.Equal(successMove.ID.String(), paymentRequestPayload.MoveTaskOrderID.String()) - suite.Equal(paymentRequest.IsFinal, *paymentRequestPayload.IsFinal) - suite.Equal(*paymentRequest.RejectionReason, *paymentRequestPayload.RejectionReason) - suite.Equal(paymentRequest.Status.String(), string(paymentRequestPayload.Status)) - suite.Equal(paymentRequest.PaymentRequestNumber, paymentRequestPayload.PaymentRequestNumber) - suite.Equal(paymentRequest.RecalculationOfPaymentRequestID.String(), paymentRequestPayload.RecalculationOfPaymentRequestID.String()) + var matchingPR *primev3messages.PaymentRequest + for i := range movePayload.PaymentRequests { + pr := movePayload.PaymentRequests[i] + if pr.ID.String() == paymentRequest.ID.String() { + matchingPR = pr + break + } + } + paymentRequestPayload := matchingPR + + suite.NotNil(matchingPR, "expected to find a payment request payload matching paymentRequest.ID") + suite.Equal(paymentRequest.ID.String(), matchingPR.ID.String()) + suite.Equal(successMove.ID.String(), matchingPR.MoveTaskOrderID.String()) + suite.Equal(paymentRequest.IsFinal, *matchingPR.IsFinal) + suite.Equal(*paymentRequest.RejectionReason, *matchingPR.RejectionReason) + suite.Equal(paymentRequest.Status.String(), string(matchingPR.Status)) + suite.Equal(paymentRequest.PaymentRequestNumber, matchingPR.PaymentRequestNumber) + suite.Equal(paymentRequest.RecalculationOfPaymentRequestID.String(), matchingPR.RecalculationOfPaymentRequestID.String()) // verify paymentServiceItems suite.Len(paymentRequestPayload.PaymentServiceItems, 2) diff --git a/pkg/handlers/primeapiv3/mto_service_item_test.go b/pkg/handlers/primeapiv3/mto_service_item_test.go index c9f2c74d663..a56985cac60 100644 --- a/pkg/handlers/primeapiv3/mto_service_item_test.go +++ b/pkg/handlers/primeapiv3/mto_service_item_test.go @@ -109,7 +109,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) subtestData := makeSubtestData() moveRouter := moverouter.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) @@ -170,7 +169,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -225,7 +223,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -364,7 +361,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -409,7 +405,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -512,7 +507,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -545,7 +539,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -625,7 +618,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDomesticCratingHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -663,7 +655,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDomesticCratingHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -787,7 +778,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -834,7 +824,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -904,7 +893,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -989,7 +977,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandlerWithDOFSITNoA mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1098,7 +1085,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemOriginSITHandlerWithDOFSITWit mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1266,7 +1252,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1341,7 +1326,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1375,7 +1359,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1432,7 +1415,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1497,7 +1479,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ @@ -1534,7 +1515,6 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemDestSITHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) handler := CreateMTOServiceItemHandler{ diff --git a/pkg/handlers/primeapiv3/mto_shipment_test.go b/pkg/handlers/primeapiv3/mto_shipment_test.go index 318b91df0ee..948f7667ead 100644 --- a/pkg/handlers/primeapiv3/mto_shipment_test.go +++ b/pkg/handlers/primeapiv3/mto_shipment_test.go @@ -60,7 +60,6 @@ func (suite *HandlerSuite) TestCreateMTOShipmentHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) vLocationServices := address.NewVLocation() diff --git a/pkg/handlers/supportapi/move_task_order_test.go b/pkg/handlers/supportapi/move_task_order_test.go index 716c11a1404..d58c1d797cf 100644 --- a/pkg/handlers/supportapi/move_task_order_test.go +++ b/pkg/handlers/supportapi/move_task_order_test.go @@ -176,7 +176,6 @@ func (suite *HandlerSuite) TestMakeMoveAvailableHandlerIntegrationSuccess() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { @@ -393,7 +392,6 @@ func (suite *HandlerSuite) TestCreateMoveTaskOrderRequestHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/handlers/supportapi/mto_service_item_test.go b/pkg/handlers/supportapi/mto_service_item_test.go index a03f7373bab..9c99213cefa 100644 --- a/pkg/handlers/supportapi/mto_service_item_test.go +++ b/pkg/handlers/supportapi/mto_service_item_test.go @@ -87,7 +87,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandlerApproveSuccess() mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) handler := UpdateMTOServiceItemStatusHandler{handlerConfig, mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()), @@ -145,7 +144,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandlerRejectSuccess() mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) handler := UpdateMTOServiceItemStatusHandler{handlerConfig, mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()), @@ -203,7 +201,6 @@ func (suite *HandlerSuite) TestUpdateMTOServiceItemStatusHandlerRejectionFailedN mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) handler := UpdateMTOServiceItemStatusHandler{handlerConfig, mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()), diff --git a/pkg/handlers/supportapi/mto_shipment_test.go b/pkg/handlers/supportapi/mto_shipment_test.go index ad61feb2b5d..c111449d875 100644 --- a/pkg/handlers/supportapi/mto_shipment_test.go +++ b/pkg/handlers/supportapi/mto_shipment_test.go @@ -98,7 +98,6 @@ func (suite *HandlerSuite) TestUpdateMTOShipmentStatusHandler() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) planner.On("Zip5TransitDistanceLineHaul", diff --git a/pkg/payment_request/service_param_value_lookups/distance_zip_lookup.go b/pkg/payment_request/service_param_value_lookups/distance_zip_lookup.go index acc87eb2715..c50c105e9c4 100644 --- a/pkg/payment_request/service_param_value_lookups/distance_zip_lookup.go +++ b/pkg/payment_request/service_param_value_lookups/distance_zip_lookup.go @@ -135,17 +135,17 @@ func (r DistanceZipLookup) lookup(appCtx appcontext.AppContext, keyData *Service totalDistanceMiles = distanceMiles } else if hasApprovedDestinationSIT { // from pickup zip to delivery zip - totalDistanceMiles, err = planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode, isInternationalShipment) + totalDistanceMiles, err = planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode) if err != nil { return "", err } // from pickup zip to Destination SIT zip - distanceMiles, err = planner.ZipTransitDistance(appCtx, pickupZip, destinationZip, isInternationalShipment) + distanceMiles, err = planner.ZipTransitDistance(appCtx, pickupZip, destinationZip) if err != nil { return "", err } } else { - distanceMiles, err = planner.ZipTransitDistance(appCtx, pickupZip, destinationZip, isInternationalShipment) + distanceMiles, err = planner.ZipTransitDistance(appCtx, pickupZip, destinationZip) if err != nil { return "", err } diff --git a/pkg/payment_request/service_param_value_lookups/distance_zip_lookup_test.go b/pkg/payment_request/service_param_value_lookups/distance_zip_lookup_test.go index 8b8d866b313..fd9f12ff1c8 100644 --- a/pkg/payment_request/service_param_value_lookups/distance_zip_lookup_test.go +++ b/pkg/payment_request/service_param_value_lookups/distance_zip_lookup_test.go @@ -115,14 +115,14 @@ func (suite *ServiceParamValueLookupsSuite) TestDistanceLookup() { distanceStr, err := paramLookup.ServiceParamValue(suite.AppContextForTest(), key) suite.FatalNoError(err) - expected := strconv.Itoa(defaultInternationalZipDistance) + expected := strconv.Itoa(defaultZipDistance) suite.Equal(expected, distanceStr) var mtoShipment models.MTOShipment err = suite.DB().Find(&mtoShipment, mtoServiceItem.MTOShipmentID) suite.NoError(err) - suite.Equal(unit.Miles(defaultInternationalZipDistance), *mtoShipment.Distance) + suite.Equal(unit.Miles(defaultZipDistance), *mtoShipment.Distance) }) suite.Run("Call ZipTransitDistance on international PPMs with CONUS -> Tacoma Port ZIP", func() { @@ -172,7 +172,7 @@ func (suite *ServiceParamValueLookupsSuite) TestDistanceLookup() { planner := suite.planner.(*mocks.Planner) // should be called with the 98421 ZIP of the Tacoma port and NOT 99505 - planner.AssertCalled(suite.T(), "ZipTransitDistance", appContext, ppmShipment.PickupAddress.PostalCode, "98421", true) + planner.AssertCalled(suite.T(), "ZipTransitDistance", appContext, ppmShipment.PickupAddress.PostalCode, "98421") }) suite.Run("Calculate transit zip distance with an approved Destination SIT service item", func() { @@ -273,7 +273,7 @@ func (suite *ServiceParamValueLookupsSuite) TestDistanceLookup() { suite.NoError(err) planner := suite.planner.(*mocks.Planner) - planner.AssertCalled(suite.T(), "ZipTransitDistance", appContext, ppmShipment.PickupAddress.PostalCode, ppmShipment.DestinationAddress.PostalCode, false) + planner.AssertCalled(suite.T(), "ZipTransitDistance", appContext, ppmShipment.PickupAddress.PostalCode, ppmShipment.DestinationAddress.PostalCode) err = suite.DB().Reload(&ppmShipment.Shipment) suite.NoError(err) @@ -304,7 +304,7 @@ func (suite *ServiceParamValueLookupsSuite) TestDistanceLookup() { suite.NoError(err) planner := suite.planner.(*mocks.Planner) - planner.AssertCalled(suite.T(), "ZipTransitDistance", appContext, ppmShipment.PickupAddress.PostalCode, ppmShipment.DestinationAddress.PostalCode, false) + planner.AssertCalled(suite.T(), "ZipTransitDistance", appContext, ppmShipment.PickupAddress.PostalCode, ppmShipment.DestinationAddress.PostalCode) err = suite.DB().Reload(&ppmShipment.Shipment) suite.NoError(err) diff --git a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup.go b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup.go index bc3e612c811..2136d7556bc 100644 --- a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup.go +++ b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup.go @@ -33,7 +33,7 @@ func (r DistanceZipSITDestLookup) lookup(appCtx appcontext.AppContext, keyData * if destZip == finalDestZip { distanceMiles = 1 } else { - distanceMiles, distanceErr = planner.ZipTransitDistance(appCtx, destZip, finalDestZip, false) + distanceMiles, distanceErr = planner.ZipTransitDistance(appCtx, destZip, finalDestZip) } if distanceErr != nil { diff --git a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup_test.go b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup_test.go index c0e29027758..8231238b831 100644 --- a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup_test.go +++ b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_dest_lookup_test.go @@ -211,7 +211,6 @@ func (suite *ServiceParamValueLookupsSuite) TestDistanceZipSITDestLookup() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(0, errors.New("error with ZipTransitDistance")) paramLookup, err := ServiceParamLookupInitialize(suite.AppContextForTest(), errorPlanner, mtoServiceItemSameZip3, paymentRequest.ID, paymentRequest.MoveTaskOrderID, nil) diff --git a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup.go b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup.go index 945462236dd..e452adbed10 100644 --- a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup.go +++ b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup.go @@ -39,7 +39,7 @@ func (r DistanceZipSITOriginLookup) lookup(appCtx appcontext.AppContext, keyData if originZip == actualOriginZip { distanceMiles = 1 } else { - distanceMiles, distanceErr = planner.ZipTransitDistance(appCtx, originZip, actualOriginZip, false) + distanceMiles, distanceErr = planner.ZipTransitDistance(appCtx, originZip, actualOriginZip) } if distanceErr != nil { return "", distanceErr diff --git a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup_test.go b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup_test.go index eabf098155f..31d766db385 100644 --- a/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup_test.go +++ b/pkg/payment_request/service_param_value_lookups/distance_zip_sit_origin_lookup_test.go @@ -184,7 +184,6 @@ func (suite *ServiceParamValueLookupsSuite) TestDistanceZipSITOriginLookup() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(0, errors.New("error with ZipTransitDistance")) paramLookup, err := ServiceParamLookupInitialize(suite.AppContextForTest(), errorPlanner, mtoServiceItemSameZip3, paymentRequest.ID, paymentRequest.MoveTaskOrderID, nil) diff --git a/pkg/payment_request/service_param_value_lookups/service_param_value_lookups_test.go b/pkg/payment_request/service_param_value_lookups/service_param_value_lookups_test.go index 34d4a025d2b..f71757a23f3 100644 --- a/pkg/payment_request/service_param_value_lookups/service_param_value_lookups_test.go +++ b/pkg/payment_request/service_param_value_lookups/service_param_value_lookups_test.go @@ -47,13 +47,11 @@ func TestServiceParamValueLookupsSuite(t *testing.T) { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(defaultZipDistance, nil) planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - true, ).Return(defaultInternationalZipDistance, nil) ts := &ServiceParamValueLookupsSuite{ diff --git a/pkg/route/dtod_planner.go b/pkg/route/dtod_planner.go index af426b41b69..383de1dd923 100644 --- a/pkg/route/dtod_planner.go +++ b/pkg/route/dtod_planner.go @@ -44,7 +44,7 @@ func (p *dtodPlanner) Zip3TransitDistance(_ appcontext.AppContext, _ string, _ s } // ZipTransitDistance calculates the distance between two valid Zips -func (p *dtodPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string, isInternationalShipment bool) (int, error) { +func (p *dtodPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) { if len(source) < 5 { source = fmt.Sprintf("%05s", source) } diff --git a/pkg/route/dtod_planner_test.go b/pkg/route/dtod_planner_test.go index 02e811e31d4..905981e6a17 100644 --- a/pkg/route/dtod_planner_test.go +++ b/pkg/route/dtod_planner_test.go @@ -100,7 +100,7 @@ func (suite *GHCTestSuite) TestDTODZipTransitDistance() { plannerMileage := NewDTODZip5Distance(fakeUsername, fakePassword, testSoapClient, false) planner := NewDTODPlanner(plannerMileage) - distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30301", false) + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30301") suite.NoError(err) suite.Equal(150, distance) }) @@ -114,7 +114,7 @@ func (suite *GHCTestSuite) TestDTODZipTransitDistance() { plannerMileage := NewDTODZip5Distance(fakeUsername, fakePassword, testSoapClient, false) planner := NewDTODPlanner(plannerMileage) - distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30901", false) + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30901") suite.Error(err) suite.Equal(0, distance) }) diff --git a/pkg/route/here_planner.go b/pkg/route/here_planner.go index aea2b861639..e8d40c85521 100644 --- a/pkg/route/here_planner.go +++ b/pkg/route/here_planner.go @@ -219,7 +219,7 @@ func (p *herePlanner) Zip5TransitDistance(appCtx appcontext.AppContext, source s } // ZipTransitDistance calculates the distance between two valid Zip5s; it is used by the PPM flow -func (p *herePlanner) ZipTransitDistance(_ appcontext.AppContext, _ string, _ string, _ bool) (int, error) { +func (p *herePlanner) ZipTransitDistance(_ appcontext.AppContext, _ string, _ string) (int, error) { // This might get retired after we transition over fully to GHC. panic("implement me") diff --git a/pkg/route/hhg_planner.go b/pkg/route/hhg_planner.go index f69cc2c0591..86f209dc546 100644 --- a/pkg/route/hhg_planner.go +++ b/pkg/route/hhg_planner.go @@ -46,7 +46,7 @@ func (p *hhgPlanner) Zip3TransitDistance(_ appcontext.AppContext, _ string, _ st } // ZipTransitDistance calculates the distance between two valid Zips -func (p *hhgPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string, isInternationalShipment bool) (int, error) { +func (p *hhgPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) { sourceZip5 := source if len(source) < 5 { sourceZip5 = fmt.Sprintf("%05s", source) @@ -58,7 +58,8 @@ func (p *hhgPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source str sourceZip3 := sourceZip5[0:3] destZip3 := destZip5[0:3] - if sourceZip3 == destZip3 || isInternationalShipment { + // if the first 3 numbers of the ZIPs are the same then we need to get the exact distance between the full ZIP5s + if sourceZip3 == destZip3 { if sourceZip5 == destZip5 { return 1, nil } @@ -66,7 +67,6 @@ func (p *hhgPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source str } else { // Get reZip3s for origin and destination to compare base point cities. // Dont throw/return errors from this. If we dont find them, we'll just use randMcNallyZip3Distance - // this only applies to domestic shipments sourceReZip3, sErr := models.FetchReZip3Item(appCtx.DB(), sourceZip3) if sErr != nil { appCtx.Logger().Error("Failed to fetch the reZip3 item for sourceZip3", zap.Error(sErr)) @@ -80,6 +80,7 @@ func (p *hhgPlanner) ZipTransitDistance(appCtx appcontext.AppContext, source str if sourceReZip3 != nil && destinationReZip3 != nil && sourceReZip3.BasePointCity == destinationReZip3.BasePointCity { return p.dtodPlannerMileage.DTODZip5Distance(appCtx, source, destination) } + } return randMcNallyZip3Distance(appCtx, sourceZip3, destZip3) diff --git a/pkg/route/hhg_planner_test.go b/pkg/route/hhg_planner_test.go index a2725ef1c3a..b79eb22389a 100644 --- a/pkg/route/hhg_planner_test.go +++ b/pkg/route/hhg_planner_test.go @@ -78,7 +78,7 @@ func (suite *GHCTestSuite) TestHHGZipTransitDistance() { plannerMileage := NewDTODZip5Distance(fakeUsername, fakePassword, testSoapClient, false) planner := NewHHGPlanner(plannerMileage) - distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30301", false) + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30301") suite.NoError(err) suite.Equal(149, distance) }) @@ -88,7 +88,7 @@ func (suite *GHCTestSuite) TestHHGZipTransitDistance() { plannerMileage := NewDTODZip5Distance(fakeUsername, fakePassword, testSoapClient, false) planner := NewHHGPlanner(plannerMileage) - distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "11201", "11201", false) + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "11201", "11201") suite.NoError(err) suite.Equal(1, distance) }) @@ -105,7 +105,7 @@ func (suite *GHCTestSuite) TestHHGZipTransitDistance() { planner := NewHHGPlanner(plannerMileage) // Get distance between two zips in the same base point city - distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "33169", "33040", false) + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "33169", "33040") suite.NoError(err) // Ensure DTOD was used for distance @@ -121,8 +121,27 @@ func (suite *GHCTestSuite) TestHHGZipTransitDistance() { plannerMileage := NewDTODZip5Distance(fakeUsername, fakePassword, testSoapClient, false) planner := NewHHGPlanner(plannerMileage) - distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30901", false) + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "30907", "30901") suite.Error(err) suite.Equal(0, distance) }) + + suite.Run("ZipTransitDistance returns Rand McNally distance when isInternationalShipment is true", func() { + testSoapClient := &ghcmocks.SoapCaller{} + + plannerMileage := NewDTODZip5Distance(fakeUsername, fakePassword, testSoapClient, false) + planner := NewHHGPlanner(plannerMileage) + fromZip := "74133" + toZip := "99702" + + // get the result from the test db + var zip3Distance models.Zip3Distance + err := suite.DB().Where("from_zip3 = $1 AND to_zip3 = $2", fromZip[0:3], toZip[0:3]).First(&zip3Distance) + suite.NoError(err) + + // confirm we get the same + distance, err := planner.ZipTransitDistance(suite.AppContextForTest(), "74133", "99702") + suite.NoError(err) + suite.Equal(zip3Distance.DistanceMiles, distance) + }) } diff --git a/pkg/route/mocks/Planner.go b/pkg/route/mocks/Planner.go index ac16906e51c..2cf26622df2 100644 --- a/pkg/route/mocks/Planner.go +++ b/pkg/route/mocks/Planner.go @@ -156,9 +156,9 @@ func (_m *Planner) Zip5TransitDistanceLineHaul(appCtx appcontext.AppContext, sou return r0, r1 } -// ZipTransitDistance provides a mock function with given fields: appCtx, source, destination, isInternationalShipment -func (_m *Planner) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string, isInternationalShipment bool) (int, error) { - ret := _m.Called(appCtx, source, destination, isInternationalShipment) +// ZipTransitDistance provides a mock function with given fields: appCtx, source, destination +func (_m *Planner) ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) { + ret := _m.Called(appCtx, source, destination) if len(ret) == 0 { panic("no return value specified for ZipTransitDistance") @@ -166,17 +166,17 @@ func (_m *Planner) ZipTransitDistance(appCtx appcontext.AppContext, source strin var r0 int var r1 error - if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, string, bool) (int, error)); ok { - return rf(appCtx, source, destination, isInternationalShipment) + if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, string) (int, error)); ok { + return rf(appCtx, source, destination) } - if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, string, bool) int); ok { - r0 = rf(appCtx, source, destination, isInternationalShipment) + if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, string) int); ok { + r0 = rf(appCtx, source, destination) } else { r0 = ret.Get(0).(int) } - if rf, ok := ret.Get(1).(func(appcontext.AppContext, string, string, bool) error); ok { - r1 = rf(appCtx, source, destination, isInternationalShipment) + if rf, ok := ret.Get(1).(func(appcontext.AppContext, string, string) error); ok { + r1 = rf(appCtx, source, destination) } else { r1 = ret.Error(1) } diff --git a/pkg/route/planner.go b/pkg/route/planner.go index 860be9caddf..ccc349be6d9 100644 --- a/pkg/route/planner.go +++ b/pkg/route/planner.go @@ -120,7 +120,7 @@ type Planner interface { // Zip5TransitDistanceLineHaul is used by PPM flow and checks for minimum distance restriction as PPM doesn't allow short hauls // New code should probably make the minimum checks after calling Zip5TransitDistance over using this method Zip5TransitDistanceLineHaul(appCtx appcontext.AppContext, source string, destination string) (int, error) - ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string, isInternationalShipment bool) (int, error) + ZipTransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) Zip3TransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) Zip5TransitDistance(appCtx appcontext.AppContext, source string, destination string) (int, error) } diff --git a/pkg/route/planner_test.go b/pkg/route/planner_test.go index cfbd39dd69f..eb574873278 100644 --- a/pkg/route/planner_test.go +++ b/pkg/route/planner_test.go @@ -109,7 +109,7 @@ func (suite *PlannerFullSuite) TestZipDistance() { {zip1: "902101234", zip2: caZip, distanceMin: 30, distanceMax: 49}, } for _, ts := range tests { - distance, err := suite.planner.ZipTransitDistance(suite.AppContextForTest(), ts.zip1, ts.zip2, false) + distance, err := suite.planner.ZipTransitDistance(suite.AppContextForTest(), ts.zip1, ts.zip2) if len(ts.zip1) > 5 { suite.Error(err) suite.Equal(distance, 0) diff --git a/pkg/services/move_history/move_history_fetcher_test.go b/pkg/services/move_history/move_history_fetcher_test.go index b7576dfbc26..f29923745a1 100644 --- a/pkg/services/move_history/move_history_fetcher_test.go +++ b/pkg/services/move_history/move_history_fetcher_test.go @@ -378,7 +378,6 @@ func (suite *MoveHistoryServiceSuite) TestMoveHistoryFetcherScenarios() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) updater := mtoserviceitem.NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) move := factory.BuildApprovalsRequestedMove(suite.DB(), nil, nil) @@ -554,7 +553,6 @@ func (suite *MoveHistoryServiceSuite) TestMoveHistoryFetcherScenarios() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -628,7 +626,6 @@ func (suite *MoveHistoryServiceSuite) TestMoveHistoryFetcherScenarios() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) diff --git a/pkg/services/move_task_order/move_task_order_updater_test.go b/pkg/services/move_task_order/move_task_order_updater_test.go index e07099c94be..27c8f80fafb 100644 --- a/pkg/services/move_task_order/move_task_order_updater_test.go +++ b/pkg/services/move_task_order/move_task_order_updater_test.go @@ -81,7 +81,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_UpdateStatusSer mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) mtoUpdater := mt.NewMoveTaskOrderUpdater( queryBuilder, @@ -395,7 +394,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_UpdatePostCouns mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { @@ -563,7 +561,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_ShowHide() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { @@ -825,7 +822,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_ApproveMoveAndC mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) serviceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) mtoUpdater := mt.NewMoveTaskOrderUpdater(queryBuilder, serviceItemCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator) @@ -860,7 +856,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_ApproveMoveAndC mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) officeUser := setupTestData() move := factory.BuildApprovalsRequestedMove(suite.DB(), []factory.Customization{ @@ -888,7 +883,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_ApproveMoveAndC mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) serviceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) mtoUpdater := mt.NewMoveTaskOrderUpdater(queryBuilder, serviceItemCreator, moveRouter, setUpSignedCertificationCreatorMock(nil, nil), setUpSignedCertificationUpdaterMock(nil, nil), ppmEstimator) @@ -1248,7 +1242,6 @@ func (suite *MoveTaskOrderServiceSuite) TestMoveTaskOrderUpdater_UpdatePPMType() mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/services/mto_service_item/mto_service_item_creator.go b/pkg/services/mto_service_item/mto_service_item_creator.go index aaf8fb65b70..f7c2fd3730b 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator.go +++ b/pkg/services/mto_service_item/mto_service_item_creator.go @@ -131,7 +131,7 @@ func (o *mtoServiceItemCreator) FindEstimatedPrice(appCtx appcontext.AppContext, return 0, err } if mtoShipment.PickupAddress != nil && mtoShipment.DestinationAddress != nil { - distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode, false) + distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode) if err != nil { return 0, err } @@ -147,7 +147,7 @@ func (o *mtoServiceItemCreator) FindEstimatedPrice(appCtx appcontext.AppContext, return 0, err } if mtoShipment.PickupAddress != nil && mtoShipment.DestinationAddress != nil { - distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode, false) + distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode) if err != nil { return 0, err } @@ -170,7 +170,7 @@ func (o *mtoServiceItemCreator) FindEstimatedPrice(appCtx appcontext.AppContext, } if mtoShipment.PickupAddress != nil && mtoShipment.DestinationAddress != nil { - distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode, false) + distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode) if err != nil { return 0, err } @@ -306,14 +306,14 @@ func (o *mtoServiceItemCreator) calculateSITDeliveryMiles(appCtx appcontext.AppC originalSITAddressZip = mtoShipment.PickupAddress.PostalCode } if mtoShipment.PickupAddress != nil && originalSITAddressZip != "" { - distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, originalSITAddressZip, false) + distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, originalSITAddressZip) } } if serviceItem.ReService.Code == models.ReServiceCodeDDFSIT || serviceItem.ReService.Code == models.ReServiceCodeDDASIT || serviceItem.ReService.Code == models.ReServiceCodeDDSFSC || serviceItem.ReService.Code == models.ReServiceCodeDDDSIT { // Creation: Destination SIT: distance between shipment destination address & service item destination address if mtoShipment.DestinationAddress != nil && serviceItem.SITDestinationFinalAddress != nil { - distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.DestinationAddress.PostalCode, serviceItem.SITDestinationFinalAddress.PostalCode, false) + distance, err = o.planner.ZipTransitDistance(appCtx, mtoShipment.DestinationAddress.PostalCode, serviceItem.SITDestinationFinalAddress.PostalCode) } } if err != nil { diff --git a/pkg/services/mto_service_item/mto_service_item_creator_test.go b/pkg/services/mto_service_item/mto_service_item_creator_test.go index 2670cdb29cb..994cfa18d8a 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator_test.go +++ b/pkg/services/mto_service_item/mto_service_item_creator_test.go @@ -233,7 +233,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateMTOServiceItemWithInvalidMove mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) serviceItemForUnapprovedMove := suite.buildValidServiceItemWithInvalidMove() @@ -262,7 +261,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateMTOServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1126,7 +1124,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1176,7 +1173,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1251,7 +1247,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1387,7 +1382,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) _, _, err := creator.CreateMTOServiceItem(suite.AppContextForTest(), &serviceItemDOFSIT) @@ -1433,7 +1427,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) _, _, err := creator.CreateMTOServiceItem(suite.AppContextForTest(), &serviceItemDOFSIT) @@ -1469,7 +1462,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1504,7 +1496,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1538,7 +1529,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1614,7 +1604,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateOriginSITServiceItemFailToCre mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -1649,7 +1638,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateDestSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -2006,7 +1994,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateDestSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) createdServiceItems, _, err := creator.CreateMTOServiceItem(suite.AppContextForTest(), &serviceItemDDASIT) @@ -2116,7 +2103,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateDestSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -2174,7 +2160,6 @@ func (suite *MTOServiceItemServiceSuite) TestCreateDestSITServiceItem() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -2460,7 +2445,6 @@ func (suite *MTOServiceItemServiceSuite) TestPriceEstimator() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -2759,7 +2743,6 @@ func (suite *MTOServiceItemServiceSuite) TestPriceEstimator() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(800, nil) creator := NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) diff --git a/pkg/services/mto_service_item/mto_service_item_updater.go b/pkg/services/mto_service_item/mto_service_item_updater.go index 0a81d7ede20..be0c8900bf3 100644 --- a/pkg/services/mto_service_item/mto_service_item_updater.go +++ b/pkg/services/mto_service_item/mto_service_item_updater.go @@ -194,7 +194,7 @@ func (p *mtoServiceItemUpdater) findEstimatedPrice(appCtx appcontext.AppContext, return 0, err } if mtoShipment.PickupAddress != nil && mtoShipment.DestinationAddress != nil { - distance, err = p.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode, false) + distance, err = p.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode) if err != nil { return 0, err } @@ -222,7 +222,7 @@ func (p *mtoServiceItemUpdater) findEstimatedPrice(appCtx appcontext.AppContext, // fuel surcharge if serviceItem.ReService.Code == models.ReServiceCodeFSC { if mtoShipment.PickupAddress != nil && mtoShipment.DestinationAddress != nil { - distance, err = p.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode, false) + distance, err = p.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, mtoShipment.DestinationAddress.PostalCode) if err != nil { return 0, err } @@ -411,7 +411,7 @@ func (p *mtoServiceItemUpdater) updateServiceItem(appCtx appcontext.AppContext, serviceItem.ReService.Code == models.ReServiceCodeIDDSIT || serviceItem.ReService.Code == models.ReServiceCodeIDSFSC { // Destination SIT: distance between shipment destination address & service item ORIGINAL destination address - milesCalculated, err := p.planner.ZipTransitDistance(appCtx, mtoShipment.DestinationAddress.PostalCode, serviceItem.SITDestinationOriginalAddress.PostalCode, false) + milesCalculated, err := p.planner.ZipTransitDistance(appCtx, mtoShipment.DestinationAddress.PostalCode, serviceItem.SITDestinationOriginalAddress.PostalCode) if err != nil { return nil, err } @@ -425,7 +425,7 @@ func (p *mtoServiceItemUpdater) updateServiceItem(appCtx appcontext.AppContext, serviceItem.ReService.Code == models.ReServiceCodeIOPSIT || serviceItem.ReService.Code == models.ReServiceCodeIOSFSC { // Origin SIT: distance between shipment pickup address & service item ORIGINAL pickup address - milesCalculated, err := p.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, serviceItem.SITOriginHHGOriginalAddress.PostalCode, false) + milesCalculated, err := p.planner.ZipTransitDistance(appCtx, mtoShipment.PickupAddress.PostalCode, serviceItem.SITOriginHHGOriginalAddress.PostalCode) if err != nil { return nil, err } @@ -568,7 +568,7 @@ func (p *mtoServiceItemUpdater) UpdateMTOServiceItemPrime( func calculateOriginSITRequiredDeliveryDate(appCtx appcontext.AppContext, shipment models.MTOShipment, planner route.Planner, sitCustomerContacted *time.Time, sitDepartureDate *time.Time) (*time.Time, error) { // Get a distance calculation between pickup and destination addresses. - distance, err := planner.ZipTransitDistance(appCtx, shipment.PickupAddress.PostalCode, shipment.DestinationAddress.PostalCode, false) + distance, err := planner.ZipTransitDistance(appCtx, shipment.PickupAddress.PostalCode, shipment.DestinationAddress.PostalCode) if err != nil { return nil, apperror.NewUnprocessableEntityError("cannot calculate distance between pickup and destination addresses") @@ -814,8 +814,9 @@ func (p *mtoServiceItemUpdater) UpdateMTOServiceItem( pickupZip = mtoServiceItem.PODLocation.UsPostRegionCity.UsprZipID destZip = shipment.DestinationAddress.PostalCode } - // we need to get the mileage from DTOD first, the db proc will consume that - mileage, err := p.planner.ZipTransitDistance(appCtx, pickupZip, destZip, true) + // we need to get the mileage first, the db proc will consume that + // only international shipments will have POE/PODFSC service items + mileage, err := p.planner.ZipTransitDistance(appCtx, pickupZip, destZip) if err != nil { return err } diff --git a/pkg/services/mto_service_item/mto_service_item_updater_test.go b/pkg/services/mto_service_item/mto_service_item_updater_test.go index c1f55a56a77..7af20ed70d7 100644 --- a/pkg/services/mto_service_item/mto_service_item_updater_test.go +++ b/pkg/services/mto_service_item/mto_service_item_updater_test.go @@ -52,7 +52,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) updater := NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -330,7 +329,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -455,7 +453,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -584,7 +581,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -711,7 +707,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -796,7 +791,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -867,7 +861,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -976,7 +969,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -1092,7 +1084,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -1253,7 +1244,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -1364,7 +1354,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1234, apperror.UnprocessableEntityError{}) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -1399,7 +1388,6 @@ func (suite *MTOServiceItemServiceSuite) TestMTOServiceItemUpdater() { mock.AnythingOfType("*appcontext.appContext"), "50314", "98158", - true, ).Return(1000, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -2177,7 +2165,6 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemStatus() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) updater := NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -3171,7 +3158,6 @@ func (suite *MTOServiceItemServiceSuite) TestUpdateMTOServiceItemPricingEstimate mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) updater := NewMTOServiceItemUpdater(planner, builder, moveRouter, shipmentFetcher, addressCreator, portlocation.NewPortLocationFetcher(), ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) diff --git a/pkg/services/mto_shipment/mto_shipment_address_updater.go b/pkg/services/mto_shipment/mto_shipment_address_updater.go index 4b6efc1d478..edab362940f 100644 --- a/pkg/services/mto_shipment/mto_shipment_address_updater.go +++ b/pkg/services/mto_shipment/mto_shipment_address_updater.go @@ -72,9 +72,9 @@ func UpdateOriginSITServiceItemSITDeliveryMiles(planner route.Planner, shipment // Origin SIT: distance between shipment pickup address & service item ORIGINAL pickup address if serviceItem.SITOriginHHGOriginalAddress != nil { - milesCalculated, err = planner.ZipTransitDistance(appCtx, newAddress.PostalCode, serviceItem.SITOriginHHGOriginalAddress.PostalCode, false) + milesCalculated, err = planner.ZipTransitDistance(appCtx, newAddress.PostalCode, serviceItem.SITOriginHHGOriginalAddress.PostalCode) } else { - milesCalculated, err = planner.ZipTransitDistance(appCtx, oldAddress.PostalCode, newAddress.PostalCode, false) + milesCalculated, err = planner.ZipTransitDistance(appCtx, oldAddress.PostalCode, newAddress.PostalCode) } if err != nil { return nil, err diff --git a/pkg/services/mto_shipment/mto_shipment_address_updater_test.go b/pkg/services/mto_shipment/mto_shipment_address_updater_test.go index 13d5f04299f..e6df2b95c54 100644 --- a/pkg/services/mto_shipment/mto_shipment_address_updater_test.go +++ b/pkg/services/mto_shipment/mto_shipment_address_updater_test.go @@ -19,7 +19,6 @@ func (suite *MTOShipmentServiceSuite) TestUpdateMTOShipmentAddress() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) addressCreator := address.NewAddressCreator() addressUpdater := address.NewAddressUpdater() @@ -180,7 +179,6 @@ func (suite *MTOShipmentServiceSuite) TestUpdateMTOShipmentAddress() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(465, nil) mtoServiceItems, _ := UpdateOriginSITServiceItemSITDeliveryMiles(planner, &externalShipment, &newAddress, &oldAddress, suite.AppContextForTest()) suite.Equal(2, len(*mtoServiceItems)) diff --git a/pkg/services/mto_shipment/mto_shipment_updater.go b/pkg/services/mto_shipment/mto_shipment_updater.go index cb36634cec8..a2018f21ece 100644 --- a/pkg/services/mto_shipment/mto_shipment_updater.go +++ b/pkg/services/mto_shipment/mto_shipment_updater.go @@ -879,7 +879,7 @@ func (f *mtoShipmentUpdater) updateShipmentRecord(appCtx appcontext.AppContext, destZip = newShipment.DestinationAddress.PostalCode } // we need to get the mileage from DTOD first, the db proc will consume that - mileage, err := f.planner.ZipTransitDistance(appCtx, pickupZip, destZip, true) + mileage, err := f.planner.ZipTransitDistance(appCtx, pickupZip, destZip) if err != nil { return err } @@ -1193,9 +1193,7 @@ func reServiceCodesForShipment(shipment models.MTOShipment) []models.ReServiceCo // the value returned to make a fetch on the ghc_domestic_transit_times table and returns a required delivery date // based on the max_days_transit_time. func CalculateRequiredDeliveryDate(appCtx appcontext.AppContext, planner route.Planner, pickupAddress models.Address, destinationAddress models.Address, pickupDate time.Time, weight int, marketCode models.MarketCode, moveID uuid.UUID, shipmentType models.MTOShipmentType) (*time.Time, error) { - internationalShipment := marketCode == models.MarketCodeInternational - - distance, err := planner.ZipTransitDistance(appCtx, pickupAddress.PostalCode, destinationAddress.PostalCode, internationalShipment) + distance, err := planner.ZipTransitDistance(appCtx, pickupAddress.PostalCode, destinationAddress.PostalCode) if err != nil { return nil, err } @@ -1397,11 +1395,11 @@ func UpdateDestinationSITServiceItemsSITDeliveryMiles(planner route.Planner, app if TOOApprovalRequired { if serviceItem.SITDestinationOriginalAddress != nil { // if TOO approval was required, shipment destination address has been updated at this point - milesCalculated, err = planner.ZipTransitDistance(appCtx, shipment.DestinationAddress.PostalCode, serviceItem.SITDestinationOriginalAddress.PostalCode, false) + milesCalculated, err = planner.ZipTransitDistance(appCtx, shipment.DestinationAddress.PostalCode, serviceItem.SITDestinationOriginalAddress.PostalCode) } } else { // if TOO approval was not required, use the newAddress - milesCalculated, err = planner.ZipTransitDistance(appCtx, newAddress.PostalCode, serviceItem.SITDestinationOriginalAddress.PostalCode, false) + milesCalculated, err = planner.ZipTransitDistance(appCtx, newAddress.PostalCode, serviceItem.SITDestinationOriginalAddress.PostalCode) } if err != nil { return err diff --git a/pkg/services/mto_shipment/mto_shipment_updater_test.go b/pkg/services/mto_shipment/mto_shipment_updater_test.go index ffaad59f804..0ff61d7c40d 100644 --- a/pkg/services/mto_shipment/mto_shipment_updater_test.go +++ b/pkg/services/mto_shipment/mto_shipment_updater_test.go @@ -52,7 +52,6 @@ func (suite *MTOShipmentServiceSuite) TestMTOShipmentUpdater() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(1000, nil) moveRouter := moveservices.NewMoveRouter(transportationoffice.NewTransportationOfficesFetcher()) waf := entitlements.NewWeightAllotmentFetcher() @@ -467,13 +466,11 @@ func (suite *MTOShipmentServiceSuite) TestMTOShipmentUpdater() { mock.AnythingOfType("*appcontext.appContext"), "50314", "99505", - true, ).Return(1000, nil) planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "97220", "99505", - true, ).Return(1000, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -670,13 +667,11 @@ func (suite *MTOShipmentServiceSuite) TestMTOShipmentUpdater() { mock.AnythingOfType("*appcontext.appContext"), "50314", "99505", - true, ).Return(1000, nil) planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "50314", "97220", - true, ).Return(1000, nil) ghcDomesticTransitTime := models.GHCDomesticTransitTime{ @@ -2194,7 +2189,6 @@ func (suite *MTOShipmentServiceSuite) TestUpdateMTOShipmentStatus() { mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), mock.AnythingOfType("string"), - false, ).Return(500, nil).Run(func(args mock.Arguments) { TransitDistancePickupArg = args.Get(1).(string) TransitDistanceDestinationArg = args.Get(2).(string) @@ -3568,7 +3562,6 @@ func (suite *MTOShipmentServiceSuite) TestUpdateStatusServiceItems() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) siCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, builder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) updater := NewMTOShipmentStatusUpdater(builder, siCreator, planner) diff --git a/pkg/services/mto_shipment/shipment_approver.go b/pkg/services/mto_shipment/shipment_approver.go index 801507ea7a6..1266e111382 100644 --- a/pkg/services/mto_shipment/shipment_approver.go +++ b/pkg/services/mto_shipment/shipment_approver.go @@ -111,8 +111,8 @@ func (f *shipmentApprover) ApproveShipment(appCtx appcontext.AppContext, shipmen pickupZip = *portZip destZip = shipment.DestinationAddress.PostalCode } - // we need to get the mileage from DTOD first, the db proc will consume that - mileage, err := f.planner.ZipTransitDistance(appCtx, pickupZip, destZip, true) + // we need to get the mileage first, the db proc will consume that + mileage, err := f.planner.ZipTransitDistance(appCtx, pickupZip, destZip) if err != nil { return err } diff --git a/pkg/services/mto_shipment/shipment_approver_test.go b/pkg/services/mto_shipment/shipment_approver_test.go index 418174b4a5f..85a8f8f3ac2 100644 --- a/pkg/services/mto_shipment/shipment_approver_test.go +++ b/pkg/services/mto_shipment/shipment_approver_test.go @@ -122,7 +122,6 @@ func (suite *MTOShipmentServiceSuite) createApproveShipmentSubtestData() (subtes mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) ppmEstimator := &servicesMocks.PPMEstimator{} queryBuilder := query.NewQueryBuilder() @@ -351,7 +350,6 @@ func (suite *MTOShipmentServiceSuite) TestApproveShipment() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - true, ).Return(500, nil) // Approve international shipment @@ -731,7 +729,6 @@ func (suite *MTOShipmentServiceSuite) TestApproveShipment() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(500, nil) preApprovalTime := time.Now() @@ -851,7 +848,6 @@ func (suite *MTOShipmentServiceSuite) TestApproveShipment() { mock.AnythingOfType("*appcontext.appContext"), createdShipment.PickupAddress.PostalCode, createdShipment.DestinationAddress.PostalCode, - false, ).Return(500, nil) shipmentHeavyEtag := etag.GenerateEtag(shipmentHeavy.UpdatedAt) @@ -1127,7 +1123,6 @@ func (suite *MTOShipmentServiceSuite) TestApproveShipment() { mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), mock.AnythingOfType("string"), - false, ).Return(500, nil).Run(func(args mock.Arguments) { TransitDistancePickupArg = args.Get(1).(string) TransitDistanceDestinationArg = args.Get(2).(string) @@ -1182,7 +1177,6 @@ func (suite *MTOShipmentServiceSuite) TestApproveShipment() { mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), mock.AnythingOfType("string"), - false, ).Return(500, nil) suite.Equal(8000, *shipment.MoveTaskOrder.Orders.Entitlement.AuthorizedWeight()) @@ -1223,7 +1217,6 @@ func (suite *MTOShipmentServiceSuite) TestApproveShipment() { mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), mock.AnythingOfType("string"), - false, ).Return(500, nil) shipmentEtag := etag.GenerateEtag(shipment.UpdatedAt) diff --git a/pkg/services/mto_shipment/shipment_deleter_test.go b/pkg/services/mto_shipment/shipment_deleter_test.go index 150e1496ce0..204ff1d157c 100644 --- a/pkg/services/mto_shipment/shipment_deleter_test.go +++ b/pkg/services/mto_shipment/shipment_deleter_test.go @@ -30,7 +30,6 @@ func (suite *MTOShipmentServiceSuite) TestShipmentDeleter() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { @@ -261,7 +260,6 @@ func (suite *MTOShipmentServiceSuite) TestPrimeShipmentDeleter() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) setUpSignedCertificationCreatorMock := func(returnValue ...interface{}) services.SignedCertificationCreator { diff --git a/pkg/services/orchestrators/shipment/shipment_updater_test.go b/pkg/services/orchestrators/shipment/shipment_updater_test.go index 39619a2fd09..50feaed241f 100644 --- a/pkg/services/orchestrators/shipment/shipment_updater_test.go +++ b/pkg/services/orchestrators/shipment/shipment_updater_test.go @@ -581,7 +581,6 @@ func (suite *ShipmentSuite) TestUpdateShipment() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(800, nil) returnCents := unit.Cents(123) diff --git a/pkg/services/payment_request/payment_request_creator_test.go b/pkg/services/payment_request/payment_request_creator_test.go index 6c44677c2e8..ecff224d66a 100644 --- a/pkg/services/payment_request/payment_request_creator_test.go +++ b/pkg/services/payment_request/payment_request_creator_test.go @@ -327,7 +327,6 @@ func (suite *PaymentRequestServiceSuite) TestCreatePaymentRequest() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(0, nil) }) @@ -569,7 +568,6 @@ func (suite *PaymentRequestServiceSuite) TestCreatePaymentRequest() { mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(0, nil) failingCreator := NewPaymentRequestCreator(planner, failingServiceItemPricer) @@ -1461,7 +1459,6 @@ func (suite *PaymentRequestServiceSuite) TestCreatePaymentRequestCheckOnNTSRelea mock.AnythingOfType("*appcontext.appContext"), testStorageFacilityZip, testDestinationZip, - false, ).Return(testZip3Distance, nil) // Create an initial payment request. diff --git a/pkg/services/payment_request/payment_request_recalculator_test.go b/pkg/services/payment_request/payment_request_recalculator_test.go index 94b21d42e71..8e7e645d8ee 100644 --- a/pkg/services/payment_request/payment_request_recalculator_test.go +++ b/pkg/services/payment_request/payment_request_recalculator_test.go @@ -55,7 +55,6 @@ func (suite *PaymentRequestServiceSuite) TestRecalculatePaymentRequestSuccess() mock.AnythingOfType("*appcontext.appContext"), recalculateTestPickupZip, recalculateTestDestinationZip, - false, ).Return(recalculateTestZip3Distance, nil) // Create an initial payment request. @@ -296,7 +295,6 @@ func (suite *PaymentRequestServiceSuite) TestRecalculatePaymentRequestErrors() { mock.AnythingOfType("*appcontext.appContext"), recalculateTestPickupZip, recalculateTestDestinationZip, - false, ).Return(recalculateTestZip3Distance, nil) // Create an initial payment request. diff --git a/pkg/services/payment_request/payment_request_shipment_recalculate_test.go b/pkg/services/payment_request/payment_request_shipment_recalculate_test.go index d308e237efb..238a622bc90 100644 --- a/pkg/services/payment_request/payment_request_shipment_recalculate_test.go +++ b/pkg/services/payment_request/payment_request_shipment_recalculate_test.go @@ -27,7 +27,6 @@ func (suite *PaymentRequestServiceSuite) TestRecalculateShipmentPaymentRequestSu mock.AnythingOfType("*appcontext.appContext"), recalculateTestPickupZip, recalculateTestDestinationZip, - false, ).Return(recalculateTestZip3Distance, nil) // Create an initial payment request. @@ -137,7 +136,6 @@ func (suite *PaymentRequestServiceSuite) TestRecalculateShipmentPaymentRequestEr mock.AnythingOfType("*appcontext.appContext"), recalculateTestPickupZip, recalculateTestDestinationZip, - false, ).Return(recalculateTestZip3Distance, nil) creator := NewPaymentRequestCreator(mockPlanner, ghcrateengine.NewServiceItemPricer()) diff --git a/pkg/services/ppm_closeout/ppm_closeout_test.go b/pkg/services/ppm_closeout/ppm_closeout_test.go index cc0fff6a390..2de07717f92 100644 --- a/pkg/services/ppm_closeout/ppm_closeout_test.go +++ b/pkg/services/ppm_closeout/ppm_closeout_test.go @@ -337,7 +337,7 @@ func (suite *PPMCloseoutSuite) TestPPMShipmentCloseout() { appCtx := suite.AppContextForTest() mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) mockedPaymentRequestHelper.On( "FetchServiceParamsForServiceItems", @@ -393,7 +393,7 @@ func (suite *PPMCloseoutSuite) TestPPMShipmentCloseout() { appCtx := suite.AppContextForTest() mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) mockedPaymentRequestHelper.On( "FetchServiceParamsForServiceItems", diff --git a/pkg/services/ppmshipment/ppm_estimator.go b/pkg/services/ppmshipment/ppm_estimator.go index d162aa3a722..290397a0a09 100644 --- a/pkg/services/ppmshipment/ppm_estimator.go +++ b/pkg/services/ppmshipment/ppm_estimator.go @@ -798,13 +798,13 @@ func (f *estimatePPM) CalculateOCONUSIncentive(appCtx appcontext.AppContext, ppm mileage = 0 case isPickupOconus && !isDestinationOconus: // OCONUS -> CONUS (port ZIP -> address ZIP) - mileage, err = f.planner.ZipTransitDistance(appCtx, ppmPort.UsPostRegionCity.UsprZipID, destinationAddress.PostalCode, true) + mileage, err = f.planner.ZipTransitDistance(appCtx, ppmPort.UsPostRegionCity.UsprZipID, destinationAddress.PostalCode) if err != nil { return nil, fmt.Errorf("failed to calculate OCONUS to CONUS mileage: %w", err) } case !isPickupOconus && isDestinationOconus: // CONUS -> OCONUS (address ZIP -> port ZIP) - mileage, err = f.planner.ZipTransitDistance(appCtx, pickupAddress.PostalCode, ppmPort.UsPostRegionCity.UsprZipID, true) + mileage, err = f.planner.ZipTransitDistance(appCtx, pickupAddress.PostalCode, ppmPort.UsPostRegionCity.UsprZipID) if err != nil { return nil, fmt.Errorf("failed to calculate CONUS to OCONUS mileage: %w", err) } diff --git a/pkg/services/ppmshipment/ppm_estimator_test.go b/pkg/services/ppmshipment/ppm_estimator_test.go index f384223e3ba..30ac0f8315d 100644 --- a/pkg/services/ppmshipment/ppm_estimator_test.go +++ b/pkg/services/ppmshipment/ppm_estimator_test.go @@ -492,13 +492,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"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) linehaul, fuel, origin, dest, packing, unpacking, _, err := ppmEstimator.PriceBreakdown(suite.AppContextForTest(), &ppmShipment) suite.NilOrNoVerrs(err) mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(unit.Pound(4000), *ppmShipment.EstimatedWeight) @@ -537,13 +537,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.PickupAddress.PostalCode, newPPM.PickupAddress.PostalCode) @@ -574,13 +574,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.PickupAddress.PostalCode, newPPM.PickupAddress.PostalCode) @@ -608,13 +608,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.PickupAddress.PostalCode, newPPM.PickupAddress.PostalCode) @@ -642,13 +642,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.PickupAddress.PostalCode, newPPM.PickupAddress.PostalCode) @@ -678,7 +678,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"), - "50309", "30813", false).Return(2294, nil).Once() + "50309", "30813").Return(2294, nil).Once() ppmEstimate, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) @@ -765,13 +765,13 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { mock.AnythingOfType("[]models.MTOServiceItem")).Return(serviceParams, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) maxIncentive, err := ppmEstimator.MaxIncentive(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(unit.Cents(128398858), *maxIncentive) @@ -826,13 +826,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.ActualPickupPostalCode, newPPM.ActualPickupPostalCode) @@ -877,12 +877,12 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { mock.AnythingOfType("[]models.MTOServiceItem")).Return(serviceParams, nil) // DTOD distance is going to be less than the HHG Rand McNally distance of 2361 miles - mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "50309", "30813", false).Return(2294, nil) + mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "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"), "50309", "30813", false) + mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.ActualPickupPostalCode, newPPM.ActualPickupPostalCode) @@ -928,12 +928,12 @@ 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"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) ppmFinalIncentiveLimitedByAllowableWeight, err := ppmEstimator.FinalIncentiveWithDefaultChecks(suite.AppContextForTest(), oldPPMShipment, &newPPM) suite.NilOrNoVerrs(err) - mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "50309", "30813", false) + mockedPlanner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.ActualPickupPostalCode, newPPM.ActualPickupPostalCode) @@ -983,13 +983,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) suite.Equal(oldPPMShipment.ActualPickupPostalCode, newPPM.ActualPickupPostalCode) @@ -1040,13 +1040,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) originalWeight, newWeight := SumWeightTickets(oldPPMShipment, newPPM) @@ -1102,13 +1102,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) originalWeight, newWeight := SumWeightTickets(oldPPMShipment, newPPM) @@ -1172,13 +1172,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"), - "50309", "30813", false).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"), - "50309", "30813", false) + "50309", "30813") mockedPaymentRequestHelper.AssertCalled(suite.T(), "FetchServiceParamsForServiceItems", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("[]models.MTOServiceItem")) originalWeight, newWeight := SumWeightTickets(oldPPMShipment, newPPM) @@ -1669,7 +1669,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) _, estimatedSITCost, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), models.PPMShipment{}, &shipmentOriginSIT) @@ -1731,7 +1731,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) _, estimatedSITCost, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), models.PPMShipment{}, &shipmentDestinationSIT) @@ -1769,7 +1769,7 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { }, }, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30813", false).Return(2294, nil) + "50309", "30813").Return(2294, nil) _, estimatedSITCost, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), models.PPMShipment{}, &shipmentOriginSIT) @@ -1959,10 +1959,10 @@ func (suite *PPMShipmentSuite) TestPPMEstimator() { shipmentDifferentDeparture.ExpectedDepartureDate = originalShipment.ExpectedDepartureDate.Add(time.Hour * 24 * 70) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90211", "30813", false).Return(2294, nil) + "90211", "30813").Return(2294, nil) mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "30814", false).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. @@ -2086,7 +2086,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { newPPM.EstimatedWeight = &estimatedWeight planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "74133", "98421", true).Return(3000, nil) + "74133", "98421").Return(3000, nil) ppmEstimate, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), ppm, &newPPM) suite.NilOrNoVerrs(err) @@ -2094,7 +2094,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // it should've called from the pickup -> port and NOT pickup -> dest planner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "74133", "98421", true) + "74133", "98421") suite.Equal(unit.Cents(459178), *ppmEstimate) }) @@ -2133,7 +2133,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { newPPM.EstimatedWeight = &estimatedWeight planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "98421", "74133", true).Return(3000, nil) + "98421", "74133").Return(3000, nil) ppmEstimate, _, err := ppmEstimator.EstimateIncentiveWithDefaultChecks(suite.AppContextForTest(), ppm, &newPPM) suite.NilOrNoVerrs(err) @@ -2141,7 +2141,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // it should've called from the pickup -> port and NOT pickup -> dest planner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "98421", "74133", true) + "98421", "74133") suite.Equal(unit.Cents(423178), *ppmEstimate) }) }) @@ -2215,7 +2215,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // DTOD will be called to get the distance between the origin duty location & the Tacoma Port ZIP planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "98421", true).Return(3000, nil) + "50309", "98421").Return(3000, nil) ppmMaxIncentive, err := ppmEstimator.MaxIncentive(suite.AppContextForTest(), ppm, &newPPM) suite.NilOrNoVerrs(err) @@ -2223,7 +2223,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // it should've called from the pickup -> port and NOT pickup -> dest planner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "50309", "98421", true) + "50309", "98421") suite.Equal(unit.Cents(656532), *ppmMaxIncentive) }) @@ -2295,7 +2295,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // DTOD will be called to get the distance between the origin duty location & the Tacoma Port ZIP planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "98421", "30813", true).Return(3000, nil) + "98421", "30813").Return(3000, nil) ppmMaxIncentive, err := ppmEstimator.MaxIncentive(suite.AppContextForTest(), ppm, &newPPM) suite.NilOrNoVerrs(err) @@ -2303,7 +2303,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // it should've called from the pickup -> port and NOT pickup -> dest planner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "98421", "30813", true) + "98421", "30813") suite.Equal(unit.Cents(676692), *ppmMaxIncentive) }) }) @@ -2362,7 +2362,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { setupPricerData() planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "74133", "98421", true).Return(3000, nil) + "74133", "98421").Return(3000, nil) ppmFinalIncentive, err := ppmEstimator.FinalIncentiveWithDefaultChecks(suite.AppContextForTest(), ppm, &newPPM) suite.NilOrNoVerrs(err) @@ -2370,7 +2370,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // it should've called from the pickup -> port and NOT pickup -> dest planner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "74133", "98421", true) + "74133", "98421") suite.Equal(unit.Cents(459178), *ppmFinalIncentive) }) @@ -2427,7 +2427,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { setupPricerData() planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "98421", "74133", true).Return(3000, nil) + "98421", "74133").Return(3000, nil) ppmFinalIncentive, err := ppmEstimator.FinalIncentiveWithDefaultChecks(suite.AppContextForTest(), ppm, &newPPM) suite.NilOrNoVerrs(err) @@ -2435,7 +2435,7 @@ func (suite *PPMShipmentSuite) TestInternationalPPMEstimator() { // it should've called from the pickup -> port and NOT pickup -> dest planner.AssertCalled(suite.T(), "ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "98421", "74133", true) + "98421", "74133") suite.Equal(unit.Cents(423178), *ppmFinalIncentive) }) }) diff --git a/pkg/services/ppmshipment/ppm_shipment_updater_test.go b/pkg/services/ppmshipment/ppm_shipment_updater_test.go index 3ee017878b4..33263dc2ade 100644 --- a/pkg/services/ppmshipment/ppm_shipment_updater_test.go +++ b/pkg/services/ppmshipment/ppm_shipment_updater_test.go @@ -1504,7 +1504,7 @@ func (suite *PPMShipmentSuite) TestUpdatePPMShipment() { originalPPM.DestinationAddress = destinationAddress mockedPlanner := &routemocks.Planner{} mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813", false).Return(2294, nil) + "90210", "30813").Return(2294, nil) updatedPPM, err := subtestData.ppmShipmentUpdater.UpdatePPMShipmentSITEstimatedCost(appCtx, &originalPPM) @@ -1520,6 +1520,8 @@ func (suite *PPMShipmentSuite) TestUpdatePPMShipment() { subtestData := setUpForTests(newFakeEstimatedIncentive, newFakeSITEstimatedCost, nil, nil) sitLocationDestination := models.SITLocationTypeDestination entryDate := time.Date(2020, time.March, 15, 0, 0, 0, 0, time.UTC) + // we do not have a contract for this date + invalidDate := time.Date(2017, time.March, 15, 0, 0, 0, 0, time.UTC) streetAddress1 := "10642 N Second Ave" streetAddress2 := "Apt. 308" city := "Atco" @@ -1542,7 +1544,7 @@ func (suite *PPMShipmentSuite) TestUpdatePPMShipment() { originalPPM := factory.BuildPPMShipment(suite.DB(), []factory.Customization{ { Model: models.PPMShipment{ - ExpectedDepartureDate: entryDate.Add(time.Hour * 24 * 30), + ExpectedDepartureDate: invalidDate, SITExpected: models.BoolPointer(true), SITLocation: &sitLocationDestination, SITEstimatedEntryDate: &entryDate, @@ -1560,7 +1562,7 @@ func (suite *PPMShipmentSuite) TestUpdatePPMShipment() { originalPPM.DestinationAddress = destinationAddress mockedPlanner := &routemocks.Planner{} mockedPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813", false).Return(2294, nil) + "90210", "30813").Return(2294, nil) updatedPPM, err := subtestData.ppmShipmentUpdater.UpdatePPMShipmentSITEstimatedCost(appCtx, &originalPPM) diff --git a/pkg/services/reweigh/reweigh_updater_test.go b/pkg/services/reweigh/reweigh_updater_test.go index c1501906a98..ad2ab0da981 100644 --- a/pkg/services/reweigh/reweigh_updater_test.go +++ b/pkg/services/reweigh/reweigh_updater_test.go @@ -31,7 +31,6 @@ func (suite *ReweighSuite) TestReweighUpdater() { mockPlanner.On("ZipTransitDistance", recalculateTestPickupZip, recalculateTestDestinationZip, - false, ).Return(recalculateTestZip3Distance, nil) // Get shipment payment request recalculator service diff --git a/pkg/services/shipment_address_update/shipment_address_update_requester.go b/pkg/services/shipment_address_update/shipment_address_update_requester.go index 3acd31b33fb..8fdb3b5c1e0 100644 --- a/pkg/services/shipment_address_update/shipment_address_update_requester.go +++ b/pkg/services/shipment_address_update/shipment_address_update_requester.go @@ -38,10 +38,10 @@ func NewShipmentAddressUpdateRequester(planner route.Planner, addressCreator ser } } -func (f *shipmentAddressUpdateRequester) isAddressChangeDistanceOver50(appCtx appcontext.AppContext, addressUpdate models.ShipmentAddressUpdate, isInternationalShipment bool) (bool, error) { +func (f *shipmentAddressUpdateRequester) isAddressChangeDistanceOver50(appCtx appcontext.AppContext, addressUpdate models.ShipmentAddressUpdate) (bool, error) { // We calculate and set the distance between the old and new address - distance, err := f.planner.ZipTransitDistance(appCtx, addressUpdate.OriginalAddress.PostalCode, addressUpdate.NewAddress.PostalCode, isInternationalShipment) + distance, err := f.planner.ZipTransitDistance(appCtx, addressUpdate.OriginalAddress.PostalCode, addressUpdate.NewAddress.PostalCode) if err != nil { return false, err } @@ -122,11 +122,12 @@ func (f *shipmentAddressUpdateRequester) doesDeliveryAddressUpdateChangeMileageB return false, nil } - previousDistance, err := f.planner.ZipTransitDistance(appCtx, originalPickupAddress.PostalCode, originalDeliveryAddress.PostalCode, false) + // this only runs for domestic shipments so putting false for the isInternationalShipment value here + previousDistance, err := f.planner.ZipTransitDistance(appCtx, originalPickupAddress.PostalCode, originalDeliveryAddress.PostalCode) if err != nil { return false, err } - newDistance, err := f.planner.ZipTransitDistance(appCtx, originalPickupAddress.PostalCode, newDeliveryAddress.PostalCode, false) + newDistance, err := f.planner.ZipTransitDistance(appCtx, originalPickupAddress.PostalCode, newDeliveryAddress.PostalCode) if err != nil { return false, err } @@ -354,14 +355,14 @@ func (f *shipmentAddressUpdateRequester) RequestShipmentDeliveryAddressUpdate(ap if addressUpdate.NewSitDistanceBetween != nil { distanceBetweenOld = *addressUpdate.NewSitDistanceBetween } else { - distanceBetweenOld, err = f.planner.ZipTransitDistance(appCtx, addressUpdate.SitOriginalAddress.PostalCode, addressUpdate.OriginalAddress.PostalCode, false) + distanceBetweenOld, err = f.planner.ZipTransitDistance(appCtx, addressUpdate.SitOriginalAddress.PostalCode, addressUpdate.OriginalAddress.PostalCode) } if err != nil { return nil, err } // calculating distance between the new address update & the SIT - distanceBetweenNew, err = f.planner.ZipTransitDistance(appCtx, addressUpdate.SitOriginalAddress.PostalCode, addressUpdate.NewAddress.PostalCode, false) + distanceBetweenNew, err = f.planner.ZipTransitDistance(appCtx, addressUpdate.SitOriginalAddress.PostalCode, addressUpdate.NewAddress.PostalCode) if err != nil { return nil, err } @@ -418,7 +419,7 @@ func (f *shipmentAddressUpdateRequester) RequestShipmentDeliveryAddressUpdate(ap } if !updateNeedsTOOReview { - updateNeedsTOOReview, err = f.isAddressChangeDistanceOver50(appCtx, addressUpdate, isInternationalShipment) + updateNeedsTOOReview, err = f.isAddressChangeDistanceOver50(appCtx, addressUpdate) if err != nil { return nil, err } @@ -698,8 +699,8 @@ func (f *shipmentAddressUpdateRequester) ReviewShipmentAddressChange(appCtx appc pickupZip = *portZip destZip = shipment.DestinationAddress.PostalCode } - // we need to get the mileage from DTOD first, the db proc will consume that - mileage, err := f.planner.ZipTransitDistance(appCtx, pickupZip, destZip, true) + // we need to get the mileage first, the db proc will consume that + mileage, err := f.planner.ZipTransitDistance(appCtx, pickupZip, destZip) if err != nil { return err } diff --git a/pkg/services/shipment_address_update/shipment_address_update_requester_test.go b/pkg/services/shipment_address_update/shipment_address_update_requester_test.go index c955d604541..84e1c17b28b 100644 --- a/pkg/services/shipment_address_update/shipment_address_update_requester_test.go +++ b/pkg/services/shipment_address_update/shipment_address_update_requester_test.go @@ -108,13 +108,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(2500, nil).Twice() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(2500, nil).Once() move := setupTestData() shipment := factory.BuildMTOShipmentWithMove(&move, suite.DB(), nil, nil) @@ -148,13 +146,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(2500, nil).Twice() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(2500, nil).Once() move := setupTestData() @@ -217,7 +213,6 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "99505", "99506", - true, ).Return(49, nil) move := setupTestData() @@ -298,7 +293,6 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), mock.AnythingOfType("string"), - false, ).Return(0, fmt.Errorf("error calculating distance 2")).Once() testdatagen.FetchOrMakeReContractYear(suite.DB(), testdatagen.Assertions{ @@ -438,13 +432,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(2500, nil).Times(4) mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(2500, nil).Twice() update, err := addressUpdateRequester.RequestShipmentDeliveryAddressUpdate(suite.AppContextForTest(), shipment.ID, newAddress, "we really need to change the address", etag.GenerateEtag(shipment.UpdatedAt)) @@ -470,13 +462,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "89523", "89503", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "89523", "90210", - false, ).Return(2500, nil).Once() newAddress := models.Address{ StreetAddress1: "123 Any St", @@ -517,13 +507,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "89523", "89503", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "89523", "90210", - false, ).Return(2500, nil).Once() move := setupTestData() shipment := factory.BuildMTOShipmentWithMove(&move, suite.DB(), []factory.Customization{ @@ -564,13 +552,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(0, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "89503", - false, ).Return(200, nil).Once() testdatagen.MakeReContractYear(suite.DB(), testdatagen.Assertions{ ReContractYear: models.ReContractYear{ @@ -693,13 +679,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), "87108", - false, ).Return(500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.AnythingOfType("string"), "87053", - false, ).Return(501, nil).Once() suite.NotEmpty(move.MTOShipments) update, err := addressUpdateRequester.RequestShipmentDeliveryAddressUpdate(suite.AppContextForTest(), shipment.ID, newAddress, "we really need to change the address", etag.GenerateEtag(shipment.UpdatedAt)) @@ -753,19 +737,16 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(0, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94523", "90210", - false, ).Return(500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "90210", - false, ).Return(501, nil).Once() // request the update @@ -836,19 +817,16 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestCreateApprovedShipmentAddres mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(0, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94523", "99695", - false, ).Return(500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "99695", - false, ).Return(1000, nil).Once() // request the update @@ -875,7 +853,6 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) addressUpdateRequester := NewShipmentAddressUpdateRequester(mockPlanner, addressCreator, moveRouter) @@ -1252,14 +1229,12 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(300, nil) mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - true, ).Return(300, nil) newDestUSPRC, err := models.FindByZipCode(suite.AppContextForTest().DB(), "99703") @@ -1470,7 +1445,6 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(300, nil) newDestUSPRC, err := models.FindByZipCode(suite.AppContextForTest().DB(), "99703") @@ -1574,13 +1548,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), "89523", "89503", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "89523", "90210", - false, ).Return(2500, nil).Once() move := setupTestData() @@ -1645,13 +1617,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), "89523", "89503", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "89523", "90210", - false, ).Return(2500, nil).Once() move := setupTestData() @@ -1731,13 +1701,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(2500, nil).Once() addressChange, _ := addressUpdateRequester.RequestShipmentDeliveryAddressUpdate(suite.AppContextForTest(), shipment.ID, newAddress, "we really need to change the address", etag.GenerateEtag(shipment.UpdatedAt)) @@ -1759,13 +1727,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), "89523", "89503", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "89523", "90210", - false, ).Return(2500, nil).Once() move := setupTestData() @@ -1825,13 +1791,11 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), "89523", "89503", - false, ).Return(2500, nil).Once() mockPlanner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "89523", "90210", - false, ).Return(2500, nil).Once() newAddress := models.Address{ StreetAddress1: "123 Any St", @@ -1890,7 +1854,6 @@ func (suite *ShipmentAddressUpdateServiceSuite) TestTOOApprovedShipmentAddressUp mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", - false, ).Return(30, nil) move := setupTestData() shipment := factory.BuildMTOShipmentWithMove(&move, suite.DB(), nil, nil) diff --git a/pkg/services/sit_extension/sit_extension_denier.go b/pkg/services/sit_extension/sit_extension_denier.go index 9f019a0c47c..a9f213ea251 100644 --- a/pkg/services/sit_extension/sit_extension_denier.go +++ b/pkg/services/sit_extension/sit_extension_denier.go @@ -34,7 +34,6 @@ func NewSITExtensionDenier(moveRouter services.MoveRouter) services.SITExtension mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) return &sitExtensionDenier{moveRouter, mtoserviceitem.NewMTOServiceItemUpdater(planner, query.NewQueryBuilder(), moveRouter, mtoshipment.NewMTOShipmentFetcher(), address.NewAddressCreator(), portlocation.NewPortLocationFetcher(), ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer())} } diff --git a/pkg/testdatagen/scenario/shared.go b/pkg/testdatagen/scenario/shared.go index 52a325f3c8d..c1c5e55e237 100644 --- a/pkg/testdatagen/scenario/shared.go +++ b/pkg/testdatagen/scenario/shared.go @@ -4211,7 +4211,6 @@ func createHHGWithOriginSITServiceItems( mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) queryBuilder := query.NewQueryBuilder() @@ -4243,7 +4242,7 @@ func createHHGWithOriginSITServiceItems( // called for zip 3 domestic linehaul service item planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813", false).Return(2361, nil) + "90210", "30813").Return(2361, nil) shipmentUpdater := mtoshipment.NewMTOShipmentStatusUpdater(queryBuilder, serviceItemCreator, planner) _, updateErr := shipmentUpdater.UpdateMTOShipmentStatus(appCtx, shipment.ID, models.MTOShipmentStatusApproved, nil, nil, etag.GenerateEtag(shipment.UpdatedAt)) @@ -4294,7 +4293,6 @@ func createHHGWithOriginSITServiceItems( mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) serviceItemUpdator := mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -4486,7 +4484,6 @@ func createHHGWithDestinationSITServiceItems(appCtx appcontext.AppContext, prime mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) serviceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -4518,7 +4515,7 @@ func createHHGWithDestinationSITServiceItems(appCtx appcontext.AppContext, prime // called for zip 3 domestic linehaul service item planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "90210", "30813", false).Return(2361, nil) + "90210", "30813").Return(2361, nil) shipmentUpdater := mtoshipment.NewMTOShipmentStatusUpdater(queryBuilder, serviceItemCreator, planner) _, updateErr := shipmentUpdater.UpdateMTOShipmentStatus(appCtx, shipment.ID, models.MTOShipmentStatusApproved, nil, nil, etag.GenerateEtag(shipment.UpdatedAt)) @@ -4564,7 +4561,6 @@ func createHHGWithDestinationSITServiceItems(appCtx appcontext.AppContext, prime mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) serviceItemUpdator := mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -4901,7 +4897,7 @@ func createHHGWithPaymentServiceItems( queryBuilder := query.NewQueryBuilder() planner := &routemocks.Planner{} - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, false).Return(123, nil).Once() + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything).Return(123, nil).Once() serviceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -4930,33 +4926,33 @@ func createHHGWithPaymentServiceItems( logger.Fatal("Error approving move") } // called using the addresses with origin zip of 90210 and destination zip of 94535 - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, false).Return(348, nil).Times(2) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything).Return(348, nil).Times(2) // called using the addresses with origin zip of 90210 and destination zip of 90211 - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, false).Return(3, nil).Times(5) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything).Return(3, nil).Times(5) // called for zip 3 domestic linehaul service item planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), - "94535", "94535", false).Return(348, nil).Times(2) + "94535", "94535").Return(348, nil).Times(2) // called for zip 5 domestic linehaul service item - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "94535", false).Return(348, nil).Times(2) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "94535").Return(348, nil).Times(2) // called for domestic shorthaul service item planner.On("Zip5TransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "90211").Return(3, nil).Times(7) // called for domestic shorthaul service item - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "90211", false).Return(348, nil).Times(10) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "90211").Return(348, nil).Times(10) // called for domestic origin SIT pickup service item - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "94535", false).Return(348, nil).Once() + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "90210", "94535").Return(348, nil).Once() // called for domestic destination SIT delivery service item - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "90210", false).Return(348, nil).Times(2) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), "94535", "90210").Return(348, nil).Times(2) // called for DLH, DSH, FSC service item estimated price calculations - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, false).Return(400, nil).Times(3) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything).Return(400, nil).Times(3) for _, shipment := range []models.MTOShipment{longhaulShipment, shorthaulShipment, shipmentWithOriginalWeight, shipmentWithOriginalAndReweighWeight, shipmentWithOriginalAndReweighWeightReweihBolded, shipmentWithOriginalReweighAndAdjustedWeight, shipmentWithOriginalAndAdjustedWeight} { shipmentUpdater := mtoshipment.NewMTOShipmentStatusUpdater(queryBuilder, serviceItemCreator, planner) @@ -5051,7 +5047,6 @@ func createHHGWithPaymentServiceItems( mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(400, nil) serviceItemUpdater := mtoserviceitem.NewMTOServiceItemUpdater(planner, queryBuilder, moveRouter, shipmentFetcher, addressCreator, portLocationFetcher, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -5539,7 +5534,6 @@ func createHHGMoveWithPaymentRequest(appCtx appcontext.AppContext, userUploader mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, - false, ).Return(910, nil) paymentRequestCreator := paymentrequest.NewPaymentRequestCreator( diff --git a/pkg/testdatagen/testharness/make_move.go b/pkg/testdatagen/testharness/make_move.go index f6cadea3627..5b55389b101 100644 --- a/pkg/testdatagen/testharness/make_move.go +++ b/pkg/testdatagen/testharness/make_move.go @@ -4015,7 +4015,7 @@ func MakeHHGMoveWithApprovedNTSShipmentsForTOO(appCtx appcontext.AppContext) mod planner := &routemocks.Planner{} // mock any and all planner calls - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, false).Return(2361, nil) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything).Return(2361, nil) queryBuilder := query.NewQueryBuilder() serviceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer()) @@ -4119,7 +4119,7 @@ func MakeHHGMoveWithApprovedNTSRShipmentsForTOO(appCtx appcontext.AppContext) mo planner := &routemocks.Planner{} // mock any and all planner calls - planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything, false).Return(2361, nil) + planner.On("ZipTransitDistance", mock.AnythingOfType("*appcontext.appContext"), mock.Anything, mock.Anything).Return(2361, nil) queryBuilder := query.NewQueryBuilder() serviceItemCreator := mtoserviceitem.NewMTOServiceItemCreator(planner, queryBuilder, moveRouter, ghcrateengine.NewDomesticUnpackPricer(), ghcrateengine.NewDomesticPackPricer(), ghcrateengine.NewDomesticLinehaulPricer(), ghcrateengine.NewDomesticShorthaulPricer(), ghcrateengine.NewDomesticOriginPricer(), ghcrateengine.NewDomesticDestinationPricer(), ghcrateengine.NewFuelSurchargePricer())