diff --git a/config/tls/milmove-cert-bundle.p7b b/config/tls/milmove-cert-bundle.p7b index 755ddc7b08a..9a53bf6c2e9 100644 Binary files a/config/tls/milmove-cert-bundle.p7b and b/config/tls/milmove-cert-bundle.p7b differ diff --git a/go.mod b/go.mod index 6e0a3a4356e..296ddbf9b31 100644 --- a/go.mod +++ b/go.mod @@ -95,7 +95,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.28.0 go.opentelemetry.io/otel/trace v1.31.0 go.uber.org/zap v1.27.0 - golang.org/x/crypto v0.31.0 + golang.org/x/crypto v0.27.0 golang.org/x/net v0.29.0 golang.org/x/oauth2 v0.23.0 golang.org/x/text v0.21.0 @@ -262,8 +262,8 @@ require ( golang.org/x/image v0.23.0 // indirect golang.org/x/mod v0.20.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect diff --git a/go.sum b/go.sum index 8dbbb90bbe0..53544074443 100644 --- a/go.sum +++ b/go.sum @@ -723,8 +723,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= @@ -831,8 +831,8 @@ golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -849,8 +849,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index 0c4f0c85126..21d52bc13fd 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -1071,13 +1071,15 @@ 20241230150644_student_travel_weight_limit_param.up.sql 20241230190638_remove_AK_zips_from_zip3.up.sql 20241230190647_add_missing_AK_zips_to_zip3_distances.up.sql +20241231155337_add_payment_params_for_international_shuttle.up.sql 20250103130619_revert_data_change_for_gbloc_for_ak.up.sql 20250103142533_update_postal_codes_and_gblocs_for_ak.up.sql 20250103180420_update_pricing_proc_to_use_local_price_variable.up.sql 20250110001339_update_nts_release_enum_name.up.sql 20250110153428_add_shipment_address_updates_to_move_history.up.sql -20250110214012_homesafeconnect_cert.up.sql 20250113152050_rename_ubp.up.sql +20250113160816_updating_create_accessorial_service_item_proc.up.sql 20250113201232_update_estimated_pricing_procs_add_is_peak_func.up.sql 20250116200912_disable_homesafe_stg_cert.up.sql 20250120144247_update_pricing_proc_to_use_110_percent_weight.up.sql +20250121153007_update_pricing_proc_to_handle_international_shuttle.up.sql diff --git a/migrations/app/schema/20241231155337_add_payment_params_for_international_shuttle.up.sql b/migrations/app/schema/20241231155337_add_payment_params_for_international_shuttle.up.sql new file mode 100644 index 00000000000..e14357ac6a4 --- /dev/null +++ b/migrations/app/schema/20241231155337_add_payment_params_for_international_shuttle.up.sql @@ -0,0 +1,15 @@ +INSERT INTO service_params +(id,service_id,service_item_param_key_id,created_at,updated_at) +VALUES +('379c6d36-56ed-4469-8d17-cc5060b02fa3', (SELECT id FROM re_services WHERE code='IOSHUT'), (SELECT id FROM service_item_param_keys WHERE key='ContractCode'), now(), now()), +('1925f884-e66a-4c5b-91b5-f953072dadfc', (SELECT id FROM re_services WHERE code='IOSHUT'), (SELECT id FROM service_item_param_keys WHERE key='ContractYearName'), now(), now()), +('590786bd-c608-429b-9382-bcb12e165512', (SELECT id FROM re_services WHERE code='IOSHUT'), (SELECT id FROM service_item_param_keys WHERE key='EscalationCompounded'), now(), now()), +('8c2d6c08-2521-40d5-bb8b-4998d6c43ceb', (SELECT id FROM re_services WHERE code='IOSHUT'), (SELECT id FROM service_item_param_keys WHERE key='PriceRateOrFactor'), now(), now()); + +INSERT INTO service_params +(id,service_id,service_item_param_key_id,created_at,updated_at) +VALUES +('b2588961-21af-416d-bb89-fcff62230991', (SELECT id FROM re_services WHERE code='IDSHUT'), (SELECT id FROM service_item_param_keys WHERE key='ContractCode'), now(), now()), +('1ee015d0-ae1a-4f0f-b228-de2537816a4b', (SELECT id FROM re_services WHERE code='IDSHUT'), (SELECT id FROM service_item_param_keys WHERE key='ContractYearName'), now(), now()), +('4eab020b-7df0-42db-b285-2ad2fc0c213c', (SELECT id FROM re_services WHERE code='IDSHUT'), (SELECT id FROM service_item_param_keys WHERE key='EscalationCompounded'), now(), now()), +('4bb8cc94-b2e2-417e-a512-a361bcadd9ba', (SELECT id FROM re_services WHERE code='IDSHUT'), (SELECT id FROM service_item_param_keys WHERE key='PriceRateOrFactor'), now(), now()); diff --git a/migrations/app/schema/20250113160816_updating_create_accessorial_service_item_proc.up.sql b/migrations/app/schema/20250113160816_updating_create_accessorial_service_item_proc.up.sql new file mode 100644 index 00000000000..ff31e1769c1 --- /dev/null +++ b/migrations/app/schema/20250113160816_updating_create_accessorial_service_item_proc.up.sql @@ -0,0 +1,121 @@ +DO ' +BEGIN + IF EXISTS (SELECT 1 FROM pg_type WHERE typname = ''mto_service_item_type'') THEN + ALTER TYPE mto_service_item_type DROP ATTRIBUTE "re_service_id"; + ALTER TYPE mto_service_item_type ADD ATTRIBUTE "re_service_code" text; + END IF; +END +'; + +DROP PROCEDURE create_accessorial_service_items_for_shipment(uuid,mto_service_item_type[]); +CREATE OR REPLACE PROCEDURE create_accessorial_service_items_for_shipment ( + IN shipment_id UUID, + IN service_items mto_service_item_type[], + INOUT created_service_item_ids text[] +) AS ' +DECLARE + s_type mto_shipment_type; + m_code market_code_enum; + move_id UUID; + service_item RECORD; + item mto_service_item_type; + new_service_id text; +BEGIN + -- get the shipment type, market code, and move_id based on shipment_id + SELECT ms.shipment_type, ms.market_code, ms.move_id + INTO s_type, m_code, move_id + FROM mto_shipments ms + WHERE ms.id = shipment_id; + + IF s_type IS NULL OR m_code IS NULL THEN + RAISE EXCEPTION ''Shipment with ID % not found or missing required details.'', shipment_id; + END IF; + + -- loop through each provided service item object + FOREACH item IN ARRAY service_items + LOOP + FOR service_item IN + SELECT rsi.id, + rs.id AS re_service_id, + rs.service_location, + rsi.is_auto_approved, + rs.code AS service_code + FROM re_service_items rsi + JOIN re_services rs ON rsi.service_id = rs.id + WHERE rsi.shipment_type = s_type + AND rsi.market_code = m_code + AND rs.code = (item.re_service_code) + AND rsi.is_auto_approved = false + LOOP + BEGIN + IF NOT does_service_item_exist(service_item.re_service_id, shipment_id) THEN + INSERT INTO mto_service_items ( + mto_shipment_id, + move_id, + re_service_id, + service_location, + status, + created_at, + updated_at, + sit_postal_code, + sit_entry_date, + sit_customer_contacted, + reason, + estimated_weight, + actual_weight, + pickup_postal_code, + description, + sit_destination_original_address_id, + sit_destination_final_address_id, + sit_requested_delivery, + sit_departure_date, + sit_origin_hhg_original_address_id, + sit_origin_hhg_actual_address_id, + customer_expense, + customer_expense_reason, + sit_delivery_miles, + standalone_crate + ) + VALUES ( + shipment_id, + move_id, + service_item.re_service_id, + service_item.service_location, + ''SUBMITTED''::service_item_status, + NOW(), + NOW(), + (item).sit_postal_code, + (item).sit_entry_date, + (item).sit_customer_contacted, + (item).reason, + (item).estimated_weight, + (item).actual_weight, + (item).pickup_postal_code, + (item).description, + (item).sit_destination_original_address_id, + (item).sit_destination_final_address_id, + (item).sit_requested_delivery, + (item).sit_departure_date, + (item).sit_origin_hhg_original_address_id, + (item).sit_origin_hhg_actual_address_id, + (item).customer_expense, + (item).customer_expense_reason, + (item).sit_delivery_miles, + (item).standalone_crate + ) RETURNING id INTO new_service_id; + + created_service_item_ids := array_append(created_service_item_ids, new_service_id); + + END IF; + EXCEPTION + WHEN OTHERS THEN + RAISE EXCEPTION ''Error creating accessorial service item with code % for shipment %: %'', + service_item.service_code, shipment_id, SQLERRM; + END; + END LOOP; + END LOOP; + + UPDATE moves SET status = ''APPROVALS REQUESTED'' WHERE id = move_id; +END; +' +LANGUAGE plpgsql; \ No newline at end of file diff --git a/migrations/app/schema/20250121153007_update_pricing_proc_to_handle_international_shuttle.up.sql b/migrations/app/schema/20250121153007_update_pricing_proc_to_handle_international_shuttle.up.sql new file mode 100644 index 00000000000..834525f7a6d --- /dev/null +++ b/migrations/app/schema/20250121153007_update_pricing_proc_to_handle_international_shuttle.up.sql @@ -0,0 +1,213 @@ +-- function to calculate the escalated price, takes in: +-- origin rate area +-- dest rate area +-- re_services id +-- contract id +-- adding the is_peak_period check to refine the price query further +CREATE OR REPLACE FUNCTION calculate_escalated_price( + o_rate_area_id UUID, + d_rate_area_id UUID, + re_service_id UUID, + c_id UUID, + service_code TEXT, + requested_pickup_date DATE +) RETURNS NUMERIC AS $$ +DECLARE + per_unit_cents NUMERIC; + escalation_factor NUMERIC; + escalated_price NUMERIC; + is_oconus BOOLEAN; + peak_period BOOLEAN; +BEGIN + -- we need to query the appropriate table based on the service code + -- need to establish if the shipment is being moved during peak period + peak_period := is_peak_period(requested_pickup_date); + IF service_code IN ('IOSHUT','IDSHUT') THEN + IF service_code = 'IOSHUT' THEN + SELECT ra.is_oconus + INTO is_oconus + FROM re_rate_areas ra + WHERE ra.id = o_rate_area_id; + ELSE + SELECT ra.is_oconus + INTO is_oconus + FROM re_rate_areas ra + WHERE ra.id = d_rate_area_id; + END IF; + + SELECT rip.per_unit_cents + INTO per_unit_cents + FROM re_intl_accessorial_prices rip + WHERE + rip.market = (CASE + WHEN is_oconus THEN 'O' + ELSE 'C' + END) + AND rip.service_id = re_service_id + AND rip.contract_id = c_id; + ELSIF service_code IN ('ISLH', 'UBP') THEN + SELECT rip.per_unit_cents + INTO per_unit_cents + FROM re_intl_prices rip + WHERE rip.origin_rate_area_id = o_rate_area_id AND rip.destination_rate_area_id = d_rate_area_id + AND rip.service_id = re_service_id + AND rip.contract_id = c_id + AND rip.is_peak_period = peak_period; + ELSE + SELECT riop.per_unit_cents + INTO per_unit_cents + FROM re_intl_other_prices riop + WHERE (riop.rate_area_id = o_rate_area_id OR riop.rate_area_id = d_rate_area_id OR + (o_rate_area_id IS NULL AND d_rate_area_id IS NULL)) + AND riop.service_id = re_service_id + AND riop.contract_id = c_id + AND riop.is_peak_period = peak_period; + END IF; + + RAISE NOTICE '% per unit cents: %', service_code, per_unit_cents; + IF per_unit_cents IS NULL THEN + RAISE EXCEPTION 'No per unit cents found for service item id: %, origin rate area: %, dest rate area: %, and contract_id: %', re_service_id, o_rate_area_id, d_rate_area_id, c_id; + END IF; + + SELECT rcy.escalation_compounded + INTO escalation_factor + FROM re_contract_years rcy + WHERE rcy.contract_id = c_id + AND requested_pickup_date BETWEEN rcy.start_date AND rcy.end_date; + + IF escalation_factor IS NULL THEN + RAISE EXCEPTION 'Escalation factor not found for contract_id %', c_id; + END IF; + -- calculate the escalated price, return in dollars (dividing by 100) + per_unit_cents := per_unit_cents / 100; -- putting in dollars + escalated_price := ROUND(per_unit_cents * escalation_factor, 2); -- rounding to two decimals (100.00) + + RETURN escalated_price; +END; +$$ LANGUAGE plpgsql; + +--Updating proc to handle IDSHUT and IOSHUT service items +CREATE OR REPLACE PROCEDURE update_service_item_pricing( + shipment_id UUID, + mileage INT +) AS +' +DECLARE + shipment RECORD; + service_item RECORD; + escalated_price NUMERIC; + estimated_price NUMERIC; + o_rate_area_id UUID; + d_rate_area_id UUID; + contract_id UUID; + service_code TEXT; + o_zip_code TEXT; + d_zip_code TEXT; + distance NUMERIC; + estimated_fsc_multiplier NUMERIC; + fuel_price NUMERIC; + cents_above_baseline NUMERIC; + price_difference NUMERIC; +BEGIN + SELECT ms.id, ms.pickup_address_id, ms.destination_address_id, ms.requested_pickup_date, ms.prime_estimated_weight + INTO shipment + FROM mto_shipments ms + WHERE ms.id = shipment_id; + + IF shipment IS NULL THEN + RAISE EXCEPTION ''Shipment with ID % not found'', shipment_id; + END IF; + + -- exit the proc if prime_estimated_weight is NULL + IF shipment.prime_estimated_weight IS NULL THEN + RETURN; + END IF; + + -- loop through service items in the shipment + FOR service_item IN + SELECT si.id, si.re_service_id + FROM mto_service_items si + WHERE si.mto_shipment_id = shipment_id + LOOP + -- get the service code for the current service item to determine calculation + SELECT code + INTO service_code + FROM re_services + WHERE id = service_item.re_service_id; + + CASE + WHEN service_code IN (''ISLH'', ''UBP'') THEN + contract_id := get_contract_id(shipment.requested_pickup_date); + o_rate_area_id := get_rate_area_id(shipment.pickup_address_id, service_item.re_service_id, contract_id); + d_rate_area_id := get_rate_area_id(shipment.destination_address_id, service_item.re_service_id, contract_id); + escalated_price := calculate_escalated_price(o_rate_area_id, d_rate_area_id, service_item.re_service_id, contract_id, service_code, shipment.requested_pickup_date); + + IF shipment.prime_estimated_weight IS NOT NULL THEN + -- multiply by 110% of estimated weight + estimated_price := ROUND((escalated_price * (shipment.prime_estimated_weight * 1.1) / 100), 2) * 100; + RAISE NOTICE ''%: Received estimated price of % (% * (% * 1.1) / 100)) cents'', service_code, estimated_price, escalated_price, shipment.prime_estimated_weight; + -- update the pricing_estimate value in mto_service_items + UPDATE mto_service_items + SET pricing_estimate = estimated_price + WHERE id = service_item.id; + END IF; + + WHEN service_code IN (''IHPK'', ''IUBPK'', ''IOSHUT'') THEN + -- perform IHPK/IUBPK-specific logic (no destination rate area) + contract_id := get_contract_id(shipment.requested_pickup_date); + o_rate_area_id := get_rate_area_id(shipment.pickup_address_id, service_item.re_service_id, contract_id); + escalated_price := calculate_escalated_price(o_rate_area_id, NULL, service_item.re_service_id, contract_id, service_code, shipment.requested_pickup_date); + + IF shipment.prime_estimated_weight IS NOT NULL THEN + -- multiply by 110% of estimated weight + estimated_price := ROUND((escalated_price * (shipment.prime_estimated_weight * 1.1) / 100), 2) * 100; + RAISE NOTICE ''%: Received estimated price of % (% * (% * 1.1) / 100)) cents'', service_code, estimated_price, escalated_price, shipment.prime_estimated_weight; + -- update the pricing_estimate value in mto_service_items + UPDATE mto_service_items + SET pricing_estimate = estimated_price + WHERE id = service_item.id; + END IF; + + WHEN service_code IN (''IHUPK'', ''IUBUPK'', ''IDSHUT'') THEN + -- perform IHUPK/IUBUPK-specific logic (no origin rate area) + contract_id := get_contract_id(shipment.requested_pickup_date); + d_rate_area_id := get_rate_area_id(shipment.destination_address_id, service_item.re_service_id, contract_id); + escalated_price := calculate_escalated_price(NULL, d_rate_area_id, service_item.re_service_id, contract_id, service_code, shipment.requested_pickup_date); + + IF shipment.prime_estimated_weight IS NOT NULL THEN + -- multiply by 110% of estimated weight + estimated_price := ROUND((escalated_price * (shipment.prime_estimated_weight * 1.1) / 100), 2) * 100; + RAISE NOTICE ''%: Received estimated price of % (% * (% * 1.1) / 100)) cents'', service_code, estimated_price, escalated_price, shipment.prime_estimated_weight; + -- update the pricing_estimate value in mto_service_items + UPDATE mto_service_items + SET pricing_estimate = estimated_price + WHERE id = service_item.id; + END IF; + + WHEN service_code IN (''POEFSC'', ''PODFSC'') THEN + distance = mileage; + + -- getting FSC multiplier from re_fsc_multipliers + estimated_fsc_multiplier := get_fsc_multiplier(shipment.prime_estimated_weight); + + fuel_price := get_fuel_price(shipment.requested_pickup_date); + + price_difference := calculate_price_difference(fuel_price); + + IF estimated_fsc_multiplier IS NOT NULL AND distance IS NOT NULL THEN + cents_above_baseline := distance * estimated_fsc_multiplier; + RAISE NOTICE ''Distance: % * FSC Multipler: % = $% cents above baseline of $2.50'', distance, estimated_fsc_multiplier, cents_above_baseline; + RAISE NOTICE ''The fuel price is % above the baseline (% - 250000 baseline)'', price_difference, fuel_price; + estimated_price := ROUND((cents_above_baseline * price_difference) * 100); + RAISE NOTICE ''Received estimated price of % cents for service_code: %.'', estimated_price, service_code; + + -- update the pricing_estimate value in mto_service_items + UPDATE mto_service_items + SET pricing_estimate = estimated_price + WHERE id = service_item.id; + END IF; + END CASE; + END LOOP; +END; +' +LANGUAGE plpgsql; \ No newline at end of file diff --git a/migrations/app/secure/20250110214012_homesafeconnect_cert.up.sql b/migrations/app/secure/20250110214012_homesafeconnect_cert.up.sql deleted file mode 100644 index f9862f58a7c..00000000000 --- a/migrations/app/secure/20250110214012_homesafeconnect_cert.up.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Local test migration. --- This will be run on development environments. --- It should mirror what you intend to apply on prd/stg/exp/demo --- DO NOT include any sensitive data. diff --git a/package.json b/package.json index 77eeb2bcc59..5fb79cde889 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "reselect": "^4.1.8", "sass": "^1.77.6", "swagger-client": "^3.18.5", - "swagger-ui-dist": "^5.18.2", + "swagger-ui-dist": "^5.2.0", "uswds": "2.13.3", "uuid": "^9.0.0", "webpack": "5", diff --git a/pkg/factory/admin_user_factory_test.go b/pkg/factory/admin_user_factory_test.go index cea44d54de2..6e7d2cdf47c 100644 --- a/pkg/factory/admin_user_factory_test.go +++ b/pkg/factory/admin_user_factory_test.go @@ -211,3 +211,72 @@ func (suite *FactorySuite) TestBuildAdminUserExtra() { suite.Equal(adminUser.Email, adminUser.User.OktaEmail) }) } +func (suite *FactorySuite) TestSuperBuildAdminUser() { + defaultEmail := "first.last@okta.mil" + suite.Run("Successful creation of super admin user", func() { + // Under test: BuildSuperAdminUser + // Mocked: None + // Set up: Create a User with no customizations or traits + // Expected outcome:User should be created with default values + defaultAdmin := models.AdminUser{ + FirstName: "Leo", + LastName: "Spaceman", + Email: "super_leo_spaceman_admin@example.com", + Role: "SYSTEM_ADMIN", + Super: true, + } + + adminUser := BuildSuperAdminUser(suite.DB(), nil, nil) + suite.Equal(defaultEmail, adminUser.User.OktaEmail) + suite.Equal(defaultAdmin.FirstName, adminUser.FirstName) + suite.Equal(defaultAdmin.LastName, adminUser.LastName) + suite.Equal(defaultAdmin.Email, adminUser.Email) + suite.Equal(defaultAdmin.Role, adminUser.Role) + suite.Equal(defaultAdmin.Super, adminUser.Super) + suite.True(adminUser.User.Active) + }) + + suite.Run("Successful creation of a super adminUser with trait", func() { + // Under test: BuildSuperAdminUser + // Mocked: None + // Set up: Create a User but pass in a trait that sets + // both the adminuser and user email to a random + // value, as adminuser has uniqueness constraints + // Expected outcome:AdminUser should have the same random email as User + + adminUser := BuildSuperAdminUser(suite.DB(), nil, []Trait{ + GetTraitAdminUserEmail, + }) + suite.Equal(adminUser.Email, adminUser.User.OktaEmail) + suite.True(adminUser.User.Active) + }) + + suite.Run("Successful creation of user with customization", func() { + // Under test: BuildSuperAdminUser + // Set up: Create an adminUser and pass in specified emails + // Expected outcome:adminUser and User should be created with specified emails + customAdmin := models.AdminUser{ + FirstName: "Leo", + LastName: "Spaceman", + Email: "super_leo_spaceman_admin@example.com", + Role: "SYSTEM_ADMIN", + Super: true, + Active: true, + } + customEmail := "leospaceman456@example.com" + adminUser := BuildSuperAdminUser(suite.DB(), []Customization{ + { + Model: models.User{ + OktaEmail: customEmail, + }, + }, + {Model: customAdmin}, + }, nil) + suite.Equal(customEmail, adminUser.User.OktaEmail) + suite.Equal(customAdmin.Email, adminUser.Email) + suite.Equal(customAdmin.FirstName, adminUser.FirstName) + suite.Equal(customAdmin.LastName, adminUser.LastName) + suite.Equal(customAdmin.Role, adminUser.Role) + suite.True(adminUser.User.Active) + }) +} diff --git a/pkg/gen/primeapi/embedded_spec.go b/pkg/gen/primeapi/embedded_spec.go index 60e069b85f2..c4dfc4fb5b2 100644 --- a/pkg/gen/primeapi/embedded_spec.go +++ b/pkg/gen/primeapi/embedded_spec.go @@ -355,7 +355,7 @@ func init() { }, "/mto-service-items/{mtoServiceItemID}": { "patch": { - "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT service items: This endpoint will handle the logic of changing the status of rejected SIT service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n", + "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT/Accessorial service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n\nThe following Accessorial service items can be resubmitted following a rejection:\n- IOSHUT\n- IDSHUT\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n", "consumes": [ "application/json" ], @@ -1063,7 +1063,7 @@ func init() { }, "/payment-requests": { "post": { - "description": "Creates a new instance of a paymentRequest and is assigned the status ` + "`" + `PENDING` + "`" + `.\nA move task order can have multiple payment requests, and\na final payment request can be marked using boolean ` + "`" + `isFinal` + "`" + `.\n\nIf a ` + "`" + `PENDING` + "`" + ` payment request is recalculated,\na new payment request is created and the original request is\nmarked with the status ` + "`" + `DEPRECATED` + "`" + `.\n\n**NOTE**: In order to create a payment request for most service items, the shipment *must*\nbe updated with the ` + "`" + `PrimeActualWeight` + "`" + ` value via [updateMTOShipment](#operation/updateMTOShipment).\n\nIf ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n\n**NOTE**: Diversions have a unique calcuation for payment requests without a ` + "`" + `WeightBilled` + "`" + ` parameter.\n\nIf you created a payment request for a diversion and ` + "`" + `WeightBilled` + "`" + ` is not provided, then the following will be used in the calculation:\n- The lowest shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) found in the diverted shipment chain.\n- The lowest reweigh weight found in the diverted shipment chain.\n\nThe diverted shipment chain is created by referencing the ` + "`" + `diversion` + "`" + ` boolean, ` + "`" + `divertedFromShipmentId` + "`" + ` UUID, and matching destination to pickup addresses.\nIf the chain cannot be established it will fall back to the ` + "`" + `PrimeActualWeight` + "`" + ` of the current shipment. This is utilized because diverted shipments are all one single shipment, but going to different locations.\nThe lowest weight found is the true shipment weight, and thus we search the chain of shipments for the lowest weight found.\n\nA service item can be on several payment requests in the case of partial payment requests and payments.\n\nIn the request, if no params are necessary, then just the ` + "`" + `serviceItem` + "`" + ` ` + "`" + `id` + "`" + ` is required. For example:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"isFinal\": false,\n \"moveTaskOrderID\": \"uuid\",\n \"serviceItems\": [\n {\n \"id\": \"uuid\",\n },\n {\n \"id\": \"uuid\",\n \"params\": [\n {\n \"key\": \"Service Item Parameter Name\",\n \"value\": \"Service Item Parameter Value\"\n }\n ]\n }\n ],\n \"pointOfContact\": \"string\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DLH - Domestic Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DSH - Domestic Shorthaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**FSC - Fuel Surcharge**\n**NOTE**: FSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DUPK - Domestic Unpacking**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DNPK - Domestic NTS Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOP - Domestic Origin Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDP - Domestic Destination Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic SIT Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DOFSIT - Domestic origin 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOASIT - Domestic origin add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOPSIT - Domestic origin SIT pickup**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOSHUT - Domestic origin shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDFSIT - Domestic destination 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDASIT - Domestic destination add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDDSIT - Domestic destination SIT delivery**\n*To create a paymentRequest for this service item, it must first have a final address set via [updateMTOServiceItem](#operation/updateMTOServiceItem).*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDSHUT - Domestic destination shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n\nInternational Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\nJust like domestic shipments \u0026 service items, if ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n**NOTE**: ` + "`" + `POEFSC` + "`" + ` \u0026 ` + "`" + `PODFSC` + "`" + ` service items must have a port associated on the service item in order to successfully add it to a payment request. To update the port of a service item, you must use the (#operation/updateMTOServiceItem) endpoint.\n\n**ISLH - International Shipping \u0026 Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHPK - International HHG Pack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHUPK - International HHG Unpack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**POEFSC - International Port of Embarkation Fuel Surcharge**\n **NOTE**: POEFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `POELocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**PODFSC - International Port of Debarkation Fuel Surcharge**\n**NOTE**: PODFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `PODLocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n", + "description": "Creates a new instance of a paymentRequest and is assigned the status ` + "`" + `PENDING` + "`" + `.\nA move task order can have multiple payment requests, and\na final payment request can be marked using boolean ` + "`" + `isFinal` + "`" + `.\n\nIf a ` + "`" + `PENDING` + "`" + ` payment request is recalculated,\na new payment request is created and the original request is\nmarked with the status ` + "`" + `DEPRECATED` + "`" + `.\n\n**NOTE**: In order to create a payment request for most service items, the shipment *must*\nbe updated with the ` + "`" + `PrimeActualWeight` + "`" + ` value via [updateMTOShipment](#operation/updateMTOShipment).\n\nIf ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n\n**NOTE**: Diversions have a unique calcuation for payment requests without a ` + "`" + `WeightBilled` + "`" + ` parameter.\n\nIf you created a payment request for a diversion and ` + "`" + `WeightBilled` + "`" + ` is not provided, then the following will be used in the calculation:\n- The lowest shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) found in the diverted shipment chain.\n- The lowest reweigh weight found in the diverted shipment chain.\n\nThe diverted shipment chain is created by referencing the ` + "`" + `diversion` + "`" + ` boolean, ` + "`" + `divertedFromShipmentId` + "`" + ` UUID, and matching destination to pickup addresses.\nIf the chain cannot be established it will fall back to the ` + "`" + `PrimeActualWeight` + "`" + ` of the current shipment. This is utilized because diverted shipments are all one single shipment, but going to different locations.\nThe lowest weight found is the true shipment weight, and thus we search the chain of shipments for the lowest weight found.\n\nA service item can be on several payment requests in the case of partial payment requests and payments.\n\nIn the request, if no params are necessary, then just the ` + "`" + `serviceItem` + "`" + ` ` + "`" + `id` + "`" + ` is required. For example:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"isFinal\": false,\n \"moveTaskOrderID\": \"uuid\",\n \"serviceItems\": [\n {\n \"id\": \"uuid\",\n },\n {\n \"id\": \"uuid\",\n \"params\": [\n {\n \"key\": \"Service Item Parameter Name\",\n \"value\": \"Service Item Parameter Value\"\n }\n ]\n }\n ],\n \"pointOfContact\": \"string\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DLH - Domestic Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DSH - Domestic Shorthaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**FSC - Fuel Surcharge**\n**NOTE**: FSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DUPK - Domestic Unpacking**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DNPK - Domestic NTS Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOP - Domestic Origin Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDP - Domestic Destination Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic SIT Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DOFSIT - Domestic origin 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOASIT - Domestic origin add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOPSIT - Domestic origin SIT pickup**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOSHUT - Domestic origin shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDFSIT - Domestic destination 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDASIT - Domestic destination add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDDSIT - Domestic destination SIT delivery**\n*To create a paymentRequest for this service item, it must first have a final address set via [updateMTOServiceItem](#operation/updateMTOServiceItem).*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDSHUT - Domestic destination shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n\nInternational Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\nJust like domestic shipments \u0026 service items, if ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n**NOTE**: ` + "`" + `POEFSC` + "`" + ` \u0026 ` + "`" + `PODFSC` + "`" + ` service items must have a port associated on the service item in order to successfully add it to a payment request. To update the port of a service item, you must use the (#operation/updateMTOServiceItem) endpoint.\n\n**ISLH - International Shipping \u0026 Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHPK - International HHG Pack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHUPK - International HHG Unpack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**POEFSC - International Port of Embarkation Fuel Surcharge**\n **NOTE**: POEFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `POELocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**PODFSC - International Port of Debarkation Fuel Surcharge**\n**NOTE**: PODFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `PODLocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n\nInternational Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\n**IOSHUT - International origin shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IDSHUT - International destination shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n", "consumes": [ "application/json" ], @@ -2427,14 +2427,73 @@ func init() { } ] }, + "MTOServiceItemInternationalShuttle": { + "description": "Describes an international shuttle service item.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reason", + "reServiceCode" + ], + "properties": { + "actualWeight": { + "description": "A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in the shuttling service.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "market": { + "description": "To identify whether the service was provided within (CONUS) or (OCONUS)", + "type": "string", + "enum": [ + "CONUS", + "OCONUS" + ], + "example": "CONUS" + }, + "reServiceCode": { + "description": "A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (` + "`" + `IOSHUT` + "`" + `) or destination (` + "`" + `IDSHUT` + "`" + `).\n", + "type": "string", + "enum": [ + "IOSHUT", + "IDSHUT" + ] + }, + "reason": { + "description": "The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item.\n", + "type": "string", + "example": "Storage items need to be picked up." + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", "MTOSerivceItemInternationalFuelSurcharge" @@ -4038,13 +4097,54 @@ func init() { } ] }, + "UpdateMTOServiceItemInternationalShuttle": { + "description": "Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item.\n", + "allOf": [ + { + "$ref": "#/definitions/UpdateMTOServiceItem" + }, + { + "type": "object", + "properties": { + "actualWeight": { + "description": "Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT \u0026 IOSHUT) service items.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT \u0026 IOSHUT) service item.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDSHUT", + "IOSHUT" + ] + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", "UpdateMTOServiceItemShuttle", - "UpdateMTOServiceItemInternationalPortFSC" + "UpdateMTOServiceItemInternationalPortFSC", + "UpdateMTOServiceItemInternationalShuttle" ] }, "UpdateMTOServiceItemSIT": { @@ -5057,7 +5157,7 @@ func init() { }, "/mto-service-items/{mtoServiceItemID}": { "patch": { - "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT service items: This endpoint will handle the logic of changing the status of rejected SIT service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n", + "description": "Updates MTOServiceItems after creation. Not all service items or fields may be updated, please see details below.\n\nThis endpoint supports different body definitions. In the modelType field below, select the modelType corresponding\n to the service item you wish to update and the documentation will update with the new definition.\n\n* Addresses: To update a destination service item's SIT destination final address, update the shipment delivery address.\nFor approved shipments, please use [updateShipmentDestinationAddress](#mtoShipment/updateShipmentDestinationAddress).\nFor shipments not yet approved, please use [updateMTOShipmentAddress](#mtoShipment/updateMTOShipmentAddress).\n\n* SIT Service Items: Take note that when updating ` + "`" + `sitCustomerContacted` + "`" + `, ` + "`" + `sitDepartureDate` + "`" + `, or ` + "`" + `sitRequestedDelivery` + "`" + `, we want\nthose to be updated on ` + "`" + `DOASIT` + "`" + ` (for origin SIT) and ` + "`" + `DDASIT` + "`" + ` (for destination SIT). If updating those values in other service\nitems, the office users will not have as much attention to those values.\n\nTo create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint.\n\n* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from\nREJECTED to SUBMITTED. Please provide the ` + "`" + `requestedApprovalsRequestedStatus: true` + "`" + ` when resubmitting as this will give attention to the TOO to\nreview the resubmitted SIT/Accessorial service item. Another note, ` + "`" + `updateReason` + "`" + ` must have a different value than the current ` + "`" + `reason` + "`" + ` value on the service item.\nIf this value is not updated, then an error will be sent back.\n\nThe following SIT service items can be resubmitted following a rejection:\n- DDASIT\n- DDDSIT\n- DDFSIT\n- DOASIT\n- DOPSIT\n- DOFSIT\n- DDSFSC\n- DOSFSC\n\nThe following Accessorial service items can be resubmitted following a rejection:\n- IOSHUT\n- IDSHUT\n\nAt a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"reServiceCode\": \"DDFSIT\",\n \"updateReason\": \"A reason that differs from the previous reason\",\n \"modelType\": \"UpdateMTOServiceItemSIT\",\n \"requestApprovalsRequestedStatus\": true\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nThe following service items allow you to update the Port that the shipment will use:\n- PODFSC (Port of Debarkation can be updated)\n- POEFSC (Port of Embarkation can be updated)\n\nAt a MINIMUM, the payload for updating the port should contain the reServiceCode (PODFSC or POEFSC), modelType (UpdateMTOServiceItemInternationalPortFSC), portCode, and id for the service item.\nPlease see the example payload below:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"id\": \"1ed224b6-c65e-4616-b88e-8304d26c9562\",\n \"modelType\": \"UpdateMTOServiceItemInternationalPortFSC\",\n \"portCode\": \"SEA\",\n \"reServiceCode\": \"POEFSC\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n", "consumes": [ "application/json" ], @@ -6004,7 +6104,7 @@ func init() { }, "/payment-requests": { "post": { - "description": "Creates a new instance of a paymentRequest and is assigned the status ` + "`" + `PENDING` + "`" + `.\nA move task order can have multiple payment requests, and\na final payment request can be marked using boolean ` + "`" + `isFinal` + "`" + `.\n\nIf a ` + "`" + `PENDING` + "`" + ` payment request is recalculated,\na new payment request is created and the original request is\nmarked with the status ` + "`" + `DEPRECATED` + "`" + `.\n\n**NOTE**: In order to create a payment request for most service items, the shipment *must*\nbe updated with the ` + "`" + `PrimeActualWeight` + "`" + ` value via [updateMTOShipment](#operation/updateMTOShipment).\n\nIf ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n\n**NOTE**: Diversions have a unique calcuation for payment requests without a ` + "`" + `WeightBilled` + "`" + ` parameter.\n\nIf you created a payment request for a diversion and ` + "`" + `WeightBilled` + "`" + ` is not provided, then the following will be used in the calculation:\n- The lowest shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) found in the diverted shipment chain.\n- The lowest reweigh weight found in the diverted shipment chain.\n\nThe diverted shipment chain is created by referencing the ` + "`" + `diversion` + "`" + ` boolean, ` + "`" + `divertedFromShipmentId` + "`" + ` UUID, and matching destination to pickup addresses.\nIf the chain cannot be established it will fall back to the ` + "`" + `PrimeActualWeight` + "`" + ` of the current shipment. This is utilized because diverted shipments are all one single shipment, but going to different locations.\nThe lowest weight found is the true shipment weight, and thus we search the chain of shipments for the lowest weight found.\n\nA service item can be on several payment requests in the case of partial payment requests and payments.\n\nIn the request, if no params are necessary, then just the ` + "`" + `serviceItem` + "`" + ` ` + "`" + `id` + "`" + ` is required. For example:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"isFinal\": false,\n \"moveTaskOrderID\": \"uuid\",\n \"serviceItems\": [\n {\n \"id\": \"uuid\",\n },\n {\n \"id\": \"uuid\",\n \"params\": [\n {\n \"key\": \"Service Item Parameter Name\",\n \"value\": \"Service Item Parameter Value\"\n }\n ]\n }\n ],\n \"pointOfContact\": \"string\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DLH - Domestic Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DSH - Domestic Shorthaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**FSC - Fuel Surcharge**\n**NOTE**: FSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DUPK - Domestic Unpacking**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DNPK - Domestic NTS Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOP - Domestic Origin Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDP - Domestic Destination Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic SIT Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DOFSIT - Domestic origin 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOASIT - Domestic origin add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOPSIT - Domestic origin SIT pickup**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOSHUT - Domestic origin shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDFSIT - Domestic destination 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDASIT - Domestic destination add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDDSIT - Domestic destination SIT delivery**\n*To create a paymentRequest for this service item, it must first have a final address set via [updateMTOServiceItem](#operation/updateMTOServiceItem).*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDSHUT - Domestic destination shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n\nInternational Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\nJust like domestic shipments \u0026 service items, if ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n**NOTE**: ` + "`" + `POEFSC` + "`" + ` \u0026 ` + "`" + `PODFSC` + "`" + ` service items must have a port associated on the service item in order to successfully add it to a payment request. To update the port of a service item, you must use the (#operation/updateMTOServiceItem) endpoint.\n\n**ISLH - International Shipping \u0026 Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHPK - International HHG Pack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHUPK - International HHG Unpack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**POEFSC - International Port of Embarkation Fuel Surcharge**\n **NOTE**: POEFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `POELocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**PODFSC - International Port of Debarkation Fuel Surcharge**\n**NOTE**: PODFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `PODLocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n", + "description": "Creates a new instance of a paymentRequest and is assigned the status ` + "`" + `PENDING` + "`" + `.\nA move task order can have multiple payment requests, and\na final payment request can be marked using boolean ` + "`" + `isFinal` + "`" + `.\n\nIf a ` + "`" + `PENDING` + "`" + ` payment request is recalculated,\na new payment request is created and the original request is\nmarked with the status ` + "`" + `DEPRECATED` + "`" + `.\n\n**NOTE**: In order to create a payment request for most service items, the shipment *must*\nbe updated with the ` + "`" + `PrimeActualWeight` + "`" + ` value via [updateMTOShipment](#operation/updateMTOShipment).\n\nIf ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n\n**NOTE**: Diversions have a unique calcuation for payment requests without a ` + "`" + `WeightBilled` + "`" + ` parameter.\n\nIf you created a payment request for a diversion and ` + "`" + `WeightBilled` + "`" + ` is not provided, then the following will be used in the calculation:\n- The lowest shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) found in the diverted shipment chain.\n- The lowest reweigh weight found in the diverted shipment chain.\n\nThe diverted shipment chain is created by referencing the ` + "`" + `diversion` + "`" + ` boolean, ` + "`" + `divertedFromShipmentId` + "`" + ` UUID, and matching destination to pickup addresses.\nIf the chain cannot be established it will fall back to the ` + "`" + `PrimeActualWeight` + "`" + ` of the current shipment. This is utilized because diverted shipments are all one single shipment, but going to different locations.\nThe lowest weight found is the true shipment weight, and thus we search the chain of shipments for the lowest weight found.\n\nA service item can be on several payment requests in the case of partial payment requests and payments.\n\nIn the request, if no params are necessary, then just the ` + "`" + `serviceItem` + "`" + ` ` + "`" + `id` + "`" + ` is required. For example:\n` + "`" + `` + "`" + `` + "`" + `json\n{\n \"isFinal\": false,\n \"moveTaskOrderID\": \"uuid\",\n \"serviceItems\": [\n {\n \"id\": \"uuid\",\n },\n {\n \"id\": \"uuid\",\n \"params\": [\n {\n \"key\": \"Service Item Parameter Name\",\n \"value\": \"Service Item Parameter Value\"\n }\n ]\n }\n ],\n \"pointOfContact\": \"string\"\n}\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DLH - Domestic Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DSH - Domestic Shorthaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**FSC - Fuel Surcharge**\n**NOTE**: FSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DUPK - Domestic Unpacking**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DNPK - Domestic NTS Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DPK - Domestic Packing**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOP - Domestic Origin Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDP - Domestic Destination Price**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\nDomestic SIT Service Items \u0026 Accepted Payment Request Parameters:\n---\n\n**DOFSIT - Domestic origin 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOASIT - Domestic origin add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOPSIT - Domestic origin SIT pickup**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DOSHUT - Domestic origin shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDFSIT - Domestic destination 1st day SIT**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDASIT - Domestic destination add'l SIT** *(SITPaymentRequestStart \u0026 SITPaymentRequestEnd are **REQUIRED**)*\n*To create a paymentRequest for this service item, the ` + "`" + `SITPaymentRequestStart` + "`" + ` and ` + "`" + `SITPaymentRequestEnd` + "`" + ` dates must not overlap previously requested SIT dates.*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n },\n {\n \"key\": \"SITPaymentRequestStart\",\n \"value\": \"date\"\n },\n {\n \"key\": \"SITPaymentRequestEnd\",\n \"value\": \"date\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDDSIT - Domestic destination SIT delivery**\n*To create a paymentRequest for this service item, it must first have a final address set via [updateMTOServiceItem](#operation/updateMTOServiceItem).*\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**DDSHUT - Domestic destination shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n\nInternational Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\nJust like domestic shipments \u0026 service items, if ` + "`" + `WeightBilled` + "`" + ` is not provided then the full shipment weight (` + "`" + `PrimeActualWeight` + "`" + `) will be considered in the calculation.\n**NOTE**: ` + "`" + `POEFSC` + "`" + ` \u0026 ` + "`" + `PODFSC` + "`" + ` service items must have a port associated on the service item in order to successfully add it to a payment request. To update the port of a service item, you must use the (#operation/updateMTOServiceItem) endpoint.\n\n**ISLH - International Shipping \u0026 Linehaul**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHPK - International HHG Pack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IHUPK - International HHG Unpack**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**POEFSC - International Port of Embarkation Fuel Surcharge**\n **NOTE**: POEFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `POELocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**PODFSC - International Port of Debarkation Fuel Surcharge**\n**NOTE**: PODFSC requires ` + "`" + `ActualPickupDate` + "`" + ` to be updated on the shipment \u0026 ` + "`" + `PODLocation` + "`" + ` on the service item.\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n\nInternational Basic Service Items \u0026 Accepted Payment Request Parameters:\n---\n**IOSHUT - International origin shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n\n**IDSHUT - International destination shuttle service**\n` + "`" + `` + "`" + `` + "`" + `json\n \"params\": [\n {\n \"key\": \"WeightBilled\",\n \"value\": \"integer\"\n }\n ]\n` + "`" + `` + "`" + `` + "`" + `\n---\n", "consumes": [ "application/json" ], @@ -7404,14 +7504,73 @@ func init() { } ] }, + "MTOServiceItemInternationalShuttle": { + "description": "Describes an international shuttle service item.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reason", + "reServiceCode" + ], + "properties": { + "actualWeight": { + "description": "A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in the shuttling service.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "market": { + "description": "To identify whether the service was provided within (CONUS) or (OCONUS)", + "type": "string", + "enum": [ + "CONUS", + "OCONUS" + ], + "example": "CONUS" + }, + "reServiceCode": { + "description": "A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (` + "`" + `IOSHUT` + "`" + `) or destination (` + "`" + `IDSHUT` + "`" + `).\n", + "type": "string", + "enum": [ + "IOSHUT", + "IDSHUT" + ] + }, + "reason": { + "description": "The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item.\n", + "type": "string", + "example": "Storage items need to be picked up." + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", "MTOSerivceItemInternationalFuelSurcharge" @@ -9020,13 +9179,54 @@ func init() { } ] }, + "UpdateMTOServiceItemInternationalShuttle": { + "description": "Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item.\n", + "allOf": [ + { + "$ref": "#/definitions/UpdateMTOServiceItem" + }, + { + "type": "object", + "properties": { + "actualWeight": { + "description": "Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT \u0026 IOSHUT) service items.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT \u0026 IOSHUT) service item.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDSHUT", + "IOSHUT" + ] + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DDFSIT - UpdateMTOServiceItemSIT\n * DDASIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DOSFSC - UpdateMTOServiceItemSIT\n * DDSFSC - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * PODFSC - UpdateMTOServiceItemInternationalPortFSC\n * POEFSC - UpdateMTOServiceItemInternationalPortFSC\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", "UpdateMTOServiceItemShuttle", - "UpdateMTOServiceItemInternationalPortFSC" + "UpdateMTOServiceItemInternationalPortFSC", + "UpdateMTOServiceItemInternationalShuttle" ] }, "UpdateMTOServiceItemSIT": { diff --git a/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go b/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go index d5ba2aa78de..8bfdb75c0f7 100644 --- a/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go +++ b/pkg/gen/primeapi/primeoperations/mto_service_item/update_m_t_o_service_item.go @@ -50,9 +50,9 @@ items, the office users will not have as much attention to those values. To create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint. -* Resubmitting rejected SIT service items: This endpoint will handle the logic of changing the status of rejected SIT service items from +* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from REJECTED to SUBMITTED. Please provide the `requestedApprovalsRequestedStatus: true` when resubmitting as this will give attention to the TOO to -review the resubmitted SIT service item. Another note, `updateReason` must have a different value than the current `reason` value on the service item. +review the resubmitted SIT/Accessorial service item. Another note, `updateReason` must have a different value than the current `reason` value on the service item. If this value is not updated, then an error will be sent back. The following SIT service items can be resubmitted following a rejection: @@ -65,7 +65,11 @@ The following SIT service items can be resubmitted following a rejection: - DDSFSC - DOSFSC -At a MINIMUM, the payload for resubmitting a rejected SIT service item must look like this: +The following Accessorial service items can be resubmitted following a rejection: +- IOSHUT +- IDSHUT + +At a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this: ```json { diff --git a/pkg/gen/primeapi/primeoperations/payment_request/create_payment_request.go b/pkg/gen/primeapi/primeoperations/payment_request/create_payment_request.go index d1ca6a38ab8..137229d55d1 100644 --- a/pkg/gen/primeapi/primeoperations/payment_request/create_payment_request.go +++ b/pkg/gen/primeapi/primeoperations/payment_request/create_payment_request.go @@ -382,6 +382,33 @@ Just like domestic shipments & service items, if `WeightBilled` is not provided } ] +``` +--- + +International Basic Service Items & Accepted Payment Request Parameters: +--- +**IOSHUT - International origin shuttle service** +```json + + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + +``` + +**IDSHUT - International destination shuttle service** +```json + + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + ``` --- */ diff --git a/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go b/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go index 1f1299ebd67..9fe2fa1212d 100644 --- a/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go +++ b/pkg/gen/primeclient/mto_service_item/mto_service_item_client.go @@ -233,9 +233,9 @@ items, the office users will not have as much attention to those values. To create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint. -* Resubmitting rejected SIT service items: This endpoint will handle the logic of changing the status of rejected SIT service items from +* Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from REJECTED to SUBMITTED. Please provide the `requestedApprovalsRequestedStatus: true` when resubmitting as this will give attention to the TOO to -review the resubmitted SIT service item. Another note, `updateReason` must have a different value than the current `reason` value on the service item. +review the resubmitted SIT/Accessorial service item. Another note, `updateReason` must have a different value than the current `reason` value on the service item. If this value is not updated, then an error will be sent back. The following SIT service items can be resubmitted following a rejection: @@ -248,7 +248,11 @@ The following SIT service items can be resubmitted following a rejection: - DDSFSC - DOSFSC -At a MINIMUM, the payload for resubmitting a rejected SIT service item must look like this: +The following Accessorial service items can be resubmitted following a rejection: +- IOSHUT +- IDSHUT + +At a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this: ```json { diff --git a/pkg/gen/primeclient/payment_request/payment_request_client.go b/pkg/gen/primeclient/payment_request/payment_request_client.go index b10b46d87cf..a2fba214717 100644 --- a/pkg/gen/primeclient/payment_request/payment_request_client.go +++ b/pkg/gen/primeclient/payment_request/payment_request_client.go @@ -389,6 +389,33 @@ Just like domestic shipments & service items, if `WeightBilled` is not provided } ] +``` +--- + +International Basic Service Items & Accepted Payment Request Parameters: +--- +**IOSHUT - International origin shuttle service** +```json + + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + +``` + +**IDSHUT - International destination shuttle service** +```json + + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + ``` --- */ diff --git a/pkg/gen/primemessages/m_t_o_service_item.go b/pkg/gen/primemessages/m_t_o_service_item.go index 1db2b84d144..5ed0f248ae0 100644 --- a/pkg/gen/primemessages/m_t_o_service_item.go +++ b/pkg/gen/primemessages/m_t_o_service_item.go @@ -285,6 +285,12 @@ func unmarshalMTOServiceItem(data []byte, consumer runtime.Consumer) (MTOService return nil, err } return &result, nil + case "MTOServiceItemInternationalShuttle": + var result MTOServiceItemInternationalShuttle + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemOriginSIT": var result MTOServiceItemOriginSIT if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primemessages/m_t_o_service_item_international_shuttle.go b/pkg/gen/primemessages/m_t_o_service_item_international_shuttle.go new file mode 100644 index 00000000000..7b7dbdf29de --- /dev/null +++ b/pkg/gen/primemessages/m_t_o_service_item_international_shuttle.go @@ -0,0 +1,701 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primemessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalShuttle Describes an international shuttle service item. +// +// swagger:model MTOServiceItemInternationalShuttle +type MTOServiceItemInternationalShuttle struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalShuttle) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalShuttle) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalShuttle) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalShuttle) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalShuttle) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalShuttle) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalShuttle) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalShuttle" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalShuttle) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalShuttle) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalShuttle) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalShuttle) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalShuttle) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalShuttle) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalShuttle) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalShuttle) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalShuttle) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalShuttle) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalShuttle) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalShuttle) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalShuttle) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalShuttle) UnmarshalJSON(raw []byte) error { + var data struct { + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalShuttle + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.ActualWeight = data.ActualWeight + result.EstimatedWeight = data.EstimatedWeight + result.Market = data.Market + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalShuttle) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + }{ + + ActualWeight: m.ActualWeight, + + EstimatedWeight: m.EstimatedWeight, + + Market: m.Market, + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international shuttle +func (m *MTOServiceItemInternationalShuttle) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMarket(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +var mTOServiceItemInternationalShuttleTypeMarketPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["CONUS","OCONUS"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalShuttleTypeMarketPropEnum = append(mTOServiceItemInternationalShuttleTypeMarketPropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalShuttle) validateMarketEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalShuttleTypeMarketPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMarket(formats strfmt.Registry) error { + + if swag.IsZero(m.Market) { // not required + return nil + } + + // value enum + if err := m.validateMarketEnum("market", "body", m.Market); err != nil { + return err + } + + return nil +} + +var mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IOSHUT","IDSHUT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum = append(mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalShuttle) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international shuttle based on the context it is used +func (m *MTOServiceItemInternationalShuttle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalShuttle) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalShuttle) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalShuttle + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primemessages/m_t_o_service_item_model_type.go b/pkg/gen/primemessages/m_t_o_service_item_model_type.go index ffdea3d8c15..9326c1377a1 100644 --- a/pkg/gen/primemessages/m_t_o_service_item_model_type.go +++ b/pkg/gen/primemessages/m_t_o_service_item_model_type.go @@ -20,6 +20,7 @@ import ( // - DOFSIT, DOASIT - MTOServiceItemOriginSIT // - DDFSIT, DDASIT - MTOServiceItemDestSIT // - DOSHUT, DDSHUT - MTOServiceItemShuttle +// - IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle // - DCRT, DUCRT - MTOServiceItemDomesticCrating // - ICRT, IUCRT - MTOServiceItemInternationalCrating // - PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -52,6 +53,9 @@ const ( // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" + // MTOServiceItemModelTypeMTOServiceItemInternationalShuttle captures enum value "MTOServiceItemInternationalShuttle" + MTOServiceItemModelTypeMTOServiceItemInternationalShuttle MTOServiceItemModelType = "MTOServiceItemInternationalShuttle" + // MTOServiceItemModelTypeMTOServiceItemDomesticCrating captures enum value "MTOServiceItemDomesticCrating" MTOServiceItemModelTypeMTOServiceItemDomesticCrating MTOServiceItemModelType = "MTOServiceItemDomesticCrating" @@ -67,7 +71,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primemessages/update_m_t_o_service_item.go b/pkg/gen/primemessages/update_m_t_o_service_item.go index 3afb12a256e..36fc059bd0a 100644 --- a/pkg/gen/primemessages/update_m_t_o_service_item.go +++ b/pkg/gen/primemessages/update_m_t_o_service_item.go @@ -123,6 +123,12 @@ func unmarshalUpdateMTOServiceItem(data []byte, consumer runtime.Consumer) (Upda return nil, err } return &result, nil + case "UpdateMTOServiceItemInternationalShuttle": + var result UpdateMTOServiceItemInternationalShuttle + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "UpdateMTOServiceItemSIT": var result UpdateMTOServiceItemSIT if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primemessages/update_m_t_o_service_item_international_shuttle.go b/pkg/gen/primemessages/update_m_t_o_service_item_international_shuttle.go new file mode 100644 index 00000000000..1d4a7b6a0bf --- /dev/null +++ b/pkg/gen/primemessages/update_m_t_o_service_item_international_shuttle.go @@ -0,0 +1,276 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primemessages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UpdateMTOServiceItemInternationalShuttle Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. +// +// swagger:model UpdateMTOServiceItemInternationalShuttle +type UpdateMTOServiceItemInternationalShuttle struct { + idField strfmt.UUID + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` +} + +// ID gets the id of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) SetID(val strfmt.UUID) { + m.idField = val +} + +// ModelType gets the model type of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) ModelType() UpdateMTOServiceItemModelType { + return "UpdateMTOServiceItemInternationalShuttle" +} + +// SetModelType sets the model type of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) SetModelType(val UpdateMTOServiceItemModelType) { +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *UpdateMTOServiceItemInternationalShuttle) UnmarshalJSON(raw []byte) error { + var data struct { + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ID strfmt.UUID `json:"id,omitempty"` + + ModelType UpdateMTOServiceItemModelType `json:"modelType"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result UpdateMTOServiceItemInternationalShuttle + + result.idField = base.ID + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + + result.ActualWeight = data.ActualWeight + result.EstimatedWeight = data.EstimatedWeight + result.ReServiceCode = data.ReServiceCode + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m UpdateMTOServiceItemInternationalShuttle) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + }{ + + ActualWeight: m.ActualWeight, + + EstimatedWeight: m.EstimatedWeight, + + ReServiceCode: m.ReServiceCode, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ID strfmt.UUID `json:"id,omitempty"` + + ModelType UpdateMTOServiceItemModelType `json:"modelType"` + }{ + + ID: m.ID(), + + ModelType: m.ModelType(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this update m t o service item international shuttle +func (m *UpdateMTOServiceItemInternationalShuttle) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +var updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IDSHUT","IOSHUT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum = append(updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *UpdateMTOServiceItemInternationalShuttle) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) validateReServiceCode(formats strfmt.Registry) error { + + if swag.IsZero(m.ReServiceCode) { // not required + return nil + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this update m t o service item international shuttle based on the context it is used +func (m *UpdateMTOServiceItemInternationalShuttle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateMTOServiceItemInternationalShuttle) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateMTOServiceItemInternationalShuttle) UnmarshalBinary(b []byte) error { + var res UpdateMTOServiceItemInternationalShuttle + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go b/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go index 40e86f82729..cc59a427e36 100644 --- a/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go +++ b/pkg/gen/primemessages/update_m_t_o_service_item_model_type.go @@ -27,6 +27,8 @@ import ( // - DOSHUT - UpdateMTOServiceItemShuttle // - PODFSC - UpdateMTOServiceItemInternationalPortFSC // - POEFSC - UpdateMTOServiceItemInternationalPortFSC +// - IDSHUT - UpdateMTOServiceItemInternationalShuttle +// - IOSHUT - UpdateMTOServiceItemInternationalShuttle // // The documentation will then update with the supported fields. // @@ -52,6 +54,9 @@ const ( // UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalPortFSC captures enum value "UpdateMTOServiceItemInternationalPortFSC" UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalPortFSC UpdateMTOServiceItemModelType = "UpdateMTOServiceItemInternationalPortFSC" + + // UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle captures enum value "UpdateMTOServiceItemInternationalShuttle" + UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItemModelType = "UpdateMTOServiceItemInternationalShuttle" ) // for schema @@ -59,7 +64,7 @@ var updateMTOServiceItemModelTypeEnum []interface{} func init() { var res []UpdateMTOServiceItemModelType - if err := json.Unmarshal([]byte(`["UpdateMTOServiceItemSIT","UpdateMTOServiceItemShuttle","UpdateMTOServiceItemInternationalPortFSC"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["UpdateMTOServiceItemSIT","UpdateMTOServiceItemShuttle","UpdateMTOServiceItemInternationalPortFSC","UpdateMTOServiceItemInternationalShuttle"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev2api/embedded_spec.go b/pkg/gen/primev2api/embedded_spec.go index a8a0c1574f4..9e0f66eb6c8 100644 --- a/pkg/gen/primev2api/embedded_spec.go +++ b/pkg/gen/primev2api/embedded_spec.go @@ -1507,14 +1507,73 @@ func init() { } ] }, + "MTOServiceItemInternationalShuttle": { + "description": "Describes an international shuttle service item.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reason", + "reServiceCode" + ], + "properties": { + "actualWeight": { + "description": "A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in the shuttling service.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "market": { + "description": "To identify whether the service was provided within (CONUS) or (OCONUS)", + "type": "string", + "enum": [ + "CONUS", + "OCONUS" + ], + "example": "CONUS" + }, + "reServiceCode": { + "description": "A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (` + "`" + `IOSHUT` + "`" + `) or destination (` + "`" + `IDSHUT` + "`" + `).\n", + "type": "string", + "enum": [ + "IOSHUT", + "IDSHUT" + ] + }, + "reason": { + "description": "The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item.\n", + "type": "string", + "example": "Storage items need to be picked up." + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", "MTOSerivceItemInternationalFuelSurcharge" @@ -3079,12 +3138,53 @@ func init() { }, "discriminator": "modelType" }, + "UpdateMTOServiceItemInternationalShuttle": { + "description": "Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item.\n", + "allOf": [ + { + "$ref": "#/definitions/UpdateMTOServiceItem" + }, + { + "type": "object", + "properties": { + "actualWeight": { + "description": "Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT \u0026 IOSHUT) service items.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT \u0026 IOSHUT) service item.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDSHUT", + "IOSHUT" + ] + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", - "UpdateMTOServiceItemShuttle" + "UpdateMTOServiceItemShuttle", + "UpdateMTOServiceItemInternationalShuttle" ] }, "UpdateMTOServiceItemSIT": { @@ -5171,14 +5271,73 @@ func init() { } ] }, + "MTOServiceItemInternationalShuttle": { + "description": "Describes an international shuttle service item.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reason", + "reServiceCode" + ], + "properties": { + "actualWeight": { + "description": "A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in the shuttling service.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "market": { + "description": "To identify whether the service was provided within (CONUS) or (OCONUS)", + "type": "string", + "enum": [ + "CONUS", + "OCONUS" + ], + "example": "CONUS" + }, + "reServiceCode": { + "description": "A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (` + "`" + `IOSHUT` + "`" + `) or destination (` + "`" + `IDSHUT` + "`" + `).\n", + "type": "string", + "enum": [ + "IOSHUT", + "IDSHUT" + ] + }, + "reason": { + "description": "The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item.\n", + "type": "string", + "example": "Storage items need to be picked up." + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", "MTOSerivceItemInternationalFuelSurcharge" @@ -6745,12 +6904,53 @@ func init() { }, "discriminator": "modelType" }, + "UpdateMTOServiceItemInternationalShuttle": { + "description": "Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item.\n", + "allOf": [ + { + "$ref": "#/definitions/UpdateMTOServiceItem" + }, + { + "type": "object", + "properties": { + "actualWeight": { + "description": "Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT \u0026 IOSHUT) service items.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT \u0026 IOSHUT) service item.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDSHUT", + "IOSHUT" + ] + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", - "UpdateMTOServiceItemShuttle" + "UpdateMTOServiceItemShuttle", + "UpdateMTOServiceItemInternationalShuttle" ] }, "UpdateMTOServiceItemSIT": { diff --git a/pkg/gen/primev2messages/m_t_o_service_item.go b/pkg/gen/primev2messages/m_t_o_service_item.go index 58ae8130bb3..7dfadf4c428 100644 --- a/pkg/gen/primev2messages/m_t_o_service_item.go +++ b/pkg/gen/primev2messages/m_t_o_service_item.go @@ -279,6 +279,12 @@ func unmarshalMTOServiceItem(data []byte, consumer runtime.Consumer) (MTOService return nil, err } return &result, nil + case "MTOServiceItemInternationalShuttle": + var result MTOServiceItemInternationalShuttle + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemOriginSIT": var result MTOServiceItemOriginSIT if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primev2messages/m_t_o_service_item_international_shuttle.go b/pkg/gen/primev2messages/m_t_o_service_item_international_shuttle.go new file mode 100644 index 00000000000..3383f8839f2 --- /dev/null +++ b/pkg/gen/primev2messages/m_t_o_service_item_international_shuttle.go @@ -0,0 +1,701 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev2messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalShuttle Describes an international shuttle service item. +// +// swagger:model MTOServiceItemInternationalShuttle +type MTOServiceItemInternationalShuttle struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalShuttle) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalShuttle) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalShuttle) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalShuttle) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalShuttle) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalShuttle) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalShuttle) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalShuttle" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalShuttle) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalShuttle) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalShuttle) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalShuttle) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalShuttle) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalShuttle) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalShuttle) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalShuttle) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalShuttle) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalShuttle) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalShuttle) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalShuttle) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalShuttle) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalShuttle) UnmarshalJSON(raw []byte) error { + var data struct { + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalShuttle + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.ActualWeight = data.ActualWeight + result.EstimatedWeight = data.EstimatedWeight + result.Market = data.Market + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalShuttle) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + }{ + + ActualWeight: m.ActualWeight, + + EstimatedWeight: m.EstimatedWeight, + + Market: m.Market, + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international shuttle +func (m *MTOServiceItemInternationalShuttle) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMarket(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +var mTOServiceItemInternationalShuttleTypeMarketPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["CONUS","OCONUS"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalShuttleTypeMarketPropEnum = append(mTOServiceItemInternationalShuttleTypeMarketPropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalShuttle) validateMarketEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalShuttleTypeMarketPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMarket(formats strfmt.Registry) error { + + if swag.IsZero(m.Market) { // not required + return nil + } + + // value enum + if err := m.validateMarketEnum("market", "body", m.Market); err != nil { + return err + } + + return nil +} + +var mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IOSHUT","IDSHUT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum = append(mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalShuttle) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international shuttle based on the context it is used +func (m *MTOServiceItemInternationalShuttle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalShuttle) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalShuttle) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalShuttle + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev2messages/m_t_o_service_item_model_type.go b/pkg/gen/primev2messages/m_t_o_service_item_model_type.go index 58755658344..97d0c5272dc 100644 --- a/pkg/gen/primev2messages/m_t_o_service_item_model_type.go +++ b/pkg/gen/primev2messages/m_t_o_service_item_model_type.go @@ -20,6 +20,7 @@ import ( // - DOFSIT, DOASIT - MTOServiceItemOriginSIT // - DDFSIT, DDASIT - MTOServiceItemDestSIT // - DOSHUT, DDSHUT - MTOServiceItemShuttle +// - IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle // - DCRT, DUCRT - MTOServiceItemDomesticCrating // - ICRT, IUCRT - MTOServiceItemInternationalCrating // - PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -52,6 +53,9 @@ const ( // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" + // MTOServiceItemModelTypeMTOServiceItemInternationalShuttle captures enum value "MTOServiceItemInternationalShuttle" + MTOServiceItemModelTypeMTOServiceItemInternationalShuttle MTOServiceItemModelType = "MTOServiceItemInternationalShuttle" + // MTOServiceItemModelTypeMTOServiceItemDomesticCrating captures enum value "MTOServiceItemDomesticCrating" MTOServiceItemModelTypeMTOServiceItemDomesticCrating MTOServiceItemModelType = "MTOServiceItemDomesticCrating" @@ -67,7 +71,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev2messages/update_m_t_o_service_item.go b/pkg/gen/primev2messages/update_m_t_o_service_item.go index 659a4a1904a..43c689afd62 100644 --- a/pkg/gen/primev2messages/update_m_t_o_service_item.go +++ b/pkg/gen/primev2messages/update_m_t_o_service_item.go @@ -117,6 +117,12 @@ func unmarshalUpdateMTOServiceItem(data []byte, consumer runtime.Consumer) (Upda return nil, err } return &result, nil + case "UpdateMTOServiceItemInternationalShuttle": + var result UpdateMTOServiceItemInternationalShuttle + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "UpdateMTOServiceItemSIT": var result UpdateMTOServiceItemSIT if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primev2messages/update_m_t_o_service_item_international_shuttle.go b/pkg/gen/primev2messages/update_m_t_o_service_item_international_shuttle.go new file mode 100644 index 00000000000..081185c8d70 --- /dev/null +++ b/pkg/gen/primev2messages/update_m_t_o_service_item_international_shuttle.go @@ -0,0 +1,276 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev2messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UpdateMTOServiceItemInternationalShuttle Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. +// +// swagger:model UpdateMTOServiceItemInternationalShuttle +type UpdateMTOServiceItemInternationalShuttle struct { + idField strfmt.UUID + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` +} + +// ID gets the id of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) SetID(val strfmt.UUID) { + m.idField = val +} + +// ModelType gets the model type of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) ModelType() UpdateMTOServiceItemModelType { + return "UpdateMTOServiceItemInternationalShuttle" +} + +// SetModelType sets the model type of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) SetModelType(val UpdateMTOServiceItemModelType) { +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *UpdateMTOServiceItemInternationalShuttle) UnmarshalJSON(raw []byte) error { + var data struct { + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ID strfmt.UUID `json:"id,omitempty"` + + ModelType UpdateMTOServiceItemModelType `json:"modelType"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result UpdateMTOServiceItemInternationalShuttle + + result.idField = base.ID + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + + result.ActualWeight = data.ActualWeight + result.EstimatedWeight = data.EstimatedWeight + result.ReServiceCode = data.ReServiceCode + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m UpdateMTOServiceItemInternationalShuttle) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + }{ + + ActualWeight: m.ActualWeight, + + EstimatedWeight: m.EstimatedWeight, + + ReServiceCode: m.ReServiceCode, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ID strfmt.UUID `json:"id,omitempty"` + + ModelType UpdateMTOServiceItemModelType `json:"modelType"` + }{ + + ID: m.ID(), + + ModelType: m.ModelType(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this update m t o service item international shuttle +func (m *UpdateMTOServiceItemInternationalShuttle) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +var updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IDSHUT","IOSHUT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum = append(updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *UpdateMTOServiceItemInternationalShuttle) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) validateReServiceCode(formats strfmt.Registry) error { + + if swag.IsZero(m.ReServiceCode) { // not required + return nil + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this update m t o service item international shuttle based on the context it is used +func (m *UpdateMTOServiceItemInternationalShuttle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateMTOServiceItemInternationalShuttle) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateMTOServiceItemInternationalShuttle) UnmarshalBinary(b []byte) error { + var res UpdateMTOServiceItemInternationalShuttle + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go b/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go index 6d9ea3d53ee..8b865cfec1f 100644 --- a/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go +++ b/pkg/gen/primev2messages/update_m_t_o_service_item_model_type.go @@ -21,6 +21,8 @@ import ( // - DOFSIT - UpdateMTOServiceItemSIT // - DDSHUT - UpdateMTOServiceItemShuttle // - DOSHUT - UpdateMTOServiceItemShuttle +// - IDSHUT - UpdateMTOServiceItemInternationalShuttle +// - IOSHUT - UpdateMTOServiceItemInternationalShuttle // // The documentation will then update with the supported fields. // @@ -43,6 +45,9 @@ const ( // UpdateMTOServiceItemModelTypeUpdateMTOServiceItemShuttle captures enum value "UpdateMTOServiceItemShuttle" UpdateMTOServiceItemModelTypeUpdateMTOServiceItemShuttle UpdateMTOServiceItemModelType = "UpdateMTOServiceItemShuttle" + + // UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle captures enum value "UpdateMTOServiceItemInternationalShuttle" + UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItemModelType = "UpdateMTOServiceItemInternationalShuttle" ) // for schema @@ -50,7 +55,7 @@ var updateMTOServiceItemModelTypeEnum []interface{} func init() { var res []UpdateMTOServiceItemModelType - if err := json.Unmarshal([]byte(`["UpdateMTOServiceItemSIT","UpdateMTOServiceItemShuttle"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["UpdateMTOServiceItemSIT","UpdateMTOServiceItemShuttle","UpdateMTOServiceItemInternationalShuttle"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev3api/embedded_spec.go b/pkg/gen/primev3api/embedded_spec.go index ffb0bcda306..e5bde117279 100644 --- a/pkg/gen/primev3api/embedded_spec.go +++ b/pkg/gen/primev3api/embedded_spec.go @@ -1694,14 +1694,73 @@ func init() { } ] }, + "MTOServiceItemInternationalShuttle": { + "description": "Describes an international shuttle service item.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reason", + "reServiceCode" + ], + "properties": { + "actualWeight": { + "description": "A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in the shuttling service.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "market": { + "description": "To identify whether the service was provided within (CONUS) or (OCONUS)", + "type": "string", + "enum": [ + "CONUS", + "OCONUS" + ], + "example": "CONUS" + }, + "reServiceCode": { + "description": "A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (` + "`" + `IOSHUT` + "`" + `) or destination (` + "`" + `IDSHUT` + "`" + `).\n", + "type": "string", + "enum": [ + "IOSHUT", + "IDSHUT" + ] + }, + "reason": { + "description": "The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item.\n", + "type": "string", + "example": "Storage items need to be picked up." + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", "MTOSerivceItemInternationalFuelSurcharge" @@ -3697,12 +3756,53 @@ func init() { }, "discriminator": "modelType" }, + "UpdateMTOServiceItemInternationalShuttle": { + "description": "Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item.\n", + "allOf": [ + { + "$ref": "#/definitions/UpdateMTOServiceItem" + }, + { + "type": "object", + "properties": { + "actualWeight": { + "description": "Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT \u0026 IOSHUT) service items.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT \u0026 IOSHUT) service item.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDSHUT", + "IOSHUT" + ] + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", - "UpdateMTOServiceItemShuttle" + "UpdateMTOServiceItemShuttle", + "UpdateMTOServiceItemInternationalShuttle" ] }, "UpdateMTOServiceItemSIT": { @@ -6068,14 +6168,73 @@ func init() { } ] }, + "MTOServiceItemInternationalShuttle": { + "description": "Describes an international shuttle service item.", + "allOf": [ + { + "$ref": "#/definitions/MTOServiceItem" + }, + { + "type": "object", + "required": [ + "reason", + "reServiceCode" + ], + "properties": { + "actualWeight": { + "description": "A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in the shuttling service.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "market": { + "description": "To identify whether the service was provided within (CONUS) or (OCONUS)", + "type": "string", + "enum": [ + "CONUS", + "OCONUS" + ], + "example": "CONUS" + }, + "reServiceCode": { + "description": "A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (` + "`" + `IOSHUT` + "`" + `) or destination (` + "`" + `IDSHUT` + "`" + `).\n", + "type": "string", + "enum": [ + "IOSHUT", + "IDSHUT" + ] + }, + "reason": { + "description": "The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item.\n", + "type": "string", + "example": "Storage items need to be picked up." + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "MTOServiceItemModelType": { - "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", + "description": "Describes all model sub-types for a MTOServiceItem model.\n\nUsing this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DOFSIT, DOASIT - MTOServiceItemOriginSIT\n * DDFSIT, DDASIT - MTOServiceItemDestSIT\n * DOSHUT, DDSHUT - MTOServiceItemShuttle\n * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle\n * DCRT, DUCRT - MTOServiceItemDomesticCrating\n * ICRT, IUCRT - MTOServiceItemInternationalCrating\n * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "MTOServiceItemBasic", "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating", "MTOSerivceItemInternationalFuelSurcharge" @@ -8073,12 +8232,53 @@ func init() { }, "discriminator": "modelType" }, + "UpdateMTOServiceItemInternationalShuttle": { + "description": "Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item.\n", + "allOf": [ + { + "$ref": "#/definitions/UpdateMTOServiceItem" + }, + { + "type": "object", + "properties": { + "actualWeight": { + "description": "Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT \u0026 IOSHUT) service items.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4000 + }, + "estimatedWeight": { + "description": "An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT \u0026 IOSHUT) service item.", + "type": "integer", + "x-nullable": true, + "x-omitempty": false, + "example": 4200 + }, + "reServiceCode": { + "description": "Service code allowed for this model type.", + "type": "string", + "enum": [ + "IDSHUT", + "IOSHUT" + ] + }, + "requestApprovalsRequestedStatus": { + "description": "Indicates if \"Approvals Requested\" status is being requested.", + "type": "boolean", + "x-nullable": true + } + } + } + ] + }, "UpdateMTOServiceItemModelType": { - "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n\nThe documentation will then update with the supported fields.\n", + "description": "Using this list, choose the correct modelType in the dropdown, corresponding to the service item type.\n * DDDSIT - UpdateMTOServiceItemSIT\n * DOPSIT - UpdateMTOServiceItemSIT\n * DOASIT - UpdateMTOServiceItemSIT\n * DOFSIT - UpdateMTOServiceItemSIT\n * DDSHUT - UpdateMTOServiceItemShuttle\n * DOSHUT - UpdateMTOServiceItemShuttle\n * IDSHUT - UpdateMTOServiceItemInternationalShuttle\n * IOSHUT - UpdateMTOServiceItemInternationalShuttle\n\nThe documentation will then update with the supported fields.\n", "type": "string", "enum": [ "UpdateMTOServiceItemSIT", - "UpdateMTOServiceItemShuttle" + "UpdateMTOServiceItemShuttle", + "UpdateMTOServiceItemInternationalShuttle" ] }, "UpdateMTOServiceItemSIT": { diff --git a/pkg/gen/primev3messages/m_t_o_service_item.go b/pkg/gen/primev3messages/m_t_o_service_item.go index d6861255a80..75d33c217f1 100644 --- a/pkg/gen/primev3messages/m_t_o_service_item.go +++ b/pkg/gen/primev3messages/m_t_o_service_item.go @@ -285,6 +285,12 @@ func unmarshalMTOServiceItem(data []byte, consumer runtime.Consumer) (MTOService return nil, err } return &result, nil + case "MTOServiceItemInternationalShuttle": + var result MTOServiceItemInternationalShuttle + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "MTOServiceItemOriginSIT": var result MTOServiceItemOriginSIT if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primev3messages/m_t_o_service_item_international_shuttle.go b/pkg/gen/primev3messages/m_t_o_service_item_international_shuttle.go new file mode 100644 index 00000000000..6b03f772b77 --- /dev/null +++ b/pkg/gen/primev3messages/m_t_o_service_item_international_shuttle.go @@ -0,0 +1,701 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev3messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// MTOServiceItemInternationalShuttle Describes an international shuttle service item. +// +// swagger:model MTOServiceItemInternationalShuttle +type MTOServiceItemInternationalShuttle struct { + eTagField string + + idField strfmt.UUID + + lockedPriceCentsField *int64 + + moveTaskOrderIdField *strfmt.UUID + + mtoShipmentIdField strfmt.UUID + + reServiceNameField string + + rejectionReasonField *string + + serviceRequestDocumentsField ServiceRequestDocuments + + statusField MTOServiceItemStatus + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` +} + +// ETag gets the e tag of this subtype +func (m *MTOServiceItemInternationalShuttle) ETag() string { + return m.eTagField +} + +// SetETag sets the e tag of this subtype +func (m *MTOServiceItemInternationalShuttle) SetETag(val string) { + m.eTagField = val +} + +// ID gets the id of this subtype +func (m *MTOServiceItemInternationalShuttle) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *MTOServiceItemInternationalShuttle) SetID(val strfmt.UUID) { + m.idField = val +} + +// LockedPriceCents gets the locked price cents of this subtype +func (m *MTOServiceItemInternationalShuttle) LockedPriceCents() *int64 { + return m.lockedPriceCentsField +} + +// SetLockedPriceCents sets the locked price cents of this subtype +func (m *MTOServiceItemInternationalShuttle) SetLockedPriceCents(val *int64) { + m.lockedPriceCentsField = val +} + +// ModelType gets the model type of this subtype +func (m *MTOServiceItemInternationalShuttle) ModelType() MTOServiceItemModelType { + return "MTOServiceItemInternationalShuttle" +} + +// SetModelType sets the model type of this subtype +func (m *MTOServiceItemInternationalShuttle) SetModelType(val MTOServiceItemModelType) { +} + +// MoveTaskOrderID gets the move task order ID of this subtype +func (m *MTOServiceItemInternationalShuttle) MoveTaskOrderID() *strfmt.UUID { + return m.moveTaskOrderIdField +} + +// SetMoveTaskOrderID sets the move task order ID of this subtype +func (m *MTOServiceItemInternationalShuttle) SetMoveTaskOrderID(val *strfmt.UUID) { + m.moveTaskOrderIdField = val +} + +// MtoShipmentID gets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalShuttle) MtoShipmentID() strfmt.UUID { + return m.mtoShipmentIdField +} + +// SetMtoShipmentID sets the mto shipment ID of this subtype +func (m *MTOServiceItemInternationalShuttle) SetMtoShipmentID(val strfmt.UUID) { + m.mtoShipmentIdField = val +} + +// ReServiceName gets the re service name of this subtype +func (m *MTOServiceItemInternationalShuttle) ReServiceName() string { + return m.reServiceNameField +} + +// SetReServiceName sets the re service name of this subtype +func (m *MTOServiceItemInternationalShuttle) SetReServiceName(val string) { + m.reServiceNameField = val +} + +// RejectionReason gets the rejection reason of this subtype +func (m *MTOServiceItemInternationalShuttle) RejectionReason() *string { + return m.rejectionReasonField +} + +// SetRejectionReason sets the rejection reason of this subtype +func (m *MTOServiceItemInternationalShuttle) SetRejectionReason(val *string) { + m.rejectionReasonField = val +} + +// ServiceRequestDocuments gets the service request documents of this subtype +func (m *MTOServiceItemInternationalShuttle) ServiceRequestDocuments() ServiceRequestDocuments { + return m.serviceRequestDocumentsField +} + +// SetServiceRequestDocuments sets the service request documents of this subtype +func (m *MTOServiceItemInternationalShuttle) SetServiceRequestDocuments(val ServiceRequestDocuments) { + m.serviceRequestDocumentsField = val +} + +// Status gets the status of this subtype +func (m *MTOServiceItemInternationalShuttle) Status() MTOServiceItemStatus { + return m.statusField +} + +// SetStatus sets the status of this subtype +func (m *MTOServiceItemInternationalShuttle) SetStatus(val MTOServiceItemStatus) { + m.statusField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *MTOServiceItemInternationalShuttle) UnmarshalJSON(raw []byte) error { + var data struct { + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result MTOServiceItemInternationalShuttle + + result.eTagField = base.ETag + + result.idField = base.ID + + result.lockedPriceCentsField = base.LockedPriceCents + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + result.moveTaskOrderIdField = base.MoveTaskOrderID + + result.mtoShipmentIdField = base.MtoShipmentID + + result.reServiceNameField = base.ReServiceName + + result.rejectionReasonField = base.RejectionReason + + result.serviceRequestDocumentsField = base.ServiceRequestDocuments + + result.statusField = base.Status + + result.ActualWeight = data.ActualWeight + result.EstimatedWeight = data.EstimatedWeight + result.Market = data.Market + result.ReServiceCode = data.ReServiceCode + result.Reason = data.Reason + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m MTOServiceItemInternationalShuttle) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in the shuttling service. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // To identify whether the service was provided within (CONUS) or (OCONUS) + // Example: CONUS + // Enum: [CONUS OCONUS] + Market string `json:"market,omitempty"` + + // A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) or destination (`IDSHUT`). + // + // Required: true + // Enum: [IOSHUT IDSHUT] + ReServiceCode *string `json:"reServiceCode"` + + // The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to approve or reject the service item. + // + // Example: Storage items need to be picked up. + // Required: true + Reason *string `json:"reason"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + }{ + + ActualWeight: m.ActualWeight, + + EstimatedWeight: m.EstimatedWeight, + + Market: m.Market, + + ReServiceCode: m.ReServiceCode, + + Reason: m.Reason, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ETag string `json:"eTag,omitempty"` + + ID strfmt.UUID `json:"id,omitempty"` + + LockedPriceCents *int64 `json:"lockedPriceCents,omitempty"` + + ModelType MTOServiceItemModelType `json:"modelType"` + + MoveTaskOrderID *strfmt.UUID `json:"moveTaskOrderID"` + + MtoShipmentID strfmt.UUID `json:"mtoShipmentID,omitempty"` + + ReServiceName string `json:"reServiceName,omitempty"` + + RejectionReason *string `json:"rejectionReason,omitempty"` + + ServiceRequestDocuments ServiceRequestDocuments `json:"serviceRequestDocuments,omitempty"` + + Status MTOServiceItemStatus `json:"status,omitempty"` + }{ + + ETag: m.ETag(), + + ID: m.ID(), + + LockedPriceCents: m.LockedPriceCents(), + + ModelType: m.ModelType(), + + MoveTaskOrderID: m.MoveTaskOrderID(), + + MtoShipmentID: m.MtoShipmentID(), + + ReServiceName: m.ReServiceName(), + + RejectionReason: m.RejectionReason(), + + ServiceRequestDocuments: m.ServiceRequestDocuments(), + + Status: m.Status(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this m t o service item international shuttle +func (m *MTOServiceItemInternationalShuttle) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoveTaskOrderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMtoShipmentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceRequestDocuments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMarket(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReason(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMoveTaskOrderID(formats strfmt.Registry) error { + + if err := validate.Required("moveTaskOrderID", "body", m.MoveTaskOrderID()); err != nil { + return err + } + + if err := validate.FormatOf("moveTaskOrderID", "body", "uuid", m.MoveTaskOrderID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMtoShipmentID(formats strfmt.Registry) error { + + if swag.IsZero(m.MtoShipmentID()) { // not required + return nil + } + + if err := validate.FormatOf("mtoShipmentID", "body", "uuid", m.MtoShipmentID().String(), formats); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateServiceRequestDocuments(formats strfmt.Registry) error { + + if swag.IsZero(m.ServiceRequestDocuments()) { // not required + return nil + } + + if err := m.ServiceRequestDocuments().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateStatus(formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +var mTOServiceItemInternationalShuttleTypeMarketPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["CONUS","OCONUS"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalShuttleTypeMarketPropEnum = append(mTOServiceItemInternationalShuttleTypeMarketPropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalShuttle) validateMarketEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalShuttleTypeMarketPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateMarket(formats strfmt.Registry) error { + + if swag.IsZero(m.Market) { // not required + return nil + } + + // value enum + if err := m.validateMarketEnum("market", "body", m.Market); err != nil { + return err + } + + return nil +} + +var mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IOSHUT","IDSHUT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum = append(mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *MTOServiceItemInternationalShuttle) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, mTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateReServiceCode(formats strfmt.Registry) error { + + if err := validate.Required("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", *m.ReServiceCode); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) validateReason(formats strfmt.Registry) error { + + if err := validate.Required("reason", "body", m.Reason); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this m t o service item international shuttle based on the context it is used +func (m *MTOServiceItemInternationalShuttle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateETag(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReServiceName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRejectionReason(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceRequestDocuments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateETag(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "eTag", "body", string(m.ETag())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", strfmt.UUID(m.ID())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateReServiceName(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "reServiceName", "body", string(m.ReServiceName())); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateRejectionReason(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "rejectionReason", "body", m.RejectionReason()); err != nil { + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateServiceRequestDocuments(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ServiceRequestDocuments().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("serviceRequestDocuments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("serviceRequestDocuments") + } + return err + } + + return nil +} + +func (m *MTOServiceItemInternationalShuttle) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.Status()) { // not required + return nil + } + + if err := m.Status().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MTOServiceItemInternationalShuttle) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MTOServiceItemInternationalShuttle) UnmarshalBinary(b []byte) error { + var res MTOServiceItemInternationalShuttle + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev3messages/m_t_o_service_item_model_type.go b/pkg/gen/primev3messages/m_t_o_service_item_model_type.go index 50a9d22e418..53d2a0450f6 100644 --- a/pkg/gen/primev3messages/m_t_o_service_item_model_type.go +++ b/pkg/gen/primev3messages/m_t_o_service_item_model_type.go @@ -20,6 +20,7 @@ import ( // - DOFSIT, DOASIT - MTOServiceItemOriginSIT // - DDFSIT, DDASIT - MTOServiceItemDestSIT // - DOSHUT, DDSHUT - MTOServiceItemShuttle +// - IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle // - DCRT, DUCRT - MTOServiceItemDomesticCrating // - ICRT, IUCRT - MTOServiceItemInternationalCrating // - PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -52,6 +53,9 @@ const ( // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" + // MTOServiceItemModelTypeMTOServiceItemInternationalShuttle captures enum value "MTOServiceItemInternationalShuttle" + MTOServiceItemModelTypeMTOServiceItemInternationalShuttle MTOServiceItemModelType = "MTOServiceItemInternationalShuttle" + // MTOServiceItemModelTypeMTOServiceItemDomesticCrating captures enum value "MTOServiceItemDomesticCrating" MTOServiceItemModelTypeMTOServiceItemDomesticCrating MTOServiceItemModelType = "MTOServiceItemDomesticCrating" @@ -67,7 +71,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating","MTOSerivceItemInternationalFuelSurcharge"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/primev3messages/update_m_t_o_service_item.go b/pkg/gen/primev3messages/update_m_t_o_service_item.go index 458956f1f1d..6f16095105d 100644 --- a/pkg/gen/primev3messages/update_m_t_o_service_item.go +++ b/pkg/gen/primev3messages/update_m_t_o_service_item.go @@ -117,6 +117,12 @@ func unmarshalUpdateMTOServiceItem(data []byte, consumer runtime.Consumer) (Upda return nil, err } return &result, nil + case "UpdateMTOServiceItemInternationalShuttle": + var result UpdateMTOServiceItemInternationalShuttle + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "UpdateMTOServiceItemSIT": var result UpdateMTOServiceItemSIT if err := consumer.Consume(buf2, &result); err != nil { diff --git a/pkg/gen/primev3messages/update_m_t_o_service_item_international_shuttle.go b/pkg/gen/primev3messages/update_m_t_o_service_item_international_shuttle.go new file mode 100644 index 00000000000..4686d0e8474 --- /dev/null +++ b/pkg/gen/primev3messages/update_m_t_o_service_item_international_shuttle.go @@ -0,0 +1,276 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package primev3messages + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UpdateMTOServiceItemInternationalShuttle Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. +// +// swagger:model UpdateMTOServiceItemInternationalShuttle +type UpdateMTOServiceItemInternationalShuttle struct { + idField strfmt.UUID + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` +} + +// ID gets the id of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) ID() strfmt.UUID { + return m.idField +} + +// SetID sets the id of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) SetID(val strfmt.UUID) { + m.idField = val +} + +// ModelType gets the model type of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) ModelType() UpdateMTOServiceItemModelType { + return "UpdateMTOServiceItemInternationalShuttle" +} + +// SetModelType sets the model type of this subtype +func (m *UpdateMTOServiceItemInternationalShuttle) SetModelType(val UpdateMTOServiceItemModelType) { +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *UpdateMTOServiceItemInternationalShuttle) UnmarshalJSON(raw []byte) error { + var data struct { + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + ID strfmt.UUID `json:"id,omitempty"` + + ModelType UpdateMTOServiceItemModelType `json:"modelType"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result UpdateMTOServiceItemInternationalShuttle + + result.idField = base.ID + + if base.ModelType != result.ModelType() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid modelType value: %q", base.ModelType) + } + + result.ActualWeight = data.ActualWeight + result.EstimatedWeight = data.EstimatedWeight + result.ReServiceCode = data.ReServiceCode + result.RequestApprovalsRequestedStatus = data.RequestApprovalsRequestedStatus + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m UpdateMTOServiceItemInternationalShuttle) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + + // Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + // Example: 4000 + ActualWeight *int64 `json:"actualWeight"` + + // An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + // Example: 4200 + EstimatedWeight *int64 `json:"estimatedWeight"` + + // Service code allowed for this model type. + // Enum: [IDSHUT IOSHUT] + ReServiceCode string `json:"reServiceCode,omitempty"` + + // Indicates if "Approvals Requested" status is being requested. + RequestApprovalsRequestedStatus *bool `json:"requestApprovalsRequestedStatus,omitempty"` + }{ + + ActualWeight: m.ActualWeight, + + EstimatedWeight: m.EstimatedWeight, + + ReServiceCode: m.ReServiceCode, + + RequestApprovalsRequestedStatus: m.RequestApprovalsRequestedStatus, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + ID strfmt.UUID `json:"id,omitempty"` + + ModelType UpdateMTOServiceItemModelType `json:"modelType"` + }{ + + ID: m.ID(), + + ModelType: m.ModelType(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this update m t o service item international shuttle +func (m *UpdateMTOServiceItemInternationalShuttle) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReServiceCode(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) validateID(formats strfmt.Registry) error { + + if swag.IsZero(m.ID()) { // not required + return nil + } + + if err := validate.FormatOf("id", "body", "uuid", m.ID().String(), formats); err != nil { + return err + } + + return nil +} + +var updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["IDSHUT","IOSHUT"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum = append(updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, v) + } +} + +// property enum +func (m *UpdateMTOServiceItemInternationalShuttle) validateReServiceCodeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, updateMTOServiceItemInternationalShuttleTypeReServiceCodePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) validateReServiceCode(formats strfmt.Registry) error { + + if swag.IsZero(m.ReServiceCode) { // not required + return nil + } + + // value enum + if err := m.validateReServiceCodeEnum("reServiceCode", "body", m.ReServiceCode); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this update m t o service item international shuttle based on the context it is used +func (m *UpdateMTOServiceItemInternationalShuttle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateMTOServiceItemInternationalShuttle) contextValidateModelType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ModelType().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("modelType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("modelType") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateMTOServiceItemInternationalShuttle) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateMTOServiceItemInternationalShuttle) UnmarshalBinary(b []byte) error { + var res UpdateMTOServiceItemInternationalShuttle + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go b/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go index a1d95c43bb3..a1bc8152ec6 100644 --- a/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go +++ b/pkg/gen/primev3messages/update_m_t_o_service_item_model_type.go @@ -21,6 +21,8 @@ import ( // - DOFSIT - UpdateMTOServiceItemSIT // - DDSHUT - UpdateMTOServiceItemShuttle // - DOSHUT - UpdateMTOServiceItemShuttle +// - IDSHUT - UpdateMTOServiceItemInternationalShuttle +// - IOSHUT - UpdateMTOServiceItemInternationalShuttle // // The documentation will then update with the supported fields. // @@ -43,6 +45,9 @@ const ( // UpdateMTOServiceItemModelTypeUpdateMTOServiceItemShuttle captures enum value "UpdateMTOServiceItemShuttle" UpdateMTOServiceItemModelTypeUpdateMTOServiceItemShuttle UpdateMTOServiceItemModelType = "UpdateMTOServiceItemShuttle" + + // UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle captures enum value "UpdateMTOServiceItemInternationalShuttle" + UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItemModelType = "UpdateMTOServiceItemInternationalShuttle" ) // for schema @@ -50,7 +55,7 @@ var updateMTOServiceItemModelTypeEnum []interface{} func init() { var res []UpdateMTOServiceItemModelType - if err := json.Unmarshal([]byte(`["UpdateMTOServiceItemSIT","UpdateMTOServiceItemShuttle"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["UpdateMTOServiceItemSIT","UpdateMTOServiceItemShuttle","UpdateMTOServiceItemInternationalShuttle"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/gen/supportapi/embedded_spec.go b/pkg/gen/supportapi/embedded_spec.go index a742b5fdc95..b794a05a20e 100644 --- a/pkg/gen/supportapi/embedded_spec.go +++ b/pkg/gen/supportapi/embedded_spec.go @@ -1544,6 +1544,7 @@ func init() { "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating" ] @@ -4416,6 +4417,7 @@ func init() { "MTOServiceItemOriginSIT", "MTOServiceItemDestSIT", "MTOServiceItemShuttle", + "MTOServiceItemInternationalShuttle", "MTOServiceItemDomesticCrating", "MTOServiceItemInternationalCrating" ] diff --git a/pkg/gen/supportmessages/m_t_o_service_item_model_type.go b/pkg/gen/supportmessages/m_t_o_service_item_model_type.go index 9a949e919da..3f957023e8a 100644 --- a/pkg/gen/supportmessages/m_t_o_service_item_model_type.go +++ b/pkg/gen/supportmessages/m_t_o_service_item_model_type.go @@ -51,6 +51,9 @@ const ( // MTOServiceItemModelTypeMTOServiceItemShuttle captures enum value "MTOServiceItemShuttle" MTOServiceItemModelTypeMTOServiceItemShuttle MTOServiceItemModelType = "MTOServiceItemShuttle" + // MTOServiceItemModelTypeMTOServiceItemInternationalShuttle captures enum value "MTOServiceItemInternationalShuttle" + MTOServiceItemModelTypeMTOServiceItemInternationalShuttle MTOServiceItemModelType = "MTOServiceItemInternationalShuttle" + // MTOServiceItemModelTypeMTOServiceItemDomesticCrating captures enum value "MTOServiceItemDomesticCrating" MTOServiceItemModelTypeMTOServiceItemDomesticCrating MTOServiceItemModelType = "MTOServiceItemDomesticCrating" @@ -63,7 +66,7 @@ var mTOServiceItemModelTypeEnum []interface{} func init() { var res []MTOServiceItemModelType - if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["MTOServiceItemBasic","MTOServiceItemOriginSIT","MTOServiceItemDestSIT","MTOServiceItemShuttle","MTOServiceItemInternationalShuttle","MTOServiceItemDomesticCrating","MTOServiceItemInternationalCrating"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go b/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go index fa61758302e..0572a497b27 100644 --- a/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go +++ b/pkg/handlers/ghcapi/internal/payloads/model_to_payload.go @@ -1937,6 +1937,22 @@ func MTOServiceItemModel(s *models.MTOServiceItem, storer storage.FileStorer) *g } } + if s.ReService.Code == models.ReServiceCodeIOSHUT && s.MTOShipment.PickupAddress != nil { + if *s.MTOShipment.PickupAddress.IsOconus { + payload.Market = handlers.FmtString(models.MarketOconus.FullString()) + } else { + payload.Market = handlers.FmtString(models.MarketConus.FullString()) + } + } + + if s.ReService.Code == models.ReServiceCodeIDSHUT && s.MTOShipment.DestinationAddress != nil { + if *s.MTOShipment.DestinationAddress.IsOconus { + payload.Market = handlers.FmtString(models.MarketOconus.FullString()) + } else { + payload.Market = handlers.FmtString(models.MarketConus.FullString()) + } + } + if s.ReService.Code == models.ReServiceCodeIUCRT && s.MTOShipment.DestinationAddress != nil { if *s.MTOShipment.DestinationAddress.IsOconus { payload.Market = handlers.FmtString(models.MarketOconus.FullString()) diff --git a/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go b/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go index 8e808cd78d9..735dfccae66 100644 --- a/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go +++ b/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go @@ -40,16 +40,29 @@ func (suite *PayloadsSuite) TestOrderWithMove() { } func (suite *PayloadsSuite) TestBoatShipment() { - boat := factory.BuildBoatShipment(suite.DB(), nil, nil) - boatShipment := BoatShipment(nil, &boat) - suite.NotNil(boatShipment) + suite.Run("Test Boat Shipment", func() { + boat := factory.BuildBoatShipment(suite.DB(), nil, nil) + boatShipment := BoatShipment(nil, &boat) + suite.NotNil(boatShipment) + }) + suite.Run("Test Boat Shipment", func() { + boatShipment := BoatShipment(nil, nil) + suite.Nil(boatShipment) + }) } func (suite *PayloadsSuite) TestMobileHomeShipment() { - mobileHome := factory.BuildMobileHomeShipment(suite.DB(), nil, nil) - mobileHomeShipment := MobileHomeShipment(nil, &mobileHome) - suite.NotNil(mobileHomeShipment) + suite.Run("Test Mobile Home Shipment", func() { + mobileHome := factory.BuildMobileHomeShipment(suite.DB(), nil, nil) + mobileHomeShipment := MobileHomeShipment(nil, &mobileHome) + suite.NotNil(mobileHomeShipment) + }) + + suite.Run("Test Mobile Home Shipment With Nil", func() { + mobileHomeShipment := MobileHomeShipment(nil, nil) + suite.Nil(mobileHomeShipment) + }) } func (suite *PayloadsSuite) TestMovingExpense() { @@ -107,6 +120,18 @@ func (suite *PayloadsSuite) TestMovingExpenses() { suite.NotNil(movingExpensesValue) } +func (suite *PayloadsSuite) TestMTOServiceItemDimension() { + dimension := models.MTOServiceItemDimension{ + Type: models.DimensionTypeItem, + Length: 1000, + Height: 1000, + Width: 1000, + } + + ghcDimension := MTOServiceItemDimension(&dimension) + suite.NotNil(ghcDimension) +} + // TestMove makes sure zero values/optional fields are handled func TestMove(t *testing.T) { _, err := Move(&models.Move{}, &test.FakeS3Storage{}) @@ -836,7 +861,6 @@ func (suite *PayloadsSuite) TestSearchMoves() { }, }, }, nil) - moves := models.Moves{moveUSMC} suite.Run("Success - Returns a ghcmessages Upload payload from Upload Struct Marine move with no shipments", func() { payload := SearchMoves(appCtx, moves) diff --git a/pkg/handlers/primeapi/mto_service_item.go b/pkg/handlers/primeapi/mto_service_item.go index 7dad26d373b..646c6d17bfb 100644 --- a/pkg/handlers/primeapi/mto_service_item.go +++ b/pkg/handlers/primeapi/mto_service_item.go @@ -28,6 +28,7 @@ var CreateableServiceItemMap = map[primemessages.MTOServiceItemModelType]bool{ primemessages.MTOServiceItemModelTypeMTOServiceItemOriginSIT: true, primemessages.MTOServiceItemModelTypeMTOServiceItemDestSIT: true, primemessages.MTOServiceItemModelTypeMTOServiceItemShuttle: true, + primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: true, primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, } diff --git a/pkg/handlers/primeapi/mto_service_item_test.go b/pkg/handlers/primeapi/mto_service_item_test.go index 2594056a8f8..319b3223705 100644 --- a/pkg/handlers/primeapi/mto_service_item_test.go +++ b/pkg/handlers/primeapi/mto_service_item_test.go @@ -193,6 +193,54 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { suite.NotZero(okResponse.Payload[0].ID()) }) + suite.Run("Successful POST for Creating International Shuttling without PrimeEstimatedWeight set - Integration Test", func() { + mto := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: mto, + LinkOnly: true, + }, + }, nil) + mtoShipment.PrimeEstimatedWeight = nil + req := httptest.NewRequest("POST", "/mto-service-items", nil) + reason := "lorem ipsum" + + mtoServiceItem := models.MTOServiceItem{ + MoveTaskOrderID: mto.ID, + MTOShipmentID: &mtoShipment.ID, + ReService: models.ReService{Code: models.ReServiceCodeIOSHUT}, + Reason: &reason, + } + + params := mtoserviceitemops.CreateMTOServiceItemParams{ + HTTPRequest: req, + Body: payloads.MTOServiceItem(&mtoServiceItem), + } + + moveRouter := moverouter.NewMoveRouter() + planner := &routemocks.Planner{} + planner.On("ZipTransitDistance", + mock.AnythingOfType("*appcontext.appContext"), + mock.Anything, + mock.Anything, + ).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{ + suite.HandlerConfig(), + creator, + mtoChecker, + } + + // Validate incoming payload + suite.NoError(params.Body.Validate(strfmt.Default)) + + response := handler.Handle(params) + suite.IsType(&mtoserviceitemops.CreateMTOServiceItemOK{}, response) + okResponse := response.(*mtoserviceitemops.CreateMTOServiceItemOK) + + suite.NotZero(okResponse.Payload[0].ID()) + }) + suite.Run("POST failure - 500", func() { subtestData := makeSubtestData() mockCreator := mocks.MTOServiceItemCreator{} diff --git a/pkg/handlers/primeapi/payloads/model_to_payload.go b/pkg/handlers/primeapi/payloads/model_to_payload.go index ffb20c6adc2..3c8a3f1b292 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload.go @@ -841,6 +841,32 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primemessages.MTOServ PortCode: portCode, } + case models.ReServiceCodeIDSHUT, models.ReServiceCodeIOSHUT: + shuttleSI := &primemessages.MTOServiceItemInternationalShuttle{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + RequestApprovalsRequestedStatus: mtoServiceItem.RequestedApprovalsRequestedStatus, + EstimatedWeight: handlers.FmtPoundPtr(mtoServiceItem.EstimatedWeight), + ActualWeight: handlers.FmtPoundPtr(mtoServiceItem.ActualWeight), + } + + if mtoServiceItem.ReService.Code == models.ReServiceCodeIOSHUT && mtoServiceItem.MTOShipment.PickupAddress != nil { + if *mtoServiceItem.MTOShipment.PickupAddress.IsOconus { + shuttleSI.Market = models.MarketOconus.FullString() + } else { + shuttleSI.Market = models.MarketConus.FullString() + } + } + + if mtoServiceItem.ReService.Code == models.ReServiceCodeIDSHUT && mtoServiceItem.MTOShipment.DestinationAddress != nil { + if *mtoServiceItem.MTOShipment.DestinationAddress.IsOconus { + shuttleSI.Market = models.MarketOconus.FullString() + } else { + shuttleSI.Market = models.MarketConus.FullString() + } + } + + payload = shuttleSI default: // otherwise, basic service item payload = &primemessages.MTOServiceItemBasic{ diff --git a/pkg/handlers/primeapi/payloads/model_to_payload_test.go b/pkg/handlers/primeapi/payloads/model_to_payload_test.go index 94041d96a99..cb9c4cf3843 100644 --- a/pkg/handlers/primeapi/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapi/payloads/model_to_payload_test.go @@ -965,6 +965,88 @@ func (suite *PayloadsSuite) TestMTOServiceItemDDSHUT() { suite.True(ok) } +func (suite *PayloadsSuite) TestMTOServiceItemIDSHUT() { + reServiceCode := models.ReServiceCodeIDSHUT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + standaloneCrate := false + + mtoServiceItemIDSHUT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + StandaloneCrate: &standaloneCrate, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultIDSHUT := MTOServiceItem(mtoServiceItemIDSHUT) + + suite.NotNil(resultIDSHUT) + + _, ok := resultIDSHUT.(*primemessages.MTOServiceItemInternationalShuttle) + + suite.True(ok) +} + +func (suite *PayloadsSuite) TestMTOServiceItemIOSHUT() { + reServiceCode := models.ReServiceCodeIOSHUT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + standaloneCrate := false + + mtoServiceItemIOSHUT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + StandaloneCrate: &standaloneCrate, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultIOSHUT := MTOServiceItem(mtoServiceItemIOSHUT) + + suite.NotNil(resultIOSHUT) + + _, ok := resultIOSHUT.(*primemessages.MTOServiceItemInternationalShuttle) + + suite.True(ok) +} + func (suite *PayloadsSuite) TestDestinationPostalCodeAndGBLOC() { moveID := uuid.Must(uuid.NewV4()) moveLocator := "TESTTEST" diff --git a/pkg/handlers/primeapi/payloads/payload_to_model.go b/pkg/handlers/primeapi/payloads/payload_to_model.go index 08a64b02b82..53362a88b84 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model.go @@ -537,6 +537,14 @@ func MTOServiceItemModel(mtoServiceItem primemessages.MTOServiceItem) (*models.M model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.EstimatedWeight) model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.ActualWeight) + case primemessages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: + shuttleService := mtoServiceItem.(*primemessages.MTOServiceItemInternationalShuttle) + // values to get from payload + model.ReService.Code = models.ReServiceCode(*shuttleService.ReServiceCode) + model.Reason = shuttleService.Reason + model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.EstimatedWeight) + model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.ActualWeight) + case primemessages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: domesticCrating := mtoServiceItem.(*primemessages.MTOServiceItemDomesticCrating) @@ -722,6 +730,20 @@ func MTOServiceItemModelFromUpdate(mtoServiceItemID string, mtoServiceItem prime model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttle.EstimatedWeight) model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttle.ActualWeight) + if verrs != nil && verrs.HasAny() { + return nil, verrs + } + case primemessages.UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle: + shuttle := mtoServiceItem.(*primemessages.UpdateMTOServiceItemInternationalShuttle) + model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttle.EstimatedWeight) + model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttle.ActualWeight) + + if shuttle.RequestApprovalsRequestedStatus != nil { + pointerValue := *shuttle.RequestApprovalsRequestedStatus + model.RequestedApprovalsRequestedStatus = &pointerValue + model.Status = models.MTOServiceItemStatusSubmitted + } + if verrs != nil && verrs.HasAny() { return nil, verrs } diff --git a/pkg/handlers/primeapi/payloads/payload_to_model_test.go b/pkg/handlers/primeapi/payloads/payload_to_model_test.go index 4ceff5aeb1f..9b5ec6f69a5 100644 --- a/pkg/handlers/primeapi/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapi/payloads/payload_to_model_test.go @@ -29,7 +29,13 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { // DCRT Service Item itemMeasurement := int32(1100) crateMeasurement := int32(1200) + estimatedWeight := int64(1000) + actualWeight := int64(1000) dcrtCode := models.ReServiceCodeDCRT.String() + ddshutCode := models.ReServiceCodeDDSHUT.String() + doshutCode := models.ReServiceCodeDOSHUT.String() + idshutCode := models.ReServiceCodeIDSHUT.String() + ioshutCode := models.ReServiceCodeIOSHUT.String() reason := "Reason" description := "Description" standaloneCrate := false @@ -52,12 +58,49 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { Description: &description, StandaloneCrate: &standaloneCrate, } + DCRTServiceItem.Item.MTOServiceItemDimension = *item DCRTServiceItem.Crate.MTOServiceItemDimension = *crate DCRTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) DCRTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + DDSHUTServiceItem := &primemessages.MTOServiceItemShuttle{ + ReServiceCode: &ddshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + DDSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + DDSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + DOSHUTServiceItem := &primemessages.MTOServiceItemShuttle{ + ReServiceCode: &doshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + DOSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + DOSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + IDSHUTServiceItem := &primemessages.MTOServiceItemInternationalShuttle{ + ReServiceCode: &idshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + IDSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + IDSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + IOSHUTServiceItem := &primemessages.MTOServiceItemInternationalShuttle{ + ReServiceCode: &ioshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + IOSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + IOSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + originReason := "storage at origin" originServiceCode := models.ReServiceCodeDOFSIT.String() originSITEntryDate := strfmt.Date(time.Now()) @@ -240,6 +283,46 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(unit.ThousandthInches(*ICRTServiceItem.Crate.Length), icurtReturnedCrate.Length) }) + suite.Run("Success - Returns a DDSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(DDSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDSHUT, returnedModel.ReService.Code) + suite.Equal(DDSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a DOSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(DOSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDOSHUT, returnedModel.ReService.Code) + suite.Equal(DOSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a IOSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(IOSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeIOSHUT, returnedModel.ReService.Code) + suite.Equal(IOSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a IDSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(IDSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeIDSHUT, returnedModel.ReService.Code) + suite.Equal(IDSHUTServiceItem.Reason, returnedModel.Reason) + }) + suite.Run("Fail - Returns error for ICRT/IUCRT service item because of validation error", func() { // ICRT icrtCode := models.ReServiceCodeICRT.String() diff --git a/pkg/handlers/primeapiv2/mto_service_item.go b/pkg/handlers/primeapiv2/mto_service_item.go index 54ea0540344..5188ccea511 100644 --- a/pkg/handlers/primeapiv2/mto_service_item.go +++ b/pkg/handlers/primeapiv2/mto_service_item.go @@ -26,6 +26,7 @@ var CreateableServiceItemMap = map[primev2messages.MTOServiceItemModelType]bool{ primev2messages.MTOServiceItemModelTypeMTOServiceItemOriginSIT: true, primev2messages.MTOServiceItemModelTypeMTOServiceItemDestSIT: true, primev2messages.MTOServiceItemModelTypeMTOServiceItemShuttle: true, + primev2messages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: true, primev2messages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, primev2messages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, } diff --git a/pkg/handlers/primeapiv2/mto_service_item_test.go b/pkg/handlers/primeapiv2/mto_service_item_test.go index 26964adf462..a48c9bfe87d 100644 --- a/pkg/handlers/primeapiv2/mto_service_item_test.go +++ b/pkg/handlers/primeapiv2/mto_service_item_test.go @@ -187,6 +187,55 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { suite.NotZero(okResponse.Payload[0].ID()) }) + suite.Run("Successful POST for Creating International Shuttling without PrimeEstimatedWeight set - Integration Test", func() { + mto := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: mto, + LinkOnly: true, + }, + }, nil) + mtoShipment.PrimeEstimatedWeight = nil + factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOSHUT) + req := httptest.NewRequest("POST", "/mto-service-items", nil) + reason := "lorem ipsum" + + mtoServiceItem := models.MTOServiceItem{ + MoveTaskOrderID: mto.ID, + MTOShipmentID: &mtoShipment.ID, + ReService: models.ReService{Code: models.ReServiceCodeIOSHUT}, + Reason: &reason, + } + + params := mtoserviceitemops.CreateMTOServiceItemParams{ + HTTPRequest: req, + Body: payloads.MTOServiceItem(&mtoServiceItem), + } + + moveRouter := moverouter.NewMoveRouter() + planner := &routemocks.Planner{} + planner.On("ZipTransitDistance", + mock.AnythingOfType("*appcontext.appContext"), + mock.Anything, + mock.Anything, + ).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{ + suite.HandlerConfig(), + creator, + mtoChecker, + } + + // Validate incoming payload + suite.NoError(params.Body.Validate(strfmt.Default)) + + response := handler.Handle(params) + suite.IsType(&mtoserviceitemops.CreateMTOServiceItemOK{}, response) + okResponse := response.(*mtoserviceitemops.CreateMTOServiceItemOK) + + suite.NotZero(okResponse.Payload[0].ID()) + }) + suite.Run("POST failure - 500", func() { subtestData := makeSubtestData() mockCreator := mocks.MTOServiceItemCreator{} diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload.go b/pkg/handlers/primeapiv2/payloads/model_to_payload.go index 5538b0a0c22..106a3bd5cf3 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload.go @@ -731,6 +731,32 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primev2messages.MTOSe EstimatedWeight: handlers.FmtPoundPtr(mtoServiceItem.EstimatedWeight), ActualWeight: handlers.FmtPoundPtr(mtoServiceItem.ActualWeight), } + case models.ReServiceCodeIDSHUT, models.ReServiceCodeIOSHUT: + shuttleSI := &primev2messages.MTOServiceItemInternationalShuttle{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + RequestApprovalsRequestedStatus: mtoServiceItem.RequestedApprovalsRequestedStatus, + EstimatedWeight: handlers.FmtPoundPtr(mtoServiceItem.EstimatedWeight), + ActualWeight: handlers.FmtPoundPtr(mtoServiceItem.ActualWeight), + } + + if mtoServiceItem.ReService.Code == models.ReServiceCodeIOSHUT && mtoServiceItem.MTOShipment.PickupAddress != nil { + if *mtoServiceItem.MTOShipment.PickupAddress.IsOconus { + shuttleSI.Market = models.MarketOconus.FullString() + } else { + shuttleSI.Market = models.MarketConus.FullString() + } + } + + if mtoServiceItem.ReService.Code == models.ReServiceCodeIDSHUT && mtoServiceItem.MTOShipment.DestinationAddress != nil { + if *mtoServiceItem.MTOShipment.DestinationAddress.IsOconus { + shuttleSI.Market = models.MarketOconus.FullString() + } else { + shuttleSI.Market = models.MarketConus.FullString() + } + } + + payload = shuttleSI default: // otherwise, basic service item payload = &primev2messages.MTOServiceItemBasic{ diff --git a/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go b/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go index 46ee940486a..7b68e2a8e69 100644 --- a/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapiv2/payloads/model_to_payload_test.go @@ -875,6 +875,88 @@ func (suite *PayloadsSuite) TestMTOServiceItemDDSHUT() { suite.True(ok) } +func (suite *PayloadsSuite) TestMTOServiceItemIDSHUT() { + reServiceCode := models.ReServiceCodeIDSHUT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + standaloneCrate := false + + mtoServiceItemIDSHUT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + StandaloneCrate: &standaloneCrate, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultIDSHUT := MTOServiceItem(mtoServiceItemIDSHUT) + + suite.NotNil(resultIDSHUT) + + _, ok := resultIDSHUT.(*primev2messages.MTOServiceItemInternationalShuttle) + + suite.True(ok) +} + +func (suite *PayloadsSuite) TestMTOServiceItemIOSHUT() { + reServiceCode := models.ReServiceCodeIOSHUT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + standaloneCrate := false + + mtoServiceItemIOSHUT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + StandaloneCrate: &standaloneCrate, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultIOSHUT := MTOServiceItem(mtoServiceItemIOSHUT) + + suite.NotNil(resultIOSHUT) + + _, ok := resultIOSHUT.(*primev2messages.MTOServiceItemInternationalShuttle) + + suite.True(ok) +} + func (suite *PayloadsSuite) TestStorageFacilityPayload() { phone := "555" email := "email" diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model.go b/pkg/handlers/primeapiv2/payloads/payload_to_model.go index 40c697b3672..b628bcc0502 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model.go @@ -630,6 +630,14 @@ func MTOServiceItemModel(mtoServiceItem primev2messages.MTOServiceItem) (*models model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.EstimatedWeight) model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.ActualWeight) + case primev2messages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: + shuttleService := mtoServiceItem.(*primev2messages.MTOServiceItemInternationalShuttle) + // values to get from payload + model.ReService.Code = models.ReServiceCode(*shuttleService.ReServiceCode) + model.Reason = shuttleService.Reason + model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.EstimatedWeight) + model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.ActualWeight) + case primev2messages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: domesticCrating := mtoServiceItem.(*primev2messages.MTOServiceItemDomesticCrating) @@ -815,6 +823,20 @@ func MTOServiceItemModelFromUpdate(mtoServiceItemID string, mtoServiceItem prime model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttle.EstimatedWeight) model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttle.ActualWeight) + if verrs != nil && verrs.HasAny() { + return nil, verrs + } + case primev2messages.UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle: + shuttle := mtoServiceItem.(*primev2messages.UpdateMTOServiceItemInternationalShuttle) + model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttle.EstimatedWeight) + model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttle.ActualWeight) + + if shuttle.RequestApprovalsRequestedStatus != nil { + pointerValue := *shuttle.RequestApprovalsRequestedStatus + model.RequestedApprovalsRequestedStatus = &pointerValue + model.Status = models.MTOServiceItemStatusSubmitted + } + if verrs != nil && verrs.HasAny() { return nil, verrs } diff --git a/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go index a576e36173e..3df180b58ea 100644 --- a/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapiv2/payloads/payload_to_model_test.go @@ -29,7 +29,13 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { // DCRT Service Item itemMeasurement := int32(1100) crateMeasurement := int32(1200) + estimatedWeight := int64(1000) + actualWeight := int64(1000) dcrtCode := models.ReServiceCodeDCRT.String() + ddshutCode := models.ReServiceCodeDDSHUT.String() + doshutCode := models.ReServiceCodeDOSHUT.String() + idshutCode := models.ReServiceCodeIDSHUT.String() + ioshutCode := models.ReServiceCodeIOSHUT.String() reason := "Reason" description := "Description" standaloneCrate := false @@ -46,6 +52,42 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { Length: &crateMeasurement, } + DDSHUTServiceItem := &primev2messages.MTOServiceItemShuttle{ + ReServiceCode: &ddshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + DDSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + DDSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + DOSHUTServiceItem := &primev2messages.MTOServiceItemShuttle{ + ReServiceCode: &doshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + DOSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + DOSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + IDSHUTServiceItem := &primev2messages.MTOServiceItemInternationalShuttle{ + ReServiceCode: &idshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + IDSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + IDSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + IOSHUTServiceItem := &primev2messages.MTOServiceItemInternationalShuttle{ + ReServiceCode: &ioshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + IOSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + IOSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + DCRTServiceItem := &primev2messages.MTOServiceItemDomesticCrating{ ReServiceCode: &dcrtCode, Reason: &reason, @@ -219,6 +261,46 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { suite.Equal(unit.ThousandthInches(*ICRTServiceItem.Crate.Length), icurtReturnedCrate.Length) }) + suite.Run("Success - Returns a DDSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(DDSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDSHUT, returnedModel.ReService.Code) + suite.Equal(DDSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a DOSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(DOSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDOSHUT, returnedModel.ReService.Code) + suite.Equal(DOSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a IOSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(IOSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeIOSHUT, returnedModel.ReService.Code) + suite.Equal(IOSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a IDSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(IDSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeIDSHUT, returnedModel.ReService.Code) + suite.Equal(IDSHUTServiceItem.Reason, returnedModel.Reason) + }) + suite.Run("Fail - Returns error for ICRT/IUCRT service item because of validation error", func() { // ICRT icrtCode := models.ReServiceCodeICRT.String() diff --git a/pkg/handlers/primeapiv3/mto_service_item.go b/pkg/handlers/primeapiv3/mto_service_item.go index ef7528e4ddf..f3c16b46e60 100644 --- a/pkg/handlers/primeapiv3/mto_service_item.go +++ b/pkg/handlers/primeapiv3/mto_service_item.go @@ -26,6 +26,7 @@ var CreateableServiceItemMap = map[primev3messages.MTOServiceItemModelType]bool{ primev3messages.MTOServiceItemModelTypeMTOServiceItemOriginSIT: true, primev3messages.MTOServiceItemModelTypeMTOServiceItemDestSIT: true, primev3messages.MTOServiceItemModelTypeMTOServiceItemShuttle: true, + primev3messages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: true, primev3messages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: true, primev3messages.MTOServiceItemModelTypeMTOServiceItemInternationalCrating: true, } diff --git a/pkg/handlers/primeapiv3/mto_service_item_test.go b/pkg/handlers/primeapiv3/mto_service_item_test.go index edbee13d335..b0b02a71aca 100644 --- a/pkg/handlers/primeapiv3/mto_service_item_test.go +++ b/pkg/handlers/primeapiv3/mto_service_item_test.go @@ -188,6 +188,55 @@ func (suite *HandlerSuite) TestCreateMTOServiceItemHandler() { suite.NotZero(okResponse.Payload[0].ID()) }) + suite.Run("Successful POST for Creating International Shuttling without PrimeEstimatedWeight set - Integration Test", func() { + mto := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: mto, + LinkOnly: true, + }, + }, nil) + mtoShipment.PrimeEstimatedWeight = nil + factory.FetchReServiceByCode(suite.DB(), models.ReServiceCodeDOSHUT) + req := httptest.NewRequest("POST", "/mto-service-items", nil) + reason := "lorem ipsum" + + mtoServiceItem := models.MTOServiceItem{ + MoveTaskOrderID: mto.ID, + MTOShipmentID: &mtoShipment.ID, + ReService: models.ReService{Code: models.ReServiceCodeIOSHUT}, + Reason: &reason, + } + + params := mtoserviceitemops.CreateMTOServiceItemParams{ + HTTPRequest: req, + Body: payloads.MTOServiceItem(&mtoServiceItem), + } + + moveRouter := moverouter.NewMoveRouter() + planner := &routemocks.Planner{} + planner.On("ZipTransitDistance", + mock.AnythingOfType("*appcontext.appContext"), + mock.Anything, + mock.Anything, + ).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{ + suite.HandlerConfig(), + creator, + mtoChecker, + } + + // Validate incoming payload + suite.NoError(params.Body.Validate(strfmt.Default)) + + response := handler.Handle(params) + suite.IsType(&mtoserviceitemops.CreateMTOServiceItemOK{}, response) + okResponse := response.(*mtoserviceitemops.CreateMTOServiceItemOK) + + suite.NotZero(okResponse.Payload[0].ID()) + }) + suite.Run("POST failure - 500", func() { subtestData := makeSubtestData() mockCreator := mocks.MTOServiceItemCreator{} diff --git a/pkg/handlers/primeapiv3/payloads/model_to_payload.go b/pkg/handlers/primeapiv3/payloads/model_to_payload.go index 6643847c6b6..5ef6731190a 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload.go @@ -887,6 +887,32 @@ func MTOServiceItem(mtoServiceItem *models.MTOServiceItem) primev3messages.MTOSe PortCode: portCode, } + case models.ReServiceCodeIDSHUT, models.ReServiceCodeIOSHUT: + shuttleSI := &primev3messages.MTOServiceItemInternationalShuttle{ + ReServiceCode: handlers.FmtString(string(mtoServiceItem.ReService.Code)), + Reason: mtoServiceItem.Reason, + RequestApprovalsRequestedStatus: mtoServiceItem.RequestedApprovalsRequestedStatus, + EstimatedWeight: handlers.FmtPoundPtr(mtoServiceItem.EstimatedWeight), + ActualWeight: handlers.FmtPoundPtr(mtoServiceItem.ActualWeight), + } + + if mtoServiceItem.ReService.Code == models.ReServiceCodeIOSHUT && mtoServiceItem.MTOShipment.PickupAddress != nil { + if *mtoServiceItem.MTOShipment.PickupAddress.IsOconus { + shuttleSI.Market = models.MarketOconus.FullString() + } else { + shuttleSI.Market = models.MarketConus.FullString() + } + } + + if mtoServiceItem.ReService.Code == models.ReServiceCodeIDSHUT && mtoServiceItem.MTOShipment.DestinationAddress != nil { + if *mtoServiceItem.MTOShipment.DestinationAddress.IsOconus { + shuttleSI.Market = models.MarketOconus.FullString() + } else { + shuttleSI.Market = models.MarketConus.FullString() + } + } + + payload = shuttleSI default: // otherwise, basic service item payload = &primev3messages.MTOServiceItemBasic{ diff --git a/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go b/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go index 3c17d65dd1a..475008105bb 100644 --- a/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go +++ b/pkg/handlers/primeapiv3/payloads/model_to_payload_test.go @@ -1152,6 +1152,88 @@ func (suite *PayloadsSuite) TestMTOServiceItemDDSHUT() { suite.True(ok) } +func (suite *PayloadsSuite) TestMTOServiceItemIDSHUT() { + reServiceCode := models.ReServiceCodeIDSHUT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + standaloneCrate := false + + mtoServiceItemIDSHUT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + StandaloneCrate: &standaloneCrate, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultIDSHUT := MTOServiceItem(mtoServiceItemIDSHUT) + + suite.NotNil(resultIDSHUT) + + _, ok := resultIDSHUT.(*primev3messages.MTOServiceItemInternationalShuttle) + + suite.True(ok) +} + +func (suite *PayloadsSuite) TestMTOServiceItemIOSHUT() { + reServiceCode := models.ReServiceCodeIOSHUT + reason := "reason" + dateOfContact1 := time.Now() + timeMilitary1 := "1500Z" + firstAvailableDeliveryDate1 := dateOfContact1.AddDate(0, 0, 10) + dateOfContact2 := time.Now().AddDate(0, 0, 5) + timeMilitary2 := "1300Z" + firstAvailableDeliveryDate2 := dateOfContact2.AddDate(0, 0, 10) + standaloneCrate := false + + mtoServiceItemIOSHUT := &models.MTOServiceItem{ + ID: uuid.Must(uuid.NewV4()), + ReService: models.ReService{Code: reServiceCode}, + Reason: &reason, + StandaloneCrate: &standaloneCrate, + CustomerContacts: models.MTOServiceItemCustomerContacts{ + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact1, + TimeMilitary: timeMilitary1, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate1, + Type: models.CustomerContactTypeFirst, + }, + models.MTOServiceItemCustomerContact{ + DateOfContact: dateOfContact2, + TimeMilitary: timeMilitary2, + FirstAvailableDeliveryDate: firstAvailableDeliveryDate2, + Type: models.CustomerContactTypeSecond, + }, + }, + } + + resultIOSHUT := MTOServiceItem(mtoServiceItemIOSHUT) + + suite.NotNil(resultIOSHUT) + + _, ok := resultIOSHUT.(*primev3messages.MTOServiceItemInternationalShuttle) + + suite.True(ok) +} + func (suite *PayloadsSuite) TestStorageFacilityPayload() { phone := "555" email := "email" diff --git a/pkg/handlers/primeapiv3/payloads/payload_to_model.go b/pkg/handlers/primeapiv3/payloads/payload_to_model.go index 47634cb343a..f33d8b2ff34 100644 --- a/pkg/handlers/primeapiv3/payloads/payload_to_model.go +++ b/pkg/handlers/primeapiv3/payloads/payload_to_model.go @@ -795,6 +795,14 @@ func MTOServiceItemModel(mtoServiceItem primev3messages.MTOServiceItem) (*models model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.EstimatedWeight) model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.ActualWeight) + case primev3messages.MTOServiceItemModelTypeMTOServiceItemInternationalShuttle: + shuttleService := mtoServiceItem.(*primev3messages.MTOServiceItemInternationalShuttle) + // values to get from payload + model.ReService.Code = models.ReServiceCode(*shuttleService.ReServiceCode) + model.Reason = shuttleService.Reason + model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.EstimatedWeight) + model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttleService.ActualWeight) + case primev3messages.MTOServiceItemModelTypeMTOServiceItemDomesticCrating: domesticCrating := mtoServiceItem.(*primev3messages.MTOServiceItemDomesticCrating) @@ -980,6 +988,20 @@ func MTOServiceItemModelFromUpdate(mtoServiceItemID string, mtoServiceItem prime model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttle.EstimatedWeight) model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttle.ActualWeight) + if verrs != nil && verrs.HasAny() { + return nil, verrs + } + case primev3messages.UpdateMTOServiceItemModelTypeUpdateMTOServiceItemInternationalShuttle: + shuttle := mtoServiceItem.(*primev3messages.UpdateMTOServiceItemInternationalShuttle) + model.EstimatedWeight = handlers.PoundPtrFromInt64Ptr(shuttle.EstimatedWeight) + model.ActualWeight = handlers.PoundPtrFromInt64Ptr(shuttle.ActualWeight) + + if shuttle.RequestApprovalsRequestedStatus != nil { + pointerValue := *shuttle.RequestApprovalsRequestedStatus + model.RequestedApprovalsRequestedStatus = &pointerValue + model.Status = models.MTOServiceItemStatusSubmitted + } + if verrs != nil && verrs.HasAny() { return nil, verrs } diff --git a/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go b/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go index be2e2356114..fd9430379f0 100644 --- a/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go +++ b/pkg/handlers/primeapiv3/payloads/payload_to_model_test.go @@ -29,7 +29,13 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { // DCRT Service Item itemMeasurement := int32(1100) crateMeasurement := int32(1200) + estimatedWeight := int64(1000) + actualWeight := int64(1000) dcrtCode := models.ReServiceCodeDCRT.String() + ddshutCode := models.ReServiceCodeDDSHUT.String() + doshutCode := models.ReServiceCodeDOSHUT.String() + idshutCode := models.ReServiceCodeIDSHUT.String() + ioshutCode := models.ReServiceCodeIOSHUT.String() reason := "Reason" description := "Description" standaloneCrate := false @@ -58,6 +64,42 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { DCRTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) DCRTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + DDSHUTServiceItem := &primev3messages.MTOServiceItemShuttle{ + ReServiceCode: &ddshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + DDSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + DDSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + DOSHUTServiceItem := &primev3messages.MTOServiceItemShuttle{ + ReServiceCode: &doshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + DOSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + DOSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + IDSHUTServiceItem := &primev3messages.MTOServiceItemInternationalShuttle{ + ReServiceCode: &idshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + IDSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + IDSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + + IOSHUTServiceItem := &primev3messages.MTOServiceItemInternationalShuttle{ + ReServiceCode: &ioshutCode, + Reason: &reason, + EstimatedWeight: &estimatedWeight, + ActualWeight: &actualWeight, + } + IOSHUTServiceItem.SetMoveTaskOrderID(handlers.FmtUUID(moveTaskOrderIDField)) + IOSHUTServiceItem.SetMtoShipmentID(*mtoShipmentIDString) + destReason := "service member will pick up from storage at destination" destServiceCode := models.ReServiceCodeDDFSIT.String() destDate := strfmt.Date(time.Now()) @@ -146,6 +188,46 @@ func (suite *PayloadsSuite) TestMTOServiceItemModel() { }) + suite.Run("Success - Returns a DDSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(DDSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDDSHUT, returnedModel.ReService.Code) + suite.Equal(DDSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a DOSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(DOSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeDOSHUT, returnedModel.ReService.Code) + suite.Equal(DOSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a IOSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(IOSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeIOSHUT, returnedModel.ReService.Code) + suite.Equal(IOSHUTServiceItem.Reason, returnedModel.Reason) + }) + + suite.Run("Success - Returns a IDSHUT service item model", func() { + returnedModel, verrs := MTOServiceItemModel(IDSHUTServiceItem) + + suite.NoVerrs(verrs) + suite.Equal(moveTaskOrderIDField.String(), returnedModel.MoveTaskOrderID.String()) + suite.Equal(mtoShipmentIDField.String(), returnedModel.MTOShipmentID.String()) + suite.Equal(models.ReServiceCodeIDSHUT, returnedModel.ReService.Code) + suite.Equal(IDSHUTServiceItem.Reason, returnedModel.Reason) + }) + suite.Run("Success - Returns a ICRT/IUCRT service item model", func() { // ICRT icrtCode := models.ReServiceCodeICRT.String() diff --git a/pkg/models/mto_service_items.go b/pkg/models/mto_service_items.go index b65f2e7ac96..814febf0e70 100644 --- a/pkg/models/mto_service_items.go +++ b/pkg/models/mto_service_items.go @@ -1,6 +1,8 @@ package models import ( + "database/sql/driver" + "fmt" "time" "github.com/gobuffalo/pop/v6" @@ -252,3 +254,189 @@ func (m MTOServiceItem) GetMTOServiceItemTypeFromServiceItem() MTOServiceItemTyp PODLocationID: m.PODLocationID, } } + +func (m MTOServiceItem) Value() (driver.Value, error) { + var id string + var moveTaskOrderID string + var mtoShipmentID string + var reason string + var pickupPostalCode string + var description string + var rejectionReason string + var approvedAt string + var rejectedAt string + var sitPostalCode string + var sitRequestedDelivery string + var requestedApprovalsRequestedStatus bool + var serviceLocation string + var sitEntryDate string + var sitDepartureDate string + var sitCustomerContacted string + var poeLocationID string + var podLocationID string + var sitDestinationFinalAddressID string + var sitOriginHHGOriginalAddressID string + var sitOriginHHGActualAddressID string + var sitDestinationOriginalAddressID string + var standaloneCrate bool + var lockedPriceCents int64 + var sitDeliveryMiles int + var customerExpenseReason string + var estimatedWeight int64 + var actualWeight int64 + var pricingEstimate int64 + + if m.ID != uuid.Nil { + id = m.ID.String() + } + + if m.MoveTaskOrderID != uuid.Nil { + moveTaskOrderID = m.MoveTaskOrderID.String() + } + + if *m.MTOShipmentID != uuid.Nil { + mtoShipmentID = m.MTOShipmentID.String() + } + + if m.Reason != nil { + reason = *m.Reason + } + + if m.PickupPostalCode != nil { + pickupPostalCode = *m.PickupPostalCode + } + + if m.Description != nil { + description = *m.Description + } + + if m.RejectionReason != nil { + rejectionReason = *m.RejectionReason + } + + if m.ApprovedAt != nil { + approvedAt = m.ApprovedAt.Format("2006-01-02 15:04:05") + } + + if m.RejectedAt != nil { + rejectedAt = m.RejectedAt.Format("2006-01-02 15:04:05") + } + + if m.SITPostalCode != nil { + sitPostalCode = *m.SITPostalCode + } + + if m.SITRequestedDelivery != nil { + sitRequestedDelivery = m.SITRequestedDelivery.Format("2006-01-02 15:04:05") + } + + if m.RequestedApprovalsRequestedStatus != nil { + requestedApprovalsRequestedStatus = *m.RequestedApprovalsRequestedStatus + } + + if m.ServiceLocation != nil { + serviceLocation = string(*m.ServiceLocation) + } + + if m.SITEntryDate != nil { + sitEntryDate = m.SITEntryDate.Format("2006-01-02 15:04:05") + } + + if m.SITDepartureDate != nil { + sitDepartureDate = m.SITDepartureDate.Format("2006-01-02 15:04:05") + } + + if m.SITCustomerContacted != nil { + sitCustomerContacted = m.SITCustomerContacted.Format("2006-01-02 15:04:05") + } + + if m.POELocationID != nil { + poeLocationID = m.POELocationID.String() + } + + if m.PODLocationID != nil { + podLocationID = m.PODLocationID.String() + } + + if m.SITDestinationFinalAddressID != nil { + sitDestinationFinalAddressID = m.SITDestinationFinalAddressID.String() + } + + if m.SITOriginHHGActualAddressID != nil { + sitOriginHHGActualAddressID = m.SITOriginHHGActualAddressID.String() + } + + if m.SITDestinationOriginalAddressID != nil { + sitDestinationOriginalAddressID = m.SITDestinationOriginalAddressID.String() + } + + if m.SITOriginHHGOriginalAddressID != nil { + sitOriginHHGOriginalAddressID = m.SITOriginHHGOriginalAddressID.String() + } + + if m.StandaloneCrate != nil { + standaloneCrate = *m.StandaloneCrate + } + + if m.LockedPriceCents != nil { + lockedPriceCents = m.LockedPriceCents.Int64() + } + + if m.SITDeliveryMiles != nil { + sitDeliveryMiles = *m.SITDeliveryMiles + } + + if m.CustomerExpenseReason != nil { + customerExpenseReason = *m.CustomerExpenseReason + } + + if m.EstimatedWeight != nil { + estimatedWeight = m.EstimatedWeight.Int64() + } + + if m.ActualWeight != nil { + actualWeight = m.ActualWeight.Int64() + } + + if m.PricingEstimate != nil { + pricingEstimate = m.PricingEstimate.Int64() + } + + s := fmt.Sprintf("(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d,%d,%s,%s,%s,%t,%t,%s,%d,%d,%t,%d,%s,%s,%s,%s)", + id, + moveTaskOrderID, + mtoShipmentID, + m.CreatedAt.Format("2006-01-02 15:04:05"), + m.UpdatedAt.Format("2006-01-02 15:04:05"), + reason, + pickupPostalCode, + description, + m.Status, + rejectionReason, + approvedAt, + rejectedAt, + sitPostalCode, + sitEntryDate, + sitDepartureDate, + sitDestinationFinalAddressID, + sitOriginHHGOriginalAddressID, + sitOriginHHGActualAddressID, + estimatedWeight, + actualWeight, + sitDestinationOriginalAddressID, + sitCustomerContacted, + sitRequestedDelivery, + requestedApprovalsRequestedStatus, + m.CustomerExpense, + customerExpenseReason, + sitDeliveryMiles, + pricingEstimate, + standaloneCrate, + lockedPriceCents, + serviceLocation, + poeLocationID, + podLocationID, + m.ReService.Code.String(), + ) + return []byte(s), nil +} diff --git a/pkg/models/mto_service_items_test.go b/pkg/models/mto_service_items_test.go index 720ef5c9226..8d55e1c4bea 100644 --- a/pkg/models/mto_service_items_test.go +++ b/pkg/models/mto_service_items_test.go @@ -110,3 +110,57 @@ func (suite *ModelSuite) TestFetchRelatedDestinationSITServiceItems() { suite.Len(relatedServiceItems, 0, "There should be zero related destination service items") }) } + +func (suite *ModelSuite) TestValue() { + suite.Run("value returns an array", func() { + move := factory.BuildMove(suite.DB(), nil, nil) + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: move, + LinkOnly: true, + }, + }, nil) + msServiceItem := factory.BuildMTOServiceItem(suite.DB(), []factory.Customization{ + { + Model: shipment, + LinkOnly: true, + }, + { + Model: models.ReService{ + Code: models.ReServiceCodeMS, + }, + }, + }, nil) + + byte, err := msServiceItem.Value() + + suite.NotNil(byte) + suite.Nil(err) + }) +} + +func (suite *ModelSuite) TestGetMTOServiceItemTypeFromServiceItem() { + suite.Run("returns service item", func() { + move := factory.BuildMove(suite.DB(), nil, nil) + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: move, + LinkOnly: true, + }, + }, nil) + msServiceItem := factory.BuildMTOServiceItem(suite.DB(), []factory.Customization{ + { + Model: shipment, + LinkOnly: true, + }, + { + Model: models.ReService{ + Code: models.ReServiceCodeMS, + }, + }, + }, nil) + + returnedShipment := msServiceItem.GetMTOServiceItemTypeFromServiceItem() + suite.NotNil(returnedShipment) + }) +} diff --git a/pkg/models/mto_shipments.go b/pkg/models/mto_shipments.go index ee91209f961..b3c69cb52bb 100644 --- a/pkg/models/mto_shipments.go +++ b/pkg/models/mto_shipments.go @@ -3,14 +3,17 @@ package models import ( "database/sql" "fmt" + "slices" "time" "github.com/gobuffalo/pop/v6" "github.com/gobuffalo/validate/v3" "github.com/gobuffalo/validate/v3/validators" "github.com/gofrs/uuid" + "github.com/lib/pq" "github.com/pkg/errors" + "github.com/transcom/mymove/pkg/apperror" "github.com/transcom/mymove/pkg/unit" ) @@ -33,6 +36,20 @@ const ( MarketCodeInternational MarketCode = "i" // international ) +// Add to this list as international service items are implemented +var internationalAccessorialServiceItems = []ReServiceCode{ + ReServiceCodeICRT, + ReServiceCodeIUCRT, + ReServiceCodeIOASIT, + ReServiceCodeIDASIT, + ReServiceCodeIOFSIT, + ReServiceCodeIDFSIT, + ReServiceCodeIOPSIT, + ReServiceCodeIDDSIT, + ReServiceCodeIDSHUT, + ReServiceCodeIOSHUT, +} + const ( // MTOShipmentTypeHHG is an HHG Shipment Type default MTOShipmentTypeHHG MTOShipmentType = "HHG" @@ -432,6 +449,28 @@ func CreateApprovedServiceItemsForShipment(db *pop.Connection, shipment *MTOShip return nil } +func CreateInternationalAccessorialServiceItemsForShipment(db *pop.Connection, shipmentId uuid.UUID, mtoServiceItems MTOServiceItems) ([]string, error) { + if len(mtoServiceItems) == 0 { + err := fmt.Errorf("must request service items to create: %s", shipmentId) + return nil, apperror.NewInvalidInputError(shipmentId, err, nil, err.Error()) + } + + for _, serviceItem := range mtoServiceItems { + if !slices.Contains(internationalAccessorialServiceItems, serviceItem.ReService.Code) { + err := fmt.Errorf("cannot create domestic service items for international shipment: %s", shipmentId) + return nil, apperror.NewInvalidInputError(shipmentId, err, nil, err.Error()) + } + } + + createdServiceItemIDs := []string{} + err := db.RawQuery("CALL create_accessorial_service_items_for_shipment($1, $2, $3)", shipmentId, pq.Array(mtoServiceItems), pq.StringArray(createdServiceItemIDs)).All(&createdServiceItemIDs) + if err != nil { + return nil, apperror.NewInvalidInputError(shipmentId, err, nil, err.Error()) + } + + return createdServiceItemIDs, nil +} + // a db stored proc that will handle updating the pricing_estimate columns of basic service items for shipment types: // iHHG // iUB diff --git a/pkg/models/mto_shipments_test.go b/pkg/models/mto_shipments_test.go index 558e80525bd..62957b6222b 100644 --- a/pkg/models/mto_shipments_test.go +++ b/pkg/models/mto_shipments_test.go @@ -325,6 +325,61 @@ func (suite *ModelSuite) TestCreateApprovedServiceItemsForShipment() { }) } +func (suite *ModelSuite) TestCreateInternationalAccessorialServiceItemsForShipment() { + suite.Run("test creating accessorial service items for shipment", func() { + + move := factory.BuildAvailableToPrimeMove(suite.DB(), nil, nil) + + shipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ + { + Model: models.MTOShipment{ + Status: models.MTOShipmentStatusApproved, + }, + }, + { + Model: move, + LinkOnly: true, + }, + }, nil) + + serviceItem := factory.BuildMTOServiceItemBasic(suite.DB(), []factory.Customization{ + { + Model: models.MTOServiceItem{ + RejectionReason: models.StringPointer("not applicable"), + MTOShipmentID: &shipment.ID, + Reason: models.StringPointer("this is a special item"), + EstimatedWeight: models.PoundPointer(400), + ActualWeight: models.PoundPointer(500), + }, + }, + { + Model: move, + LinkOnly: true, + }, + { + Model: shipment, + LinkOnly: true, + }, + { + Model: models.ReService{ + Code: models.ReServiceCodeIDSHUT, + }, + }, + }, nil) + + serviceItem.MTOShipment = shipment + serviceItemIds, err := models.CreateInternationalAccessorialServiceItemsForShipment(suite.DB(), shipment.ID, models.MTOServiceItems{serviceItem}) + suite.NoError(err) + suite.NotNil(serviceItemIds) + }) + + suite.Run("test error handling for invalid shipment", func() { + serviceItemIds, err := models.CreateInternationalAccessorialServiceItemsForShipment(suite.DB(), uuid.Nil, models.MTOServiceItems{}) + suite.Error(err) + suite.Nil(serviceItemIds) + }) +} + func (suite *ModelSuite) TestFindShipmentByID() { suite.Run("success - test find", func() { shipment := factory.BuildMTOShipmentMinimal(suite.DB(), nil, nil) @@ -485,3 +540,25 @@ func (suite *ModelSuite) TestGetDestinationGblocForShipment() { suite.Equal(*gbloc, "USMC") }) } + +func (suite *ModelSuite) TestIsPPMShipment() { + suite.Run("true - shipment is a ppm", func() { + ppmShipment := factory.BuildPPMShipment(suite.DB(), nil, nil) + mtoShipment := factory.BuildMTOShipmentMinimal(suite.DB(), nil, nil) + + mtoShipment.PPMShipment = &ppmShipment + mtoShipment.ShipmentType = models.MTOShipmentTypePPM + + isPPM := mtoShipment.IsPPMShipment() + suite.NotNil(isPPM) + suite.Equal(isPPM, true) + }) + + suite.Run("false - shipment is not a ppm", func() { + nonPPMshipment := factory.BuildMTOShipmentMinimal(suite.DB(), nil, nil) + + isPPM := nonPPMshipment.IsPPMShipment() + suite.NotNil(isPPM) + suite.Equal(isPPM, false) + }) +} diff --git a/pkg/payment_request/service_param_value_lookups/market_destination_lookup.go b/pkg/payment_request/service_param_value_lookups/market_destination_lookup.go new file mode 100644 index 00000000000..61c3234ed41 --- /dev/null +++ b/pkg/payment_request/service_param_value_lookups/market_destination_lookup.go @@ -0,0 +1,20 @@ +package serviceparamvaluelookups + +import ( + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/handlers" + "github.com/transcom/mymove/pkg/models" +) + +type MarketDestinationLookup struct { + Address models.Address +} + +func (r MarketDestinationLookup) lookup(_ appcontext.AppContext, _ *ServiceItemParamKeyData) (string, error) { + international := r.Address.IsOconus + value := handlers.FmtString(models.MarketConus.String()) + if *international { + value = handlers.FmtString(models.MarketOconus.String()) + } + return *value, nil +} diff --git a/pkg/payment_request/service_param_value_lookups/market_destination_lookup_test.go b/pkg/payment_request/service_param_value_lookups/market_destination_lookup_test.go new file mode 100644 index 00000000000..f4195887f5f --- /dev/null +++ b/pkg/payment_request/service_param_value_lookups/market_destination_lookup_test.go @@ -0,0 +1,49 @@ +package serviceparamvaluelookups + +import ( + "github.com/transcom/mymove/pkg/models" +) + +func (suite *ServiceParamValueLookupsSuite) TestMarketDestinationLookup() { + suite.Run("test conus market destination lookup", func() { + falseBool := false + conusAddress := models.Address{ + StreetAddress1: "987 Other Avenue", + StreetAddress2: models.StringPointer("P.O. Box 1234"), + StreetAddress3: models.StringPointer("c/o Another Person"), + City: "Des Moines", + State: "IA", + PostalCode: "50309", + IsOconus: &falseBool, + } + + conusLookup := MarketDestinationLookup{ + Address: conusAddress, + } + + value, err := conusLookup.lookup(nil, nil) + suite.FatalNoError(err) + suite.Equal(models.MarketConus.String(), value) + }) + + suite.Run("test oconus market destination lookup", func() { + trueBool := true + oconusAddress := models.Address{ + StreetAddress1: "987 Other Avenue", + StreetAddress2: models.StringPointer("P.O. Box 1234"), + StreetAddress3: models.StringPointer("c/o Another Person"), + City: "Des Moines", + State: "AK", + PostalCode: "99720", + IsOconus: &trueBool, + } + + oconusLookup := MarketDestinationLookup{ + Address: oconusAddress, + } + + value, err := oconusLookup.lookup(nil, nil) + suite.FatalNoError(err) + suite.Equal(models.MarketOconus.String(), value) + }) +} diff --git a/pkg/payment_request/service_param_value_lookups/market_origin_lookup.go b/pkg/payment_request/service_param_value_lookups/market_origin_lookup.go new file mode 100644 index 00000000000..cf857ebfe2b --- /dev/null +++ b/pkg/payment_request/service_param_value_lookups/market_origin_lookup.go @@ -0,0 +1,20 @@ +package serviceparamvaluelookups + +import ( + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/handlers" + "github.com/transcom/mymove/pkg/models" +) + +type MarketOriginLookup struct { + Address models.Address +} + +func (r MarketOriginLookup) lookup(_ appcontext.AppContext, _ *ServiceItemParamKeyData) (string, error) { + international := r.Address.IsOconus + value := handlers.FmtString(models.MarketConus.String()) + if *international { + value = handlers.FmtString(models.MarketOconus.String()) + } + return *value, nil +} diff --git a/pkg/payment_request/service_param_value_lookups/market_origin_lookup_test.go b/pkg/payment_request/service_param_value_lookups/market_origin_lookup_test.go new file mode 100644 index 00000000000..514d40f2f0f --- /dev/null +++ b/pkg/payment_request/service_param_value_lookups/market_origin_lookup_test.go @@ -0,0 +1,49 @@ +package serviceparamvaluelookups + +import ( + "github.com/transcom/mymove/pkg/models" +) + +func (suite *ServiceParamValueLookupsSuite) TestMarketOriginLookup() { + falseBool := false + suite.Run("test conus market origin lookup", func() { + conusAddress := models.Address{ + StreetAddress1: "987 Other Avenue", + StreetAddress2: models.StringPointer("P.O. Box 1234"), + StreetAddress3: models.StringPointer("c/o Another Person"), + City: "Des Moines", + State: "IA", + PostalCode: "50309", + IsOconus: &falseBool, + } + + conusLookup := MarketOriginLookup{ + Address: conusAddress, + } + + value, err := conusLookup.lookup(nil, nil) + suite.FatalNoError(err) + suite.Equal(value, models.MarketConus.String()) + }) + + suite.Run("test oconus market origin lookup", func() { + trueBool := true + oconusAddress := models.Address{ + StreetAddress1: "987 Other Avenue", + StreetAddress2: models.StringPointer("P.O. Box 1234"), + StreetAddress3: models.StringPointer("c/o Another Person"), + City: "Des Moines", + State: "AK", + PostalCode: "99720", + IsOconus: &trueBool, + } + + oconusLookup := MarketOriginLookup{ + Address: oconusAddress, + } + + value, err := oconusLookup.lookup(nil, nil) + suite.FatalNoError(err) + suite.Equal(value, models.MarketOconus.String()) + }) +} diff --git a/pkg/payment_request/service_param_value_lookups/service_param_value_lookups.go b/pkg/payment_request/service_param_value_lookups/service_param_value_lookups.go index d5f73e1ff2d..580ec02bc19 100644 --- a/pkg/payment_request/service_param_value_lookups/service_param_value_lookups.go +++ b/pkg/payment_request/service_param_value_lookups/service_param_value_lookups.go @@ -88,6 +88,8 @@ var ServiceItemParamsWithLookups = []models.ServiceItemParamName{ models.ServiceItemParamNameLockedPriceCents, models.ServiceItemParamNamePerUnitCents, models.ServiceItemParamNamePortZip, + models.ServiceItemParamNameMarketDest, + models.ServiceItemParamNameMarketOrigin, } // ServiceParamLookupInitialize initializes service parameter lookup @@ -441,6 +443,14 @@ func InitializeLookups(appCtx appcontext.AppContext, shipment models.MTOShipment ServiceItem: serviceItem, } + lookups[models.ServiceItemParamNameMarketOrigin] = MarketOriginLookup{ + Address: *shipment.PickupAddress, + } + + lookups[models.ServiceItemParamNameMarketDest] = MarketDestinationLookup{ + Address: *shipment.DestinationAddress, + } + return lookups } diff --git a/pkg/rateengine/linehaul.go b/pkg/rateengine/linehaul.go deleted file mode 100644 index 914509499bc..00000000000 --- a/pkg/rateengine/linehaul.go +++ /dev/null @@ -1,17 +0,0 @@ -package rateengine - -import ( - "github.com/transcom/mymove/pkg/unit" -) - -// LinehaulCostComputation represents the results of a computation. -// Deprecated: This is part of the old pre-GHC rate engine. -type LinehaulCostComputation struct { - BaseLinehaul unit.Cents - OriginLinehaulFactor unit.Cents - DestinationLinehaulFactor unit.Cents - ShorthaulCharge unit.Cents - LinehaulChargeTotal unit.Cents - Mileage int - FuelSurcharge FeeAndRate -} diff --git a/pkg/rateengine/nonlinehaul.go b/pkg/rateengine/nonlinehaul.go deleted file mode 100644 index 7e3dacf59a1..00000000000 --- a/pkg/rateengine/nonlinehaul.go +++ /dev/null @@ -1,21 +0,0 @@ -package rateengine - -import ( - "github.com/transcom/mymove/pkg/unit" -) - -// FeeAndRate holds the rate lookup and calculated fee (non-discounted) -// Deprecated: This is part of the old pre-GHC rate engine. -type FeeAndRate struct { - Fee unit.Cents - Rate unit.Millicents -} - -// NonLinehaulCostComputation represents the results of a computation. -// Deprecated: This is part of the old pre-GHC rate engine. -type NonLinehaulCostComputation struct { - OriginService FeeAndRate - DestinationService FeeAndRate - Pack FeeAndRate - Unpack FeeAndRate -} diff --git a/pkg/rateengine/rateengine.go b/pkg/rateengine/rateengine.go deleted file mode 100644 index 5b0b45d7013..00000000000 --- a/pkg/rateengine/rateengine.go +++ /dev/null @@ -1,75 +0,0 @@ -package rateengine - -import ( - "time" - - "github.com/pkg/errors" - "go.uber.org/zap" - - "github.com/transcom/mymove/pkg/appcontext" - "github.com/transcom/mymove/pkg/models" - "github.com/transcom/mymove/pkg/unit" -) - -// RateEngine encapsulates the TSP rate engine process -// Deprecated: This is part of the old pre-GHC rate engine. -type RateEngine struct { - move models.Move -} - -// CostComputation represents the results of a computation. -// Deprecated: This is part of the old pre-GHC rate engine. -type CostComputation struct { - LinehaulCostComputation - NonLinehaulCostComputation - - SITFee unit.Cents - SITMax unit.Cents - GCC unit.Cents - LHDiscount unit.DiscountRate - SITDiscount unit.DiscountRate - Weight unit.Pound -} - -// CostDetail holds the costComputation and a bool that signifies if the calculation is the winning (lowest cost) computation -// Deprecated: This is part of the old pre-GHC rate engine. -type CostDetail struct { - Cost CostComputation - IsWinning bool -} - -// CostDetails is a map of CostDetail -// Deprecated: This is part of the old pre-GHC rate engine. -type CostDetails map[string]*CostDetail - -// ComputePPMMoveCosts uses zip codes to make two calculations for the price of a PPM move - once with the pickup zip and once with the current duty location zip - and returns both calcs. -// Deprecated: This is part of the old pre-GHC rate engine. -func (re *RateEngine) ComputePPMMoveCosts(appCtx appcontext.AppContext, _ unit.Pound, _ string, _ string, _ string, _ int, _ int, _ time.Time, _ int) (costDetails CostDetails, err error) { - errDeprecated := errors.New("ComputePPMMoveCosts function is deprecated") - appCtx.Logger().Error("Invoking deprecated function", zap.Error(errDeprecated)) - return nil, errDeprecated -} - -// GetWinningCostMove returns a costComputation of the winning calculation -// Deprecated: This is part of the old pre-GHC rate engine. -func GetWinningCostMove(costDetails CostDetails) CostComputation { - if costDetails["pickupLocation"].IsWinning { - return costDetails["pickupLocation"].Cost - } - return costDetails["originDutyLocation"].Cost -} - -// GetNonWinningCostMove returns a costComputation of the non-winning calculation -// Deprecated: This is part of the old pre-GHC rate engine. -func GetNonWinningCostMove(costDetails CostDetails) CostComputation { - if costDetails["pickupLocation"].IsWinning { - return costDetails["originDutyLocation"].Cost - } - return costDetails["pickupLocation"].Cost -} - -// NewRateEngine creates a new RateEngine -// Deprecated: This is part of the old pre-GHC rate engine. -func NewRateEngine(move models.Move) *RateEngine { - return &RateEngine{move: move} -} diff --git a/pkg/services/ghc_rate_engine.go b/pkg/services/ghc_rate_engine.go index 2247e3d7426..2aa23954ce6 100644 --- a/pkg/services/ghc_rate_engine.go +++ b/pkg/services/ghc_rate_engine.go @@ -85,7 +85,7 @@ type DomesticOriginShuttlingPricer interface { ParamsPricer } -// DomesticDestinationShuttlingPricer prices the domestic origin shuttling service for a GHC Move +// DomesticDestinationShuttlingPricer prices the domestic destination shuttling service for a GHC Move // //go:generate mockery --name DomesticDestinationShuttlingPricer type DomesticDestinationShuttlingPricer interface { @@ -93,6 +93,22 @@ type DomesticDestinationShuttlingPricer interface { ParamsPricer } +// InternationalDestinationShuttlingPricer prices the international destination shuttling service for a GHC Move +// +//go:generate mockery --name InternationalDestinationShuttlingPricer +type InternationalDestinationShuttlingPricer interface { + Price(appCtx appcontext.AppContext, contractCode string, requestedPickupDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, PricingDisplayParams, error) + ParamsPricer +} + +// InternationalOriginShuttlingPricer prices the international origin shuttling service for a GHC Move +// +//go:generate mockery --name InternationalOriginShuttlingPricer +type InternationalOriginShuttlingPricer interface { + Price(appCtx appcontext.AppContext, contractCode string, requestedPickupDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, PricingDisplayParams, error) + ParamsPricer +} + // DomesticCratingPricer prices the domestic crating service for a GHC Move // //go:generate mockery --name DomesticCratingPricer diff --git a/pkg/services/ghcrateengine/ghc_rate_engine_service_test.go b/pkg/services/ghcrateengine/ghc_rate_engine_service_test.go index 8fcd52d9d34..c5bcbebac4c 100644 --- a/pkg/services/ghcrateengine/ghc_rate_engine_service_test.go +++ b/pkg/services/ghcrateengine/ghc_rate_engine_service_test.go @@ -84,6 +84,27 @@ func (suite *GHCRateEngineServiceSuite) setupDomesticAccessorialPrice(code model suite.MustSave(&accessorialPrice) } +func (suite *GHCRateEngineServiceSuite) setupInternationalAccessorialPrice(code models.ReServiceCode, market models.Market, perUnitCents unit.Cents, contractYearName string, escalationCompounded float64) { + contractYear := testdatagen.MakeReContractYear(suite.DB(), + testdatagen.Assertions{ + ReContractYear: models.ReContractYear{ + Name: contractYearName, + EscalationCompounded: escalationCompounded, + }, + }) + + service := factory.FetchReServiceByCode(suite.DB(), code) + + accessorialPrice := models.ReIntlAccessorialPrice{ + ContractID: contractYear.Contract.ID, + ServiceID: service.ID, + PerUnitCents: perUnitCents, + Market: market, + } + + suite.MustSave(&accessorialPrice) +} + func (suite *GHCRateEngineServiceSuite) setupDomesticServiceAreaPrice(code models.ReServiceCode, serviceAreaCode string, isPeakPeriod bool, priceCents unit.Cents, contractYearName string, escalationCompounded float64) { contractYear := testdatagen.FetchOrMakeReContractYear(suite.DB(), testdatagen.Assertions{ diff --git a/pkg/services/ghcrateengine/international_destination_shuttling_pricer.go b/pkg/services/ghcrateengine/international_destination_shuttling_pricer.go new file mode 100644 index 00000000000..226672230d2 --- /dev/null +++ b/pkg/services/ghcrateengine/international_destination_shuttling_pricer.go @@ -0,0 +1,48 @@ +package ghcrateengine + +import ( + "time" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" + "github.com/transcom/mymove/pkg/unit" +) + +type internationalDestinationShuttlingPricer struct { +} + +// NewInternationalDestinationShuttlingPricer creates a new pricer for international destination shuttle +func NewInternationalDestinationShuttlingPricer() services.InternationalDestinationShuttlingPricer { + return &internationalDestinationShuttlingPricer{} +} + +// Price determines the price for international destination shuttle +func (p internationalDestinationShuttlingPricer) Price(appCtx appcontext.AppContext, contractCode string, referenceDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, services.PricingDisplayParams, error) { + return priceInternationalShuttling(appCtx, models.ReServiceCodeIDSHUT, contractCode, referenceDate, weight, market) +} + +// PriceUsingParams determines the price for international destination shuttle given PaymentServiceItemParams +func (p internationalDestinationShuttlingPricer) PriceUsingParams(appCtx appcontext.AppContext, params models.PaymentServiceItemParams) (unit.Cents, services.PricingDisplayParams, error) { + contractCode, err := getParamString(params, models.ServiceItemParamNameContractCode) + if err != nil { + return unit.Cents(0), nil, err + } + + referenceDate, err := getParamTime(params, models.ServiceItemParamNameReferenceDate) + if err != nil { + return unit.Cents(0), nil, err + } + + market, err := getParamMarket(params, models.ServiceItemParamNameMarketDest) + if err != nil { + return unit.Cents(0), nil, err + } + + weightBilled, err := getParamInt(params, models.ServiceItemParamNameWeightBilled) + if err != nil { + return unit.Cents(0), nil, err + } + + return p.Price(appCtx, contractCode, referenceDate, unit.Pound(weightBilled), market) +} diff --git a/pkg/services/ghcrateengine/international_destination_shuttling_pricer_test.go b/pkg/services/ghcrateengine/international_destination_shuttling_pricer_test.go new file mode 100644 index 00000000000..cae0ce84a3f --- /dev/null +++ b/pkg/services/ghcrateengine/international_destination_shuttling_pricer_test.go @@ -0,0 +1,109 @@ +package ghcrateengine + +import ( + "fmt" + "time" + + "github.com/transcom/mymove/pkg/factory" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" + "github.com/transcom/mymove/pkg/testdatagen" + "github.com/transcom/mymove/pkg/unit" +) + +const ( + idshutTestMarket = models.Market("O") + idshutTestBasePriceCents = unit.Cents(353) + idshutTestEscalationCompounded = 1.125 + idshutTestWeight = unit.Pound(4000) + idshutTestPriceCents = unit.Cents(15880) +) + +var idshutTestRequestedPickupDate = time.Date(testdatagen.TestYear, time.June, 5, 7, 33, 11, 456, time.UTC) + +func (suite *GHCRateEngineServiceSuite) TestInternationalDestinationShuttlingPricer() { + pricer := NewInternationalDestinationShuttlingPricer() + + suite.Run("success using PaymentServiceItemParams", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, ioshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + + paymentServiceItem := suite.setupInternationalDestinationShuttlingServiceItem() + priceCents, displayParams, err := pricer.PriceUsingParams(suite.AppContextForTest(), paymentServiceItem.PaymentServiceItemParams) + suite.NoError(err) + suite.Equal(idshutTestPriceCents, priceCents) + + expectedParams := services.PricingDisplayParams{ + {Key: models.ServiceItemParamNameContractYearName, Value: testdatagen.DefaultContractCode}, + {Key: models.ServiceItemParamNameEscalationCompounded, Value: FormatEscalation(idshutTestEscalationCompounded)}, + {Key: models.ServiceItemParamNamePriceRateOrFactor, Value: FormatCents(idshutTestBasePriceCents)}, + } + suite.validatePricerCreatedParams(expectedParams, displayParams) + }) + + suite.Run("success without PaymentServiceItemParams", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, ioshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + + priceCents, _, err := pricer.Price(suite.AppContextForTest(), testdatagen.DefaultContractCode, idshutTestRequestedPickupDate, idshutTestWeight, idshutTestMarket) + suite.NoError(err) + suite.Equal(idshutTestPriceCents, priceCents) + }) + + suite.Run("PriceUsingParams but sending empty params", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, ioshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + _, _, err := pricer.PriceUsingParams(suite.AppContextForTest(), models.PaymentServiceItemParams{}) + suite.Error(err) + }) + + suite.Run("invalid weight", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, ioshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + badWeight := unit.Pound(250) + _, _, err := pricer.Price(suite.AppContextForTest(), testdatagen.DefaultContractCode, idshutTestRequestedPickupDate, badWeight, idshutTestMarket) + suite.Error(err) + suite.Contains(err.Error(), "Weight must be a minimum of 500") + }) + + suite.Run("not finding a rate record", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, ioshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + _, _, err := pricer.Price(suite.AppContextForTest(), "BOGUS", idshutTestRequestedPickupDate, idshutTestWeight, idshutTestMarket) + suite.Error(err) + suite.Contains(err.Error(), "could not lookup International Accessorial Area Price") + }) + + suite.Run("not finding a contract year record", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, ioshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + twoYearsLaterPickupDate := idshutTestRequestedPickupDate.AddDate(2, 0, 0) + _, _, err := pricer.Price(suite.AppContextForTest(), testdatagen.DefaultContractCode, twoYearsLaterPickupDate, idshutTestWeight, idshutTestMarket) + suite.Error(err) + + suite.Contains(err.Error(), "could not calculate escalated price") + }) +} + +func (suite *GHCRateEngineServiceSuite) setupInternationalDestinationShuttlingServiceItem() models.PaymentServiceItem { + return factory.BuildPaymentServiceItemWithParams( + suite.DB(), + models.ReServiceCodeIDSHUT, + []factory.CreatePaymentServiceItemParams{ + { + Key: models.ServiceItemParamNameContractCode, + KeyType: models.ServiceItemParamTypeString, + Value: factory.DefaultContractCode, + }, + { + Key: models.ServiceItemParamNameReferenceDate, + KeyType: models.ServiceItemParamTypeDate, + Value: idshutTestRequestedPickupDate.Format(DateParamFormat), + }, + { + Key: models.ServiceItemParamNameMarketDest, + KeyType: models.ServiceItemParamTypeString, + Value: idshutTestMarket.String(), + }, + { + Key: models.ServiceItemParamNameWeightBilled, + KeyType: models.ServiceItemParamTypeInteger, + Value: fmt.Sprintf("%d", int(idshutTestWeight)), + }, + }, nil, nil, + ) +} diff --git a/pkg/services/ghcrateengine/international_origin_shuttling_pricer.go b/pkg/services/ghcrateengine/international_origin_shuttling_pricer.go new file mode 100644 index 00000000000..6c499d3a41b --- /dev/null +++ b/pkg/services/ghcrateengine/international_origin_shuttling_pricer.go @@ -0,0 +1,48 @@ +package ghcrateengine + +import ( + "time" + + "github.com/transcom/mymove/pkg/appcontext" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" + "github.com/transcom/mymove/pkg/unit" +) + +type internationalOriginShuttlingPricer struct { +} + +// NewInternationalOriginShuttlingPricer creates a new pricer for international origin shuttle +func NewInternationalOriginShuttlingPricer() services.InternationalOriginShuttlingPricer { + return &internationalOriginShuttlingPricer{} +} + +// Price determines the price for international origin shuttle +func (p internationalOriginShuttlingPricer) Price(appCtx appcontext.AppContext, contractCode string, referenceDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, services.PricingDisplayParams, error) { + return priceInternationalShuttling(appCtx, models.ReServiceCodeIOSHUT, contractCode, referenceDate, weight, market) +} + +// PriceUsingParams determines the price for international origin shuttle given PaymentServiceItemParams +func (p internationalOriginShuttlingPricer) PriceUsingParams(appCtx appcontext.AppContext, params models.PaymentServiceItemParams) (unit.Cents, services.PricingDisplayParams, error) { + contractCode, err := getParamString(params, models.ServiceItemParamNameContractCode) + if err != nil { + return unit.Cents(0), nil, err + } + + referenceDate, err := getParamTime(params, models.ServiceItemParamNameReferenceDate) + if err != nil { + return unit.Cents(0), nil, err + } + + market, err := getParamMarket(params, models.ServiceItemParamNameMarketOrigin) + if err != nil { + return unit.Cents(0), nil, err + } + + weightBilled, err := getParamInt(params, models.ServiceItemParamNameWeightBilled) + if err != nil { + return unit.Cents(0), nil, err + } + + return p.Price(appCtx, contractCode, referenceDate, unit.Pound(weightBilled), market) +} diff --git a/pkg/services/ghcrateengine/international_origin_shuttling_pricer_test.go b/pkg/services/ghcrateengine/international_origin_shuttling_pricer_test.go new file mode 100644 index 00000000000..0f18a1ed70a --- /dev/null +++ b/pkg/services/ghcrateengine/international_origin_shuttling_pricer_test.go @@ -0,0 +1,110 @@ +package ghcrateengine + +import ( + "fmt" + "time" + + "github.com/transcom/mymove/pkg/factory" + "github.com/transcom/mymove/pkg/models" + "github.com/transcom/mymove/pkg/services" + "github.com/transcom/mymove/pkg/testdatagen" + "github.com/transcom/mymove/pkg/unit" +) + +const ( + ioshutTestMarket = "O" + ioshutTestBasePriceCents = unit.Cents(353) + ioshutTestEscalationCompounded = 1.125 + ioshutTestWeight = unit.Pound(4000) + ioshutTestPriceCents = unit.Cents(15880) +) + +var ioshutTestRequestedPickupDate = time.Date(testdatagen.TestYear, time.June, 5, 7, 33, 11, 456, time.UTC) + +func (suite *GHCRateEngineServiceSuite) TestInternationalOriginShuttlingPricer() { + pricer := NewInternationalOriginShuttlingPricer() + + suite.Run("success using PaymentServiceItemParams", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + + paymentServiceItem := suite.setupInternationalOriginShuttlingServiceItem() + priceCents, displayParams, err := pricer.PriceUsingParams(suite.AppContextForTest(), paymentServiceItem.PaymentServiceItemParams) + suite.NoError(err) + suite.Equal(ioshutTestPriceCents, priceCents) + + expectedParams := services.PricingDisplayParams{ + {Key: models.ServiceItemParamNameContractYearName, Value: testdatagen.DefaultContractCode}, + {Key: models.ServiceItemParamNameEscalationCompounded, Value: FormatEscalation(ioshutTestEscalationCompounded)}, + {Key: models.ServiceItemParamNamePriceRateOrFactor, Value: FormatCents(ioshutTestBasePriceCents)}, + } + suite.validatePricerCreatedParams(expectedParams, displayParams) + }) + + suite.Run("success without PaymentServiceItemParams", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + + priceCents, _, err := pricer.Price(suite.AppContextForTest(), testdatagen.DefaultContractCode, ioshutTestRequestedPickupDate, ioshutTestWeight, ioshutTestMarket) + suite.NoError(err) + suite.Equal(ioshutTestPriceCents, priceCents) + }) + + suite.Run("PriceUsingParams but sending empty params", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + _, _, err := pricer.PriceUsingParams(suite.AppContextForTest(), models.PaymentServiceItemParams{}) + suite.Error(err) + }) + + suite.Run("invalid weight", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + badWeight := unit.Pound(250) + _, _, err := pricer.Price(suite.AppContextForTest(), testdatagen.DefaultContractCode, ioshutTestRequestedPickupDate, badWeight, ioshutTestMarket) + suite.Error(err) + suite.Contains(err.Error(), "Weight must be a minimum of 500") + }) + + suite.Run("not finding a rate record", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + _, _, err := pricer.Price(suite.AppContextForTest(), "BOGUS", ioshutTestRequestedPickupDate, ioshutTestWeight, ioshutTestMarket) + suite.Error(err) + suite.Contains(err.Error(), "could not lookup International Accessorial Area Price") + }) + + suite.Run("not finding a contract year record", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + twoYearsLaterPickupDate := ioshutTestRequestedPickupDate.AddDate(2, 0, 0) + _, _, err := pricer.Price(suite.AppContextForTest(), testdatagen.DefaultContractCode, twoYearsLaterPickupDate, ioshutTestWeight, ioshutTestMarket) + suite.Error(err) + + suite.Contains(err.Error(), "could not calculate escalated price") + + }) +} + +func (suite *GHCRateEngineServiceSuite) setupInternationalOriginShuttlingServiceItem() models.PaymentServiceItem { + return factory.BuildPaymentServiceItemWithParams( + suite.DB(), + models.ReServiceCodeIOSHUT, + []factory.CreatePaymentServiceItemParams{ + { + Key: models.ServiceItemParamNameContractCode, + KeyType: models.ServiceItemParamTypeString, + Value: factory.DefaultContractCode, + }, + { + Key: models.ServiceItemParamNameReferenceDate, + KeyType: models.ServiceItemParamTypeDate, + Value: ioshutTestRequestedPickupDate.Format(DateParamFormat), + }, + { + Key: models.ServiceItemParamNameMarketOrigin, + KeyType: models.ServiceItemParamTypeString, + Value: ioshutTestMarket, + }, + { + Key: models.ServiceItemParamNameWeightBilled, + KeyType: models.ServiceItemParamTypeInteger, + Value: fmt.Sprintf("%d", int(ioshutTestWeight)), + }, + }, nil, nil, + ) +} diff --git a/pkg/services/ghcrateengine/param_convert.go b/pkg/services/ghcrateengine/param_convert.go index 16ecf8d9fe6..553794946be 100644 --- a/pkg/services/ghcrateengine/param_convert.go +++ b/pkg/services/ghcrateengine/param_convert.go @@ -66,6 +66,20 @@ func getParamString(params models.PaymentServiceItemParams, name models.ServiceI return paymentServiceItemParam.Value, nil } +func getParamMarket(params models.PaymentServiceItemParams, name models.ServiceItemParamName) (models.Market, error) { + paymentServiceItemParam := getPaymentServiceItemParam(params, name) + if paymentServiceItemParam == nil { + return "", fmt.Errorf("could not find param with key %s", name) + } + + paramType := paymentServiceItemParam.ServiceItemParamKey.Type + if paramType != models.ServiceItemParamTypeString { + return "", fmt.Errorf("trying to convert %s to a string, but param is of type %s", name, paramType) + } + + return models.Market(paymentServiceItemParam.Value), nil +} + func getParamTime(params models.PaymentServiceItemParams, name models.ServiceItemParamName) (time.Time, error) { paymentServiceItemParam := getPaymentServiceItemParam(params, name) if paymentServiceItemParam == nil { diff --git a/pkg/services/ghcrateengine/param_convert_test.go b/pkg/services/ghcrateengine/param_convert_test.go index f4a5ddc5867..9da3a9deb33 100644 --- a/pkg/services/ghcrateengine/param_convert_test.go +++ b/pkg/services/ghcrateengine/param_convert_test.go @@ -145,6 +145,26 @@ func (suite *GHCRateEngineServiceSuite) Test_getParamTime() { }) } +func (suite *GHCRateEngineServiceSuite) Test_getParamMarket() { + + params := models.PaymentServiceItemParams{ + setupParamConvertParam(models.ServiceItemParamNameMarketOrigin, models.ServiceItemParamTypeString, models.MarketConus.String()), + setupParamConvertParam(models.ServiceItemParamNameMarketDest, models.ServiceItemParamTypeString, models.MarketOconus.String()), + } + + suite.Run("finding expected market origin", func() { + value, err := getParamMarket(params, models.ServiceItemParamNameMarketOrigin) + suite.NoError(err) + suite.Equal(models.MarketConus, value) + }) + + suite.Run("finding expected market destination", func() { + value, err := getParamMarket(params, models.ServiceItemParamNameMarketDest) + suite.NoError(err) + suite.Equal(models.MarketOconus, value) + }) +} + func setupParamConvertParam(key models.ServiceItemParamName, keyType models.ServiceItemParamType, value string) models.PaymentServiceItemParam { return models.PaymentServiceItemParam{ Value: value, diff --git a/pkg/services/ghcrateengine/pricer_helpers_intl.go b/pkg/services/ghcrateengine/pricer_helpers_intl.go index 924dad55537..7d8d70508ea 100644 --- a/pkg/services/ghcrateengine/pricer_helpers_intl.go +++ b/pkg/services/ghcrateengine/pricer_helpers_intl.go @@ -13,6 +13,56 @@ import ( "github.com/transcom/mymove/pkg/unit" ) +func priceInternationalShuttling(appCtx appcontext.AppContext, shuttlingCode models.ReServiceCode, contractCode string, referenceDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, services.PricingDisplayParams, error) { + if shuttlingCode != models.ReServiceCodeIOSHUT && shuttlingCode != models.ReServiceCodeIDSHUT { + return 0, nil, fmt.Errorf("unsupported international shuttling code of %s", shuttlingCode) + } + // Validate parameters + if len(contractCode) == 0 { + return 0, nil, errors.New("ContractCode is required") + } + if referenceDate.IsZero() { + return 0, nil, errors.New("ReferenceDate is required") + } + if weight < minInternationalWeight { + return 0, nil, fmt.Errorf("Weight must be a minimum of %d", minInternationalWeight) + } + if market == "" { + return 0, nil, errors.New("Market is required") + } + + // look up rate for international accessorial price + internationalAccessorialPrice, err := fetchInternationalAccessorialPrice(appCtx, contractCode, shuttlingCode, market) + if err != nil { + return 0, nil, fmt.Errorf("could not lookup International Accessorial Area Price: %w", err) + } + + basePrice := internationalAccessorialPrice.PerUnitCents.Float64() + escalatedPrice, contractYear, err := escalatePriceForContractYear(appCtx, internationalAccessorialPrice.ContractID, referenceDate, false, basePrice) + if err != nil { + return 0, nil, fmt.Errorf("could not calculate escalated price: %w", err) + } + + escalatedPrice = escalatedPrice * weight.ToCWTFloat64() + totalCost := unit.Cents(math.Round(escalatedPrice)) + + params := services.PricingDisplayParams{ + { + Key: models.ServiceItemParamNamePriceRateOrFactor, + Value: FormatCents(internationalAccessorialPrice.PerUnitCents), + }, + { + Key: models.ServiceItemParamNameContractYearName, + Value: contractYear.Name, + }, + { + Key: models.ServiceItemParamNameEscalationCompounded, + Value: FormatEscalation(contractYear.EscalationCompounded), + }, + } + return totalCost, params, nil +} + func priceIntlPackUnpack(appCtx appcontext.AppContext, packUnpackCode models.ReServiceCode, contractCode string, referenceDate time.Time, weight unit.Pound, perUnitCents int) (unit.Cents, services.PricingDisplayParams, error) { if packUnpackCode != models.ReServiceCodeIHPK && packUnpackCode != models.ReServiceCodeIHUPK { return 0, nil, fmt.Errorf("unsupported pack/unpack code of %s", packUnpackCode) diff --git a/pkg/services/ghcrateengine/pricer_helpers_intl_test.go b/pkg/services/ghcrateengine/pricer_helpers_intl_test.go index 19539e4c976..56d5bcce1dc 100644 --- a/pkg/services/ghcrateengine/pricer_helpers_intl_test.go +++ b/pkg/services/ghcrateengine/pricer_helpers_intl_test.go @@ -6,8 +6,63 @@ import ( "github.com/transcom/mymove/pkg/models" "github.com/transcom/mymove/pkg/services" "github.com/transcom/mymove/pkg/testdatagen" + "github.com/transcom/mymove/pkg/unit" ) +func (suite *GHCRateEngineServiceSuite) Test_priceInternationalShuttling() { + suite.Run("origin golden path", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + + priceCents, displayParams, err := priceInternationalShuttling(suite.AppContextForTest(), models.ReServiceCodeIOSHUT, testdatagen.DefaultContractCode, ioshutTestRequestedPickupDate, ioshutTestWeight, ioshutTestMarket) + suite.NoError(err) + suite.Equal(ioshutTestPriceCents, priceCents) + + expectedParams := services.PricingDisplayParams{ + {Key: models.ServiceItemParamNameContractYearName, Value: testdatagen.DefaultContractCode}, + {Key: models.ServiceItemParamNameEscalationCompounded, Value: FormatEscalation(ioshutTestEscalationCompounded)}, + {Key: models.ServiceItemParamNamePriceRateOrFactor, Value: FormatCents(ioshutTestBasePriceCents)}, + } + suite.validatePricerCreatedParams(expectedParams, displayParams) + }) + + suite.Run("invalid service code", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + _, _, err := priceInternationalShuttling(suite.AppContextForTest(), models.ReServiceCodeCS, testdatagen.DefaultContractCode, ioshutTestRequestedPickupDate, ioshutTestWeight, ioshutTestMarket) + + suite.Error(err) + suite.Contains(err.Error(), "unsupported international shuttling code") + }) + + suite.Run("invalid weight", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + + badWeight := unit.Pound(250) + _, _, err := priceInternationalShuttling(suite.AppContextForTest(), models.ReServiceCodeIOSHUT, testdatagen.DefaultContractCode, ioshutTestRequestedPickupDate, badWeight, ioshutTestMarket) + + suite.Error(err) + suite.Contains(err.Error(), "Weight must be a minimum of 500") + }) + + suite.Run("not finding a rate record", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + + _, _, err := priceInternationalShuttling(suite.AppContextForTest(), models.ReServiceCodeIOSHUT, "BOGUS", ioshutTestRequestedPickupDate, ioshutTestWeight, ioshutTestMarket) + + suite.Error(err) + suite.Contains(err.Error(), "could not lookup International Accessorial Area Price") + }) + + suite.Run("not finding a contract year record", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIOSHUT, ioshutTestMarket, ioshutTestBasePriceCents, testdatagen.DefaultContractCode, ioshutTestEscalationCompounded) + + twoYearsLaterPickupDate := ioshutTestRequestedPickupDate.AddDate(2, 0, 0) + _, _, err := priceInternationalShuttling(suite.AppContextForTest(), models.ReServiceCodeIOSHUT, testdatagen.DefaultContractCode, twoYearsLaterPickupDate, ioshutTestWeight, ioshutTestMarket) + + suite.Error(err) + suite.Contains(err.Error(), "could not calculate escalated price: could not lookup contract year") + }) +} + func (suite *GHCRateEngineServiceSuite) TestPriceIntlPackUnpack() { suite.Run("success with IHPK", func() { suite.setupIntlPackServiceItem() diff --git a/pkg/services/ghcrateengine/pricer_helpers_test.go b/pkg/services/ghcrateengine/pricer_helpers_test.go index 06b9ec30044..ee8fddf3ebe 100644 --- a/pkg/services/ghcrateengine/pricer_helpers_test.go +++ b/pkg/services/ghcrateengine/pricer_helpers_test.go @@ -595,6 +595,7 @@ func (suite *GHCRateEngineServiceSuite) Test_priceDomesticShuttling() { suite.Contains(err.Error(), "could not calculate escalated price: could not lookup contract year") }) } + func (suite *GHCRateEngineServiceSuite) Test_priceDomesticCrating() { suite.Run("crating golden path", func() { suite.setupDomesticAccessorialPrice(models.ReServiceCodeDCRT, dcrtTestServiceSchedule, dcrtTestBasePriceCents, testdatagen.DefaultContractCode, dcrtTestEscalationCompounded) diff --git a/pkg/services/ghcrateengine/pricer_query_helpers.go b/pkg/services/ghcrateengine/pricer_query_helpers.go index 84cde4fc64c..318c6f32864 100644 --- a/pkg/services/ghcrateengine/pricer_query_helpers.go +++ b/pkg/services/ghcrateengine/pricer_query_helpers.go @@ -64,6 +64,23 @@ func fetchDomServiceAreaPrice(appCtx appcontext.AppContext, contractCode string, return domServiceAreaPrice, nil } +func fetchInternationalAccessorialPrice(appCtx appcontext.AppContext, contractCode string, serviceCode models.ReServiceCode, market models.Market) (models.ReIntlAccessorialPrice, error) { + var internationalAccessorialPrice models.ReIntlAccessorialPrice + err := appCtx.DB().Q(). + Join("re_services", "service_id = re_services.id"). + Join("re_contracts", "re_contracts.id = re_intl_accessorial_prices.contract_id"). + Where("re_contracts.code = $1", contractCode). + Where("re_services.code = $2", serviceCode). + Where("market = $3", market). + First(&internationalAccessorialPrice) + + if err != nil { + return models.ReIntlAccessorialPrice{}, err + } + + return internationalAccessorialPrice, nil +} + func fetchAccessorialPrice(appCtx appcontext.AppContext, contractCode string, serviceCode models.ReServiceCode, schedule int) (models.ReDomesticAccessorialPrice, error) { var domAccessorialPrice models.ReDomesticAccessorialPrice err := appCtx.DB().Q(). diff --git a/pkg/services/ghcrateengine/pricer_query_helpers_test.go b/pkg/services/ghcrateengine/pricer_query_helpers_test.go index 349f0bdeae4..35b4b6860f9 100644 --- a/pkg/services/ghcrateengine/pricer_query_helpers_test.go +++ b/pkg/services/ghcrateengine/pricer_query_helpers_test.go @@ -78,6 +78,16 @@ func (suite *GHCRateEngineServiceSuite) Test_fetchAccessorialPrice() { }) } +func (suite *GHCRateEngineServiceSuite) Test_fetchInternationalAccessorialPrice() { + suite.Run("golden path", func() { + suite.setupInternationalAccessorialPrice(models.ReServiceCodeIDSHUT, idshutTestMarket, idshutTestBasePriceCents, testdatagen.DefaultContractCode, idshutTestEscalationCompounded) + internationalAccessorialPrice, err := fetchInternationalAccessorialPrice(suite.AppContextForTest(), testdatagen.DefaultContractCode, models.ReServiceCodeIDSHUT, idshutTestMarket) + + suite.NoError(err) + suite.Equal(idshutTestBasePriceCents, internationalAccessorialPrice.PerUnitCents) + }) +} + func (suite *GHCRateEngineServiceSuite) Test_fetchContractYear() { testDate := time.Date(testdatagen.TestYear, time.June, 17, 8, 45, 44, 333, time.UTC) testEscalationCompounded := 1.0512 diff --git a/pkg/services/ghcrateengine/service_item_pricer.go b/pkg/services/ghcrateengine/service_item_pricer.go index a673f832b63..130c137c7c6 100644 --- a/pkg/services/ghcrateengine/service_item_pricer.go +++ b/pkg/services/ghcrateengine/service_item_pricer.go @@ -65,6 +65,10 @@ func PricerForServiceItem(serviceCode models.ReServiceCode) (services.ParamsPric return NewDomesticDestinationShuttlingPricer(), nil case models.ReServiceCodeDOSHUT: return NewDomesticOriginShuttlingPricer(), nil + case models.ReServiceCodeIDSHUT: + return NewInternationalDestinationShuttlingPricer(), nil + case models.ReServiceCodeIOSHUT: + return NewInternationalOriginShuttlingPricer(), nil case models.ReServiceCodeDCRT: return NewDomesticCratingPricer(), nil case models.ReServiceCodeDUCRT: diff --git a/pkg/services/ghcrateengine/service_item_pricer_test.go b/pkg/services/ghcrateengine/service_item_pricer_test.go index 86e5e858af1..c27652cf90d 100644 --- a/pkg/services/ghcrateengine/service_item_pricer_test.go +++ b/pkg/services/ghcrateengine/service_item_pricer_test.go @@ -51,6 +51,8 @@ func (suite *GHCRateEngineServiceSuite) TestGetPricer() { {models.ReServiceCodeDDP, &domesticDestinationPricer{}}, {models.ReServiceCodeDDSHUT, &domesticDestinationShuttlingPricer{}}, {models.ReServiceCodeDOSHUT, &domesticOriginShuttlingPricer{}}, + {models.ReServiceCodeIDSHUT, &internationalDestinationShuttlingPricer{}}, + {models.ReServiceCodeIOSHUT, &internationalOriginShuttlingPricer{}}, {models.ReServiceCodeDCRT, &domesticCratingPricer{}}, {models.ReServiceCodeDUCRT, &domesticUncratingPricer{}}, {models.ReServiceCodeDPK, &domesticPackPricer{}}, diff --git a/pkg/services/ghcrateengine/shared.go b/pkg/services/ghcrateengine/shared.go index 171d8668bb1..1a76f817734 100644 --- a/pkg/services/ghcrateengine/shared.go +++ b/pkg/services/ghcrateengine/shared.go @@ -12,6 +12,9 @@ const minDomesticWeight = unit.Pound(500) // minIntlWeightHHG is the minimum weight used in intl calculations (weights below this are upgraded to the min) const minIntlWeightHHG = unit.Pound(500) +// minInternationalWeight is the minimum weight used in international calculations (weights below this are upgraded to the min) +const minInternationalWeight = unit.Pound(500) + // dateInYear represents a specific date in a year (without caring what year it is) type dateInYear struct { month time.Month diff --git a/pkg/services/ghcrateengine/shared_test.go b/pkg/services/ghcrateengine/shared_test.go index 72b669e73ca..4547dafa0ce 100644 --- a/pkg/services/ghcrateengine/shared_test.go +++ b/pkg/services/ghcrateengine/shared_test.go @@ -2,6 +2,8 @@ package ghcrateengine import ( "time" + + "github.com/transcom/mymove/pkg/unit" ) func (suite *GHCRateEngineServiceSuite) TestIsPeakPeriod() { @@ -39,3 +41,11 @@ func (suite *GHCRateEngineServiceSuite) TestIsPeakPeriod() { suite.False(IsPeakPeriod(date)) }) } + +func (suite *GHCRateEngineServiceSuite) TestGetDomesticWeight() { + suite.Run("test getDomesticWeight", func() { + domesticWeight := GetMinDomesticWeight() + suite.NotNil(domesticWeight) + suite.Equal(domesticWeight, unit.Pound(500)) + }) +} diff --git a/pkg/services/mocks/InternationalDestinationShuttlingPricer.go b/pkg/services/mocks/InternationalDestinationShuttlingPricer.go new file mode 100644 index 00000000000..f6871e1fd4b --- /dev/null +++ b/pkg/services/mocks/InternationalDestinationShuttlingPricer.go @@ -0,0 +1,109 @@ +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + appcontext "github.com/transcom/mymove/pkg/appcontext" + + models "github.com/transcom/mymove/pkg/models" + + services "github.com/transcom/mymove/pkg/services" + + time "time" + + unit "github.com/transcom/mymove/pkg/unit" +) + +// InternationalDestinationShuttlingPricer is an autogenerated mock type for the InternationalDestinationShuttlingPricer type +type InternationalDestinationShuttlingPricer struct { + mock.Mock +} + +// Price provides a mock function with given fields: appCtx, contractCode, requestedPickupDate, weight, market +func (_m *InternationalDestinationShuttlingPricer) Price(appCtx appcontext.AppContext, contractCode string, requestedPickupDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, services.PricingDisplayParams, error) { + ret := _m.Called(appCtx, contractCode, requestedPickupDate, weight, market) + + if len(ret) == 0 { + panic("no return value specified for Price") + } + + var r0 unit.Cents + var r1 services.PricingDisplayParams + var r2 error + if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) (unit.Cents, services.PricingDisplayParams, error)); ok { + return rf(appCtx, contractCode, requestedPickupDate, weight, market) + } + if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) unit.Cents); ok { + r0 = rf(appCtx, contractCode, requestedPickupDate, weight, market) + } else { + r0 = ret.Get(0).(unit.Cents) + } + + if rf, ok := ret.Get(1).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) services.PricingDisplayParams); ok { + r1 = rf(appCtx, contractCode, requestedPickupDate, weight, market) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(services.PricingDisplayParams) + } + } + + if rf, ok := ret.Get(2).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) error); ok { + r2 = rf(appCtx, contractCode, requestedPickupDate, weight, market) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// PriceUsingParams provides a mock function with given fields: appCtx, params +func (_m *InternationalDestinationShuttlingPricer) PriceUsingParams(appCtx appcontext.AppContext, params models.PaymentServiceItemParams) (unit.Cents, services.PricingDisplayParams, error) { + ret := _m.Called(appCtx, params) + + if len(ret) == 0 { + panic("no return value specified for PriceUsingParams") + } + + var r0 unit.Cents + var r1 services.PricingDisplayParams + var r2 error + if rf, ok := ret.Get(0).(func(appcontext.AppContext, models.PaymentServiceItemParams) (unit.Cents, services.PricingDisplayParams, error)); ok { + return rf(appCtx, params) + } + if rf, ok := ret.Get(0).(func(appcontext.AppContext, models.PaymentServiceItemParams) unit.Cents); ok { + r0 = rf(appCtx, params) + } else { + r0 = ret.Get(0).(unit.Cents) + } + + if rf, ok := ret.Get(1).(func(appcontext.AppContext, models.PaymentServiceItemParams) services.PricingDisplayParams); ok { + r1 = rf(appCtx, params) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(services.PricingDisplayParams) + } + } + + if rf, ok := ret.Get(2).(func(appcontext.AppContext, models.PaymentServiceItemParams) error); ok { + r2 = rf(appCtx, params) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// NewInternationalDestinationShuttlingPricer creates a new instance of InternationalDestinationShuttlingPricer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewInternationalDestinationShuttlingPricer(t interface { + mock.TestingT + Cleanup(func()) +}) *InternationalDestinationShuttlingPricer { + mock := &InternationalDestinationShuttlingPricer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/services/mocks/InternationalOriginShuttlingPricer.go b/pkg/services/mocks/InternationalOriginShuttlingPricer.go new file mode 100644 index 00000000000..fbfc2d9ba26 --- /dev/null +++ b/pkg/services/mocks/InternationalOriginShuttlingPricer.go @@ -0,0 +1,109 @@ +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + appcontext "github.com/transcom/mymove/pkg/appcontext" + + models "github.com/transcom/mymove/pkg/models" + + services "github.com/transcom/mymove/pkg/services" + + time "time" + + unit "github.com/transcom/mymove/pkg/unit" +) + +// InternationalOriginShuttlingPricer is an autogenerated mock type for the InternationalOriginShuttlingPricer type +type InternationalOriginShuttlingPricer struct { + mock.Mock +} + +// Price provides a mock function with given fields: appCtx, contractCode, requestedPickupDate, weight, market +func (_m *InternationalOriginShuttlingPricer) Price(appCtx appcontext.AppContext, contractCode string, requestedPickupDate time.Time, weight unit.Pound, market models.Market) (unit.Cents, services.PricingDisplayParams, error) { + ret := _m.Called(appCtx, contractCode, requestedPickupDate, weight, market) + + if len(ret) == 0 { + panic("no return value specified for Price") + } + + var r0 unit.Cents + var r1 services.PricingDisplayParams + var r2 error + if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) (unit.Cents, services.PricingDisplayParams, error)); ok { + return rf(appCtx, contractCode, requestedPickupDate, weight, market) + } + if rf, ok := ret.Get(0).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) unit.Cents); ok { + r0 = rf(appCtx, contractCode, requestedPickupDate, weight, market) + } else { + r0 = ret.Get(0).(unit.Cents) + } + + if rf, ok := ret.Get(1).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) services.PricingDisplayParams); ok { + r1 = rf(appCtx, contractCode, requestedPickupDate, weight, market) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(services.PricingDisplayParams) + } + } + + if rf, ok := ret.Get(2).(func(appcontext.AppContext, string, time.Time, unit.Pound, models.Market) error); ok { + r2 = rf(appCtx, contractCode, requestedPickupDate, weight, market) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// PriceUsingParams provides a mock function with given fields: appCtx, params +func (_m *InternationalOriginShuttlingPricer) PriceUsingParams(appCtx appcontext.AppContext, params models.PaymentServiceItemParams) (unit.Cents, services.PricingDisplayParams, error) { + ret := _m.Called(appCtx, params) + + if len(ret) == 0 { + panic("no return value specified for PriceUsingParams") + } + + var r0 unit.Cents + var r1 services.PricingDisplayParams + var r2 error + if rf, ok := ret.Get(0).(func(appcontext.AppContext, models.PaymentServiceItemParams) (unit.Cents, services.PricingDisplayParams, error)); ok { + return rf(appCtx, params) + } + if rf, ok := ret.Get(0).(func(appcontext.AppContext, models.PaymentServiceItemParams) unit.Cents); ok { + r0 = rf(appCtx, params) + } else { + r0 = ret.Get(0).(unit.Cents) + } + + if rf, ok := ret.Get(1).(func(appcontext.AppContext, models.PaymentServiceItemParams) services.PricingDisplayParams); ok { + r1 = rf(appCtx, params) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(services.PricingDisplayParams) + } + } + + if rf, ok := ret.Get(2).(func(appcontext.AppContext, models.PaymentServiceItemParams) error); ok { + r2 = rf(appCtx, params) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// NewInternationalOriginShuttlingPricer creates a new instance of InternationalOriginShuttlingPricer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewInternationalOriginShuttlingPricer(t interface { + mock.TestingT + Cleanup(func()) +}) *InternationalOriginShuttlingPricer { + mock := &InternationalOriginShuttlingPricer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} 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 05ccd8c7929..8002d3a38d2 100644 --- a/pkg/services/mto_service_item/mto_service_item_creator.go +++ b/pkg/services/mto_service_item/mto_service_item_creator.go @@ -328,6 +328,7 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex var err error var requestedServiceItems models.MTOServiceItems // used in case additional service items need to be auto-created var createdServiceItems models.MTOServiceItems + var createdInternationalServiceItemIds []string var move models.Move moveID := serviceItem.MoveTaskOrderID @@ -673,9 +674,16 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex } } - verrs, err = o.builder.CreateOne(txnAppCtx, requestedServiceItem) - if verrs != nil || err != nil { - return fmt.Errorf("%#v %e", verrs, err) + if mtoShipment.MarketCode == models.MarketCodeInternational { + createdInternationalServiceItemIds, err = models.CreateInternationalAccessorialServiceItemsForShipment(appCtx.DB(), *serviceItem.MTOShipmentID, models.MTOServiceItems{*serviceItem}) + if err != nil { + return err + } + } else { + verrs, err = o.builder.CreateOne(txnAppCtx, requestedServiceItem) + if verrs != nil || err != nil { + return fmt.Errorf("%#v %e", verrs, err) + } } // need isOconus information for InternationalCrates in model_to_payload @@ -685,6 +693,13 @@ func (o *mtoServiceItemCreator) CreateMTOServiceItem(appCtx appcontext.AppContex createdServiceItems = append(createdServiceItems, *requestedServiceItem) + if mtoShipment.MarketCode == models.MarketCodeInternational { + requestedServiceItem.ID, err = uuid.FromString(createdInternationalServiceItemIds[0]) + if err != nil { + return fmt.Errorf("%e", err) + } + } + // create dimensions if any for index := range requestedServiceItem.Dimensions { createDimension := &requestedServiceItem.Dimensions[index] diff --git a/pkg/services/mto_service_item/mto_service_item_validators.go b/pkg/services/mto_service_item/mto_service_item_validators.go index bd062ebf8a0..756543e7c67 100644 --- a/pkg/services/mto_service_item/mto_service_item_validators.go +++ b/pkg/services/mto_service_item/mto_service_item_validators.go @@ -45,6 +45,11 @@ var allSITServiceItemsToCheck = []models.ReServiceCode{ models.ReServiceCodeDOSFSC, } +var allAccessorialServiceItemsToCheck = []models.ReServiceCode{ + models.ReServiceCodeIDSHUT, + models.ReServiceCodeIOSHUT, +} + var destSITServiceItems = []models.ReServiceCode{ models.ReServiceCodeDDDSIT, models.ReServiceCodeDDASIT, @@ -338,6 +343,39 @@ func (v *updateMTOServiceItemData) checkOldServiceItemStatus(_ appcontext.AppCon } } + if slices.Contains(allAccessorialServiceItemsToCheck, serviceItemData.oldServiceItem.ReService.Code) { + if serviceItemData.oldServiceItem.Status == models.MTOServiceItemStatusRejected { + return nil + } else if serviceItemData.oldServiceItem.Status == models.MTOServiceItemStatusApproved { + + invalidFieldChange := false + // Fields that are not allowed to change when status is approved + + if serviceItemData.updatedServiceItem.ReService.Code.String() != "" && serviceItemData.updatedServiceItem.ReService.Code.String() != serviceItemData.oldServiceItem.ReService.Code.String() { + invalidFieldChange = true + } + + if serviceItemData.updatedServiceItem.Reason != nil { + invalidFieldChange = true + } + + if serviceItemData.updatedServiceItem.RequestedApprovalsRequestedStatus != nil { + invalidFieldChange = true + } + + if invalidFieldChange { + return apperror.NewConflictError(serviceItemData.oldServiceItem.ID, + "- one or more fields is not allowed to be updated when the shuttle service item has an approved status.") + } + + return apperror.NewConflictError(serviceItemData.oldServiceItem.ID, + "- unknown field or fields attempting to be updated.") + } else { + return apperror.NewConflictError(serviceItemData.oldServiceItem.ID, + "- this shuttle service item cannot be updated because the status is not in an editable state.") + } + } + return nil } @@ -382,7 +420,7 @@ func (v *updateMTOServiceItemData) checkPrimeAvailability(appCtx appcontext.AppC // checkNonPrimeFields checks that no fields were modified that are not allowed to be updated by the Prime func (v *updateMTOServiceItemData) checkNonPrimeFields(_ appcontext.AppContext) error { - if v.updatedServiceItem.Status != "" && v.updatedServiceItem.Status != v.oldServiceItem.Status && (!slices.Contains(allSITServiceItemsToCheck, v.oldServiceItem.ReService.Code)) { + if v.updatedServiceItem.Status != "" && v.updatedServiceItem.Status != v.oldServiceItem.Status && (!slices.Contains(allAccessorialServiceItemsToCheck, v.oldServiceItem.ReService.Code)) && (!slices.Contains(allSITServiceItemsToCheck, v.oldServiceItem.ReService.Code)) { v.verrs.Add("status", "cannot be updated") } diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx index 15ccedb7d41..b351755d15b 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.jsx @@ -8,6 +8,7 @@ import OriginSITServiceItemForm from './OriginSITServiceItemForm'; import ShuttleSITServiceItemForm from './ShuttleSITServiceItemForm'; import DomesticCratingForm from './DomesticCratingForm'; import InternationalCratingForm from './InternationalCratingForm'; +import InternationalShuttleServiceItemForm from './InternationalShuttleServiceItemForm'; import { isBooleanFlagEnabled } from 'utils/featureFlags'; import { ShipmentShape } from 'types/shipment'; @@ -22,6 +23,7 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) MTOServiceItemShuttle, MTOServiceItemDomesticCrating, MTOServiceItemInternationalCrating, + MTOServiceItemInternationalShuttle, } = createServiceItemModelTypes; const [selectedServiceItemType, setSelectedServiceItemType] = useState(MTOServiceItemOriginSIT); const [enableAlaskaFeatureFlag, setEnableAlaskaFeatureFlag] = useState(false); @@ -48,6 +50,7 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) + {enableAlaskaFeatureFlag && } @@ -61,6 +64,9 @@ const CreateShipmentServiceItemForm = ({ shipment, createServiceItemMutation }) {selectedServiceItemType === MTOServiceItemShuttle && ( )} + {selectedServiceItemType === MTOServiceItemInternationalShuttle && ( + + )} {selectedServiceItemType === MTOServiceItemDomesticCrating && ( )} diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx index 55da98f0b2f..f30c0b9f459 100644 --- a/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/CreateShipmentServiceItemForm.test.jsx @@ -91,6 +91,7 @@ describe('CreateShipmentServiceItemForm component', () => { ['shuttleSITServiceItemForm', createServiceItemModelTypes.MTOServiceItemShuttle], ['DomesticCratingForm', createServiceItemModelTypes.MTOServiceItemDomesticCrating], ['InternationalCratingForm', createServiceItemModelTypes.MTOServiceItemInternationalCrating], + ['InternationalShuttleServiceItemForm', createServiceItemModelTypes.MTOServiceItemInternationalShuttle], ])('renders %s after selecting %s type', async (formName, serviceItemType) => { isBooleanFlagEnabled.mockResolvedValue(true); const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalShuttleServiceItemForm.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalShuttleServiceItemForm.jsx new file mode 100644 index 00000000000..51b69ba6963 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalShuttleServiceItemForm.jsx @@ -0,0 +1,83 @@ +import * as Yup from 'yup'; +import { Formik } from 'formik'; +import { Button } from '@trussworks/react-uswds'; +import React from 'react'; +import PropTypes from 'prop-types'; + +import TextField from 'components/form/fields/TextField/TextField'; +import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextField'; +import { Form } from 'components/form/Form'; +import { ShipmentShape } from 'types/shipment'; +import { DropdownInput } from 'components/form/fields'; +import { internationalShuttleServiceItemCodeOptions, createServiceItemModelTypes } from 'constants/prime'; + +const internationalShuttleValidationSchema = Yup.object().shape({ + reServiceCode: Yup.string().required('Required'), + reason: Yup.string().required('Required'), +}); + +const InternationalShuttleServiceItemForm = ({ shipment, submission }) => { + const initialValues = { + moveTaskOrderID: shipment.moveTaskOrderID, + mtoShipmentID: shipment.id, + modelType: createServiceItemModelTypes.MTOServiceItemInternationalShuttle, + reason: '', + estimatedWeight: null, + actualWeight: null, + }; + + const onSubmit = (values) => { + const { estimatedWeight, actualWeight, ...otherFields } = values; + const body = { + estimatedWeight: Number.parseInt(estimatedWeight, 10), + actualWeight: Number.parseInt(actualWeight, 10), + ...otherFields, + }; + submission({ body }); + }; + + return ( + +
+ + + + + + +
+ ); +}; + +InternationalShuttleServiceItemForm.propTypes = { + shipment: ShipmentShape.isRequired, + submission: PropTypes.func.isRequired, +}; + +export default InternationalShuttleServiceItemForm; diff --git a/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalShuttleServiceItemForm.test.jsx b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalShuttleServiceItemForm.test.jsx new file mode 100644 index 00000000000..f1fb47038f7 --- /dev/null +++ b/src/components/PrimeUI/CreateShipmentServiceItemForm/InternationalShuttleServiceItemForm.test.jsx @@ -0,0 +1,83 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; + +import InternationalShuttleServiceItemForm from './InternationalShuttleServiceItemForm'; + +const moveId = '9c7b255c-2981-4bf8-839f-61c7458e2b4d'; + +const approvedMoveTaskOrder = { + moveTaskOrder: { + id: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + moveCode: 'LR4T8V', + mtoShipments: [ + { + actualPickupDate: '2020-03-17', + agents: [], + approvedDate: '2021-10-20', + createdAt: '2021-10-21', + customerRemarks: 'Please treat gently', + destinationAddress: { + city: 'Fairfield', + id: 'bfe61147-5fd7-426e-b473-54ccf77bde35', + postalCode: '94535', + state: 'CA', + streetAddress1: '987 Any Avenue', + streetAddress2: 'P.O. Box 9876', + streetAddress3: 'c/o Some Person', + }, + eTag: 'MjAyMS0xMC0xOFQxODoyNDo0MS4zNzc5Nzha', + firstAvailableDeliveryDate: null, + id: 'ce01a5b8-9b44-4511-8a8d-edb60f2a4aee', + moveTaskOrderID: '9c7b255c-2981-4bf8-839f-61c7458e2b4d', + pickupAddress: { + city: 'Beverly Hills', + id: 'cf159eca-162c-4131-84a0-795e684416a6', + postalCode: '90210', + state: 'CA', + streetAddress1: '123 Any Street', + streetAddress2: 'P.O. Box 12345', + streetAddress3: 'c/o Some Person', + }, + primeActualWeight: 2000, + primeEstimatedWeight: 1400, + primeEstimatedWeightRecordedDate: null, + requestedPickupDate: '2020-03-15', + requiredDeliveryDate: null, + scheduledPickupDate: '2020-03-16', + secondaryDeliveryAddress: { + city: null, + postalCode: null, + state: null, + streetAddress1: null, + }, + shipmentType: 'HHG', + status: 'APPROVED', + updatedAt: '2021-10-22', + mtoServiceItems: null, + reweigh: { + id: '1234', + weight: 9000, + requestedAt: '2021-10-23', + }, + }, + ], + }, +}; + +describe('InternationalShuttleSITForm component', () => { + it.each([ + ['Service item code', 'reServiceCode'], + ['Reason', 'reason'], + ['Estimated weight (lbs)', 'estimatedWeight'], + ['Actual weight (lbs)', 'actualWeight'], + ])('renders field %s in form', (labelName, inputName) => { + const shipment = approvedMoveTaskOrder.moveTaskOrder.mtoShipments[0]; + + render(); + + // shipment text values + const field = screen.getByText(labelName); + expect(field).toBeInTheDocument(); + expect(field.closest('div').nextElementSibling.name).toBe(inputName); + }); +}); diff --git a/src/constants/prime.js b/src/constants/prime.js index 098dfe54dc7..267156031b9 100644 --- a/src/constants/prime.js +++ b/src/constants/prime.js @@ -7,6 +7,7 @@ export const createServiceItemModelTypes = { MTOServiceItemShuttle: 'MTOServiceItemShuttle', MTOServiceItemDomesticCrating: 'MTOServiceItemDomesticCrating', MTOServiceItemInternationalCrating: 'MTOServiceItemInternationalCrating', + MTOServiceItemInternationalShuttle: 'MTOServiceItemInternationalShuttle', }; export const shuttleServiceItemCodeOptions = [ @@ -14,6 +15,11 @@ export const shuttleServiceItemCodeOptions = [ { value: serviceItemCodes.DDSHUT, key: SERVICE_ITEM_CODES.DDSHUT }, ]; +export const internationalShuttleServiceItemCodeOptions = [ + { value: serviceItemCodes.IOSHUT, key: SERVICE_ITEM_CODES.IOSHUT }, + { value: serviceItemCodes.IDSHUT, key: SERVICE_ITEM_CODES.IDSHUT }, +]; + export const domesticCratingServiceItemCodeOptions = [ { value: serviceItemCodes.DCRT, key: SERVICE_ITEM_CODES.DCRT }, { value: serviceItemCodes.DUCRT, key: SERVICE_ITEM_CODES.DUCRT }, diff --git a/src/constants/serviceItems.js b/src/constants/serviceItems.js index 31e47819527..213afb45f38 100644 --- a/src/constants/serviceItems.js +++ b/src/constants/serviceItems.js @@ -138,12 +138,14 @@ const SERVICE_ITEM_CODES = { DOP: 'DOP', DOPSIT: 'DOPSIT', DOSHUT: 'DOSHUT', + IOSHUT: 'IOSHUT', DPK: 'DPK', DNPK: 'DNPK', DSH: 'DSH', DUPK: 'DUPK', FSC: 'FSC', DDSHUT: 'DDSHUT', + IDSHUT: 'IDSHUT', DCRT: 'DCRT', DUCRT: 'DUCRT', ICRT: 'ICRT', diff --git a/swagger-def/definitions/prime/MTOServiceItemInternationalShuttle.yaml b/swagger-def/definitions/prime/MTOServiceItemInternationalShuttle.yaml new file mode 100644 index 00000000000..137aed40a02 --- /dev/null +++ b/swagger-def/definitions/prime/MTOServiceItemInternationalShuttle.yaml @@ -0,0 +1,47 @@ +description: Describes an international shuttle service item. +allOf: + - $ref: 'MTOServiceItem.yaml' + - type: object + properties: + reServiceCode: + type: string + description: > + A unique code for the service item. Indicates if shuttling is requested for the international shipment origin (`IOSHUT`) + or destination (`IDSHUT`). + enum: + - IOSHUT # International Origin Shuttle Service + - IDSHUT # International Destination Shuttle Service + reason: + type: string + example: Storage items need to be picked up. + description: > + The contractor's explanation for why a shuttle service is requested. Used by the TOO while deciding to + approve or reject the service item. + estimatedWeight: + type: integer + example: 4200 + description: An estimate of how much weight from a shipment will be included in the shuttling service. + x-nullable: true + x-omitempty: false + actualWeight: + type: integer + example: 4000 + description: A record of the actual weight that was shuttled. Provided by the movers, based on weight tickets. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + market: + type: string + enum: + - CONUS + - OCONUS + example: CONUS + description: >- + To identify whether the service was provided within (CONUS) or + (OCONUS) + required: + - reason + - reServiceCode diff --git a/swagger-def/definitions/prime/MTOServiceItemModelType.yaml b/swagger-def/definitions/prime/MTOServiceItemModelType.yaml index f96badf678a..4d0ed5ad684 100644 --- a/swagger-def/definitions/prime/MTOServiceItemModelType.yaml +++ b/swagger-def/definitions/prime/MTOServiceItemModelType.yaml @@ -7,6 +7,7 @@ description: > * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle + * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -18,6 +19,7 @@ enum: - MTOServiceItemOriginSIT - MTOServiceItemDestSIT - MTOServiceItemShuttle + - MTOServiceItemInternationalShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating - MTOSerivceItemInternationalFuelSurcharge diff --git a/swagger-def/prime.yaml b/swagger-def/prime.yaml index f34788446eb..5ca10ba69f1 100644 --- a/swagger-def/prime.yaml +++ b/swagger-def/prime.yaml @@ -808,9 +808,9 @@ paths: To create a service item, please use [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint. - * Resubmitting rejected SIT service items: This endpoint will handle the logic of changing the status of rejected SIT service items from + * Resubmitting rejected SIT/Accessorial service items: This endpoint will handle the logic of changing the status of rejected SIT/Accessorial service items from REJECTED to SUBMITTED. Please provide the `requestedApprovalsRequestedStatus: true` when resubmitting as this will give attention to the TOO to - review the resubmitted SIT service item. Another note, `updateReason` must have a different value than the current `reason` value on the service item. + review the resubmitted SIT/Accessorial service item. Another note, `updateReason` must have a different value than the current `reason` value on the service item. If this value is not updated, then an error will be sent back. The following SIT service items can be resubmitted following a rejection: @@ -823,7 +823,11 @@ paths: - DDSFSC - DOSFSC - At a MINIMUM, the payload for resubmitting a rejected SIT service item must look like this: + The following Accessorial service items can be resubmitted following a rejection: + - IOSHUT + - IDSHUT + + At a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial service item must look like this: ```json { "reServiceCode": "DDFSIT", @@ -1243,6 +1247,29 @@ paths: ] ``` --- + + International Basic Service Items & Accepted Payment Request Parameters: + --- + **IOSHUT - International origin shuttle service** + ```json + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + ``` + + **IDSHUT - International destination shuttle service** + ```json + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + ``` + --- operationId: createPaymentRequest tags: - paymentRequest @@ -1693,6 +1720,8 @@ definitions: $ref: 'definitions/prime/MTOServiceItemShuttle.yaml' MTOServiceItemInternationalFuelSurcharge: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemInternationalFuelSurcharge.yaml' + MTOServiceItemInternationalShuttle: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalShuttle.yaml' MTOShipment: type: object properties: @@ -1777,6 +1806,8 @@ definitions: * DOSHUT - UpdateMTOServiceItemShuttle * PODFSC - UpdateMTOServiceItemInternationalPortFSC * POEFSC - UpdateMTOServiceItemInternationalPortFSC + * IDSHUT - UpdateMTOServiceItemInternationalShuttle + * IOSHUT - UpdateMTOServiceItemInternationalShuttle The documentation will then update with the supported fields. type: string @@ -1784,6 +1815,7 @@ definitions: - UpdateMTOServiceItemSIT - UpdateMTOServiceItemShuttle - UpdateMTOServiceItemInternationalPortFSC + - UpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItemShuttle: # spectral oas2-unused-definition is OK here due to polymorphism description: | Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. @@ -1809,6 +1841,35 @@ definitions: enum: - DDSHUT # Domestic Destination Shuttle - DOSHUT # Domestic Origin Shuttle + UpdateMTOServiceItemInternationalShuttle: # spectral oas2-unused-definition is OK here due to polymorphism + description: | + Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. + allOf: + - $ref: '#/definitions/UpdateMTOServiceItem' + - type: object + properties: + actualWeight: + type: integer + example: 4000 + description: Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + x-nullable: true + x-omitempty: false + estimatedWeight: + type: integer + example: 4200 + description: An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDSHUT # Domestic Destination Shuttle + - IOSHUT # Domestic Origin Shuttle UpdateMTOServiceItemSIT: # spectral oas2-unused-definition is OK here due to polymorphism description: | Subtype used to provide the departure date for origin or destination SIT. This is not creating a new service item but rather updating an existing service item. diff --git a/swagger-def/prime_v2.yaml b/swagger-def/prime_v2.yaml index bf11d799eb1..5fb651099b5 100644 --- a/swagger-def/prime_v2.yaml +++ b/swagger-def/prime_v2.yaml @@ -357,6 +357,8 @@ definitions: $ref: 'definitions/prime/MTOServiceItemOriginSIT.yaml' MTOServiceItemShuttle: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemShuttle.yaml' + MTOServiceItemInternationalShuttle: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalShuttle.yaml' CreateMTOShipment: type: object properties: @@ -611,12 +613,15 @@ definitions: * DOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle + * IDSHUT - UpdateMTOServiceItemInternationalShuttle + * IOSHUT - UpdateMTOServiceItemInternationalShuttle The documentation will then update with the supported fields. type: string enum: - UpdateMTOServiceItemSIT - UpdateMTOServiceItemShuttle + - UpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItem: description: UpdateMTOServiceItem describes a base type of a service item. Polymorphic type. Both Move Task Orders and MTO Shipments will have MTO Service Items. type: object @@ -656,6 +661,35 @@ definitions: enum: - DDSHUT # Domestic Destination Shuttle - DOSHUT # Domestic Origin Shuttle + UpdateMTOServiceItemInternationalShuttle: # spectral oas2-unused-definition is OK here due to polymorphism + description: | + Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. + allOf: + - $ref: '#/definitions/UpdateMTOServiceItem' + - type: object + properties: + actualWeight: + type: integer + example: 4000 + description: Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + x-nullable: true + x-omitempty: false + estimatedWeight: + type: integer + example: 4200 + description: An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDSHUT # Domestic Destination Shuttle + - IOSHUT # Domestic Origin Shuttle UpdatePPMShipment: description: The PPM specific fields of the shipment with values being changed type: object diff --git a/swagger-def/prime_v3.yaml b/swagger-def/prime_v3.yaml index 66a497501f4..b4296ffde49 100644 --- a/swagger-def/prime_v3.yaml +++ b/swagger-def/prime_v3.yaml @@ -348,6 +348,8 @@ definitions: $ref: 'definitions/prime/MTOServiceItemOriginSIT.yaml' MTOServiceItemShuttle: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemShuttle.yaml' + MTOServiceItemInternationalShuttle: # spectral oas2-unused-definition is OK here due to polymorphism + $ref: 'definitions/prime/MTOServiceItemInternationalShuttle.yaml' MTOServiceItemInternationalFuelSurcharge: # spectral oas2-unused-definition is OK here due to polymorphism $ref: 'definitions/prime/MTOServiceItemInternationalFuelSurcharge.yaml' CreateMTOShipment: @@ -638,12 +640,15 @@ definitions: * DOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle + * IDSHUT - UpdateMTOServiceItemInternationalShuttle + * IOSHUT - UpdateMTOServiceItemInternationalShuttle The documentation will then update with the supported fields. type: string enum: - UpdateMTOServiceItemSIT - UpdateMTOServiceItemShuttle + - UpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItem: description: UpdateMTOServiceItem describes a base type of a service item. Polymorphic type. Both Move Task Orders and MTO Shipments will have MTO Service Items. type: object @@ -683,6 +688,35 @@ definitions: enum: - DDSHUT # Domestic Destination Shuttle - DOSHUT # Domestic Origin Shuttle + UpdateMTOServiceItemInternationalShuttle: # spectral oas2-unused-definition is OK here due to polymorphism + description: | + Subtype used to provide the estimated weight and actual weight for shuttle. This is not creating a new service item but rather updating an existing service item. + allOf: + - $ref: '#/definitions/UpdateMTOServiceItem' + - type: object + properties: + actualWeight: + type: integer + example: 4000 + description: Provided by the movers, based on weight tickets. Relevant for shuttling (IDSHUT & IOSHUT) service items. + x-nullable: true + x-omitempty: false + estimatedWeight: + type: integer + example: 4200 + description: An estimate of how much weight from a shipment will be included in a shuttling (IDSHUT & IOSHUT) service item. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDSHUT # Domestic Destination Shuttle + - IOSHUT # Domestic Origin Shuttle UpdatePPMShipment: description: The PPM specific fields of the shipment with values being changed type: object diff --git a/swagger-def/support.yaml b/swagger-def/support.yaml index 1a531468c77..b1b34351e9a 100644 --- a/swagger-def/support.yaml +++ b/swagger-def/support.yaml @@ -1303,6 +1303,7 @@ definitions: - MTOServiceItemOriginSIT - MTOServiceItemDestSIT - MTOServiceItemShuttle + - MTOServiceItemInternationalShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating MTOServiceItemOriginSIT: # spectral oas2-unused-definition is OK here due to polymorphism diff --git a/swagger/prime.yaml b/swagger/prime.yaml index 6b7fd1961dc..19cecc3266e 100644 --- a/swagger/prime.yaml +++ b/swagger/prime.yaml @@ -1025,16 +1025,17 @@ paths: [createMTOServiceItem](#mtoServiceItem/createMTOServiceItem)) endpoint. - * Resubmitting rejected SIT service items: This endpoint will handle the - logic of changing the status of rejected SIT service items from + * Resubmitting rejected SIT/Accessorial service items: This endpoint + will handle the logic of changing the status of rejected SIT/Accessorial + service items from REJECTED to SUBMITTED. Please provide the `requestedApprovalsRequestedStatus: true` when resubmitting as this will give attention to the TOO to - review the resubmitted SIT service item. Another note, `updateReason` - must have a different value than the current `reason` value on the - service item. + review the resubmitted SIT/Accessorial service item. Another note, + `updateReason` must have a different value than the current `reason` + value on the service item. If this value is not updated, then an error will be sent back. @@ -1059,8 +1060,16 @@ paths: - DOSFSC - At a MINIMUM, the payload for resubmitting a rejected SIT service item - must look like this: + The following Accessorial service items can be resubmitted following a + rejection: + + - IOSHUT + + - IDSHUT + + + At a MINIMUM, the payload for resubmitting a rejected SIT/Accessorial + service item must look like this: ```json @@ -1601,6 +1610,36 @@ paths: ``` --- + + + International Basic Service Items & Accepted Payment Request Parameters: + + --- + + **IOSHUT - International origin shuttle service** + + ```json + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + ``` + + + **IDSHUT - International destination shuttle service** + + ```json + "params": [ + { + "key": "WeightBilled", + "value": "integer" + } + ] + ``` + + --- operationId: createPaymentRequest tags: - paymentRequest @@ -2499,6 +2538,60 @@ definitions: portCode: description: A unique code for a Port type: string + MTOServiceItemInternationalShuttle: + description: Describes an international shuttle service item. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: > + A unique code for the service item. Indicates if shuttling is + requested for the international shipment origin (`IOSHUT`) or + destination (`IDSHUT`). + enum: + - IOSHUT + - IDSHUT + reason: + type: string + example: Storage items need to be picked up. + description: > + The contractor's explanation for why a shuttle service is + requested. Used by the TOO while deciding to approve or reject the + service item. + estimatedWeight: + type: integer + example: 4200 + description: >- + An estimate of how much weight from a shipment will be included in + the shuttling service. + x-nullable: true + x-omitempty: false + actualWeight: + type: integer + example: 4000 + description: >- + A record of the actual weight that was shuttled. Provided by the + movers, based on weight tickets. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + market: + type: string + enum: + - CONUS + - OCONUS + example: CONUS + description: >- + To identify whether the service was provided within (CONUS) or + (OCONUS) + required: + - reason + - reServiceCode MTOShipment: type: object properties: @@ -2593,6 +2686,8 @@ definitions: * DOSHUT - UpdateMTOServiceItemShuttle * PODFSC - UpdateMTOServiceItemInternationalPortFSC * POEFSC - UpdateMTOServiceItemInternationalPortFSC + * IDSHUT - UpdateMTOServiceItemInternationalShuttle + * IOSHUT - UpdateMTOServiceItemInternationalShuttle The documentation will then update with the supported fields. type: string @@ -2600,6 +2695,7 @@ definitions: - UpdateMTOServiceItemSIT - UpdateMTOServiceItemShuttle - UpdateMTOServiceItemInternationalPortFSC + - UpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItemShuttle: description: > Subtype used to provide the estimated weight and actual weight for @@ -2631,6 +2727,41 @@ definitions: enum: - DDSHUT - DOSHUT + UpdateMTOServiceItemInternationalShuttle: + description: > + Subtype used to provide the estimated weight and actual weight for + shuttle. This is not creating a new service item but rather updating an + existing service item. + allOf: + - $ref: '#/definitions/UpdateMTOServiceItem' + - type: object + properties: + actualWeight: + type: integer + example: 4000 + description: >- + Provided by the movers, based on weight tickets. Relevant for + shuttling (IDSHUT & IOSHUT) service items. + x-nullable: true + x-omitempty: false + estimatedWeight: + type: integer + example: 4200 + description: >- + An estimate of how much weight from a shipment will be included in + a shuttling (IDSHUT & IOSHUT) service item. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDSHUT + - IOSHUT UpdateMTOServiceItemSIT: description: > Subtype used to provide the departure date for origin or destination SIT. @@ -3685,6 +3816,7 @@ definitions: * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle + * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -3696,6 +3828,7 @@ definitions: - MTOServiceItemOriginSIT - MTOServiceItemDestSIT - MTOServiceItemShuttle + - MTOServiceItemInternationalShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating - MTOSerivceItemInternationalFuelSurcharge diff --git a/swagger/prime_v2.yaml b/swagger/prime_v2.yaml index 66db246cf69..d5d7a41b687 100644 --- a/swagger/prime_v2.yaml +++ b/swagger/prime_v2.yaml @@ -686,6 +686,60 @@ definitions: required: - reason - reServiceCode + MTOServiceItemInternationalShuttle: + description: Describes an international shuttle service item. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: > + A unique code for the service item. Indicates if shuttling is + requested for the international shipment origin (`IOSHUT`) or + destination (`IDSHUT`). + enum: + - IOSHUT + - IDSHUT + reason: + type: string + example: Storage items need to be picked up. + description: > + The contractor's explanation for why a shuttle service is + requested. Used by the TOO while deciding to approve or reject the + service item. + estimatedWeight: + type: integer + example: 4200 + description: >- + An estimate of how much weight from a shipment will be included in + the shuttling service. + x-nullable: true + x-omitempty: false + actualWeight: + type: integer + example: 4000 + description: >- + A record of the actual weight that was shuttled. Provided by the + movers, based on weight tickets. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + market: + type: string + enum: + - CONUS + - OCONUS + example: CONUS + description: >- + To identify whether the service was provided within (CONUS) or + (OCONUS) + required: + - reason + - reServiceCode CreateMTOShipment: type: object properties: @@ -968,12 +1022,15 @@ definitions: * DOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle + * IDSHUT - UpdateMTOServiceItemInternationalShuttle + * IOSHUT - UpdateMTOServiceItemInternationalShuttle The documentation will then update with the supported fields. type: string enum: - UpdateMTOServiceItemSIT - UpdateMTOServiceItemShuttle + - UpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItem: description: >- UpdateMTOServiceItem describes a base type of a service item. Polymorphic @@ -1021,6 +1078,41 @@ definitions: enum: - DDSHUT - DOSHUT + UpdateMTOServiceItemInternationalShuttle: + description: > + Subtype used to provide the estimated weight and actual weight for + shuttle. This is not creating a new service item but rather updating an + existing service item. + allOf: + - $ref: '#/definitions/UpdateMTOServiceItem' + - type: object + properties: + actualWeight: + type: integer + example: 4000 + description: >- + Provided by the movers, based on weight tickets. Relevant for + shuttling (IDSHUT & IOSHUT) service items. + x-nullable: true + x-omitempty: false + estimatedWeight: + type: integer + example: 4200 + description: >- + An estimate of how much weight from a shipment will be included in + a shuttling (IDSHUT & IOSHUT) service item. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDSHUT + - IOSHUT UpdatePPMShipment: description: The PPM specific fields of the shipment with values being changed type: object @@ -2089,6 +2181,7 @@ definitions: * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle + * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -2100,6 +2193,7 @@ definitions: - MTOServiceItemOriginSIT - MTOServiceItemDestSIT - MTOServiceItemShuttle + - MTOServiceItemInternationalShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating - MTOSerivceItemInternationalFuelSurcharge diff --git a/swagger/prime_v3.yaml b/swagger/prime_v3.yaml index 31d5c57781c..cd2473feb5f 100644 --- a/swagger/prime_v3.yaml +++ b/swagger/prime_v3.yaml @@ -663,6 +663,60 @@ definitions: required: - reason - reServiceCode + MTOServiceItemInternationalShuttle: + description: Describes an international shuttle service item. + allOf: + - $ref: '#/definitions/MTOServiceItem' + - type: object + properties: + reServiceCode: + type: string + description: > + A unique code for the service item. Indicates if shuttling is + requested for the international shipment origin (`IOSHUT`) or + destination (`IDSHUT`). + enum: + - IOSHUT + - IDSHUT + reason: + type: string + example: Storage items need to be picked up. + description: > + The contractor's explanation for why a shuttle service is + requested. Used by the TOO while deciding to approve or reject the + service item. + estimatedWeight: + type: integer + example: 4200 + description: >- + An estimate of how much weight from a shipment will be included in + the shuttling service. + x-nullable: true + x-omitempty: false + actualWeight: + type: integer + example: 4000 + description: >- + A record of the actual weight that was shuttled. Provided by the + movers, based on weight tickets. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + market: + type: string + enum: + - CONUS + - OCONUS + example: CONUS + description: >- + To identify whether the service was provided within (CONUS) or + (OCONUS) + required: + - reason + - reServiceCode MTOServiceItemInternationalFuelSurcharge: description: >- Describes a international Port of Embarkation/Debarkation fuel surcharge @@ -1006,12 +1060,15 @@ definitions: * DOFSIT - UpdateMTOServiceItemSIT * DDSHUT - UpdateMTOServiceItemShuttle * DOSHUT - UpdateMTOServiceItemShuttle + * IDSHUT - UpdateMTOServiceItemInternationalShuttle + * IOSHUT - UpdateMTOServiceItemInternationalShuttle The documentation will then update with the supported fields. type: string enum: - UpdateMTOServiceItemSIT - UpdateMTOServiceItemShuttle + - UpdateMTOServiceItemInternationalShuttle UpdateMTOServiceItem: description: >- UpdateMTOServiceItem describes a base type of a service item. Polymorphic @@ -1059,6 +1116,41 @@ definitions: enum: - DDSHUT - DOSHUT + UpdateMTOServiceItemInternationalShuttle: + description: > + Subtype used to provide the estimated weight and actual weight for + shuttle. This is not creating a new service item but rather updating an + existing service item. + allOf: + - $ref: '#/definitions/UpdateMTOServiceItem' + - type: object + properties: + actualWeight: + type: integer + example: 4000 + description: >- + Provided by the movers, based on weight tickets. Relevant for + shuttling (IDSHUT & IOSHUT) service items. + x-nullable: true + x-omitempty: false + estimatedWeight: + type: integer + example: 4200 + description: >- + An estimate of how much weight from a shipment will be included in + a shuttling (IDSHUT & IOSHUT) service item. + x-nullable: true + x-omitempty: false + requestApprovalsRequestedStatus: + description: Indicates if "Approvals Requested" status is being requested. + type: boolean + x-nullable: true + reServiceCode: + type: string + description: Service code allowed for this model type. + enum: + - IDSHUT + - IOSHUT UpdatePPMShipment: description: The PPM specific fields of the shipment with values being changed type: object @@ -2196,6 +2288,7 @@ definitions: * DOFSIT, DOASIT - MTOServiceItemOriginSIT * DDFSIT, DDASIT - MTOServiceItemDestSIT * DOSHUT, DDSHUT - MTOServiceItemShuttle + * IOSHUT, IDSHUT - MTOServiceItemInternationalShuttle * DCRT, DUCRT - MTOServiceItemDomesticCrating * ICRT, IUCRT - MTOServiceItemInternationalCrating * PODFSC, POEFSC - MTOSerivceItemInternationalFuelSurcharge @@ -2207,6 +2300,7 @@ definitions: - MTOServiceItemOriginSIT - MTOServiceItemDestSIT - MTOServiceItemShuttle + - MTOServiceItemInternationalShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating - MTOSerivceItemInternationalFuelSurcharge diff --git a/swagger/support.yaml b/swagger/support.yaml index 31ecdc921ce..362742d57a9 100644 --- a/swagger/support.yaml +++ b/swagger/support.yaml @@ -1409,6 +1409,7 @@ definitions: - MTOServiceItemOriginSIT - MTOServiceItemDestSIT - MTOServiceItemShuttle + - MTOServiceItemInternationalShuttle - MTOServiceItemDomesticCrating - MTOServiceItemInternationalCrating MTOServiceItemOriginSIT: diff --git a/yarn.lock b/yarn.lock index c38785ccc74..258ff336b38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2947,11 +2947,6 @@ resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.1.3.tgz#6801033be7ff87a6b7cadaf5b337c9f366a3c4b0" integrity sha512-WiBSI6JBIhC6LRIsB2Kwh8DsGTlbBU+mLRxJmAe3LjHTdkDpwIbEOZgoXBbZilk/vlfjK8i6nKRAvIRn1XaIMw== -"@scarf/scarf@=1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@scarf/scarf/-/scarf-1.4.0.tgz#3bbb984085dbd6d982494538b523be1ce6562972" - integrity sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ== - "@sinclair/typebox@^0.23.3": version "0.23.5" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.5.tgz#93f7b9f4e3285a7a9ade7557d9a8d36809cbc47d" @@ -16641,12 +16636,10 @@ swagger-client@^3.18.5: traverse "~0.6.6" url "~0.11.0" -swagger-ui-dist@^5.18.2: - version "5.18.2" - resolved "https://registry.yarnpkg.com/swagger-ui-dist/-/swagger-ui-dist-5.18.2.tgz#62013074374d272c04ed3030704b88db5aa8c0b7" - integrity sha512-J+y4mCw/zXh1FOj5wGJvnAajq6XgHOyywsa9yITmwxIlJbMqITq3gYRZHaeqLVH/eV/HOPphE6NjF+nbSNC5Zw== - dependencies: - "@scarf/scarf" "=1.4.0" +swagger-ui-dist@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/swagger-ui-dist/-/swagger-ui-dist-5.2.0.tgz#175e112b3aea756fdbbbb035d4cffef26ac579d1" + integrity sha512-rLvJBgualxNZcwKOmTFzy4zF1nHy+3S0pUDDR/ageDRZgi8aITSe7pVYiAy03xGQZtqEifjwEtHQE+eF14gveg== swc-loader@^0.2.3: version "0.2.3"