diff --git a/modules/vaos/app/services/vaos/base_service.rb b/modules/vaos/app/services/vaos/base_service.rb index 88d9acc30d..f6e7b7a690 100644 --- a/modules/vaos/app/services/vaos/base_service.rb +++ b/modules/vaos/app/services/vaos/base_service.rb @@ -28,5 +28,13 @@ def referrer 'https://review-instance.va.gov' # VAMF rejects Referer that is not valid; such as those of review instances end end + + def base_vaos_route + if Flipper.enabled?(:va_online_scheduling_vaos_alternate_route, user) + 'vaos-alt/v1' + else + 'vaos/v1' + end + end end end diff --git a/modules/vaos/app/services/vaos/v2/appointments_service.rb b/modules/vaos/app/services/vaos/v2/appointments_service.rb index 80c961ec8d..c789927b35 100644 --- a/modules/vaos/app/services/vaos/v2/appointments_service.rb +++ b/modules/vaos/app/services/vaos/v2/appointments_service.rb @@ -727,7 +727,7 @@ def log_partial_errors(response) end def appointments_base_path_vaos - "/vaos/v1/patients/#{user.icn}/appointments" + "/#{base_vaos_route}/patients/#{user.icn}/appointments" end def appointments_base_path_vpg @@ -742,7 +742,7 @@ def get_appointment_base_path(appointment_id) if Flipper.enabled?(APPOINTMENTS_USE_VPG, user) "/vpg/v1/patients/#{user.icn}/appointments/#{appointment_id}" else - "/vaos/v1/patients/#{user.icn}/appointments/#{appointment_id}" + "/#{base_vaos_route}/patients/#{user.icn}/appointments/#{appointment_id}" end end @@ -773,7 +773,7 @@ def update_appointment_vpg(appt_id, status) end def update_appointment_vaos(appt_id, status) - url_path = "/vaos/v1/patients/#{user.icn}/appointments/#{appt_id}" + url_path = "/#{base_vaos_route}/patients/#{user.icn}/appointments/#{appt_id}" params = VAOS::V2::UpdateAppointmentForm.new(status:).params perform(:put, url_path, params, headers) end diff --git a/modules/vaos/app/services/vaos/v2/mobile_facility_service.rb b/modules/vaos/app/services/vaos/v2/mobile_facility_service.rb index db4e7f68b1..28321a84f7 100644 --- a/modules/vaos/app/services/vaos/v2/mobile_facility_service.rb +++ b/modules/vaos/app/services/vaos/v2/mobile_facility_service.rb @@ -285,7 +285,7 @@ def page_params(pagination_params) end def clinic_url(station_id) - "/vaos/v1/locations/#{station_id}/clinics" + "/#{base_vaos_route}/locations/#{station_id}/clinics" end def scheduling_url diff --git a/modules/vaos/app/services/vaos/v2/patients_service.rb b/modules/vaos/app/services/vaos/v2/patients_service.rb index e12fdc2975..7f4861efc5 100644 --- a/modules/vaos/app/services/vaos/v2/patients_service.rb +++ b/modules/vaos/app/services/vaos/v2/patients_service.rb @@ -29,7 +29,7 @@ def get_patient_appointment_metadata_vaos(clinic_service_id, facility_id, type) type: } - perform(:get, "/vaos/v1/patients/#{user.icn}/eligibility", params, headers) + perform(:get, "/#{base_vaos_route}/patients/#{user.icn}/eligibility", params, headers) end def get_patient_appointment_metadata_vpg(clinic_service_id, facility_id, type) diff --git a/modules/vaos/app/services/vaos/v2/systems_service.rb b/modules/vaos/app/services/vaos/v2/systems_service.rb index 1fd1dd9842..dc9a99e858 100644 --- a/modules/vaos/app/services/vaos/v2/systems_service.rb +++ b/modules/vaos/app/services/vaos/v2/systems_service.rb @@ -32,7 +32,7 @@ def get_available_slots(location_id:, clinic_id:, clinical_service:, start_dt:, def get_clinics(location_id:, clinical_service:, clinic_ids:, page_size:, page_number:) page_size = 0 if page_size.nil? # 0 is the default for the VAOS service which means return all clinics url = if Flipper.enabled?(:va_online_scheduling_use_vpg, user) - "/vpg/v1/locations/#{location_id}/clinics" + "/#{base_vaos_route}/v1/locations/#{location_id}/clinics" else "/vaos/v1/locations/#{location_id}/clinics" end @@ -65,7 +65,7 @@ def get_clinic_ids(ids) end def get_slots_vaos(location_id:, clinic_id:, start_dt:, end_dt:) - url_path = "/vaos/v1/locations/#{location_id}/clinics/#{clinic_id}/slots" + url_path = "/#{base_vaos_route}/locations/#{location_id}/clinics/#{clinic_id}/slots" url_params = { 'start' => start_dt, 'end' => end_dt