paylane 0.0.2 → 0.0.3
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/lib/paylane.rb +0 -1
- data/lib/paylane/api.rb +12 -3
- data/lib/paylane/connection_error.rb +13 -0
- data/lib/paylane/version.rb +1 -1
- data/spec/paylane/api_spec.rb +14 -0
- metadata +3 -2
data/lib/paylane.rb
CHANGED
data/lib/paylane/api.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require "paylane/response"
|
2
|
+
require "paylane/connection_error"
|
3
|
+
|
1
4
|
module PayLane
|
2
5
|
class API
|
3
6
|
def initialize(client)
|
@@ -49,9 +52,15 @@ module PayLane
|
|
49
52
|
private
|
50
53
|
|
51
54
|
def request(method, params, params_prefix = nil)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
+
begin
|
56
|
+
body = params_prefix ? {params_prefix => params} : params
|
57
|
+
soap_response = @client.request(method) { soap.body = body }
|
58
|
+
soap_response.to_hash
|
59
|
+
rescue Savon::Error => e
|
60
|
+
err = PayLane::ConnectionError.new(e)
|
61
|
+
PayLane.logger.error("[PayLane][Savon] #{err}")
|
62
|
+
raise err
|
63
|
+
end
|
55
64
|
end
|
56
65
|
end
|
57
66
|
end
|
data/lib/paylane/version.rb
CHANGED
data/spec/paylane/api_spec.rb
CHANGED
@@ -187,5 +187,19 @@ describe PayLane::API do
|
|
187
187
|
sales.should include({id_sale: "2772323", status: "PERFORMED", is_refund: false, is_chargeback: false, is_reversal: false})
|
188
188
|
end
|
189
189
|
end
|
190
|
+
|
191
|
+
describe 'handle savon error' do
|
192
|
+
let(:savon_http_error) {
|
193
|
+
Savon::HTTP::Error.new(double(error?: true, code: 404, body: 'Not Found'))
|
194
|
+
}
|
195
|
+
|
196
|
+
it 'logs and raise PayLane::ConnectionError' do
|
197
|
+
connection.stub(:request).and_raise(savon_http_error)
|
198
|
+
PayLane.logger.should_receive(:error).with("[PayLane][Savon] HTTP error (404): Not Found")
|
199
|
+
expect {
|
200
|
+
api.multi_sale({})
|
201
|
+
}.to raise_error(PayLane::ConnectionError)
|
202
|
+
end
|
203
|
+
end
|
190
204
|
end
|
191
205
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paylane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- Rakefile
|
92
92
|
- lib/paylane.rb
|
93
93
|
- lib/paylane/api.rb
|
94
|
+
- lib/paylane/connection_error.rb
|
94
95
|
- lib/paylane/gateway.rb
|
95
96
|
- lib/paylane/payment.rb
|
96
97
|
- lib/paylane/railtie.rb
|