sterling_api 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.md +2 -0
- data/Rakefile +2 -0
- data/doc/AdminRequest.xsd +47 -0
- data/doc/AdminResponse.xsd +64 -0
- data/doc/CPBackgroundReports.xsd +55 -0
- data/doc/CPScreenings.xsd +1762 -0
- data/doc/admin.wsdl +57 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/sterling_api/background_check.rb +339 -0
- data/lib/sterling_api/password_change.rb +65 -0
- data/lib/sterling_api/remote_actions.rb +116 -0
- data/lib/sterling_api/version.rb +3 -0
- data/lib/sterling_api/xml_helper.rb +43 -0
- data/lib/sterling_api/xml_samples.rb +50 -0
- data/lib/sterling_api.rb +124 -0
- data/lib/tasks/sterling_api_tasks.rake +4 -0
- data/sterling_api.gemspec +27 -0
- data/test/background_check_test.rb +304 -0
- data/test/password_change_test.rb +32 -0
- data/test/remote_actions_test.rb +47 -0
- data/test/sterling_api_test.rb +70 -0
- data/test/test_helper.rb +143 -0
- data/uninstall.rb +1 -0
- metadata +139 -0
data/lib/sterling_api.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
2
|
+
require 'sterling_api/xml_helper'
|
3
|
+
require 'sterling_api/background_check'
|
4
|
+
require 'sterling_api/password_change'
|
5
|
+
require 'sterling_api/remote_actions'
|
6
|
+
|
7
|
+
module SterlingApi
|
8
|
+
|
9
|
+
URLS = {
|
10
|
+
:test => {
|
11
|
+
:wsdl_background_checks => {
|
12
|
+
:name => 'WSDL - Back Ground Checks',
|
13
|
+
:description => 'URL for background screening web services WSDL',
|
14
|
+
:url => 'https://deuce.tandemselect.com:9000/wh_soap_listener.cgi'
|
15
|
+
},
|
16
|
+
:order_one_step => {
|
17
|
+
:name => 'New Requests URL - Customer Test (One-Step)',
|
18
|
+
:description => 'URL for web service CreateOrder',
|
19
|
+
:url => 'https://deuce.tandemselect.com:9000/wh_soap_listener.cgi'
|
20
|
+
},
|
21
|
+
:order_two_step => {
|
22
|
+
:name => 'New Requests URL - Customer Test (Two-Step)',
|
23
|
+
:description => 'URL for web service CreateOrder',
|
24
|
+
:url => 'https://deuce.tandemselect.com:9000/wh_soap_listener.cgi'
|
25
|
+
},
|
26
|
+
:provider_website => {
|
27
|
+
:name => 'Provider Website URL - Test',
|
28
|
+
:description => 'CPScreen.com URL',
|
29
|
+
:url => 'https://deuce.tandemselect.com:9000/wh_soap_listener.cgi'
|
30
|
+
},
|
31
|
+
:response_post => {
|
32
|
+
:name => 'Response URL - Customer Test',
|
33
|
+
:description => 'URL ChoicePoint uses to post results to ATS',
|
34
|
+
:url => ''
|
35
|
+
},
|
36
|
+
:wsdl_admin => {
|
37
|
+
:name => 'WSDL - Admin',
|
38
|
+
:description => 'URL for admin web services WSDL',
|
39
|
+
:url => 'https://deuce.tandemselect.com:9000/wh_soap_listener.cgi'
|
40
|
+
},
|
41
|
+
:password_change => {
|
42
|
+
:name => 'Password Change Requests URL - Test',
|
43
|
+
:description => 'URL for web service ChangePasswords, GetPackages',
|
44
|
+
:url => 'https://deuce.tandemselect.com:9000/wh_soap_listener.cgi'
|
45
|
+
},
|
46
|
+
},
|
47
|
+
|
48
|
+
:prod => {
|
49
|
+
:wsdl_background_checks => {
|
50
|
+
:name => 'WSDL - Back Ground Checks',
|
51
|
+
:description => 'URL for background screening web services WSDL',
|
52
|
+
:url => 'https://orders.tandemselect.com:444/wh_soap_listener.cgi'
|
53
|
+
},
|
54
|
+
:order_one_step => {
|
55
|
+
:name => 'New Requests URL - Production (One-Step)',
|
56
|
+
:description => 'URL for web service CreateOrder',
|
57
|
+
:url => 'https://orders.tandemselect.com:444/wh_soap_listener.cgi'
|
58
|
+
},
|
59
|
+
:order_two_step => {
|
60
|
+
:name => 'New Requests URL - Production (Two-Step)',
|
61
|
+
:description => 'URL for web service CreateOrder',
|
62
|
+
:url => 'https://orders.tandemselect.com:444/wh_soap_listener.cgi'
|
63
|
+
},
|
64
|
+
:provider_website => {
|
65
|
+
:name => 'Provider Website URL - Production',
|
66
|
+
:description => 'CPScreen.com URL',
|
67
|
+
:url => 'https://orders.tandemselect.com:444/wh_soap_listener.cgi'
|
68
|
+
},
|
69
|
+
:response_post => {
|
70
|
+
:name => 'Response URL - Production',
|
71
|
+
:description => 'URL ChoicePoint uses to post results to ATS',
|
72
|
+
:url => ''
|
73
|
+
},
|
74
|
+
:wsdl_admin => {
|
75
|
+
:name => 'WSDL - Admin',
|
76
|
+
:description => 'URL for admin web services WSDL',
|
77
|
+
:url => 'https://orders.tandemselect.com:444/wh_soap_listener.cgi'
|
78
|
+
},
|
79
|
+
:password_change => {
|
80
|
+
:name => 'Password Change Requests URL - Production',
|
81
|
+
:description => 'URL for web service ChangePasswords, GetPackages',
|
82
|
+
:url => 'https://orders.tandemselect.com:444/wh_soap_listener.cgi'
|
83
|
+
},
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
class Api
|
89
|
+
|
90
|
+
# mode: prod[uction] or test
|
91
|
+
def initialize(mode)
|
92
|
+
@mode = mode
|
93
|
+
# test system password is 'Password2' until changed
|
94
|
+
self
|
95
|
+
end
|
96
|
+
|
97
|
+
def mode
|
98
|
+
@mode.to_s =~ /prod/i ? :prod : :test
|
99
|
+
end
|
100
|
+
|
101
|
+
def order(background_check)
|
102
|
+
req = SterlingApi::RemoteActions::Request.new(
|
103
|
+
:url => url(:order_one_step),
|
104
|
+
:body => background_check.to_xml
|
105
|
+
)
|
106
|
+
req.send_request
|
107
|
+
end
|
108
|
+
|
109
|
+
def password_change_request(password_change)
|
110
|
+
req = SterlingApi::RemoteActions::Request.new(
|
111
|
+
:url => url(:password_change),
|
112
|
+
:body => password_change.to_xml
|
113
|
+
)
|
114
|
+
req.send_request
|
115
|
+
end
|
116
|
+
|
117
|
+
def url(type)
|
118
|
+
SterlingApi::URLS[mode][type][:url]
|
119
|
+
end
|
120
|
+
|
121
|
+
end # class Api
|
122
|
+
|
123
|
+
|
124
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sterling_api/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "sterling_api"
|
7
|
+
s.version = SterlingApi::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Manny Rodriguez"]
|
10
|
+
s.email = ["manny@7compass.com"]
|
11
|
+
s.homepage = "https://github.com/7compass/sterling_api"
|
12
|
+
s.summary = %q{Sterling Api}
|
13
|
+
s.description = %q{For requesting background checks}
|
14
|
+
|
15
|
+
s.rubyforge_project = "sterling_api"
|
16
|
+
|
17
|
+
s.add_runtime_dependency("nokogiri")
|
18
|
+
s.add_runtime_dependency("net/http")
|
19
|
+
s.add_runtime_dependency("net/https")
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
23
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
|
26
|
+
s.license = 'MIT'
|
27
|
+
end
|
@@ -0,0 +1,304 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class BackgroundCheckTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'should get mvr node' do
|
6
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
7
|
+
one_year_ago = 1.year.ago.to_date
|
8
|
+
bg_hash[:licenses] << license_hash(
|
9
|
+
{
|
10
|
+
:valid_from => one_year_ago,
|
11
|
+
:valid_to => nil,
|
12
|
+
:country_code => 'US',
|
13
|
+
:license_number => '1234ABC',
|
14
|
+
:license_region => 'FL',
|
15
|
+
}
|
16
|
+
)
|
17
|
+
bg_hash[:licenses] << license_hash(
|
18
|
+
{
|
19
|
+
:valid_from => '1999-03-13',
|
20
|
+
:valid_to => one_year_ago,
|
21
|
+
:country_code => 'US',
|
22
|
+
:license_number => 'in&val<id>',
|
23
|
+
:license_region => 'CA',
|
24
|
+
}
|
25
|
+
)
|
26
|
+
|
27
|
+
bg = SterlingApi::BackgroundCheck.for_package(2116, bg_hash)
|
28
|
+
xml = bg.to_xml
|
29
|
+
|
30
|
+
assert_node xml, 'License', :attributes => {:validFrom => one_year_ago.to_s(:db), :validTo => ""}
|
31
|
+
assert_node xml, 'LicenseNumber', :content => '1234ABC'
|
32
|
+
assert_node xml, 'LicenseRegion', :content => 'FL'
|
33
|
+
|
34
|
+
assert_node xml, 'License', :attributes => {:validFrom => "1999-03-13", :validTo => one_year_ago.to_s(:db)}
|
35
|
+
assert_node xml, 'LicenseNumber', :content => 'in&val<id>'
|
36
|
+
assert_node xml, 'LicenseRegion', :content => 'CA'
|
37
|
+
end
|
38
|
+
|
39
|
+
test 'should get names' do
|
40
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
41
|
+
bg_hash[:person_names] << name_hash({
|
42
|
+
:type => 'subject',
|
43
|
+
:first_name => 'First1',
|
44
|
+
:middle_name => 'M1',
|
45
|
+
:last_name => 'Last1'
|
46
|
+
})
|
47
|
+
bg_hash[:person_names] << name_hash({
|
48
|
+
:type => 'alias',
|
49
|
+
:first_name => 'First2',
|
50
|
+
:middle_name => 'M2',
|
51
|
+
:last_name => 'Last2'
|
52
|
+
})
|
53
|
+
bg = SterlingApi::BackgroundCheck.for_package(2112, bg_hash)
|
54
|
+
xml = bg.to_xml
|
55
|
+
|
56
|
+
assert_node xml, 'PersonName', :attributes => {:type => 'subject'}, :child => {:node_name => 'GivenName', :content => 'First1'}
|
57
|
+
assert_node xml, 'PersonName', :attributes => {:type => 'subject'}, :child => {:node_name => 'MiddleName', :content => 'M1'}
|
58
|
+
assert_node xml, 'PersonName', :attributes => {:type => 'subject'}, :child => {:node_name => 'FamilyName', :content => 'Last1'}
|
59
|
+
|
60
|
+
assert_node xml, 'PersonName', :attributes => {:type => 'alias'}, :child => {:node_name => 'GivenName', :content => 'First2'}
|
61
|
+
assert_node xml, 'PersonName', :attributes => {:type => 'alias'}, :child => {:node_name => 'MiddleName', :content => 'M2'}
|
62
|
+
assert_node xml, 'PersonName', :attributes => {:type => 'alias'}, :child => {:node_name => 'FamilyName', :content => 'Last2'}
|
63
|
+
end
|
64
|
+
|
65
|
+
test 'should get addresses' do
|
66
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
67
|
+
bg_hash[:postal_addresses] << address_hash({
|
68
|
+
:type => 'current',
|
69
|
+
:valid_from => '2010-01-02',
|
70
|
+
:valid_to => '2020-12-31',
|
71
|
+
:municipality => 'Madison',
|
72
|
+
:region => 'WI',
|
73
|
+
:postal_code => '53711',
|
74
|
+
:country_code => 'US',
|
75
|
+
:address1 => '1234 Main St',
|
76
|
+
:address2 => '',
|
77
|
+
})
|
78
|
+
bg_hash[:postal_addresses] << address_hash({
|
79
|
+
:type => 'prior',
|
80
|
+
:valid_from => '2001-02-03',
|
81
|
+
:valid_to => '2009-11-12',
|
82
|
+
:municipality => 'Podunk',
|
83
|
+
:region => 'KS',
|
84
|
+
:postal_code => '98765',
|
85
|
+
:country_code => 'US',
|
86
|
+
:address1 => '222 There St',
|
87
|
+
:address2 => 'Apt 2',
|
88
|
+
})
|
89
|
+
bg = SterlingApi::BackgroundCheck.for_package(2112, bg_hash)
|
90
|
+
xml = bg.to_xml
|
91
|
+
|
92
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'current', :validFrom => '2010-01-02', :validTo => '2020-12-31'},
|
93
|
+
:child => {:node_name => 'Municipality', :content => 'Madison'}
|
94
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'current', :validFrom => '2010-01-02', :validTo => '2020-12-31'},
|
95
|
+
:child => {:node_name => 'Region', :content => 'WI'}
|
96
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'current', :validFrom => '2010-01-02', :validTo => '2020-12-31'},
|
97
|
+
:child => {:node_name => 'PostalCode', :content => '53711'}
|
98
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'current', :validFrom => '2010-01-02', :validTo => '2020-12-31'},
|
99
|
+
:child => {:node_name => 'CountryCode', :content => 'US'}
|
100
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'current', :validFrom => '2010-01-02', :validTo => '2020-12-31'},
|
101
|
+
:child => {:node_name => 'DeliveryAddress', :child => {
|
102
|
+
:node_name => 'AddressLine', :content => '1234 Main St'
|
103
|
+
}}
|
104
|
+
assert_no_node xml, 'PostalAddress', :attributes => {:type => 'current', :validFrom => '2010-01-02', :validTo => '2020-12-31'},
|
105
|
+
:child => {:node_name => 'DeliveryAddress', :child => {
|
106
|
+
:node_name => 'AddressLine', :content => ''
|
107
|
+
}}
|
108
|
+
|
109
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'prior', :validFrom => '2001-02-03', :validTo => '2009-11-12'},
|
110
|
+
:child => {:node_name => 'Municipality', :content => 'Podunk'}
|
111
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'prior', :validFrom => '2001-02-03', :validTo => '2009-11-12'},
|
112
|
+
:child => {:node_name => 'Region', :content => 'KS'}
|
113
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'prior', :validFrom => '2001-02-03', :validTo => '2009-11-12'},
|
114
|
+
:child => {:node_name => 'PostalCode', :content => '98765'}
|
115
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'prior', :validFrom => '2001-02-03', :validTo => '2009-11-12'},
|
116
|
+
:child => {:node_name => 'CountryCode', :content => 'US'}
|
117
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'prior', :validFrom => '2001-02-03', :validTo => '2009-11-12'},
|
118
|
+
:child => {:node_name => 'DeliveryAddress', :child => {
|
119
|
+
:node_name => 'AddressLine', :content => '222 There St'
|
120
|
+
}}
|
121
|
+
assert_node xml, 'PostalAddress', :attributes => {:type => 'prior', :validFrom => '2001-02-03', :validTo => '2009-11-12'},
|
122
|
+
:child => {:node_name => 'DeliveryAddress', :child => {
|
123
|
+
:node_name => 'AddressLine', :content => 'Apt 2'
|
124
|
+
}}
|
125
|
+
end
|
126
|
+
|
127
|
+
test 'should get ssnv' do
|
128
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
129
|
+
bg_hash.merge!(ssnv_hash({
|
130
|
+
:ssn => '333224444',
|
131
|
+
:date_of_birth => '1951-02-03'
|
132
|
+
}))
|
133
|
+
bg = SterlingApi::BackgroundCheck.for_package(2112, bg_hash)
|
134
|
+
xml = bg.to_xml
|
135
|
+
assert_node xml, 'DemographicDetail', :child => {
|
136
|
+
:node_name => 'GovernmentId', :content => '333224444'
|
137
|
+
}
|
138
|
+
assert_node xml, 'DemographicDetail', :child => {
|
139
|
+
:node_name => 'DateOfBirth', :content => '1951-02-03'
|
140
|
+
}
|
141
|
+
end
|
142
|
+
|
143
|
+
test 'should have soap wrapper in to_xml' do
|
144
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
145
|
+
bg = SterlingApi::BackgroundCheck.for_package(2112, bg_hash)
|
146
|
+
xml = bg.to_xml
|
147
|
+
assert_node xml, 'soapenv:Envelope'
|
148
|
+
end
|
149
|
+
|
150
|
+
test 'should have order_as user and account' do
|
151
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2', :order_as_user_id => 'joeuser', :order_as_account_suffix => 'XYZ')
|
152
|
+
bg = SterlingApi::BackgroundCheck.for_package(2112, bg_hash)
|
153
|
+
xml = bg.to_xml
|
154
|
+
|
155
|
+
assert_node xml, 'ClientReferences', :child => {:node_name => 'ClientReference', :content => 'joeuser'}
|
156
|
+
assert_node xml, 'OrderAccount', :child => {:node_name => 'Account', :content => '036483XYZ'}
|
157
|
+
end
|
158
|
+
|
159
|
+
test '2112 should have correct parts' do
|
160
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
161
|
+
bg_hash[:person_names] << name_hash
|
162
|
+
bg_hash[:postal_addresses] << address_hash
|
163
|
+
bg_hash[:licenses] << license_hash
|
164
|
+
bg_hash.merge!(ssnv_hash)
|
165
|
+
|
166
|
+
bg = SterlingApi::BackgroundCheck.for_package(2112, bg_hash)
|
167
|
+
xml = bg.to_xml
|
168
|
+
|
169
|
+
assert_node xml, 'PackageId', :content => '2112'
|
170
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
171
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
172
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
173
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
174
|
+
assert_no_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
175
|
+
end
|
176
|
+
|
177
|
+
test '2113 should have correct parts' do
|
178
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
179
|
+
bg_hash[:person_names] << name_hash
|
180
|
+
bg_hash[:postal_addresses] << address_hash
|
181
|
+
bg_hash[:licenses] << license_hash
|
182
|
+
bg_hash.merge!(ssnv_hash)
|
183
|
+
|
184
|
+
bg = SterlingApi::BackgroundCheck.for_package(2113, bg_hash)
|
185
|
+
xml = bg.to_xml
|
186
|
+
|
187
|
+
assert_node xml, 'PackageId', :content => '2113'
|
188
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
189
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
190
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
191
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
192
|
+
assert_no_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
193
|
+
end
|
194
|
+
|
195
|
+
test '2114 should have correct parts' do
|
196
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
197
|
+
bg_hash[:person_names] << name_hash
|
198
|
+
bg_hash[:postal_addresses] << address_hash
|
199
|
+
bg_hash[:licenses] << license_hash
|
200
|
+
bg_hash.merge!(ssnv_hash)
|
201
|
+
|
202
|
+
bg = SterlingApi::BackgroundCheck.for_package(2114, bg_hash)
|
203
|
+
xml = bg.to_xml
|
204
|
+
|
205
|
+
assert_node xml, 'PackageId', :content => '2114'
|
206
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
207
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
208
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
209
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
210
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
211
|
+
end
|
212
|
+
|
213
|
+
test '2116 should have correct parts' do
|
214
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
215
|
+
bg_hash[:person_names] << name_hash
|
216
|
+
bg_hash[:postal_addresses] << address_hash
|
217
|
+
bg_hash[:licenses] << license_hash
|
218
|
+
bg_hash.merge!(ssnv_hash)
|
219
|
+
|
220
|
+
bg = SterlingApi::BackgroundCheck.for_package(2116, bg_hash)
|
221
|
+
xml = bg.to_xml
|
222
|
+
|
223
|
+
assert_node xml, 'PackageId', :content => '2116'
|
224
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
225
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
226
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
227
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
228
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
229
|
+
end
|
230
|
+
|
231
|
+
test '2117 should have correct parts' do
|
232
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
233
|
+
bg_hash[:person_names] << name_hash
|
234
|
+
bg_hash[:postal_addresses] << address_hash
|
235
|
+
bg_hash[:licenses] << license_hash
|
236
|
+
bg_hash.merge!(ssnv_hash)
|
237
|
+
|
238
|
+
bg = SterlingApi::BackgroundCheck.for_package(2117, bg_hash)
|
239
|
+
xml = bg.to_xml
|
240
|
+
|
241
|
+
assert_node xml, 'PackageId', :content => '2117'
|
242
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
243
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
244
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
245
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
246
|
+
assert_no_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
247
|
+
end
|
248
|
+
|
249
|
+
test '2168 should have correct parts' do
|
250
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
251
|
+
bg_hash[:person_names] << name_hash
|
252
|
+
bg_hash[:postal_addresses] << address_hash
|
253
|
+
bg_hash[:licenses] << license_hash
|
254
|
+
bg_hash.merge!(ssnv_hash)
|
255
|
+
|
256
|
+
bg = SterlingApi::BackgroundCheck.for_package(2168, bg_hash)
|
257
|
+
xml = bg.to_xml
|
258
|
+
|
259
|
+
assert_node xml, 'PackageId', :content => '2168'
|
260
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
261
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
262
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
263
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
264
|
+
assert_no_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
265
|
+
end
|
266
|
+
|
267
|
+
test '2169 should have correct parts' do
|
268
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
269
|
+
bg_hash[:person_names] << name_hash
|
270
|
+
bg_hash[:postal_addresses] << address_hash
|
271
|
+
bg_hash[:licenses] << license_hash
|
272
|
+
bg_hash.merge!(ssnv_hash)
|
273
|
+
|
274
|
+
bg = SterlingApi::BackgroundCheck.for_package(2169, bg_hash)
|
275
|
+
xml = bg.to_xml
|
276
|
+
|
277
|
+
assert_node xml, 'PackageId', :content => '2169'
|
278
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
279
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
280
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
281
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
282
|
+
assert_no_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
283
|
+
end
|
284
|
+
|
285
|
+
test '2360 should have correct parts' do
|
286
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2')
|
287
|
+
bg_hash[:person_names] << name_hash
|
288
|
+
bg_hash[:postal_addresses] << address_hash
|
289
|
+
bg_hash[:licenses] << license_hash
|
290
|
+
bg_hash.merge!(ssnv_hash)
|
291
|
+
|
292
|
+
bg = SterlingApi::BackgroundCheck.for_package(2360, bg_hash)
|
293
|
+
xml = bg.to_xml
|
294
|
+
|
295
|
+
assert_node xml, 'PackageId', :content => '2360'
|
296
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PersonName'}
|
297
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'PostalAddress'}
|
298
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'GovernmentId'}}
|
299
|
+
assert_node xml, 'PersonalData', :child => {:node_name => 'DemographicDetail', :child => {:node_name => 'DateOfBirth'}}
|
300
|
+
assert_no_node xml, 'PersonalData', :child => {:node_name => 'Licenses'}
|
301
|
+
end
|
302
|
+
|
303
|
+
|
304
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class PasswordChangeTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'should get new without subaccount' do
|
6
|
+
pc = SterlingApi::PasswordChange.new(
|
7
|
+
'12345',
|
8
|
+
'secret',
|
9
|
+
'secreter'
|
10
|
+
)
|
11
|
+
|
12
|
+
xml = pc.to_xml
|
13
|
+
|
14
|
+
assert_node xml, 'ChoicePointAdminRequest', :attributes => {:account => '12345'}
|
15
|
+
assert_node xml, 'Account', :content => '12345'
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'should get new with subaccount' do
|
19
|
+
pc = SterlingApi::PasswordChange.new(
|
20
|
+
'12345',
|
21
|
+
'secret',
|
22
|
+
'secreter',
|
23
|
+
'ABC'
|
24
|
+
)
|
25
|
+
|
26
|
+
xml = pc.to_xml
|
27
|
+
|
28
|
+
assert_node xml, 'ChoicePointAdminRequest', :attributes => {:account => '12345ABC'}
|
29
|
+
assert_node xml, 'Account', :content => '12345ABC'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RemoteActionsTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'should get host_from_url' do
|
6
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'http://test.lexisnexis.fake/foo/bar')
|
7
|
+
assert_equal 'test.lexisnexis.fake', req.host_from_url
|
8
|
+
|
9
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'http://this.that-test.lexisnexis.fake/foo/bar')
|
10
|
+
assert_equal 'this.that-test.lexisnexis.fake', req.host_from_url
|
11
|
+
|
12
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'http://test2.lexisnexis.fake')
|
13
|
+
assert_equal 'test2.lexisnexis.fake', req.host_from_url
|
14
|
+
|
15
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'test3.lexisnexis.fake/foo/bar')
|
16
|
+
assert_equal 'test3.lexisnexis.fake', req.host_from_url
|
17
|
+
|
18
|
+
req = SterlingApi::RemoteActions::Request.new(:url => '')
|
19
|
+
assert_equal nil, req.host_from_url
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'should get port_from_url' do
|
23
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'http://test.lexisnexis.fake/foo/bar')
|
24
|
+
assert_equal 80, req.port_from_url
|
25
|
+
|
26
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'https://test.lexisnexis.fake/foo/bar')
|
27
|
+
assert_equal 443, req.port_from_url
|
28
|
+
|
29
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'http://test.lexisnexis.fake:8765/foo/bar')
|
30
|
+
assert_equal 8765, req.port_from_url
|
31
|
+
end
|
32
|
+
|
33
|
+
test 'should get is_ssl?' do
|
34
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'http://test.lexisnexis.fake/foo/bar')
|
35
|
+
assert !req.is_ssl?
|
36
|
+
|
37
|
+
req = SterlingApi::RemoteActions::Request.new(:url => 'https://test.lexisnexis.fake/foo/bar')
|
38
|
+
assert req.is_ssl?
|
39
|
+
end
|
40
|
+
|
41
|
+
test 'should get response errors' do
|
42
|
+
res = SterlingApi::RemoteActions::MockResponse.new(:body => SterlingApi::XmlSamples::CHANGE_PASSWORD_FAIL_RESPONSE)
|
43
|
+
assert_equal '250', res.errors[:error_code]
|
44
|
+
assert_equal 'Invalid old password', res.errors[:error_description]
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class SterlingApiTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
# DO YOU REALLY WANT TO SEND THESE TEST REQUESTS TO LEXIS-NEXIS?
|
7
|
+
@SEND_REQUESTS = false
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'should order packages' do
|
11
|
+
if @SEND_REQUESTS
|
12
|
+
%w(Eligible Ineligible).each do |status|
|
13
|
+
@status = status
|
14
|
+
@client_reference1 = "Make me #{@status}"
|
15
|
+
@order_as_user_id = nil
|
16
|
+
@order_as_account_suffix = nil
|
17
|
+
|
18
|
+
[2112, 2113, 2114, 2116, 2117, 2168, 2169, 2360].each do |id|
|
19
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2',
|
20
|
+
:order_as_user_id => @order_as_user_id,
|
21
|
+
:order_as_account_suffix => @order_as_account_suffix,
|
22
|
+
:client_reference1 => @client_reference1
|
23
|
+
)
|
24
|
+
bg_hash[:person_names] << name_hash(:last_name => @status)
|
25
|
+
bg_hash[:postal_addresses] << address_hash
|
26
|
+
bg_hash[:licenses] << license_hash
|
27
|
+
bg_hash.merge!(ssnv_hash)
|
28
|
+
|
29
|
+
bg = SterlingApi::BackgroundCheck.for_package(id, bg_hash)
|
30
|
+
api = SterlingApi::Api.new(:test)
|
31
|
+
response = api.order(bg)
|
32
|
+
|
33
|
+
puts "response for package #{id}: #{response.inspect}"
|
34
|
+
assert_no_match %r{<ErrorReport>}, response.body, "Error on package #{id}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'should order packages with suffix' do
|
41
|
+
if @SEND_REQUESTS
|
42
|
+
%w(Eligible Ineligible).each do |status|
|
43
|
+
@status = status
|
44
|
+
@client_reference1 = "Make me #{@status}"
|
45
|
+
@order_as_user_id = 'test_user'
|
46
|
+
@order_as_account_suffix = 'TST'
|
47
|
+
|
48
|
+
[2112, 2113, 2114, 2116, 2117, 2168, 2169, 2360].each do |id|
|
49
|
+
bg_hash = background_check_hash(:account => '036483', :password => 'Password2',
|
50
|
+
:order_as_user_id => @order_as_user_id,
|
51
|
+
:order_as_account_suffix => @order_as_account_suffix,
|
52
|
+
:client_reference1 => @client_reference1
|
53
|
+
)
|
54
|
+
bg_hash[:person_names] << name_hash(:last_name => @status)
|
55
|
+
bg_hash[:postal_addresses] << address_hash
|
56
|
+
bg_hash[:licenses] << license_hash
|
57
|
+
bg_hash.merge!(ssnv_hash)
|
58
|
+
|
59
|
+
bg = SterlingApi::BackgroundCheck.for_package(id, bg_hash)
|
60
|
+
api = SterlingApi::Api.new(:test)
|
61
|
+
response = api.order(bg)
|
62
|
+
|
63
|
+
puts "response for package #{id}: #{response.inspect}"
|
64
|
+
assert_no_match %r{<ErrorReport>}, response.body, "Error on package #{id}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|