omni_kassa 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/README.md +1 -1
- data/lib/omni_kassa/request.rb +1 -0
- data/lib/omni_kassa/response.rb +10 -4
- data/omni_kassa-1.2.1.gem +0 -0
- data/omni_kassa.gemspec +1 -1
- data/test/response_test.rb +28 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f9c48b4c414542401fe6ed235bffe8c24fd80a
|
4
|
+
data.tar.gz: 0230889fe5e5eb16b080b58b108df08d9354aafe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6057c969480ae4b1ff986ceaf7a39bd24a5e05756bb128c8a6362576ad240d3ba820d2be91e2d0c8404056d6d049426d05172cb25424df48b08584b9481f4908
|
7
|
+
data.tar.gz: e3821b5f57be3ef3540c5207c0c5a4b0e5823ec456d7aac38bd5cb0f571ad65164d708e766f97bdff7efa7b98100712125d909ea68993714315728f922073925
|
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omni_kassa (1.
|
4
|
+
omni_kassa (1.3.0)
|
5
5
|
activesupport
|
6
6
|
httparty
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (3.2.
|
12
|
-
i18n (
|
11
|
+
activesupport (3.2.13)
|
12
|
+
i18n (= 0.6.1)
|
13
13
|
multi_json (~> 1.0)
|
14
|
-
httparty (0.
|
14
|
+
httparty (0.11.0)
|
15
15
|
multi_json (~> 1.0)
|
16
|
-
multi_xml
|
16
|
+
multi_xml (>= 0.5.2)
|
17
17
|
i18n (0.6.1)
|
18
18
|
minitest (4.4.0)
|
19
|
-
multi_json (1.
|
20
|
-
multi_xml (0.5.
|
19
|
+
multi_json (1.7.7)
|
20
|
+
multi_xml (0.5.4)
|
21
21
|
rack (1.4.3)
|
22
22
|
rack-protection (1.3.2)
|
23
23
|
rack
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[][gem]
|
3
3
|
[](https://travis-ci.org/pepijn/omni_kassa)
|
4
4
|
[](https://gemnasium.com/pepijn/omni_kassa)
|
5
|
-
[](https://codeclimate.com/github/pepijn/omni_kassa)
|
6
6
|
|
7
7
|
Easier Rabobank OmniKassa payments. Extracted from www.studysquare.nl. [RDocs](http://rdoc.info/projects/pepijn/omni_kassa).
|
8
8
|
|
data/lib/omni_kassa/request.rb
CHANGED
data/lib/omni_kassa/response.rb
CHANGED
@@ -2,8 +2,10 @@ module OmniKassa
|
|
2
2
|
class Response
|
3
3
|
RESPONSE_CODES = {
|
4
4
|
0 => :success,
|
5
|
-
17 => :
|
6
|
-
|
5
|
+
17 => :cancelled,
|
6
|
+
60 => :pending,
|
7
|
+
90 => :pending,
|
8
|
+
97 => :expired
|
7
9
|
}
|
8
10
|
|
9
11
|
attr_accessor :data, :seal, :order_id, :response_code, :amount
|
@@ -15,12 +17,16 @@ module OmniKassa
|
|
15
17
|
verify_seal!
|
16
18
|
end
|
17
19
|
|
20
|
+
def pending?
|
21
|
+
response == :pending
|
22
|
+
end
|
23
|
+
|
18
24
|
def successful?
|
19
25
|
response == :success
|
20
26
|
end
|
21
27
|
|
22
28
|
def response
|
23
|
-
RESPONSE_CODES[response_code]
|
29
|
+
RESPONSE_CODES[response_code] || :unknown_failure
|
24
30
|
end
|
25
31
|
|
26
32
|
def data=(data)
|
@@ -48,7 +54,7 @@ module OmniKassa
|
|
48
54
|
end
|
49
55
|
|
50
56
|
def data_hash
|
51
|
-
Hash[data.split('|').map {|a| a.split('=') }]
|
57
|
+
Hash[data.split('|').map { |a| a.split('=') }]
|
52
58
|
end
|
53
59
|
|
54
60
|
class SealMismatchError < OmniKassaError; end
|
Binary file
|
data/omni_kassa.gemspec
CHANGED
data/test/response_test.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'omni_kassa/test_helper'
|
2
2
|
|
3
|
+
RESPONSE_PARAMS = {
|
4
|
+
Data: "amount=1337|captureDay=0|captureMode=AUTHOR_CAPTURE|currencyCode=978|merchantId=002020000000001|orderId=527|transactionDateTime=2012-12-02T21:41:01+01:00|transactionReference=omnikassatest1354480861|keyVersion=1|authorisationId=0020000006791167|paymentMeanBrand=IDEAL|paymentMeanType=CREDIT_TRANSFER|responseCode=00",
|
5
|
+
InterfaceVersion: "HP_1.0",
|
6
|
+
Encode: '',
|
7
|
+
Seal: '46204f0e97394293c9270b6313e78524027acba1f83d4ce9682848e1f5927ab3'
|
8
|
+
}
|
9
|
+
|
3
10
|
class ResponseTest < MiniTest::Unit::TestCase
|
4
11
|
def setup
|
5
|
-
@params =
|
6
|
-
Data: "amount=1337|captureDay=0|captureMode=AUTHOR_CAPTURE|currencyCode=978|merchantId=002020000000001|orderId=527|transactionDateTime=2012-12-02T21:41:01+01:00|transactionReference=omnikassatest1354480861|keyVersion=1|authorisationId=0020000006791167|paymentMeanBrand=IDEAL|paymentMeanType=CREDIT_TRANSFER|responseCode=00",
|
7
|
-
InterfaceVersion: "HP_1.0",
|
8
|
-
Encode: '',
|
9
|
-
Seal: '46204f0e97394293c9270b6313e78524027acba1f83d4ce9682848e1f5927ab3'
|
10
|
-
}
|
11
|
-
|
12
|
+
@params = RESPONSE_PARAMS.clone
|
12
13
|
@response = OmniKassa::Response.new(@params)
|
13
14
|
end
|
14
15
|
|
@@ -19,15 +20,33 @@ class ResponseTest < MiniTest::Unit::TestCase
|
|
19
20
|
|
20
21
|
def test_responses
|
21
22
|
assert_equal :success, @response.response
|
23
|
+
refute @response.pending?
|
24
|
+
assert @response.successful?
|
22
25
|
|
23
26
|
@response.response_code = 17
|
24
|
-
assert_equal :
|
27
|
+
assert_equal :cancelled, @response.response
|
28
|
+
refute @response.pending?
|
29
|
+
refute @response.successful?
|
30
|
+
|
31
|
+
@response.response_code = 60
|
32
|
+
assert_equal :pending, @response.response
|
33
|
+
assert @response.pending?
|
34
|
+
refute @response.successful?
|
35
|
+
|
36
|
+
@response.response_code = 90
|
37
|
+
assert_equal :pending, @response.response
|
38
|
+
assert @response.pending?
|
39
|
+
refute @response.successful?
|
25
40
|
|
26
41
|
@response.response_code = 97
|
27
|
-
assert_equal :
|
42
|
+
assert_equal :expired, @response.response
|
43
|
+
refute @response.pending?
|
44
|
+
refute @response.successful?
|
28
45
|
|
29
46
|
@response.response_code = 1 # not 0
|
30
47
|
assert_equal :unknown_failure, @response.response
|
48
|
+
refute @response.pending?
|
49
|
+
refute @response.successful?
|
31
50
|
end
|
32
51
|
|
33
52
|
def test_invalid_seal
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omni_kassa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pepijn Looije
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- ./lib/omni_kassa/response.rb
|
109
109
|
- ./lib/omni_kassa.rb
|
110
110
|
- ./LICENSE
|
111
|
+
- ./omni_kassa-1.2.1.gem
|
111
112
|
- ./omni_kassa.gemspec
|
112
113
|
- ./Rakefile
|
113
114
|
- ./README.md
|