geti 1.0.0 → 1.1.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 CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -29,7 +29,7 @@ class Geti::Client
29
29
  end
30
30
 
31
31
  op_key ||= operation.gsub(/(.)([A-Z])/, '\1_\2').downcase
32
- operation.sub!('_certification','') unless certification?
32
+ op_key.sub!('_certification','') unless certification?
33
33
  response_key = (op_key+'_response').to_sym
34
34
  result_key = (op_key+'_result').to_sym
35
35
 
@@ -53,6 +53,21 @@ describe Geti::AppClient do
53
53
  }
54
54
  end
55
55
 
56
+ def production_soap_response
57
+ Nori.parse("<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><BoardMerchant_ACHResponse xmlns=\"http://tempuri.org/GETI.eMagnus.WebServices/AppGateway\"><BoardMerchant_ACHResult>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;RESPONSE xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"&gt;&lt;STATUS&gt;Pending&lt;/STATUS&gt;&lt;MESSAGE&gt;1 merchant(s) created.\n0 merchant(s) not created due to errors.\n\n-----------------------\nMerchants Created:\nMy Company (ISO ID: 10150, CrossRef: 83, Status: PendingInput)\n\n&lt;/MESSAGE&gt;&lt;APP_DATA&gt;&lt;Merchant ID=\"1844832\" /&gt;&lt;/APP_DATA&gt;&lt;VALIDATION_MESSAGE&gt;&lt;RESULT&gt;Passed&lt;/RESULT&gt;&lt;SCHEMA_FILE_PATH /&gt;&lt;/VALIDATION_MESSAGE&gt;&lt;/RESPONSE&gt;</BoardMerchant_ACHResult></BoardMerchant_ACHResponse></soap:Body></soap:Envelope>\n")[:envelope][:body]
58
+ end
59
+
60
+ def pending_response
61
+ {:response=>
62
+ {:status=>"Pending",
63
+ :"@xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
64
+ :"@xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
65
+ :message=>
66
+ "1 merchant(s) created.\n0 merchant(s) not created due to errors.\n\n-----------------------\nMerchants Created:\nMy Company (ISO ID: 10150, CrossRef: 83, Status: PendingInput)\n\n",
67
+ :validation_message=>{:schema_file_path=>nil, :result=>"Passed"},
68
+ :app_data=>{:merchant=>{:@id=>"1844832"}}}}
69
+ end
70
+
56
71
  def success_response
57
72
  {:response=>{
58
73
  :status=>"Approved",
@@ -122,13 +137,13 @@ describe Geti::AppClient do
122
137
  describe '#board_merchant_ach' do
123
138
  it 'calls BoardCertificationMerchant_ACH' do
124
139
  client = Geti::AppClient.new(test_credentials, {})
125
- mock_soap!(client, success_response, "BoardCertificationMerchant_ACH", "board_certification_merchant_ach")
140
+ mock_soap!(client, pending_response, "BoardCertificationMerchant_ACH", "board_certification_merchant_ach")
126
141
  client.board_merchant_ach(request_payload)
127
142
  end
128
143
 
129
144
  it 'calls BoardMerchant_ACH in production' do
130
145
  client = Geti::AppClient.new(test_credentials, {}, 'production')
131
- mock_soap!(client, success_response, "BoardMerchant_ACH", "board_certification_merchant_ach")
146
+ mock_soap!(client, pending_response, "BoardMerchant_ACH", "board_merchant_ach")
132
147
  client.board_merchant_ach(request_payload)
133
148
  end
134
149
 
@@ -140,6 +155,16 @@ describe Geti::AppClient do
140
155
  }
141
156
  subject { client.board_merchant_ach(request_payload) }
142
157
 
158
+ describe 'on pending' do
159
+ let(:response) { pending_response }
160
+ its([:success]) { should be_true }
161
+ its([:status]) { should eq("Pending") }
162
+
163
+ it 'normalizes (nested) keys' do
164
+ subject[:app_data][:merchant][:id].should eq("1844832")
165
+ end
166
+ end
167
+
143
168
  describe 'on success' do
144
169
  let(:response) { success_response }
145
170
  its([:success]) { should be_true }
@@ -162,5 +187,15 @@ describe Geti::AppClient do
162
187
  its([:status]) { should be_nil }
163
188
  end
164
189
  end
190
+
191
+ describe 'production response handling' do
192
+ it 'does not error' do
193
+ client = Geti::AppClient.new(test_credentials, {}, 'production').tap{|c|
194
+ c.soap_client.should_receive(:request).with("BoardMerchant_ACH").and_return(OpenStruct.new(:body => production_soap_response))
195
+ }
196
+
197
+ response = client.board_merchant_ach(request_payload)
198
+ end
199
+ end
165
200
  end
166
201
  end
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: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.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-11-05 00:00:00 Z
18
+ date: 2012-11-13 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: savon