adyen 2.3.0 → 2.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8ef547799ff5fa479e0adb223c8e325b394e064
4
- data.tar.gz: 964b4e93c00f7448a073aa9423497713ee480dfd
3
+ metadata.gz: 1b926d8669cb0ce4a11bb4b3d1cd04d64921da2d
4
+ data.tar.gz: f286044af288973fe8c392de39c5cfc633392df1
5
5
  SHA512:
6
- metadata.gz: 6c0d7a296dd0697404034dbc655a7b53fb1e3cba9443fe6a821203db33fe307ec4b21b58b1196c853d486eec05b8bf6d15c5f9152078a939d5fca0779664b010
7
- data.tar.gz: 62422891b4307c4b6e1a872cfe17223bb323c1163df1ce47920f77bd0990ce4432fd5189ad9e55463dcd10a99d769956c1f4a3f0114134b6c2b80d6322ff1210
6
+ metadata.gz: 11a035e5c3faaad7c8875d6f62370e5f5451c5e26ef604797c9b0a18188809de738657b61b7db603f715aa057e1c926c2a51ea57db8581fc7bb1ed0bbc597fc0
7
+ data.tar.gz: 0672a9e65e12f72a189f47fe7558aefd145225190c68b99b677fe511a7793a0e473012027cc9e14d3f4c3af5de4fa2feadbab191b82999be846925c0c60c1d60
@@ -1,29 +1,26 @@
1
1
  sudo: false
2
- dist: trusty
3
2
  language: ruby
4
3
  cache: bundler
5
4
  rvm:
6
- - "2.0"
7
- - "2.1"
8
- - "2.2"
9
- - "2.3.1"
10
- - "2.4.1"
11
- - "jruby-9.0"
12
- - "jruby-9.1"
13
- - "ruby-head"
14
- - "rubinius-3"
15
- - "jruby-head"
5
+ - "2.2"
6
+ - "2.3"
7
+ - "2.4"
8
+ - "2.5"
9
+ - "jruby-9.1.15.0"
10
+ - "ruby-head"
11
+ - "rubinius-3"
12
+ - "jruby-head"
16
13
  matrix:
17
14
  allow_failures:
18
- - rvm: jruby-head
19
- - rvm: ruby-head
20
- - rvm: rubinius-3
15
+ - rvm: jruby-head
16
+ - rvm: ruby-head
17
+ - rvm: rubinius-3
21
18
 
22
19
  before_install:
23
20
  - bundle --version || gem install bundler
24
21
  - gem update bundler
25
22
  before_script:
26
- - cp test/functional/initializer.rb.ci test/functional/initializer.rb
23
+ - cp test/functional/initializer.rb.ci test/functional/initializer.rb
27
24
  script: bundle exec rake
28
25
 
29
26
  env:
@@ -2,12 +2,20 @@
2
2
 
3
3
  The following changes have been made to the library over the years. Pleae add an entry to this file as part of your pull requests.
4
4
 
5
+ #### Unreleased changes
6
+
7
+ #### Version 2.4.0
8
+
9
+ - Add `additionalData` to response from `listRecurringDetails` recurring payment SOAP endpoint.
10
+ - Updates to the development & test setup for this gem.
11
+
5
12
  #### Version 2.3.0
6
13
 
7
- - Add `shopper_statement` option to `Adyen::APP`, allowing to generate Billets with custom payment instructions.
14
+ - Add support for merchant-specific endpoints.
15
+ - Add `shopper_statement` option to `Adyen::HPP`, allowing to generate Billets with custom payment instructions.
8
16
  - Make sure the unique index created by the notification model generator includes `merchant_account_code`
9
- - Make refusal_reson availble as a response field for failed requests.
10
- - Updates to the testing in frastructure
17
+ - Make `refusal_resaon` availble as a response field for failed requests.
18
+ - Updates to the testing infrastructure
11
19
 
12
20
  #### Version 2.2.0
