omni_kassa 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/app.rb +2 -0
- data/lib/omni_kassa/request.rb +22 -22
- data/lib/omni_kassa/response.rb +13 -12
- data/omni_kassa-1.1.0.gem +0 -0
- data/omni_kassa.gemspec +1 -1
- metadata +2 -1
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
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) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/pepijn/omni_kassa)
|
2
2
|
=========
|
3
3
|
|
4
|
-
Easier Rabobank OmniKassa payments. Extracted from www.studysquare.nl.
|
4
|
+
Easier Rabobank OmniKassa payments. Extracted from www.studysquare.nl. [RDocs](http://rdoc.info/projects/pepijn/omni_kassa).
|
5
5
|
|
6
6
|
Installation
|
7
7
|
------------
|
@@ -20,7 +20,7 @@ OmniKassa.config(
|
|
20
20
|
merchant_id: '002020000000001',
|
21
21
|
currency_code: 978, # Euro
|
22
22
|
url: 'https://payment-webinit.simu.omnikassa.rabobank.nl/paymentServlet',
|
23
|
-
transaction_reference: lambda {|order_id| "omnikassatest#{Time.now.to_i}" }
|
23
|
+
transaction_reference: lambda { |order_id| "omnikassatest#{Time.now.to_i}" }
|
24
24
|
)
|
25
25
|
```
|
26
26
|
|
data/app.rb
CHANGED
data/lib/omni_kassa/request.rb
CHANGED
@@ -7,12 +7,11 @@ module OmniKassa
|
|
7
7
|
INTERFACE_VERSION = 'HP_1.0'
|
8
8
|
|
9
9
|
REQUIRED = :merchant_id, :currency_code, :transaction_reference,
|
10
|
-
:order_id, :amount, :normal_return_url, :key_version
|
11
|
-
|
12
|
-
attr_accessor :merchant_id, :currency_code, :transaction_reference,
|
13
10
|
:order_id, :amount, :normal_return_url, :key_version,
|
14
11
|
:automatic_response_url
|
15
12
|
|
13
|
+
attr_accessor *REQUIRED
|
14
|
+
|
16
15
|
def initialize
|
17
16
|
self.key_version = KEY_VERSION
|
18
17
|
|
@@ -37,31 +36,32 @@ module OmniKassa
|
|
37
36
|
@transaction_reference.call(order_id)
|
38
37
|
end
|
39
38
|
|
39
|
+
def query
|
40
|
+
{
|
41
|
+
InterfaceVersion: INTERFACE_VERSION,
|
42
|
+
Data: data,
|
43
|
+
Seal: seal
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
40
47
|
protected
|
41
|
-
def query
|
42
|
-
{
|
43
|
-
InterfaceVersion: INTERFACE_VERSION,
|
44
|
-
Data: data,
|
45
|
-
Seal: seal
|
46
|
-
}
|
47
|
-
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def data
|
50
|
+
data_hash.to_a.map {|a| a.join('=') }.join('|')
|
51
|
+
end
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
def data_hash
|
54
|
+
REQUIRED.map do |attr|
|
55
|
+
value = send attr
|
56
|
+
raise RequestError, "attribute '#{attr}' missing" if value.nil?
|
57
57
|
|
58
|
-
|
59
|
-
end
|
58
|
+
[attr.to_s.camelcase(:lower), value]
|
60
59
|
end
|
60
|
+
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
def seal
|
63
|
+
Digest::SHA2.new.update data + OmniKassa.secret_key
|
64
|
+
end
|
65
65
|
|
66
66
|
class RequestError < OmniKassaError; end
|
67
67
|
end
|
data/lib/omni_kassa/response.rb
CHANGED
@@ -34,21 +34,22 @@ module OmniKassa
|
|
34
34
|
end
|
35
35
|
|
36
36
|
protected
|
37
|
-
def verify_seal!
|
38
|
-
seal = Digest::SHA2.new.update(data + OmniKassa.secret_key)
|
39
|
-
raise SealMismatchError if seal != self.seal
|
40
|
-
end
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
38
|
+
def verify_seal!
|
39
|
+
seal = Digest::SHA2.new.update(data + OmniKassa.secret_key)
|
40
|
+
raise SealMismatchError if seal != self.seal
|
41
|
+
end
|
48
42
|
|
49
|
-
|
50
|
-
|
43
|
+
def parse_data_hash
|
44
|
+
data_hash.each do |key, value|
|
45
|
+
key = key.underscore + '='
|
46
|
+
send key, value if respond_to? key
|
51
47
|
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def data_hash
|
51
|
+
Hash[data.split('|').map {|a| a.split('=') }]
|
52
|
+
end
|
52
53
|
|
53
54
|
class SealMismatchError < OmniKassaError; end
|
54
55
|
class ResponseCodeError < OmniKassaError; end
|
Binary file
|
data/omni_kassa.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omni_kassa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- ./LICENSE
|
145
145
|
- ./omni_kassa-1.0.0.gem
|
146
146
|
- ./omni_kassa-1.0.1.gem
|
147
|
+
- ./omni_kassa-1.1.0.gem
|
147
148
|
- ./omni_kassa.gemspec
|
148
149
|
- ./Rakefile
|
149
150
|
- ./README.md
|