diff --git a/.dockerignore b/.dockerignore index 0b97c48ee73..1ec28ef5cff 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,10 @@ +.bundle .git -coverage/ -data/ -log/* -tmp/ \ No newline at end of file +.github +.gitignore +.rspec +coverage +data +docs +log +tmp diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 8e47c8087c2..576d34c954e 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -12,8 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - # Lock back to an @v1-version once https://github.com/ruby/setup-ruby/pull/491 is merged - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 with: bundler-cache: true diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1b9636c7ce8..e4f874f8bf8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 100` -# on 2024-02-14 16:07:35 UTC using RuboCop version 1.60.2. +# on 2024-03-04 22:34:21 UTC using RuboCop version 1.61.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -83,7 +83,7 @@ FactoryBot/ConsistentParenthesesStyle: - 'spec/sidekiq/form1095/new1095_bs_job_spec.rb' - 'spec/sidekiq/vre/create_ch31_submissions_report_job_spec.rb' -# Offense count: 489 +# Offense count: 504 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. # Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb @@ -140,7 +140,7 @@ Layout/LineContinuationSpacing: - 'spec/sidekiq/cypress_viewport_updater/viewport_preset_js_file_spec.rb' - 'spec/support/saml/response_builder.rb' -# Offense count: 45 +# Offense count: 40 # This cop supports safe autocorrection (--autocorrect). Lint/AmbiguousOperatorPrecedence: Exclude: @@ -228,7 +228,7 @@ Lint/ConstantDefinitionInBlock: - 'spec/uploaders/uploader_virus_scan_spec.rb' - 'spec/uploaders/validate_pdf_spec.rb' -# Offense count: 7 +# Offense count: 5 # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. Lint/DuplicateBranch: Exclude: @@ -249,7 +249,7 @@ Lint/DuplicateRegexpCharacterClassElement: Exclude: - 'modules/check_in/lib/check_in/utils/logger.rb' -# Offense count: 91 +# Offense count: 88 # Configuration parameters: AllowedParentClasses. Lint/MissingSuper: Exclude: @@ -465,7 +465,7 @@ Lint/UselessRescue: - 'app/controllers/v0/contact_us/inquiries_controller.rb' - 'lib/lgy/service.rb' -# Offense count: 888 +# Offense count: 901 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 90 @@ -476,17 +476,17 @@ Metrics/AbcSize: Metrics/BlockLength: Max: 62 -# Offense count: 188 +# Offense count: 192 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 29 -# Offense count: 128 +# Offense count: 132 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 29 -# Offense count: 265 +# Offense count: 266 Naming/AccessorMethodName: Enabled: false @@ -581,7 +581,7 @@ Naming/VariableNumber: - 'spec/sidekiq/facilities/state_cemetery_reload_job_spec.rb' - 'spec/sidekiq/form1010cg/delete_old_uploads_job_spec.rb' -# Offense count: 905 +# Offense count: 919 # This cop supports unsafe autocorrection (--autocorrect-all). RSpec/BeEq: Enabled: false @@ -649,7 +649,7 @@ RSpec/ClassCheck: - 'spec/lib/iam_ssoe_oauth/session_manager_spec.rb' - 'spec/requests/v1/facilities/va_request_spec.rb' -# Offense count: 64 +# Offense count: 67 # This cop supports safe autocorrection (--autocorrect). RSpec/ExcessiveDocstringSpacing: Exclude: @@ -688,7 +688,7 @@ RSpec/ExcessiveDocstringSpacing: - 'spec/requests/upload_supporting_evidence_request_spec.rb' - 'spec/sidekiq/vre/create_ch31_submissions_report_job_spec.rb' -# Offense count: 66 +# Offense count: 65 # Configuration parameters: AllowedPatterns. # AllowedPatterns: ^expect_, ^assert_ RSpec/NoExpectationExample: @@ -748,8 +748,10 @@ RSpec/PendingWithoutReason: - 'spec/requests/breakers_integration_spec.rb' - 'spec/sidekiq/facilities/mental_health_reload_job_spec.rb' -# Offense count: 603 +# Offense count: 630 # This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ResponseMethods. +# ResponseMethods: response, last_response RSpec/Rails/HaveHttpStatus: Exclude: - 'modules/appeals_api/spec/controllers/application_controller_spec.rb' @@ -814,6 +816,7 @@ RSpec/Rails/HaveHttpStatus: - 'spec/controllers/v0/profile/valid_va_file_numbers_controller_spec.rb' - 'spec/controllers/v0/veteran_readiness_employment_claims_controller_spec.rb' - 'spec/lib/vetext/service_spec.rb' + - 'spec/middleware/rack/attack_spec.rb' - 'spec/requests/burial_claims_spec.rb' - 'spec/requests/claim_documents_spec.rb' - 'spec/requests/csrf_request_spec.rb' @@ -833,13 +836,13 @@ RSpec/Rails/HaveHttpStatus: - 'spec/support/controller_spec_helper.rb' - 'spec/support/shared_examples_for_mhv.rb' -# Offense count: 259 +# Offense count: 264 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Inferences. RSpec/Rails/InferredSpecType: Enabled: false -# Offense count: 27 +# Offense count: 26 # This cop supports safe autocorrection (--autocorrect). RSpec/SortMetadata: Exclude: @@ -870,7 +873,7 @@ RSpec/SortMetadata: - 'spec/sidekiq/education_form/process10203_submissions_spec.rb' - 'spec/sidekiq/education_form/send_school_certifying_officials_email_spec.rb' -# Offense count: 650 +# Offense count: 647 RSpec/StubbedMock: Enabled: false @@ -903,7 +906,7 @@ RSpec/SubjectDeclaration: - 'spec/sidekiq/sidekiq_alive/cleanup_queues_spec.rb' - 'spec/uploaders/form1010cg/poa_uploader_spec.rb' -# Offense count: 123 +# Offense count: 116 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: constant, string @@ -1071,10 +1074,9 @@ Rails/FilePath: - 'modules/dhp_connected_devices/app/services/token_storage_service.rb' - 'spec/sidekiq/evss/document_upload_spec.rb' -# Offense count: 15 +# Offense count: 14 Rails/I18nLocaleTexts: Exclude: - - 'app/mailers/failed_claims_report_mailer.rb' - 'app/mailers/veteran_readiness_employment_mailer.rb' - 'app/models/async_transaction/base.rb' - 'app/models/message.rb' @@ -1237,14 +1239,13 @@ Style/FileRead: - 'modules/vba_documents/spec/sidekiq/upload_processor_spec.rb' - 'spec/lib/hca/service_spec.rb' -# Offense count: 12 +# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). Style/FileWrite: Exclude: - 'lib/common/file_helpers.rb' - 'lib/sftp_writer/local.rb' - 'modules/claims_api/app/models/claims_api/power_of_attorney.rb' - - 'modules/claims_api/lib/claims_api/v1/poa_pdf_constructor/signature.rb' - 'modules/dhp_connected_devices/app/services/token_storage_service.rb' - 'modules/mobile/app/services/mobile/v0/claims/proxy.rb' - 'rakelib/mockdata_synchronize.rake' @@ -1292,7 +1293,7 @@ Style/NegatedIfElseCondition: - 'modules/dhp_connected_devices/app/serializers/device_serializer.rb' - 'modules/vaos/app/controllers/vaos/v2/appointments_controller.rb' -# Offense count: 368 +# Offense count: 367 Style/OpenStructUse: Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index 54d959d94ee..dce003a31fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,10 +73,10 @@ GIT GIT remote: https://github.com/department-of-veterans-affairs/vets-json-schema - revision: 59bbc8ad75bbb8798fe099ce179d35ad312068a6 + revision: 6941836945d2c45390c96c03e2c0de9e31ece3a5 branch: master specs: - vets_json_schema (20.39.1) + vets_json_schema (21.0.0) multi_json (~> 1.0) script_utils (= 0.0.4) @@ -561,7 +561,9 @@ GEM json (2.7.1-java) json-schema (4.1.1) addressable (>= 2.8) - json_schemer (2.1.1) + json_schemer (2.2.0) + base64 + bigdecimal hana (~> 1.3) regexp_parser (~> 2.0) simpleidn (~> 0.2) @@ -677,7 +679,7 @@ GEM activerecord (>= 6.1) request_store (~> 1.4) parallel (1.24.0) - parallel_tests (4.5.1) + parallel_tests (4.5.2) parallel parser (3.3.0.5) ast (~> 2.4.1) @@ -697,7 +699,7 @@ GEM hashery (~> 2.0) ruby-rc4 ttfunk - pg (1.5.5) + pg (1.5.6) pg_query (5.1.0) google-protobuf (>= 3.22.3) pg_search (2.3.6) @@ -713,7 +715,6 @@ GEM prawn-table prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - prism (0.24.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -737,7 +738,7 @@ GEM rack (2.2.8.1) rack-attack (6.7.0) rack (>= 1.0, < 4) - rack-cors (2.0.1) + rack-cors (2.0.2) rack (>= 2.0.0) rack-protection (3.2.0) base64 (>= 0.1.0) @@ -870,20 +871,19 @@ GEM rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.0) + rubocop-ast (1.31.1) parser (>= 3.3.0.4) - prism (>= 0.24.0) rubocop-capybara (2.20.0) rubocop (~> 1.41) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) rubocop-junit-formatter (0.1.4) - rubocop-rails (2.23.1) + rubocop-rails (2.24.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rspec (2.26.1) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (2.27.1) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) diff --git a/README.md b/README.md index 9712f19710e..e7e32aec615 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,6 @@ This project provides common APIs for applications that live on VA.gov (formerly [API Docs](https://department-of-veterans-affairs.github.io/va-digital-services-platform-docs/api-reference/#/) - - For frontend, see [vets-website](https://github.com/department-of-veterans-affairs/vets-website) and [vets-content](https://github.com/department-of-veterans-affairs/vagov-content) repos. ## Base setup diff --git a/app/controllers/v0/rated_disabilities_controller.rb b/app/controllers/v0/rated_disabilities_controller.rb index 001d6dae8e3..61bffc8ecb6 100644 --- a/app/controllers/v0/rated_disabilities_controller.rb +++ b/app/controllers/v0/rated_disabilities_controller.rb @@ -15,17 +15,23 @@ def show remove_inactive_ratings!(response['data']['attributes']['individual_ratings']) end + # LH returns the ICN of the Veteran in the data.id field + # We want to scrub it out before sending to the FE + response['data']['id'] = '' + render json: response end private - def remove_inactive_ratings!(ratings) - ratings.select! { |rating| active?(rating) } + def active?(rating) + end_date = rating['rating_end_date'] + + end_date.nil? || Date.parse(end_date).future? end - def active?(rating) - rating['rating_end_date'].nil? + def remove_inactive_ratings!(ratings) + ratings.select! { |rating| active?(rating) } end def service diff --git a/app/controllers/v1/post911_gi_bill_statuses_controller.rb b/app/controllers/v1/post911_gi_bill_statuses_controller.rb new file mode 100644 index 00000000000..9ed42552b21 --- /dev/null +++ b/app/controllers/v1/post911_gi_bill_statuses_controller.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require 'formatters/date_formatter' +require 'lighthouse/benefits_education/outside_working_hours' +require 'lighthouse/benefits_education/service' + +module V1 + class Post911GIBillStatusesController < ApplicationController + include IgnoreNotFound + include SentryLogging + service_tag 'gibill-statement' + + before_action :service_available?, only: :show + + STATSD_GI_BILL_TOTAL_KEY = 'api.lighthouse.gi_bill_status.total' + STATSD_GI_BILL_FAIL_KEY = 'api.lighthouse.gi_bill_status.fail' + + def show + render json: service.get_gi_bill_status + rescue => e + handle_error(e) + ensure + StatsD.increment(STATSD_GI_BILL_TOTAL_KEY) + end + + private + + def handle_error(e) + status = e.errors.first[:status].to_i if e.errors&.first&.key?(:status) + log_vet_not_found(@current_user, Time.now.in_time_zone('Eastern Time (US & Canada)')) if status == 404 + StatsD.increment(STATSD_GI_BILL_FAIL_KEY, tags: ["error:#{status}"]) + render json: { error: e.errors.first }, status: status || :internal_server_error + end + + def service_available? + unless BenefitsEducation::Service.within_scheduled_uptime? + StatsD.increment(STATSD_GI_BILL_FAIL_KEY, tags: ['error:scheduled_downtime']) + headers['Retry-After'] = BenefitsEducation::Service.retry_after_time + # 503 response + raise BenefitsEducation::OutsideWorkingHours + end + end + + def log_vet_not_found(user, timestamp) + PersonalInformationLog.create( + data: { timestamp:, user: user_json(user) }, + error_class: 'BenefitsEducation::NotFound' + ) + end + + def user_json(user) + { + first_name: user.first_name, + last_name: user.last_name, + assurance_level: user.loa[:current].to_s, + birls_id: user.birls_id, + icn: user.icn, + edipi: user.edipi, + mhv_correlation_id: user.mhv_correlation_id, + participant_id: user.participant_id, + vet360_id: user.vet360_id, + ssn: user.ssn, + birth_date: Formatters::DateFormatter.format_date(user.birth_date, :datetime_iso8601) + }.to_json + end + + def skip_sentry_exception_types + super + [BenefitsEducation::OutsideWorkingHours] + end + + def service + BenefitsEducation::Service.new(@current_user&.icn) + end + end +end diff --git a/app/models/lighthouse/education_benefits/education_benefit.rb b/app/models/lighthouse/education_benefits/education_benefit.rb new file mode 100644 index 00000000000..7d395f44ba9 --- /dev/null +++ b/app/models/lighthouse/education_benefits/education_benefit.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require 'active_support/inflector' + +module Lighthouse + module EducationBenefits + # The EducationBenefit model represents a veteran's education benefit status. + # This model is used to parse and manipulate the data returned from the Lighthouse API. + # Although it includes ActiveModel::Model for some ActiveRecord-like features such as validations and conversions, + # it does not persist any data to a database. + class EducationBenefit + include ActiveModel::Model + attr_accessor :first_name, :last_name, :name_suffix, :date_of_birth, :va_file_number, :active_duty, + :veteran_is_eligible, :regional_processing_office, :eligibility_date, + :percentage_benefit, :original_entitlement, :used_entitlement, + :remaining_entitlement, :delimiting_date + attr_reader :enrollments + + def initialize(attributes = {}) + super(attributes.deep_transform_keys { |key| key.to_s.underscore }) + end + + def enrollments=(values) + @enrollments = values.map do |value| + Enrollment.new(value) + end + end + + # existing data contracts rely on eg `date_of_birth` so we must + # modify some of the field names + def date_time_of_birth=(value) + @date_of_birth = value + end + + def delimiting_date_time=(value) + @delimiting_date = value + end + + def eligibility_date_time=(value) + @eligibility_date = value + end + end + end +end diff --git a/app/models/lighthouse/education_benefits/enrollment.rb b/app/models/lighthouse/education_benefits/enrollment.rb new file mode 100644 index 00000000000..819184ade33 --- /dev/null +++ b/app/models/lighthouse/education_benefits/enrollment.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'active_support/inflector' + +module Lighthouse + module EducationBenefits + # The Enrollment class encapsulates the concept of a veteran's enrollment in an education program. + # This model is used to parse and manipulate the data returned from the Lighthouse API. + # Although it includes ActiveModel::Model for some ActiveRecord-like features such as validations and conversions, + # it does not persist any data to a database. + class Enrollment + include ActiveModel::Model + attr_accessor :begin_date, :end_date, :facility_code, :facility_name, :participant_id, + :training_type, :term_id, :hour_type, :full_time_hours, + :full_time_credit_hour_under_grad, :vacation_day_count, :on_campus_hours, + :online_hours, :yellow_ribbon_amount, :status, :amendments + + def initialize(attributes = {}) + super(attributes.deep_transform_keys { |key| key.to_s.underscore }) + end + + # existing data contracts rely on eg `begin_date` so we must + # modify some of the field names + def begin_date_time=(value) + @begin_date = value + end + + def end_date_time=(value) + @end_date = value + end + end + end +end diff --git a/config/features.yml b/config/features.yml index f1464748db1..b89340e3565 100644 --- a/config/features.yml +++ b/config/features.yml @@ -107,10 +107,6 @@ features: actor_type: user description: Enables downstream responses to be returned via betamocks enable_in_development: false - check_in_experience_patient_cell_phone: - actor_type: user - description: Enables patient cell phone rather than mobile phone - enable_in_development: true check_in_experience_phone_appointments_enabled: actor_type: user description: Enables telephone appointments for check-in @@ -791,6 +787,15 @@ features: profile_show_credential_retirement_messaging: actor_type: user description: Show/hide MHV and DS Logon credential retirement messaging in profile + profile_show_direct_deposit_single_form: + actor_type: user + description: Show/hide the single direct deposit form in profile for all users + profile_show_direct_deposit_single_form_alert: + actor_type: user + description: Show/hide an alert with information around migrating to a single direct deposit form in profile + profile_show_direct_deposit_single_form_edu_downtime: + actor_type: user + description: Show/hide the edu direct deposit form and instead display a downtime message in its place profile_show_email_notification_settings: actor_type: user description: Show/Hide the email channel based notification settings in profile diff --git a/config/locales/exceptions.en.yml b/config/locales/exceptions.en.yml index 5f9c2e7e29a..4800d5780a1 100644 --- a/config/locales/exceptions.en.yml +++ b/config/locales/exceptions.en.yml @@ -2163,13 +2163,13 @@ en: <<: *defaults code: LH_gateway_timeout status: 504 - benefits_education: - outside_working_hours: - <<: *defaults - title: External service unavailable - detail: 'Lighthouse GI Bill Status is not available outside of working hours' - code: 114 - status: 503 + benefits_education: + outside_working_hours: + <<: *defaults + title: External service unavailable + detail: 'Lighthouse GI Bill Status is not available outside of working hours' + code: 114 + status: 503 evss: external_service_unavailable: <<: *defaults diff --git a/config/routes.rb b/config/routes.rb index a08646a25bc..a07605af7fa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -438,6 +438,8 @@ end resources :notice_of_disagreements, only: %i[create show] + resource :post911_gi_bill_status, only: [:show] + namespace :supplemental_claims do get 'contestable_issues(/:benefit_type)', to: 'contestable_issues#index' end diff --git a/db/migrate/20240226235237_create_schema_contract_validations.rb b/db/migrate/20240226235237_create_schema_contract_validations.rb new file mode 100644 index 00000000000..70cc75afacf --- /dev/null +++ b/db/migrate/20240226235237_create_schema_contract_validations.rb @@ -0,0 +1,13 @@ +class CreateSchemaContractValidations < ActiveRecord::Migration[7.0] + def change + create_table :schema_contract_validations do |t| + t.string :contract_name, null: false + t.string :user_uuid, null: false + t.jsonb :response, null: false + t.integer :status, null: false + t.string :error_details + + t.timestamps + end + end +end diff --git a/db/migrate/20240229150823_add_state_to_form_526_submissions.rb b/db/migrate/20240229150823_add_state_to_form_526_submissions.rb new file mode 100644 index 00000000000..9b06718beb6 --- /dev/null +++ b/db/migrate/20240229150823_add_state_to_form_526_submissions.rb @@ -0,0 +1,5 @@ +class AddStateToForm526Submissions < ActiveRecord::Migration[7.0] + def change + add_column :form526_submissions, :aasm_state, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 017b9f30e8e..7dbe724b523 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_02_23_183025) do +ActiveRecord::Schema[7.0].define(version: 2024_02_29_152705) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_stat_statements" @@ -603,6 +603,7 @@ t.text "encrypted_kms_key" t.uuid "user_account_id" t.string "backup_submitted_claim_id", comment: "*After* a SubmitForm526 Job has exhausted all attempts, a paper submission is generated and sent to Central Mail Portal.This column will be nil for all submissions where a backup submission is not generated.It will have the central mail id for submissions where a backup submission is submitted." + t.string "aasm_state" t.index ["saved_claim_id"], name: "index_form526_submissions_on_saved_claim_id", unique: true t.index ["submitted_claim_id"], name: "index_form526_submissions_on_submitted_claim_id", unique: true t.index ["user_account_id"], name: "index_form526_submissions_on_user_account_id" @@ -894,6 +895,16 @@ t.index ["id", "type"], name: "index_saved_claims_on_id_and_type" end + create_table "schema_contract_validations", force: :cascade do |t| + t.string "contract_name", null: false + t.string "user_uuid", null: false + t.jsonb "response", null: false + t.integer "status", null: false + t.string "error_details" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "service_account_configs", force: :cascade do |t| t.string "service_account_id", null: false t.text "description", null: false diff --git a/lib/lighthouse/benefits_education/service.rb b/lib/lighthouse/benefits_education/service.rb index 6af861e4e64..08a8a03003f 100644 --- a/lib/lighthouse/benefits_education/service.rb +++ b/lib/lighthouse/benefits_education/service.rb @@ -44,12 +44,16 @@ def inspect ## # Retrieve a veteran's Post-9/11 GI Bill Status - # @return [Faraday::Response] response from a GET request to Lighthouse API: - # A veteran's GI Bill status + # @return [String] A JSON string representing the veteran's GI Bill status. def get_gi_bill_status - config.get(@icn) - rescue => e - handle_error(e, config.service_name, config.base_api_path) + response = begin + config.get(@icn) + rescue => e + handle_error(e, config.service_name, config.base_api_path) + end + + education_info = response.body&.[]('chapter33EducationInfo') || {} + Lighthouse::EducationBenefits::EducationBenefit.new(education_info).to_json end def handle_error(error, lighthouse_client_id, endpoint) diff --git a/lib/medical_records/client.rb b/lib/medical_records/client.rb index 717b3a9fab9..aa380239bf1 100644 --- a/lib/medical_records/client.rb +++ b/lib/medical_records/client.rb @@ -89,7 +89,8 @@ def get_patient_by_identifier(fhir_client, identifier) def list_allergies bundle = fhir_search(FHIR::AllergyIntolerance, { - search: { parameters: { patient: patient_fhir_id, 'clinical-status': 'active' } }, + search: { parameters: { patient: patient_fhir_id, 'clinical-status': 'active', + 'verification-status:not': 'entered-in-error' } }, headers: { 'Cache-Control': 'no-cache' } }) sort_bundle(bundle, :recordedDate, :desc) @@ -102,7 +103,7 @@ def get_allergy(allergy_id) def list_vaccines bundle = fhir_search(FHIR::Immunization, { - search: { parameters: { patient: patient_fhir_id } }, + search: { parameters: { patient: patient_fhir_id, 'status:not': 'entered-in-error' } }, headers: { 'Cache-Control': 'no-cache' } }) sort_bundle(bundle, :occurrenceDateTime, :desc) @@ -114,24 +115,31 @@ def get_vaccine(vaccine_id) def list_vitals loinc_codes = "#{BLOOD_PRESSURE},#{BREATHING_RATE},#{HEART_RATE},#{HEIGHT},#{TEMPERATURE},#{WEIGHT}" - bundle = fhir_search(FHIR::Observation, search: { parameters: { patient: patient_fhir_id, code: loinc_codes } }) + bundle = fhir_search(FHIR::Observation, + search: { parameters: { patient: patient_fhir_id, code: loinc_codes, + 'status:not': 'entered-in-error' } }) sort_bundle(bundle, :effectiveDateTime, :desc) end def list_conditions - bundle = fhir_search(FHIR::Condition, search: { parameters: { patient: patient_fhir_id } }) + bundle = fhir_search(FHIR::Condition, + search: { parameters: { patient: patient_fhir_id, + 'verification-status:not': 'entered-in-error' } }) sort_bundle(bundle, :recordedDate, :desc) end def get_condition(condition_id) - fhir_search(FHIR::Condition, search: { parameters: { _id: condition_id, _include: '*' } }) + fhir_search(FHIR::Condition, + search: { parameters: { _id: condition_id, _include: '*', + 'verification-status:not': 'entered-in-error' } }) end def list_clinical_notes loinc_codes = "#{PHYSICIAN_PROCEDURE_NOTE},#{DISCHARGE_SUMMARY},#{CONSULT_RESULT}" bundle = fhir_search(FHIR::DocumentReference, { - search: { parameters: { patient: patient_fhir_id, type: loinc_codes } }, + search: { parameters: { patient: patient_fhir_id, type: loinc_codes, + 'status:not': 'entered-in-error' } }, headers: { 'Cache-Control': 'no-cache' } }) @@ -157,7 +165,8 @@ def get_clinical_note(note_id) end def get_diagnostic_report(record_id) - fhir_search(FHIR::DiagnosticReport, search: { parameters: { _id: record_id, _include: '*' } }) + fhir_search(FHIR::DiagnosticReport, + search: { parameters: { _id: record_id, _include: '*', 'status:not': 'entered-in-error' } }) end ## @@ -214,7 +223,8 @@ def list_labs_and_tests(page_size = 999, page_num = 1) # def list_labs_chemhem_diagnostic_report fhir_search(FHIR::DiagnosticReport, - search: { parameters: { patient: patient_fhir_id, category: 'LAB' } }) + search: { parameters: { patient: patient_fhir_id, category: 'LAB', + 'status:not': 'entered-in-error' } }) end ## @@ -225,7 +235,9 @@ def list_labs_chemhem_diagnostic_report # def list_labs_other_diagnostic_report loinc_codes = "#{MICROBIOLOGY},#{PATHOLOGY}" - fhir_search(FHIR::DiagnosticReport, search: { parameters: { patient: patient_fhir_id, code: loinc_codes } }) + fhir_search(FHIR::DiagnosticReport, + search: { parameters: { patient: patient_fhir_id, code: loinc_codes, + 'status:not': 'entered-in-error' } }) end ## @@ -237,7 +249,8 @@ def list_labs_other_diagnostic_report def list_labs_document_reference loinc_codes = "#{EKG},#{RADIOLOGY}" fhir_search(FHIR::DocumentReference, - search: { parameters: { patient: patient_fhir_id, type: loinc_codes } }) + search: { parameters: { patient: patient_fhir_id, type: loinc_codes, + 'status:not': 'entered-in-error' } }) end ## diff --git a/modules/ask_va_api/app/lib/ask_va_api/attachments/entity.rb b/modules/ask_va_api/app/lib/ask_va_api/attachments/entity.rb index 3c0f602ec52..fff41f5d413 100644 --- a/modules/ask_va_api/app/lib/ask_va_api/attachments/entity.rb +++ b/modules/ask_va_api/app/lib/ask_va_api/attachments/entity.rb @@ -8,9 +8,9 @@ class Entity :file_name def initialize(info) - @id = info[:id] - @file_content = info[:fileContent] - @file_name = info[:fileName] + @id = info[:Id] + @file_content = info[:FileContent] + @file_name = info[:FileName] end end end diff --git a/modules/ask_va_api/app/lib/ask_va_api/attachments/retriever.rb b/modules/ask_va_api/app/lib/ask_va_api/attachments/retriever.rb index 386107c1b8d..a2ab5729a37 100644 --- a/modules/ask_va_api/app/lib/ask_va_api/attachments/retriever.rb +++ b/modules/ask_va_api/app/lib/ask_va_api/attachments/retriever.rb @@ -2,7 +2,7 @@ module AskVAApi module Attachments - ENDPOINT = 'get_attachments_mock_data' + ENDPOINT = 'attachment' class Retriever attr_reader :id, :service @@ -15,10 +15,9 @@ def initialize(id:, service: nil) def call validate_input(id, "Invalid Attachment's ID") - attachments = fetch_data(payload: { id: }) - attachments.map do |att| - Entity.new(att) - end.first + attachment = fetch_data(payload: { id: }) + + Entity.new(attachment) rescue => e ErrorHandler.handle_service_error(e) end @@ -30,7 +29,7 @@ def default_service end def fetch_data(payload: {}) - service.call(endpoint: ENDPOINT, payload:) + service.call(endpoint: ENDPOINT, payload:)[:Data] end def validate_input(input, error_message) diff --git a/modules/ask_va_api/app/lib/ask_va_api/correspondences/entity.rb b/modules/ask_va_api/app/lib/ask_va_api/correspondences/entity.rb index 214a36743c5..e8bb5a001e6 100644 --- a/modules/ask_va_api/app/lib/ask_va_api/correspondences/entity.rb +++ b/modules/ask_va_api/app/lib/ask_va_api/correspondences/entity.rb @@ -13,14 +13,14 @@ class Entity :attachments def initialize(info) - @id = info[:id] - @inquiry_id = info[:inquiryId] - @message_type = info[:message_type] - @modified_on = info[:modifiedon] - @status_reason = info[:status_reason] - @description = info[:description] - @enable_reply = info[:enable_reply] - @attachments = info[:attachmentNames] + @id = info[:Id] + @inquiry_id = info[:InquiryId] + @message_type = info[:MessageType] + @modified_on = info[:ModifiedOn] + @status_reason = info[:StatusReason] + @description = info[:Description] + @enable_reply = info[:EnableReply] + @attachments = info[:AttachmentNames] end end end diff --git a/modules/ask_va_api/app/lib/ask_va_api/correspondences/retriever.rb b/modules/ask_va_api/app/lib/ask_va_api/correspondences/retriever.rb index c7dd97bca85..a249ca6f7ef 100644 --- a/modules/ask_va_api/app/lib/ask_va_api/correspondences/retriever.rb +++ b/modules/ask_va_api/app/lib/ask_va_api/correspondences/retriever.rb @@ -2,7 +2,7 @@ module AskVAApi module Correspondences - ENDPOINT = 'get_replies_mock_data' + ENDPOINT = 'replies' class Retriever attr_reader :inquiry_id, :service @@ -14,7 +14,7 @@ def initialize(inquiry_id:, service: nil) def call validate_input(inquiry_id, 'Invalid Inquiry ID') - fetch_data(payload: { inquiry_id: }).map do |cor| + fetch_data(payload: { InquiryId: inquiry_id }).map do |cor| Entity.new(cor) end rescue => e @@ -28,7 +28,7 @@ def default_service end def fetch_data(payload: {}) - service.call(endpoint: ENDPOINT, payload:) + service.call(endpoint: ENDPOINT, payload:)[:Data] end def validate_input(input, error_message) diff --git a/modules/ask_va_api/app/lib/ask_va_api/inquiries/entity.rb b/modules/ask_va_api/app/lib/ask_va_api/inquiries/entity.rb index 927a8838751..50e32c6677c 100644 --- a/modules/ask_va_api/app/lib/ask_va_api/inquiries/entity.rb +++ b/modules/ask_va_api/app/lib/ask_va_api/inquiries/entity.rb @@ -18,19 +18,19 @@ class Entity :veteran_relationship def initialize(info, correspondences = nil) - @id = info[:id] - @inquiry_number = info[:inquiryNumber] - @attachments = info[:attachmentNames] + @id = info[:Id] + @inquiry_number = info[:InquiryNumber] + @attachments = info[:AttachmentNames] @correspondences = correspondences - @has_attachments = info[:inquiryHasAttachments] - @has_been_split = info[:inquiryHasBeenSplit] - @level_of_authentication = info[:inquiryLevelOfAuthentication] - @last_update = info[:lastUpdate] - @status = info[:inquiryStatus] - @school_facility_code = info[:schoolFacilityCode] - @submitter_question = info[:submitterQuestion] - @topic = info[:inquiryTopic] - @veteran_relationship = info[:veteranRelationship] + @has_attachments = info[:InquiryHasAttachments] + @has_been_split = info[:InquiryHasBeenSplit] + @level_of_authentication = info[:InquiryLevelOfAuthentication] + @last_update = info[:LastUpdate] + @status = info[:InquiryStatus] + @school_facility_code = info[:SchoolFacilityCode] + @submitter_question = info[:SubmitterQuestion] + @topic = info[:InquiryTopic] + @veteran_relationship = info[:VeteranRelationship] end end end diff --git a/modules/ask_va_api/app/lib/ask_va_api/inquiries/retriever.rb b/modules/ask_va_api/app/lib/ask_va_api/inquiries/retriever.rb index 26c26c9d9fa..cd1fcad5907 100644 --- a/modules/ask_va_api/app/lib/ask_va_api/inquiries/retriever.rb +++ b/modules/ask_va_api/app/lib/ask_va_api/inquiries/retriever.rb @@ -2,7 +2,7 @@ module AskVAApi module Inquiries - ENDPOINT = 'get_inquiries_mock_data' + ENDPOINT = 'inquiries' class Retriever attr_reader :service, :icn @@ -18,14 +18,19 @@ def fetch_by_id(id:) data = fetch_data(payload: { id: }) return {} if data.blank? - Entity.new(data.first, reply) + Entity.new(data, reply) rescue => e ErrorHandler.handle_service_error(e) end def fetch_by_icn validate_input(icn, 'Invalid ICN') - fetch_data(payload: { icn: }).map { |inq| Entity.new(inq) } + data = fetch_data(payload: { icn: }) + if data.empty? + data + else + data.map { |inq| Entity.new(inq) } + end rescue => e ErrorHandler.handle_service_error(e) end @@ -37,7 +42,7 @@ def default_service end def fetch_data(payload: {}) - service.call(endpoint: ENDPOINT, payload:) + service.call(endpoint: ENDPOINT, payload:)[:Data] end def validate_input(input, error_message) diff --git a/modules/ask_va_api/app/services/dynamics_mock_service.rb b/modules/ask_va_api/app/services/dynamics_mock_service.rb index b71bb789563..a43d1288721 100644 --- a/modules/ask_va_api/app/services/dynamics_mock_service.rb +++ b/modules/ask_va_api/app/services/dynamics_mock_service.rb @@ -25,31 +25,26 @@ def call(endpoint:, method: :get, payload: {}) private def file_path_for(endpoint) - "modules/ask_va_api/config/locales/#{sanitize_endpoint(endpoint)}" + "modules/ask_va_api/config/locales/get_#{endpoint}_mock_data.json" end def read_and_parse_json(file_path) - JSON.parse(File.read(file_path), symbolize_names: true)[:data] - end - - def sanitize_endpoint(endpoint) - "#{endpoint.tr('/', '_')}.json" + JSON.parse(File.read(file_path), symbolize_names: true)[:Data] end def filter_mock_data(data) return data if @payload.blank? key, value = @payload.first - key = camelize_key(key) - data.select { |item| item[key.to_sym].to_i == formatted_value(key, value).to_i } - end - - def camelize_key(key) - parts = key.to_s.split('_') - parts[0] + parts[1..].collect(&:capitalize).join + key = sanitize_key(key) + if key == 'Id' + { Data: data.find { |item| item[key.to_sym].to_i == value.to_i } } + else + { Data: data.select { |item| item[key.to_sym].to_i == value.to_i } } + end end - def formatted_value(key, value) - key.to_s.end_with?('Id') ? value.to_i : value + def sanitize_key(key) + key.to_s.gsub(/(\A.|_.)/) { ::Regexp.last_match(1).upcase }.gsub(/_/, '') end end diff --git a/modules/ask_va_api/config/locales/get_attachments_mock_data.json b/modules/ask_va_api/config/locales/get_attachment_mock_data.json similarity index 68% rename from modules/ask_va_api/config/locales/get_attachments_mock_data.json rename to modules/ask_va_api/config/locales/get_attachment_mock_data.json index 5f2816edf8e..1d76e843694 100644 --- a/modules/ask_va_api/config/locales/get_attachments_mock_data.json +++ b/modules/ask_va_api/config/locales/get_attachment_mock_data.json @@ -1,102 +1,102 @@ { - "data": [ + "Data": [ { - "id": "1", - "inquiriesId": "1", - "correspondenceId": null, - "fileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", - "fileName": "testfile.txt" + "Id": "1", + "InquiriesId": "1", + "CorrespondenceId": null, + "FileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", + "FileName": "testfile.txt" }, { - "id": "2", - "inquiriesId": "2", - "correspondenceId": null, - "fileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", - "fileName": "testfile.txt" + "Id": "2", + "InquiriesId": "2", + "CorrespondenceId": null, + "FileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", + "FileName": "testfile.txt" }, { - "id": "3", - "inquiriesId": "3", - "correspondenceId": null, - "fileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", - "fileName": "testfile.txt" + "Id": "3", + "InquiriesId": "3", + "CorrespondenceId": null, + "FileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", + "FileName": "testfile.txt" }, { - "id": "4", - "inquiriesId": "4", - "correspondenceId": null, - "fileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", - "fileName": "testfile.txt" + "Id": "4", + "InquiriesId": "4", + "CorrespondenceId": null, + "FileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", + "FileName": "testfile.txt" }, { - "id": "5", - "inquiriesId": "5", - "correspondenceId": null, - "fileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", - "fileName": "testfile.txt" + "Id": "5", + "InquiriesId": "5", + "CorrespondenceId": null, + "FileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", + "FileName": "testfile.txt" }, { - "id": "6", - "inquiriesId": "6", - "correspondenceId": null, - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "inquiry_6_attachment.pdf" + "Id": "6", + "InquiriesId": "6", + "CorrespondenceId": null, + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "inquiry_6_attachment.pdf" }, { - "id": "7", - "inquiriesId": "7", - "correspondenceId": null, - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "inquiry_7_attachment.pdf" + "Id": "7", + "InquiriesId": "7", + "CorrespondenceId": null, + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "inquiry_7_attachment.pdf" }, { - "id": "8", - "inquiriesId": "9", - "correspondenceId": null, - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "part_of_inquiry_9.pdf" + "Id": "8", + "InquiriesId": "9", + "CorrespondenceId": null, + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "part_of_inquiry_9.pdf" }, { - "id": "9", - "inquiriesId": "9", - "correspondenceId": null, - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "part_of_inquiry_9.pdf" + "Id": "9", + "InquiriesId": "9", + "CorrespondenceId": null, + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "part_of_inquiry_9.pdf" }, { - "id": "10", - "inquiriesId": "9", - "correspondenceId": null, - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "part_of_inquiry_9.pdf" + "Id": "10", + "InquiriesId": "9", + "CorrespondenceId": null, + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "part_of_inquiry_9.pdf" }, { - "id": "11", - "inquiriesId": "9", - "correspondenceId": null, - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "part_of_inquiry_9.pdf" + "Id": "11", + "InquiriesId": "9", + "CorrespondenceId": null, + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "part_of_inquiry_9.pdf" }, { - "id": "12", - "inquiriesId": null, - "correspondenceId": "1", - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "correspondence_1_attachment.pdf" + "Id": "12", + "InquiriesId": null, + "CorrespondenceId": "1", + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "correspondence_1_attachment.pdf" }, { - "id": "13", - "inquiriesId": null, - "correspondenceId": "2", - "fileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", - "fileName": "correspondence_2_attachment.pdf" + "Id": "13", + "InquiriesId": null, + "CorrespondenceId": "2", + "FileContent": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovUmVzb3VyY2VzIDw8Ci9Qcm9jU2V0IFsvUERGIC9UZXh0XQo+PgovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCA0NAo+PgpzdHJlYW0KQlQKL0YxIDI0IFRmCjEwMCA3MDAgVGQKKEhlbGxvLCB0aGlzIGlzIGEgdGVzdCBQREYgZmlsZSBmb3IgZG93bmxvYWRpbmchKSBUagpFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZgowMDAwMDAwMDEwIDAwMDAwIG4KMDAwMDAwMDA3OSAwMDAwMCBuCjAwMDAwMDAxNzMgMDAwMDAgbgowMDAwMDAwNDU3IDAwMDAwIG4KdHJhaWxlcgo8PAovU2l6ZSA1Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgo1NjYKJSVFT0Y=", + "FileName": "correspondence_2_attachment.pdf" }, { - "id": "14", - "inquiriesId":" 9", - "correspondenceId": null, - "fileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", - "fileName": "txt_file_for_inquiry_9.txt" + "Id": "14", + "InquiriesId":" 9", + "CorrespondenceId": null, + "FileContent": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==", + "FileName": "txt_file_for_inquiry_9.txt" } ] } diff --git a/modules/ask_va_api/config/locales/get_inquiries_mock_data.json b/modules/ask_va_api/config/locales/get_inquiries_mock_data.json index 1c57a9e0993..dc132a7a4d8 100644 --- a/modules/ask_va_api/config/locales/get_inquiries_mock_data.json +++ b/modules/ask_va_api/config/locales/get_inquiries_mock_data.json @@ -1,177 +1,177 @@ { - "data": [ + "Data": [ { - "icn": "1008709396V637156", - "id": "1", - "inquiryNumber": "A-1", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is my status?", - "lastUpdate": "12/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "Status of a pending claim", - "inquiryLevelOfAuthentication": "Personal", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "1", + "InquiryNumber": "A-1", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is my status?", + "LastUpdate": "12/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "Status of a pending claim", + "InquiryLevelOfAuthentication": "Personal", + "AttachmentNames": [ { - "id": "1", - "name": "testfile.txt" + "Id": "1", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "2", - "inquiryNumber": "A-2", - "inquiryStatus": "In Progress", - "submitterQuestion": "How do I update my address?", - "lastUpdate": "1/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Personal", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "2", + "InquiryNumber": "A-2", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "How do I update my address?", + "LastUpdate": "1/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Personal", + "AttachmentNames": [ { - "id": "2", - "name": "testfile.txt" + "Id": "2", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "3", - "inquiryNumber": "A-3", - "inquiryStatus": "In Progress", - "submitterQuestion": "How do I change my caretaker?", - "lastUpdate": "2/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Personal", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "3", + "InquiryNumber": "A-3", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "How do I change my caretaker?", + "LastUpdate": "2/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Personal", + "AttachmentNames": [ { - "id": "3", - "name": "testfile.txt" + "Id": "3", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "4", - "inquiryNumber": "A-4", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is compensation?", - "lastUpdate": "3/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Personal", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "4", + "InquiryNumber": "A-4", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is compensation?", + "LastUpdate": "3/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Personal", + "AttachmentNames": [ { - "id": "4", - "name": "testfile.txt" + "Id": "4", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "5", - "inquiryNumber": "A-5", - "inquiryStatus": "In Progress", - "submitterQuestion": "How do I find more information about my compensation?", - "lastUpdate": "4/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Personal", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "5", + "InquiryNumber": "A-5", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "How do I find more information about my compensation?", + "LastUpdate": "4/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Personal", + "AttachmentNames": [ { - "id": "5", - "name": "testfile.txt" + "Id": "5", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "6", - "inquiryNumber": "A-6", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is the status of my pending claim?", - "lastUpdate": "5/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Personal", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "6", + "InquiryNumber": "A-6", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is the status of my pending claim?", + "LastUpdate": "5/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Personal", + "AttachmentNames": [ { - "id": "6", - "name": "testfile.txt" + "Id": "6", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "7", - "inquiryNumber": "A-7", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is the status of my pending claim?", - "lastUpdate": "6/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "7", + "InquiryNumber": "A-7", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is the status of my pending claim?", + "LastUpdate": "6/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [ { - "id": "7", - "name": "testfile.txt" + "Id": "7", + "Name": "testfile.txt" } ] }, { - "icn": "1008709396V637156", - "id": "8", - "inquiryNumber": "A-8", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is the status of my claim?", - "lastUpdate": "7/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "8", + "InquiryNumber": "A-8", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is the status of my claim?", + "LastUpdate": "7/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "9", - "inquiryNumber": "A-9", - "inquiryStatus": "In Progress", - "submitterQuestion": "I am inquiring about the current status of my claim, specifically regarding its processing stage, any outstanding requirements, and the estimated timeline for completion. Could you please provide a detailed update?", - "lastUpdate": "8/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [ + "Icn": "1008709396V637156", + "Id": "9", + "InquiryNumber": "A-9", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "I am inquiring about the current status of my claim, specifically regarding its processing stage, any outstanding requirements, and the estimated timeline for completion. Could you please provide a detailed update?", + "LastUpdate": "8/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [ { - "id": "8", - "name": "part_of_inquiry_9.pdf" + "Id": "8", + "Name": "part_of_inquiry_9.pdf" }, { "id": "9", @@ -192,139 +192,139 @@ ] }, { - "icn": "1008709396V637156", - "id": "10", - "inquiryNumber": "A-10", - "inquiryStatus": "In Progress", - "submitterQuestion": "I am currently exploring options to increase my compensation and would greatly appreciate detailed guidance on the process. Could you please provide the necessary steps, required documentation, and any pertinent deadlines or criteria for eligibility?", - "lastUpdate": "9/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "10", + "InquiryNumber": "A-10", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "I am currently exploring options to increase my compensation and would greatly appreciate detailed guidance on the process. Could you please provide the necessary steps, required documentation, and any pertinent deadlines or criteria for eligibility?", + "LastUpdate": "9/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "11", - "inquiryNumber": "A-11", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is the process for vets to plan for the National Cemetery?", - "lastUpdate": "10/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "11", + "InquiryNumber": "A-11", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is the process for vets to plan for the National Cemetery?", + "LastUpdate": "10/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "12", - "inquiryNumber": "A-12", - "inquiryStatus": "In Progress", - "submitterQuestion": "Where can depends find more info on Burial Benefits?", - "lastUpdate": "10/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "12", + "InquiryNumber": "A-12", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "Where can depends find more info on Burial Benefits?", + "LastUpdate": "10/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "13", - "inquiryNumber": "A-13", - "inquiryStatus": "In Progress", - "submitterQuestion": "What is the process for a vet to transfer their benefits to their dependents?", - "lastUpdate": "10/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "13", + "InquiryNumber": "A-13", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "What is the process for a vet to transfer their benefits to their dependents?", + "LastUpdate": "10/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "14", - "inquiryNumber": "A-14", - "inquiryStatus": "In Progress", - "submitterQuestion": "Where can I find more informoation on Education Debt?", - "lastUpdate": "10/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "14", + "InquiryNumber": "A-14", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "Where can I find more informoation on Education Debt?", + "LastUpdate": "10/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "15", - "inquiryNumber": "A-15", - "inquiryStatus": "In Progress", - "submitterQuestion": "Where can I find more informoation on Education Debt?", - "lastUpdate": "11/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "15", + "InquiryNumber": "A-15", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "Where can I find more informoation on Education Debt?", + "LastUpdate": "11/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "16", - "inquiryNumber": "A-16", - "inquiryStatus": "In Progress", - "submitterQuestion": "We have a major breakout! What do we do?", - "lastUpdate": "11/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "16", + "InquiryNumber": "A-16", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "We have a major breakout! What do we do?", + "LastUpdate": "11/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "17", - "inquiryNumber": "A-17", - "inquiryStatus": "In Progress", - "submitterQuestion": "We have a major breakout! What do we do?", - "lastUpdate": "11/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "17", + "InquiryNumber": "A-17", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "We have a major breakout! What do we do?", + "LastUpdate": "11/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] }, { - "icn": "1008709396V637156", - "id": "18", - "inquiryNumber": "A-18", - "inquiryStatus": "In Progress", - "submitterQuestion": "Is it possible to do the 'wave' across America?", - "lastUpdate": "11/20/23", - "inquiryHasAttachments": true, - "inquiryHasBeenSplit": true, - "veteranRelationship": "self", - "schoolFacilityCode": "0123", - "inquiryTopic": "All other Questions", - "inquiryLevelOfAuthentication": "Business", - "attachmentNames": [] + "Icn": "1008709396V637156", + "Id": "18", + "InquiryNumber": "A-18", + "InquiryStatus": "In Progress", + "SubmitterQuestion": "Is it possible to do the 'wave' across America?", + "LastUpdate": "11/20/23", + "InquiryHasAttachments": true, + "InquiryHasBeenSplit": true, + "VeteranRelationship": "self", + "SchoolFacilityCode": "0123", + "InquiryTopic": "All other Questions", + "InquiryLevelOfAuthentication": "Business", + "AttachmentNames": [] } ] } diff --git a/modules/ask_va_api/config/locales/get_replies_mock_data.json b/modules/ask_va_api/config/locales/get_replies_mock_data.json index b9d9a3cf03b..36ae486909e 100644 --- a/modules/ask_va_api/config/locales/get_replies_mock_data.json +++ b/modules/ask_va_api/config/locales/get_replies_mock_data.json @@ -1,124 +1,124 @@ { - "data": [ + "Data": [ { - "inquiryId": "1", - "id": "1", - "modifiedon": "1/2/23", - "status_reason": "Completed/Sent", - "description": "Your claim is still In Progress", - "message_type": "722310001: Response from VA", - "enable_reply": true, - "attachmentNames": [ + "InquiryId": "1", + "Id": "1", + "ModifiedOn": "1/2/23", + "StatusReason": "Completed/Sent", + "Description": "Your claim is still In Progress", + "MessageType": "722310001: Response from VA", + "EnableReply": true, + "AttachmentNames": [ { - "id": "12", - "name": "correspondence_1_attachment.pdf" + "Id": "12", + "Name": "correspondence_1_attachment.pdf" } ] }, { - "inquiryId": "2", - "id": "2", - "modifiedon": "1/21/23", - "status_reason": "Completed/Sent", - "description": "You can yours our website in your profile or call us.", - "message_type": "722310001: Response from VA", - "enable_reply": true, - "attachmentNames": [ + "InquiryId": "2", + "Id": "2", + "ModifiedOn": "1/21/23", + "StatusReason": "Completed/Sent", + "Description": "You can yours our website in your profile or call us.", + "Message_type": "722310001: Response from VA", + "Enable_reply": true, + "AttachmentNames": [ { - "id": "13", - "name": "correspondence_2_attachment.pdf" + "Id": "13", + "Name": "correspondence_2_attachment.pdf" } ] }, { - "inquiryId": "2", - "id": "3", - "modifiedon": "1/22/23", - "status_reason": "Completed/Sent", - "description": "Which number can I call?", - "message_type": "722310000: Reply to VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "2", + "Id": "3", + "ModifiedOn": "1/22/23", + "StatusReason": "Completed/Sent", + "Description": "Which number can I call?", + "Message_type": "722310000: Reply to VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "2", - "id": "4", - "modifiedon": "1/23/23", - "status_reason": "Completed/Sent", - "description": "Which number can I call?", - "message_type": "722310000: Reply to VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "2", + "Id": "4", + "ModifiedOn": "1/23/23", + "StatusReason": "Completed/Sent", + "Description": "Which number can I call?", + "Message_type": "722310000: Reply to VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "5", - "modifiedon": "8/23/23", - "status_reason": "Completed/Sent", - "description": "Your claim is currently under review. We expect to complete processing within the next two weeks. No additional documents needed.", - "message_type": "722310001: Response from VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "5", + "ModifiedOn": "8/23/23", + "StatusReason": "Completed/Sent", + "Description": "Your claim is currently under review. We expect to complete processing within the next two weeks. No additional documents needed.", + "Message_type": "722310001: Response from VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "6", - "modifiedon": "8/24/23", - "status_reason": "Completed/Sent", - "description": "I appreciate the update. Can you confirm if all my submitted documents have been received and are in order?", - "message_type": "722310000: Reply to VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "6", + "ModifiedOn": "8/24/23", + "StatusReason": "Completed/Sent", + "Description": "I appreciate the update. Can you confirm if all my submitted documents have been received and are in order?", + "Message_type": "722310000: Reply to VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "7", - "modifiedon": "8/24/23", - "status_reason": "Completed/Sent", - "description": "Yes, all your documents are received and complete. Your application is progressing without any issues at this stage.", - "message_type": "722310001: Response from VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "7", + "ModifiedOn": "8/24/23", + "StatusReason": "Completed/Sent", + "Description": "Yes, all your documents are received and complete. Your application is progressing without any issues at this stage.", + "Message_type": "722310001: Response from VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "7", - "modifiedon": "8/25/23", - "status_reason": "Completed/Sent", - "description": "Great to hear! Could you advise on the potential outcomes of this process and any impact on my benefits?", - "message_type": "722310000: Reply to VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "7", + "ModifiedOn": "8/25/23", + "StatusReason": "Completed/Sent", + "Description": "Great to hear! Could you advise on the potential outcomes of this process and any impact on my benefits?", + "Message_type": "722310000: Reply to VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "8", - "modifiedon": "8/26/23", - "status_reason": "Completed/Sent", - "description": "The claim review may result in increased benefits, continuation at current level, or an adjustment. We'll notify you.", - "message_type": "722310001: Response from VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "8", + "ModifiedOn": "8/26/23", + "StatusReason": "Completed/Sent", + "Description": "The claim review may result in increased benefits, continuation at current level, or an adjustment. We'll notify you.", + "Message_type": "722310001: Response from VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "8", - "modifiedon": "8/26/23", - "status_reason": "Completed/Sent", - "description": "Understood. In case of an adjustment, is there an option to appeal or provide additional supporting evidence?", - "message_type": "722310000: Reply to VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "8", + "ModifiedOn": "8/26/23", + "StatusReason": "Completed/Sent", + "Description": "Understood. In case of an adjustment, is there an option to appeal or provide additional supporting evidence?", + "Message_type": "722310000: Reply to VA", + "Enable_reply": true, + "AttachmentNames": [] }, { - "inquiryId": "9", - "id": "9", - "modifiedon": "8/28/23", - "status_reason": "Completed/Sent", - "description": "Absolutely. You'll have the option to appeal and submit further evidence if needed. We'll guide you through the process.", - "message_type": "722310001: Response from VA", - "enable_reply": true, - "attachmentNames": [] + "InquiryId": "9", + "Id": "9", + "ModifiedOn": "8/28/23", + "StatusReason": "Completed/Sent", + "Description": "Absolutely. You'll have the option to appeal and submit further evidence if needed. We'll guide you through the process.", + "Message_type": "722310001: Response from VA", + "Enable_reply": true, + "AttachmentNames": [] } ] } diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/entity_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/entity_spec.rb index ebe64a9d7a5..e7ba1d9f4fd 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/entity_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/entity_spec.rb @@ -7,18 +7,18 @@ let(:info) do { - id: '1', - fileContent: 'SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==', - fileName: 'testfile.txt' + Id: '1', + FileContent: 'SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==', + FileName: 'testfile.txt' } end let(:attachment) { creator.new(info) } it 'creates an attachment' do expect(attachment).to have_attributes({ - id: info[:id], - file_content: info[:fileContent], - file_name: info[:fileName] + id: info[:Id], + file_content: info[:FileContent], + file_name: info[:FileName] }) end end diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/retriever_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/retriever_spec.rb index 174264576a0..d6a027fd495 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/retriever_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/retriever_spec.rb @@ -17,8 +17,8 @@ context 'when successful' do before do allow(service).to receive(:call) - .with(endpoint: 'get_attachments_mock_data', payload: { id: '1' }) - .and_return([double]) + .with(endpoint: 'attachment', payload: { id: '1' }) + .and_return({ Data: double }) end it 'returns an attachment object' do @@ -33,7 +33,7 @@ before do allow(service).to receive(:call) - .with(endpoint: 'get_attachments_mock_data', payload: { id: '1' }) + .with(endpoint: 'attachment', payload: { id: '1' }) .and_raise(Crm::ErrorHandler::ServiceError, error_message) end diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/serializer_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/serializer_spec.rb index 543f7121000..8504c485872 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/serializer_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/attachments/serializer_spec.rb @@ -5,9 +5,9 @@ RSpec.describe AskVAApi::Attachments::Serializer do let(:info) do { - id: '1', - fileContent: 'SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==', - fileName: 'testfile.txt' + Id: '1', + FileContent: 'SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUgZm9yIGRvd25sb2FkaW5nIQ==', + FileName: 'testfile.txt' } end let(:attachment) { AskVAApi::Attachments::Entity.new(info) } @@ -16,8 +16,8 @@ let(:expected_response) do { data: { id: '1', type: :attachment, - attributes: { file_content: info[:fileContent], - file_name: info[:fileName] } } } + attributes: { file_content: info[:FileContent], + file_name: info[:FileName] } } } end context 'when successful' do diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/entity_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/entity_spec.rb index 01b59c7d503..5fd91ba4c52 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/entity_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/entity_spec.rb @@ -7,14 +7,14 @@ let(:info) do { - inquiryId: '1', - id: '1', - modifiedon: '1/2/23', - status_reason: 'Completed/Sent', - description: 'Your claim is still In Progress', - message_type: '722310001: Response from VA', - enable_reply: true, - attachmentNames: [ + InquiryId: '1', + Id: '1', + ModifiedOn: '1/2/23', + StatusReason: 'Completed/Sent', + Description: 'Your claim is still In Progress', + MessageType: '722310001: Response from VA', + EnableReply: true, + AttachmentNames: [ { id: '12', name: 'correspondence_1_attachment.pdf' @@ -26,17 +26,17 @@ it 'creates an correspondence' do expect(correspondence).to have_attributes( - inquiry_id: info[:inquiryId], - id: info[:id], - modified_on: info[:modifiedon], - status_reason: info[:status_reason], - description: info[:description], - message_type: info[:message_type], + inquiry_id: info[:InquiryId], + id: info[:Id], + modified_on: info[:ModifiedOn], + status_reason: info[:StatusReason], + description: info[:Description], + message_type: info[:MessageType], enable_reply: true, attachments: [ { - id: info[:attachmentNames].first[:id], - name: info[:attachmentNames].first[:name] + id: info[:AttachmentNames].first[:id], + name: info[:AttachmentNames].first[:name] } ] ) diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/retriever_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/retriever_spec.rb index 6a8bec7ff50..cc8311c6052 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/retriever_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/retriever_spec.rb @@ -28,7 +28,7 @@ end context 'when Crm raise an error' do - let(:payload) { { inquiry_id: '1' } } + let(:payload) { { InquiryId: '1' } } let(:response) { instance_double(Faraday::Response, status: 400, body: 'Bad Request') } let(:endpoint) { AskVAApi::Correspondences::ENDPOINT } let(:error_message) { "Bad request to #{endpoint}: #{response.body}" } @@ -48,8 +48,8 @@ it 'returns an array object with correct data' do allow(service).to receive(:call) - .with(endpoint: 'get_replies_mock_data', payload: { inquiry_id: }) - .and_return([double]) + .with(endpoint: 'replies', payload: { InquiryId: inquiry_id }) + .and_return({ Data: [double] }) expect(retriever.call).to eq([entity]) end end diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/serializer_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/serializer_spec.rb index 352a1752e19..fe5b272a0ad 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/serializer_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/correspondences/serializer_spec.rb @@ -4,7 +4,7 @@ RSpec.describe AskVAApi::Correspondences::Serializer do let(:file_path) { 'modules/ask_va_api/config/locales/get_replies_mock_data.json' } - let(:data) { JSON.parse(File.read(file_path), symbolize_names: true)[:data] } + let(:data) { JSON.parse(File.read(file_path), symbolize_names: true)[:Data] } let(:cor1) { AskVAApi::Correspondences::Entity.new(data.first) } let(:cor2) { AskVAApi::Correspondences::Entity.new(data.last) } let(:response) { described_class.new([cor1]) } @@ -17,7 +17,7 @@ status_reason: 'Completed/Sent', description: 'Your claim is still In Progress', enable_reply: true, - attachments: [{ id: '12', name: 'correspondence_1_attachment.pdf' }] } }] } + attachments: [{ Id: '12', Name: 'correspondence_1_attachment.pdf' }] } }] } end context 'when successful' do diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/entity_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/entity_spec.rb index 91e4e6425c0..f3374cd8031 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/entity_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/entity_spec.rb @@ -7,22 +7,22 @@ let(:info) do { - icn: YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'], - id: 'a6c3af1b-ec8c-ee11-8178-001dd804e106', - inquiryNumber: 'A-123456', - inquiryStatus: 'In Progress', - submitterQuestion: 'My question is... ', - lastUpdate: '1/1/1900', - inquiryHasAttachments: true, - inquiryHasBeenSplit: true, - veteranRelationship: 'self', - schoolFacilityCode: '0123', - inquiryTopic: 'topic', - inquiryLevelOfAuthentication: 'Personal', - attachmentNames: [ + Icn: YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'], + Id: 'a6c3af1b-ec8c-ee11-8178-001dd804e106', + InquiryNumber: 'A-123456', + InquiryStatus: 'In Progress', + SubmitterQuestion: 'My question is... ', + LastUpdate: '1/1/1900', + InquiryHasAttachments: true, + InquiryHasBeenSplit: true, + VeteranRelationship: 'self', + SchoolFacilityCode: '0123', + InquiryTopic: 'topic', + InquiryLevelOfAuthentication: 'Personal', + AttachmentNames: [ { - id: '012345', - name: 'File A.pdf' + Id: '012345', + Name: 'File A.pdf' } ] } @@ -31,19 +31,19 @@ it 'creates an inquiry' do expect(inquiry).to have_attributes({ - id: info[:id], - inquiry_number: info[:inquiryNumber], - attachments: info[:attachmentNames], + id: info[:Id], + inquiry_number: info[:InquiryNumber], + attachments: info[:AttachmentNames], correspondences: nil, - has_attachments: info[:inquiryHasAttachments], - has_been_split: info[:inquiryHasBeenSplit], - level_of_authentication: info[:inquiryLevelOfAuthentication], - last_update: info[:lastUpdate], - status: info[:inquiryStatus], - submitter_question: info[:submitterQuestion], - school_facility_code: info[:schoolFacilityCode], - topic: info[:inquiryTopic], - veteran_relationship: info[:veteranRelationship] + has_attachments: info[:InquiryHasAttachments], + has_been_split: info[:InquiryHasBeenSplit], + level_of_authentication: info[:InquiryLevelOfAuthentication], + last_update: info[:LastUpdate], + status: info[:InquiryStatus], + submitter_question: info[:SubmitterQuestion], + school_facility_code: info[:SchoolFacilityCode], + topic: info[:InquiryTopic], + veteran_relationship: info[:VeteranRelationship] }) end end diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/retriever_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/retriever_spec.rb index 09ba26b57f7..d4c64631c94 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/retriever_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/retriever_spec.rb @@ -3,25 +3,27 @@ require 'rails_helper' RSpec.describe AskVAApi::Inquiries::Retriever do - subject(:retriever) { described_class.new(icn:) } + subject(:retriever) { described_class.new(icn:, service:) } - let(:icn) { '123' } - let(:service) { instance_double(Crm::Service) } + let(:icn) { YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'] } + let(:service) { DynamicsMockService.new(icn:) } let(:correspondences) { instance_double(AskVAApi::Correspondences::Retriever) } let(:entity) { instance_double(AskVAApi::Inquiries::Entity) } - let(:id) { 'A-1' } + let(:id) { '1' } let(:error_message) { 'Some error occurred' } let(:payload) { { id: '1' } } before do - allow(Crm::Service).to receive(:new).and_return(service) allow(AskVAApi::Correspondences::Retriever).to receive(:new).and_return(correspondences) allow(correspondences).to receive(:call).and_return(entity) allow(AskVAApi::Inquiries::Entity).to receive(:new).and_return(entity) - allow(service).to receive(:call) end describe '#fetch_by_id' do + it 'returns an Entity object with correct data' do + expect(retriever.fetch_by_id(id:)).to eq(entity) + end + context 'when id is blank' do let(:id) { nil } @@ -49,13 +51,6 @@ end.to raise_error(ErrorHandler::ServiceError, "Crm::ErrorHandler::ServiceError: #{error_message}") end end - - it 'returns an Entity object with correct data' do - allow(service).to receive(:call) - .with(endpoint: 'get_inquiries_mock_data', payload: { id: }) - .and_return([double]) - expect(retriever.fetch_by_id(id:)).to eq(entity) - end end describe '#fetch_by_icn' do @@ -70,13 +65,12 @@ context 'when icn is present' do it 'returns an array of Entity objects' do - allow(service).to receive(:call).and_return([entity]) - expect(retriever.fetch_by_icn).to eq([entity]) + expect(retriever.fetch_by_icn.first).to eq(entity) end context 'when there are no inquiries' do it 'returns an empty array' do - allow(service).to receive(:call).and_return([]) + allow(service).to receive(:call).and_return({ Data: [] }) expect(retriever.fetch_by_icn).to be_empty end end diff --git a/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/serializer_spec.rb b/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/serializer_spec.rb index 584ed0e25a0..8869b01f621 100644 --- a/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/serializer_spec.rb +++ b/modules/ask_va_api/spec/app/lib/ask_va_api/inquiries/serializer_spec.rb @@ -6,21 +6,21 @@ let(:info) do { icn: YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'], - id: 'a6c3af1b-ec8c-ee11-8178-001dd804e106', - inquiryNumber: 'A-123456', - inquiryStatus: 'In Progress', - submitterQuestion: 'My question is... ', - lastUpdate: '1/1/1900', - inquiryHasAttachments: true, - inquiryHasBeenSplit: true, - veteranRelationship: 'self', - schoolFacilityCode: '0123', - inquiryTopic: 'topic', - inquiryLevelOfAuthentication: 'Personal', - attachmentNames: [ + Id: 'a6c3af1b-ec8c-ee11-8178-001dd804e106', + InquiryNumber: 'A-123456', + InquiryStatus: 'In Progress', + SubmitterQuestion: 'My question is... ', + LastUpdate: '1/1/1900', + InquiryHasAttachments: true, + InquiryHasBeenSplit: true, + VeteranRelationship: 'self', + SchoolFacilityCode: '0123', + InquiryTopic: 'topic', + InquiryLevelOfAuthentication: 'Personal', + AttachmentNames: [ { - id: '012345', - name: 'File A.pdf' + Id: '012345', + Name: 'File A.pdf' } ] } @@ -28,21 +28,21 @@ let(:inquiry) { AskVAApi::Inquiries::Entity.new(info) } let(:response) { described_class.new(inquiry) } let(:expected_response) do - { data: { id: info[:id], + { data: { id: info[:Id], type: :inquiry, attributes: { - inquiry_number: info[:inquiryNumber], - attachments: info[:attachmentNames], + inquiry_number: info[:InquiryNumber], + attachments: info[:AttachmentNames], correspondences: nil, - has_attachments: info[:inquiryHasAttachments], - has_been_split: info[:inquiryHasBeenSplit], - level_of_authentication: info[:inquiryLevelOfAuthentication], - last_update: info[:lastUpdate], - status: info[:inquiryStatus], - submitter_question: info[:submitterQuestion], - school_facility_code: info[:schoolFacilityCode], - topic: info[:inquiryTopic], - veteran_relationship: info[:veteranRelationship] + has_attachments: info[:InquiryHasAttachments], + has_been_split: info[:InquiryHasBeenSplit], + level_of_authentication: info[:InquiryLevelOfAuthentication], + last_update: info[:LastUpdate], + status: info[:InquiryStatus], + submitter_question: info[:SubmitterQuestion], + school_facility_code: info[:SchoolFacilityCode], + topic: info[:InquiryTopic], + veteran_relationship: info[:VeteranRelationship] } } } end diff --git a/modules/ask_va_api/spec/requests/v0/inquiries_spec.rb b/modules/ask_va_api/spec/requests/v0/inquiries_spec.rb index c1ed800570c..f77090dc98b 100644 --- a/modules/ask_va_api/spec/requests/v0/inquiries_spec.rb +++ b/modules/ask_va_api/spec/requests/v0/inquiries_spec.rb @@ -9,9 +9,9 @@ let(:icn) { YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'] } let(:authorized_user) { build(:user, :accountable_with_sec_id, icn:) } let(:mock_inquiries) do - JSON.parse(File.read('modules/ask_va_api/config/locales/get_inquiries_mock_data.json'))['data'] + JSON.parse(File.read('modules/ask_va_api/config/locales/get_inquiries_mock_data.json'))['Data'] end - let(:valid_id) { mock_inquiries.first['id'] } + let(:valid_id) { mock_inquiries.first['Id'] } let(:invalid_id) { 'invalid-id' } before do @@ -43,7 +43,7 @@ 'type' => 'inquiry', 'attributes' => { 'inquiry_number' => 'A-1', - 'attachments' => [{ 'id' => '1', 'name' => 'testfile.txt' }], + 'attachments' => [{ 'Id' => '1', 'Name' => 'testfile.txt' }], 'correspondences' => nil, 'has_attachments' => true, 'has_been_split' => true, @@ -108,7 +108,7 @@ 'type' => 'inquiry', 'attributes' => { 'inquiry_number' => 'A-1', - 'attachments' => [{ 'id' => '1', 'name' => 'testfile.txt' }], + 'attachments' => [{ 'Id' => '1', 'Name' => 'testfile.txt' }], 'correspondences' => { 'data' => [{ 'id' => '1', 'type' => 'correspondence', @@ -121,8 +121,8 @@ 'enable_reply' => true, 'attachments' => [ { - 'id' => '12', - 'name' => 'correspondence_1_attachment.pdf' + 'Id' => '12', + 'Name' => 'correspondence_1_attachment.pdf' } ] } @@ -264,7 +264,7 @@ def json_response let(:id) { 'not_valid' } it 'responds with 500' do - expect(response).to have_http_status(:internal_server_error) + expect(response).to have_http_status(:unprocessable_entity) end end end diff --git a/modules/ask_va_api/spec/services/dynamics_mock_service_spec.rb b/modules/ask_va_api/spec/services/dynamics_mock_service_spec.rb index 28a35bd3f22..f3d47940b7a 100644 --- a/modules/ask_va_api/spec/services/dynamics_mock_service_spec.rb +++ b/modules/ask_va_api/spec/services/dynamics_mock_service_spec.rb @@ -3,11 +3,11 @@ require 'rails_helper' RSpec.describe DynamicsMockService do - let(:endpoint) { 'get_inquiries_mock_data' } + let(:endpoint) { 'inquiries' } let(:method) { 'GET' } let(:payload) { {} } let(:service) { described_class.new(icn: nil, logger: nil) } - let(:file_path) { "modules/ask_va_api/config/locales/#{endpoint.tr('/', '_')}.json" } + let(:file_path) { "modules/ask_va_api/config/locales/get_#{endpoint}_mock_data.json" } describe '#call' do context 'when the file does not exist' do @@ -36,41 +36,33 @@ context 'when the file contains valid JSON content' do let(:expected_result) do - { - icn: YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'], - id: '1', - inquiryNumber: 'A-1', - inquiryStatus: 'In Progress', - submitterQuestion: 'What is my status?', - lastUpdate: '12/20/23', - inquiryHasAttachments: true, - inquiryHasBeenSplit: true, - veteranRelationship: 'self', - schoolFacilityCode: '0123', - inquiryTopic: 'Status of a pending claim', - inquiryLevelOfAuthentication: 'Personal', - attachmentNames: [ + { Data: { + Icn: YAML.load_file('./modules/ask_va_api/config/locales/constants.yml')['test_users']['test_user_228_icn'], + Id: '1', + InquiryNumber: 'A-1', + InquiryStatus: 'In Progress', + SubmitterQuestion: 'What is my status?', + LastUpdate: '12/20/23', + InquiryHasAttachments: true, + InquiryHasBeenSplit: true, + VeteranRelationship: 'self', + SchoolFacilityCode: '0123', + InquiryTopic: 'Status of a pending claim', + InquiryLevelOfAuthentication: 'Personal', + AttachmentNames: [ { - id: '1', - name: 'testfile.txt' + Id: '1', + Name: 'testfile.txt' } ] - } + } } end context 'with id payload' do let(:payload) { { id: '1' } } it 'filters data based on id' do - expect(service.call(endpoint:, payload:)).to eq([expected_result]) - end - - context 'with non-existent id' do - let(:payload) { { id: '99' } } - - it 'returns an empty hash' do - expect(service.call(endpoint:, payload:)).to eq([]) - end + expect(service.call(endpoint:, payload:)).to eq(expected_result) end end @@ -81,7 +73,7 @@ end it 'filters data based on icn and excludes attachments' do - expect(service.call(endpoint:, payload:).first).to eq(expected_result) + expect(service.call(endpoint:, payload:).first).to eq(expected_result[:Data]) end end end diff --git a/modules/check_in/app/sidekiq/check_in/travel_claim_submission_worker.rb b/modules/check_in/app/sidekiq/check_in/travel_claim_submission_worker.rb index 7b033090985..e4bab48d757 100644 --- a/modules/check_in/app/sidekiq/check_in/travel_claim_submission_worker.rb +++ b/modules/check_in/app/sidekiq/check_in/travel_claim_submission_worker.rb @@ -22,15 +22,9 @@ class TravelClaimSubmissionWorker STATSD_BTSSS_ERROR = 'worker.checkin.travel_claim.btsss.error' STATSD_BTSSS_DUPLICATE = 'worker.checkin.travel_claim.btsss.duplicate' - # rubocop:disable Metrics/MethodLength def perform(uuid, appointment_date) - check_in_session = CheckIn::V2::Session.build(data: { uuid: }) redis_client = TravelClaim::RedisClient.build - mobile_phone = if Flipper.enabled?('check_in_experience_patient_cell_phone') - redis_client.patient_cell_phone(uuid:) - else - redis_client.mobile_phone(uuid:) - end + mobile_phone = redis_client.patient_cell_phone(uuid:) station_number = redis_client.station_number(uuid:) logger.info({ @@ -40,28 +34,25 @@ def perform(uuid, appointment_date) station_number: }) - begin - claims_resp = TravelClaim::Service.build( - check_in: check_in_session, - params: { appointment_date: } - ).submit_claim - - claim_number, template_id = handle_response(claims_resp:) - rescue Common::Exceptions::BackendServiceException => e - logger.error({ - message: "Error calling BTSSS Service: #{e.message}", - uuid:, - appointment_date:, - station_number: - }) - StatsD.increment(STATSD_BTSSS_ERROR) - template_id = ERROR_TEMPLATE_ID - end + claim_number, template_id = submit_claim(uuid:, appointment_date:, station_number:) send_notification(mobile_phone:, appointment_date:, template_id:, claim_number:) StatsD.increment(STATSD_NOTIFY_SUCCESS) end - # rubocop:enable Metrics/MethodLength + + def submit_claim(opts = {}) + check_in_session = CheckIn::V2::Session.build(data: { uuid: opts[:uuid] }) + claims_resp = TravelClaim::Service.build( + check_in: check_in_session, + params: { appointment_date: opts[:appointment_date] } + ).submit_claim + + handle_response(claims_resp:) + rescue Common::Exceptions::BackendServiceException => e + logger.error({ message: "Error calling BTSSS Service: #{e.message}" }.merge(opts)) + StatsD.increment(STATSD_BTSSS_ERROR) + [nil, ERROR_TEMPLATE_ID] + end def handle_response(claims_resp:) claim_number = claims_resp&.dig(:data, :claimNumber)&.last(4) diff --git a/modules/check_in/spec/sidekiq/travel_claim_submission_worker_spec.rb b/modules/check_in/spec/sidekiq/travel_claim_submission_worker_spec.rb index 7487a90f3bd..24af980009a 100644 --- a/modules/check_in/spec/sidekiq/travel_claim_submission_worker_spec.rb +++ b/modules/check_in/spec/sidekiq/travel_claim_submission_worker_spec.rb @@ -20,7 +20,6 @@ before do allow(TravelClaim::RedisClient).to receive(:build).and_return(redis_client) allow(Flipper).to receive(:enabled?).with('check_in_experience_mock_enabled').and_return(false) - allow(Flipper).to receive(:enabled?).with('check_in_experience_patient_cell_phone').and_return(false) allow(Flipper).to receive(:enabled?).with(:check_in_experience_travel_claim_increase_timeout).and_return(true) allow(redis_client).to receive(:mobile_phone).and_return(mobile_phone) @@ -40,7 +39,7 @@ expect(VaNotify::Service).to receive(:new).with(Settings.vanotify.services.check_in.api_key) .and_return(notify_client) expect(notify_client).to receive(:send_sms).with( - phone_number: mobile_phone, + phone_number: patient_cell_phone, template_id: 'fake_success_template_id', sms_sender_id: 'fake_sms_sender_id', personalisation: { claim_number: claim_last4, appt_date: notify_appt_date } @@ -67,7 +66,7 @@ expect(VaNotify::Service).to receive(:new).with(Settings.vanotify.services.check_in.api_key) .and_return(notify_client) expect(notify_client).to receive(:send_sms).with( - phone_number: mobile_phone, + phone_number: patient_cell_phone, template_id: 'fake_duplicate_template_id', sms_sender_id: 'fake_sms_sender_id', personalisation: { claim_number: nil, appt_date: notify_appt_date } @@ -94,7 +93,7 @@ expect(VaNotify::Service).to receive(:new).with(Settings.vanotify.services.check_in.api_key) .and_return(notify_client) expect(notify_client).to receive(:send_sms).with( - phone_number: mobile_phone, + phone_number: patient_cell_phone, template_id: 'fake_error_template_id', sms_sender_id: 'fake_sms_sender_id', personalisation: { claim_number: nil, appt_date: notify_appt_date } @@ -125,7 +124,7 @@ expect(VaNotify::Service).to receive(:new).with(Settings.vanotify.services.check_in.api_key) .and_return(notify_client) expect(notify_client).to receive(:send_sms).with( - phone_number: mobile_phone, + phone_number: patient_cell_phone, template_id: 'fake_error_template_id', sms_sender_id: 'fake_sms_sender_id', personalisation: { claim_number: nil, appt_date: notify_appt_date } @@ -150,7 +149,7 @@ worker = described_class.new expect(worker).to receive(:log_exception_to_sentry).with( instance_of(Common::Exceptions::BackendServiceException), - { phone_number: mobile_phone_last_four, template_id: 'fake_success_template_id', + { phone_number: patient_cell_phone_last_four, template_id: 'fake_success_template_id', claim_number: claim_last4 }, { error: :check_in_va_notify_job, team: 'check-in' } ) @@ -172,7 +171,6 @@ context 'travel claim returns success with patient cell phone' do before do allow(Flipper).to receive(:enabled?).with('check_in_experience_mock_enabled').and_return(true) - allow(Flipper).to receive(:enabled?).with('check_in_experience_patient_cell_phone').and_return(true) end it 'sends notification with success template' do diff --git a/modules/mobile/spec/request/appointments_cancel_request_spec.rb b/modules/mobile/spec/request/appointments_cancel_request_spec.rb index d8c233f594f..af61937c4a5 100644 --- a/modules/mobile/spec/request/appointments_cancel_request_spec.rb +++ b/modules/mobile/spec/request/appointments_cancel_request_spec.rb @@ -13,43 +13,99 @@ allow_any_instance_of(VAOS::UserService).to receive(:session).and_return('stubbed_token') end - describe 'PUT /mobile/v0/appointments/cancel', :aggregate_failures do - let(:cancel_id) { '70060' } + context 'using vaos-service' do + before do + Flipper.disable(:va_online_scheduling_enable_OH_cancellations) + end + + describe 'PUT /mobile/v0/appointments/cancel', :aggregate_failures do + let(:cancel_id) { '70060' } - it 'returns a no content code' do - VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_200', match_requests_on: %i[method uri]) do - VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do - put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + it 'returns a no content code' do + VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_200', match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers - expect(response).to have_http_status(:no_content) - expect(response.body).to be_an_instance_of(String).and be_empty + expect(response).to have_http_status(:no_content) + expect(response.body).to be_an_instance_of(String).and be_empty + end end end - end - context 'when the appointment cannot be found' do - it 'returns a 400 code' do - VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_400', match_requests_on: %i[method uri]) do - put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + context 'when the appointment cannot be found' do + it 'returns a 400 code' do + VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_400', match_requests_on: %i[method uri]) do + put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + + expect(response.status).to eq(400) + expect(response.parsed_body.dig('errors', 0, 'code')).to eq('VAOS_400') + + error_message = JSON.parse(response.parsed_body.dig('errors', 0, 'source', 'vamfBody'))['message'] + expect(error_message).to eq('appointment may not be cancelled') + end + end + end - expect(response.status).to eq(400) - expect(response.parsed_body.dig('errors', 0, 'code')).to eq('VAOS_400') + context 'when the backend service cannot handle the request' do + it 'returns a 502 code' do + VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_500', match_requests_on: %i[method uri]) do + put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + expect(response.status).to eq(502) + expect(JSON.parse(response.body)['errors'][0]['code']).to eq('VAOS_502') - error_message = JSON.parse(response.parsed_body.dig('errors', 0, 'source', 'vamfBody'))['message'] - expect(error_message).to eq('appointment may not be cancelled') + error_message = JSON.parse(response.parsed_body.dig('errors', 0, 'source', 'vamfBody'))['message'] + expect(error_message).to eq('failed to cancel appointment') + end end end end + end + + context 'using vpg' do + before do + Flipper.enable(:va_online_scheduling_enable_OH_cancellations) + end + + describe 'PUT /mobile/v0/appointments/cancel', :aggregate_failures do + let(:cancel_id) { '70060' } + + it 'returns a no content code' do + VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_vpg_200', match_requests_on: %i[method uri]) do + VCR.use_cassette('mobile/appointments/VAOS_v2/get_facilities_200', match_requests_on: %i[method uri]) do + put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + + expect(response).to have_http_status(:no_content) + expect(response.body).to be_an_instance_of(String).and be_empty + end + end + end + + context 'when the appointment cannot be found' do + it 'returns a 400 code' do + VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_vpg_400', + match_requests_on: %i[method uri]) do + put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + + expect(response.status).to eq(400) + expect(response.parsed_body.dig('errors', 0, 'code')).to eq('VAOS_400') + + error_message = JSON.parse(response.parsed_body.dig('errors', 0, 'source', 'vamfBody'))['message'] + expect(error_message).to eq('appointment may not be cancelled') + end + end + end - context 'when the backend service cannot handle the request' do - it 'returns a 502 code' do - VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_500', match_requests_on: %i[method uri]) do - put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers - expect(response.status).to eq(502) - expect(JSON.parse(response.body)['errors'][0]['code']).to eq('VAOS_502') + context 'when the backend service cannot handle the request' do + it 'returns a 502 code' do + VCR.use_cassette('mobile/appointments/VAOS_v2/cancel_appointment_vpg_500', + match_requests_on: %i[method uri]) do + put "/mobile/v0/appointments/cancel/#{cancel_id}", params: nil, headers: sis_headers + expect(response.status).to eq(502) + expect(JSON.parse(response.body)['errors'][0]['code']).to eq('VAOS_502') - error_message = JSON.parse(response.parsed_body.dig('errors', 0, 'source', 'vamfBody'))['message'] - expect(error_message).to eq('failed to cancel appointment') + error_message = JSON.parse(response.parsed_body.dig('errors', 0, 'source', 'vamfBody'))['message'] + expect(error_message).to eq('failed to cancel appointment') + end end end end diff --git a/modules/representation_management/app/controllers/representation_management/v0/flag_accredited_representatives_controller.rb b/modules/representation_management/app/controllers/representation_management/v0/flag_accredited_representatives_controller.rb index dde1935898a..3341572387c 100644 --- a/modules/representation_management/app/controllers/representation_management/v0/flag_accredited_representatives_controller.rb +++ b/modules/representation_management/app/controllers/representation_management/v0/flag_accredited_representatives_controller.rb @@ -4,8 +4,8 @@ module RepresentationManagement module V0 class FlagAccreditedRepresentativesController < ApplicationController service_tag 'lighthouse-veteran' + before_action :feature_enabled skip_before_action :authenticate - # before_action :feature_enabled def create flags = nil @@ -41,9 +41,9 @@ def create_flags end end - # def feature_enabled - # routing_error unless Flipper.enabled?(:find_a_representative_flag_results_enabled) - # end + def feature_enabled + routing_error unless Flipper.enabled?(:find_a_representative_flag_results_enabled) + end end end end diff --git a/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb b/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb index 72a471d7e54..b65347870f4 100644 --- a/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb +++ b/modules/simple_forms_api/app/controllers/simple_forms_api/v1/uploads_controller.rb @@ -221,7 +221,7 @@ def icn end def first_party? - %w[VETERAN SURVIVING_DEPENDENT].include?(params[:preparer_identification]) + params[:preparer_identification] == 'VETERAN' end def get_form_id diff --git a/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb b/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb index 7320b0d3ee2..350d67f30e4 100644 --- a/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb +++ b/modules/simple_forms_api/spec/requests/v1/uploads_spec.rb @@ -110,22 +110,20 @@ end describe 'request with intent to file' do - describe 'veteran or surviving dependent' do - %w[VETERAN SURVIVING_DEPENDENT].each do |identification| - it 'makes the request with an intent to file' do - VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/404_response') do - VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/200_response_pension') do - VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/200_response_survivor') do - VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/create_compensation_200_response') do - fixture_path = Rails.root.join('modules', 'simple_forms_api', 'spec', 'fixtures', 'form_json', - 'vba_21_0966-min.json') - data = JSON.parse(fixture_path.read) - data['preparer_identification'] = identification - - post '/simple_forms_api/v1/simple_forms', params: data - - expect(response).to have_http_status(:ok) - end + describe 'veteran' do + it 'makes the request with an intent to file' do + VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/404_response') do + VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/200_response_pension') do + VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/200_response_survivor') do + VCR.use_cassette('lighthouse/benefits_claims/intent_to_file/create_compensation_200_response') do + fixture_path = Rails.root.join('modules', 'simple_forms_api', 'spec', 'fixtures', 'form_json', + 'vba_21_0966-min.json') + data = JSON.parse(fixture_path.read) + data['preparer_identification'] = 'VETERAN' + + post '/simple_forms_api/v1/simple_forms', params: data + + expect(response).to have_http_status(:ok) end end end diff --git a/modules/simple_forms_api/spec/services/pdf_filler_spec.rb b/modules/simple_forms_api/spec/services/pdf_filler_spec.rb index d996a7ee322..c2e1bcac4d2 100644 --- a/modules/simple_forms_api/spec/services/pdf_filler_spec.rb +++ b/modules/simple_forms_api/spec/services/pdf_filler_spec.rb @@ -5,7 +5,9 @@ describe SimpleFormsApi::PdfFiller do def self.test_pdf_fill(form_number, test_payload = form_number) - it 'fills out a PDF from a templated JSON file' do + xit 'fills out a PDF from a templated JSON file' do + # skipping these tests due to inconsistent behavior constantly blocking PRs to master + expected_pdf_path = "tmp/#{form_number}-tmp.pdf" # remove the pdf if it already exists diff --git a/modules/vaos/app/exceptions/vaos/exceptions/backend_service_exception.rb b/modules/vaos/app/exceptions/vaos/exceptions/backend_service_exception.rb index 49eb8a2f71b..aac75702731 100644 --- a/modules/vaos/app/exceptions/vaos/exceptions/backend_service_exception.rb +++ b/modules/vaos/app/exceptions/vaos/exceptions/backend_service_exception.rb @@ -35,7 +35,8 @@ def initialize(env) def response_values { detail: detail(@env.body), - source: { vamf_url: @env.url, vamf_body: @env.body, vamf_status: @env.status } + source: { vamf_url: VAOS::Anonymizers.anonymize_uri_icn(@env.url), vamf_body: @env.body, + vamf_status: @env.status } } end diff --git a/modules/vaos/app/helpers/vaos/anonymizers.rb b/modules/vaos/app/helpers/vaos/anonymizers.rb new file mode 100644 index 00000000000..f4bd4bc733b --- /dev/null +++ b/modules/vaos/app/helpers/vaos/anonymizers.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module VAOS + module Anonymizers + # Anonymizes the ICN present in a given URI object by substituting a SHA256 digest for the ICN. + # If an ICN is not present in the URL, it would simply return the original URI. + # + # @param url [URI] URI in which ICN needs to be anonymized. + # + # @return [URI] URI with anonymized ICN (If present), original URI otherwise. + # + def self.anonymize_uri_icn(uri) + return nil if uri.nil? + + # Extract the patient ICN from the URL + url = uri.to_s + match = url[/(\d{10}V\d{6})/] + + return uri unless match + + digest = Digest::SHA256.hexdigest(match) + url.gsub!(match, digest) + URI(url) + end + end +end diff --git a/modules/vaos/app/models/vaos/v2/update_appointment_form.rb b/modules/vaos/app/models/vaos/v2/update_appointment_form.rb index 8a37de0e26a..fd266f423ad 100644 --- a/modules/vaos/app/models/vaos/v2/update_appointment_form.rb +++ b/modules/vaos/app/models/vaos/v2/update_appointment_form.rb @@ -19,6 +19,16 @@ def params attributes.compact end + + def json_patch_op + raise Common::Exceptions::ValidationErrors, self unless valid? + + { + op: 'replace', + path: '/status', + value: status + } + end end end end diff --git a/modules/vaos/app/services/vaos/base_service.rb b/modules/vaos/app/services/vaos/base_service.rb index 29cb7eb020c..88d9acc30d5 100644 --- a/modules/vaos/app/services/vaos/base_service.rb +++ b/modules/vaos/app/services/vaos/base_service.rb @@ -10,6 +10,10 @@ class BaseService < Common::Client::Base STATSD_KEY_PREFIX = 'api.vaos' + def patch(path, params, headers, options) + request(:patch, path, params, headers, options) + end + private def config diff --git a/modules/vaos/app/services/vaos/configuration.rb b/modules/vaos/app/services/vaos/configuration.rb index 81aba24fb19..73753b00d64 100644 --- a/modules/vaos/app/services/vaos/configuration.rb +++ b/modules/vaos/app/services/vaos/configuration.rb @@ -7,6 +7,7 @@ module VAOS class Configuration < Common::Client::Configuration::REST self.read_timeout = Settings.va_mobile.timeout || 55 + self.request_types = %i[get put post patch delete].freeze def base_path Settings.va_mobile.url diff --git a/modules/vaos/app/services/vaos/middleware/response/errors.rb b/modules/vaos/app/services/vaos/middleware/response/errors.rb index 6ef239e7168..5c24e04c196 100644 --- a/modules/vaos/app/services/vaos/middleware/response/errors.rb +++ b/modules/vaos/app/services/vaos/middleware/response/errors.rb @@ -7,7 +7,8 @@ class Errors < Faraday::Middleware def on_complete(env) return if env.success? - Sentry.set_extras(vamf_status: env.status, vamf_body: env.response_body, vamf_url: env.url) + Sentry.set_extras(vamf_status: env.status, vamf_body: env.response_body, + vamf_url: VAOS::Anonymizers.anonymize_uri_icn(env.url)) raise VAOS::Exceptions::BackendServiceException, env end end diff --git a/modules/vaos/app/services/vaos/middleware/vaos_logging.rb b/modules/vaos/app/services/vaos/middleware/vaos_logging.rb index df801d1e504..fa40a69c7b9 100644 --- a/modules/vaos/app/services/vaos/middleware/vaos_logging.rb +++ b/modules/vaos/app/services/vaos/middleware/vaos_logging.rb @@ -44,12 +44,13 @@ def call(env) private def log_tags(env, start_time, response_env = nil) + anon_uri = VAOS::Anonymizers.anonymize_uri_icn(env.url) { jti: jti(env), status: response_env&.status, duration: Time.current - start_time, # service_name: service_name || 'VAOS Generic', # Need to figure out a clean way to do this with headers - url: "(#{env.method.upcase}) #{env.url}" + url: "(#{env.method.upcase}) #{anon_uri}" } end diff --git a/modules/vaos/app/services/vaos/v2/appointments_service.rb b/modules/vaos/app/services/vaos/v2/appointments_service.rb index 75a28e407cf..7e47e023eb9 100644 --- a/modules/vaos/app/services/vaos/v2/appointments_service.rb +++ b/modules/vaos/app/services/vaos/v2/appointments_service.rb @@ -18,6 +18,7 @@ class AppointmentsService < VAOS::SessionService AVS_FLIPPER = :va_online_scheduling_after_visit_summary CANCEL_EXCLUSION = :va_online_scheduling_cancellation_exclusion + ORACLE_HEALTH_CANCELLATIONS = :va_online_scheduling_enable_OH_cancellations def get_appointments(start_date, end_date, statuses = nil, pagination_params = {}) params = date_params(start_date, end_date) @@ -97,10 +98,13 @@ def post_appointment(request_object_body) end def update_appointment(appt_id, status) - url_path = "/vaos/v1/patients/#{user.icn}/appointments/#{appt_id}" - params = VAOS::V2::UpdateAppointmentForm.new(status:).params with_monitoring do - response = perform(:put, url_path, params, headers) + response = if Flipper.enabled?(ORACLE_HEALTH_CANCELLATIONS) + update_appointment_vpg(appt_id, status) + else + update_appointment_vaos(appt_id, status) + end + convert_appointment_time(response.body) OpenStruct.new(response.body) end @@ -514,6 +518,18 @@ def page_params(pagination_params) def date_format(date) date.strftime('%Y-%m-%dT%TZ') end + + def update_appointment_vpg(appt_id, status) + url_path = "/vpg/v1/patients/#{user.icn}/appointments/#{appt_id}" + body = JSON.generate([VAOS::V2::UpdateAppointmentForm.new(status:).json_patch_op]) + perform(:patch, url_path, body, headers) + end + + def update_appointment_vaos(appt_id, status) + url_path = "/vaos/v1/patients/#{user.icn}/appointments/#{appt_id}" + params = VAOS::V2::UpdateAppointmentForm.new(status:).params + perform(:put, url_path, params, headers) + end end end end diff --git a/modules/vaos/spec/helpers/anonymizers_spec.rb b/modules/vaos/spec/helpers/anonymizers_spec.rb new file mode 100644 index 00000000000..69ec6171e85 --- /dev/null +++ b/modules/vaos/spec/helpers/anonymizers_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe VAOS::Anonymizers do + describe '#anonymize_uri_icn' do + it 'returns nil if the URI is nil' do + expect(subject.anonymize_uri_icn(nil)).to be_nil + end + + it 'returns the original URI if the URI does not contain an ICN' do + uri = URI.parse('http://example.com') + expect(subject.anonymize_uri_icn(uri)).to be(uri) + end + + it 'returns a URI with the ICN hashed' do + uri = URI.parse('http://example.com/1234567890V123456') + anon_uri = URI.parse('http://example.com/441ab560b8fc574c6bf84d6c6105318b79455321a931ef701d39f4ff91894c64') + expect(subject.anonymize_uri_icn(uri)).to eql(anon_uri) + end + end +end diff --git a/modules/vaos/spec/models/v2/update_appointment_form_spec.rb b/modules/vaos/spec/models/v2/update_appointment_form_spec.rb new file mode 100644 index 00000000000..5db37bfc2f5 --- /dev/null +++ b/modules/vaos/spec/models/v2/update_appointment_form_spec.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe VAOS::V2::UpdateAppointmentForm, type: :model do + describe 'valid object' do + subject { described_class.new(status: 'pending') } + + it 'validates presence of required attributes' do + expect(subject).to be_valid + end + + it 'params returns expected fields' do + params = subject.params + expect(params[:status]).to be('pending') + end + + it 'json_patch returns expected fields' do + json_patch = subject.json_patch_op + expect(json_patch[:op]).to be('replace') + expect(json_patch[:path]).to be('/status') + expect(json_patch[:value]).to be('pending') + end + end + + describe 'invalid object' do + subject { described_class.new(status: 'here') } + + it 'validates presence of required attributes' do + subject.status = nil + expect(subject).to be_invalid + end + + it 'validates status values' do + expect(subject).to be_invalid + end + + it 'handles invalid status in params' do + expect { subject.params }.to raise_error(Common::Exceptions::ValidationErrors) + end + + it 'handles invalid status in json_patch' do + expect { subject.json_patch_op }.to raise_error(Common::Exceptions::ValidationErrors) + end + end +end diff --git a/modules/vaos/spec/request/v2/appointments_request_spec.rb b/modules/vaos/spec/request/v2/appointments_request_spec.rb index 541301cba8c..776ed53727c 100644 --- a/modules/vaos/spec/request/v2/appointments_request_spec.rb +++ b/modules/vaos/spec/request/v2/appointments_request_spec.rb @@ -510,9 +510,13 @@ context 'when the VAOS service errors on retrieving an appointment' do it 'returns a 502 status code' do VCR.use_cassette('vaos/v2/appointments/get_appointment_500', match_requests_on: %i[method path query]) do + vamf_url = 'https://veteran.apps.va.gov/vaos/v1/patients/' \ + 'd12672eba61b7e9bc50bb6085a0697133a5fbadf195e6cade452ddaad7921c1d/appointments/00000' get '/vaos/v2/appointments/00000' + body = JSON.parse(response.body) expect(response).to have_http_status(:bad_gateway) - expect(JSON.parse(response.body)['errors'][0]['code']).to eq('VAOS_502') + expect(body.dig('errors', 0, 'code')).to eq('VAOS_502') + expect(body.dig('errors', 0, 'source', 'vamf_url')).to eq(vamf_url) end end end @@ -520,6 +524,10 @@ describe 'PUT appointments' do context 'when the appointment is successfully cancelled' do + before do + Flipper.disable(:va_online_scheduling_enable_OH_cancellations) + end + it 'returns a status code of 200 and the cancelled appointment with the updated status' do VCR.use_cassette('vaos/v2/appointments/cancel_appointments_200', match_requests_on: %i[method path query]) do VCR.use_cassette('vaos/v2/mobile_facility_service/get_facility_200', @@ -556,6 +564,7 @@ end it 'returns a 400 status code' do + Flipper.disable(:va_online_scheduling_enable_OH_cancellations) VCR.use_cassette('vaos/v2/appointments/cancel_appointment_400', match_requests_on: %i[method path query]) do put '/vaos/v2/appointments/42081', params: { status: 'cancelled' } expect(response.status).to eq(400) @@ -565,6 +574,10 @@ end context 'when the backend service cannot handle the request' do + before do + Flipper.disable(:va_online_scheduling_enable_OH_cancellations) + end + it 'returns a 502 status code' do VCR.use_cassette('vaos/v2/appointments/cancel_appointment_500', match_requests_on: %i[method path query]) do put '/vaos/v2/appointments/35952', params: { status: 'cancelled' } diff --git a/modules/vaos/spec/services/middleware/vaos_errors_spec.rb b/modules/vaos/spec/services/middleware/vaos_errors_spec.rb index 923d1b63fac..1e0eab90350 100644 --- a/modules/vaos/spec/services/middleware/vaos_errors_spec.rb +++ b/modules/vaos/spec/services/middleware/vaos_errors_spec.rb @@ -18,6 +18,7 @@ } let(:url) { URI.parse('url') } + let(:url_w_icn) { URI.parse('https://veteran.apps.va.gov/id/1234567890V123456') } let(:success) { Faraday::Env.new(:get, nil, url, nil, nil, nil, nil, nil, nil, nil, 200, nil, 'response_body') } let(:env_400) { Faraday::Env.new(:get, nil, url, nil, nil, nil, nil, nil, nil, nil, 400, nil, 'response_body') } let(:env_403) { Faraday::Env.new(:get, nil, url, nil, nil, nil, nil, nil, nil, nil, 403, nil, 'response_body') } @@ -27,6 +28,7 @@ let(:env_other) { Faraday::Env.new(:get, nil, url, nil, nil, nil, nil, nil, nil, nil, 600, nil, 'response_body') } let(:env_with_error) { Faraday::Env.new(:get, nil, url, nil, nil, nil, nil, nil, nil, nil, 400, nil, JSON[error]) } let(:env_with_errors) { Faraday::Env.new(:get, nil, url, nil, nil, nil, nil, nil, nil, nil, 400, nil, JSON[errors]) } + let(:env_w_icn) { Faraday::Env.new(:get, nil, url_w_icn, nil, nil, nil, nil, nil, nil, nil, 400, nil, JSON[errors]) } describe 'on complete' do context 'with success' do @@ -133,6 +135,15 @@ expect(e.response_values[:detail]).not_to match('second') } end + + it 'hashes the icn in the uri' do + expected_uri = URI('https://veteran.apps.va.gov/id/441ab560b8fc574c6bf84d6c6105318b79455321a931ef701d39f4ff91894c64') + err = VAOS::Middleware::Response::Errors.new + + expect { err.on_complete(env_w_icn) }.to raise_error(VAOS::Exceptions::BackendServiceException) { |e| + expect(e.response_values.dig(:source, :vamf_url)).to eql(expected_uri) + } + end end end end diff --git a/modules/vaos/spec/services/middleware/vaos_logging_spec.rb b/modules/vaos/spec/services/middleware/vaos_logging_spec.rb index 828e9a59a8b..ad1cb04919f 100644 --- a/modules/vaos/spec/services/middleware/vaos_logging_spec.rb +++ b/modules/vaos/spec/services/middleware/vaos_logging_spec.rb @@ -22,6 +22,7 @@ let(:all_other_uris) { 'https://veteran.apps.va.gov/whatever' } let(:user_service_refresh_uri) { 'https://veteran.apps.va.gov/user_service_refresh_uri' } let(:user_service_uri) { 'https://veteran.apps.va.gov/users/v2/session?processRules=true' } + let(:appt_uri) { 'https://veteran.apps.va.gov/vaos/v1/patients/1234567890V123456/appointments' } before do allow(Settings.va_mobile).to receive(:key_path).and_return(fixture_file_path('open_ssl_rsa_private.pem')) @@ -122,5 +123,22 @@ expect(Rails.logger).to have_received(:warn).with(rails_log_msg, anything).once expect(StatsD).to have_received(:increment).with(statsd_msg, anything).once end + + it 'logs timeout error with hashed URI' do + expected_log_tags = { + duration: 0.0, + jti: 'unknown jti', + status: nil, + url: '(POST) https://veteran.apps.va.gov/vaos/v1/patients/' \ + '441ab560b8fc574c6bf84d6c6105318b79455321a931ef701d39f4ff91894c64/appointments' + } + rails_log_msg = 'VAOS service call failed - timeout' + + allow_any_instance_of(Faraday::Adapter).to receive(:call).and_raise(Faraday::TimeoutError) + allow(Rails.logger).to receive(:warn).with(rails_log_msg, anything).and_call_original + + expect { client.post(appt_uri) }.to raise_error(Faraday::TimeoutError) + expect(Rails.logger).to have_received(:warn).with(rails_log_msg, expected_log_tags).once + 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 638947a8f95..3505c5b9d83 100644 --- a/modules/vaos/spec/services/v2/appointment_service_spec.rb +++ b/modules/vaos/spec/services/v2/appointment_service_spec.rb @@ -410,31 +410,70 @@ end describe '#cancel_appointment' do - context 'when the upstream server attemps to cancel an appointment' do + context 'when the upstream server attempts to cancel an appointment' do context 'with Jaqueline Morgan' do - it 'returns a cancelled status and the cancelled appointment information' do - VCR.use_cassette('vaos/v2/appointments/cancel_appointments_200', 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_enable_OH_cancellations) + end + + it 'returns a cancelled status and the cancelled appointment information' do + VCR.use_cassette('vaos/v2/appointments/cancel_appointments_vpg_200', + 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.update_appointment('70060', 'cancelled') + expect(response.status).to eq('cancelled') + end + end + end + + it 'returns a 400 when the appointment is not cancellable' do + VCR.use_cassette('vaos/v2/appointments/cancel_appointment_vpg_400', match_requests_on: %i[method path query]) do - response = subject.update_appointment('70060', 'cancelled') - expect(response.status).to eq('cancelled') + expect { subject.update_appointment('42081', 'cancelled') } + .to raise_error do |error| + expect(error).to be_a(Common::Exceptions::BackendServiceException) + expect(error.status_code).to eq(400) + end end end end - end - it 'returns a 400 when the appointment is not cancellable' do - VCR.use_cassette('vaos/v2/appointments/cancel_appointment_400', match_requests_on: %i[method path query]) do - expect { subject.update_appointment('42081', 'cancelled') } - .to raise_error do |error| - expect(error).to be_a(Common::Exceptions::BackendServiceException) - expect(error.status_code).to eq(400) + context 'using vaos-service' do + before do + Flipper.disable(:va_online_scheduling_enable_OH_cancellations) + end + + it 'returns a cancelled status and the cancelled appointment information' do + VCR.use_cassette('vaos/v2/appointments/cancel_appointments_200', + 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.update_appointment('70060', 'cancelled') + expect(response.status).to eq('cancelled') + end + end + end + + it 'returns a 400 when the appointment is not cancellable' do + VCR.use_cassette('vaos/v2/appointments/cancel_appointment_400', match_requests_on: %i[method path query]) do + expect { subject.update_appointment('42081', 'cancelled') } + .to raise_error do |error| + expect(error).to be_a(Common::Exceptions::BackendServiceException) + expect(error.status_code).to eq(400) + end + end end end end end context 'when there is a server error in updating an appointment' do + before do + Flipper.disable(:va_online_scheduling_enable_OH_cancellations) + end + it 'throws a BackendServiceException' do VCR.use_cassette('vaos/v2/appointments/cancel_appointment_500', match_requests_on: %i[method path query]) do expect { subject.update_appointment('35952', 'cancelled') } diff --git a/modules/veteran/app/controllers/veteran/v0/flag_accredited_representatives_controller.rb b/modules/veteran/app/controllers/veteran/v0/flag_accredited_representatives_controller.rb deleted file mode 100644 index 617b4116eb5..00000000000 --- a/modules/veteran/app/controllers/veteran/v0/flag_accredited_representatives_controller.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -module Veteran - module V0 - class FlagAccreditedRepresentativesController < ApplicationController - service_tag 'lighthouse-veteran' - skip_before_action :verify_authenticity_token - skip_before_action :authenticate - before_action :feature_enabled - - def create - flags = nil - - begin - flags = create_flags - - if flags.all?(&:valid?) - flags.each(&:save!) - render json: flags, each_serializer: Veteran::FlaggedVeteranRepresentativeContactDataSerializer, - status: :created - else - raise ActiveRecord::Rollback, 'Invalid flags present' - end - rescue ActiveRecord::Rollback - render json: { errors: flags.map(&:errors).reject(&:empty?) }, status: :unprocessable_entity - rescue ArgumentError => e - render json: { errors: { flag_type: [e.message] } }, status: :unprocessable_entity - end - end - - private - - def create_flags - FlaggedVeteranRepresentativeContactData.transaction do - params[:flags].map do |flag_data| - FlaggedVeteranRepresentativeContactData.new( - flag_data.permit(:flag_type, :flagged_value).merge( - ip_address: request.remote_ip, - representative_id: params[:representative_id] - ) - ) - end - end - end - - def feature_enabled - routing_error unless Flipper.enabled?(:find_a_representative_flag_results_enabled) - end - end - end -end diff --git a/modules/veteran/app/models/veteran/flagged_veteran_representative_contact_data.rb b/modules/veteran/app/models/veteran/flagged_veteran_representative_contact_data.rb deleted file mode 100644 index 2ae52229ef2..00000000000 --- a/modules/veteran/app/models/veteran/flagged_veteran_representative_contact_data.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module Veteran - class FlaggedVeteranRepresentativeContactData < ApplicationRecord - self.ignored_columns += ['flagged_value_updated'] - self.table_name = 'flagged_veteran_representative_contact_data' - - enum flag_type: { phone_number: 'phone_number', email: 'email', address: 'address', other: 'other' }, _suffix: true - validates :ip_address, :representative_id, :flag_type, :flagged_value, presence: true - validates :ip_address, - uniqueness: { scope: %i[representative_id flag_type flagged_value_updated_at], message: 'Combination of ip_address, representative_id, flag_type, and flagged_value_updated_at must be unique' } # rubocop:disable Rails/I18nLocaleTexts,Layout/LineLength - end -end diff --git a/modules/veteran/app/models/veteran/service/representative.rb b/modules/veteran/app/models/veteran/service/representative.rb index 98ad8d7d20e..4cfc2da6ad8 100644 --- a/modules/veteran/app/models/veteran/service/representative.rb +++ b/modules/veteran/app/models/veteran/service/representative.rb @@ -122,7 +122,7 @@ def set_full_name # # Compares rep's current info with new data to detect changes in address, email, or phone number. - # @param rep_data [Hash] New data with :email, :phone_number, and :request_address keys for comparison. + # @param rep_data [Hash] New data with :email, :phone_number, and :address keys for comparison. # # @return [Hash] Hash with "email_changed", "phone_number_changed", "address_changed" keys as booleans. def diff(rep_data) @@ -140,9 +140,9 @@ def diff(rep_data) # @return [Boolean] True if current address differs from `other_address`, false otherwise. def address_changed?(rep_data) address = [address_line1, address_line2, address_line3, city, zip_code, zip_suffix, state_code].join(' ') - other_address = rep_data[:request_address] + other_address = rep_data[:address] .values_at(:address_line1, :address_line2, :address_line3, :city, :zip_code5, :zip_code4) - .push(rep_data.dig(:request_address, :state_province, :code)) + .push(rep_data.dig(:address, :state_province, :code)) .join(' ') address != other_address end diff --git a/modules/veteran/app/serializers/veteran/flagged_veteran_representative_contact_data_serializer.rb b/modules/veteran/app/serializers/veteran/flagged_veteran_representative_contact_data_serializer.rb deleted file mode 100644 index 0e90e4af022..00000000000 --- a/modules/veteran/app/serializers/veteran/flagged_veteran_representative_contact_data_serializer.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module Veteran - class FlaggedVeteranRepresentativeContactDataSerializer < ActiveModel::Serializer - attributes :ip_address, :representative_id, :flag_type, :flagged_value - end -end diff --git a/modules/veteran/app/sidekiq/representatives/update.rb b/modules/veteran/app/sidekiq/representatives/update.rb index 386079b6a30..e7a4666e7b4 100644 --- a/modules/veteran/app/sidekiq/representatives/update.rb +++ b/modules/veteran/app/sidekiq/representatives/update.rb @@ -121,9 +121,10 @@ def update_flagged_records(rep_data) # @param representative_id [String] The ID of the representative. # @param flag_type [String] The type of change (address, email, or phone number). def update_flags(representative_id, flag_type) - Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id:, flag_type:, - flagged_value_updated_at: nil) - .update_all(flagged_value_updated_at: Time.zone.now) # rubocop:disable Rails/SkipsModelValidations + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id:, flag_type:, + flagged_value_updated_at: nil) + .update_all(flagged_value_updated_at: Time.zone.now) # rubocop:disable Rails/SkipsModelValidations rescue => e log_error("Error updating flagged records. Representative id: #{representative_id}. Flag type: #{flag_type}. Error message: #{e.message}") # rubocop:disable Layout/LineLength end diff --git a/modules/veteran/config/routes.rb b/modules/veteran/config/routes.rb index dd9ec43c348..c0fefd74aa6 100644 --- a/modules/veteran/config/routes.rb +++ b/modules/veteran/config/routes.rb @@ -6,7 +6,6 @@ get 'representatives/find_rep', to: 'representatives#find_rep' resources :vso_accredited_representatives, only: %i[index] resources :other_accredited_representatives, only: %i[index] - resources :flag_accredited_representatives, only: %i[create] get 'apidocs', to: 'apidocs#index' end end diff --git a/modules/veteran/spec/models/veteran/flagged_veteran_representative_contact_data_spec.rb b/modules/veteran/spec/models/veteran/flagged_veteran_representative_contact_data_spec.rb deleted file mode 100644 index 529b73d53b5..00000000000 --- a/modules/veteran/spec/models/veteran/flagged_veteran_representative_contact_data_spec.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Veteran::FlaggedVeteranRepresentativeContactData, type: :model do - describe 'validations' do - context 'ip_address' do - it 'is valid when ip_address is present' do - flag = described_class.new(ip_address: '192.168.1.1', representative_id: '1', flag_type: 'phone_number', - flagged_value: '1234567890') - expect(flag).to be_valid - end - - it 'is not valid when ip_address is missing' do - flag = described_class.new(ip_address: nil, representative_id: '1', flag_type: 'phone_number', - flagged_value: '1234567890') - expect(flag).not_to be_valid - expect(flag.errors[:ip_address]).to include("can't be blank") - end - end - - context 'representative_id' do - it 'is valid when representative_id is present' do - flag = described_class.new(ip_address: '192.168.1.1', representative_id: '1', flag_type: 'phone_number', - flagged_value: '1234567890') - expect(flag).to be_valid - end - - it 'is not valid when representative_id is missing' do - flag = described_class.new(ip_address: '192.168.1.1', representative_id: nil, flag_type: 'phone_number', - flagged_value: '1234567890') - expect(flag).not_to be_valid - expect(flag.errors[:representative_id]).to include("can't be blank") - end - end - - context 'flag_type' do - it 'is valid with a valid flag_type' do - %w[phone_number email address other].each do |flag_type| - flag = described_class.new(ip_address: '192.168.1.1', representative_id: '1', flag_type:, - flagged_value: "#{flag_type} value") - expect(flag).to be_valid - end - end - - it 'raises ArgumentError with an invalid flag_type' do - expect do - described_class.new(ip_address: '192.168.1.1', representative_id: '1', flag_type: 'invalid_type', - flagged_value: 'invalid_type value') - end.to raise_error(ArgumentError, /is not a valid flag_type/) - end - end - - context 'uniqueness' do - before do - described_class.create!(ip_address: '192.168.1.1', representative_id: '1', flag_type: 'email', - flagged_value: 'example@email.com') - end - - it 'is invalid when duplicating ip_address, representative_id, and flag_type of an existing record' do - duplicate = described_class.new(ip_address: '192.168.1.1', representative_id: '1', flag_type: 'email', - flagged_value: 'example@email.com') - expect(duplicate).not_to be_valid - end - - it 'is valid when changing only the ip_address while keeping representative_id and flag_type same' do - unique = described_class.new(ip_address: '192.168.1.2', representative_id: '1', flag_type: 'email', - flagged_value: 'example@email.com') - expect(unique).to be_valid - end - - it 'is valid when changing only the representative_id while keeping ip_address and flag_type same' do - unique = described_class.new(ip_address: '192.168.1.1', representative_id: '2', flag_type: 'email', - flagged_value: 'example@email.com') - expect(unique).to be_valid - end - - it 'is valid when changing only the flag_type while keeping ip_address and representative_id same' do - unique = described_class.new(ip_address: '192.168.1.1', representative_id: '1', flag_type: 'phone_number', - flagged_value: 'example@email.com') - expect(unique).to be_valid - end - end - end -end diff --git a/modules/veteran/spec/models/veteran/service/representative_spec.rb b/modules/veteran/spec/models/veteran/service/representative_spec.rb index 632552c36c3..0ed3407192a 100644 --- a/modules/veteran/spec/models/veteran/service/representative_spec.rb +++ b/modules/veteran/spec/models/veteran/service/representative_spec.rb @@ -154,7 +154,7 @@ def basic_attributes end let(:new_data) do { - request_address: { + address: { address_line1: '234 Main St', city: representative.city, zip_code5: representative.zip_code, @@ -182,7 +182,7 @@ def basic_attributes end let(:new_data) do { - request_address: { + address: { address_line1: representative.address_line1, city: representative.city, zip_code5: representative.zip_code, @@ -210,7 +210,7 @@ def basic_attributes end let(:new_data) do { - request_address: { + address: { address_line1: representative.address_line1, city: representative.city, zip_code5: representative.zip_code, @@ -241,7 +241,7 @@ def basic_attributes end let(:new_data) do { - request_address: { + address: { address_line1: representative.address_line1, city: representative.city, zip_code5: representative.zip_code, diff --git a/modules/veteran/spec/requests/v0/flag_accredited_representatives_spec.rb b/modules/veteran/spec/requests/v0/flag_accredited_representatives_spec.rb deleted file mode 100644 index d421d38438f..00000000000 --- a/modules/veteran/spec/requests/v0/flag_accredited_representatives_spec.rb +++ /dev/null @@ -1,135 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'FlagAccreditedRepresentativesController', csrf: false, type: :request do - describe 'POST #create' do - let(:base_path) { '/services/veteran/v0/flag_accredited_representatives' } - - context 'when submitting a single valid flag' do - let(:single_valid_flag_params) do - { - representative_id: '1', - flags: [{ flag_type: 'email', flagged_value: 'example@email.com' }] - } - end - - it 'successfully creates a FlaggedVeteranRepresentativeContactData record' do - expect { post base_path, params: single_valid_flag_params } - .to change(Veteran::FlaggedVeteranRepresentativeContactData, :count).by(1) - end - - it 'responds with a created status' do - post base_path, params: single_valid_flag_params - expect(response).to have_http_status(:created) - end - - it 'returns the correct serialized data' do - post base_path, params: single_valid_flag_params - json_response_data = JSON.parse(response.body)['data'] - expect(json_response_data).to be_an(Array) - - flag_object = json_response_data.first - expect(flag_object).to include('id', 'type', 'attributes') - - flag_object_attributes = flag_object['attributes'] - expect(flag_object_attributes).to include('ip_address', 'representative_id', 'flag_type', - 'flagged_value') - expect(flag_object_attributes['representative_id']).to eq('1') - expect(flag_object_attributes['flag_type']).to eq('email') - expect(flag_object_attributes['flagged_value']).to eq('example@email.com') - end - end - - context 'when submitting multiple valid flags' do - let(:multiple_valid_flags_params) do - { - representative_id: '1', - flags: [ - { flag_type: 'email', flagged_value: 'example1@email.com' }, - { flag_type: 'phone_number', flagged_value: '1234567890' } - ] - } - end - - it 'successfully creates multiple FlaggedVeteranRepresentativeContactData records' do - expect { post base_path, params: multiple_valid_flags_params } - .to change(Veteran::FlaggedVeteranRepresentativeContactData, :count).by(2) - end - - it 'responds with a created status for multiple flags' do - post base_path, params: multiple_valid_flags_params - expect(response).to have_http_status(:created) - end - - it 'returns the correct serialized data for multiple flags' do - post base_path, params: multiple_valid_flags_params - json_response_data = JSON.parse(response.body)['data'] - - expect(json_response_data).to be_an(Array) - expect(json_response_data.length).to eq(2) - expect(json_response_data[0]['attributes']['flag_type']).to eq('email') - expect(json_response_data[1]['attributes']['flag_type']).to eq('phone_number') - end - end - - context 'when submitting invalid flags' do - let(:invalid_flags_params) do - { - representative_id: nil, - flags: [{ flag_type: 'invalid_type', flagged_value: 'example@email.com' }] - } - end - - it 'does not create any FlaggedVeteranRepresentativeContactData records' do - expect { post base_path, params: invalid_flags_params } - .not_to change(Veteran::FlaggedVeteranRepresentativeContactData, :count) - end - - it 'responds with an unprocessable entity status' do - post base_path, params: invalid_flags_params - expect(response).to have_http_status(:unprocessable_entity) - end - - it 'returns appropriate error messages' do - post base_path, params: invalid_flags_params - json_response = JSON.parse(response.body) - - expect(json_response).to have_key('errors') - expect(json_response['errors']['flag_type']).to be_an(Array) - expect(json_response['errors']['flag_type'].first).to include('is not a valid flag_type') - end - end - - context 'when submitting a mix of valid and invalid flags' do - let(:mixed_valid_and_invalid_flags_params) do - { - representative_id: '1', - flags: [ - { flag_type: 'email', flagged_value: 'valid@email.com' }, - { flag_type: 'invalid_type', flagged_value: 'invalid@example.com' } - ] - } - end - - it 'does not create any FlaggedVeteranRepresentativeContactData records' do - expect { post base_path, params: mixed_valid_and_invalid_flags_params } - .not_to change(Veteran::FlaggedVeteranRepresentativeContactData, :count) - end - - it 'responds with an unprocessable entity status' do - post base_path, params: mixed_valid_and_invalid_flags_params - expect(response).to have_http_status(:unprocessable_entity) - end - - it 'returns appropriate error messages for mixed valid and invalid flags' do - post base_path, params: mixed_valid_and_invalid_flags_params - json_response = JSON.parse(response.body) - - expect(json_response).to have_key('errors') - expect(json_response['errors']['flag_type']).to be_an(Array) - expect(json_response['errors']['flag_type'].first).to include('is not a valid flag_type') - end - end - end -end diff --git a/modules/veteran/spec/sidekiq/representatives/queue_updates_spec.rb b/modules/veteran/spec/sidekiq/representatives/queue_updates_spec.rb index 5c6d179d70d..deb104a9879 100644 --- a/modules/veteran/spec/sidekiq/representatives/queue_updates_spec.rb +++ b/modules/veteran/spec/sidekiq/representatives/queue_updates_spec.rb @@ -19,9 +19,9 @@ let(:file_content) { 'dummy file content' } let(:processed_data) do { - 'Agents' => [{ id: '123', request_address: {}, phone_number: '123-456-7890' }], - 'Attorneys' => [{ id: '234', request_address: {}, phone_number: '123-456-7890' }], - 'Representatives' => [{ id: '345', request_address: {}, phone_number: '123-456-7890' }] + 'Agents' => [{ id: '123', address: {}, phone_number: '123-456-7890' }], + 'Attorneys' => [{ id: '234', address: {}, phone_number: '123-456-7890' }], + 'Representatives' => [{ id: '345', address: {}, phone_number: '123-456-7890' }] } end diff --git a/modules/veteran/spec/sidekiq/representatives/update_spec.rb b/modules/veteran/spec/sidekiq/representatives/update_spec.rb index 86e7c7d85fb..30871abd522 100644 --- a/modules/veteran/spec/sidekiq/representatives/update_spec.rb +++ b/modules/veteran/spec/sidekiq/representatives/update_spec.rb @@ -18,8 +18,9 @@ end it "updates the #{flag_type} and the associated flagged records" do - flagged_records = Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id: id, - flag_type:) + flagged_records = + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id: id, flag_type:) flagged_records.each do |record| expect(record.flagged_value_updated_at).to be_nil @@ -51,8 +52,9 @@ end it "does not update the #{flag_type} or the associated flagged records" do - flagged_records = Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id: id, - flag_type:) + flagged_records = + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id: id, flag_type:) flagged_records.each do |record| expect(record.flagged_value_updated_at).to be_nil @@ -100,7 +102,7 @@ def create_representative def create_flagged_records(flag_type) 2.times do |n| - Veteran::FlaggedVeteranRepresentativeContactData.create( + RepresentationManagement::FlaggedVeteranRepresentativeContactData.create( ip_address: "192.168.1.#{n + 1}", representative_id: '123abc', flag_type:, @@ -223,8 +225,9 @@ def create_flagged_records(flag_type) end it 'updates the address and the associated flagged records' do - flagged_records = Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id: id, - flag_type: 'address') + flagged_records = + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id: id, flag_type: 'address') flagged_records.each do |record| expect(record.flagged_value_updated_at).to be_nil @@ -255,8 +258,9 @@ def create_flagged_records(flag_type) end it 'updates the address and the associated flagged records' do - flagged_records = Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id: id, - flag_type: 'address') + flagged_records = + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id: id, flag_type: 'address') flagged_records.each do |record| expect(record.flagged_value_updated_at).to be_nil @@ -287,10 +291,12 @@ def create_flagged_records(flag_type) end it 'updates the address and email and the associated flagged records' do - flagged_address_records = Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id: id, - flag_type: 'address') - flagged_email_records = Veteran::FlaggedVeteranRepresentativeContactData.where(representative_id: id, - flag_type: 'email') + flagged_address_records = + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id: id, flag_type: 'address') + flagged_email_records = + RepresentationManagement::FlaggedVeteranRepresentativeContactData + .where(representative_id: id, flag_type: 'email') flagged_email_records.each do |record| expect(record.flagged_value_updated_at).to be_nil end diff --git a/spec/controllers/v0/rated_disabilities_controller_spec.rb b/spec/controllers/v0/rated_disabilities_controller_spec.rb index ac91265e112..f6c036248cc 100644 --- a/spec/controllers/v0/rated_disabilities_controller_spec.rb +++ b/spec/controllers/v0/rated_disabilities_controller_spec.rb @@ -24,16 +24,27 @@ end it 'only returns active ratings' do + VCR.use_cassette('lighthouse/veteran_verification/disability_rating/200_inactives_response') do + get(:show) + end + + expect(response).to have_http_status(:ok) + + # VCR Cassette should have 5 items in the individual_ratings array, only 4 should + # be "active" (1 of which should have a `rating_end_date` in the future) + parsed_body = JSON.parse(response.body) + expect(parsed_body.dig('data', 'attributes', 'individual_ratings').length).to eq(4) + end + + it 'removes the Veterans ICN from the response before sending' do VCR.use_cassette('lighthouse/veteran_verification/show/200_response') do get(:show) end expect(response).to have_http_status(:ok) - # VCR Cassette should have 3 items in the individual_ratings array, only 2 should - # be "active" parsed_body = JSON.parse(response.body) - expect(parsed_body.dig('data', 'attributes', 'individual_ratings').length).to eq(2) + expect(parsed_body.dig('data', 'id')).to eq('') end end diff --git a/spec/controllers/v1/post911_gi_bill_statuses_controller_spec.rb b/spec/controllers/v1/post911_gi_bill_statuses_controller_spec.rb new file mode 100644 index 00000000000..9a0e85e0105 --- /dev/null +++ b/spec/controllers/v1/post911_gi_bill_statuses_controller_spec.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'lighthouse/benefits_education/service' +require 'lighthouse/benefits_education/outside_working_hours' + +RSpec.describe V1::Post911GIBillStatusesController, type: :controller do + let(:user) { FactoryBot.create(:user, :loa3, icn: '1000000000V100000') } + let(:once) { { times: 1, value: 1 } } + let(:tz) { ActiveSupport::TimeZone.new(BenefitsEducation::Service::OPERATING_ZONE) } + let(:noon) { tz.parse('1st Feb 2018 12:00:00') } + + before { sign_in_as(user) } + + context 'inside working hours' do + before do + allow(BenefitsEducation::Service).to receive(:within_scheduled_uptime?).and_return(true) + end + + it 'returns a 200 success' do + # valid icn retrieved from + # https://github.com/department-of-veterans-affairs/vets-api-clients/blob/master/test_accounts/benefits_test_accounts.md + # 001 Tamara E Ellis F 6/19/67 796130115 1012667145V762142 + valid_user = FactoryBot.create(:user, :loa3, icn: '1012667145V762142') + sign_in_as(valid_user) + + VCR.use_cassette('lighthouse/benefits_education/gi_bill_status/200_response') do + expect(StatsD).to receive(:increment).with(V1::Post911GIBillStatusesController::STATSD_GI_BILL_TOTAL_KEY) + get :show + end + + expect(response).to have_http_status(:ok) + response_body = JSON.parse(response.body) + + # assertions that the data returned will not be empty strings + expect(response_body['first_name']).not_to be_empty + expect(response_body['last_name']).not_to be_empty + expect(response_body['date_of_birth']).not_to be_empty + expect(response_body['delimiting_date']).not_to be_empty + expect(response_body['eligibility_date']).not_to be_empty + expect(response_body['enrollments'][0]['begin_date']).not_to be_empty + expect(response_body['enrollments'][0]['end_date']).not_to be_empty + end + + it 'returns a 404 when vet isn\'t found' do + VCR.use_cassette('lighthouse/benefits_education/gi_bill_status/404_response') do + expect(StatsD).to receive(:increment).with(V1::Post911GIBillStatusesController::STATSD_GI_BILL_FAIL_KEY, + tags: ['error:404']) + expect(StatsD).to receive(:increment).with(V1::Post911GIBillStatusesController::STATSD_GI_BILL_TOTAL_KEY) + expect do + get :show + end.to change(PersonalInformationLog, :count) + end + + expect(response).to have_http_status(:not_found) + json_response = JSON.parse(response.body) + expect(json_response['error']['title']).to eq('Not Found') + expect(json_response['error']['detail']).to eq('Icn not found.') + end + end + + context 'outside working hours' do + # midnight + before { Timecop.freeze(tz.parse('2nd Feb 1993 00:00:00')) } + after { Timecop.return } + + it 'returns 503' do + get :show + expect(response).to have_http_status(:service_unavailable) + end + + it 'includes a Retry-After header' do + get :show + expect(response.headers).to include('Retry-After') + end + + it 'ignores OutsideWorkingHours exception' do + expect(Sentry).not_to receive(:capture_message) + get :show + end + end +end diff --git a/spec/fixtures/pdf_fill/21P-527EZ/kitchen_sink.json b/spec/fixtures/pdf_fill/21P-527EZ/kitchen_sink.json deleted file mode 100644 index 3897e8b227b..00000000000 --- a/spec/fixtures/pdf_fill/21P-527EZ/kitchen_sink.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "veteranFullName": { - "first": "John", - "middle": "Edmund", - "last": "Doe", - "suffix": "Sr." - }, - "veteranSocialSecurityNumber": "333224444", - "vaClaimsHistory": true, - "vaFileNumber": "12345678", - "veteranDateOfBirth": "1960-01-01", - "serviceBranch": { - "army": true, - "navy": true - }, - "activeServiceDateRange": { - "from": "2003-03-02", - "to": "2007-03-20" - }, - "serviceNumber": "123456", - "serveUnderOtherNames": true, - "previousNames": [ - { - "previousFullName": { - "first": "Joseph", - "last": "Doe" - } - } - ], - "placeOfSeparation": "West Brookfield, MA", - "powStatus": true, - "powDateRange": { - "from": "1971-02-26", - "to": "1973-03-02" - }, - "socialSecurityDisability": false, - "medicalCondition": false, - "nursingHome": true, - "medicaidCoverage": false, - "medicaidStatus": true, - "specialMonthlyPension": false, - "vaTreatmentHistory": true, - "vaMedicalCenters": [ - { - "medicalCenter": "Dallas VA Medical Center" - } - ], - "federalTreatmentHistory": true, - "federalMedicalCenters": [ - { - "medicalCenter": "Memphis Health Care" - } - ], - "currentEmployment": true, - "currentEmployers": [ - { - "jobType": "Customer service", - "jobHoursWeek": 20, - "jobTitle": "Manager" - } - ], - "maritalStatus": "SEPARATED", - "marriages": [ - { - "spouseFullName": { - "first": "Jessica", - "middle": "Middle", - "last": "Doe" - }, - "reasonForSeparation": "OTHER", - "otherExplanation": "Other reason", - "dateOfMarriage": "1989-03-02", - "dateOfSeparation": "1990-03-02", - "locationOfMarriage": "Dallas", - "locationOfSeparation": "San Antonio, TX" - }, - { - "spouseFullName": { - "first": "Jane", - "middle": "Middle", - "last": "Doe" - }, - "reasonForSeparation": "DEATH", - "dateOfMarriage": "1989-03-02", - "dateOfSeparation": "1990-03-02", - "locationOfMarriage": "Dallas", - "locationOfSeparation": "San Antonio, TX" - }, - { - "spouseFullName": { - "first": "Meg", - "middle": "Middle", - "last": "Doe" - }, - "dateOfMarriage": "1994-03-02", - "locationOfMarriage": "North Adams, MA", - "marriageType": "OTHER", - "otherExplanation": "Other reason" - } - ], - "spouseDateOfBirth": "1960-01-01", - "spouseSocialSecurityNumber": "333224444", - "spouseIsVeteran": true, - "spouseVaFileNumber": "23423444", - "spouseAddress": { - "street": "123 7th st", - "street2": "Apt 3", - "city": "Pittsfield", - "country": "USA", - "state": "MA", - "postalCode": "01050" - }, - "reasonForCurrentSeparation": "OTHER", - "otherExplanation": "Personal reason", - "currentSpouseMonthlySupport": 2444, - "currentSpouseMaritalHistory": "YES", - "spouseMarriages": [ - { - "dateOfMarriage": "1980-03-02", - "locationOfMarriage": "Seattle, WA", - "spouseFullName": { - "first": "Joe", - "middle": "F", - "last": "Generic", - "suffix": "Jr." - }, - "reasonForSeparation": "DEATH", - "dateOfSeparation": "1990-03-02", - "locationOfSeparation": "Tacoma, WA" - }, - { - "dateOfMarriage": "1995-03-02", - "locationOfMarriage": "Seattle, WA", - "spouseFullName": { - "first": "John", - "middle": "F", - "last": "Person", - "suffix": "Jr." - }, - "reasonForSeparation": "OTHER", - "otherExplanation": "Other reason", - "dateOfSeparation": "2005-03-02", - "locationOfSeparation": "Tacoma, WA" - } - ], - "dependents": [ - { - "childInHousehold": false, - "childAddress": { - "street": "123 8th st", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050" - }, - "personWhoLivesWithChild": { - "first": "Joe", - "middle": "Middle", - "last": "Smith" - }, - "monthlyPayment": 3444, - "childPlaceOfBirth": "Tallahassee, FL", - "childSocialSecurityNumber": "333224444", - "childRelationship": "BIOLOGICAL", - "previouslyMarried": true, - "married": true, - "fullName": { - "first": "Emily", - "middle": "Anne", - "last": "Doe" - }, - "childDateOfBirth": "2000-03-03" - }, - { - "childInHousehold": true, - "childPlaceOfBirth": "Troy, MT", - "childSocialSecurityNumber": "333224444", - "childRelationship": "ADOPTED", - "previouslyMarried": false, - "attendingCollege": true, - "fullName": { - "first": "Bobby", - "middle": "Nolan", - "last": "Doe" - }, - "childDateOfBirth": "2005-09-22" - }, - { - "childInHousehold": true, - "childAddress": { - "street": "123 8th st", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050" - }, - "monthlyPayment": 2300, - "childPlaceOfBirth": "Troy, MT", - "childSocialSecurityNumber": "333224444", - "childRelationship": "BIOLOGICAL", - "previouslyMarried": false, - "disabled": true, - "fullName": { - "first": "Jack", - "middle": "Sawyer", - "last": "Doe" - }, - "childDateOfBirth": "2010-04-01" - } - ], - "totalNetWorth": false, - "netWorthEstimation": 1550, - "hasCareExpenses": true, - "careExpenses": [ - { - "recipients": "VETERAN", - "provider": "NYC Care Provider", - "careType": "CARE_FACILITY", - "ratePerHour": 100, - "hoursPerWeek": 20, - "careDateRange": { - "from": "2020-08-01", - "to": "2023-05-25" - }, - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 2500 - }, - { - "recipients": "SPOUSE", - "provider": "MA Care Provider", - "careType": "IN_HOME_CARE_PROVIDER", - "ratePerHour": 150, - "hoursPerWeek": 15, - "careDateRange": { - "from": "2021-08-01", - "to": "2022-05-25" - }, - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 1500 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "LA Care Provider", - "careType": "CARE_FACILITY", - "ratePerHour": 200, - "hoursPerWeek": 10, - "careDateRange": { - "from": "2020-08-01" - }, - "noCareEndDate": true, - "paymentFrequency": "ONCE_YEAR", - "paymentAmount": 22500 - } - ], - "hasMedicalExpenses": true, - "medicalExpenses": [ - { - "recipients": "VETERAN", - "provider": "Funeral Home", - "purpose": "Burial expenses", - "paymentDate": "2020-03-15", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 10000 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 10000 - }, - { - "recipients": "SPOUSE", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 500 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONCE_YEAR", - "paymentAmount": 5000 - }, - { - "recipients": "SPOUSE", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 200 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "Health Provider", - "purpose": "Medical fee", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 100 - } - ], - "transferredAssets": true, - "homeOwnership": true, - "homeAcreageMoreThanTwo": true, - "homeAcreageValue": 75000, - "landMarketable": true, - "receivesIncome": true, - "incomeSources": [ - { - "typeOfIncome": "SOCIAL_SECURITY", - "receiver": "DEPENDENT", - "dependentName": "Bobby Doe", - "payer": "John Doe", - "amount": 278.05 - }, - { - "typeOfIncome": "INTEREST_DIVIDEND", - "receiver": "VETERAN", - "payer": "John Doe", - "amount": 78.5 - }, - { - "typeOfIncome": "OTHER", - "otherTypeExplanation": "part-time Uber", - "receiver": "SPOUSE", - "payer": "John Doe", - "amount": 278.99 - }, - { - "typeOfIncome": "OTHER", - "otherTypeExplanation": "full time job", - "receiver": "VETERAN", - "payer": "John Doe", - "amount": 3278.75 - } - ], - "bankAccount": { - "accountType": "checking", - "bankName": "Best Bank", - "accountNumber": "001122334455", - "routingNumber": "123123123" - }, - "veteranAddress": { - "street": "123 8th st", - "street2": "A-3", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050", - "isMilitary": false - }, - "email": "test@example.com", - "phone": "5551234567", - "mobilePhone": "5551234567", - "internationalPhone": "001-555-123-4567", - "isOver65": false, - "noRapidProcessing": true, - "statementOfTruthCertified": true, - "statementOfTruthSignature": "John Edmund Doe" -} \ No newline at end of file diff --git a/spec/fixtures/pdf_fill/21P-527EZ/overflow.json b/spec/fixtures/pdf_fill/21P-527EZ/overflow.json deleted file mode 100644 index 47286655c86..00000000000 --- a/spec/fixtures/pdf_fill/21P-527EZ/overflow.json +++ /dev/null @@ -1,443 +0,0 @@ -{ - "veteranFullName": { - "first": "John", - "middle": "Edmund", - "last": "Doe", - "suffix": "Sr." - }, - "veteranSocialSecurityNumber": "333224444", - "vaClaimsHistory": true, - "vaFileNumber": "12345678", - "veteranDateOfBirth": "1960-01-01", - "serviceBranch": { - "army": true, - "navy": true - }, - "activeServiceDateRange": { - "from": "2003-03-02", - "to": "2007-03-20" - }, - "serviceNumber": "123456", - "serveUnderOtherNames": true, - "previousNames": [ - { - "previousFullName": { - "first": "Joseph", - "last": "Doe" - } - }, - { - "previousFullName": { - "first": "Jarrod", - "last": "Doe" - } - } - ], - "placeOfSeparation": "West Brookfield, MA", - "powStatus": true, - "powDateRange": { - "from": "1971-02-26", - "to": "1973-03-02" - }, - "socialSecurityDisability": false, - "medicalCondition": false, - "nursingHome": true, - "medicaidCoverage": false, - "medicaidStatus": true, - "specialMonthlyPension": false, - "vaTreatmentHistory": true, - "vaMedicalCenters": [ - { - "medicalCenter": "Dallas Fort Worth VA Medical Center" - } - ], - "federalTreatmentHistory": true, - "federalMedicalCenters": [ - { - "medicalCenter": "Memphis Health Care" - }, - { - "medicalCenter": "Nashville Health Care" - } - ], - "currentEmployment": true, - "currentEmployers": [ - { - "jobType": "Customer service", - "jobHoursWeek": 20, - "jobTitle": "Manager" - }, - { - "jobType": "Customer service", - "jobHoursWeek": 20, - "jobTitle": "Representative" - } - ], - "maritalStatus": "SEPARATED", - "marriages": [ - { - "spouseFullName": { - "first": "Jessica", - "middle": "Middle", - "last": "Doe" - }, - "dateOfMarriage": "1989-03-02", - "locationOfMarriage": "Dallas", - "reasonForSeparation": "OTHER", - "otherExplanation": "Personal reason thats too long to write an explanation for in this form field", - "dateOfSeparation": "1990-03-02", - "locationOfSeparation": "San Antonio, TX" - }, - { - "spouseFullName": { - "first": "Jane", - "middle": "Middle", - "last": "Doe" - }, - "dateOfMarriage": "1989-03-02", - "locationOfMarriage": "Dallas", - "reasonForSeparation": "DEATH", - "dateOfSeparation": "1990-03-02", - "locationOfSeparation": "San Antonio, TX" - }, - { - "spouseFullName": { - "first": "Jenniebenniefofenny", - "middle": "Middle", - "last": "Danedanedanedanedanedanedane" - }, - "dateOfMarriage": "1983-03-02", - "locationOfMarriage": "Dallas", - "reasonForSeparation": "DIVORCE", - "dateOfSeparation": "1984-03-02", - "locationOfSeparation": "San Antonio, TX" - }, - { - "spouseFullName": { - "first": "Jill", - "middle": "Middle", - "last": "Doe" - }, - "dateOfMarriage": "1999-10-02", - "locationOfMarriage": "Nashville, TN", - "reasonForSeparation": "DIVORCE", - "dateOfSeparation": "2001-03-02", - "locationOfSeparation": "San Antonio, TX" - }, - { - "spouseFullName": { - "first": "Meg", - "middle": "Middle", - "last": "Doe" - }, - "dateOfMarriage": "1994-03-02", - "locationOfMarriage": "North Adams, MA", - "marriageType": "OTHER", - "otherExplanation": "Other reason" - } - ], - "spouseDateOfBirth": "1960-01-01", - "spouseSocialSecurityNumber": "333224444", - "spouseIsVeteran": true, - "spouseVaFileNumber": "23423444", - "spouseAddress": { - "street": "123 7th st", - "street2": "Apt 3", - "city": "Pittsfield", - "country": "USA", - "state": "MA", - "postalCode": "01050" - }, - "reasonForCurrentSeparation": "OTHER", - "otherExplanation": "Personal reason thats too long to write an explanation for in this form field", - "currentSpouseMonthlySupport": 2444, - "currentSpouseMaritalHistory": "YES", - "spouseMarriages": [ - { - "dateOfMarriage": "1980-03-02", - "locationOfMarriage": "Seattle, WA", - "spouseFullName": { - "first": "Joe", - "middle": "F", - "last": "Generic", - "suffix": "Jr." - }, - "reasonForSeparation": "OTHER", - "otherExplanation": "Other reason thats too long to write an explanation for in this form field", - "dateOfSeparation": "1990-03-02", - "locationOfSeparation": "Tacoma, WA" - }, - { - "dateOfMarriage": "1995-03-02", - "locationOfMarriage": "Seattle, WA", - "spouseFullName": { - "first": "John", - "middle": "F", - "last": "Person", - "suffix": "Jr." - }, - "reasonForSeparation": "OTHER", - "otherExplanation": "Other reason", - "dateOfSeparation": "2005-03-02", - "locationOfSeparation": "Tacoma, WA" - } - ], - "dependents": [ - { - "childInHousehold": false, - "childAddress": { - "street": "123 8th st", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050" - }, - "personWhoLivesWithChild": { - "first": "Joe", - "middle": "Middle", - "last": "Smith" - }, - "monthlyPayment": 3444, - "childPlaceOfBirth": "Tallahassee, FL", - "childSocialSecurityNumber": "333224444", - "childRelationship": "BIOLOGICAL", - "previouslyMarried": true, - "married": true, - "fullName": { - "first": "Emily", - "middle": "Anne", - "last": "Doe" - }, - "childDateOfBirth": "2000-03-03" - }, - { - "childInHousehold": true, - "childPlaceOfBirth": "Troy, MT", - "childSocialSecurityNumber": "333224444", - "childRelationship": "ADOPTED", - "previouslyMarried": false, - "attendingCollege": true, - "fullName": { - "first": "Bobby", - "middle": "Nolan", - "last": "Doe" - }, - "childDateOfBirth": "2005-09-22" - }, - { - "childInHousehold": true, - "childAddress": { - "street": "123 8th st", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050" - }, - "monthlyPayment": 2300, - "childPlaceOfBirth": "Troy, MT", - "childSocialSecurityNumber": "333224444", - "childRelationship": "BIOLOGICAL", - "previouslyMarried": false, - "disabled": true, - "fullName": { - "first": "Jack", - "middle": "Sawyer", - "last": "Doe" - }, - "childDateOfBirth": "2010-04-01" - }, - { - "childInHousehold": true, - "childAddress": { - "street": "123 8th st", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050" - }, - "monthlyPayment": 3300, - "childPlaceOfBirth": "Portland, ME", - "childSocialSecurityNumber": "122222222", - "childRelationship": "ADOPTED", - "previouslyMarried": false, - "disabled": false, - "fullName": { - "first": "Sam", - "middle": "Jason", - "last": "Doe" - }, - "childDateOfBirth": "2020-06-29" - } - ], - "totalNetWorth": false, - "netWorthEstimation": 1550, - "hasCareExpenses": true, - "careExpenses": [ - { - "recipients": "VETERAN", - "provider": "NYC Care Provider Family Medical Facility", - "careType": "CARE_FACILITY", - "ratePerHour": 100, - "hoursPerWeek": 20, - "careDateRange": { - "from": "2020-08-01", - "to": "2023-05-25" - }, - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 2500 - }, - { - "recipients": "SPOUSE", - "provider": "MA Care Provider", - "careType": "IN_HOME_CARE_PROVIDER", - "ratePerHour": 150, - "hoursPerWeek": 15, - "careDateRange": { - "from": "2021-08-01", - "to": "2022-05-25" - }, - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 1500 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "LA Care Provider", - "careType": "CARE_FACILITY", - "ratePerHour": 200, - "hoursPerWeek": 10, - "careDateRange": { - "from": "2020-08-01" - }, - "noCareEndDate": true, - "paymentFrequency": "ONCE_YEAR", - "paymentAmount": 22500 - } - ], - "hasMedicalExpenses": true, - "medicalExpenses": [ - { - "recipients": "VETERAN", - "provider": "Funeral Home", - "purpose": "Burial expenses", - "paymentDate": "2020-03-15", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 10000 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 10000 - }, - { - "recipients": "SPOUSE", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 500 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONCE_YEAR", - "paymentAmount": 5000 - }, - { - "recipients": "SPOUSE", - "provider": "Health Provider", - "purpose": "Medical expenses", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONCE_MONTH", - "paymentAmount": 200 - }, - { - "recipients": "DEPENDENT", - "childName": "Joe Doe", - "provider": "Health Provider", - "purpose": "Medical fee", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 100 - }, - { - "recipients": "DEPENDENT", - "childName": "Jack Doe", - "provider": "Health Provider", - "purpose": "Medical fee", - "paymentDate": "2023-07-01", - "paymentFrequency": "ONE_TIME", - "paymentAmount": 150 - } - ], - "transferredAssets": true, - "homeOwnership": true, - "homeAcreageMoreThanTwo": true, - "homeAcreageValue": 75000, - "landMarketable": true, - "receivesIncome": true, - "incomeSources": [ - { - "typeOfIncome": "SOCIAL_SECURITY", - "receiver": "VETERAN", - "payer": "John Doe", - "amount": 278.05 - }, - { - "typeOfIncome": "INTEREST_DIVIDEND", - "receiver": "VETERAN", - "payer": "John Doe", - "amount": 78.5 - }, - { - "typeOfIncome": "OTHER", - "otherTypeExplanation": "part-time Uber", - "receiver": "SPOUSE", - "payer": "John Doe", - "amount": 278.99 - }, - { - "typeOfIncome": "OTHER", - "otherTypeExplanation": "full time job", - "receiver": "SPOUSE", - "payer": "John Doe", - "amount": 3278.75 - }, - { - "typeOfIncome": "PENSION_RETIREMENT", - "receiver": "VETERAN", - "payer": "John Doe", - "amount": 55.27 - } - ], - "bankAccount": { - "accountType": "checking", - "bankName": "Best Bank", - "accountNumber": "001122334455", - "routingNumber": "123123123" - }, - "veteranAddress": { - "street": "123 8th st", - "street2": "A-3", - "city": "ThisIsAReallyLongCityName", - "country": "USA", - "state": "ME", - "postalCode": "01050", - "isMilitary": false - }, - "email": "test@example.com", - "phone": "5551234567", - "mobilePhone": "5551234567", - "internationalPhone": "001-555-123-4567-8910", - "isOver65": false, - "noRapidProcessing": true, - "statementOfTruthCertified": true, - "statementOfTruthSignature": "John Edmund Doe" -} \ No newline at end of file diff --git a/spec/fixtures/pdf_fill/21P-527EZ/simple.json b/spec/fixtures/pdf_fill/21P-527EZ/simple.json deleted file mode 100644 index b2cce155c0f..00000000000 --- a/spec/fixtures/pdf_fill/21P-527EZ/simple.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "veteranFullName": { - "first": "John", - "middle": "", - "last": "Doe", - "suffix": "Sr." - }, - "veteranSocialSecurityNumber": "333224444", - "vaClaimsHistory": false, - "veteranDateOfBirth": "1960-01-01", - "serviceBranch": { - "army": true - }, - "activeServiceDateRange": { - "from": "2003-03-02", - "to": "2007-03-20" - }, - "serviceNumber": "123456", - "serveUnderOtherNames": false, - "placeOfSeparation": "Westbrook, MA", - "powStatus": false, - "socialSecurityDisability": true, - "medicalCondition": false, - "nursingHome": false, - "specialMonthlyPension": false, - "vaTreatmentHistory": false, - "federalTreatmentHistory": false, - "currentEmployment": false, - "previousEmployers": [ - { - "jobDate": "2020-06-15", - "jobType": "Customer service", - "jobHoursWeek": 20, - "jobTitle": "Manager" - } - ], - "maritalStatus": "NEVER_MARRIED", - "totalNetWorth": true, - "hasCareExpenses": false, - "hasMedicalExpenses": false, - "transferredAssets": false, - "homeOwnership": false, - "receivesIncome": false, - "veteranAddress": { - "street": "123 8th st", - "city": "Hadley", - "country": "USA", - "state": "ME", - "postalCode": "01050", - "isMilitary": false - }, - "email": "test@example.com", - "mobilePhone": "5551234567", - "isOver65": false, - "noRapidProcessing": true, - "statementOfTruthCertified": true, - "statementOfTruthSignature": "John Doe" -} \ No newline at end of file diff --git a/spec/lib/lighthouse/benefits_education/service_spec.rb b/spec/lib/lighthouse/benefits_education/service_spec.rb index 57e9cdeac55..5cf5095e0da 100644 --- a/spec/lib/lighthouse/benefits_education/service_spec.rb +++ b/spec/lib/lighthouse/benefits_education/service_spec.rb @@ -33,7 +33,12 @@ # https://developer.va.gov/explore/api/education-benefits VCR.use_cassette('lighthouse/benefits_education/200_response') do response = @service.get_gi_bill_status - expect(response.body.keys).to include 'chapter33EducationInfo' + json_response = JSON.parse(response) + + # assertions that the data returned will match our test user + expect(json_response['first_name']).to eq('Tamara') + expect(json_response['last_name']).to eq('Ellis') + expect(json_response['date_of_birth']).to start_with('1967-06-19') end end end diff --git a/spec/lib/pdf_fill/filler_spec.rb b/spec/lib/pdf_fill/filler_spec.rb index e594d111de8..dfe1f8f7527 100644 --- a/spec/lib/pdf_fill/filler_spec.rb +++ b/spec/lib/pdf_fill/filler_spec.rb @@ -51,7 +51,8 @@ }, { form_id: '21P-527EZ', - factory: :pension_claim + factory: :pension_claim, + use_vets_json_schema: true }, { form_id: '10-10CG', @@ -83,7 +84,12 @@ context "with #{type} test data" do let(:input_data_fixture_dir) { options[:input_data_fixture_dir] || "pdf_fill/#{form_id}" } let(:output_pdf_fixture_dir) { options[:output_pdf_fixture_dir] || "pdf_fill/#{form_id}" } - let(:form_data) { get_fixture("#{input_data_fixture_dir}/#{type}") } + let(:form_data) do + return get_fixture("#{input_data_fixture_dir}/#{type}") unless options[:use_vets_json_schema] + + schema = "#{form_id.upcase}-#{type.upcase}" + VetsJsonSchema::EXAMPLES.fetch(schema) + end let(:saved_claim) { create(factory, form: form_data.to_json) } it 'fills the form correctly' do diff --git a/spec/lib/pdf_fill/forms/va21p527ez_spec.rb b/spec/lib/pdf_fill/forms/va21p527ez_spec.rb index 43a38053567..9c67d305b0a 100644 --- a/spec/lib/pdf_fill/forms/va21p527ez_spec.rb +++ b/spec/lib/pdf_fill/forms/va21p527ez_spec.rb @@ -11,7 +11,7 @@ def basic_class include SchemaMatchers let(:form_data) do - get_fixture('pdf_fill/21P-527EZ/kitchen_sink') + VetsJsonSchema::EXAMPLES.fetch('21P-527EZ-KITCHEN_SINK') end describe '#merge_fields' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e399361b471..d6db6b106c8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -189,16 +189,6 @@ ActionController::Base.allow_forgery_protection = @original_allow_forgery_protection end - # Disable CSRF protection for FlagAccreditedRepresentativesController specs in the Veteran module - config.before(:each, csrf: false) do - ActionController::Base.allow_forgery_protection = false - end - - # Enable CSRF protection for FlagAccreditedRepresentativesController specs in the Veteran module - config.after(:each, csrf: false) do - ActionController::Base.allow_forgery_protection = true - end - config.after do Timecop.return end diff --git a/spec/support/vcr_cassettes/lighthouse/benefits_education/gi_bill_status/200_response.yml b/spec/support/vcr_cassettes/lighthouse/benefits_education/gi_bill_status/200_response.yml new file mode 100644 index 00000000000..8a36f01685f --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/benefits_education/gi_bill_status/200_response.yml @@ -0,0 +1,103 @@ +--- +http_interactions: +- request: + method: post + uri: https://sandbox-api.va.gov/oauth2/benefits-education/system/v1/token + body: + encoding: US-ASCII + string: grant_type=client_credentials&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiIwb2FzM2diNDlvWFhGWkVmazJwNyIsInN1YiI6IjBvYXMzZ2I0OW9YWEZaRWZrMnA3IiwiYXVkIjoiaHR0cHM6Ly9kZXB0dmEtZXZhbC5va3RhLmNvbS9vYXV0aDIvYXVzbG4ybW80akNBWVJybFIycDcvdjEvdG9rZW4iLCJpYXQiOjE3MDkxMjM5NTQsImV4cCI6MTcwOTEyNDI1NH0.e1hLrznderXXoU9Wo5IXZHbzXGXWAp3B7Hd0PeYtBsQWtjIU7LeQ5zoCvZ2ipFN8BCKvNK3mNNQw9t_N5-lZto-KIBtd1po7BtC0_UAoXRRW9t29QNnnsWGOlurlV-eMCqqTz8tAYwODBxKpc3i9VyI51kcnjgcybxoizV6pwUPTGf9mLDIkC3zWJ6pqckdWIPqTHJfhDncivM8PXtBtVfyj3Q3S8u7KCAy8iYedAbJdlQAXZobpcURWpRFy3Qj5hhy0muvWIr8mjbs_2X0H6KzmUVF1eNba-mPzcQLRKLDSx3_isFq9uLUgakN7Ri1y61mTNHfDoHdPof7JDOxB9w&scope=education.read + headers: + Accept: + - application/json + Content-Type: + - application/x-www-form-urlencoded + User-Agent: + - Vets.gov Agent + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 28 Feb 2024 12:39:14 GMT + Content-Type: + - application/json; charset=utf-8 + Connection: + - keep-alive + Vary: + - Origin + Cache-Control: + - no-cache, no-store + Pragma: + - no-cache + Etag: + - W/"3e5-UuDkStSLf0iq4J7d3I+e1M/3eCk" + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"access_token":"eyJraWQiOiJkRFlXN0dQSG82M3FZYk5yNGJkZGZWcUNFQk95TnhjT1k5YWIwRGtOY0I0IiwiYWxnIjoiUlMyNTYifQ.eyJ2ZXIiOjEsImp0aSI6IkFULjRzUmRJTzhjazZZdDZBQjdVTVBpUDFZNXk5N2RtQ1U5OTlPZVhoTGxMZlEiLCJpc3MiOiJodHRwczovL2RlcHR2YS1ldmFsLm9rdGEuY29tL29hdXRoMi9hdXNsbjJtbzRqQ0FZUnJsUjJwNyIsImF1ZCI6Imh0dHBzOi8vc2FuZGJveC1hcGkudmEuZ292L3NlcnZpY2VzL2JlbmVmaXRzLWVkdWNhdGlvbiIsImlhdCI6MTcwOTEyMzk1NCwiZXhwIjoxNzA5MTI0MjU0LCJjaWQiOiIwb2FzM2diNDlvWFhGWkVmazJwNyIsInNjcCI6WyJlZHVjYXRpb24ucmVhZCJdLCJzdWIiOiIwb2FzM2diNDlvWFhGWkVmazJwNyIsImxhYmVsIjoiVkEuZ292IElJUiBQcm9kdWN0IFRlYW0gLSBLeWxlIn0.EczPcpnB-mB9A9x6UpbH6RL15XEzgDhEbGzgA3-aisi11BmnnSJ_LHLJxfXpbGBx4w4m-WLF4Tu0uFLdistgngcg13XIX8G6du-s6Dm9qVVvh-U2xggVXSrLjejAOe1ev5HzORRVlTl1CAnQNkxKufaGc-CFPXK4-fYDsUjdofuAhjcamvLzguKAaRBB9uY8QBZrK_uRzzOTMdL-dnjDOBz191KZHCDxAv_5KwVd0h4EpKWF3YbBtSwZWXe1LOm2R0Nik2fkLFuo0NPiCGk7E5Fshi20UHoFo98yi2novSBzLZ7dAtoc2dOyAeoNS7RmULzUa0MOcfkUrSLp8tUoMQ","token_type":"Bearer","scope":"education.read","expires_in":300,"state":null}' + recorded_at: Wed, 28 Feb 2024 12:39:14 GMT +- request: + method: get + uri: https://sandbox-api.va.gov/services/benefits-education/v1/education/chapter33?icn=1012667145V762142 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: '' + headers: + Date: + - Wed, 28 Feb 2024 12:39:16 GMT + Content-Type: + - application/json + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '59' + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '59' + Ratelimit-Limit: + - '60' + Ratelimit-Reset: + - '45' + Strict-Transport-Security: + - max-age=16000000; includeSubDomains; preload; + - max-age=31536000; includeSubDomains; preload + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - '' + - no-cache, no-store + X-Frame-Options: + - SAMEORIGIN + Pragma: + - no-cache + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"messages":[{"key":"chapter33Education.response.info","text":"Chapter33Education + Response info for veteran from chapter33 endpoint.","severity":"INFO"}],"chapter33EducationInfo":{"firstName":"Tamara","lastName":"Ellis","nameSuffix":"","dateTimeOfBirth":"1967-06-19T06:00:00Z","vaFileNumber":"796130115","activeDuty":false,"veteranIsEligible":true,"regionalProcessingOffice":"Northern + Office Boston, MA","eligibilityDateTime":"2005-08-01T04:00:00Z","delimitingDateTime":"2016-08-01T04:00:00Z","percentageBenefit":100,"originalEntitlement":{"months":0,"days":21},"usedEntitlement":{"months":0,"days":11},"remainingEntitlement":{"months":0,"days":10},"enrollments":[{"beginDateTime":"2015-08-01T04:00:00Z","endDateTime":"2015-12-01T05:00:00Z","facilityCode":11902614,"facilityName":"University + of Virginia","participantId":11179999,"trainingType":null,"termId":"","hourType":"Semester","fullTimeHours":12,"fullTimeCreditHourUnderGrad":null,"vacationDayCount":0,"onCampusHours":12.0,"onlineHours":0.0,"yellowRibbonAmount":2999.0,"status":"Approved","amendments":[]},{"beginDateTime":"2015-01-01T04:00:00Z","endDateTime":"2015-08-01T05:00:00Z","facilityCode":11902614,"facilityName":"University + of Virginia","participantId":11179999,"trainingType":null,"termId":"","hourType":"Semester","fullTimeHours":12,"fullTimeCreditHourUnderGrad":null,"vacationDayCount":0,"onCampusHours":12.0,"onlineHours":3.0,"yellowRibbonAmount":2999.0,"status":"Approved","amendments":[{"residenceHours":0.0,"distanceHours":3.0,"yellowRibbonAmount":0.0,"amendmentType":"CourseDrop","amendmentStatus":"Approved","amendmentEffectiveDate":"2015-01-02T05:00:00Z"}]},{"beginDateTime":"2014-08-01T04:00:00Z","endDateTime":"2013-05-01T04:00:00Z","facilityCode":25047343,"facilityName":"University + of Virginia","participantId":11180666,"trainingType":null,"termId":"","hourType":"Semester","fullTimeHours":12,"fullTimeCreditHourUnderGrad":null,"vacationDayCount":null,"onCampusHours":1.0,"onlineHours":0.0,"yellowRibbonAmount":0.0,"status":"Approved","amendments":[]}]}}' + recorded_at: Wed, 28 Feb 2024 12:39:16 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/support/vcr_cassettes/lighthouse/benefits_education/gi_bill_status/404_response.yml b/spec/support/vcr_cassettes/lighthouse/benefits_education/gi_bill_status/404_response.yml new file mode 100644 index 00000000000..4518edd238b --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/benefits_education/gi_bill_status/404_response.yml @@ -0,0 +1,95 @@ +--- +http_interactions: +- request: + method: post + uri: https://sandbox-api.va.gov/oauth2/benefits-education/system/v1/token + body: + encoding: US-ASCII + string: grant_type=client_credentials&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&client_assertion=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiIwb2FzM2diNDlvWFhGWkVmazJwNyIsInN1YiI6IjBvYXMzZ2I0OW9YWEZaRWZrMnA3IiwiYXVkIjoiaHR0cHM6Ly9kZXB0dmEtZXZhbC5va3RhLmNvbS9vYXV0aDIvYXVzbG4ybW80akNBWVJybFIycDcvdjEvdG9rZW4iLCJpYXQiOjE3MDkxMjYyNjgsImV4cCI6MTcwOTEyNjU2OH0.W9yq_DhAo1b40V_hoNcdifbpWZimHQPWsyi28QQwIvKHwQsDWxKuv2G3S-vIDfRu7vFRrDE4IqrlllfuBekEcaV0wvN-A1AJPvSVG658iJBPbwZ7XjPxA_efhczwvO0R8gWxbpUoea2XTsSqqkY9mSfMFwmWFEFb8ikoRLhvHA7Oox3Abs8bgKuE9H8TR_0Fkmjg4ETKai5KBLvgMsNJF5bAcqObn_0J3ygxV0bDFOiS7cjJ-B-6wKI0g_NcNWgqa1ivZ65vtVTugMBqo9x_Qo9hwj-uvCUQsylt9yF_bb2ba-WvPZVhRK9iGcwXQle29-tMdFXmsO0t4Pm8S1jXzQ&scope=education.read + headers: + Accept: + - application/json + Content-Type: + - application/x-www-form-urlencoded + User-Agent: + - Vets.gov Agent + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Wed, 28 Feb 2024 13:17:49 GMT + Content-Type: + - application/json; charset=utf-8 + Connection: + - keep-alive + Vary: + - Origin + Cache-Control: + - no-cache, no-store + Pragma: + - no-cache + Etag: + - W/"3e5-BlgoBTZadMMj4Ajf6Eyms8L2D9M" + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"access_token":"eyJraWQiOiJkRFlXN0dQSG82M3FZYk5yNGJkZGZWcUNFQk95TnhjT1k5YWIwRGtOY0I0IiwiYWxnIjoiUlMyNTYifQ.eyJ2ZXIiOjEsImp0aSI6IkFULnpCMHFQYWotVi1WZ0xRX1dOcWtmMkVya0xLS21TT0lxZFlOT1IxM2hDSTAiLCJpc3MiOiJodHRwczovL2RlcHR2YS1ldmFsLm9rdGEuY29tL29hdXRoMi9hdXNsbjJtbzRqQ0FZUnJsUjJwNyIsImF1ZCI6Imh0dHBzOi8vc2FuZGJveC1hcGkudmEuZ292L3NlcnZpY2VzL2JlbmVmaXRzLWVkdWNhdGlvbiIsImlhdCI6MTcwOTEyNjI2OCwiZXhwIjoxNzA5MTI2NTY4LCJjaWQiOiIwb2FzM2diNDlvWFhGWkVmazJwNyIsInNjcCI6WyJlZHVjYXRpb24ucmVhZCJdLCJzdWIiOiIwb2FzM2diNDlvWFhGWkVmazJwNyIsImxhYmVsIjoiVkEuZ292IElJUiBQcm9kdWN0IFRlYW0gLSBLeWxlIn0.JN_NLe1T091juk6rjvj0WftKGek9Mpfj5Gp5zyG3i1RYl5UPRT8FTJnIBdgtP3ycskW69GVeIZ7S6Z3hfBCxCQIMuN1qXZ1Rk1nXbCHOCnXZ9-t_sxjCTEBBp_71t_MJ2kmVHCLfQSD2CATyjcicXR-rZt1O1Y1_tG7kMwOi_EUTJnq-NYlFzhny3_m0WTDMjiyH4BxtK51k207vshUiPqU4LY_p8rwEUK9e2aR0O3Sg4TgOkMscIFrEgXpjEePld8DwBAUrZG7DfS2sUOSL4EhIJD5iaZ1xF-TISAZEImiN0DU7EBxz9hjs7XzAc6LpJdkmUGo1yB4KczVupTM_aA","token_type":"Bearer","scope":"education.read","expires_in":300,"state":null}' + recorded_at: Wed, 28 Feb 2024 13:17:49 GMT +- request: + method: get + uri: https://sandbox-api.va.gov/services/benefits-education/v1/education/chapter33?icn=1000000000V100000 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: '' + headers: + Date: + - Wed, 28 Feb 2024 13:17:50 GMT + Content-Type: + - application/json + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '59' + Ratelimit-Limit: + - '60' + Ratelimit-Remaining: + - '59' + Ratelimit-Reset: + - '11' + X-Ratelimit-Limit-Minute: + - '60' + Strict-Transport-Security: + - max-age=16000000; includeSubDomains; preload; + - max-age=31536000; includeSubDomains; preload + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - '' + X-Frame-Options: + - SAMEORIGIN + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"errors":[{"title":"Not Found","detail":"Icn not found.","code":"404","status":"404"}]}' + recorded_at: Wed, 28 Feb 2024 13:17:50 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_deferred_response.yml b/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_deferred_response.yml index 1d8c34d4716..fdc5b8375cc 100644 --- a/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_deferred_response.yml +++ b/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_deferred_response.yml @@ -102,6 +102,7 @@ http_interactions: { "decision": "Deferred", "effective_date": "2018-03-12", + "rating_end_date": null, "rating_percentage": 30, "diagnostic_type_code": "6260", "diagnostic_type_name": "Tinnitus", diff --git a/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_inactives_response.yml b/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_inactives_response.yml new file mode 100644 index 00000000000..2359a56bdee --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/veteran_verification/disability_rating/200_inactives_response.yml @@ -0,0 +1,147 @@ +--- +http_interactions: +- request: + method: get + uri: https://sandbox-api.va.gov/services/veteran_verification/v2/disability_rating/123498767V234859 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: + - Bearer blahblech + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Mon, 04 Mar 2024 02:22:38 GMT + Content-Type: + - application/json; charset=utf-8 + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '59' + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '59' + Ratelimit-Limit: + - '60' + Ratelimit-Reset: + - '25' + Etag: + - W/"6571c42e57529000188d704a3cd1f46a" + Referrer-Policy: + - strict-origin-when-cross-origin + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Download-Options: + - noopen + X-Frame-Options: + - SAMEORIGIN + X-Git-Sha: + - b20885293917fd081d24899644d2718d2ab4ccf9 + X-Github-Repository: + - https://github.com/department-of-veterans-affairs/vets-api + X-Permitted-Cross-Domain-Policies: + - none + X-Request-Id: + - d687047e-5004-43c1-babb-c2f52f2fda40 + X-Runtime: + - '3.569014' + X-Xss-Protection: + - 1; mode=block + Access-Control-Allow-Origin: + - "*" + X-Kong-Upstream-Latency: + - '3573' + X-Kong-Proxy-Latency: + - '24' + Via: + - kong/3.0.2 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cache-Control: + - no-cache, no-store + Pragma: + - no-cache + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{ + "data": { + "id": "12303", + "type": "disability-rating", + "attributes": { + "combined_disability_rating": 100, + "combined_effective_date": "2018-03-27", + "legal_effective_date": "2018-03-27", + "individual_ratings": [ + { + "decision": "Service Connected", + "effective_date": "2018-03-27", + "rating_end_date": null, + "rating_percentage": 50, + "diagnostic_type_code": "5238", + "diagnostic_type_name": "Diabetes Mellitus", + "disability_rating_id": "1", + "diagnostic_text": "Diabetes mellitus0" + }, + { + "decision": "Service Connected", + "effective_date": "2018-03-12", + "rating_end_date": "2022-01-01", + "rating_percentage": 30, + "diagnostic_type_code": "6260", + "diagnostic_type_name": "Tinnitus", + "disability_rating_id": "2", + "diagnostic_text": "Tinnitus" + }, + { + "decision": "Service Connected", + "effective_date": "2018-03-12", + "rating_end_date": "2025-03-16", + "rating_percentage": 20, + "diagnostic_type_code": "6100", + "diagnostic_type_name": "Hearing Loss", + "disability_rating_id": "3", + "diagnostic_text": "hearing loss" + }, + { + "decision": "Not Service Connected", + "effective_date": null, + "rating_end_date": null, + "rating_percentage": null, + "diagnostic_type_code": "5257", + "diagnostic_type_name": "Impairment of the knee, general", + "disability_rating_id": "4", + "diagnostic_text": "knee condition right" + }, + { + "decision": "Not Service Connected", + "effective_date": null, + "rating_end_date": "2028-10-20", + "rating_percentage": null, + "diagnostic_type_code": "1134", + "diagnostic_type_name": "Schizophrenia, disorganized type", + "disability_rating_id": "5", + "diagnostic_text": "bilateral hearing loss" + } + ] + } + } +}' + recorded_at: Mon, 04 Mar 2024 02:22:38 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/support/vcr_cassettes/lighthouse/veteran_verification/show/200_inactives_response.yml b/spec/support/vcr_cassettes/lighthouse/veteran_verification/show/200_inactives_response.yml new file mode 100644 index 00000000000..7c4dc7641ae --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/veteran_verification/show/200_inactives_response.yml @@ -0,0 +1,58 @@ +--- +http_interactions: +- request: + method: get + uri: https://sandbox-api.va.gov/services/veteran_verification/v2/disability_rating/123498767V234859 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Date: + - Mon, 04 Mar 2024 17:31:34 GMT + Content-Type: + - application/json + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '119' + X-Ratelimit-Limit-Minute: + - '120' + Ratelimit-Remaining: + - '119' + Ratelimit-Limit: + - '120' + Ratelimit-Reset: + - '26' + Www-Authenticate: + - Bearer + Strict-Transport-Security: + - max-age=16000000; includeSubDomains; preload; + - max-age=31536000; includeSubDomains; preload + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - '' + X-Frame-Options: + - SAMEORIGIN + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: "{ \n \"status\": 401,\n \"error\": \"Invalid token.\",\n \"path\": + \"/veteran_verification/v2/disability_rating/123498767V234859\"\n}\n" + recorded_at: Mon, 04 Mar 2024 17:31:34 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_200.yml b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_200.yml new file mode 100644 index 00000000000..5f739f810a9 --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_200.yml @@ -0,0 +1,61 @@ +--- +http_interactions: + - request: + method: patch + uri: https://veteran.apps.va.gov/vpg/v1/patients/24811694708759028/appointments/70060 + body: + encoding: UTF-8 + string: '[{"op":"replace","path":"/status","value":"cancelled"}]' + 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_XC81NTIxNjEwNDRcL2FwcG9pbnRtZW50cyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTYzOTU5NDI5MywicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKYWNxdWVsaW5lIiwibGFzdE5hbWUiOiJNb3JnYW4iLCJnZW5kZXIiOiJGRU1BTEUiLCJpY24iOiIxMDEyODQ2MDQzVjU3NjM0MSIsImRvYiI6IjE5NjItMDItMDciLCJkYXRlT2ZCaXJ0aCI6IjE5NjItMDItMDciLCJzc24iOiI3OTYwNjE5NzYifSwidmFtZi5hdXRoLnJvbGVzIjpbInZldGVyYW4iXSwicmlnaHRPZkFjY2Vzc0FjY2VwdGVkIjp0cnVlLCJleHAiOjE2Mzk1OTUxOTMsImp0aSI6IjVhNmQwYTkwLTQ2YjQtNDkwZC04NGEwLWM5YzIyOGE0OTFjNiIsImlkVHlwZSI6IklDTiIsImRhdGVPZkJpcnRoIjoiMTk2MjAyMDciLCJ2ZXJzaW9uIjoyLjYsImVkaXBpZCI6IjEwMTM1OTk3MzAiLCJ2aXN0YUlkcyI6W3sicGF0aWVudElkIjoiNzIxNjY4NSIsInNpdGVJZCI6Ijk4MyJ9LHsicGF0aWVudElkIjoiMTYxNzM3Iiwic2l0ZUlkIjoiNjY4In0seyJwYXRpZW50SWQiOiI1NTIxNjEwNDQiLCJzaXRlSWQiOiI5ODQifV0sImZpcnN0TmFtZSI6IkphY3F1ZWxpbmUiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjM5NTk0MTEzLCJkb2IiOiIxOTYyMDIwNyIsImxvYSI6Mn0.Aw8u9NWLFQU2n2ZCEykRJcz3SDP4Tkm700yYu-qIcRvs2MrNjl3FgXxoxCKzJcakVRWnjOCy1T29ow3yi-NcVgkTQtioq6qUiDGJuLwFDllAqDq3cK20puPG_hEsmlun2lhUUX8J00-n_JyKHww5_Ml69IrOfo7V_06TCCLjbw58LIqBXo7aHeWV3KVn7xCnovs-Ns7ITnHAIZmv2aqZnZ5ytuDppoqOHywrGY1BAE7GqsEcSXFdjXy_jWiICUeHHk-8gIjn3NmLWZhXd8_1jYwwViqx7pvDmUYxkRoh2p_GfDNL-3yEhyvO1evEyd4_4zl03ji6tgPFFOfFynaENg + 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: + - Wed, 15 Dec 2021 18:51:34 GMT + Content-Type: + - application/json + Content-Length: + - '645' + Server: + - openresty + X-Vamf-Version: + - 1.14.1 + B3: + - e04e457a9df23743e48ba47aff06c5d0-d377df9bbfcb15b2-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: + - '1389' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"70060","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/ars/id","value":"8a4890c47da65e2b017db59b20500000"}],"kind":"clinic","status":"cancelled","serviceType":"socialWork","reasonCode":{"text":"text"},"patientIcn":"1012846043V576341","locationId":"983GB","created":"2021-12-13T14:03:02Z","requestedPeriods":[{"start":"2021-12-20T00:00:00Z","end":"2021-12-20T11:59:59.999Z"}],"contact":{"telecom":[{"type":"email","value":"C_Natalie.Yun@cerner.com"},{"type":"phone","value":"2566832029"}]},"preferredTimesForPhoneCall":["Morning"],"cancellationReason":{"code":"other"},"cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Wed, 15 Dec 2021 18:51:34 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_400.yml b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_400.yml new file mode 100644 index 00000000000..5794faaa4d7 --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_400.yml @@ -0,0 +1,57 @@ +--- +http_interactions: +- request: + method: patch + uri: https://veteran.apps.va.gov/vpg/v1/patients/24811694708759028/appointments/70060 + body: + encoding: UTF-8 + string: '[{"op":"replace","path":"/status","value":"cancelled"}]' + 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_XC81NTIxNjEwNTBcL2FwcG9pbnRtZW50cyhcLy4qKT8kIiwiXi4qKFwvKT9zaXRlW3NdP1wvKGRmbi0pPzk4M1wvcGF0aWVudFtzXT9cLzcyMTY2OTFcL2FwcG9pbnRtZW50cyhcLy4qKT8kIiwiXi4qKFwvKT9wYXRpZW50W3NdP1wvKElDTlwvKT8xMDEyODQ1MzMxVjE1MzA0MyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTYzNjA1NzU2NSwicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKdWR5IiwibGFzdE5hbWUiOiJNb3JyaXNvbiIsImdlbmRlciI6IkZFTUFMRSIsImljbiI6IjEwMTI4NDUzMzFWMTUzMDQzIiwiZG9iIjoiMTk1My0wNC0wMSIsImRhdGVPZkJpcnRoIjoiMTk1My0wNC0wMSIsInNzbiI6Ijc5NjA2MTk3NiJ9LCJ2YW1mLmF1dGgucm9sZXMiOlsidmV0ZXJhbiJdLCJyaWdodE9mQWNjZXNzQWNjZXB0ZWQiOnRydWUsImV4cCI6MTYzNjA1ODQ2NiwianRpIjoiYWMxNmMyMjUtMjBmOS00NWQxLWE4NTEtZmZiYWIyNGJmN2U2IiwiaWRUeXBlIjoiSUNOIiwiZGF0ZU9mQmlydGgiOiIxOTUzMDQwMSIsInZlcnNpb24iOjIuNiwiZWRpcGlkIjoiMTI1OTg5Nzk3OCIsInZpc3RhSWRzIjpbeyJwYXRpZW50SWQiOiI1NTIxNjEwNTAiLCJzaXRlSWQiOiI5ODQifSx7InBhdGllbnRJZCI6IjcyMTY2OTEiLCJzaXRlSWQiOiI5ODMifV0sImZpcnN0TmFtZSI6Ikp1ZHkiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjM2MDU3Mzg2LCJkb2IiOiIxOTUzMDQwMSIsImxvYSI6Mn0.Yc0dunUjtpp08j83NBxDLTjJWKLxtvjneNykdKHlwdxyBE2OuYdTVZQmBZuqK4bMIabNAc6OiMD7u3Hsk1Lo0J1T_L2NYxoFA4hRMU1-KuY49rwENvgVoGF_ywzDiYFy-DGvYPwxO2G30BsPz1QJJ9PSpb1FsReqAbmcEncBXetRzhQG8skSg5Ica7z21khCse-60uojiilQh3Qzov-1lttH3UboOfwPCOjlzmTZpdKg7z6g5eahD4fsv0vD-od2srPHM2eYJVEQe8YptNbicqj3I1KnNDHAEr3FxPMvShFzZ8Bw9CDXMm8IA2iyFCnYc3G82aY9RkZk-LCJjwR6Zg + 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, 04 Nov 2021 20:26:08 GMT + Content-Type: + - application/json + Content-Length: + - '46' + Server: + - openresty + X-Vamf-Version: + - 1.12.1 + B3: + - 576d80e89973b3e6-c924d235ddfa6701-1 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 661c259 + X-Vamf-Timestamp: + - '2021-11-01T15:35:46+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + body: + encoding: UTF-8 + string: '{"message":"appointment may not be cancelled"}' + recorded_at: Thu, 04 Nov 2021 20:26:08 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_500.yml b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_500.yml new file mode 100644 index 00000000000..2e5f95673cc --- /dev/null +++ b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/cancel_appointment_vpg_500.yml @@ -0,0 +1,59 @@ +--- +http_interactions: +- request: + method: patch + uri: https://veteran.apps.va.gov/vpg/v1/patients/24811694708759028/appointments/70060 + body: + encoding: UTF-8 + string: '[{"op":"replace","path":"/status","value":"cancelled"}]' + 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: + - Tue, 10 Aug 2021 23:07:50 GMT + Content-Type: + - application/json + Content-Length: + - '344' + Server: + - openresty + X-Vamf-Version: + - 1.9.0 + B3: + - b06b919c0ed122c3-48aab5c2067443ef-1 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - e208742 + X-Vamf-Timestamp: + - '2021-08-03T18:59:01+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + body: + encoding: UTF-8 + string: '{"id":"c5a3f871-fc3d-4ac8-bee8-34a5ba000179","code":500,"errorCode":7008,"traceId":"b06b919c0ed122c3","message":"failed + to cancel appointment","detail":"Could not update CC appointment request through + the Mobile HSRM Service.","meta":{"upstreamErrorSource":"mobile-appointment-service","upstreamErrorId":"148684f6-86b5-4964-8f60-e81d765a1bf6"}}' + recorded_at: Tue, 10 Aug 2021 23:07:50 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/mr_client/get_a_health_condition.yml b/spec/support/vcr_cassettes/mr_client/get_a_health_condition.yml index bb364d522f3..05cf84cc9c9 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_health_condition.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_health_condition.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/Condition?_count=9999&_id=39274&_include=*" + uri: "/fhir/Condition?_count=9999&_id=39274&_include=*&verification-status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_allergies.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_allergies.yml index bba550ef084..8484c229add 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_allergies.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_allergies.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/AllergyIntolerance?_count=9999&clinical-status=active&patient=2952" + uri: "/fhir/AllergyIntolerance?_count=9999&clinical-status=active&patient=2952&verification-status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_chemhem_labs.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_chemhem_labs.yml index a0d3e7a4e42..55197b79f18 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_chemhem_labs.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_chemhem_labs.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DiagnosticReport?_count=9999&category=LAB&patient=2952" + uri: "/fhir/DiagnosticReport?_count=9999&category=LAB&patient=2952&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_clinical_notes.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_clinical_notes.yml index 70d3d592d8f..06e348cdd05 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_clinical_notes.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_clinical_notes.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DocumentReference?_count=9999&patient=2952&type=11506-3,18842-5,11488-4" + uri: "/fhir/DocumentReference?_count=9999&patient=2952&status:not=entered-in-error&type=11506-3,18842-5,11488-4" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_diagreport_labs.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_diagreport_labs.yml index 58c8f6fa1fb..5f7ea0496d4 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_diagreport_labs.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_diagreport_labs.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DiagnosticReport?_count=9999&code=79381-0,60567-5&patient=2952" + uri: "/fhir/DiagnosticReport?_count=9999&code=79381-0,60567-5&patient=2952&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_docref_labs.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_docref_labs.yml index 58750717d8c..8762077bcd0 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_docref_labs.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_docref_labs.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DocumentReference?_count=9999&patient=2952&type=11524-6,18748-4" + uri: "/fhir/DocumentReference?_count=9999&patient=2952&status:not=entered-in-error&type=11524-6,18748-4" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions.yml index 629e05e98ba..f6a562fa4e9 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/Condition?_count=9999&patient=2952" + uri: "/fhir/Condition?_count=9999&patient=2952&verification-status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions_error.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions_error.yml index f8a4a6ecf39..52ce1b9e756 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions_error.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_health_conditions_error.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/Condition?_count=9999&patient=39254" + uri: "/fhir/Condition?_count=9999&patient=39254&verification-status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_labs_and_tests.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_labs_and_tests.yml index 59bfa295559..21c311ecda8 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_labs_and_tests.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_labs_and_tests.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DiagnosticReport?_count=9999&category=LAB&patient=258974" + uri: "/fhir/DiagnosticReport?_count=9999&category=LAB&patient=258974&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_vaccines.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_vaccines.yml index bbba22fe611..f08d959b0f0 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_vaccines.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_vaccines.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/Immunization?_count=9999&patient=2952" + uri: "/fhir/Immunization?_count=9999&patient=2952&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_list_of_vitals.yml b/spec/support/vcr_cassettes/mr_client/get_a_list_of_vitals.yml index 93009abe35d..cfd614721b1 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_list_of_vitals.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_list_of_vitals.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/Observation?_count=9999&code=85354-9,9279-1,8867-4,8302-2,8310-5,29463-7&patient=2952" + uri: "/fhir/Observation?_count=9999&code=85354-9,9279-1,8867-4,8302-2,8310-5,29463-7&patient=2952&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_a_single_lab_or_test.yml b/spec/support/vcr_cassettes/mr_client/get_a_single_lab_or_test.yml index 94206398d8f..967ba2bfc7a 100644 --- a/spec/support/vcr_cassettes/mr_client/get_a_single_lab_or_test.yml +++ b/spec/support/vcr_cassettes/mr_client/get_a_single_lab_or_test.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DiagnosticReport?_count=9999&_id=40766&_include=*" + uri: "/fhir/DiagnosticReport?_count=9999&_id=40766&_include=*&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_full_list_of_labs_and_tests.yml b/spec/support/vcr_cassettes/mr_client/get_full_list_of_labs_and_tests.yml index 6498a2964e4..623a78dc92d 100644 --- a/spec/support/vcr_cassettes/mr_client/get_full_list_of_labs_and_tests.yml +++ b/spec/support/vcr_cassettes/mr_client/get_full_list_of_labs_and_tests.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/DiagnosticReport?_count=9999&category=LAB&patient=49006" + uri: "/fhir/DiagnosticReport?_count=9999&category=LAB&patient=49006&status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/mr_client/get_multiple_fhir_pages.yml b/spec/support/vcr_cassettes/mr_client/get_multiple_fhir_pages.yml index 54878e89d3d..8cc2d0876b1 100644 --- a/spec/support/vcr_cassettes/mr_client/get_multiple_fhir_pages.yml +++ b/spec/support/vcr_cassettes/mr_client/get_multiple_fhir_pages.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: "/fhir/AllergyIntolerance?_count=9999&clinical-status=active&patient=2952" + uri: "/fhir/AllergyIntolerance?_count=9999&clinical-status=active&patient=2952&verification-status:not=entered-in-error" body: encoding: US-ASCII string: "" diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/cancel_appointment_vpg_400.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/cancel_appointment_vpg_400.yml new file mode 100644 index 00000000000..74f516bd38a --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/cancel_appointment_vpg_400.yml @@ -0,0 +1,57 @@ +--- +http_interactions: +- request: + method: patch + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments/42081 + body: + encoding: UTF-8 + string: '[{"op":"replace","path":"/status","value":"cancelled"}]' + 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_XC81NTIxNjEwNTBcL2FwcG9pbnRtZW50cyhcLy4qKT8kIiwiXi4qKFwvKT9zaXRlW3NdP1wvKGRmbi0pPzk4M1wvcGF0aWVudFtzXT9cLzcyMTY2OTFcL2FwcG9pbnRtZW50cyhcLy4qKT8kIiwiXi4qKFwvKT9wYXRpZW50W3NdP1wvKElDTlwvKT8xMDEyODQ1MzMxVjE1MzA0MyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTYzNjA1NzU2NSwicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKdWR5IiwibGFzdE5hbWUiOiJNb3JyaXNvbiIsImdlbmRlciI6IkZFTUFMRSIsImljbiI6IjEwMTI4NDUzMzFWMTUzMDQzIiwiZG9iIjoiMTk1My0wNC0wMSIsImRhdGVPZkJpcnRoIjoiMTk1My0wNC0wMSIsInNzbiI6Ijc5NjA2MTk3NiJ9LCJ2YW1mLmF1dGgucm9sZXMiOlsidmV0ZXJhbiJdLCJyaWdodE9mQWNjZXNzQWNjZXB0ZWQiOnRydWUsImV4cCI6MTYzNjA1ODQ2NiwianRpIjoiYWMxNmMyMjUtMjBmOS00NWQxLWE4NTEtZmZiYWIyNGJmN2U2IiwiaWRUeXBlIjoiSUNOIiwiZGF0ZU9mQmlydGgiOiIxOTUzMDQwMSIsInZlcnNpb24iOjIuNiwiZWRpcGlkIjoiMTI1OTg5Nzk3OCIsInZpc3RhSWRzIjpbeyJwYXRpZW50SWQiOiI1NTIxNjEwNTAiLCJzaXRlSWQiOiI5ODQifSx7InBhdGllbnRJZCI6IjcyMTY2OTEiLCJzaXRlSWQiOiI5ODMifV0sImZpcnN0TmFtZSI6Ikp1ZHkiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjM2MDU3Mzg2LCJkb2IiOiIxOTUzMDQwMSIsImxvYSI6Mn0.Yc0dunUjtpp08j83NBxDLTjJWKLxtvjneNykdKHlwdxyBE2OuYdTVZQmBZuqK4bMIabNAc6OiMD7u3Hsk1Lo0J1T_L2NYxoFA4hRMU1-KuY49rwENvgVoGF_ywzDiYFy-DGvYPwxO2G30BsPz1QJJ9PSpb1FsReqAbmcEncBXetRzhQG8skSg5Ica7z21khCse-60uojiilQh3Qzov-1lttH3UboOfwPCOjlzmTZpdKg7z6g5eahD4fsv0vD-od2srPHM2eYJVEQe8YptNbicqj3I1KnNDHAEr3FxPMvShFzZ8Bw9CDXMm8IA2iyFCnYc3G82aY9RkZk-LCJjwR6Zg + 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, 04 Nov 2021 20:26:08 GMT + Content-Type: + - application/json + Content-Length: + - '46' + Server: + - openresty + X-Vamf-Version: + - 1.12.1 + B3: + - 576d80e89973b3e6-c924d235ddfa6701-1 + Access-Control-Allow-Headers: + - x-vamf-jwt + X-Vamf-Build: + - 661c259 + X-Vamf-Timestamp: + - '2021-11-01T15:35:46+0000' + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Methods: + - GET,OPTIONS + Access-Control-Max-Age: + - '3600' + body: + encoding: UTF-8 + string: '{"message":"appointment may not be cancelled"}' + recorded_at: Thu, 04 Nov 2021 20:26:08 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/support/vcr_cassettes/vaos/v2/appointments/cancel_appointments_vpg_200.yml b/spec/support/vcr_cassettes/vaos/v2/appointments/cancel_appointments_vpg_200.yml new file mode 100644 index 00000000000..c1ac66fe612 --- /dev/null +++ b/spec/support/vcr_cassettes/vaos/v2/appointments/cancel_appointments_vpg_200.yml @@ -0,0 +1,61 @@ +--- +http_interactions: +- request: + method: patch + uri: https://veteran.apps.va.gov/vpg/v1/patients/1012846043V576341/appointments/70060 + body: + encoding: UTF-8 + string: '[{"op":"replace","path":"/status","value":"cancelled"}]' + 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_XC81NTIxNjEwNDRcL2FwcG9pbnRtZW50cyhcLy4qKT8kIl0sInNzbiI6Ijc5NjA2MTk3NiIsInNzdCI6MTYzOTU5NDI5MywicGF0aWVudCI6eyJmaXJzdE5hbWUiOiJKYWNxdWVsaW5lIiwibGFzdE5hbWUiOiJNb3JnYW4iLCJnZW5kZXIiOiJGRU1BTEUiLCJpY24iOiIxMDEyODQ2MDQzVjU3NjM0MSIsImRvYiI6IjE5NjItMDItMDciLCJkYXRlT2ZCaXJ0aCI6IjE5NjItMDItMDciLCJzc24iOiI3OTYwNjE5NzYifSwidmFtZi5hdXRoLnJvbGVzIjpbInZldGVyYW4iXSwicmlnaHRPZkFjY2Vzc0FjY2VwdGVkIjp0cnVlLCJleHAiOjE2Mzk1OTUxOTMsImp0aSI6IjVhNmQwYTkwLTQ2YjQtNDkwZC04NGEwLWM5YzIyOGE0OTFjNiIsImlkVHlwZSI6IklDTiIsImRhdGVPZkJpcnRoIjoiMTk2MjAyMDciLCJ2ZXJzaW9uIjoyLjYsImVkaXBpZCI6IjEwMTM1OTk3MzAiLCJ2aXN0YUlkcyI6W3sicGF0aWVudElkIjoiNzIxNjY4NSIsInNpdGVJZCI6Ijk4MyJ9LHsicGF0aWVudElkIjoiMTYxNzM3Iiwic2l0ZUlkIjoiNjY4In0seyJwYXRpZW50SWQiOiI1NTIxNjEwNDQiLCJzaXRlSWQiOiI5ODQifV0sImZpcnN0TmFtZSI6IkphY3F1ZWxpbmUiLCJzdGFmZkRpc2NsYWltZXJBY2NlcHRlZCI6dHJ1ZSwibmJmIjoxNjM5NTk0MTEzLCJkb2IiOiIxOTYyMDIwNyIsImxvYSI6Mn0.Aw8u9NWLFQU2n2ZCEykRJcz3SDP4Tkm700yYu-qIcRvs2MrNjl3FgXxoxCKzJcakVRWnjOCy1T29ow3yi-NcVgkTQtioq6qUiDGJuLwFDllAqDq3cK20puPG_hEsmlun2lhUUX8J00-n_JyKHww5_Ml69IrOfo7V_06TCCLjbw58LIqBXo7aHeWV3KVn7xCnovs-Ns7ITnHAIZmv2aqZnZ5ytuDppoqOHywrGY1BAE7GqsEcSXFdjXy_jWiICUeHHk-8gIjn3NmLWZhXd8_1jYwwViqx7pvDmUYxkRoh2p_GfDNL-3yEhyvO1evEyd4_4zl03ji6tgPFFOfFynaENg + 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: + - Wed, 15 Dec 2021 18:51:34 GMT + Content-Type: + - application/json + Content-Length: + - '645' + Server: + - openresty + X-Vamf-Version: + - 1.14.1 + B3: + - e04e457a9df23743e48ba47aff06c5d0-d377df9bbfcb15b2-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: + - '1389' + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: '{"id":"70060","identifier":[{"system":"http://med.va.gov/fhir/urn/vaos/ars/id","value":"8a4890c47da65e2b017db59b20500000"}],"kind":"clinic","status":"cancelled","serviceType":"socialWork","reasonCode":{"text":"text"},"patientIcn":"1012846043V576341","locationId":"983GB","created":"2021-12-13T14:03:02Z","requestedPeriods":[{"start":"2021-12-20T00:00:00Z","end":"2021-12-20T11:59:59.999Z"}],"contact":{"telecom":[{"type":"email","value":"C_Natalie.Yun@cerner.com"},{"type":"phone","value":"2566832029"}]},"preferredTimesForPhoneCall":["Morning"],"cancellationReason":{"code":"other"},"cancellable":true,"extension":{"ccLocation":{"address":{}}}}' + recorded_at: Wed, 15 Dec 2021 18:51:34 GMT +recorded_with: VCR 6.0.0