13
21
 
data/Gemfile CHANGED
@@ -6,7 +6,6 @@ ruby RUBY_VERSION
6
6
  gem 'pry'
7
7
 
8
8
  platform :rbx do
9
- gem 'rubysl'
10
9
  gem 'racc'
11
10
  end
12
11
 
data/README.md CHANGED
@@ -16,7 +16,7 @@ This library aims to ease the implementation of all these modes into your Rack a
16
16
  - Check out [the example server](https://github.com/wvanbergen/adyen/blob/master/test/helpers/example_server.rb) for an example implementation of the HPP payment flow, and an implementation of self-hosted a payment flow that uses the REST webservice. To start the example server, run `bundle exec rackup` in the root of this project.
17
17
  - Complete RDoc documentation can be found on [rubydoc.info](http://www.rubydoc.info/gems/adyen).
18
18
  - For more information about Adyen, see http://www.adyen.com
19
- - For more information about integrating Adyen, see [their manuals](https://www.adyen.com/home/support/manuals.html). Of primary interest are the HPP integration manual for `Adyen::Form`, and the API integration manual for `Adyen::REST`.
19
+ - For more information about integrating Adyen, see [their manuals](https://www.adyen.com/home/support/manuals.html). Of primary interest are the HPP integration manual for `Adyen::HPP`, and the API integration manual for `Adyen::REST`.
20
20
 
21
21
  The library doesn't have any dependencies, but making Nokogiri available in your environment will greatly improve the speed of any XML and HTML processing.
22
22
 
@@ -27,9 +27,9 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency('minitest', '~> 5.0')
28
28
  s.add_development_dependency('mocha')
29
29
  s.add_development_dependency('sinatra')
30
- s.add_development_dependency('poltergeist')
30
+ s.add_development_dependency('capybara-webkit')
31
31
 
32
- s.add_development_dependency('railties', '>= 3.2', '< 5.2')
32
+ s.add_development_dependency('railties', '>= 3.2', '< 6.0')
33
33
  s.add_development_dependency('nokogiri', '>= 1.6.8')
34
34
 
35
35
  s.requirements << 'Having Nokogiri installed will speed up XML handling when using the SOAP API.'
@@ -93,7 +93,7 @@ module Adyen
93
93
  end
94
94
 
95
95
  class ListResponse < Response
96
- response_attrs :details, :last_known_shopper_email, :shopper_reference, :creation_date
96
+ response_attrs :details, :last_known_shopper_email, :shopper_reference, :creation_date, :additional_data
97
97
 
98
98
  def references
99
99
  details ? details.map { |d| d[:recurring_detail_reference] } : []
@@ -117,7 +117,8 @@ module Adyen
117
117
  result = {
118
118
  :recurring_detail_reference => node.text('./recurring:recurringDetailReference'),
119
119
  :variant => node.text('./recurring:variant'),
120
- :creation_date => DateTime.parse(node.text('./recurring:creationDate'))
120
+ :creation_date => DateTime.parse(node.text('./recurring:creationDate')),
121
+ :additional_data => parse_additional_data(node.xpath('./recurring:additionalData'))
121
122
  }
122
123
 
123
124
  card = node.xpath('./recurring:card')
@@ -164,6 +165,21 @@ module Adyen
164
165
  :holder_name => bank.text('./payment:ownerName')
165
166
  }
166
167
  end
168
+
169
+ def parse_additional_data(xpath)
170
+ if xpath.empty?
171
+ {}
172
+ else
173
+ results = {}
174
+ xpath.map do |node|
175
+ key = node.text('./recurring:entry/recurring:key')
176
+ value = node.text('./recurring:entry/recurring:value')
177
+ results[key] = value unless key.empty?
178
+ end
179
+
180
+ results
181
+ end
182
+ end
167
183
  end
168
184
 
169
185
  class StoreTokenResponse < Response
@@ -41,6 +41,10 @@ class Adyen::Configuration
41
41
  LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test'
42
42
  end
43
43
 
44
+
45
+ # TODO
46
+ attr_accessor :merchant_specific_endpoint
47
+
44
48
  # The payment flow page type that’s used to choose the payment process
45
49
  #
46
50
  # @example
@@ -45,7 +45,8 @@ module Adyen
45
45
  Adyen::REST::Client.new(
46
46
  Adyen.configuration.environment,
47
47
  Adyen.configuration.api_username,
48
- Adyen.configuration.api_password
48
+ Adyen.configuration.api_password,
49
+ Adyen.configuration.merchant_specific_endpoint
49
50
  )
50
51
  end
51
52
 
@@ -20,14 +20,15 @@ module Adyen
20
20
  include AuthorisePayment
21
21
  include ModifyPayment
22
22
 
23
- attr_reader :environment
23
+ attr_reader :environment, :merchant
24
24
 
25
25
  # @param environment [String] The Adyen environment to interface with. Either
26
26
  # <tt>'live'</tt> or <tt>'test'</tt>.
27
27
  # @param username [String] The webservice username, e.g. <tt>ws@Company.Account</tt>
28
28
  # @param password [String] The password associated with the username
29
- def initialize(environment, username, password)
30
- @environment, @username, @password = environment, username, password
29
+ # @param merchant [String]
30
+ def initialize(environment, username, password, merchant = nil)
31
+ @environment, @username, @password, @merchant = environment, username, password, merchant
31
32
  end
32
33
 
33
34
  # Closes the client.
@@ -113,12 +114,18 @@ module Adyen
113
114
  # The endpoint URI for this client.
114
115
  # @return [URI] The endpoint to use for the environment.
115
116
  def endpoint
116
- @endpoint ||= URI(ENDPOINT % [environment])
117
+ @endpoint ||= if merchant && environment.to_sym == :live
118
+ URI(ENDPOINT_MERCHANT_SPECIFIC % [merchant])
119
+ else
120
+ URI(ENDPOINT % [environment])
121
+ end
117
122
  end
118
123
 
119
124
  # @see Adyen::REST::Client#endpoint
120
125
  ENDPOINT = 'https://pal-%s.adyen.com/pal/adapter/httppost'
121
- private_constant :ENDPOINT
126
+ ENDPOINT_MERCHANT_SPECIFIC = 'https://%s.pal-live.adyenpayments.com/pal/adapter/httppost'
127
+
128
+ private_constant :ENDPOINT, :ENDPOINT_MERCHANT_SPECIFIC
122
129
  end
123
130
  end
124
131
  end
@@ -1,5 +1,5 @@
1
1
  module Adyen
2
2
  # Version constant for the Adyen plugin.
3
3
  # Set it & commit the change before running rake release.
4
- VERSION = "2.3.0"
4
+ VERSION = "2.4.0"
5
5
  end
@@ -1,12 +1,7 @@
1
1
  require 'helpers/example_server'
2
2
  require 'capybara/dsl'
3
- require 'capybara/poltergeist'
3
+ require 'capybara/webkit'
4
4
 
5
- Capybara.register_driver :poltergeist do |app|
6
- Capybara::Poltergeist::Driver.new(app, phantomjs_options: ['--ssl-protocol=any'])
7
- end
8
-
9
- Capybara.default_driver = :poltergeist
10
- Capybara.javascript_driver = :poltergeist
5
+ Capybara.default_driver = :webkit
6
+ Capybara.javascript_driver = :webkit
11
7
  Capybara.app = Adyen::ExampleServer
12
-
@@ -71,6 +71,7 @@ describe Adyen::API::RecurringService do
71
71
  :number => '1111'
72
72
  },
73
73
  :recurring_detail_reference => 'RecurringDetailReference1',
74
+ :additional_data => { "newAlias" => "123456" },
74
75
  :variant => 'mc',
75
76
  :creation_date => DateTime.parse('2009-10-27T11:50:12.178+01:00')
76
77
  },
@@ -85,6 +86,7 @@ describe Adyen::API::RecurringService do
85
86
  :holder_name => 'S. Hopper'
86
87
  },
