adyen 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +12 -5
- data/CHANGELOG.md +5 -2
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +4 -0
- data/README.md +0 -2
- data/Rakefile +2 -8
- data/adyen.gemspec +4 -5
- data/lib/adyen/api.rb +14 -10
- data/lib/adyen/api/payment_service.rb +35 -4
- data/lib/adyen/api/templates/payment_service.rb +5 -0
- data/lib/adyen/form.rb +1 -1
- data/lib/adyen/hpp/request.rb +8 -6
- data/lib/adyen/rest.rb +21 -8
- data/lib/adyen/rest/client.rb +13 -0
- data/lib/adyen/templates/notification_migration.rb +1 -1
- data/lib/adyen/templates/notification_model.rb +2 -2
- data/lib/adyen/version.rb +1 -1
- data/{spec/functional/api_spec.rb → test/functional/api_test.rb} +38 -33
- data/{spec → test}/functional/initializer.rb.ci +0 -0
- data/{spec → test}/functional/initializer.rb.sample +0 -0
- data/test/helpers/views/hpp.erb +15 -15
- data/test/test_helper.rb +1 -0
- data/{spec/api/api_spec.rb → test/unit/api/api_test.rb} +7 -7
- data/{spec/api/payment_service_spec.rb → test/unit/api/payment_service_test.rb} +149 -117
- data/{spec/api/recurring_service_spec.rb → test/unit/api/recurring_service_test.rb} +49 -46
- data/{spec/api/response_spec.rb → test/unit/api/response_test.rb} +12 -12
- data/{spec/api/simple_soap_client_spec.rb → test/unit/api/simple_soap_client_test.rb} +27 -30
- data/{spec/api/spec_helper.rb → test/unit/api/test_helper.rb} +44 -35
- data/{spec/api/test_helpers_spec.rb → test/unit/api/test_helpers_test.rb} +11 -11
- data/test/{form_test.rb → unit/form_test.rb} +0 -0
- data/test/unit/hpp/request_test.rb +68 -0
- data/test/{hpp → unit/hpp}/signature_test.rb +0 -0
- data/test/{hpp_test.rb → unit/hpp_test.rb} +0 -0
- data/test/{rest → unit/rest}/signature_test.rb +0 -0
- data/test/{rest_list_recurring_details_response_test.rb → unit/rest_list_recurring_details_response_test.rb} +0 -0
- data/test/{rest_request_test.rb → unit/rest_request_test.rb} +0 -0
- data/test/{rest_response_test.rb → unit/rest_response_test.rb} +0 -0
- data/test/{signature_test.rb → unit/signature_test.rb} +0 -0
- data/test/{util_test.rb → unit/util_test.rb} +0 -0
- metadata +53 -61
- data/spec/spec_helper.rb +0 -8
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require 'api/
|
3
|
+
require 'unit/api/test_helper'
|
4
4
|
require 'adyen/api/test_helpers'
|
5
5
|
|
6
6
|
describe "Test helpers" do
|
@@ -42,29 +42,29 @@ describe "Test helpers" do
|
|
42
42
|
it "returns an `authorized' response" do
|
43
43
|
stub_net_http(AUTHORISATION_DECLINED_RESPONSE)
|
44
44
|
Adyen::API::PaymentService.stub_success!
|
45
|
-
@payment.authorise_payment.
|
45
|
+
@payment.authorise_payment.must_be :authorized?
|
46
46
|
|
47
|
-
@payment.authorise_payment.
|
47
|
+
@payment.authorise_payment.wont_be :authorized?
|
48
48
|
end
|
49
49
|
|
50
50
|
it "returns a `refused' response" do
|
51
51
|
stub_net_http(AUTHORISE_RESPONSE)
|
52
52
|
Adyen::API::PaymentService.stub_refused!
|
53
53
|
response = @payment.authorise_payment
|
54
|
-
response.
|
55
|
-
response.
|
54
|
+
response.wont_be :authorized?
|
55
|
+
response.wont_be :invalid_request?
|
56
56
|
|
57
|
-
@payment.authorise_payment.
|
57
|
+
@payment.authorise_payment.must_be :authorized?
|
58
58
|
end
|
59
59
|
|
60
60
|
it "returns a `invalid request' response" do
|
61
61
|
stub_net_http(AUTHORISE_RESPONSE)
|
62
62
|
Adyen::API::PaymentService.stub_invalid!
|
63
63
|
response = @payment.authorise_payment
|
64
|
-
response.
|
65
|
-
response.
|
64
|
+
response.wont_be :authorized?
|
65
|
+
response.must_be :invalid_request?
|
66
66
|
|
67
|
-
@payment.authorise_payment.
|
67
|
+
@payment.authorise_payment.must_be :authorized?
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -77,8 +77,8 @@ describe "Test helpers" do
|
|
77
77
|
it "returns a `disabled' response" do
|
78
78
|
stub_net_http(DISABLE_RESPONSE % 'nope')
|
79
79
|
Adyen::API::RecurringService.stub_disabled!
|
80
|
-
@recurring.disable.
|
81
|
-
@recurring.disable.
|
80
|
+
@recurring.disable.must_be :disabled?
|
81
|
+
@recurring.disable.wont_be :disabled?
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
File without changes
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'adyen/hpp/request'
|
3
|
+
|
4
|
+
class HPPRequestTest < Minitest::Test
|
5
|
+
def setup
|
6
|
+
Adyen.configuration.default_form_params[:merchant_account] = 'TestMerchant'
|
7
|
+
Adyen.configuration.default_skin = :skin1
|
8
|
+
|
9
|
+
# Use autodetection for the environment unless otherwise specified
|
10
|
+
Adyen.configuration.environment = nil
|
11
|
+
Adyen.configuration.payment_flow = :select
|
12
|
+
Adyen.configuration.payment_flow_domain = nil
|
13
|
+
Adyen.configuration.default_skin = :skin1
|
14
|
+
|
15
|
+
@raw_params = {
|
16
|
+
:merchant_account => 'TestMerchant',
|
17
|
+
:currency_code => 'EUR',
|
18
|
+
:payment_amount => '199',
|
19
|
+
:session_validity => '2015-06-25T10:31:06Z',
|
20
|
+
:ship_before_date => '2015-07-01',
|
21
|
+
:shopper_locale => 'en_GB',
|
22
|
+
:merchant_reference => 'SKINTEST-1435226439255',
|
23
|
+
:skin_code => 'X7hsNDWp',
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_formatted_parameters
|
28
|
+
expected_parameters = {
|
29
|
+
merchant_account: "TestMerchant",
|
30
|
+
currency_code: "EUR",
|
31
|
+
payment_amount: "199",
|
32
|
+
session_validity: "2015-06-25T10:31:06Z",
|
33
|
+
ship_before_date: "2015-07-01",
|
34
|
+
shopper_locale: "en_GB",
|
35
|
+
merchant_reference: "SKINTEST-1435226439255",
|
36
|
+
skin_code: "X7hsNDWp"}
|
37
|
+
|
38
|
+
parameters = Adyen::HPP::Request.new(@raw_params).formatted_parameters
|
39
|
+
assert_equal parameters, expected_parameters
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_formatted_parameters_without_parameters
|
43
|
+
request = Adyen::HPP::Request.new('String')
|
44
|
+
|
45
|
+
exception = assert_raises(ArgumentError) { request.formatted_parameters }
|
46
|
+
assert_equal("Cannot generate request: parameters should be a hash!", exception.message)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_formatted_parameters_without_currency_code
|
50
|
+
@raw_params.delete(:currency_code)
|
51
|
+
request = Adyen::HPP::Request.new(@raw_params)
|
52
|
+
|
53
|
+
exception = assert_raises(ArgumentError) { request.formatted_parameters }
|
54
|
+
assert_equal("Cannot generate request: :currency_code attribute not found!", exception.message)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_formatted_parameters_missing_parameters
|
58
|
+
Adyen.configuration.default_form_params[:merchant_account] = nil
|
59
|
+
Adyen.configuration.default_skin = 'unknown_skin'
|
60
|
+
%i(currency_code payment_amount merchant_account skin_code ship_before_date session_validity).each do |parameter|
|
61
|
+
params = @raw_params.reject { |param| param == parameter }
|
62
|
+
request = Adyen::HPP::Request.new(params)
|
63
|
+
|
64
|
+
exception = assert_raises(ArgumentError) { request.formatted_parameters }
|
65
|
+
assert_equal("Cannot generate request: :#{parameter} attribute not found!", exception.message)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adyen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -27,34 +27,20 @@ dependencies:
|
|
27
27
|
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rspec
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
requirements:
|
34
|
-
- - ~>
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '2.14'
|
37
|
-
type: :development
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '2.14'
|
44
30
|
- !ruby/object:Gem::Dependency
|
45
31
|
name: minitest
|
46
32
|
requirement: !ruby/object:Gem::Requirement
|
47
33
|
requirements:
|
48
34
|
- - ~>
|
49
35
|
- !ruby/object:Gem::Version
|
50
|
-
version: '5'
|
36
|
+
version: '5.0'
|
51
37
|
type: :development
|
52
38
|
prerelease: false
|
53
39
|
version_requirements: !ruby/object:Gem::Requirement
|
54
40
|
requirements:
|
55
41
|
- - ~>
|
56
42
|
- !ruby/object:Gem::Version
|
57
|
-
version: '5'
|
43
|
+
version: '5.0'
|
58
44
|
- !ruby/object:Gem::Dependency
|
59
45
|
name: mocha
|
60
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,12 +84,15 @@ dependencies:
|
|
98
84
|
- !ruby/object:Gem::Version
|
99
85
|
version: '0'
|
100
86
|
- !ruby/object:Gem::Dependency
|
101
|
-
name:
|
87
|
+
name: railties
|
102
88
|
requirement: !ruby/object:Gem::Requirement
|
103
89
|
requirements:
|
104
90
|
- - '>='
|
105
91
|
- !ruby/object:Gem::Version
|
106
92
|
version: '3.2'
|
93
|
+
- - <
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '5.2'
|
107
96
|
type: :development
|
108
97
|
prerelease: false
|
109
98
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -111,20 +100,23 @@ dependencies:
|
|
111
100
|
- - '>='
|
112
101
|
- !ruby/object:Gem::Version
|
113
102
|
version: '3.2'
|
103
|
+
- - <
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '5.2'
|
114
106
|
- !ruby/object:Gem::Dependency
|
115
107
|
name: nokogiri
|
116
108
|
requirement: !ruby/object:Gem::Requirement
|
117
109
|
requirements:
|
118
110
|
- - '>='
|
119
111
|
- !ruby/object:Gem::Version
|
120
|
-
version: 1.6.
|
112
|
+
version: 1.6.8
|
121
113
|
type: :development
|
122
114
|
prerelease: false
|
123
115
|
version_requirements: !ruby/object:Gem::Requirement
|
124
116
|
requirements:
|
125
117
|
- - '>='
|
126
118
|
- !ruby/object:Gem::Version
|
127
|
-
version: 1.6.
|
119
|
+
version: 1.6.8
|
128
120
|
description: |2
|
129
121
|
Package to simplify including the Adyen payments services into a Ruby on Rails application.
|
130
122
|
The package provides functionality to create payment forms, handling and storing notifications
|
@@ -187,18 +179,9 @@ files:
|
|
187
179
|
- lib/adyen/templates/notification_model.rb
|
188
180
|
- lib/adyen/util.rb
|
189
181
|
- lib/adyen/version.rb
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
- spec/api/response_spec.rb
|
194
|
-
- spec/api/simple_soap_client_spec.rb
|
195
|
-
- spec/api/spec_helper.rb
|
196
|
-
- spec/api/test_helpers_spec.rb
|
197
|
-
- spec/functional/api_spec.rb
|
198
|
-
- spec/functional/initializer.rb.ci
|
199
|
-
- spec/functional/initializer.rb.sample
|
200
|
-
- spec/spec_helper.rb
|
201
|
-
- test/form_test.rb
|
182
|
+
- test/functional/api_test.rb
|
183
|
+
- test/functional/initializer.rb.ci
|
184
|
+
- test/functional/initializer.rb.sample
|
202
185
|
- test/functional/payment_authorisation_api_test.rb
|
203
186
|
- test/functional/payment_modification_api_test.rb
|
204
187
|
- test/helpers/capybara.rb
|
@@ -212,18 +195,27 @@ files:
|
|
212
195
|
- test/helpers/views/index.erb
|
213
196
|
- test/helpers/views/pay.erb
|
214
197
|
- test/helpers/views/redirect_shopper.erb
|
215
|
-
- test/hpp/signature_test.rb
|
216
|
-
- test/hpp_test.rb
|
217
198
|
- test/integration/hpp_integration_test.rb
|
218
199
|
- test/integration/payment_using_3d_secure_integration_test.rb
|
219
200
|
- test/integration/payment_with_client_side_encryption_integration_test.rb
|
220
|
-
- test/rest/signature_test.rb
|
221
|
-
- test/rest_list_recurring_details_response_test.rb
|
222
|
-
- test/rest_request_test.rb
|
223
|
-
- test/rest_response_test.rb
|
224
|
-
- test/signature_test.rb
|
225
201
|
- test/test_helper.rb
|
226
|
-
- test/
|
202
|
+
- test/unit/api/api_test.rb
|
203
|
+
- test/unit/api/payment_service_test.rb
|
204
|
+
- test/unit/api/recurring_service_test.rb
|
205
|
+
- test/unit/api/response_test.rb
|
206
|
+
- test/unit/api/simple_soap_client_test.rb
|
207
|
+
- test/unit/api/test_helper.rb
|
208
|
+
- test/unit/api/test_helpers_test.rb
|
209
|
+
- test/unit/form_test.rb
|
210
|
+
- test/unit/hpp/request_test.rb
|
211
|
+
- test/unit/hpp/signature_test.rb
|
212
|
+
- test/unit/hpp_test.rb
|
213
|
+
- test/unit/rest/signature_test.rb
|
214
|
+
- test/unit/rest_list_recurring_details_response_test.rb
|
215
|
+
- test/unit/rest_request_test.rb
|
216
|
+
- test/unit/rest_response_test.rb
|
217
|
+
- test/unit/signature_test.rb
|
218
|
+
- test/unit/util_test.rb
|
227
219
|
- yard_extensions.rb
|
228
220
|
homepage: http://github.com/wvanbergen/adyen/wiki
|
229
221
|
licenses:
|
@@ -257,18 +249,9 @@ signing_key:
|
|
257
249
|
specification_version: 4
|
258
250
|
summary: Integrate Adyen payment services in your Ruby on Rails application.
|
259
251
|
test_files:
|
260
|
-
-
|
261
|
-
-
|
262
|
-
-
|
263
|
-
- spec/api/response_spec.rb
|
264
|
-
- spec/api/simple_soap_client_spec.rb
|
265
|
-
- spec/api/spec_helper.rb
|
266
|
-
- spec/api/test_helpers_spec.rb
|
267
|
-
- spec/functional/api_spec.rb
|
268
|
-
- spec/functional/initializer.rb.ci
|
269
|
-
- spec/functional/initializer.rb.sample
|
270
|
-
- spec/spec_helper.rb
|
271
|
-
- test/form_test.rb
|
252
|
+
- test/functional/api_test.rb
|
253
|
+
- test/functional/initializer.rb.ci
|
254
|
+
- test/functional/initializer.rb.sample
|
272
255
|
- test/functional/payment_authorisation_api_test.rb
|
273
256
|
- test/functional/payment_modification_api_test.rb
|
274
257
|
- test/helpers/capybara.rb
|
@@ -282,15 +265,24 @@ test_files:
|
|
282
265
|
- test/helpers/views/index.erb
|
283
266
|
- test/helpers/views/pay.erb
|
284
267
|
- test/helpers/views/redirect_shopper.erb
|
285
|
-
- test/hpp/signature_test.rb
|
286
|
-
- test/hpp_test.rb
|
287
268
|
- test/integration/hpp_integration_test.rb
|
288
269
|
- test/integration/payment_using_3d_secure_integration_test.rb
|
289
270
|
- test/integration/payment_with_client_side_encryption_integration_test.rb
|
290
|
-
- test/rest/signature_test.rb
|
291
|
-
- test/rest_list_recurring_details_response_test.rb
|
292
|
-
- test/rest_request_test.rb
|
293
|
-
- test/rest_response_test.rb
|
294
|
-
- test/signature_test.rb
|
295
271
|
- test/test_helper.rb
|
296
|
-
- test/
|
272
|
+
- test/unit/api/api_test.rb
|
273
|
+
- test/unit/api/payment_service_test.rb
|
274
|
+
- test/unit/api/recurring_service_test.rb
|
275
|
+
- test/unit/api/response_test.rb
|
276
|
+
- test/unit/api/simple_soap_client_test.rb
|
277
|
+
- test/unit/api/test_helper.rb
|
278
|
+
- test/unit/api/test_helpers_test.rb
|
279
|
+
- test/unit/form_test.rb
|
280
|
+
- test/unit/hpp/request_test.rb
|
281
|
+
- test/unit/hpp/signature_test.rb
|
282
|
+
- test/unit/hpp_test.rb
|
283
|
+
- test/unit/rest/signature_test.rb
|
284
|
+
- test/unit/rest_list_recurring_details_response_test.rb
|
285
|
+
- test/unit/rest_request_test.rb
|
286
|
+
- test/unit/rest_response_test.rb
|
287
|
+
- test/unit/signature_test.rb
|
288
|
+
- test/unit/util_test.rb
|