fingertips-adyen 0.3.7.20100917 → 0.3.8.20100924
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +12 -5
- data/TODO +10 -0
- data/adyen.gemspec +12 -8
- data/lib/adyen.rb +1 -1
- data/lib/adyen/api.rb +38 -3
- data/lib/adyen/form.rb +28 -26
- data/lib/adyen/matchers.rb +6 -7
- data/lib/adyen/notification.rb +3 -3
- data/spec/adyen_spec.rb +1 -1
- data/spec/api_spec.rb +79 -5
- data/spec/form_spec.rb +1 -1
- data/spec/notification_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/tasks/github-gem.rake +1 -1
- metadata +69 -12
data/README.rdoc
CHANGED
@@ -15,14 +15,20 @@ automated test suite to assert the integration is working correctly.
|
|
15
15
|
|
16
16
|
== Installation
|
17
17
|
|
18
|
-
Add the following line to your <tt>
|
18
|
+
<b>Bundler / Rails 3</b>: Add the following line to your <tt>Gemfile</tt>:
|
19
|
+
|
20
|
+
gem 'adyen'
|
21
|
+
|
22
|
+
<b>Rails 2.x</b>: Add the following line to your <tt>environment.rb</tt> and run <tt>rake gems:install</tt>
|
19
23
|
to make the Adyen functionality available in your Rails project:
|
20
24
|
|
21
|
-
|
25
|
+
config.gem 'adyen'
|
22
26
|
|
23
27
|
You can also install it as a Rails plugin (*deprecated*):
|
24
28
|
|
25
|
-
|
29
|
+
script/plugin install git://github.com/wvanbergen/adyen.git
|
30
|
+
|
31
|
+
Depending on your use case, you may also need the following gems: activerecord, handsoap and nokogiri.
|
26
32
|
|
27
33
|
== Usage
|
28
34
|
|
@@ -36,5 +42,6 @@ RDoc documentation for the project can be found on http://rdoc.info/projects/wva
|
|
36
42
|
== About
|
37
43
|
|
38
44
|
This package is written by Michel Barbosa and Willem van Bergen for Floorplanner.com, and
|
39
|
-
made public under the MIT license (see LICENSE).
|
40
|
-
|
45
|
+
made public under the MIT license (see LICENSE). Its is currently maintained by Willem van
|
46
|
+
Bergen, Stefan Borsje and Eloy Duran. We are not affiliated with Adyen B.V. The software
|
47
|
+
comes without warranty of any kind, so use at your own risk.
|
data/TODO
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
* Use require/autoload instead of const_missing
|
2
|
+
* Make sure Japansese yens work as expected (this is the only currency Adyen does not expect to be in cents)
|
3
|
+
* Ditch SOAP library dependency.
|
4
|
+
* Complete SOAP API.
|
5
|
+
* Add ActiveMerchant integration
|
6
|
+
|
7
|
+
* Split up gem to have more explicit dependency requirements, e.g.:
|
8
|
+
* adyen-soap
|
9
|
+
* adyen-railtie
|
10
|
+
* adyen-activemerchant
|
data/adyen.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'fingertips-adyen'
|
3
|
-
s.version = "0.3.
|
4
|
-
s.date = "2010-
|
3
|
+
s.version = "0.3.8.20100924"
|
4
|
+
s.date = "2010-09-23"
|
5
5
|
|
6
|
-
s.summary = "Integrate Adyen payment services in
|
6
|
+
s.summary = "Integrate Adyen payment services in your Ruby on Rails application."
|
7
7
|
s.description = <<-EOS
|
8
8
|
Package to simplify including the Adyen payments services into a Ruby on Rails application.
|
9
9
|
The package provides functionality to create payment forms, handling and storing notifications
|
@@ -11,20 +11,24 @@ Gem::Specification.new do |s|
|
|
11
11
|
methods, mocks and matchers to simpify writing tests/specsfor your code.
|
12
12
|
EOS
|
13
13
|
|
14
|
-
s.authors = ['Willem van Bergen', 'Michel Barbosa', 'Eloy Duran']
|
15
|
-
s.email = ['willem@vanbergen.org', 'cicaboo@gmail.com', 'eloy.de.enige@gmail.com']
|
14
|
+
s.authors = ['Willem van Bergen', 'Michel Barbosa', 'Stefan Borsje', 'Eloy Duran']
|
15
|
+
s.email = ['willem@vanbergen.org', 'cicaboo@gmail.com', 'mail@sborsje.nl', 'eloy.de.enige@gmail.com']
|
16
16
|
s.homepage = 'http://wiki.github.com/wvanbergen/adyen'
|
17
17
|
|
18
|
+
s.add_development_dependency('rake')
|
18
19
|
s.add_development_dependency('rspec', '>= 1.1.4')
|
19
20
|
s.add_development_dependency('git', '>= 1.1.0')
|
21
|
+
s.add_development_dependency('gemcutter')
|
22
|
+
|
23
|
+
# Drop or make runtime dependency.
|
24
|
+
s.add_development_dependency('activerecord')
|
25
|
+
s.add_development_dependency('nokogiri')
|
20
26
|
|
21
|
-
s.requirements << 'Handsoap is required for accessing the SOAP services. See http://github.com/troelskn/handsoap.'
|
22
|
-
s.requirements << 'LibXML is required for using the RSpec matchers.'
|
23
27
|
s.requirements << 'ActiveRecord is required for storing the notifications in your database.'
|
24
28
|
|
25
29
|
s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
|
26
30
|
s.extra_rdoc_files = ['README.rdoc']
|
27
31
|
|
28
|
-
s.files = %w(spec/spec_helper.rb spec/adyen_spec.rb lib/adyen/form.rb .gitignore spec/notification_spec.rb lib/adyen/api.rb LICENSE spec/api_spec.rb init.rb adyen.gemspec Rakefile spec/form_spec.rb README.rdoc lib/adyen/notification.rb lib/adyen/formatter.rb tasks/github-gem.rake lib/adyen/encoding.rb lib/adyen/matchers.rb lib/adyen.rb)
|
32
|
+
s.files = %w(spec/spec_helper.rb spec/adyen_spec.rb lib/adyen/form.rb .gitignore spec/notification_spec.rb lib/adyen/api.rb LICENSE spec/api_spec.rb init.rb adyen.gemspec Rakefile spec/form_spec.rb README.rdoc lib/adyen/notification.rb lib/adyen/formatter.rb tasks/github-gem.rake lib/adyen/encoding.rb TODO lib/adyen/matchers.rb lib/adyen.rb)
|
29
33
|
s.test_files = %w(spec/adyen_spec.rb spec/notification_spec.rb spec/api_spec.rb spec/form_spec.rb)
|
30
34
|
end
|
data/lib/adyen.rb
CHANGED
@@ -13,7 +13,7 @@ module Adyen
|
|
13
13
|
# Version constant for the Adyen plugin.
|
14
14
|
# DO NOT CHANGE THIS VALUE BY HAND. It will be updated automatically by
|
15
15
|
# the gem:release rake task.
|
16
|
-
VERSION = "0.3.
|
16
|
+
VERSION = "0.3.8.20100924"
|
17
17
|
|
18
18
|
# Loads configuration settings from a Hash.
|
19
19
|
#
|
data/lib/adyen/api.rb
CHANGED
@@ -30,6 +30,10 @@ module Adyen
|
|
30
30
|
PaymentService.new(params).authorise_recurring_payment
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.disable_recurring_contract(params = {})
|
34
|
+
RecurringService.new(params).disable
|
35
|
+
end
|
36
|
+
|
33
37
|
# TODO: the rest
|
34
38
|
|
35
39
|
#
|
@@ -144,10 +148,22 @@ module Adyen
|
|
144
148
|
end
|
145
149
|
end
|
146
150
|
|
151
|
+
def disable
|
152
|
+
response = call_webservice_action('disable', disable_request_body)
|
153
|
+
{ :response => response.text('//recurring:disableResponse/recurring:result/recurring:response') }
|
154
|
+
end
|
155
|
+
|
147
156
|
private
|
148
157
|
|
149
158
|
def list_request_body
|
150
|
-
|
159
|
+
LIST_LAYOUT % [@params[:merchant_account], @params[:shopper][:reference]]
|
160
|
+
end
|
161
|
+
|
162
|
+
def disable_request_body
|
163
|
+
if reference = @params[:recurring_detail_reference]
|
164
|
+
reference = RECURRING_DETAIL_PARTIAL % reference
|
165
|
+
end
|
166
|
+
DISABLE_LAYOUT % [@params[:merchant_account], @params[:shopper][:reference], reference || '']
|
151
167
|
end
|
152
168
|
|
153
169
|
# @todo add support for elv
|
@@ -240,7 +256,7 @@ module Adyen
|
|
240
256
|
end
|
241
257
|
|
242
258
|
def text(query)
|
243
|
-
xpath("#{query}/text()").to_s
|
259
|
+
xpath("#{query}/text()").to_s.strip
|
244
260
|
end
|
245
261
|
|
246
262
|
def children
|
@@ -322,7 +338,7 @@ EOS
|
|
322
338
|
end
|
323
339
|
|
324
340
|
class RecurringService
|
325
|
-
|
341
|
+
LIST_LAYOUT = <<EOS
|
326
342
|
<?xml version="1.0"?>
|
327
343
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
328
344
|
<soap:Body>
|
@@ -337,6 +353,25 @@ EOS
|
|
337
353
|
</ns1:listRecurringDetails>
|
338
354
|
</soap:Body>
|
339
355
|
</soap:Envelope>
|
356
|
+
EOS
|
357
|
+
|
358
|
+
DISABLE_LAYOUT = <<EOS
|
359
|
+
<?xml version="1.0"?>
|
360
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
361
|
+
<soap:Body>
|
362
|
+
<ns1:disable xmlns:ns1="http://recurring.services.adyen.com">
|
363
|
+
<ns1:request>
|
364
|
+
<ns1:merchantAccount>%s</ns1:merchantAccount>
|
365
|
+
<ns1:shopperReference>%s</ns1:shopperReference>
|
366
|
+
%s
|
367
|
+
</ns1:request>
|
368
|
+
</ns1:disable>
|
369
|
+
</soap:Body>
|
370
|
+
</soap:Envelope>
|
371
|
+
EOS
|
372
|
+
|
373
|
+
RECURRING_DETAIL_PARTIAL = <<EOS
|
374
|
+
<ns1:recurringDetailReference>%s</ns1:recurringDetailReference>
|
340
375
|
EOS
|
341
376
|
end
|
342
377
|
end
|
data/lib/adyen/form.rb
CHANGED
@@ -21,8 +21,8 @@ module Adyen
|
|
21
21
|
# @see Adyen::Form.redirect_url
|
22
22
|
# @see Adyen::Form.redirect_signature_check
|
23
23
|
module Form
|
24
|
-
|
25
|
-
extend
|
24
|
+
include ActionView::Helpers::TagHelper
|
25
|
+
extend self
|
26
26
|
|
27
27
|
######################################################
|
28
28
|
# SKINS
|
@@ -30,7 +30,7 @@ module Adyen
|
|
30
30
|
|
31
31
|
# Returns all registered skins and their accompanying skin code and shared secret.
|
32
32
|
# @return [Hash] The hash of registered skins.
|
33
|
-
def
|
33
|
+
def skins
|
34
34
|
@skins ||= {}
|
35
35
|
end
|
36
36
|
|
@@ -38,7 +38,7 @@ module Adyen
|
|
38
38
|
# @param [Hash<Symbol, Hash>] hash A hash with the skin name as key and the skin parameter hash
|
39
39
|
# (which should include +:skin_code+ and +:shared_secret+) as value.
|
40
40
|
# @see Adyen::Form.register_skin
|
41
|
-
def
|
41
|
+
def skins=(hash)
|
42
42
|
@skins = hash.inject({}) do |skins, (name, skin)|
|
43
43
|
skins[name.to_sym] = skin.merge(:name => name.to_sym)
|
44
44
|
skins
|
@@ -58,28 +58,28 @@ module Adyen
|
|
58
58
|
# @param [String] skin_code The skin code for this skin, as defined by Adyen.
|
59
59
|
# @param [String] shared_secret The shared secret used for signature calculation.
|
60
60
|
# @see Adyen.load_config
|
61
|
-
def
|
62
|
-
|
61
|
+
def register_skin(name, skin_code, shared_secret)
|
62
|
+
skins[name.to_sym] = {:name => name.to_sym, :skin_code => skin_code, :shared_secret => shared_secret }
|
63
63
|
end
|
64
64
|
|
65
65
|
# Returns skin information given a skin name.
|
66
66
|
# @param [Symbol] skin_name The name of the skin
|
67
67
|
# @return [Hash, nil] A hash with the skin information, or nil if not found.
|
68
|
-
def
|
69
|
-
|
68
|
+
def skin_by_name(skin_name)
|
69
|
+
skins[skin_name.to_sym]
|
70
70
|
end
|
71
71
|
|
72
72
|
# Returns skin information given a skin code.
|
73
73
|
# @param [String] skin_code The skin code of the skin
|
74
74
|
# @return [Hash, nil] A hash with the skin information, or nil if not found.
|
75
|
-
def
|
76
|
-
|
75
|
+
def skin_by_code(skin_code)
|
76
|
+
skins.detect { |(name, skin)| skin[:skin_code] == skin_code }.last rescue nil
|
77
77
|
end
|
78
78
|
|
79
79
|
# Returns the shared secret belonging to a skin code.
|
80
80
|
# @param [String] skin_code The skin code of the skin
|
81
81
|
# @return [String, nil] The shared secret for the skin, or nil if not found.
|
82
|
-
def
|
82
|
+
def lookup_shared_secret(skin_code)
|
83
83
|
skin = skin_by_code(skin_code)[:shared_secret] rescue nil
|
84
84
|
end
|
85
85
|
|
@@ -90,14 +90,14 @@ module Adyen
|
|
90
90
|
# Returns the default parameters to use, unless they are overridden.
|
91
91
|
# @see Adyen::Form.default_parameters
|
92
92
|
# @return [Hash] The hash of default parameters
|
93
|
-
def
|
93
|
+
def default_parameters
|
94
94
|
@default_arguments ||= {}
|
95
95
|
end
|
96
96
|
|
97
97
|
# Sets the default parameters to use.
|
98
98
|
# @see Adyen::Form.default_parameters
|
99
99
|
# @param [Hash] hash The hash of default parameters
|
100
|
-
def
|
100
|
+
def default_parameters=(hash)
|
101
101
|
@default_arguments = hash
|
102
102
|
end
|
103
103
|
|
@@ -117,7 +117,7 @@ module Adyen
|
|
117
117
|
# for payment forms or redirects.
|
118
118
|
# @see Adyen::Form.environment
|
119
119
|
# @see Adyen::Form.redirect_url
|
120
|
-
def
|
120
|
+
def url(environment = nil)
|
121
121
|
environment ||= Adyen.environment
|
122
122
|
Adyen::Form::ACTION_URL % environment.to_s
|
123
123
|
end
|
@@ -133,7 +133,7 @@ module Adyen
|
|
133
133
|
#
|
134
134
|
# @private
|
135
135
|
# @param [Hash] parameters The payment parameters hash to transform
|
136
|
-
def
|
136
|
+
def do_parameter_transformations!(parameters = {})
|
137
137
|
raise "YENs are not yet supported!" if parameters[:currency_code] == 'JPY' # TODO: fixme
|
138
138
|
|
139
139
|
parameters.replace(default_parameters.merge(parameters))
|
@@ -160,7 +160,7 @@ module Adyen
|
|
160
160
|
# is provided as the +:shared_secret+ parameter.
|
161
161
|
# @return [Hash] The payment parameters with the +:merchant_signature+ parameter set.
|
162
162
|
# @raise [StandardError] Thrown if some parameter health check fails.
|
163
|
-
def
|
163
|
+
def payment_parameters(parameters = {}, shared_secret = nil)
|
164
164
|
do_parameter_transformations!(parameters)
|
165
165
|
|
166
166
|
raise "Cannot generate form: :currency code attribute not found!" unless parameters[:currency_code]
|
@@ -204,8 +204,8 @@ module Adyen
|
|
204
204
|
#
|
205
205
|
# @param [Hash] parameters The payment parameters to include in the payment request.
|
206
206
|
# @return [String] An absolute URL to redirect to the Adyen payment system.
|
207
|
-
def
|
208
|
-
|
207
|
+
def redirect_url(parameters = {})
|
208
|
+
url + '?' + payment_parameters(parameters).map { |(k, v)|
|
209
209
|
"#{k.to_s.camelize(:lower)}=#{CGI.escape(v.to_s)}" }.join('&')
|
210
210
|
end
|
211
211
|
|
@@ -230,12 +230,14 @@ module Adyen
|
|
230
230
|
# @param [Hash] parameters The payment parameters to include in the payment request.
|
231
231
|
# @return [String] An HTML snippet that can be included in a form that POSTs to the
|
232
232
|
# Adyen payment system.
|
233
|
-
def
|
233
|
+
def hidden_fields(parameters = {})
|
234
234
|
|
235
235
|
# Generate a hidden input tag per parameter, join them by newlines.
|
236
|
-
payment_parameters(parameters).map { |key, value|
|
237
|
-
|
236
|
+
form_str = payment_parameters(parameters).map { |key, value|
|
237
|
+
tag(:input, :type => 'hidden', :name => key.to_s.camelize(:lower), :value => value)
|
238
238
|
}.join("\n")
|
239
|
+
|
240
|
+
form_str.respond_to?(:html_safe) ? form_str.html_safe : form_str
|
239
241
|
end
|
240
242
|
|
241
243
|
######################################################
|
@@ -246,7 +248,7 @@ module Adyen
|
|
246
248
|
# is used by Adyen to check whether the request is genuinely originating from you.
|
247
249
|
# @param [Hash] parameters The parameters that will be included in the payment request.
|
248
250
|
# @return [String] The string for which the siganture is calculated.
|
249
|
-
def
|
251
|
+
def calculate_signature_string(parameters)
|
250
252
|
merchant_sig_string = ""
|
251
253
|
merchant_sig_string << parameters[:payment_amount].to_s << parameters[:currency_code].to_s <<
|
252
254
|
parameters[:ship_before_date].to_s << parameters[:merchant_reference].to_s <<
|
@@ -270,7 +272,7 @@ module Adyen
|
|
270
272
|
# It should correspond with the skin_code parameter. This parameter can be
|
271
273
|
# left out if the shared_secret is included as key in the parameters.
|
272
274
|
# @return [String] The signature of the payment request
|
273
|
-
def
|
275
|
+
def calculate_signature(parameters, shared_secret = nil)
|
274
276
|
shared_secret ||= parameters.delete(:shared_secret)
|
275
277
|
Adyen::Encoding.hmac_base64(shared_secret, calculate_signature_string(parameters))
|
276
278
|
end
|
@@ -282,7 +284,7 @@ module Adyen
|
|
282
284
|
# Generates the string for which the redirect signature is calculated, using the request paramaters.
|
283
285
|
# @param [Hash] params A hash of HTTP GET parameters for the redirect request.
|
284
286
|
# @return [String] The signature string.
|
285
|
-
def
|
287
|
+
def redirect_signature_string(params)
|
286
288
|
params[:authResult].to_s + params[:pspReference].to_s + params[:merchantReference].to_s + params[:skinCode].to_s
|
287
289
|
end
|
288
290
|
|
@@ -294,7 +296,7 @@ module Adyen
|
|
294
296
|
# the original payment form. You can leave this out of the skin is registered
|
295
297
|
# using the {Adyen::Form.register_skin} method.
|
296
298
|
# @return [String] The redirect signature
|
297
|
-
def
|
299
|
+
def redirect_signature(params, shared_secret = nil)
|
298
300
|
shared_secret ||= lookup_shared_secret(params[:skinCode])
|
299
301
|
Adyen::Encoding.hmac_base64(shared_secret, redirect_signature_string(params))
|
300
302
|
end
|
@@ -329,7 +331,7 @@ module Adyen
|
|
329
331
|
# the original payment form. You can leave this out of the skin is registered
|
330
332
|
# using the {Adyen::Form.register_skin} method.
|
331
333
|
# @return [true, false] Returns true only if the signature in the parameters is correct.
|
332
|
-
def
|
334
|
+
def redirect_signature_check(params, shared_secret = nil)
|
333
335
|
params[:merchantSig] == redirect_signature(params, shared_secret)
|
334
336
|
end
|
335
337
|
end
|
data/lib/adyen/matchers.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'rexml/document'
|
2
|
+
require 'rexml/xpath'
|
2
3
|
|
3
4
|
module Adyen
|
4
5
|
module Matchers
|
@@ -31,12 +32,10 @@ module Adyen
|
|
31
32
|
|
32
33
|
def self.document(subject)
|
33
34
|
if String === subject
|
34
|
-
|
35
|
+
REXML::Document.new(subject.to_s)
|
35
36
|
elsif subject.respond_to?(:body)
|
36
|
-
|
37
|
-
elsif
|
38
|
-
subject
|
39
|
-
elsif XML::Document === subject
|
37
|
+
REXML::Document.new(subject.body.to_s)
|
38
|
+
elsif REXML::Document === subject
|
40
39
|
subject
|
41
40
|
else
|
42
41
|
raise "Cannot handle this XML input type"
|
@@ -44,7 +43,7 @@ module Adyen
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def self.check(subject, checks = {})
|
47
|
-
document(subject)
|
46
|
+
!!REXML::XPath.first(document(subject), build_xpath_query(checks))
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
data/lib/adyen/notification.rb
CHANGED
@@ -105,15 +105,15 @@ module Adyen
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def live=(value)
|
108
|
-
|
108
|
+
super([true, 1, '1', 'true'].include?(value))
|
109
109
|
end
|
110
110
|
|
111
111
|
def success=(value)
|
112
|
-
|
112
|
+
super([true, 1, '1', 'true'].include?(value))
|
113
113
|
end
|
114
114
|
|
115
115
|
def value=(value)
|
116
|
-
|
116
|
+
super(Adyen::Formatter::Price.from_cents(value)) unless value.blank?
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
data/spec/adyen_spec.rb
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -66,7 +66,7 @@ module Adyen
|
|
66
66
|
end
|
67
67
|
|
68
68
|
class RecurringService
|
69
|
-
public :list_request_body
|
69
|
+
public :list_request_body, :disable_request_body
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -238,6 +238,13 @@ describe Adyen::API do
|
|
238
238
|
payment.should_receive(:authorise_recurring_payment)
|
239
239
|
Adyen::API.authorise_recurring_payment(:reference => 'order-id')
|
240
240
|
end
|
241
|
+
|
242
|
+
it "performs a `disable recurring contract' request" do
|
243
|
+
recurring = mock('RecurringService')
|
244
|
+
Adyen::API::RecurringService.should_receive(:new).with(:shopper => { :reference => 'user-id' }).and_return(recurring)
|
245
|
+
recurring.should_receive(:disable)
|
246
|
+
Adyen::API.disable_recurring_contract(:shopper => { :reference => 'user-id' })
|
247
|
+
end
|
241
248
|
end
|
242
249
|
|
243
250
|
describe Adyen::API::PaymentService do
|
@@ -420,6 +427,12 @@ describe Adyen::API do
|
|
420
427
|
it "includes the type of contract, which is always `RECURRING'" do
|
421
428
|
text('./recurring:recurring/recurring:contract').should == 'RECURRING'
|
422
429
|
end
|
430
|
+
|
431
|
+
private
|
432
|
+
|
433
|
+
def node_for_current_method
|
434
|
+
super(@recurring).xpath('//recurring:listRecurringDetails/recurring:request')
|
435
|
+
end
|
423
436
|
end
|
424
437
|
|
425
438
|
describe "list" do
|
@@ -476,12 +489,58 @@ describe Adyen::API do
|
|
476
489
|
}
|
477
490
|
end
|
478
491
|
end
|
479
|
-
end
|
480
492
|
|
481
|
-
|
493
|
+
describe "disable_request_body" do
|
494
|
+
before :all do
|
495
|
+
@method = :disable_request_body
|
496
|
+
end
|
482
497
|
|
483
|
-
|
484
|
-
|
498
|
+
it "includes the merchant account handle" do
|
499
|
+
text('./recurring:merchantAccount').should == 'SuperShopper'
|
500
|
+
end
|
501
|
+
|
502
|
+
it "includes the shopper’s reference" do
|
503
|
+
text('./recurring:shopperReference').should == 'user-id'
|
504
|
+
end
|
505
|
+
|
506
|
+
it "includes the shopper’s recurring detail reference if it is given" do
|
507
|
+
xpath('./recurring:recurringDetailReference').should be_empty
|
508
|
+
@recurring.params[:recurring_detail_reference] = 'RecurringDetailReference1'
|
509
|
+
text('./recurring:recurringDetailReference').should == 'RecurringDetailReference1'
|
510
|
+
end
|
511
|
+
|
512
|
+
private
|
513
|
+
|
514
|
+
def node_for_current_method
|
515
|
+
super(@recurring).xpath('//recurring:disable/recurring:request')
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
describe "disable" do
|
520
|
+
before do
|
521
|
+
stub_net_http(DISABLE_RESPONSE)
|
522
|
+
@recurring.disable
|
523
|
+
@request, @post = Net::HTTP.posted
|
524
|
+
end
|
525
|
+
|
526
|
+
after do
|
527
|
+
Net::HTTP.stubbing_enabled = false
|
528
|
+
end
|
529
|
+
|
530
|
+
it "posts the body generated for the given parameters" do
|
531
|
+
@post.body.should == @recurring.disable_request_body
|
532
|
+
end
|
533
|
+
|
534
|
+
it "posts to the correct SOAP action" do
|
535
|
+
@post.soap_action.should == 'disable'
|
536
|
+
end
|
537
|
+
|
538
|
+
for_each_xml_backend do
|
539
|
+
it "returns a hash with parsed response details" do
|
540
|
+
@recurring.disable.should == { :response => '[detail-successfully-disabled]' }
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
485
544
|
end
|
486
545
|
end
|
487
546
|
end
|
@@ -560,3 +619,18 @@ LIST_RESPONSE = <<EOS
|
|
560
619
|
</soap:Body>
|
561
620
|
</soap:Envelope>
|
562
621
|
EOS
|
622
|
+
|
623
|
+
DISABLE_RESPONSE = <<EOS
|
624
|
+
<?xml version="1.0"?>
|
625
|
+
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
626
|
+
<soap:Body>
|
627
|
+
<ns1:disableResponse xmlns:ns1="http://recurring.services.adyen.com">
|
628
|
+
<ns1:result>
|
629
|
+
<response xmlns="http://recurring.services.adyen.com">
|
630
|
+
[detail-successfully-disabled]
|
631
|
+
</response>
|
632
|
+
</ns1:result>
|
633
|
+
</ns1:disableResponse>
|
634
|
+
</soap:Body>
|
635
|
+
</soap:Envelope>
|
636
|
+
EOS
|
data/spec/form_spec.rb
CHANGED
data/spec/notification_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'spec'
|
@@ -6,6 +6,7 @@ require 'spec/autorun'
|
|
6
6
|
require 'active_support'
|
7
7
|
|
8
8
|
require 'adyen'
|
9
|
+
require 'adyen/matchers'
|
9
10
|
|
10
11
|
Spec::Runner.configure do |config|
|
11
12
|
config.include Adyen::Matchers
|
data/tasks/github-gem.rake
CHANGED
@@ -217,7 +217,7 @@ module GithubGem
|
|
217
217
|
|
218
218
|
def check_version_task
|
219
219
|
raise "#{ENV['VERSION']} is not a valid version number!" if ENV['VERSION'] && !Gem::Version.correct?(ENV['VERSION'])
|
220
|
-
proposed_version = Gem::Version.new(ENV['VERSION'] || gemspec.version)
|
220
|
+
proposed_version = Gem::Version.new(ENV['VERSION'].dup || gemspec.version)
|
221
221
|
raise "This version (#{proposed_version}) is not higher than the highest tagged version (#{newest_version})" if newest_version >= proposed_version
|
222
222
|
end
|
223
223
|
|
metadata
CHANGED
@@ -1,30 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fingertips-adyen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 40201743
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
-
|
11
|
-
version: 0.3.
|
9
|
+
- 8
|
10
|
+
- 20100924
|
11
|
+
version: 0.3.8.20100924
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Willem van Bergen
|
15
15
|
- Michel Barbosa
|
16
|
+
- Stefan Borsje
|
16
17
|
- Eloy Duran
|
17
18
|
autorequire:
|
18
19
|
bindir: bin
|
19
20
|
cert_chain: []
|
20
21
|
|
21
|
-
date: 2010-
|
22
|
+
date: 2010-09-23 00:00:00 +02:00
|
22
23
|
default_executable:
|
23
24
|
dependencies:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
|
-
name:
|
26
|
+
name: rake
|
26
27
|
prerelease: false
|
27
28
|
requirement: &id001 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
hash: 3
|
34
|
+
segments:
|
35
|
+
- 0
|
36
|
+
version: "0"
|
37
|
+
type: :development
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rspec
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
43
|
none: false
|
29
44
|
requirements:
|
30
45
|
- - ">="
|
@@ -36,11 +51,11 @@ dependencies:
|
|
36
51
|
- 4
|
37
52
|
version: 1.1.4
|
38
53
|
type: :development
|
39
|
-
version_requirements: *
|
54
|
+
version_requirements: *id002
|
40
55
|
- !ruby/object:Gem::Dependency
|
41
56
|
name: git
|
42
57
|
prerelease: false
|
43
|
-
requirement: &
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
44
59
|
none: false
|
45
60
|
requirements:
|
46
61
|
- - ">="
|
@@ -52,11 +67,54 @@ dependencies:
|
|
52
67
|
- 0
|
53
68
|
version: 1.1.0
|
54
69
|
type: :development
|
55
|
-
version_requirements: *
|
70
|
+
version_requirements: *id003
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: gemcutter
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: activerecord
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
type: :development
|
98
|
+
version_requirements: *id005
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: nokogiri
|
101
|
+
prerelease: false
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
111
|
+
type: :development
|
112
|
+
version_requirements: *id006
|
56
113
|
description: " Package to simplify including the Adyen payments services into a Ruby on Rails application.\n The package provides functionality to create payment forms, handling and storing notifications \n sent by Adyen and consuming the SOAP services provided by Adyen. Moreover, it contains helper\n methods, mocks and matchers to simpify writing tests/specsfor your code.\n"
|
57
114
|
email:
|
58
115
|
- willem@vanbergen.org
|
59
116
|
- cicaboo@gmail.com
|
117
|
+
- mail@sborsje.nl
|
60
118
|
- eloy.de.enige@gmail.com
|
61
119
|
executables: []
|
62
120
|
|
@@ -82,6 +140,7 @@ files:
|
|
82
140
|
- lib/adyen/formatter.rb
|
83
141
|
- tasks/github-gem.rake
|
84
142
|
- lib/adyen/encoding.rb
|
143
|
+
- TODO
|
85
144
|
- lib/adyen/matchers.rb
|
86
145
|
- lib/adyen.rb
|
87
146
|
has_rdoc: true
|
@@ -117,14 +176,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
176
|
- 0
|
118
177
|
version: "0"
|
119
178
|
requirements:
|
120
|
-
- Handsoap is required for accessing the SOAP services. See http://github.com/troelskn/handsoap.
|
121
|
-
- LibXML is required for using the RSpec matchers.
|
122
179
|
- ActiveRecord is required for storing the notifications in your database.
|
123
180
|
rubyforge_project:
|
124
181
|
rubygems_version: 1.3.7
|
125
182
|
signing_key:
|
126
183
|
specification_version: 3
|
127
|
-
summary: Integrate Adyen payment services in
|
184
|
+
summary: Integrate Adyen payment services in your Ruby on Rails application.
|
128
185
|
test_files:
|
129
186
|
- spec/adyen_spec.rb
|
130
187
|
- spec/notification_spec.rb
|