87
88
  :recurring_detail_reference => 'RecurringDetailReference2',
89
+ :additional_data => { "newAlias" => "123456" },
88
90
  :variant => 'IDEAL',
89
91
  :creation_date => DateTime.parse('2009-10-27T11:26:22.216+01:00')
90
92
  },
@@ -97,6 +99,7 @@ describe Adyen::API::RecurringService do
97
99
  :bank_name => 'TestBank',
98
100
  },
99
101
  :recurring_detail_reference => 'RecurringDetailReference3',
102
+ :additional_data => { "newAlias" => "123456" },
100
103
  :variant => 'elv',
101
104
  :creation_date => DateTime.parse('2009-10-27T11:26:22.216+01:00')
102
105
  }
@@ -328,6 +328,12 @@ LIST_RESPONSE = <<EOS
328
328
  <elv xsi:nil="true"/>
329
329
  <name/>
330
330
  <recurringDetailReference>RecurringDetailReference1</recurringDetailReference>
331
+ <additionalData>
332
+ <entry>
333
+ <key xsi:type="xsd:string">newAlias</key>
334
+ <value xsi:type="xsd:string">123456</value>
335
+ </entry>
336
+ </additionalData>
331
337
  <variant>mc</variant>
332
338
  </RecurringDetail>
333
339
  <RecurringDetail>
