adyen 1.6.0 → 2.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +116 -0
- data/CONTRIBUTING.md +84 -0
- data/Gemfile +1 -1
- data/README.md +33 -0
- data/Rakefile +19 -4
- data/adyen.gemspec +7 -5
- data/config.ru +5 -0
- data/lib/adyen.rb +2 -2
- data/lib/adyen/configuration.rb +6 -0
- data/lib/adyen/form.rb +13 -48
- data/lib/adyen/matchers.rb +1 -1
- data/lib/adyen/rest.rb +53 -0
- data/lib/adyen/rest/authorise_payment.rb +148 -0
- data/lib/adyen/rest/client.rb +110 -0
- data/lib/adyen/rest/errors.rb +33 -0
- data/lib/adyen/rest/modify_payment.rb +97 -0
- data/lib/adyen/rest/request.rb +107 -0
- data/lib/adyen/rest/response.rb +59 -0
- data/lib/adyen/util.rb +147 -0
- data/lib/adyen/version.rb +1 -1
- data/test/form_test.rb +17 -10
- data/test/functional/payment_authorisation_api_test.rb +54 -0
- data/test/functional/payment_modification_api_test.rb +57 -0
- data/test/helpers/configure_adyen.rb +5 -0
- data/test/helpers/example_server.rb +105 -0
- data/test/helpers/public/adyen.encrypt.js +679 -0
- data/test/helpers/public/adyen.encrypt.min.js +14 -0
- data/test/helpers/test_cards.rb +20 -0
- data/test/helpers/views/authorized.erb +7 -0
- data/test/helpers/views/hpp.erb +19 -0
- data/test/helpers/views/index.erb +6 -0
- data/test/helpers/views/pay.erb +36 -0
- data/test/helpers/views/redirect_shopper.erb +18 -0
- data/test/integration/hpp_integration_test.rb +52 -0
- data/test/integration/payment_using_3d_secure_integration_test.rb +40 -0
- data/test/integration/payment_with_client_side_encryption_integration_test.rb +26 -0
- data/test/rest_request_test.rb +50 -0
- data/test/rest_response_test.rb +18 -0
- data/test/test_helper.rb +32 -0
- data/test/util_test.rb +77 -0
- metadata +89 -16
- data/README.rdoc +0 -50
- data/lib/adyen/encoding.rb +0 -21
- data/lib/adyen/formatter.rb +0 -33
- data/test/adyen_test.rb +0 -31
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:
|
4
|
+
version: 2.0.0.pre1
|
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: 2015-01-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -69,6 +69,34 @@ dependencies:
|
|
69
69
|
- - '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: sinatra
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: poltergeist
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
72
100
|
- !ruby/object:Gem::Dependency
|
73
101
|
name: rails
|
74
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,11 +125,11 @@ dependencies:
|
|
97
125
|
- - '>='
|
98
126
|
- !ruby/object:Gem::Version
|
99
127
|
version: 1.6.1
|
100
|
-
description:
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
128
|
+
description: |2
|
129
|
+
Package to simplify including the Adyen payments services into a Ruby on Rails application.
|
130
|
+
The package provides functionality to create payment forms, handling and storing notifications
|
131
|
+
sent by Adyen and consuming the SOAP services provided by Adyen. Moreover, it contains helper
|
132
|
+
methods, mocks and matchers to simpify writing tests/specs for your code.
|
105
133
|
email:
|
106
134
|
- willem@vanbergen.org
|
107
135
|
- cicaboo@gmail.com
|
@@ -110,15 +138,20 @@ email:
|
|
110
138
|
executables: []
|
111
139
|
extensions: []
|
112
140
|
extra_rdoc_files:
|
113
|
-
- README.
|
141
|
+
- README.md
|
142
|
+
- CHANGELOG.md
|
143
|
+
- CONTRIBUTING.md
|
114
144
|
files:
|
115
145
|
- .gitignore
|
116
146
|
- .travis.yml
|
147
|
+
- CHANGELOG.md
|
148
|
+
- CONTRIBUTING.md
|
117
149
|
- Gemfile
|
118
150
|
- LICENSE
|
119
|
-
- README.
|
151
|
+
- README.md
|
120
152
|
- Rakefile
|
121
153
|
- adyen.gemspec
|
154
|
+
- config.ru
|
122
155
|
- lib/adyen.rb
|
123
156
|
- lib/adyen/api.rb
|
124
157
|
- lib/adyen/api/cacert.pem
|
@@ -131,14 +164,20 @@ files:
|
|
131
164
|
- lib/adyen/api/test_helpers.rb
|
132
165
|
- lib/adyen/api/xml_querier.rb
|
133
166
|
- lib/adyen/configuration.rb
|
134
|
-
- lib/adyen/encoding.rb
|
135
167
|
- lib/adyen/form.rb
|
136
|
-
- lib/adyen/formatter.rb
|
137
168
|
- lib/adyen/matchers.rb
|
138
169
|
- lib/adyen/notification_generator.rb
|
139
170
|
- lib/adyen/railtie.rb
|
171
|
+
- lib/adyen/rest.rb
|
172
|
+
- lib/adyen/rest/authorise_payment.rb
|
173
|
+
- lib/adyen/rest/client.rb
|
174
|
+
- lib/adyen/rest/errors.rb
|
175
|
+
- lib/adyen/rest/modify_payment.rb
|
176
|
+
- lib/adyen/rest/request.rb
|
177
|
+
- lib/adyen/rest/response.rb
|
140
178
|
- lib/adyen/templates/notification_migration.rb
|
141
179
|
- lib/adyen/templates/notification_model.rb
|
180
|
+
- lib/adyen/util.rb
|
142
181
|
- lib/adyen/version.rb
|
143
182
|
- spec/api/api_spec.rb
|
144
183
|
- spec/api/payment_service_spec.rb
|
@@ -151,9 +190,26 @@ files:
|
|
151
190
|
- spec/functional/initializer.rb.ci
|
152
191
|
- spec/functional/initializer.rb.sample
|
153
192
|
- spec/spec_helper.rb
|
154
|
-
- test/adyen_test.rb
|
155
193
|
- test/form_test.rb
|
194
|
+
- test/functional/payment_authorisation_api_test.rb
|
195
|
+
- test/functional/payment_modification_api_test.rb
|
196
|
+
- test/helpers/configure_adyen.rb
|
197
|
+
- test/helpers/example_server.rb
|
198
|
+
- test/helpers/public/adyen.encrypt.js
|
199
|
+
- test/helpers/public/adyen.encrypt.min.js
|
200
|
+
- test/helpers/test_cards.rb
|
201
|
+
- test/helpers/views/authorized.erb
|
202
|
+
- test/helpers/views/hpp.erb
|
203
|
+
- test/helpers/views/index.erb
|
204
|
+
- test/helpers/views/pay.erb
|
205
|
+
- test/helpers/views/redirect_shopper.erb
|
206
|
+
- test/integration/hpp_integration_test.rb
|
207
|
+
- test/integration/payment_using_3d_secure_integration_test.rb
|
208
|
+
- test/integration/payment_with_client_side_encryption_integration_test.rb
|
209
|
+
- test/rest_request_test.rb
|
210
|
+
- test/rest_response_test.rb
|
156
211
|
- test/test_helper.rb
|
212
|
+
- test/util_test.rb
|
157
213
|
- yard_extensions.rb
|
158
214
|
homepage: http://github.com/wvanbergen/adyen/wiki
|
159
215
|
licenses:
|
@@ -164,7 +220,7 @@ rdoc_options:
|
|
164
220
|
- --title
|
165
221
|
- adyen
|
166
222
|
- --main
|
167
|
-
- README.
|
223
|
+
- README.md
|
168
224
|
- --line-numbers
|
169
225
|
- --inline-source
|
170
226
|
require_paths:
|
@@ -176,9 +232,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
176
232
|
version: 1.9.3
|
177
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
234
|
requirements:
|
179
|
-
- - '
|
235
|
+
- - '>'
|
180
236
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
237
|
+
version: 1.3.1
|
182
238
|
requirements:
|
183
239
|
- Having Nokogiri installed will speed up XML handling when using the SOAP API.
|
184
240
|
rubyforge_project:
|
@@ -198,6 +254,23 @@ test_files:
|
|
198
254
|
- spec/functional/initializer.rb.ci
|
199
255
|
- spec/functional/initializer.rb.sample
|
200
256
|
- spec/spec_helper.rb
|
201
|
-
- test/adyen_test.rb
|
202
257
|
- test/form_test.rb
|
258
|
+
- test/functional/payment_authorisation_api_test.rb
|
259
|
+
- test/functional/payment_modification_api_test.rb
|
260
|
+
- test/helpers/configure_adyen.rb
|
261
|
+
- test/helpers/example_server.rb
|
262
|
+
- test/helpers/public/adyen.encrypt.js
|
263
|
+
- test/helpers/public/adyen.encrypt.min.js
|
264
|
+
- test/helpers/test_cards.rb
|
265
|
+
- test/helpers/views/authorized.erb
|
266
|
+
- test/helpers/views/hpp.erb
|
267
|
+
- test/helpers/views/index.erb
|
268
|
+
- test/helpers/views/pay.erb
|
269
|
+
- test/helpers/views/redirect_shopper.erb
|
270
|
+
- test/integration/hpp_integration_test.rb
|
271
|
+
- test/integration/payment_using_3d_secure_integration_test.rb
|
272
|
+
- test/integration/payment_with_client_side_encryption_integration_test.rb
|
273
|
+
- test/rest_request_test.rb
|
274
|
+
- test/rest_response_test.rb
|
203
275
|
- test/test_helper.rb
|
276
|
+
- test/util_test.rb
|
data/README.rdoc
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
= Adyen {<img src="https://travis-ci.org/wvanbergen/adyen.png" />}[https://travis-ci.org/wvanbergen/adyen]
|
2
|
-
|
3
|
-
Package to simplify including the Adyen payments services into a Ruby on Rails application.
|
4
|
-
|
5
|
-
Visit the wiki for documentation: https://github.com/wvanbergen/adyen/wiki.
|
6
|
-
|
7
|
-
Adyen integration relies on three modes of communication between Adyen, your server and
|
8
|
-
your client/customer:
|
9
|
-
|
10
|
-
* Client-to-Adyen communication using forms and redirects.
|
11
|
-
* Adyen-to-server communications using notifications.
|
12
|
-
* Server-to-Adyen communication using SOAP services.
|
13
|
-
|
14
|
-
This library aims to ease the implementation of all these modes into your application.
|
15
|
-
Moreover, it provides matchers, assertions and mocks to make it easier to implement an
|
16
|
-
automated test suite to assert the integration is working correctly.
|
17
|
-
|
18
|
-
== Usage
|
19
|
-
|
20
|
-
See the project wiki on https://github.com/wvanbergen/adyen/wiki to get started. Complete
|
21
|
-
RDoc documentation for the project can be found on http://rdoc.info/projects/wvanbergen/adyen.
|
22
|
-
|
23
|
-
* For more information about Adyen, see http://www.adyen.com
|
24
|
-
* For more information about integrating Adyen, see their manuals at
|
25
|
-
https://www.adyen.com/home/support/manuals.html, primarily the HPP integration manual for Adyen::Form, and the API integration manual for Adyen::API.
|
26
|
-
|
27
|
-
The library doesn't have any dependencies, but making Nokogiri available in your environment
|
28
|
-
will greatly improve the speed of XML and HTML processing.
|
29
|
-
|
30
|
-
== About
|
31
|
-
|
32
|
-
This package is written by Michel Barbosa and Willem van Bergen for Floorplanner.com, and
|
33
|
-
made public under the MIT license (see LICENSE). Its is currently maintained by Willem van
|
34
|
-
Bergen, Stefan Borsje and Eloy Durán. We are not affiliated with Adyen B.V. The software
|
35
|
-
comes without warranty of any kind, so use at your own risk.
|
36
|
-
|
37
|
-
Contributions are welcomed; this is very much a scratch your own itch project. Some notes:
|
38
|
-
|
39
|
-
* Fork the project, implement your stuff and issue a pull request. Topic branches not necessary.
|
40
|
-
* We prefer to keep the number of dependencies of this library to 0.
|
41
|
-
* All functionality must include tests and preferably documentation.
|
42
|
-
* New SOAP API calls should include functional tests that actually test if the call is working.
|
43
|
-
Adyen has a nasty tendency to switch things up every now and then, so this is vital.
|
44
|
-
Note: we use a test account to run the functional specs on CI. Some API calls have to be
|
45
|
-
enabled on Adyen's side before our test account can use them. If you receive failures with
|
46
|
-
"010 Not allowed" on CI while it works fine with your owen test account, please let us know on
|
47
|
-
the pull request, so I can ask Adyen to enable the feature on the test account as well.
|
48
|
-
|
49
|
-
Please visit the changelog at https://github.com/wvanbergen/adyen/wiki/Changelog to see the
|
50
|
-
changes in the different releases.
|
data/lib/adyen/encoding.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'base64'
|
2
|
-
require 'openssl'
|
3
|
-
require 'stringio'
|
4
|
-
require 'zlib'
|
5
|
-
|
6
|
-
module Adyen
|
7
|
-
module Encoding
|
8
|
-
def self.hmac_base64(hmac_key, message)
|
9
|
-
digest = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), hmac_key, message)
|
10
|
-
Base64.strict_encode64(digest).strip
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.gzip_base64(message)
|
14
|
-
sio = StringIO.new
|
15
|
-
gz = Zlib::GzipWriter.new(sio)
|
16
|
-
gz.write(message)
|
17
|
-
gz.close
|
18
|
-
Base64.strict_encode64(sio.string)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/adyen/formatter.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
|
3
|
-
module Adyen
|
4
|
-
module Formatter
|
5
|
-
module DateTime
|
6
|
-
# Returns a valid Adyen string representation for a date
|
7
|
-
def self.fmt_date(date)
|
8
|
-
case date
|
9
|
-
when Date, DateTime, Time
|
10
|
-
date.strftime('%Y-%m-%d')
|
11
|
-
when String
|
12
|
-
raise ArgumentError, "Invalid date notation: #{date.inspect}!" unless /^\d{4}-\d{2}-\d{2}$/ =~ date
|
13
|
-
date
|
14
|
-
else
|
15
|
-
raise ArgumentError, "Cannot convert #{date.inspect} to date!"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# Returns a valid Adyen string representation for a timestamp
|
20
|
-
def self.fmt_time(time)
|
21
|
-
case time
|
22
|
-
when Date, DateTime, Time
|
23
|
-
time.strftime('%Y-%m-%dT%H:%M:%SZ')
|
24
|
-
when String
|
25
|
-
raise ArgumentError, "Invalid timestamp notation: #{time.inspect}!" unless /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z$/ =~ time
|
26
|
-
time
|
27
|
-
else
|
28
|
-
raise ArgumentError, "Cannot convert #{time.inspect} to timestamp!"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/test/adyen_test.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class AdyenTest < Minitest::Test
|
5
|
-
def test_hmac_base64_encoding
|
6
|
-
encoded_str = Adyen::Encoding.hmac_base64('bla', 'bla')
|
7
|
-
assert_equal '6nItEkVpIYF+i1RwrEyQ7RHmrfU=', encoded_str
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_gzip_base64_encoding
|
11
|
-
encoded_str = Adyen::Encoding.gzip_base64('bla')
|
12
|
-
assert_equal 32, encoded_str.length
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_date_formatting
|
16
|
-
assert_match /^\d{4}-\d{2}-\d{2}$/, Adyen::Formatter::DateTime.fmt_date(Date.today)
|
17
|
-
assert_equal '2009-01-01', Adyen::Formatter::DateTime.fmt_date('2009-01-01')
|
18
|
-
|
19
|
-
assert_raises(ArgumentError) { Adyen::Formatter::DateTime.fmt_date('2009-1-1') }
|
20
|
-
assert_raises(ArgumentError) { Adyen::Formatter::DateTime.fmt_time(20090101) }
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_timestamp_formatting
|
24
|
-
assert_match /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z$/, Adyen::Formatter::DateTime.fmt_time(Time.now)
|
25
|
-
assert_match /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z$/, Adyen::Formatter::DateTime.fmt_time(DateTime.now)
|
26
|
-
assert_equal '2009-01-01T11:11:11Z', Adyen::Formatter::DateTime.fmt_time('2009-01-01T11:11:11Z')
|
27
|
-
|
28
|
-
assert_raises(ArgumentError) { Adyen::Formatter::DateTime.fmt_time('2009-01-01 11:11:11') }
|
29
|
-
assert_raises(ArgumentError) { Adyen::Formatter::DateTime.fmt_time(20090101111111) }
|
30
|
-
end
|
31
|
-
end
|