active_merchant_ideal 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,43 +1,188 @@
1
- h2. Active_merchant_ideal
1
+ h1. Active_merchant_ideal
2
2
 
3
- Download: http://github.com/dovadi/active_merchant_ideal or clone
3
+ h2. Description:
4
4
 
5
- * git clone git://github.com/dovadi/active_merchant_ideal.git
5
+ "iDEAL":http://www.ideal.nl payment gateway for "ActiveMerchant":http://www.activemerchant.org.
6
6
 
7
- h2. Description:
7
+ h2. What is iDEAL?
8
8
 
9
- iDEAL payment gateway for ActiveMerchant (see http://www.ideal.nl and http://www.activemerchant.org/).
9
+ iDEAL is a set of standards developed to facilitate online payments through the online banking applications that most Dutch banks provide.
10
10
 
11
- h2. History:
11
+ If a consumer already has online banking with ABN AMRO, Fortis, ING/Postbank, Rabobank, or SNS Bank, they can make payments using iDEAL in a way that they are already familiar with.
12
12
 
13
- In 2006 an iDEAL payment library was written in Ruby for a web shop build in Rails for selling mobile phone credits. It was basically a translation of the PHP example given by the iDEAL organization (see iDEAL Advanced Integration Manual PHP). Is was released as the ideal-on-rails library (see http://dev.dovadi.com/projects/ideal).
13
+ See "http://ideal.nl":http://ideal.nl and "http://idealdesk.com":http://idealdesk.com for more information.
14
14
 
15
- In 2007 this code was refactored as a patch for the ActiveMerchant library, this was mainly done by "Fingertips":http://www.fngtps.com/ for a client project. This patch was never accepted due to the fact it was too different (and maybe too obscure) from the 'normal' credit card gateways.
15
+ h2. Merchant account
16
16
 
17
- In 2009 Fingertips forked the ActiveMerchant library and added an iDEAL gateway (presumable based on the first ActiveMerchant patch) to a new ideal branch.
17
+ In order to use iDEAL you will need to get an iDEAL merchant account from your bank. Every bank offers ‘complete payment’ services, which can obfuscate the right choice. The payment product that you will want to get, in order to use this gateway class, is a bare bones iDEAL account.
18
18
 
19
- In 2010 this code was extracted and converted into a separate gem, so it can be more easily used in combination with the latest version of ActiveMerchant. This library is just an extraction, nothing more and nothing less. There are no fundamental changes between the code from the ideal branch and the code of this gem.
19
+ * ING/Postbank: iDEAL Advanced
20
+ * ABN AMRO: iDEAL Zelfbouw
21
+ * Fortis: ? (Unknown)
22
+ * Rabobank: Rabo iDEAL Professional. (Unverified)
23
+ * SNS Bank: "Not yet available":http://www.snsbank.nl/zakelijk/betalingsverkeer/kan-ik-ideal-gebruiken-voor-mijn-webwinkel.html
20
24
 
21
- h2. Install:
25
+ If you implement tests for other banks, if they require such acceptance tests, please do submit a patch or contact me directly: frank@dovadi.com.
26
+
27
+ h2. Install active_merchant_ideal:
22
28
 
23
- <pre>
24
29
  As a gem:
25
30
 
26
- * sudo gem install active_merchant_ideal
27
- * Add the following to your environment.rb:
31
+ <pre>
32
+ sudo gem install active_merchant_ideal
33
+ </pre>
34
+
35
+ Add the following to your environment.rb:
28
36
 
37
+ <pre>
29
38
  config.gem 'active_merchant_ideal'
39
+ </pre>
30
40
 
31
41
  As a plugin:
32
-
33
- * ./script/plugin install git://github.com/dovadi/active_merchant_ideal.git
42
+ <pre>
43
+ ./script/plugin install git://github.com/dovadi/active_merchant_ideal.git
34
44
  </pre>
35
45
 
46
+ h2. Generate private keys and certificates
47
+
48
+ Messages to, and from, the acquirer, are all signed in order to prove their authenticity. This means that you will have to have a certificate to sign your messages going to the acquirer _and_ you will need to have the certificate of the acquirer to verify its signed messages.
49
+
50
+ The latter can be downloaded from your acquirer after registration. The former, however, can be a certificate signed by a CA authority or a self-signed certificate.
51
+
52
+ To create a self-signed certificate follow these steps:
53
+
54
+ * /usr/bin/openssl genrsa -des3 -out private_key.pem -passout pass:the_passphrase 1024
55
+ * /usr/bin/openssl req -x509 -new -key private_key.pem -passin pass:the_passphrase -days 3650 -out private_certificate.cer
56
+
57
+ Substitute _the_passphrase__ with your own passphrase.
58
+
59
+ With the ING bank you upload your private certificate with your iDEAL Dashboard. Be aware that there are two dashboards, one "dashboard":https://idealtest.secure-ing.com/ideal/logon_ing.do for the test environment and one "dashboard":https://ideal.secure-ing.com/ideal/logon_ing.do for the production environment!
60
+
61
+ For more information see:
62
+ * "http://en.wikipedia.org/wiki/Certificate_authority":http://en.wikipedia.org/wiki/Certificate_authority
63
+ * "http://en.wikipedia.org/wiki/Self-signed_certificate":http://en.wikipedia.org/wiki/Self-signed_certificate
64
+
36
65
  h2. Test
37
66
 
38
- * You can run the tests from this gem with rake test.
39
- * For running the seven remote test transaction use rake test:remote
67
+ h3. Test the gem
68
+
69
+ You can run the tests from this gem with (inside the active_merchant_ideal directory):
70
+
71
+ <pre>
72
+ rake test
73
+ </pre>
74
+
75
+ h3. Run the remote tests
76
+
77
+ * Create .active_merchant directory in your own home directory
78
+ * Copy test/fixtures.yml to the .active_merchant directory
79
+ * Fill in your own merchant id, passphrase and the correct locations to your private key and certificates.
80
+ * For running the *seven prescribed remote test transactions* (ING bank) which are needed to activate the iDEAL account use
81
+
82
+ <pre>
83
+ rake test:remote
84
+ </pre>
85
+
86
+ h2. Example (Rails)
87
+
88
+ h3. First configure the gateway
89
+
90
+ Put the following code in, for instance, an initializer:
91
+
92
+ <pre>
93
+ IdealGateway.live_url = 'https://ideal.secure-ing.com:443/ideal/iDeal'
94
+ IdealGateway.merchant_id = '00123456789'
95
+ IdealGateway.passphrase = 'the_private_key_passphrase'
96
+
97
+ # CERTIFICATE_ROOT points to a directory where the key and certificates are located
98
+ IdealGateway.private_key_file = File.join(CERTIFICATE_ROOT, 'private_key.pem')
99
+ IdealGateway.private_certificate_file = File.join(CERTIFICATE_ROOT, 'private_certificate.cer')
100
+ IdealGateway.ideal_certificate_file = File.join(CERTIFICATE_ROOT, 'ideal.cer')
101
+ </pre>
102
+
103
+ h3. View
104
+
105
+ Give the consumer a list of available issuer options:
106
+
107
+ <pre>
108
+ gateway = ActiveMerchant::Billing::IdealGateway.new
109
+ issuers = gateway.issuers.list
110
+ sorted_issuers = issuers.sort_by { |issuer| issuer[:name] }
111
+ select('purchase', 'issuer_id', issuers.map { |issuer| [issuer[:name], issuer[:id]] })
112
+ </pre>
113
+
114
+ Could become:
115
+
116
+ <pre>
117
+ <select name="purchase[issuer_id]">
118
+ <option value="1006" selected="selected">ABN AMRO Bank</option>
119
+ <option value="1017">Asr bank</option>
120
+ <option value="1003">Postbank</option>
121
+ <option value="1005">Rabobank</option>
122
+ <option value="1023">Van Lanschot</option>
123
+ </select>
124
+ </pre>
125
+
126
+ h3. Controller
127
+
128
+ First you'll need to setup a transaction and redirect the consumer there so she can make the payment:
129
+
130
+ <pre>
131
+ class PurchasesController < ActionController::Base
132
+ def create
133
+ purchase = @user.purchases.build(:price => 1000) # €10.00 in cents.
134
+ purchase.save(false) # We want an id for the URL.
135
+
136
+ purchase_options = {
137
+ :issuer_id => params[:purchase][:issuer_id],
138
+ :order_id => purchase.id,
139
+ :return_url => purchase_url(purchase),
140
+ :description => 'A Dutch windmill'
141
+ }
142
+
143
+ # Save the purchase instance so that the consumer can return to its resource url to finish the transaction.
144
+ purchase.update_attributes!(purchase_options)
145
+
146
+ gateway = ActiveMerchant::Billing::IdealGateway.new
147
+ transaction_response = gateway.setup_purchase(purchase.price, purchase_options)
148
+ if transaction_response.success?
149
+
150
+ # Store the transaction_id that the acquirer has created to identify the transaction.
151
+ purchase.update_attributes!(:transaction_id => transaction_response.transaction_id)
152
+
153
+ # Redirect the consumer to the issuer’s payment page.
154
+ redirect_to transaction_response.service_url
155
+ end
156
+ end
157
+ end
158
+ </pre>
159
+
160
+ After the consumer is done with the payment she will be redirected to the _:return_url_. It's now _your_ responsibility as merchant to check if the payment has been made:
161
+
162
+ <pre>
163
+ class PurchasesController < ActionController::Base
164
+ def show
165
+ gateway = ActiveMerchant::Billing::IdealGateway.new
166
+ transaction_status = gateway.capture(@purchase.transaction_id)
167
+
168
+ if transaction_status.success?
169
+ @purchase.update_attributes!(:paid => true)
170
+ flash[:notice] = "Congratulations, you are now the proud owner of a Dutch windmill!"
171
+ end
172
+ end
173
+ end
174
+ </pre>
175
+
176
+ h2. History
177
+
178
+ In 2006 an iDEAL payment library was written in Ruby for a web shop build in Rails for selling mobile phone credits. It was basically a translation of the PHP example given by the iDEAL organization (see iDEAL Advanced Integration Manual PHP). Is was released as the ideal-on-rails library (see "http://dev.dovadi.com/projects/ideal":http://dev.dovadi.com/projects/ideal).
179
+
180
+ In 2007 this code was refactored as a patch for the ActiveMerchant library, this was mainly done by "Fingertips":http://www.fngtps.com/ for a client project. This patch was never accepted due to the fact it was too different (and maybe too obscure) from the 'normal' credit card gateways.
181
+
182
+ In 2009 Fingertips forked the ActiveMerchant library and added an iDEAL gateway (presumable based on the first ActiveMerchant patch) to a new ideal branch.
183
+
184
+ In 2010 this code was extracted and converted into a separate gem, so it can be more easily used in combination with the latest version of ActiveMerchant. This library is just an extraction, nothing more and nothing less. There are no fundamental changes between the code from the ideal branch and the code of this gem.
40
185
 
41
- h2. Credits
186
+ h2. Maintainer
42
187
 
43
188
  This gem is maintained by "Agile Dovadi BV":http://dovadi.com, contact "Frank Oxener":mailto:frank@dovadi.com
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_merchant_ideal}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Soemirno Kartosoewito, Matthijs Kadijk, Aloy Duran, Frank Oxener"]
@@ -5,145 +5,6 @@ require 'digest/sha1'
5
5
 
6
6
  module ActiveMerchant #:nodoc:
7
7
  module Billing #:nodoc:
8
- # == iDEAL
9
- #
10
- # iDEAL is a set of standards developed to facilitate online payments
11
- # through the online banking applications that most Dutch banks provide.
12
- #
13
- # If a consumer already has online banking with ABN AMRO, Fortis,
14
- # ING/Postbank, Rabobank, or SNS Bank, they can make payments using iDEAL in
15
- # a way that they are already familiar with.
16
- #
17
- # See http://ideal.nl and http://idealdesk.com for more information.
18
- #
19
- # ==== Merchant account
20
- #
21
- # In order to use iDEAL you will need to get an iDEAL merchant account from
22
- # your bank. Every bank offers ‘complete payment’ services, which can
23
- # obfuscate the right choice. The payment product that you will want to
24
- # get, in order to use this gateway class, is a bare bones iDEAL account.
25
- #
26
- # * ING/Postbank: iDEAL Advanced
27
- # * ABN AMRO: iDEAL Zelfbouw
28
- # * Fortis: ? (Unknown)
29
- # * Rabobank: Rabo iDEAL Professional. (Unverified)
30
- # * SNS Bank: Not yet available. (http://www.snsbank.nl/zakelijk/betalingsverkeer/kan-ik-ideal-gebruiken-voor-mijn-webwinkel.html)
31
- #
32
- # At least the ING bank requires you to perform 7 remote tests which have
33
- # to pass before you will get access to the live environment. These tests
34
- # have been implemented in the remote tests. Running these should be enough:
35
- #
36
- # test/remote/remote_ideal_test.rb
37
- #
38
- # If you implement tests for other banks, if they require such acceptance
39
- # tests, please do submit a patch or contact me directly: frank@dovadi.com.
40
- #
41
- # ==== Private keys, certificates and all that jazz
42
- #
43
- # Messages to, and from, the acquirer, are all signed in order to prove
44
- # their authenticity. This means that you will have to have a certificate
45
- # to sign your messages going to the acquirer _and_ you will need to have
46
- # the certificate of the acquirer to verify its signed messages.
47
- #
48
- # The latter can be downloaded from your acquirer after registration.
49
- # The former, however, can be a certificate signed by a CA authority or a
50
- # self-signed certificate.
51
- #
52
- # To create a self-signed certificate follow these steps:
53
- #
54
- # $ /usr/bin/openssl genrsa -des3 -out private_key.pem -passout pass:the_passphrase 1024
55
- # $ /usr/bin/openssl req -x509 -new -key private_key.pem -passin pass:the_passphrase -days 3650 -out private_certificate.cer
56
- #
57
- # Substitute <tt>the_passphrase</tt> with your own passphrase.
58
- #
59
- # For more information see:
60
- # * http://en.wikipedia.org/wiki/Certificate_authority
61
- # * http://en.wikipedia.org/wiki/Self-signed_certificate
62
- #
63
- # === Example (Rails)
64
- #
65
- # ==== First configure the gateway
66
- #
67
- # Put the following code in, for instance, an initializer:
68
- #
69
- # IdealGateway.live_url = 'https://ideal.secure-ing.com:443/ideal/iDeal'
70
- #
71
- # IdealGateway.merchant_id = '00123456789'
72
- #
73
- # # CERTIFICATE_ROOT points to a directory where the key and certificates are located.
74
- # IdealGateway.passphrase = 'the_private_key_passphrase'
75
- # IdealGateway.private_key_file = File.join(CERTIFICATE_ROOT, 'private_key.pem')
76
- # IdealGateway.private_certificate_file = File.join(CERTIFICATE_ROOT, 'private_certificate.cer')
77
- # IdealGateway.ideal_certificate_file = File.join(CERTIFICATE_ROOT, 'ideal.cer')
78
- #
79
- # ==== View
80
- #
81
- # Give the consumer a list of available issuer options:
82
- #
83
- # gateway = ActiveMerchant::Billing::IdealGateway.new
84
- # issuers = gateway.issuers.list
85
- # sorted_issuers = issuers.sort_by { |issuer| issuer[:name] }
86
- # select('purchase', 'issuer_id', issuers.map { |issuer| [issuer[:name], issuer[:id]] })
87
- #
88
- # Could become:
89
- #
90
- # <select name="purchase[issuer_id]">
91
- # <option value="1006" selected="selected">ABN AMRO Bank</option>
92
- # <option value="1017">Asr bank</option>
93
- # <option value="1003">Postbank</option>
94
- # <option value="1005">Rabobank</option>
95
- # <option value="1023">Van Lanschot</option>
96
- # </select>
97
- #
98
- # ==== Controller
99
- #
100
- # First you'll need to setup a transaction and redirect the consumer there
101
- # so she can make the payment:
102
- #
103
- # class PurchasesController < ActionController::Base
104
- # def create
105
- # purchase = @user.purchases.build(:price => 1000) # €10.00 in cents.
106
- # purchase.save(false) # We want an id for the URL.
107
- #
108
- # purchase_options = {
109
- # :issuer_id => params[:purchase][:issuer_id],
110
- # :order_id => purchase.id,
111
- # :return_url => purchase_url(purchase),
112
- # :description => 'A Dutch windmill'
113
- # }
114
- #
115
- # # Save the purchase instance so that the consumer can return to its resource url to finish the transaction.
116
- # purchase.update_attributes!(purchase_options)
117
- #
118
- # gateway = ActiveMerchant::Billing::IdealGateway.new
119
- # transaction_response = gateway.setup_purchase(purchase.price, purchase_options)
120
- # if transaction_response.success?
121
- #
122
- # # Store the transaction_id that the acquirer has created to identify the transaction.
123
- # purchase.update_attributes!(:transaction_id => transaction_response.transaction_id)
124
- #
125
- # # Redirect the consumer to the issuer’s payment page.
126
- # redirect_to transaction_response.service_url
127
- # end
128
- # end
129
- # end
130
- #
131
- # After the consumer is done with the payment she will be redirected to the
132
- # <tt>:return_url</tt>. It's now _your_ responsibility as merchant to check
133
- # if the payment has been made:
134
- #
135
- # class PurchasesController < ActionController::Base
136
- # def show
137
- # gateway = ActiveMerchant::Billing::IdealGateway.new
138
- # transaction_status = gateway.capture(@purchase.transaction_id)
139
- #
140
- # if transaction_status.success?
141
- # @purchase.update_attributes!(:paid => true)
142
- # flash[:notice] = "Congratulations, you are now the proud owner of a Dutch windmill!"
143
- # end
144
- # end
145
- # end
146
- #
147
8
  # === Response classes
148
9
  #
149
10
  # * IdealResponse
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Soemirno Kartosoewito, Matthijs Kadijk, Aloy Duran, Frank Oxener