-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new service, add spec & cassette
- Loading branch information
1 parent
137d71f
commit 26b50b7
Showing
3 changed files
with
352 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module ClaimsApi | ||
class VnpProcFormService < LocalBGS | ||
FORM_TYPE_CD = '21-22' | ||
|
||
def vnp_proc_form_create(options) | ||
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML | ||
<arg0> | ||
<VnpProcFormDTO> | ||
<compId> | ||
<vnpProcId>#{options[:vnp_proc_id]}</vnpProcId> | ||
<formTypeCd>#{FORM_TYPE_CD}</formTypeCd> | ||
</compId> | ||
<jrnDt>#{options[:jrn_dt]}</jrnDt> | ||
<jrnLctnId>#{options[:vnp_ptcpnt_id]}</jrnLctnId> | ||
<jrnObjId>#{options[:jrn_obj_id]}</jrnObjId> | ||
<jrnStatusTypeCd>#{options[:jrn_status_type_cd]}</jrnStatusTypeCd> | ||
<jrnUserId>#{options[:jrn_user_id]}</jrnUserId> | ||
</VnpProcFormDTO> | ||
</arg0> | ||
EOXML | ||
|
||
make_request(endpoint: 'VnpProcFormWebServiceBean/VnpProcFormService', | ||
action: 'vnpProcFormCreate', body:, key: 'return') | ||
end | ||
end | ||
end | ||
26 changes: 26 additions & 0 deletions
26
modules/claims_api/spec/lib/claims_api/vnp_proc_form_service_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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] = '3830252' # '3854437''3830249' # | ||
# options[:vnp_ptcpnt_id] = nil | ||
# options[:jrn_dt] = nil | ||
# options[:jrn_obj_id] = nil | ||
# options[:jrn_status_type_cd] = nil | ||
# options[:jrn_user_id] = nil | ||
VCR.use_cassette('bgs/vnp_proc_service_v2/vnp_proc_form_service') do | ||
byebug | ||
response = subject.vnp_proc_form_create(options) | ||
expect(response[:vnp_proc_id]).to eq '29637' | ||
end | ||
end | ||
end | ||
end | ||
Oops, something went wrong.