From bce38135b52731b2059a3e0e6fc86b737dda654a Mon Sep 17 00:00:00 2001 From: Devin McCurdy Date: Mon, 22 Apr 2024 15:33:12 -0400 Subject: [PATCH] Create appointments using VPG (#16409) --- .../appointments_create_request_spec.rb | 188 ++++++++++++--- .../services/vaos/v2/appointments_service.rb | 8 +- .../request/v2/appointments_request_spec.rb | 225 +++++++++++++----- .../services/v2/appointment_service_spec.rb | 218 ++++++++++++----- .../post_appointments_400_vpg.yml | 57 +++++ .../post_appointments_cc_200_2222022_vpg.yml | 62 +++++ ...ntments_va_booked_200_JACQUELINE_M_vpg.yml | 61 +++++ ...ppointments_va_proposed_clinic_200_vpg.yml | 62 +++++ .../post_appointments_400_vpg.yml | 57 +++++ .../post_appointments_500_vpg.yml | 51 ++++ .../post_appointments_cc_200_2222022_vpg.yml | 62 +++++ ..._appointments_cc_200_with_provider_vpg.yml | 61 +++++ ...ntments_va_booked_200_JACQUELINE_M_vpg.yml | 64 +++++ ...nts_va_booked_200_and_log_facility_vpg.yml | 62 +++++ ...tments_va_booked_200_and_logs_data_vpg.yml | 62 +++++ ...ppointments_va_proposed_clinic_200_vpg.yml | 62 +++++ 16 files changed, 1209 insertions(+), 153 deletions(-) create mode 100644 spec/support/vcr_cassettes/mobile/appointments/post_appointments_400_vpg.yml create mode 100644 spec/support/vcr_cassettes/mobile/appointments/post_appointments_cc_200_2222022_vpg.yml create mode 100644 spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml create mode 100644 spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_proposed_clinic_200_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_400_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_500_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_2222022_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_with_provider_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data_vpg.yml create mode 100644 spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_proposed_clinic_200_vpg.yml diff --git a/modules/mobile/spec/request/appointments_create_request_spec.rb b/modules/mobile/spec/request/appointments_create_request_spec.rb index e3fa7cb4a6d..17051edd055 100644 --- a/modules/mobile/spec/request/appointments_create_request_spec.rb +++ b/modules/mobile/spec/request/appointments_create_request_spec.rb @@ -61,70 +61,188 @@ end context 'when feature flag is on and user has access' do - it 'returns created' do - VCR.use_cassette('mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M', - match_requests_on: %i[method uri]) do - VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do - post '/mobile/v0/appointment', params: {}, headers: sis_headers - expect(response).to have_http_status(:created) + context 'using VAOS' do + before do + Flipper.disable(:va_online_scheduling_use_vpg) + Flipper.disable(:va_online_scheduling_enable_OH_requests) + end + + it 'returns created' do + VCR.use_cassette('mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M', + match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:created) + end + end + end + end + + context 'using VPG' do + before do + Flipper.enable(:va_online_scheduling_use_vpg) + Flipper.enable(:va_online_scheduling_enable_OH_requests) + end + + it 'returns created' do + VCR.use_cassette('mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg', + match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:created) + end end end end end end - it 'clears the cache' do - expect(Mobile::V0::Appointment).to receive(:clear_cache).once + context 'using VAOS' do + before do + Flipper.disable(:va_online_scheduling_use_vpg) + Flipper.disable(:va_online_scheduling_enable_OH_requests) + end - VCR.use_cassette('mobile/appointments/post_appointments_va_proposed_clinic_200', - match_requests_on: %i[method uri]) do - post '/mobile/v0/appointment', params: va_proposed_request_body, headers: sis_headers + it 'clears the cache' do + expect(Mobile::V0::Appointment).to receive(:clear_cache).once + + VCR.use_cassette('mobile/appointments/post_appointments_va_proposed_clinic_200', + match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: va_proposed_request_body, headers: sis_headers + end + end + + it 'returns a descriptive 400 error when given invalid params' do + VCR.use_cassette('mobile/appointments/post_appointments_400', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:bad_request) + expect(JSON.parse(response.body)['errors'][0]['status']).to eq('400') + expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( + 'the patientIcn must match the ICN in the request URI' + ) + end end end - it 'returns a descriptive 400 error when given invalid params' do - VCR.use_cassette('mobile/appointments/post_appointments_400', match_requests_on: %i[method uri]) do - post '/mobile/v0/appointment', params: {}, headers: sis_headers - expect(response).to have_http_status(:bad_request) - expect(JSON.parse(response.body)['errors'][0]['status']).to eq('400') - expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( - 'the patientIcn must match the ICN in the request URI' - ) + context 'using VPG' do + before do + Flipper.enable(:va_online_scheduling_use_vpg) + Flipper.enable(:va_online_scheduling_enable_OH_requests) + end + + it 'clears the cache' do + expect(Mobile::V0::Appointment).to receive(:clear_cache).once + + VCR.use_cassette('mobile/appointments/post_appointments_va_proposed_clinic_200_vpg', + match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: va_proposed_request_body, headers: sis_headers + end + end + + it 'returns a descriptive 400 error when given invalid params' do + VCR.use_cassette('mobile/appointments/post_appointments_400_vpg', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:bad_request) + expect(JSON.parse(response.body)['errors'][0]['status']).to eq('400') + expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( + 'the patientIcn must match the ICN in the request URI' + ) + end end end context 'for CC facility' do - it 'creates the cc appointment' do - VCR.use_cassette('mobile/appointments/post_appointments_cc_200_2222022', match_requests_on: %i[method uri]) do - VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do - post '/mobile/v0/appointment', params: community_cares_request_body, headers: sis_headers - expect(response).to have_http_status(:created) - expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + context 'for VAOS' do + before do + Flipper.disable(:va_online_scheduling_use_vpg) + Flipper.disable(:va_online_scheduling_enable_OH_requests) + end + + it 'creates the cc appointment' do + VCR.use_cassette('mobile/appointments/post_appointments_cc_200_2222022', match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: community_cares_request_body, headers: sis_headers + expect(response).to have_http_status(:created) + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + end + end + + context 'for VPG' do + before do + Flipper.enable(:va_online_scheduling_use_vpg) + Flipper.enable(:va_online_scheduling_enable_OH_requests) + end + + it 'creates the cc appointment' do + VCR.use_cassette('mobile/appointments/post_appointments_cc_200_2222022_vpg', + match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: community_cares_request_body, headers: sis_headers + expect(response).to have_http_status(:created) + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end end end end end context 'for va facility' do - it 'creates the va appointment - proposed' do - VCR.use_cassette('mobile/appointments/post_appointments_va_proposed_clinic_200', - match_requests_on: %i[method uri]) do - post '/mobile/v0/appointment', params: {}, headers: sis_headers + context 'using VAOS' do + before do + Flipper.disable(:va_online_scheduling_use_vpg) + Flipper.disable(:va_online_scheduling_enable_OH_requests) + end + + it 'creates the va appointment - proposed' do + VCR.use_cassette('mobile/appointments/post_appointments_va_proposed_clinic_200', + match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers - expect(response).to have_http_status(:created) - expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + expect(response).to have_http_status(:created) + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + + it 'creates the va appointment - booked' do + VCR.use_cassette('mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M', + match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:created) + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end end end - it 'creates the va appointment - booked' do - VCR.use_cassette('mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M', - match_requests_on: %i[method uri]) do - VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + context 'using VPG' do + before do + Flipper.enable(:va_online_scheduling_use_vpg) + Flipper.enable(:va_online_scheduling_enable_OH_requests) + end + + it 'creates the va appointment - proposed' do + VCR.use_cassette('mobile/appointments/post_appointments_va_proposed_clinic_200_vpg', + match_requests_on: %i[method uri]) do post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:created) expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) end end + + it 'creates the va appointment - booked' do + VCR.use_cassette('mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg', + match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + post '/mobile/v0/appointment', params: {}, headers: sis_headers + expect(response).to have_http_status(:created) + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + 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 633dc571978..6a3eacbb338 100644 --- a/modules/vaos/app/services/vaos/v2/appointments_service.rb +++ b/modules/vaos/app/services/vaos/v2/appointments_service.rb @@ -19,6 +19,7 @@ class AppointmentsService < VAOS::SessionService AVS_FLIPPER = :va_online_scheduling_after_visit_summary ORACLE_HEALTH_CANCELLATIONS = :va_online_scheduling_enable_OH_cancellations APPOINTMENTS_USE_VPG = :va_online_scheduling_use_vpg + APPOINTMENTS_ENABLE_OH_REQUESTS = :va_online_scheduling_enable_OH_requests # rubocop:disable Metrics/MethodLength def get_appointments(start_date, end_date, statuses = nil, pagination_params = {}) @@ -92,7 +93,12 @@ def post_appointment(request_object_body) params = VAOS::V2::AppointmentForm.new(user, request_object_body).params.with_indifferent_access params.compact_blank! with_monitoring do - response = perform(:post, appointments_base_path, params, headers) + response = if Flipper.enabled?(APPOINTMENTS_USE_VPG, user) && + Flipper.enabled?(APPOINTMENTS_ENABLE_OH_REQUESTS) + perform(:post, "/vpg/v1/patients/#{user.icn}/appointments", params, headers) + else + perform(:post, appointments_base_path, params, headers) + end convert_appointment_time(response.body) OpenStruct.new(response.body) rescue Common::Exceptions::BackendServiceException => e diff --git a/modules/vaos/spec/request/v2/appointments_request_spec.rb b/modules/vaos/spec/request/v2/appointments_request_spec.rb index 82c3133f02e..ccab586e6bd 100644 --- a/modules/vaos/spec/request/v2/appointments_request_spec.rb +++ b/modules/vaos/spec/request/v2/appointments_request_spec.rb @@ -95,91 +95,196 @@ context 'with jacqueline morgan' do let(:current_user) { build(:user, :jac) } - describe 'CREATE cc appointment' do - let(:community_cares_request_body) do - FactoryBot.build(:appointment_form_v2, :community_cares, user: current_user).attributes + context 'with VAOS' do + before do + Flipper.disable(:va_online_scheduling_use_vpg) + Flipper.disable(:va_online_scheduling_enable_OH_requests) end - let(:community_cares_request_body2) do - FactoryBot.build(:appointment_form_v2, :community_cares2, user: current_user).attributes - end + describe 'CREATE cc appointment' do + let(:community_cares_request_body) do + FactoryBot.build(:appointment_form_v2, :community_cares, user: current_user).attributes + end + + let(:community_cares_request_body2) do + FactoryBot.build(:appointment_form_v2, :community_cares2, user: current_user).attributes + end - it 'creates the cc appointment' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_cc_200_with_provider', - match_requests_on: %i[method path query]) do - VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + it 'creates the cc appointment' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_cc_200_with_provider', match_requests_on: %i[method path query]) do - allow_any_instance_of(VAOS::V2::MobilePPMSService).to \ - receive(:get_provider_with_cache).with('1174506877').and_return(provider_response3) - post '/vaos/v2/appointments', params: community_cares_request_body2, headers: inflection_header + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + allow_any_instance_of(VAOS::V2::MobilePPMSService).to \ + receive(:get_provider_with_cache).with('1174506877').and_return(provider_response3) + post '/vaos/v2/appointments', params: community_cares_request_body2, headers: inflection_header - expect(response).to have_http_status(:created) - json_body = json_body_for(response) - expect(json_body.dig('attributes', 'preferredProviderName')).to eq('BRIANT G MOYLES') - expect(json_body.dig('attributes', 'requestedPeriods', 0, 'localStartTime')) - .to eq('2023-01-17T00:00:00.000-07:00') - expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + expect(response).to have_http_status(:created) + json_body = json_body_for(response) + expect(json_body.dig('attributes', 'preferredProviderName')).to eq('BRIANT G MOYLES') + expect(json_body.dig('attributes', 'requestedPeriods', 0, 'localStartTime')) + .to eq('2023-01-17T00:00:00.000-07:00') + expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + end + + it 'returns a 400 error' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_400', match_requests_on: %i[method path query]) do + post '/vaos/v2/appointments', params: community_cares_request_body + expect(response).to have_http_status(:bad_request) + expect(JSON.parse(response.body)['errors'][0]['status']).to eq('400') + expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( + 'the patientIcn must match the ICN in the request URI' + ) end end end - it 'returns a 400 error' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_400', match_requests_on: %i[method path query]) do - post '/vaos/v2/appointments', params: community_cares_request_body - expect(response).to have_http_status(:bad_request) - expect(JSON.parse(response.body)['errors'][0]['status']).to eq('400') - expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( - 'the patientIcn must match the ICN in the request URI' - ) + describe 'CREATE va appointment' do + let(:va_booked_request_body) do + FactoryBot.build(:appointment_form_v2, :va_booked, user: current_user).attributes + end + + let(:va_proposed_request_body) do + FactoryBot.build(:appointment_form_v2, :va_proposed_clinic, user: current_user).attributes + end + + it 'creates the va appointment - proposed' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_proposed_clinic_200', + match_requests_on: %i[method path query]) do + post '/vaos/v2/appointments', params: va_proposed_request_body, headers: inflection_header + expect(response).to have_http_status(:created) + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + + it 'creates the va appointment - booked' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + post '/vaos/v2/appointments', params: va_booked_request_body, headers: inflection_header + expect(response).to have_http_status(:created) + json_body = json_body_for(response) + expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + expect(json_body['attributes']['localStartTime']).to eq('2022-11-30T13:45:00.000-07:00') + end + end + end + + it 'creates the va appointment and logs appointment details when there is a PAP COMPLIANCE comment' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + allow(Rails.logger).to receive(:info).at_least(:once) + post '/vaos/v2/appointments', params: va_booked_request_body, headers: inflection_header + expect(response).to have_http_status(:created) + json_body = json_body_for(response) + expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + expect(Rails.logger).to have_received(:info).with('Details for PAP COMPLIANCE/TELE appointment', + any_args).at_least(:once) + expect(json_body['attributes']['localStartTime']).to eq('2022-11-30T13:45:00.000-07:00') + end + end end end end - describe 'CREATE va appointment' do - let(:va_booked_request_body) do - FactoryBot.build(:appointment_form_v2, :va_booked, user: current_user).attributes + context 'using VPG' do + before do + Flipper.enable(:va_online_scheduling_use_vpg) + Flipper.enable(:va_online_scheduling_enable_OH_requests) end - let(:va_proposed_request_body) do - FactoryBot.build(:appointment_form_v2, :va_proposed_clinic, user: current_user).attributes - end + describe 'CREATE cc appointment' do + let(:community_cares_request_body) do + FactoryBot.build(:appointment_form_v2, :community_cares, user: current_user).attributes + end - it 'creates the va appointment - proposed' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_va_proposed_clinic_200', - match_requests_on: %i[method path query]) do - post '/vaos/v2/appointments', params: va_proposed_request_body, headers: inflection_header - expect(response).to have_http_status(:created) - expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + let(:community_cares_request_body2) do + FactoryBot.build(:appointment_form_v2, :community_cares2, user: current_user).attributes end - end - it 'creates the va appointment - booked' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M', - match_requests_on: %i[method path query]) do - VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + it 'creates the cc appointment' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_cc_200_with_provider_vpg', match_requests_on: %i[method path query]) do - post '/vaos/v2/appointments', params: va_booked_request_body, headers: inflection_header - expect(response).to have_http_status(:created) - json_body = json_body_for(response) - expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) - expect(json_body['attributes']['localStartTime']).to eq('2022-11-30T13:45:00.000-07:00') + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + allow_any_instance_of(VAOS::V2::MobilePPMSService).to \ + receive(:get_provider_with_cache).with('1174506877').and_return(provider_response3) + post '/vaos/v2/appointments', params: community_cares_request_body2, headers: inflection_header + + expect(response).to have_http_status(:created) + json_body = json_body_for(response) + expect(json_body.dig('attributes', 'preferredProviderName')).to eq('BRIANT G MOYLES') + expect(json_body.dig('attributes', 'requestedPeriods', 0, 'localStartTime')) + .to eq('2023-01-17T00:00:00.000-07:00') + expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + end + + it 'returns a 400 error' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_400_vpg', + match_requests_on: %i[method path query]) do + post '/vaos/v2/appointments', params: community_cares_request_body + expect(response).to have_http_status(:bad_request) + expect(JSON.parse(response.body)['errors'][0]['status']).to eq('400') + expect(JSON.parse(response.body)['errors'][0]['detail']).to eq( + 'the patientIcn must match the ICN in the request URI' + ) end end end - it 'creates the va appointment and logs appointment details when there is a PAP COMPLIANCE comment' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility', - match_requests_on: %i[method path query]) do - VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + describe 'CREATE va appointment' do + let(:va_booked_request_body) do + FactoryBot.build(:appointment_form_v2, :va_booked, user: current_user).attributes + end + + let(:va_proposed_request_body) do + FactoryBot.build(:appointment_form_v2, :va_proposed_clinic, user: current_user).attributes + end + + it 'creates the va appointment - proposed' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_proposed_clinic_200_vpg', match_requests_on: %i[method path query]) do - allow(Rails.logger).to receive(:info).at_least(:once) - post '/vaos/v2/appointments', params: va_booked_request_body, headers: inflection_header + post '/vaos/v2/appointments', params: va_proposed_request_body, headers: inflection_header expect(response).to have_http_status(:created) - json_body = json_body_for(response) - expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) - expect(Rails.logger).to have_received(:info).with('Details for PAP COMPLIANCE/TELE appointment', - any_args).at_least(:once) - expect(json_body['attributes']['localStartTime']).to eq('2022-11-30T13:45:00.000-07:00') + expect(json_body_for(response)).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + end + end + + it 'creates the va appointment - booked' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + post '/vaos/v2/appointments', params: va_booked_request_body, headers: inflection_header + expect(response).to have_http_status(:created) + json_body = json_body_for(response) + expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + expect(json_body['attributes']['localStartTime']).to eq('2022-11-30T13:45:00.000-07:00') + end + end + end + + it 'creates the va appointment and logs appointment details when there is a PAP COMPLIANCE comment' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility_vpg', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + allow(Rails.logger).to receive(:info).at_least(:once) + post '/vaos/v2/appointments', params: va_booked_request_body, headers: inflection_header + expect(response).to have_http_status(:created) + json_body = json_body_for(response) + expect(json_body).to match_camelized_schema('vaos/v2/appointment', { strict: false }) + expect(Rails.logger).to have_received(:info).with('Details for PAP COMPLIANCE/TELE appointment', + any_args).at_least(:once) + expect(json_body['attributes']['localStartTime']).to eq('2022-11-30T13:45:00.000-07:00') + end end end end diff --git a/modules/vaos/spec/services/v2/appointment_service_spec.rb b/modules/vaos/spec/services/v2/appointment_service_spec.rb index 005d829f7cd..5ff40013f14 100644 --- a/modules/vaos/spec/services/v2/appointment_service_spec.rb +++ b/modules/vaos/spec/services/v2/appointment_service_spec.rb @@ -67,89 +67,193 @@ FactoryBot.build(:appointment_form_v2, :community_cares, user:).attributes end - context 'when va appointment create request is valid' do - # appointment created using the Jacqueline Morgan user + context 'using VAOS' do + before do + Flipper.disable(:va_online_scheduling_use_vpg) + Flipper.disable(:va_online_scheduling_enable_OH_requests) + end - it 'returns the created appointment - va - booked' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M', - match_requests_on: %i[method path query]) do - VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + context 'when va appointment create request is valid' do + # appointment created using the Jacqueline Morgan user + + it 'returns the created appointment - va - booked' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + allow(Rails.logger).to receive(:info).at_least(:once) + response = subject.post_appointment(va_booked_request_body) + expect(response[:id]).to be_a(String) + expect(response[:local_start_time]) + .to eq(DateTime.parse('2022-11-30T13:45:00-07:00')) + end + end + end + + it 'returns the created appointment and logs data' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data', match_requests_on: %i[method path query]) do - allow(Rails.logger).to receive(:info).at_least(:once) - response = subject.post_appointment(va_booked_request_body) - expect(response[:id]).to be_a(String) - expect(response[:local_start_time]) - .to eq(DateTime.parse('2022-11-30T13:45:00-07:00')) + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + response = subject.post_appointment(va_booked_request_body) + expect(response[:id]).to be_a(String) + expect(response[:local_start_time]) + .to eq(DateTime.parse('2022-11-30T13:45:00-07:00')) + end + end + end + + it 'returns the created appointment-va-proposed-clinic' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_proposed_clinic_200', + match_requests_on: %i[method path query]) do + response = subject.post_appointment(va_proposed_clinic_request_body) + expect(response[:id]).to eq('70065') end end end - it 'returns the created appointment and logs data' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data', - match_requests_on: %i[method path query]) do - VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + context 'when cc appointment create request is valid' do + it 'returns the created appointment - cc - proposed' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_cc_200_2222022', match_requests_on: %i[method path query]) do - response = subject.post_appointment(va_booked_request_body) - expect(response[:id]).to be_a(String) - expect(response[:local_start_time]) - .to eq(DateTime.parse('2022-11-30T13:45:00-07:00')) + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + response = subject.post_appointment(community_cares_request_body) + expect(response[:id]).to be_a(String) + expect(response.dig(:requested_periods, 0, :local_start_time)) + .to eq(DateTime.parse('2021-06-15T06:00:00-06:00')) + end end end end - it 'returns the created appointment-va-proposed-clinic' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_va_proposed_clinic_200', - match_requests_on: %i[method path query]) do - response = subject.post_appointment(va_proposed_clinic_request_body) - expect(response[:id]).to eq('70065') + context 'when the patientIcn is missing' do + it 'raises a backend exception' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_400', match_requests_on: %i[method path query]) do + expect { subject.post_appointment(community_cares_request_body) }.to raise_error( + Common::Exceptions::BackendServiceException + ) + end + end + end + + context 'when the patientIcn is missing on a direct scheduling submission' do + it 'raises a backend exception and logs error details' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_400', match_requests_on: %i[method path query]) do + allow(Rails.logger).to receive(:warn).at_least(:once) + expect { subject.post_appointment(va_booked_request_body) }.to raise_error( + Common::Exceptions::BackendServiceException + ) + expect(Rails.logger).to have_received(:warn).with('Direct schedule submission error', + any_args).at_least(:once) + end + end + end + + context 'when the upstream server returns a 500' do + it 'raises a backend exception' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_500', match_requests_on: %i[method path query]) do + expect { subject.post_appointment(community_cares_request_body) }.to raise_error( + Common::Exceptions::BackendServiceException + ) + end end end end - context 'when cc appointment create request is valid' do - it 'returns the created appointment - cc - proposed' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_cc_200_2222022', - match_requests_on: %i[method path query]) do - VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + context 'using VPG' do + before do + Flipper.enable(:va_online_scheduling_use_vpg) + Flipper.enable(:va_online_scheduling_enable_OH_requests) + end + + context 'when va appointment create request is valid' do + # appointment created using the Jacqueline Morgan user + + it 'returns the created appointment - va - booked' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg', match_requests_on: %i[method path query]) do - response = subject.post_appointment(community_cares_request_body) - expect(response[:id]).to be_a(String) - expect(response.dig(:requested_periods, 0, :local_start_time)) - .to eq(DateTime.parse('2021-06-15T06:00:00-06:00')) + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + allow(Rails.logger).to receive(:info).at_least(:once) + response = subject.post_appointment(va_booked_request_body) + expect(response[:id]).to be_a(String) + expect(response[:local_start_time]) + .to eq(DateTime.parse('2022-11-30T13:45:00-07:00')) + end + end + end + + it 'returns the created appointment and logs data' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data_vpg', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + response = subject.post_appointment(va_booked_request_body) + expect(response[:id]).to be_a(String) + expect(response[:local_start_time]) + .to eq(DateTime.parse('2022-11-30T13:45:00-07:00')) + end + end + end + + it 'returns the created appointment-va-proposed-clinic' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_va_proposed_clinic_200_vpg', + match_requests_on: %i[method path query]) do + response = subject.post_appointment(va_proposed_clinic_request_body) + expect(response[:id]).to eq('70065') end end end - end - context 'when the patientIcn is missing' do - it 'raises a backend exception' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_400', match_requests_on: %i[method path query]) do - expect { subject.post_appointment(community_cares_request_body) }.to raise_error( - Common::Exceptions::BackendServiceException - ) + context 'when cc appointment create request is valid' do + it 'returns the created appointment - cc - proposed' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_cc_200_2222022_vpg', + match_requests_on: %i[method path query]) do + VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', + match_requests_on: %i[method path query]) do + response = subject.post_appointment(community_cares_request_body) + expect(response[:id]).to be_a(String) + expect(response.dig(:requested_periods, 0, :local_start_time)) + .to eq(DateTime.parse('2021-06-15T06:00:00-06:00')) + end + end end end - end - context 'when the patientIcn is missing on a direct scheduling submission' do - it 'raises a backend exception and logs error details' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_400', match_requests_on: %i[method path query]) do - allow(Rails.logger).to receive(:warn).at_least(:once) - expect { subject.post_appointment(va_booked_request_body) }.to raise_error( - Common::Exceptions::BackendServiceException - ) - expect(Rails.logger).to have_received(:warn).with('Direct schedule submission error', - any_args).at_least(:once) + context 'when the patientIcn is missing' do + it 'raises a backend exception' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_400_vpg', + match_requests_on: %i[method path query]) do + expect { subject.post_appointment(community_cares_request_body) }.to raise_error( + Common::Exceptions::BackendServiceException + ) + end end end - end - context 'when the upstream server returns a 500' do - it 'raises a backend exception' do - VCR.use_cassette('vaos/v2/appointments/post_appointments_500', match_requests_on: %i[method path query]) do - expect { subject.post_appointment(community_cares_request_body) }.to raise_error( - Common::Exceptions::BackendServiceException - ) + context 'when the patientIcn is missing on a direct scheduling submission' do + it 'raises a backend exception and logs error details' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_400_vpg', + match_requests_on: %i[method path query]) do + allow(Rails.logger).to receive(:warn).at_least(:once) + expect { subject.post_appointment(va_booked_request_body) }.to raise_error( + Common::Exceptions::BackendServiceException + ) + expect(Rails.logger).to have_received(:warn).with('Direct schedule submission error', + any_args).at_least(:once) + end + end + end + + context 'when the upstream server returns a 500' do + it 'raises a backend exception' do + VCR.use_cassette('vaos/v2/appointments/post_appointments_500_vpg', + match_requests_on: %i[method path query]) do + expect { subject.post_appointment(community_cares_request_body) }.to raise_error( + Common::Exceptions::BackendServiceException + ) + end end end end diff --git a/spec/support/vcr_cassettes/mobile/appointments/post_appointments_400_vpg.yml b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_400_vpg.yml new file mode 100644 index 00000000000..e92a2c8dd28 --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_400_vpg.yml @@ -0,0 +1,57 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"cc","status":"proposed","locationId":"983","reason":"Testing","slot":{},"contact":{"telecom":[{"type":"phone","value":"2125688889"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"serviceType":"CCPOD","requestedPeriods":[{"start":"2021-06-15T12:00:00.000+00:00","end":"2021-06-15T23:59:00.000+00:00"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - eyJhbGciOiJSUzUxMiJ9.eyJhdXRoZW50aWNhdGVkIjp0cnVlLCJsYXN0TmFtZSI6Ik1vcnJpc29uIiwic3ViIjoiMTAxMjg0NTMzMVYxNTMwNDMiLCJhdXRoZW50aWNhdGlvbkF1dGhvcml0eSI6Imdvdi52YS52YW9zIiwiZ2VuZGVyIjoiRkVNQUxFIiwiaXNzIjoiZ292LnZhLnZhbWYudXNlcnNlcnZpY2UudjIiLCJ2YW1mLmF1dGgucmVzb3VyY2VzIjpbIl4uKihcLyk_c2l0ZVtzXT9cLyhkZm4tKT85ODRcL3BhdGllbnRbc10_XC81NTIxNjEwNTBcL2FwcG9pbnRtZW50cyhcLy4qKT8kIiwiXi4qKFwvKT9zaXRlW3NdP1wvKGRmbi0pPzk4M1wvcGF0aWVudFtzXT9cLzcyMTY2OTFcL2FwcG9pbnRtZW50cyhcLy4qKT8kIiwiXi4qKFwvKT9wYXRpZW50W3NdP1wvKElDTlwvKT8xMDEyODQ1MzMxVjE1MzA0MyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTYyMjc1NTAxNCwicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKdWR5IiwibGFzdE5hbWUiOiJNb3JyaXNvbiIsImdlbmRlciI6IkZFTUFMRSIsImljbiI6IjEwMTI4NDUzMzFWMTUzMDQzIiwiZG9iIjoiMTk1My0wNC0wMSIsImRhdGVPZkJpcnRoIjoiMTk1My0wNC0wMSIsInNzbiI6Ijc5NjA2MTk3NiJ9LCJ2YW1mLmF1dGgucm9sZXMiOlsidmV0ZXJhbiJdLCJyaWdodE9mQWNjZXNzQWNjZXB0ZWQiOnRydWUsImV4cCI6MTYyMjc1NTkxNCwianRpIjoiYjkzOGI5YTQtMDAwMC00MzRiLWI1MDgtNjAzOWQxMjVjZDRjIiwiaWRUeXBlIjoiSUNOIiwiZGF0ZU9mQmlydGgiOiIxOTUzMDQwMSIsInZlcnNpb24iOjIuNSwiZWRpcGlkIjoiMTI1OTg5Nzk3OCIsInZpc3RhSWRzIjpbeyJwYXRpZW50SWQiOiI1NTIxNjEwNTAiLCJzaXRlSWQiOiI5ODQifSx7InBhdGllbnRJZCI6IjcyMTY2OTEiLCJzaXRlSWQiOiI5ODMifV0sImZpcnN0TmFtZSI6Ikp1ZHkiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjIyNzU0ODM0LCJkb2IiOiIxOTUzMDQwMSIsImxvYSI6Mn0.xSPU-3nDiisLD0sFtoYIreyaRfOmPUF_GvqRHqj-T9Sxy0bU6JFiU7YBFeAQv0TFpLg6_-oqBbxw4y6fFvyDrkTEHz5o9FHYfxCJKk1Bf-FPp99b6rEIP0PHTh-ewPVpiVfXxAbHUc12Bxjfw0q1-LhBI8qWVsdIapQ-aEaM5UsHLM9DGU2CsUfd_ifOwMfZT6j_HMkZySHe5cUOtOuYfxk4dX2sR7PrMshvOBj3xeAbkrKCOvio-bwvvWwjHS6csR21Mcuaqlwdixzw7UUgcWn1UpmjDxYNwT6gS8G5nAk8Gjwkn0OcH_z0bL212DSIQTd-GmgQs9ORSubgWGETxQ + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Thu, 03 Jun 2021 21:16:55 GMT + Content-Type: + - application/json + Content-Length: + - '66' + Server: + - openresty + X-Vamf-Version: + - 1.6.0 + B3: + - c9b88ad736b44fcd-9506797b4f25487c-1 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 36e545f + X-Vamf-Timestamp: + - '2021-05-29T19:44:21+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + body: + encoding: UTF-8 + string: '{"message":"the patientIcn must match the ICN in the request URI"}' + recorded_at: Thu, 03 Jun 2021 21:16:55 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/mobile/appointments/post_appointments_cc_200_2222022_vpg.yml b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_cc_200_2222022_vpg.yml new file mode 100644 index 00000000000..82e686a9ff4 --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_cc_200_2222022_vpg.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"cc","status":"proposed","locationId":"983","contact":{"telecom":[{"type":"phone","value":"2125688887"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"serviceType":"podiatry","requestedPeriods":[{"start":"2021-06-15T12:00:00.000+00:00","end":"2021-06-15T23:59:00.000+00:00"}],"preferredLanguage":"English","practitioners":[{"identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1407938061"}],"address":{"type":"postal","line":["38143 + Martha Ave"],"city":"Fremont","state":"CA","postalCode":"94536","country":"USA","text":"test"}}],"preferredTimesForPhoneCall":["Morning"],"preferredLocation":{"city":"Helena","state":"MT"},"comment":"test","patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - eyJhbGciOiJSUzUxMiJ9.eyJhdXRoZW50aWNhdGVkIjp0cnVlLCJsYXN0TmFtZSI6Ik1vcmdhbiIsInN1YiI6IjEwMTI4NDYwNDNWNTc2MzQxIiwiYXV0aGVudGljYXRpb25BdXRob3JpdHkiOiJnb3YudmEudmFvcyIsImdlbmRlciI6IkZFTUFMRSIsImlzcyI6Imdvdi52YS52YW1mLnVzZXJzZXJ2aWNlLnYyIiwidmFtZi5hdXRoLnJlc291cmNlcyI6WyJeLiooXC8pP3BhdGllbnRbc10_XC8oSUNOXC8pPzEwMTI4NDYwNDNWNTc2MzQxKFwvLiopPyQiLCJeLiooXC8pP3NpdGVbc10_XC8oZGZuLSk_OTgzXC9wYXRpZW50W3NdP1wvNzIxNjY4NVwvYXBwb2ludG1lbnRzKFwvLiopPyQiLCJeLiooXC8pP3NpdGVbc10_XC8oZGZuLSk_NjY4XC9wYXRpZW50W3NdP1wvMTYxNzM3XC9hcHBvaW50bWVudHMoXC8uKik_JCIsIl4uKihcLyk_c2l0ZVtzXT9cLyhkZm4tKT85ODRcL3BhdGllbnRbc10_XC81NTIxNjEwNDRcL2FwcG9pbnRtZW50cyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTY0NTU2NjM0MiwicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKYWNxdWVsaW5lIiwibGFzdE5hbWUiOiJNb3JnYW4iLCJnZW5kZXIiOiJGRU1BTEUiLCJpY24iOiIxMDEyODQ2MDQzVjU3NjM0MSIsImRvYiI6IjE5NjItMDItMDciLCJkYXRlT2ZCaXJ0aCI6IjE5NjItMDItMDciLCJzc24iOiI3OTYwNjE5NzYifSwidmFtZi5hdXRoLnJvbGVzIjpbInZldGVyYW4iXSwicmlnaHRPZkFjY2Vzc0FjY2VwdGVkIjp0cnVlLCJleHAiOjE2NDU1NjcyNDIsImp0aSI6IjIxOTQ3ZjdhLWFiMTQtNDE1ZC1iMzMxLWJmM2QwNjRlNGYwNCIsImlkVHlwZSI6IklDTiIsImRhdGVPZkJpcnRoIjoiMTk2MjAyMDciLCJ2ZXJzaW9uIjoyLjYsImVkaXBpZCI6IjEwMTM1OTk3MzAiLCJ2aXN0YUlkcyI6W3sicGF0aWVudElkIjoiNzIxNjY4NSIsInNpdGVJZCI6Ijk4MyJ9LHsicGF0aWVudElkIjoiMTYxNzM3Iiwic2l0ZUlkIjoiNjY4In0seyJwYXRpZW50SWQiOiI1NTIxNjEwNDQiLCJzaXRlSWQiOiI5ODQifV0sImZpcnN0TmFtZSI6IkphY3F1ZWxpbmUiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjQ1NTY2MTYyLCJkb2IiOiIxOTYyMDIwNyIsImxvYSI6Mn0.IW4TZPQoTEogVsfkeBRVEtIia6MlNu0vCAs1SwjhBaloG4caS2TvA9KlNag2861NDmt4BmneamTgHVgZ_uS0foYJKb4OXSZOEu1Pguly_sb3FxtYqvvMX4wTQQDPaZc43XqqgEG6RE_8lzreTI0iIDO1ZVfMDrUYu4uc02ZBXFPIeOsZbBZ-p3EQCG9n5Ebp02BggQqvcq0lfVDCmLlJtPt1ouFuTngGsjyMW6n_9lUvpO3sPC3M-N4F4MJ2doI43jIzSDHcb5l9br7Q4p56_h8aULnOovWAx8T7jf1ysSxLDRoXFZJHCxmqIzHZgajmKabUwZBDz96QBHdMQPasOQ + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 22 Feb 2022 21:46:03 GMT + Content-Type: + - application/json + Content-Length: + - '614' + Server: + - openresty + X-Vamf-Version: + - 1.15.2 + B3: + - 38613f08883e2d8959f5b199aae93593-a0127fd9ebf0ac76-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - c9a85ac + X-Vamf-Timestamp: + - '2022-01-28T19:18:54+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '21106' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"81063","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/hsrm/id","value":"11992"}],"kind":"cc","status":"proposed","serviceType":"podiatry","patientIcn":"1012846043V576341","locationId":"983","created":"2022-02-22T21:46:00Z","requestedPeriods":[{"start":"2021-06-15T12:00:00Z"}],"contact":{"telecom":[{"type":"phone","value":"2125688887"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"preferredLocation":{"city":"Helena","state":"MT"},"cancellationReason":{"code":"other"},"comment":"test","preferredLanguage":"English","cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Tue, 22 Feb 2022 21:46:03 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml new file mode 100644 index 00000000000..dfa709876eb --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml @@ -0,0 +1,61 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"clinic","status":"booked","locationId":"983","clinic":"1020","slot":{"id":"3230323230323032313530303A323032323032303231363030"},"extension":{"desiredDate":"2022-02-15T23:59:00.000+00:00"},"patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - eyJhbGciOiJSUzUxMiJ9.eyJhdXRoZW50aWNhdGVkIjp0cnVlLCJsYXN0TmFtZSI6Ik1vcmdhbiIsInN1YiI6IjEwMTI4NDYwNDNWNTc2MzQxIiwiYXV0aGVudGljYXRpb25BdXRob3JpdHkiOiJnb3YudmEudmFvcyIsImdlbmRlciI6IkZFTUFMRSIsImlzcyI6Imdvdi52YS52YW1mLnVzZXJzZXJ2aWNlLnYyIiwidmFtZi5hdXRoLnJlc291cmNlcyI6WyJeLiooXC8pP3BhdGllbnRbc10_XC8oSUNOXC8pPzEwMTI4NDYwNDNWNTc2MzQxKFwvLiopPyQiLCJeLiooXC8pP3NpdGVbc10_XC8oZGZuLSk_OTgzXC9wYXRpZW50W3NdP1wvNzIxNjY4NVwvYXBwb2ludG1lbnRzKFwvLiopPyQiLCJeLiooXC8pP3NpdGVbc10_XC8oZGZuLSk_NjY4XC9wYXRpZW50W3NdP1wvMTYxNzM3XC9hcHBvaW50bWVudHMoXC8uKik_JCIsIl4uKihcLyk_c2l0ZVtzXT9cLyhkZm4tKT85ODRcL3BhdGllbnRbc10_XC81NTIxNjEwNDRcL2FwcG9pbnRtZW50cyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTY0MjA5NDg5NiwicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKYWNxdWVsaW5lIiwibGFzdE5hbWUiOiJNb3JnYW4iLCJnZW5kZXIiOiJGRU1BTEUiLCJpY24iOiIxMDEyODQ2MDQzVjU3NjM0MSIsImRvYiI6IjE5NjItMDItMDciLCJkYXRlT2ZCaXJ0aCI6IjE5NjItMDItMDciLCJzc24iOiI3OTYwNjE5NzYifSwidmFtZi5hdXRoLnJvbGVzIjpbInZldGVyYW4iXSwicmlnaHRPZkFjY2Vzc0FjY2VwdGVkIjp0cnVlLCJleHAiOjE2NDIwOTU3OTYsImp0aSI6IjVhNzBkYzFkLTk0ODctNDNjMi1hOGRjLTIzMGM2M2NjMjlhOSIsImlkVHlwZSI6IklDTiIsImRhdGVPZkJpcnRoIjoiMTk2MjAyMDciLCJ2ZXJzaW9uIjoyLjYsImVkaXBpZCI6IjEwMTM1OTk3MzAiLCJ2aXN0YUlkcyI6W3sicGF0aWVudElkIjoiNzIxNjY4NSIsInNpdGVJZCI6Ijk4MyJ9LHsicGF0aWVudElkIjoiMTYxNzM3Iiwic2l0ZUlkIjoiNjY4In0seyJwYXRpZW50SWQiOiI1NTIxNjEwNDQiLCJzaXRlSWQiOiI5ODQifV0sImZpcnN0TmFtZSI6IkphY3F1ZWxpbmUiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjQyMDk0NzE2LCJkb2IiOiIxOTYyMDIwNyIsImxvYSI6Mn0.DRk59j3zEVLOAD0o0atwGoJ00NHIrTYYjkKAUtj5yVVG2YokKHvu4yj5BmFKanYTMrAgcemsda8fVf0TfcERKJxfdUHs6vIShSXTT-nVgsAEqn5bx-FQlkZEz1BMziNVysaup3GhjC1QJ0LHhj0Ag2V_eI9GOH2lNpoBe6GYTJMqmUnhJ6ww4dFcuN2S00lGDeCB1062r1vOlfIZmanth34XE7FoZWTLYsUtCVyr41lKhOltK7h0uv6Re7pzdD0jwgsaJTN8JMXdZV5uovY-lrkIW57-un3gppMv87CONWU8WJhbBomzOqp8ZQSflWPYYtLzys3CLDWwAeBdHMsSlA + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 13 Jan 2022 17:28:18 GMT + Content-Type: + - application/json + Content-Length: + - '591' + Server: + - openresty + X-Vamf-Version: + - 1.15.1 + B3: + - d33a494ebf22f01633105719d10f767a-8b75ad6c09bf9590-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - e815ffd + X-Vamf-Timestamp: + - '2022-01-12T20:37:53+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '1772' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"72149","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id","value":"1020;20220202.080000"}],"kind":"clinic","status":"booked","serviceType":"audiology","reasonCode":{"text":"9"},"patientIcn":"1012846043V576341","locationId":"983","clinic":"1020","start":"2022-02-02T15:00:00Z","end":"2022-02-02T16:00:00Z","minutesDuration":60,"slot":{"id":"3230323230323032313530303A323032323032303231363030","start":"2022-02-02T15:00:00Z","end":"2022-02-02T16:00:00Z"},"cancellationReason":{"code":"other"},"cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Thu, 13 Jan 2022 17:28:18 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_proposed_clinic_200_vpg.yml b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_proposed_clinic_200_vpg.yml new file mode 100644 index 00000000000..b9c8489af1c --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/post_appointments_va_proposed_clinic_200_vpg.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"clinic","status":"proposed","locationId":"983","contact":{"telecom":[{"type":"phone","value":"2125688889"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"serviceType":"audiology","requestedPeriods":[{"end":null,"2022-01-04T11:59:00Z":null},{"start":null,"2022-01-04T00:00:00Z":null}],"reasonCode":{"codeing":[{"code":"Routine + Follow-up"}],"text":"text"},"comment":"Follow-up/Routine: testing","patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 14 Dec 2021 23:30:04 GMT + Content-Type: + - application/json + Content-Length: + - '522' + Server: + - openresty + X-Vamf-Version: + - 1.14.1 + B3: + - b7e8fa4c5ccbed081a8afd6fe5bc0a4f-cb586bfe1c6c819a-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 20a82ca + X-Vamf-Timestamp: + - '2021-11-26T16:29:10+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '10356' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"70065","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/ars/id","value":"8a4890c47da65e2b017dbb481aeb0001"}],"kind":"clinic","status":"proposed","serviceType":"audiology","reasonCode":{"text":"text"},"patientIcn":"1012846043V576341","locationId":"983","created":"2021-12-14T16:30:04Z","contact":{"telecom":[{"type":"email","value":"judymorisooooooooooooon@gmail.com"},{"type":"phone","value":"2125688889"}]},"cancellationReason":{"code":"other"},"cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Tue, 14 Dec 2021 23:30:04 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_400_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_400_vpg.yml new file mode 100644 index 00000000000..a327a649205 --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_400_vpg.yml @@ -0,0 +1,57 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"cc","status":"proposed","locationId":"983","reason":"Testing","slot":{},"contact":{"telecom":[{"type":"phone","value":"2125688889"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"serviceType":"CCPOD","requestedPeriods":[{"start":"2021-06-15T12:00:00.000+00:00","end":"2021-06-15T23:59:00.000+00:00"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: Bad Request + headers: + Date: + - Thu, 03 Jun 2021 21:16:55 GMT + Content-Type: + - application/json + Content-Length: + - '66' + Server: + - openresty + X-Vamf-Version: + - 1.6.0 + B3: + - c9b88ad736b44fcd-9506797b4f25487c-1 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 36e545f + X-Vamf-Timestamp: + - '2021-05-29T19:44:21+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + body: + encoding: UTF-8 + string: '{"message":"the patientIcn must match the ICN in the request URI"}' + recorded_at: Thu, 03 Jun 2021 21:16:55 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_500_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_500_vpg.yml new file mode 100644 index 00000000000..4e33f37a6d5 --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_500_vpg.yml @@ -0,0 +1,51 @@ +--- +http_interactions: + - request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: + '{"kind":"clinic","status":"proposed","locationId":"983","clinic":"308","reason":"reason","slot":{"id":"A1","start":"2020-01-31T00:00:00.000+00:00","end":"2020-01-31T00:00:00.000+00:00"},"contact":{"telecom":[{"type":"email","value":"person@example.com"},{"type":"phone","value":"2125551212"}]},"serviceType":"primary + care","requestedPeriods":[{"start":"2020-01-31T00:00:00.000+00:00","end":"2020-01-31T21:00:00.000+00:00"},{"start":"2020-03-31T00:00:00.000+00:00","end":"2020-03-31T21:00:00.000+00:00"}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - "" + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 500 + message: Internal Server Error + headers: + Date: + - Mon, 10 May 2021 17:59:32 GMT + Content-Type: + - text/html + Content-Length: + - "982" + Connection: + - keep-alive + Etag: + - '"5fa5087d-3d6"' + Set-Cookie: + - TS016f4012=stubbed_cookie; + Max-Age=900; Path=/ + - vamfjwtv3=stubbed_token; + path=/; SameSite=Lax; HttpOnly + - vamftimeoutv1=1620670472; SameSite=Lax; path=/ + body: + encoding: UTF-8 + string: "need to record vcr cassette" + recorded_at: Mon, 10 May 2021 17:59:32 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_2222022_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_2222022_vpg.yml new file mode 100644 index 00000000000..d8ba07ac553 --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_2222022_vpg.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"cc","status":"proposed","locationId":"983","contact":{"telecom":[{"type":"phone","value":"2125688887"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"serviceType":"podiatry","requestedPeriods":[{"start":"2021-06-15T12:00:00.000+00:00","end":"2021-06-15T23:59:00.000+00:00"}],"preferredLanguage":"English","practitioners":[{"identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1407938061"}],"address":{"type":"postal","line":["38143 + Martha Ave"],"city":"Fremont","state":"CA","postalCode":"94536","country":"USA","text":"test"}}],"preferredTimesForPhoneCall":["Morning"],"preferredLocation":{"city":"Helena","state":"MT"},"comment":"test","patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 22 Feb 2022 21:46:03 GMT + Content-Type: + - application/json + Content-Length: + - '614' + Server: + - openresty + X-Vamf-Version: + - 1.15.2 + B3: + - 38613f08883e2d8959f5b199aae93593-a0127fd9ebf0ac76-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - c9a85ac + X-Vamf-Timestamp: + - '2022-01-28T19:18:54+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '21106' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"81063","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/hsrm/id","value":"11992"}],"kind":"cc","status":"proposed","serviceType":"podiatry","patientIcn":"1012846043V576341","locationId":"983","created":"2022-02-22T21:46:00Z","requestedPeriods":[{"start":"2021-06-15T12:00:00Z"}],"contact":{"telecom":[{"type":"phone","value":"2125688887"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"preferredLocation":{"city":"Helena","state":"MT"},"cancellationReason":{"code":"other"},"comment":"test","preferredLanguage":"English","cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Tue, 22 Feb 2022 21:46:03 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_with_provider_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_with_provider_vpg.yml new file mode 100644 index 00000000000..af116ef926f --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_cc_200_with_provider_vpg.yml @@ -0,0 +1,61 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"cc","status":"proposed","locationId":"983","serviceType":"podiatry","reasonCode":{"text":"string"},"contact":{"telecom":[{"type":"phone","value":"2762740095"},{"type":"email","value":"jacqueline.morgan@id.me"}]},"requestedPeriods":[{"start":"2023-01-17T07:00:00Z","end":"2023-01-17T18:59:00Z"}],"preferredTimesForPhoneCall":["Morning"],"preferredLanguage":"English","preferredLocation":{"city":"Palm Bay","state":"FL"},"practitioners":[{"identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1174506877"}],"address":{"line":["590 MALABAR RD SE STE 5"],"city":"PALM BAY","state":"FL","postalCode":"32907-3108"}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 22 Feb 2022 21:46:03 GMT + Content-Type: + - application/json + Content-Length: + - '614' + Server: + - openresty + X-Vamf-Version: + - 1.15.2 + B3: + - 38613f08883e2d8959f5b199aae93593-a0127fd9ebf0ac76-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - c9a85ac + X-Vamf-Timestamp: + - '2022-01-28T19:18:54+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '21106' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"153432","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/hsrm/id","value":"13413"}],"kind":"cc","status":"proposed","serviceType":"podiatry","serviceTypes":[{"text":"podiatry"}],"patientIcn":"1012846043V576341","locationId":"983","practitioners":[{"identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1174506877"}],"address":{"type":"physical","line":["590 MALABAR RD SE STE 5"],"city":"PALM BAY","state":"FL","postalCode":"32907-3108","text":"590 MALABAR RD SE STE 5,PALM BAY,FL,32907-3108"}}],"created":"2023-01-12T21:40:00Z","requestedPeriods":[{"start":"2023-01-17T07:00:00Z"}],"contact":{"telecom":[{"type":"phone","value":"2762740095"},{"type":"email","value":"jacqueline.morgan@id.me"}]},"preferredTimesForPhoneCall":["Morning"],"preferredLocation":{"city":"Palm Bay","state":"FL"},"preferredLanguage":"English","cancellable":true,"extension":{"ccLocation":{"address":{}},"ccRequestedCancellation":false,"hsrmTaskId":"13413"},"location":{"id":"983","type":"appointments","attributes":{"id":"983","vistaSite":"983","vastParent":"983","type":"va_facilities","name":"Cheyenne VA Medical Center","classification":"VA Medical Center (VAMC)","timezone":{"timeZoneId":"America/Denver"},"lat":39.744507,"long":-104.830956,"website":"https://www.denver.va.gov/locations/directions.asp","phone":{"main":"307-778-7550","fax":"307-778-7381","pharmacy":"866-420-6337","afterHours":"307-778-7550","patientAdvocate":"307-778-7550 x7517","mentalHealthClinic":"307-778-7349","enrollmentCoordinator":"307-778-7550 x7579"},"physicalAddress":{"type":"physical","line":["2360 East Pershing Boulevard"],"city":"Cheyenne","state":"WY","postalCode":"82001-5356"},"mobile":false,"healthService":["Audiology","Cardiology","DentalServices","EmergencyCare","Gastroenterology","Gynecology","MentalHealthCare","Nutrition","Ophthalmology","Optometry","Orthopedics","Podiatry","PrimaryCare","SpecialtyCare","UrgentCare","Urology","WomensHealth"],"operatingStatus":{"code":"NORMAL"}}}}' + recorded_at: Tue, 22 Feb 2022 21:46:03 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml new file mode 100644 index 00000000000..a2aceee3340 --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_JACQUELINE_M_vpg.yml @@ -0,0 +1,64 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"clinic","status":"booked","locationId":"983","clinic":"999","slot":{"id":"3230323231313330323034353A323032323131333032313030"},"reasonCode":{"text":"testing","coding":[{"code":"Routine + Follow-up"}]},"extension":{"desiredDate":"2022-11-29T17:00:00-07:00"},"patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - 6abdafd2-d7e8-40e2-9485-aeadad4fde5f + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 20 Oct 2022 22:21:59 GMT + Content-Type: + - application/json + Content-Length: + - '616' + Server: + - openresty + X-Vamf-Version: + - 1.23.1 + B3: + - 9386e780c6e24ce819013350157327bc-3637f2cce7a14a9d-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 31af686 + X-Vamf-Timestamp: + - '2022-10-20T16:55:11+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '1454' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"139064","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id","value":"999;20221130.134500"}],"kind":"clinic","status":"booked","serviceType":"optometry","serviceCategory":[{"coding":[{"system":"http://www.va.gov/Terminology/VistADefinedTerms/409_1","code":"REGULAR","display":"REGULAR"}],"text":"REGULAR"}],"reasonCode":{"text":"Routine + Follow-up: testing"},"patientIcn":"1012846043V576341","locationId":"983","clinic":"999","start":"2022-11-30T20:45:00Z","end":"2022-11-30T21:00:00Z","minutesDuration":15,"slot":{"id":"3230323231313330323034353A323032323131333032313030","start":"2022-11-30T20:45:00Z","end":"2022-11-30T21:00:00Z"},"comment":"Routine + Follow-up: testing","cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Thu, 20 Oct 2022 22:21:59 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility_vpg.yml new file mode 100644 index 00000000000..1dd245ccdaf --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_log_facility_vpg.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"clinic","status":"booked","locationId":"983","clinic":"999","slot":{"id":"3230323231313330323034353A323032323131333032313030"},"reasonCode":{"text":"testing","coding":[{"code":"Routine + Follow-up"}]},"extension":{"desiredDate":"2022-11-29T17:00:00-07:00"},"patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - 6abdafd2-d7e8-40e2-9485-aeadad4fde5f + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 20 Oct 2022 22:21:59 GMT + Content-Type: + - application/json + Content-Length: + - '616' + Server: + - openresty + X-Vamf-Version: + - 1.23.1 + B3: + - 9386e780c6e24ce819013350157327bc-3637f2cce7a14a9d-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 31af686 + X-Vamf-Timestamp: + - '2022-10-20T16:55:11+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '1454' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"139064","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id","value":"999;20221130.134500"}],"kind":"clinic","status":"booked","serviceType":"optometry","serviceCategory":[{"coding":[{"system":"http://www.va.gov/Terminology/VistADefinedTerms/409_1","code":"REGULAR","display":"REGULAR"}],"text":"REGULAR"}],"reasonCode":{"text":"PAP COMPLIANCE/TELE"},"patientIcn":"1012846043V576341","locationId":"983","clinic":"999","start":"2022-11-30T20:45:00Z","end":"2022-11-30T21:00:00Z","minutesDuration":15,"slot":{"id":"3230323231313330323034353A323032323131333032313030","start":"2022-11-30T20:45:00Z","end":"2022-11-30T21:00:00Z"},"comment":"PAP COMPLIANCE/TELE PID","cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Thu, 20 Oct 2022 22:21:59 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data_vpg.yml new file mode 100644 index 00000000000..05edca11a2a --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_booked_200_and_logs_data_vpg.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"clinic","status":"booked","locationId":"983","clinic":"999","slot":{"id":"3230323231313330323034353A323032323131333032313030"},"reasonCode":{"text":"testing","coding":[{"code":"Routine + Follow-up"}]},"extension":{"desiredDate":"2022-11-29T17:00:00-07:00"},"patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - 6abdafd2-d7e8-40e2-9485-aeadad4fde5f + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 20 Oct 2022 22:21:59 GMT + Content-Type: + - application/json + Content-Length: + - '616' + Server: + - openresty + X-Vamf-Version: + - 1.23.1 + B3: + - 9386e780c6e24ce819013350157327bc-3637f2cce7a14a9d-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 31af686 + X-Vamf-Timestamp: + - '2022-10-20T16:55:11+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '1454' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"139064","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id","value":"999;20221130.134500"}],"kind":"clinic","status":"booked","serviceType":"optometry","serviceTypes":[{"coding":[{"system":"http://veteran.apps.va.gov/terminologies/fhir/CodeSystem/vats-service-type","code":"optometry"}]}],"serviceCategory":[{"coding":[{"system":"http://www.va.gov/Terminology/VistADefinedTerms/409_1","code":"REGULAR","display":"REGULAR"}],"text":"REGULAR"}],"reasonCode":{"text":"Routine Follow-up: testing"},"patientIcn":"1012846043V576341","locationId":"983","clinic":"999","start":"2022-11-30T20:45:00Z","end":"2022-11-30T21:00:00Z","minutesDuration":15,"slot":{"id":"3230323231313330323034353A323032323131333032313030","start":"2022-11-30T20:45:00Z","end":"2022-11-30T21:00:00Z"},"comment":"Routine Follow-up: testing","cancellable":true, "telehealth":{"url":"https://pexip.mapsandbox.net/vvc-app/?join=1&media=1&escalate=1&conference=VAC000420576@pexip.mapsandbox.net&pin=955191&aid=d9824ec6-1cd2-4875-b8d1-1775c4322572#","atlas":{"siteCode":"VFW-VA-20151-05","confirmationCode":"788926","address":{"streetAddress":"14850 Conference Center Dr","city":"Chantilly","state":"VA","zipCode":"20151","country":"USA","latitutde":38.87426,"longitude":-77.46,"additionalDetails":""}},"group":false,"vvsKind":"ADHOC"}, "extension":{"ccLocation":{"address":{}}}}' + recorded_at: Thu, 20 Oct 2022 22:21:59 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_proposed_clinic_200_vpg.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_proposed_clinic_200_vpg.yml new file mode 100644 index 00000000000..b9c8489af1c --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/post_appointments_va_proposed_clinic_200_vpg.yml @@ -0,0 +1,62 @@ +--- +http_interactions: +- request: + method: post + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments + body: + encoding: UTF-8 + string: '{"kind":"clinic","status":"proposed","locationId":"983","contact":{"telecom":[{"type":"phone","value":"2125688889"},{"type":"email","value":"judymorisooooooooooooon@gmail.com"}]},"serviceType":"audiology","requestedPeriods":[{"end":null,"2022-01-04T11:59:00Z":null},{"start":null,"2022-01-04T00:00:00Z":null}],"reasonCode":{"codeing":[{"code":"Routine + Follow-up"}],"text":"text"},"comment":"Follow-up/Routine: testing","patientIcn":"1012846043V576341"}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Referer: + - https://review-instance.va.gov + X-Vamf-Jwt: + - stubbed_token + X-Request-Id: + - '' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 14 Dec 2021 23:30:04 GMT + Content-Type: + - application/json + Content-Length: + - '522' + Server: + - openresty + X-Vamf-Version: + - 1.14.1 + B3: + - b7e8fa4c5ccbed081a8afd6fe5bc0a4f-cb586bfe1c6c819a-0 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 20a82ca + X-Vamf-Timestamp: + - '2021-11-26T16:29:10+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + X-Envoy-Upstream-Service-Time: + - '10356' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"70065","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/ars/id","value":"8a4890c47da65e2b017dbb481aeb0001"}],"kind":"clinic","status":"proposed","serviceType":"audiology","reasonCode":{"text":"text"},"patientIcn":"1012846043V576341","locationId":"983","created":"2021-12-14T16:30:04Z","contact":{"telecom":[{"type":"email","value":"judymorisooooooooooooon@gmail.com"},{"type":"phone","value":"2125688889"}]},"cancellationReason":{"code":"other"},"cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Tue, 14 Dec 2021 23:30:04 GMT +recorded_with: VCR 6.0.0