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 new file mode 100644 index 00000000000..85bf4cda2ff --- /dev/null +++ b/modules/claims_api/lib/bgs_service/vnp_ptcpnt_addrs_service.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module ClaimsApi + class VnpPtcpntAddrsService < ClaimsApi::LocalBGS + def vnp_ptcpnt_addrs_create(options) + arg_strg = convert_nil_values(options) + body = Nokogiri::XML::DocumentFragment.parse <<~EOXML + + #{arg_strg} + + EOXML + + make_request(endpoint: 'VnpPtcpntAddrsWebServiceBean/VnpPtcpntAddrsService', + action: 'vnpPtcpntAddrsCreate', body:, key: 'return') + end + end +end diff --git a/modules/claims_api/spec/lib/claims_api/vnp_ptcpnt_addrs_service_spec.rb b/modules/claims_api/spec/lib/claims_api/vnp_ptcpnt_addrs_service_spec.rb new file mode 100644 index 00000000000..e9dfa8550cb --- /dev/null +++ b/modules/claims_api/spec/lib/claims_api/vnp_ptcpnt_addrs_service_spec.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +require 'rails_helper' +require 'bgs_service/vnp_ptcpnt_addrs_service' +require Rails.root.join('modules', 'claims_api', 'spec', 'support', 'bgs_client_helpers.rb') + +metadata = { + bgs: { + service: 'vnp_ptcpnt_addrs_service', + operation: 'vnp_ptcpnt_addrs_create' + } +} + +describe ClaimsApi::VnpPtcpntAddrsService, metadata do + subject { described_class.new external_uid: 'xUid', external_key: 'xKey' } + + describe 'vnp_ptcpnt_addrs_create' do + let(:options) { {} } + + it 'responds with attributes' do + options[:vnp_ptcpnt_addrs_id] = nil + options[:vnp_proc_id] = '3854596' + options[:vnp_ptcpnt_id] = '182057' + options[:efctv_dt] = '2020-07-16T18:20:18Z' + options[:addrs_one_txt] = '76 Crowther Ave' + options[:addrs_three_txt] = nil + options[:addrs_two_txt] = nil + options[:bad_addrs_ind] = nil + options[:city_nm] = 'Bridgeport' + options[:cntry_nm] = nil + options[:county_nm] = nil + options[:eft_waiver_type_nm] = nil + options[:email_addrs_txt] = 'testy@test.com' + options[:end_dt] = nil + options[:fms_addrs_code_txt] = nil + options[:frgn_postal_cd] = nil + options[:group_1_verifd_type_cd] = nil + options[:jrn_dt] = '2020-07-16T18:20:17Z' + options[:jrn_lctn_id] = 281 + options[:jrn_obj_id] = 'VAgovAPI' + options[:jrn_status_type_cd] = 'U' + options[:jrn_user_id] = 'VAgovAPI' + options[:lctn_nm] = nil + options[:mlty_postal_type_cd] = nil + options[:mlty_post_office_type_cd] = nil + options[:postal_cd] = 'CT' + options[:prvnc_nm] = 'CT' + options[:ptcpnt_addrs_type_nm] = 'Mailing' + options[:shared_addrs_ind] = 'N' + options[:trsury_addrs_five_txt] = nil + options[:trsury_addrs_four_txt] = nil + options[:trsury_addrs_one_txt] = nil + options[:trsury_addrs_six_txt] = nil + options[:trsury_addrs_three_txt] = nil + options[:trsury_addrs_two_txt] = nil + options[:trsury_seq_nbr] = nil + options[:trtry_nm] = nil + options[:zip_first_suffix_nbr] = nil + options[:zip_prefix_nbr] = '06605' + options[:zip_second_suffix_nbr] = nil + + use_bgs_cassette('happy_path') do + response = subject.vnp_ptcpnt_addrs_create(options) + expect(response).to include( + { vnp_ptcpnt_addrs_id: '143950', + efctv_dt: '2020-07-16T18:20:18Z', + vnp_ptcpnt_id: '182057', + vnp_proc_id: '3854596', + addrs_one_txt: '76 Crowther Ave', + city_nm: 'Bridgeport', + email_addrs_txt: 'testy@test.com', + jrn_dt: '2020-07-16T18:20:17Z', + jrn_lctn_id: '281', + jrn_obj_id: 'VAgovAPI', + jrn_status_type_cd: 'U', + jrn_user_id: 'VAgovAPI', + postal_cd: 'CT', + prvnc_nm: 'CT', + ptcpnt_addrs_type_nm: 'Mailing', + shared_addrs_ind: 'N', + zip_prefix_nbr: '06605' } + ) + end + end + end +end diff --git a/modules/claims_api/spec/support/bgs_client_helpers.rb b/modules/claims_api/spec/support/bgs_client_helpers.rb index 8cd2c5f8ebc..4d6394c50fd 100644 --- a/modules/claims_api/spec/support/bgs_client_helpers.rb +++ b/modules/claims_api/spec/support/bgs_client_helpers.rb @@ -38,7 +38,7 @@ module BGSClientHelpers # Then, HTTP interactions that occur within the block supplied to this method # will be captured by VCR cassettes that have the following convenient # properties: - # - They will be nicely organized at `bgs/:service/:operation/:name` + # - They will be nicely organized at `claims_api/bgs/:service/:operation/:name` # - Cassette matching will be done on canonicalized XML bodies, so # reformatting cassettes for human readability won't defeat matching def use_bgs_cassette(name, &) diff --git a/spec/support/vcr_cassettes/claims_api/bgs/vnp_ptcpnt_addrs_service/vnp_ptcpnt_addrs_create/happy_path.yml b/spec/support/vcr_cassettes/claims_api/bgs/vnp_ptcpnt_addrs_service/vnp_ptcpnt_addrs_create/happy_path.yml new file mode 100644 index 00000000000..11d52b9b5fd --- /dev/null +++ b/spec/support/vcr_cassettes/claims_api/bgs/vnp_ptcpnt_addrs_service/vnp_ptcpnt_addrs_create/happy_path.yml @@ -0,0 +1,186 @@ +--- +http_interactions: +- request: + method: get + uri: /VnpPtcpntAddrsWebServiceBean/VnpPtcpntAddrsService?WSDL + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Faraday v2.9.0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 04 Apr 2024 18:57:11 GMT + Server: + - Apache + X-Frame-Options: + - SAMEORIGIN + Transfer-Encoding: + - chunked + Content-Type: + - text/xml;charset=utf-8 + Strict-Transport-Security: + - max-age=16000000; includeSubDomains; preload; + body: + encoding: UTF-8 + string: |- + + recorded_at: Thu, 04 Apr 2024 18:57:11 GMT +- request: + method: post + uri: /VnpPtcpntAddrsWebServiceBean/VnpPtcpntAddrsService + body: + encoding: UTF-8 + string: | + + + + + + VAgovAPI + + + 127.0.0.1 + 281 + VAgovAPI + xUid + xKey + + + + + + + + 3854596 + 182057 + 2020-07-16T18:20:18Z + 76 Crowther Ave + + + + Bridgeport + + + + testy@test.com + + + + + 2020-07-16T18:20:17Z + 281 + VAgovAPI + U + VAgovAPI + + + + CT + CT + Mailing + N + + + + + + + + + + 06605 + + + + + + headers: + User-Agent: + - Faraday v2.9.0 + Content-Type: + - text/xml;charset=UTF-8 + Host: + - ".vba.va.gov" + Soapaction: + - '"vnpPtcpntAddrsCreate"' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Date: + - Thu, 04 Apr 2024 18:57:12 GMT + Server: + - Apache + X-Frame-Options: + - SAMEORIGIN + Transfer-Encoding: + - chunked + Content-Type: + - text/xml; charset=utf-8 + Strict-Transport-Security: + - max-age=16000000; includeSubDomains; preload; + body: + encoding: UTF-8 + string: | + + + + + rO0ABXdKABR3ZWJsb2dpYy5hcHAudm5wLWVhcgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTIuMC44AAA= + + + + + + 143950 + 2020-07-16T18:20:18Z + 182057 + 3854596 + 76 Crowther Ave + Bridgeport + testy@test.com + 2020-07-16T18:20:17Z + 281 + VAgovAPI + U + VAgovAPI + CT + CT + Mailing + N + 06605 + + + + + recorded_at: Thu, 04 Apr 2024 18:57:12 GMT +recorded_with: VCR 6.2.0