omni_kassa 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+ gemspec
3
+
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omni_kassa (0.1.0)
5
+ activesupport
6
+ httparty
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ activesupport (3.2.9)
12
+ i18n (~> 0.6)
13
+ multi_json (~> 1.0)
14
+ httparty (0.9.0)
15
+ multi_json (~> 1.0)
16
+ multi_xml
17
+ i18n (0.6.1)
18
+ minitest (4.3.2)
19
+ multi_json (1.4.0)
20
+ multi_xml (0.5.1)
21
+ rack (1.4.1)
22
+ rack-protection (1.2.0)
23
+ rack
24
+ rack-test (0.6.2)
25
+ rack (>= 1.0)
26
+ rake (10.0.2)
27
+ sinatra (1.3.3)
28
+ rack (~> 1.3, >= 1.3.6)
29
+ rack-protection (~> 1.2)
30
+ tilt (~> 1.3, >= 1.3.3)
31
+ tilt (1.3.3)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ minitest
38
+ omni_kassa!
39
+ rack-test
40
+ rake
41
+ sinatra
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ OmniKassa [![Build Status](https://secure.travis-ci.org/pepijn/omni_kassa.png?branch=master)](https://travis-ci.org/pepijn/omni_kassa) [![Dependency Status](https://gemnasium.com/pepijn/omni_kassa.png)](https://gemnasium.com/pepijn/omni_kassa)
2
+ =========
3
+
4
+ Easier Rabobank OmniKassa payments. Extracted from www.studysquare.nl.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Supports Ruby 1.9.2, 1.9.3 and 2.0.0. Add to your Gemfile:
10
+
11
+ ```ruby
12
+ gem 'omni_kassa'
13
+ ```
14
+
15
+ Run `bundle` and add your personal configuration. The example below is the official test configuration.
16
+
17
+ ```ruby
18
+ OmniKassa.config(
19
+ secret_key: '002020000000001_KEY1',
20
+ merchant_id: '002020000000001',
21
+ currency_code: 978, # Euro
22
+ url: 'https://payment-webinit.simu.omnikassa.rabobank.nl/paymentServlet',
23
+ transaction_reference: lambda {|order_id| "omnikassatest#{Time.now.to_i}" }
24
+ )
25
+ ```
26
+
27
+ Using Rails? Use different OmniKassa configurations by adding them in their respective `config/environments/{development,test,production}.rb` environment configuration files.
28
+
29
+ Usage
30
+ -----
31
+
32
+ ### Request
33
+
34
+ The example below uses an `OrdersController#create` action to create an order from `params[:order]` and sets up the OmniKassa request.
35
+
36
+ ```ruby
37
+ class OrdersController
38
+ def create
39
+ # Save order in database
40
+ @order = Order.create(params[:order])
41
+
42
+ # OmniKassa preparation
43
+ omnikassa = OmniKassa::Request.new
44
+ omnikassa.order_id = @order.id
45
+ omnikassa.amount = @order.amount
46
+ omnikassa.normal_return_url = payments_url
47
+
48
+ # Redirects user to OmniKassa
49
+ render text: omnikassa.perform
50
+ end
51
+ end
52
+ ```
53
+
54
+ ### Response
55
+
56
+ ```ruby
57
+ class PaymentsController
58
+ def create
59
+ response = OmniKassa::Response.new(params)
60
+
61
+ @order = Order.find(response.order_id)
62
+
63
+ if response.successful?
64
+ @order.payed = true
65
+ @order.save
66
+
67
+ redirect_to root_url, success: "Payment succeeded"
68
+ else
69
+ redirect_to root_url, alert: "Payment failed"
70
+ end
71
+ end
72
+ end
73
+ ```
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/setup'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ task default: :test
6
+
7
+ Rake::TestTask.new do |t|
8
+ t.libs << 'test/lib'
9
+ t.pattern = 'test/*_test.rb'
10
+ end
11
+
data/app.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'omni_kassa'
2
+ require './test_settings'
3
+
4
+ get '/' do
5
+ redirect '1337'
6
+ end
7
+
8
+ get '/:amount' do
9
+ omnikassa = OmniKassa::Request.new
10
+ omnikassa.order_id = rand(1337)
11
+ omnikassa.amount = params[:amount]
12
+ omnikassa.normal_return_url = request.url
13
+ omnikassa.perform
14
+ end
15
+
16
+ post '/:amount' do
17
+ omnikassa = OmniKassa::Response.new(params)
18
+ puts omnikassa.inspect
19
+
20
+ omnikassa.response.to_s
21
+ end
22
+
data/config.ru ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/setup'
2
+ require 'sinatra'
3
+
4
+ require './app'
5
+ run Sinatra::Application
6
+
data/doc/Gemfile.html ADDED
@@ -0,0 +1,110 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: Gemfile [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
45
+
46
+ </ul>
47
+ </div>
48
+
49
+
50
+ <div id="classindex-section" class="section project-section">
51
+ <h3 class="section-header">Class Index
52
+ <span class="search-toggle"><img src="./images/find.png"
53
+ height="16" width="16" alt="[+]"
54
+ title="show/hide quicksearch" /></span></h3>
55
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
56
+ <fieldset>
57
+ <legend>Quicksearch</legend>
58
+ <input type="text" name="quicksearch" value=""
59
+ class="quicksearch-field" />
60
+ </fieldset>
61
+ </form>
62
+
63
+ <ul class="link-list">
64
+
65
+ <li><a href="./OmniKassa.html">OmniKassa</a></li>
66
+
67
+ <li><a href="./OmniKassa/ConfigError.html">OmniKassa::ConfigError</a></li>
68
+
69
+ <li><a href="./OmniKassa/OmniKassaError.html">OmniKassa::OmniKassaError</a></li>
70
+
71
+ <li><a href="./OmniKassa/Request.html">OmniKassa::Request</a></li>
72
+
73
+ <li><a href="./OmniKassa/Request/RequestError.html">OmniKassa::Request::RequestError</a></li>
74
+
75
+ <li><a href="./OmniKassa/Response.html">OmniKassa::Response</a></li>
76
+
77
+ <li><a href="./OmniKassa/Response/ResponseCodeError.html">OmniKassa::Response::ResponseCodeError</a></li>
78
+
79
+ <li><a href="./OmniKassa/Response/SealMismatchError.html">OmniKassa::Response::SealMismatchError</a></li>
80
+
81
+ <li><a href="./HelloWorldTest.html">HelloWorldTest</a></li>
82
+
83
+ </ul>
84
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
85
+ </div>
86
+
87
+
88
+ </div>
89
+ </div>
90
+
91
+ <div id="documentation">
92
+ <p>
93
+ source :rubygems
94
+ </p>
95
+ <p>
96
+ gem &#8216;poltergeist&#8217;, git: &#8216;<a
97
+ href="https://github.com/jonleighton/poltergeist">github.com/jonleighton/poltergeist</a>&#8217;
98
+ gemspec
99
+ </p>
100
+
101
+ </div>
102
+
103
+ <div id="validator-badges">
104
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
106
+ Rdoc Generator</a> 1.1.6</small>.</p>
107
+ </div>
108
+ </body>
109
+ </html>
110
+
@@ -0,0 +1,268 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
+
8
+ <title>Class: HelloWorldTest</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript"
13
+ charset="utf-8"></script>
14
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
15
+ charset="utf-8"></script>
16
+ <script src="./js/quicksearch.js" type="text/javascript"
17
+ charset="utf-8"></script>
18
+ <script src="./js/darkfish.js" type="text/javascript"
19
+ charset="utf-8"></script>
20
+
21
+ </head>
22
+ <body class="class">
23
+
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="file-metadata">
36
+ <div id="file-list-section" class="section">
37
+ <h3 class="section-header">In Files</h3>
38
+ <div class="section-body">
39
+ <ul>
40
+
41
+ <li><a href="./test/omni_kassa_test_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="test/omni_kassa_test.rb">test/omni_kassa_test.rb</a></li>
43
+
44
+ </ul>
45
+ </div>
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div id="class-metadata">
52
+
53
+ <!-- Parent Class -->
54
+
55
+ <div id="parent-class-section" class="section">
56
+ <h3 class="section-header">Parent</h3>
57
+
58
+ <p class="link">MiniTest::Unit::TestCase</p>
59
+
60
+ </div>
61
+
62
+
63
+ <!-- Namespace Contents -->
64
+
65
+
66
+ <!-- Method Quickref -->
67
+
68
+ <div id="method-list-section" class="section">
69
+ <h3 class="section-header">Methods</h3>
70
+ <ul class="link-list">
71
+
72
+ <li><a href="#method-i-setup">#setup</a></li>
73
+
74
+ <li><a href="#method-i-test_amount_1337">#test_amount_1337</a></li>
75
+
76
+ </ul>
77
+ </div>
78
+
79
+
80
+ <!-- Included Modules -->
81
+
82
+ <div id="includes-section" class="section">
83
+ <h3 class="section-header">Included Modules</h3>
84
+ <ul class="link-list">
85
+
86
+
87
+ <li><span class="include">Capybara::DSL</span></li>
88
+
89
+
90
+ </ul>
91
+ </div>
92
+
93
+ </div>
94
+
95
+ <div id="project-metadata">
96
+
97
+
98
+ <div id="fileindex-section" class="section project-section">
99
+ <h3 class="section-header">Files</h3>
100
+ <ul>
101
+
102
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
103
+
104
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
105
+
106
+ </ul>
107
+ </div>
108
+
109
+
110
+ <div id="classindex-section" class="section project-section">
111
+ <h3 class="section-header">Class Index
112
+ <span class="search-toggle"><img src="./images/find.png"
113
+ height="16" width="16" alt="[+]"
114
+ title="show/hide quicksearch" /></span></h3>
115
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
116
+ <fieldset>
117
+ <legend>Quicksearch</legend>
118
+ <input type="text" name="quicksearch" value=""
119
+ class="quicksearch-field" />
120
+ </fieldset>
121
+ </form>
122
+
123
+ <ul class="link-list">
124
+
125
+ <li><a href="./OmniKassa.html">OmniKassa</a></li>
126
+
127
+ <li><a href="./OmniKassa/ConfigError.html">OmniKassa::ConfigError</a></li>
128
+
129
+ <li><a href="./OmniKassa/OmniKassaError.html">OmniKassa::OmniKassaError</a></li>
130
+
131
+ <li><a href="./OmniKassa/Request.html">OmniKassa::Request</a></li>
132
+
133
+ <li><a href="./OmniKassa/Request/RequestError.html">OmniKassa::Request::RequestError</a></li>
134
+
135
+ <li><a href="./OmniKassa/Response.html">OmniKassa::Response</a></li>
136
+
137
+ <li><a href="./OmniKassa/Response/ResponseCodeError.html">OmniKassa::Response::ResponseCodeError</a></li>
138
+
139
+ <li><a href="./OmniKassa/Response/SealMismatchError.html">OmniKassa::Response::SealMismatchError</a></li>
140
+
141
+ <li><a href="./HelloWorldTest.html">HelloWorldTest</a></li>
142
+
143
+ </ul>
144
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
145
+ </div>
146
+
147
+
148
+ </div>
149
+ </div>
150
+
151
+ <div id="documentation">
152
+ <h1 class="class">HelloWorldTest</h1>
153
+
154
+ <div id="description">
155
+
156
+ </div>
157
+
158
+ <!-- Constants -->
159
+
160
+
161
+ <!-- Attributes -->
162
+
163
+
164
+ <!-- Methods -->
165
+
166
+ <div id="public-instance-method-details" class="method-section section">
167
+ <h3 class="section-header">Public Instance Methods</h3>
168
+
169
+
170
+ <div id="setup-method" class="method-detail ">
171
+ <a name="method-i-setup"></a>
172
+
173
+ <div class="method-heading">
174
+
175
+ <span class="method-name">setup</span><span
176
+ class="method-args">()</span>
177
+ <span class="method-click-advice">click to toggle source</span>
178
+
179
+ </div>
180
+
181
+ <div class="method-description">
182
+
183
+
184
+
185
+
186
+
187
+ <div class="method-source-code"
188
+ id="setup-source">
189
+ <pre>
190
+ <span class="ruby-comment cmt"># File test/omni_kassa_test.rb, line 8</span>
191
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
192
+ 9: <span class="ruby-constant">Capybara</span>.<span class="ruby-identifier">app</span> = <span class="ruby-constant">Sinatra</span><span class="ruby-operator">::</span><span class="ruby-constant">Application</span>.<span class="ruby-identifier">new</span>
193
+ 10: <span class="ruby-keyword kw">end</span></pre>
194
+ </div>
195
+
196
+ </div>
197
+
198
+
199
+
200
+
201
+ </div>
202
+
203
+
204
+ <div id="test-amount--method" class="method-detail ">
205
+ <a name="method-i-test_amount_1337"></a>
206
+
207
+ <div class="method-heading">
208
+
209
+ <span class="method-name">test_amount_1337</span><span
210
+ class="method-args">()</span>
211
+ <span class="method-click-advice">click to toggle source</span>
212
+
213
+ </div>
214
+
215
+ <div class="method-description">
216
+
217
+
218
+
219
+
220
+
221
+ <div class="method-source-code"
222
+ id="test-amount--source">
223
+ <pre>
224
+ <span class="ruby-comment cmt"># File test/omni_kassa_test.rb, line 12</span>
225
+ 12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_amount_1337</span>
226
+ 13: <span class="ruby-identifier">visit</span> <span class="ruby-value str">'/1337'</span>
227
+ 14: <span class="ruby-identifier">assert</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">has_content?</span> <span class="ruby-value str">&quot;13,37&quot;</span>
228
+ 15: <span class="ruby-identifier">find</span>(<span class="ruby-value">:xpath</span>, <span class="ruby-value str">'//div[@class=&quot;availablePaymentMeans&quot;]/div[2]/a'</span>).<span class="ruby-identifier">click</span>
229
+ 16: <span class="ruby-identifier">select</span> <span class="ruby-value str">'Issuer Simulation 0 : Short'</span>, <span class="ruby-identifier">from</span><span class="ruby-operator">:</span> <span class="ruby-value str">'issuerComponent'</span>
230
+ 17: <span class="ruby-identifier">click_on</span> <span class="ruby-value str">'Akkoord'</span>
231
+ 18: <span class="ruby-identifier">click_on</span> <span class="ruby-value str">'Confirm Transaction'</span>
232
+ 19: <span class="ruby-identifier">click_on</span> <span class="ruby-value str">'Verder'</span>
233
+ 20: <span class="ruby-identifier">click_on</span> <span class="ruby-value str">'Continue'</span>
234
+ 21:
235
+ 22: <span class="ruby-comment cmt"># FIXME: Annoying Firefox security warning</span>
236
+ 23: <span class="ruby-identifier">assert</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">has_content?</span> <span class="ruby-value str">'success'</span>
237
+ 24: <span class="ruby-keyword kw">end</span></pre>
238
+ </div>
239
+
240
+ </div>
241
+
242
+
243
+
244
+
245
+ </div>
246
+
247
+
248
+ </div>
249
+
250
+
251
+ </div>
252
+
253
+
254
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
255
+
256
+ <p>Disabled; run with --debug to generate this.</p>
257
+
258
+ </div>
259
+
260
+ <div id="validator-badges">
261
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
262
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
263
+ Rdoc Generator</a> 1.1.6</small>.</p>
264
+ </div>
265
+
266
+ </body>
267
+ </html>
268
+