@@ -345,6 +351,12 @@ LIST_RESPONSE = <<EOS
345
351
  <elv xsi:nil="true"/>
346
352
  <name/>
347
353
  <recurringDetailReference>RecurringDetailReference2</recurringDetailReference>
354
+ <additionalData>
355
+ <entry>
356
+ <key xsi:type="xsd:string">newAlias</key>
357
+ <value xsi:type="xsd:string">123456</value>
358
+ </entry>
359
+ </additionalData>
348
360
  <variant>IDEAL</variant>
349
361
  </RecurringDetail>
350
362
  <RecurringDetail>
@@ -360,6 +372,12 @@ LIST_RESPONSE = <<EOS
360
372
  <creationDate>2009-10-27T11:26:22.216+01:00</creationDate>
361
373
  <name/>
362
374
  <recurringDetailReference>RecurringDetailReference3</recurringDetailReference>
375
+ <additionalData>
376
+ <entry>
377
+ <key xsi:type="xsd:string">newAlias</key>
378
+ <value xsi:type="xsd:string">123456</value>
379
+ </entry>
380
+ </additionalData>
363
381
  <variant>elv</variant>
364
382
  </RecurringDetail>
365
383
  </details>
@@ -83,6 +83,8 @@ class FormTest < Minitest::Test
83
83
 
84
84
  Adyen.configuration.environment = :live
85
85
  assert_equal 'https://live.adyen.com/hpp/select.shtml', Adyen::Form.url
86
+ ensure
87
+ Adyen.configuration.environment = nil
86
88
  end
87
89
 
