Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API-34933-proc-form-create #16092

Merged
merged 11 commits into from
Mar 28, 2024
9 changes: 9 additions & 0 deletions modules/claims_api/lib/bgs_service/local_bgs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,5 +339,14 @@ def transform_bgs_claims_to_evss(claims)
def to_camelcase(claim:)
claim.deep_transform_keys { |k| k.to_s.camelize(:lower) }
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]}</#{arg}>")
end
arg_strg
end
end
end
25 changes: 25 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

module ClaimsApi
class VnpProcFormService < ClaimsApi::LocalBGS
FORM_TYPE_CD = '21-22'

def vnp_proc_form_create(options)
vnp_proc_id = options[:vnp_proc_id]
options.delete(:vnp_proc_id)
arg_strg = convert_nil_values(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
<arg0>
<compId>
<vnpProcId>#{vnp_proc_id}</vnpProcId>
<formTypeCd>#{FORM_TYPE_CD}</formTypeCd>
</compId>
#{arg_strg}
</arg0>
EOXML

make_request(endpoint: 'VnpProcFormWebServiceBean/VnpProcFormService',
action: 'vnpProcFormCreate', body:, key: 'return')
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require 'rails_helper'
require 'bgs_service/vnp_proc_form_service'

describe ClaimsApi::VnpProcFormService do
subject { described_class.new external_uid: 'xUid', external_key: 'xKey' }

describe 'vnp_proc_form_service' do
let(:options) { {} }

it 'responds with a vnc_proc_id' do
options[:vnp_proc_id] = '3831394' # '3830252' '3854437' #
options[:vnp_ptcpnt_id] = nil
options[:jrn_dt] = nil
options[:jrn_obj_id] = 'VAgovAPI'
options[:jrn_status_type_cd] = 'U'
options[:jrn_user_id] = 'VAgovAPI'
VCR.use_cassette('bgs/vnp_proc_service_v2/vnp_proc_form_service') do
response = subject.vnp_proc_form_create(options)
expect(response[:comp_id][:vnp_proc_id]).to eq '3831394'
end
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading