Skip to content

Commit

Permalink
Misc fixes, test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mchristiansonVA committed Dec 4, 2024
1 parent 936931f commit f0f5083
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ module EBenefitsBnftClaimStatusWebService
#
module IntentToFileWebService
DEFINITION =
Service.new(
bean: IntentToFileWebServiceBean::DEFINITION,
path: 'IntentToFileWebService'
Bean.new(
path: 'IntentToFileWebServiceBean',
namespaces: Namespaces.new(
target: 'http://intenttofile.services.vetsnet.vba.va.gov/',
data: nil
)
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require 'claims_api/v2/benefits_documents/service'
require 'evss/disability_compensation_auth_headers'
require 'bgs_service/e_benefits_bnft_claim_status_web_service'
require 'bgs_service/intent_to_file_web_service'

module ClaimsApi
module V2
Expand Down Expand Up @@ -95,6 +96,14 @@ def bgs_claim_status_service
)
end

def bgs_itf_service
external_key = target_veteran.participant_id.to_s
@bgs_itf_service ||= ClaimsApi::IntentToFileWebService.new(
external_uid: external_key,
external_key:
)
end

# Creates a token OR gets existing one
def get_benefits_documents_auth_token
@auth_token ||= ClaimsApi::V2::BenefitsDocuments::Service.new.get_auth_token
Expand Down
Original file line number Diff line number Diff line change
@@ -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/intent_to_file_web_service'

module ClaimsApi
module V2
Expand All @@ -18,7 +18,7 @@ def type # rubocop:disable Metrics/MethodLength
validate_request!(ClaimsApi::V2::ParamsValidation::IntentToFile)

type = get_bgs_type(params)
response = local_bgs_service.find_intent_to_file_by_ptcpnt_id_itf_type_cd(
response = bgs_itf_service.find_intent_to_file_by_ptcpnt_id_itf_type_cd(
target_veteran.participant_id,
type
)
Expand Down Expand Up @@ -54,7 +54,7 @@ def submit

options = build_options_and_validate(type)

bgs_response = local_bgs_service.insert_intent_to_file(options)
bgs_response = bgs_itf_service.insert_intent_to_file(options)
if bgs_response.empty?
ClaimsApi::IntentToFile.create!(status: ClaimsApi::IntentToFile::ERRORED, cid: token.payload['cid'])
raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Veteran ID not found')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module ClaimsApi
class IntentToFileWebService < ClaimsAPI::LocalBGS
class IntentToFileWebService < ClaimsApi::LocalBGS
def bean_name
'IntentToFileWebServiceBean/IntentToFileWebService'
end
Expand Down
10 changes: 5 additions & 5 deletions modules/claims_api/spec/requests/v1/forms/0966_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'
require_relative '../../../rails_helper'
require 'bgs_service/local_bgs'
require 'bgs_service/intent_to_file_web_service'

RSpec.describe 'ClaimsApi::V1::Forms::0966', type: :request do
let(:headers) do
Expand Down Expand Up @@ -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::IntentToFileWebService)
.to receive(:insert_intent_to_file).with(hash_including(participant_claimant_id: '123')).and_return({})

mock_acg(scopes) do |auth_header|
Expand All @@ -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::IntentToFileWebService)
.to receive(:insert_intent_to_file).with(hash_including(claimant_ssn: '123')).and_return({})

mock_acg(scopes) do |auth_header|
Expand All @@ -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::IntentToFileWebService)
.to receive(:insert_intent_to_file).with(hash_including(participant_claimant_id: '999')).and_return({})

mock_acg(scopes) do |auth_header|
Expand All @@ -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::IntentToFileWebService)
.to receive(:insert_intent_to_file).with(
hash_including(
participant_claimant_id: '123', claimant_ssn: '456'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
require 'rails_helper'
require_relative '../../../rails_helper'
require 'token_validation/v2/client'
require 'bgs_service/local_bgs'
require 'bgs_service/intent_to_file_web_service'

RSpec.describe 'ClaimsApi::V2::Veterans::IntentToFiles', type: :request do
RSpec.describe 'ClaimsApi::V2::Veterans::IntentToFile', type: :request do
let(:veteran_id) { '1013062086V794840' }
let(:iws) do
ClaimsApi::LocalBGS
ClaimsApi::IntentToFileWebService
end

describe 'IntentToFiles' do
Expand Down

0 comments on commit f0f5083

Please sign in to comment.