geti 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/geti/app_client.rb +21 -5
- data/lib/geti/auth_client.rb +5 -5
- data/lib/geti/client.rb +10 -6
- data/spec/remote/geti_app_client_spec.rb +71 -41
- data/spec/remote/sample.pdf +0 -0
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/geti/app_client.rb
CHANGED
@@ -151,13 +151,29 @@ class Geti::AppClient < Geti::Client
|
|
151
151
|
}
|
152
152
|
|
153
153
|
def board_merchant_ach(application)
|
154
|
-
response = soap_request("BoardCertificationMerchant_ACH", "board_certification_merchant_ach") do
|
155
|
-
data_packet(xml, application)
|
154
|
+
response = soap_request("BoardCertificationMerchant_ACH", "board_certification_merchant_ach") do
|
155
|
+
data_packet { |xml| data(xml, application) }
|
156
156
|
end
|
157
|
-
|
157
|
+
annotate_response(response[:response])
|
158
158
|
end
|
159
159
|
|
160
|
-
def
|
160
|
+
def retrieve_merchant_status(id)
|
161
|
+
response = soap_request("RetrieveCertificationMerchantStatus") do
|
162
|
+
{'MerchantID' => id}
|
163
|
+
end
|
164
|
+
annotate_response(response[:response])
|
165
|
+
end
|
166
|
+
|
167
|
+
def upload_supporting_docs(id, filedata)
|
168
|
+
response = soap_request("UploadCertificationSupportingDocs") do
|
169
|
+
{ 'MerchantID' => id,
|
170
|
+
'DataPacket' => Base64.encode64(filedata)
|
171
|
+
}
|
172
|
+
end
|
173
|
+
annotate_response(response[:response])
|
174
|
+
end
|
175
|
+
|
176
|
+
def data(xml, opts)
|
161
177
|
xml.Envelope do
|
162
178
|
xml.Body :FileName => "261407_28_May_2009_12_05_00_590.xml", :FileDate => Time.now.iso8601 do
|
163
179
|
xml.NewMerchant({
|
@@ -256,7 +272,7 @@ class Geti::AppClient < Geti::Client
|
|
256
272
|
end
|
257
273
|
|
258
274
|
private
|
259
|
-
def
|
275
|
+
def annotate_response(response)
|
260
276
|
response[:success] = response[:validation_message][:result] == "Passed"
|
261
277
|
response.delete(:"@xmlns:xsd")
|
262
278
|
response.delete(:"@xmlns:xsi")
|
data/lib/geti/auth_client.rb
CHANGED
@@ -20,8 +20,8 @@ class Geti::AuthClient < Geti::Client
|
|
20
20
|
# but no authorization.
|
21
21
|
# NOTE: CERTIFICATION SERVER ONLY
|
22
22
|
def validate(opts)
|
23
|
-
response = soap_request("AuthGatewayCertification") do
|
24
|
-
data_packet(xml, opts)
|
23
|
+
response = soap_request("AuthGatewayCertification") do
|
24
|
+
data_packet { |xml| data(xml, opts) }
|
25
25
|
end
|
26
26
|
Geti::Response.new(response)
|
27
27
|
end
|
@@ -29,14 +29,14 @@ class Geti::AuthClient < Geti::Client
|
|
29
29
|
# Creates an authorization for funds transfer. Returns a Result
|
30
30
|
# with both validation and (if valid) authorization responses.
|
31
31
|
def process(opts)
|
32
|
-
response = soap_request("ProcessSingleCertificationCheck") do
|
33
|
-
data_packet(xml, opts)
|
32
|
+
response = soap_request("ProcessSingleCertificationCheck") do
|
33
|
+
data_packet { |xml| data(xml, opts) }
|
34
34
|
end
|
35
35
|
Geti::Response.new(response)
|
36
36
|
end
|
37
37
|
|
38
38
|
|
39
|
-
def
|
39
|
+
def data(xml, opts)
|
40
40
|
xml.AUTH_GATEWAY do # has an optional REQUEST_ID attribute for later lookups
|
41
41
|
xml.TRANSACTION do
|
42
42
|
xml.TRANSACTION_ID
|
data/lib/geti/client.rb
CHANGED
@@ -2,7 +2,7 @@ require 'savon'
|
|
2
2
|
require 'httpi'
|
3
3
|
|
4
4
|
class Geti::Client
|
5
|
-
def initialize(auth, terminal_opts, env='test')
|
5
|
+
def initialize(auth, terminal_opts={}, env='test')
|
6
6
|
@user = auth[:user]
|
7
7
|
@pass = auth[:pass]
|
8
8
|
@env = env
|
@@ -12,16 +12,20 @@ class Geti::Client
|
|
12
12
|
@soap_client ||= Savon.client(service_address)
|
13
13
|
end
|
14
14
|
|
15
|
+
def data_packet
|
16
|
+
xml = Builder::XmlMarkup.new
|
17
|
+
xml.instruct!
|
18
|
+
yield xml
|
19
|
+
content = xml.target!
|
20
|
+
{"DataPacket" => content}
|
21
|
+
end
|
22
|
+
|
15
23
|
def soap_request(operation, op_key=nil)
|
16
24
|
operation.sub!('Certification','') unless certification?
|
17
25
|
response = soap_client.request operation do
|
18
26
|
http.headers.delete('SOAPAction')
|
19
27
|
config.soap_header = soap_header
|
20
|
-
|
21
|
-
xml.instruct!
|
22
|
-
yield xml if block_given?
|
23
|
-
content = xml.target!
|
24
|
-
soap.body = {"DataPacket" => content}
|
28
|
+
soap.body = (yield if block_given?)
|
25
29
|
end
|
26
30
|
|
27
31
|
op_key ||= operation.gsub(/(.)([A-Z])/, '\1_\2').downcase
|
@@ -1,50 +1,80 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Geti::AppClient do
|
4
|
+
before :all do
|
5
|
+
@timestamp = Time.now.to_i
|
6
|
+
end
|
7
|
+
|
8
|
+
def merchant_params(ts)
|
9
|
+
{ :id => ts,
|
10
|
+
:name => "Cogsley's Cogs %d" % ts,
|
11
|
+
:industry => "Metal_Fabricators",
|
12
|
+
:address => "123 Main St",
|
13
|
+
:city => "Vancouver",
|
14
|
+
:state => "WA",
|
15
|
+
:zip => "10120",
|
16
|
+
:phone => "5555551234",
|
17
|
+
:business_type => "Corporation",
|
18
|
+
:days_in_business => 404,
|
19
|
+
|
20
|
+
:contact_name => 'George Jetson',
|
21
|
+
:physical_address => "123 Main St",
|
22
|
+
:physical_city => "Vancouver",
|
23
|
+
:physical_state => "WA",
|
24
|
+
:physical_zip => "10120",
|
25
|
+
:physical_phone => "5555551234",
|
26
|
+
|
27
|
+
:principal_first_name => "Carl",
|
28
|
+
:principal_last_name => "Cogsley",
|
29
|
+
:principal_title => 'President',
|
30
|
+
:principal_address => "123 Main St",
|
31
|
+
:principal_city => "Vancouver",
|
32
|
+
:principal_state => "WA",
|
33
|
+
:principal_zip => "10120",
|
34
|
+
:principal_dob => "1965-04-28",
|
35
|
+
:principal_ssn => '111222123',
|
36
|
+
|
37
|
+
:average_amount => "4000",
|
38
|
+
:max_amount => "7600",
|
39
|
+
|
40
|
+
:taxpayer_name => "Carl Cogsley",
|
41
|
+
:taxpayer_id => "123456789",
|
42
|
+
|
43
|
+
:routing_number => "490000018",
|
44
|
+
:account_number => "123456789",
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
4
48
|
describe '#board_merchant_ach' do
|
5
49
|
it 'has a successful response' do
|
6
|
-
|
7
|
-
|
8
|
-
response
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
:principal_state => "WA",
|
33
|
-
:principal_zip => "10120",
|
34
|
-
:principal_dob => "1965-04-28",
|
35
|
-
:principal_ssn => '111222123',
|
36
|
-
|
37
|
-
:average_amount => "4000",
|
38
|
-
:max_amount => "7600",
|
39
|
-
|
40
|
-
:taxpayer_name => "Carl Cogsley",
|
41
|
-
:taxpayer_id => "123456789",
|
42
|
-
|
43
|
-
:routing_number => "490000018",
|
44
|
-
:account_number => "123456789",
|
45
|
-
})
|
50
|
+
client = Geti::AppClient.new(test_credentials)
|
51
|
+
response = client.board_merchant_ach(merchant_params(@timestamp))
|
52
|
+
expect(response[:status]).to eq("Approved")
|
53
|
+
expect(response[:app_data][:merchant][:cross_ref_id]).to eq((@timestamp).to_s)
|
54
|
+
expect(response[:message]).to match(/CrossRef: #{@timestamp}/)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#retrieve_merchant_status' do
|
59
|
+
it 'returns data' do
|
60
|
+
client = Geti::AppClient.new(test_credentials)
|
61
|
+
response = client.board_merchant_ach(merchant_params(@timestamp+1))
|
62
|
+
|
63
|
+
response = client.retrieve_merchant_status(response[:app_data][:merchant][:id])
|
64
|
+
expect(response[:status]).to eq("Approved")
|
65
|
+
expect(response[:app_data][:merchant][:cross_ref_id]).to eq((@timestamp+1).to_s)
|
66
|
+
expect(response[:message]).to eq("Merchant Approved")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '#upload_supporting_docs' do
|
71
|
+
it 'returns data' do
|
72
|
+
client = Geti::AppClient.new(test_credentials)
|
73
|
+
response = client.board_merchant_ach(merchant_params(@timestamp+2))
|
74
|
+
|
75
|
+
response = client.upload_supporting_docs(response[:app_data][:merchant][:id], File.read('./spec/remote/sample.pdf'))
|
46
76
|
expect(response[:status]).to eq("Approved")
|
47
|
-
expect(response[:message]).to match(
|
77
|
+
expect(response[:message]).to match("Document uploaded successfuly")
|
48
78
|
end
|
49
79
|
end
|
50
80
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jamie Macey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-19 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- spec/helper.rb
|
157
157
|
- spec/remote/geti_app_client_spec.rb
|
158
158
|
- spec/remote/geti_auth_client_spec.rb
|
159
|
+
- spec/remote/sample.pdf
|
159
160
|
homepage: http://github.com/jamie/geti
|
160
161
|
licenses:
|
161
162
|
- MIT
|