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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omni_kassa (1.1.0)
4
+ omni_kassa (1.1.1)
5
5
  activesupport
6
6
  httparty
7
7
 
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
@@ -11,6 +11,8 @@ get '/:amount' do
11
11
  omnikassa.amount = params[:amount]
12
12
  omnikassa.normal_return_url = request.url
13
13
  omnikassa.automatic_response_url = request.url
14
+
15
+ puts omnikassa.query
14
16
  omnikassa.perform
15
17
  end
16
18
 
@@ -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
- def data
50
- data_hash.to_a.map {|a| a.join('=') }.join('|')
51
- end
49
+ def data
50
+ data_hash.to_a.map {|a| a.join('=') }.join('|')
51
+ end
52
52
 
53
- def data_hash
54
- REQUIRED.map do |attr|
55
- value = send attr
56
- raise RequestError, "attribute '#{attr}' missing" if value.nil?
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
- [attr.to_s.camelcase(:lower), value]
59
- end
58
+ [attr.to_s.camelcase(:lower), value]
60
59
  end
60
+ end
61
61
 
62
- def seal
63
- Digest::SHA2.new.update data + OmniKassa.secret_key
64
- end
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
@@ -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
- def parse_data_hash
43
- data_hash.each do |key, value|
44
- key = key.underscore + '='
45
- send key, value if respond_to? key
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
- def data_hash
50
- Hash[data.split('|').map {|a| a.split('=') }]
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'omni_kassa'
3
- s.version = '1.1.0'
3
+ s.version = '1.1.1'
4
4
  s.author = 'Pepijn Looije'
5
5
  s.email = 'pepijn@plict.nl'
6
6
  s.description = s.summary = 'Easier Rabobank OmniKassa payments'
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.0
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