88
90
  def test_redirect_url_for_different_payment_flows
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+ require 'adyen/rest/client'
3
+
4
+ class RESTClientTest < Minitest::Test
5
+ def test_endpoint_dev
6
+ client = Adyen::REST::Client.new(
7
+ :test,
8
+ 'login',
9
+ 'password'
10
+ )
11
+
12
+ assert_equal client.http.address, 'pal-test.adyen.com'
13
+ end
14
+
15
+ def test_endpoint_live
16
+ client = Adyen::REST::Client.new(
17
+ :live,
18
+ 'login',
19
+ 'password'
20
+ )
21
+
22
+ assert_equal client.http.address, 'pal-live.adyen.com'
23
+ end
24
+
25
+ def test_endpoint_live_with_merchant
26
+ merchant = 'merchantEndpoint'
27
+
28
+ client = Adyen::REST::Client.new(
29
+ :live,
30
+ 'login',
31
+ 'password',
32
+ merchant
33
+ )
34
+
35
+ assert_equal client.http.address, "#{merchant}.pal-live.adyenpayments.com"
36
+ end
37
+ end
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.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -11,110 +11,110 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-09-07 00:00:00.000000000 Z
14
+ date: 2018-11-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: minitest
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ~>
34
+ - - "~>"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '5.0'
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ~>
41
+ - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '5.0'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: mocha
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sinatra
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - '>='
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  - !ruby/object:Gem::Dependency
73
- name: poltergeist
73
+ name: capybara-webkit
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: railties
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '3.2'
93
- - - <
93
+ - - "<"
94
94
  - !ruby/object:Gem::Version
95
- version: '5.2'
95
+ version: '6.0'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '3.2'
103
- - - <
103
+ - - "<"
104
104
  - !ruby/object:Gem::Version
105
- version: '5.2'
105
+ version: '6.0'
106
106
  - !ruby/object:Gem::Dependency
107
107
  name: nokogiri
108
108
  requirement: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: 1.6.8
113
113
  type: :development
114
114
  prerelease: false
115
115
  version_requirements: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: 1.6.8
120
120
  description: |2
@@ -134,8 +134,8 @@ extra_rdoc_files:
134
134
  - CHANGELOG.md
135
135
  - CONTRIBUTING.md
136
136
  files:
137
- - .gitignore
138
- - .travis.yml
137
+ - ".gitignore"
138
+ - ".travis.yml"
139
139
  - CHANGELOG.md
140
140
  - CONTRIBUTING.md
141
141
  - Gemfile
@@ -210,6 +210,7 @@ files:
210
210
  - test/unit/hpp/request_test.rb
211
211
  - test/unit/hpp/signature_test.rb
212
212
  - test/unit/hpp_test.rb
213
+ - test/unit/rest/client_test.rb
213
214
  - test/unit/rest/signature_test.rb
214
215
  - test/unit/rest_list_recurring_details_response_test.rb
215
216
  - test/unit/rest_request_test.rb
@@ -223,28 +224,28 @@ licenses:
223
224
  metadata: {}
224
225
  post_install_message:
225
226
  rdoc_options:
226
- - --title
227
+ - "--title"
227
228
  - adyen
228
- - --main
229
+ - "--main"
229
230
  - README.md
230
- - --line-numbers
231
- - --inline-source
231
+ - "--line-numbers"
232
+ - "--inline-source"
232
233
  require_paths:
233
234
  - lib
234
235
  required_ruby_version: !ruby/object:Gem::Requirement
235
236
  requirements:
236
- - - '>='
237
+ - - ">="
237
238
  - !ruby/object:Gem::Version
238
239
  version: 1.9.3
239
240
  required_rubygems_version: !ruby/object:Gem::Requirement
240
241
  requirements:
241
- - - '>='
242
+ - - ">="
242
243
  - !ruby/object:Gem::Version
243
244
  version: '0'
244
245
  requirements:
245
246
  - Having Nokogiri installed will speed up XML handling when using the SOAP API.
246
247
  rubyforge_project:
247
- rubygems_version: 2.0.14.1
248
+ rubygems_version: 2.5.2.3
248
249
  signing_key:
249
250
  specification_version: 4
250
251
  summary: Integrate Adyen payment services in your Ruby on Rails application.
@@ -280,6 +281,7 @@ test_files:
280
281
  - test/unit/hpp/request_test.rb
281
282
  - test/unit/hpp/signature_test.rb
282
283
  - test/unit/hpp_test.rb
284
+ - test/unit/rest/client_test.rb
283
285
  - test/unit/rest/signature_test.rb
284
286
  - test/unit/rest_list_recurring_details_response_test.rb
285
287
  - test/unit/rest_request_test.rb