diff --git a/modules/claims_api/app/controllers/claims_api/v1/application_controller.rb b/modules/claims_api/app/controllers/claims_api/v1/application_controller.rb index d4b28ebb6fd..f58ff7bfe8d 100644 --- a/modules/claims_api/app/controllers/claims_api/v1/application_controller.rb +++ b/modules/claims_api/app/controllers/claims_api/v1/application_controller.rb @@ -130,7 +130,7 @@ def claims_service end def local_bgs_service - @local_bgs_service ||= ClaimsApi::LocalBGS.new( + @local_bgs_service ||= ClaimsApi::MiscellaneousBGSOperations.new( external_uid: target_veteran.participant_id, external_key: target_veteran.participant_id ) diff --git a/modules/claims_api/app/controllers/claims_api/v1/forms/base.rb b/modules/claims_api/app/controllers/claims_api/v1/forms/base.rb index 8835f5deebb..2a30fad9db7 100644 --- a/modules/claims_api/app/controllers/claims_api/v1/forms/base.rb +++ b/modules/claims_api/app/controllers/claims_api/v1/forms/base.rb @@ -95,7 +95,7 @@ def bgs_service def local_bgs_service external_key = target_veteran.participant_id.to_s - @local_bgs_service ||= ClaimsApi::LocalBGS.new( + @local_bgs_service ||= ClaimsApi::MiscellaneousBGSOperations.new( external_uid: external_key, external_key: ) diff --git a/modules/claims_api/app/controllers/claims_api/v1/forms/intent_to_file_controller.rb b/modules/claims_api/app/controllers/claims_api/v1/forms/intent_to_file_controller.rb index b70bddedc9e..cf0883d0c84 100644 --- a/modules/claims_api/app/controllers/claims_api/v1/forms/intent_to_file_controller.rb +++ b/modules/claims_api/app/controllers/claims_api/v1/forms/intent_to_file_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'evss/intent_to_file/service' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' module ClaimsApi module V1 diff --git a/modules/claims_api/app/controllers/claims_api/v1/forms/power_of_attorney_controller.rb b/modules/claims_api/app/controllers/claims_api/v1/forms/power_of_attorney_controller.rb index cda49f9b83b..b66640370f6 100644 --- a/modules/claims_api/app/controllers/claims_api/v1/forms/power_of_attorney_controller.rb +++ b/modules/claims_api/app/controllers/claims_api/v1/forms/power_of_attorney_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'bgs/power_of_attorney_verifier' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' module ClaimsApi module V1 @@ -227,7 +227,7 @@ def build_representative_info(poa_code) def find_by_ssn(ssn) # rubocop:disable Rails/DynamicFindBy - ClaimsApi::LocalBGS.new( + ClaimsApi::MiscellaneousBGSOperations.new( external_uid: target_veteran.participant_id, external_key: target_veteran.participant_id ).find_by_ssn(ssn) diff --git a/modules/claims_api/app/controllers/claims_api/v2/application_controller.rb b/modules/claims_api/app/controllers/claims_api/v2/application_controller.rb index 9bb20821666..f676302b93f 100644 --- a/modules/claims_api/app/controllers/claims_api/v2/application_controller.rb +++ b/modules/claims_api/app/controllers/claims_api/v2/application_controller.rb @@ -5,7 +5,7 @@ require 'token_validation/v2/client' require 'claims_api/error/error_handler' require 'claims_api/claim_logger' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' require 'claims_api/form_schemas' require 'claims_api/v2/benefits_documents/service' require 'bd/bd' @@ -81,7 +81,7 @@ def bgs_service end def local_bgs_service - @local_bgs_service ||= ClaimsApi::LocalBGS.new( + @local_bgs_service ||= ClaimsApi::MiscellaneousBGSOperations.new( external_uid: target_veteran.participant_id, external_key: target_veteran.participant_id ) diff --git a/modules/claims_api/app/controllers/claims_api/v2/veterans/intent_to_file_controller.rb b/modules/claims_api/app/controllers/claims_api/v2/veterans/intent_to_file_controller.rb index 05a42d4fa04..d5ad0515e92 100644 --- a/modules/claims_api/app/controllers/claims_api/v2/veterans/intent_to_file_controller.rb +++ b/modules/claims_api/app/controllers/claims_api/v2/veterans/intent_to_file_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'claims_api/v2/params_validation/intent_to_file' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' module ClaimsApi module V2 diff --git a/modules/claims_api/lib/bgs_service/bgs_helpers.rb b/modules/claims_api/lib/bgs_service/bgs_helpers.rb new file mode 100644 index 00000000000..e4a9f3a2527 --- /dev/null +++ b/modules/claims_api/lib/bgs_service/bgs_helpers.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module ClaimsApi + module BGSHelpers + def convert_nil_values(options) + arg_strg = '' + options.each do |option| + arg = option[0].to_s.camelize(:lower) + arg_strg += (option[1].nil? ? "<#{arg} xsi:nil='true'/>" : "<#{arg}>#{option[1]}") + end + arg_strg + end + + def validate_opts!(opts, required_keys) + keys = opts.keys.map(&:to_s) + required_keys = required_keys.map(&:to_s) + missing_keys = required_keys - keys + raise ArgumentError, "Missing required keys: #{missing_keys.join(', ')}" if missing_keys.present? + end + + def jrn + { + jrn_dt: Time.current.iso8601, + jrn_lctn_id: Settings.bgs.client_station_id, + jrn_status_type_cd: 'U', + jrn_user_id: Settings.bgs.client_username, + jrn_obj_id: Settings.bgs.application + } + end + end +end diff --git a/modules/claims_api/lib/bgs_service/local_bgs.rb b/modules/claims_api/lib/bgs_service/local_bgs.rb index b8cab2283bd..fb9443409ba 100644 --- a/modules/claims_api/lib/bgs_service/local_bgs.rb +++ b/modules/claims_api/lib/bgs_service/local_bgs.rb @@ -8,7 +8,7 @@ require 'claims_api/claim_logger' require 'claims_api/error/soap_error_handler' -require_relative 'local_bgs/miscellaneous_operations' +require 'bgs_service/bgs_helpers' module ClaimsApi class LocalBGS diff --git a/modules/claims_api/lib/bgs_service/local_bgs/miscellaneous_operations.rb b/modules/claims_api/lib/bgs_service/miscellaneous_bgs_operations.rb similarity index 86% rename from modules/claims_api/lib/bgs_service/local_bgs/miscellaneous_operations.rb rename to modules/claims_api/lib/bgs_service/miscellaneous_bgs_operations.rb index fce254c04e6..da5ef08d6e6 100644 --- a/modules/claims_api/lib/bgs_service/local_bgs/miscellaneous_operations.rb +++ b/modules/claims_api/lib/bgs_service/miscellaneous_bgs_operations.rb @@ -3,7 +3,7 @@ require 'claims_api/evss_bgs_mapper' module ClaimsApi - class LocalBGS + class MiscellaneousBGSOperations < ClaimsApi::LocalBGS def find_poa_by_participant_id(id) body = Nokogiri::XML::DocumentFragment.parse <<~EOXML @@ -168,31 +168,5 @@ def transform_bgs_claims_to_evss(claims) bgs_claim.map_and_build_object end end - - def convert_nil_values(options) - arg_strg = '' - options.each do |option| - arg = option[0].to_s.camelize(:lower) - arg_strg += (option[1].nil? ? "<#{arg} xsi:nil='true'/>" : "<#{arg}>#{option[1]}") - end - arg_strg - end - - def validate_opts!(opts, required_keys) - keys = opts.keys.map(&:to_s) - required_keys = required_keys.map(&:to_s) - missing_keys = required_keys - keys - raise ArgumentError, "Missing required keys: #{missing_keys.join(', ')}" if missing_keys.present? - end - - def jrn - { - jrn_dt: Time.current.iso8601, - jrn_lctn_id: Settings.bgs.client_station_id, - jrn_status_type_cd: 'U', - jrn_user_id: Settings.bgs.client_username, - jrn_obj_id: Settings.bgs.application - } - end end end diff --git a/modules/claims_api/lib/bgs_service/vnp_atchms_service.rb b/modules/claims_api/lib/bgs_service/vnp_atchms_service.rb index 548350ef459..b02ed2957f2 100644 --- a/modules/claims_api/lib/bgs_service/vnp_atchms_service.rb +++ b/modules/claims_api/lib/bgs_service/vnp_atchms_service.rb @@ -2,6 +2,8 @@ module ClaimsApi class VnpAtchmsService < ClaimsApi::LocalBGS + include ClaimsApi::BGSHelpers + # Takes an object with a minimum of (other fields are camelized and passed to BGS): # vnp_proc_id: BGS procID # atchms_file_nm: File name diff --git a/modules/claims_api/lib/bgs_service/vnp_person_service.rb b/modules/claims_api/lib/bgs_service/vnp_person_service.rb index 3c47d73facb..bcaa58239ce 100644 --- a/modules/claims_api/lib/bgs_service/vnp_person_service.rb +++ b/modules/claims_api/lib/bgs_service/vnp_person_service.rb @@ -2,6 +2,8 @@ module ClaimsApi class VnpPersonService < ClaimsApi::LocalBGS + include ClaimsApi::BGSHelpers + # Takes an object with a minimum of (other fields are camelized and passed to BGS): # vnp_proc_id: BGS procID # vnp_ptcpnt_id: Veteran's participant id diff --git a/modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb b/modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb index 807af6c3047..c537c693cc6 100644 --- a/modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb +++ b/modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb @@ -2,6 +2,8 @@ module ClaimsApi class VnpProcFormService < ClaimsApi::LocalBGS + include ClaimsApi::BGSHelpers + FORM_TYPE_CD = '21-22' def vnp_proc_form_create(options) diff --git a/modules/claims_api/lib/bgs_service/vnp_ptcpnt_addrs_service.rb b/modules/claims_api/lib/bgs_service/vnp_ptcpnt_addrs_service.rb index 85bf4cda2ff..26cf62c9765 100644 --- a/modules/claims_api/lib/bgs_service/vnp_ptcpnt_addrs_service.rb +++ b/modules/claims_api/lib/bgs_service/vnp_ptcpnt_addrs_service.rb @@ -2,6 +2,8 @@ module ClaimsApi class VnpPtcpntAddrsService < ClaimsApi::LocalBGS + include ClaimsApi::BGSHelpers + def vnp_ptcpnt_addrs_create(options) arg_strg = convert_nil_values(options) body = Nokogiri::XML::DocumentFragment.parse <<~EOXML diff --git a/modules/claims_api/lib/bgs_service/vnp_ptcpnt_service.rb b/modules/claims_api/lib/bgs_service/vnp_ptcpnt_service.rb index e87a72269a6..0f27007e6cf 100644 --- a/modules/claims_api/lib/bgs_service/vnp_ptcpnt_service.rb +++ b/modules/claims_api/lib/bgs_service/vnp_ptcpnt_service.rb @@ -2,6 +2,8 @@ module ClaimsApi class VnpPtcpntService < ClaimsApi::LocalBGS + include ClaimsApi::BGSHelpers + # vnpPtcpntCreate - This service is used to create VONAPP participant information def vnp_ptcpnt_create(options) arg_strg = convert_nil_values(options) diff --git a/modules/claims_api/spec/lib/claims_api/local_bgs_spec.rb b/modules/claims_api/spec/lib/claims_api/local_bgs_spec.rb index 482c897a6d8..82aa1c9e590 100644 --- a/modules/claims_api/spec/lib/claims_api/local_bgs_spec.rb +++ b/modules/claims_api/spec/lib/claims_api/local_bgs_spec.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true require 'rails_helper' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' require 'claims_api/error/soap_error_handler' -describe ClaimsApi::LocalBGS do +describe ClaimsApi::MiscellaneousBGSOperations do subject { described_class.new external_uid: 'xUid', external_key: 'xKey' } let(:soap_error_handler) { ClaimsApi::SoapErrorHandler.new } @@ -12,11 +12,9 @@ describe '#find_poa_by_participant_id' do it 'responds as expected, with extra ClaimsApi::Logger logging' do VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id') do - allow_any_instance_of(BGS::OrgWebService).to receive(:find_poa_history_by_ptcpnt_id).and_return({}) - # Events logged: - # 1: establish_ssl_connection - how long to establish the connection - # 2: connection_wsdl_get - duration of WSDL request cycle + # 1: connection_wsdl_get - duration of WSDL request cycle + # 2: built_request - how long to build the request # 3: connection_post - how long does the post itself take for the request cycle # 4: parsed_response - how long to parse the response expect(ClaimsApi::Logger).to receive(:log).exactly(4).times @@ -44,9 +42,7 @@ it 'triggers StatsD measurements' do VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id', allow_playback_repeats: true) do - allow_any_instance_of(BGS::OrgWebService).to receive(:find_poa_history_by_ptcpnt_id).and_return({}) - - %w[establish_ssl_connection connection_wsdl_get connection_post parsed_response].each do |event| + %w[connection_wsdl_get built_request connection_post parsed_response].each do |event| expect { subject.find_poa_by_participant_id('does-not-matter') } .to trigger_statsd_measure("api.claims_api.local_bgs.#{event}.duration") end @@ -107,9 +103,9 @@ ), key: 'PersonDTO').and_return(:bgs_unknown_error_message) begin - allow(soap_error_handler).to receive(:handle_errors) + allow(soap_error_handler).to receive(:handle_errors!) .with(:bgs_unknown_error_message).and_raise(Common::Exceptions::UnprocessableEntity) - ret = soap_error_handler.send(:handle_errors, :bgs_unknown_error_message) + ret = soap_error_handler.send(:handle_errors!, :bgs_unknown_error_message) expect(ret.class).to_be Array expect(ret.size).to eq 1 rescue => e diff --git a/modules/claims_api/spec/models/veteran/service/user_spec.rb b/modules/claims_api/spec/models/veteran/service/user_spec.rb index d6965951db2..759675303d6 100644 --- a/modules/claims_api/spec/models/veteran/service/user_spec.rb +++ b/modules/claims_api/spec/models/veteran/service/user_spec.rb @@ -15,7 +15,7 @@ ) end - let(:ows) { ClaimsApi::LocalBGS } + let(:ows) { ClaimsApi::MiscellaneousBGSOperations } it 'initializes from a user' do VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id') do diff --git a/modules/claims_api/spec/requests/v1/claims_request_spec.rb b/modules/claims_api/spec/requests/v1/claims_request_spec.rb index 433e24fca21..6e291420a59 100644 --- a/modules/claims_api/spec/requests/v1/claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/claims_request_spec.rb @@ -34,7 +34,7 @@ end let(:claims_service) do if Flipper.enabled? :claims_status_v1_bgs_enabled - ClaimsApi::LocalBGS + ClaimsApi::MiscellaneousBGSOperations else ClaimsApi::UnsynchronizedEVSSClaimService end diff --git a/modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb b/modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb index 3a1c3590cd4..a6f9d73da43 100644 --- a/modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/intent_to_file_request_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' require_relative '../../rails_helper' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'Intent to file', type: :request do let(:headers) do @@ -151,7 +151,7 @@ describe 'handling the claimant fields' do context "when 'participant_claimant_id' is provided" do it 'that field and value are sent to BGS' do - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:insert_intent_to_file).with(hash_including(participant_claimant_id: '123')).and_return({}) mock_acg(scopes) do |auth_header| @@ -163,7 +163,7 @@ context "when 'claimant_ssn' is provided" do it 'that field and value are sent to BGS' do - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:insert_intent_to_file).with(hash_including(claimant_ssn: '123')).and_return({}) mock_acg(scopes) do |auth_header| @@ -179,7 +179,7 @@ end it "'participant_claimant_id' is set to the target_veteran.participant_id and sent to BGS " do - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:insert_intent_to_file).with(hash_including(participant_claimant_id: '999')).and_return({}) mock_acg(scopes) do |auth_header| @@ -190,7 +190,7 @@ context "when both 'participant_claimant_id' and 'claimant_ssn' are provided" do it "both 'participant_claimant_id' and 'claimant_ssn' are sent to BGS " do - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:insert_intent_to_file).with( hash_including( participant_claimant_id: '123', claimant_ssn: '456' diff --git a/modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb b/modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb index 7267e85502d..0a62a977c3b 100644 --- a/modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/power_of_attorney_request_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' require_relative '../../rails_helper' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'Power of Attorney ', type: :request do let(:headers) do @@ -20,7 +20,7 @@ profile: FactoryBot.build(:mpi_profile, participant_id: nil, participant_ids: %w[123456789 987654321]) ) end - let(:pws) { ClaimsApi::LocalBGS } + let(:pws) { ClaimsApi::MiscellaneousBGSOperations } before do stub_poa_verification diff --git a/modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb b/modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb index 7d83b317786..d28c9ed95a5 100644 --- a/modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/rswag_claims_request_spec.rb @@ -127,7 +127,7 @@ before do |example| stub_poa_verification - allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:all).and_raise( + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations).to receive(:all).and_raise( Common::Exceptions::ResourceNotFound.new(detail: 'The Resource was not found.') ) mock_acg(scopes) do diff --git a/modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb b/modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb index 267d47d327f..c423895299b 100644 --- a/modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb +++ b/modules/claims_api/spec/requests/v1/rswag_power_of_attorney_request_spec.rb @@ -7,7 +7,7 @@ require_relative '../../support/swagger_shared_components/v1' describe 'Power of Attorney', openapi_spec: 'modules/claims_api/app/swagger/claims_api/v1/swagger.json' do # rubocop:disable RSpec/DescribeClass - let(:pws) { ClaimsApi::LocalBGS } + let(:pws) { ClaimsApi::MiscellaneousBGSOperations } path '/forms/2122' do get 'Gets schema for POA form.' do diff --git a/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb index e67b76cfee5..f2b437ceba7 100644 --- a/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/claims_request_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require_relative '../../../rails_helper' require 'token_validation/v2/client' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'Claims', type: :request do let(:veteran_id) { '1013062086V794840' } @@ -23,7 +23,7 @@ participant_ids: []) ) end - let(:bcs) { ClaimsApi::LocalBGS } + let(:bcs) { ClaimsApi::MiscellaneousBGSOperations } let(:profile_for_claimant_on_behalf_of_veteran) do MPI::Responses::FindProfileResponse.new( status: :ok, diff --git a/modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb index 1cf9d712b60..52da10c57df 100644 --- a/modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/evidence_waiver_request_spec.rb @@ -28,7 +28,7 @@ it 'returns a 200' do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/benefit_claim/update_5103_200') do - allow_any_instance_of(ClaimsApi::LocalBGS) + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_by_ssn).and_return({ file_nbr: '123456780' }) post sub_path, headers: auth_header @@ -52,7 +52,7 @@ it 'returns a 404' do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/benefit_claim/find_bnft_claim_400') do - allow_any_instance_of(ClaimsApi::LocalBGS) + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_by_ssn).and_return({ file_nbr: '123456780' }) post error_sub_path, headers: auth_header @@ -67,11 +67,11 @@ it 'passes for a valid type' do bgs_claim_response = build(:bgs_response_with_one_lc_status).to_h bgs_claim_response[:benefit_claim_details_dto][:bnft_claim_type_cd] = '140ISCD' - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_benefit_claim_details_by_benefit_claim_id).and_return(bgs_claim_response) mock_ccg(scopes) do |auth_header| - allow_any_instance_of(ClaimsApi::LocalBGS) + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_by_ssn).and_return({ file_nbr: '123456780' }) post sub_path, params: { sponsorIcn: sponsor_id }, headers: auth_header @@ -83,7 +83,7 @@ it 'silently passes for an invalid type' do mock_ccg(scopes) do |auth_header| VCR.use_cassette('claims_api/bgs/benefit_claim/update_5103_200') do - allow_any_instance_of(ClaimsApi::LocalBGS) + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_by_ssn).and_return({ file_nbr: '123456780' }) post sub_path, params: { sponsorIcn: sponsor_id }, headers: auth_header diff --git a/modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb index 2867bc29e50..029155e258f 100644 --- a/modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/intent_to_files_request_spec.rb @@ -3,12 +3,12 @@ require 'rails_helper' require_relative '../../../rails_helper' require 'token_validation/v2/client' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'IntentToFiles', type: :request do let(:veteran_id) { '1013062086V794840' } let(:iws) do - ClaimsApi::LocalBGS + ClaimsApi::MiscellaneousBGSOperations end describe 'IntentToFiles' do diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb index dee3b666e60..8412786e16d 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_ind_request_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require_relative '../../../rails_helper' require 'token_validation/v2/client' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'Power Of Attorney', type: :request do let(:veteran_id) { '1013062086V794840' } @@ -13,7 +13,7 @@ let(:individual_poa_code) { 'A1H' } let(:organization_poa_code) { '083' } let(:bgs_poa) { { person_org_name: "#{individual_poa_code} name-here" } } - let(:local_bgs) { ClaimsApi::LocalBGS } + let(:local_bgs) { ClaimsApi::MiscellaneousBGSOperations } describe 'PowerOfAttorney' do before do diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb index e9016bdde23..913d4a45f19 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_org_request_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require_relative '../../../rails_helper' require 'token_validation/v2/client' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'Power Of Attorney', type: :request do let(:veteran_id) { '1013062086V794840' } @@ -13,7 +13,7 @@ let(:individual_poa_code) { 'A1H' } let(:organization_poa_code) { '083' } let(:bgs_poa) { { person_org_name: "#{individual_poa_code} name-here" } } - let(:local_bgs) { ClaimsApi::LocalBGS } + let(:local_bgs) { ClaimsApi::MiscellaneousBGSOperations } describe 'PowerOfAttorney' do before do diff --git a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb index 186e5f5ee5b..320591e85c3 100644 --- a/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/power_of_attorney_request_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require_relative '../../../rails_helper' require 'token_validation/v2/client' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' RSpec.describe 'Power Of Attorney', type: :request do let(:veteran_id) { '1013062086V794840' } @@ -14,7 +14,7 @@ let(:individual_poa_code) { 'A1H' } let(:organization_poa_code) { '083' } let(:bgs_poa) { { person_org_name: "#{individual_poa_code} name-here" } } - let(:local_bgs) { ClaimsApi::LocalBGS } + let(:local_bgs) { ClaimsApi::MiscellaneousBGSOperations } describe 'PowerOfAttorney' do before do diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb index 8dfb2d682cd..4e105cd75c3 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_claims_request_spec.rb @@ -3,12 +3,12 @@ require 'swagger_helper' require 'rails_helper' require_relative '../../../rails_helper' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' describe 'Claims', openapi_spec: Rswag::TextHelpers.new.claims_api_docs do let(:bcs) do - ClaimsApi::LocalBGS + ClaimsApi::MiscellaneousBGSOperations end before do diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb index a20b1632e0b..3540d9409f0 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_evidence_waiver_spec.rb @@ -57,11 +57,11 @@ before do |example| bgs_claim_response = build(:bgs_response_with_one_lc_status).to_h - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_benefit_claim_details_by_benefit_claim_id).and_return(bgs_claim_response) mock_ccg(scopes) do - allow_any_instance_of(ClaimsApi::LocalBGS) + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_by_ssn).and_return({ file_nbr: '123456780' }) submit_request(example.metadata) end @@ -118,7 +118,7 @@ before do |example| mock_ccg(scopes) do - allow_any_instance_of(ClaimsApi::LocalBGS) + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_benefit_claim_details_by_benefit_claim_id).and_return(nil) submit_request(example.metadata) end diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_intent_to_file_request_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_intent_to_file_request_spec.rb index 063e858df64..74038f1331c 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_intent_to_file_request_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_intent_to_file_request_spec.rb @@ -60,7 +60,7 @@ Timecop.freeze(Time.zone.parse('2022-01-01T08:00:00Z')) mock_ccg(scopes) do - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_intent_to_file_by_ptcpnt_id_itf_type_cd).and_return(bgs_response) submit_request(example.metadata) @@ -116,7 +116,7 @@ before do |example| mock_ccg(scopes) do - expect_any_instance_of(ClaimsApi::LocalBGS) + expect_any_instance_of(ClaimsApi::MiscellaneousBGSOperations) .to receive(:find_intent_to_file_by_ptcpnt_id_itf_type_cd).and_return(nil) submit_request(example.metadata) @@ -194,7 +194,7 @@ end before do |example| - allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:insert_intent_to_file).and_return( + allow_any_instance_of(ClaimsApi::MiscellaneousBGSOperations).to receive(:insert_intent_to_file).and_return( stub_response ) diff --git a/modules/claims_api/spec/requests/v2/veterans/rswag_power_of_attorney_spec.rb b/modules/claims_api/spec/requests/v2/veterans/rswag_power_of_attorney_spec.rb index 9c17a58ad68..d93895e200e 100644 --- a/modules/claims_api/spec/requests/v2/veterans/rswag_power_of_attorney_spec.rb +++ b/modules/claims_api/spec/requests/v2/veterans/rswag_power_of_attorney_spec.rb @@ -5,12 +5,12 @@ require 'rails_helper' require_relative '../../../rails_helper' require_relative '../../../support/swagger_shared_components/v2' -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' # doc generation for V2 ITFs temporarily disabled by API-13879 describe 'PowerOfAttorney', openapi_spec: Rswag::TextHelpers.new.claims_api_docs do - let(:local_bgs) { ClaimsApi::LocalBGS } + let(:local_bgs) { ClaimsApi::MiscellaneousBGSOperations } path '/veterans/{veteranId}/power-of-attorney' do get 'Find current Power of Attorney for a Veteran.' do diff --git a/modules/claims_api/spec/sidekiq/ews_vbms_sidekiq_spec.rb b/modules/claims_api/spec/sidekiq/ews_vbms_sidekiq_spec.rb index 9ff0dd6924e..45f2037cbef 100644 --- a/modules/claims_api/spec/sidekiq/ews_vbms_sidekiq_spec.rb +++ b/modules/claims_api/spec/sidekiq/ews_vbms_sidekiq_spec.rb @@ -11,7 +11,6 @@ context 'when upload is successful' do it 'updates the Evidence Waiver Submission record' do - allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' }) allow_any_instance_of(ClaimsApi::VBMSUploader).to receive(:upload!).and_return( { status: ClaimsApi::EvidenceWaiverSubmission::UPLOADED diff --git a/modules/veteran/app/models/veteran/user.rb b/modules/veteran/app/models/veteran/user.rb index 06906300a0e..cc73d80c075 100644 --- a/modules/veteran/app/models/veteran/user.rb +++ b/modules/veteran/app/models/veteran/user.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'bgs_service/local_bgs' +require 'bgs_service/miscellaneous_bgs_operations' # Veteran model module Veteran @@ -54,7 +54,7 @@ def bgs_service def local_bgs_service external_key = "#{@user.first_name} #{@user.last_name}" - @local_bgs_service ||= ClaimsApi::LocalBGS.new( + @local_bgs_service ||= ClaimsApi::MiscellaneousBGSOperations.new( external_uid: @user.mpi_icn, external_key: external_key.presence || @user.mpi_icn ) diff --git a/modules/veteran/spec/models/veteran/user_spec.rb b/modules/veteran/spec/models/veteran/user_spec.rb index e973af313e6..59f866b0cd2 100644 --- a/modules/veteran/spec/models/veteran/user_spec.rb +++ b/modules/veteran/spec/models/veteran/user_spec.rb @@ -6,7 +6,7 @@ context 'initialization' do let(:user) { FactoryBot.create(:user, :loa3) } - let(:ows) { ClaimsApi::LocalBGS } + let(:ows) { ClaimsApi::MiscellaneousBGSOperations } it 'initializes from a user' do VCR.use_cassette('bgs/claimant_web_service/find_poa_by_participant_id') do