adyen 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  require 'yard'
8
8
  require File.expand_path('../yard_extensions', __FILE__)
9
9
  YARD::Rake::YardocTask.new do |y|
10
- y.options << '--no-private' << '--title' << 'The Adyen payment service library for Ruby'
10
+ y.options << '--no-private' << '--title' << "The 'Adyen payment service' library for Ruby"
11
11
  end
12
12
  rescue LoadError
13
13
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'adyen'
3
- s.version = "1.0.0"
4
- s.date = "2011-01-22"
3
+ s.version = "1.1.0"
4
+ s.date = "2011-03-21"
5
5
 
6
6
  s.summary = "Integrate Adyen payment services in your Ruby on Rails application."
7
7
  s.description = <<-EOS
@@ -12,7 +12,7 @@ module Adyen
12
12
  # Version constant for the Adyen plugin.
13
13
  # DO NOT CHANGE THIS VALUE BY HAND. It will be updated automatically by
14
14
  # the gem:release rake task.
15
- VERSION = "1.0.0"
15
+ VERSION = "1.1.0"
16
16
 
17
17
  # @return [Configuration] The configuration singleton.
18
18
  def self.configuration
@@ -4,6 +4,7 @@ class Adyen::Configuration
4
4
  @default_api_params = {}
5
5
  @default_form_params = {}
6
6
  @form_skins = {}
7
+ @payment_flow = :select
7
8
  end
8
9
 
9
10
  # The Rails environment for which to use to Adyen "live" environment.
@@ -38,7 +39,17 @@ class Adyen::Configuration
38
39
 
39
40
  LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test'
40
41
  end
41
-
42
+
43
+ # The payment flow URL that’s used to choose the payement process
44
+ #
45
+ # @example
46
+ # Adyen.configuration.payment_flow = :select
47
+ # Adyen.configuration.payment_flow = :pay
48
+ # Adyen.configuration.payment_flow = :details
49
+ #
50
+ # @return [String]
51
+ attr_accessor :payment_flow
52
+
42
53
  # The username that’s used to authenticate for the Adyen SOAP services. It should look
43
54
  # something like ‘+ws@AndyInc.SuperShop+’
44
55
  #
@@ -28,8 +28,8 @@ module Adyen
28
28
  ######################################################
29
29
 
30
30
  # The URL of the Adyen payment system that still requires the current
31
- # Adyen enviroment to be filled in.
32
- ACTION_URL = "https://%s.adyen.com/hpp/select.shtml"
31
+ # Adyen enviroment and payment flow to be filled.
32
+ ACTION_URL = "https://%s.adyen.com/hpp/%s.shtml"
33
33
 
34
34
  # Returns the URL of the Adyen payment system, adjusted for an Adyen environment.
35
35
  #
@@ -39,9 +39,10 @@ module Adyen
39
39
  # for payment forms or redirects.
40
40
  # @see Adyen::Form.environment
41
41
  # @see Adyen::Form.redirect_url
42
- def url(environment = nil)
43
- environment ||= Adyen.configuration.environment
44
- Adyen::Form::ACTION_URL % environment.to_s
42
+ def url(environment = nil, payment_flow = nil)
43
+ environment ||= Adyen.configuration.environment
44
+ payment_flow ||= Adyen.configuration.payment_flow
45
+ Adyen::Form::ACTION_URL % [environment.to_s, payment_flow.to_s]
45
46
  end
46
47
 
47
48
  ######################################################
@@ -17,11 +17,11 @@ describe Adyen::Form do
17
17
  Adyen.configuration.environment = nil
18
18
  end
19
19
 
20
- it "should generate correct the testing url" do
20
+ it "should generate correct testing url" do
21
21
  Adyen::Form.url.should == 'https://test.adyen.com/hpp/select.shtml'
22
22
  end
23
23
 
24
- it "should generate a live url if the environemtn is set top live" do
24
+ it "should generate a live url if the environment is set to live" do
25
25
  Adyen.configuration.environment = :live
26
26
  Adyen::Form.url.should == 'https://live.adyen.com/hpp/select.shtml'
27
27
  end
@@ -34,6 +34,21 @@ describe Adyen::Form do
34
34
  it "should generate correct live url if explicitely asked for" do
35
35
  Adyen::Form.url(:live).should == 'https://live.adyen.com/hpp/select.shtml'
36
36
  end
37
+
38
+ it "should generate correct testing url if the payment flow selection is set to select" do
39
+ Adyen.configuration.payment_flow = :select
40
+ Adyen::Form.url.should == 'https://test.adyen.com/hpp/select.shtml'
41
+ end
42
+
43
+ it "should generate correct testing url if the payment flow selection is set to pay" do
44
+ Adyen.configuration.payment_flow = :pay
45
+ Adyen::Form.url.should == 'https://test.adyen.com/hpp/pay.shtml'
46
+ end
47
+
48
+ it "should generate correct testing url if the payment flow selection is set to details" do
49
+ Adyen.configuration.payment_flow = :details
50
+ Adyen::Form.url.should == 'https://test.adyen.com/hpp/details.shtml'
51
+ end
37
52
  end
38
53
 
39
54
  describe 'redirect signature check' do
@@ -153,4 +168,4 @@ describe Adyen::Form do
153
168
  signature.should == 'F2BQEYbE+EUhiRGuPtcD16Gm7JY='
154
169
  end
155
170
  end
156
- end
171
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adyen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
7
+ - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ version: 1.1.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Willem van Bergen
@@ -18,7 +17,7 @@ autorequire:
18
17
  bindir: bin
19
18
  cert_chain: []
20
19
 
21
- date: 2011-01-22 00:00:00 -05:00
20
+ date: 2011-03-21 00:00:00 -04:00
22
21
  default_executable:
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
@@ -29,7 +28,6 @@ dependencies:
29
28
  requirements:
30
29
  - - ">="
31
30
  - !ruby/object:Gem::Version
32
- hash: 3
33
31
  segments:
34
32
  - 0
35
33
  version: "0"
@@ -43,7 +41,6 @@ dependencies:
43
41
  requirements:
44
42
  - - ~>
45
43
  - !ruby/object:Gem::Version
46
- hash: 3
47
44
  segments:
48
45
  - 2
49
46
  - 0
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 3
62
58
  segments:
63
59
  - 0
64
60
  version: "0"
@@ -72,7 +68,6 @@ dependencies:
72
68
  requirements:
73
69
  - - ">="
74
70
  - !ruby/object:Gem::Version
75
- hash: 5
76
71
  segments:
77
72
  - 2
78
73
  - 3
@@ -152,7 +147,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
147
  requirements:
153
148
  - - ">="
154
149
  - !ruby/object:Gem::Version
155
- hash: 3
156
150
  segments:
157
151
  - 0
158
152
  version: "0"
@@ -161,7 +155,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
155
  requirements:
162
156
  - - ">="
163
157
  - !ruby/object:Gem::Version
164
- hash: 3
165
158
  segments:
166
159
  - 0
167
160
  version: "0"