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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d546a263a0eaf9f3f1e4590da333f59b6ef21d33
4
- data.tar.gz: 22e0417674cdffaeb25df9ab428020d07c2f9ac1
3
+ metadata.gz: 80f9c48b4c414542401fe6ed235bffe8c24fd80a
4
+ data.tar.gz: 0230889fe5e5eb16b080b58b108df08d9354aafe
5
5
  SHA512:
6
- metadata.gz: 65e40c69268b321de284d12b0273b5f50e996484cb22c9f9b37f1d304244ef95920de2d4f6f88d3f120cc646e195a4396ca57c9dc8a5826fb4e2a671251fe9ae
7
- data.tar.gz: 105c0fe86f25770cb6a33fd63c7e2b7d6b0932536238c4fe2e859e80dfc9ce1ba9463ad4114a8fb0fd090fe6136e72be835b9b5aea9e3d0f092c79e24686a293
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.2.0)
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.11)
12
- i18n (~> 0.6)
11
+ activesupport (3.2.13)
12
+ i18n (= 0.6.1)
13
13
  multi_json (~> 1.0)
14
- httparty (0.10.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.5.0)
20
- multi_xml (0.5.2)
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 Version](https://badge.fury.io/rb/omni_kassa.png)][gem]
3
3
  [![Build Status](https://secure.travis-ci.org/pepijn/omni_kassa.png?branch=master)](https://travis-ci.org/pepijn/omni_kassa)
4
4
  [![Dependency Status](https://gemnasium.com/pepijn/omni_kassa.png)](https://gemnasium.com/pepijn/omni_kassa)
5
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/pepijn/omni_kassa)
5
+ [![Code Climate](https://codeclimate.com/github/pepijn/omni_kassa.png)](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
 
@@ -31,6 +31,7 @@ module OmniKassa
31
31
  end
32
32
 
33
33
  def perform
34
+ # SSLv3 is a TravisCI requirement; won't run otherwise
34
35
  HTTParty.post(OmniKassa.url, query: query, ssl_version: :SSLv3).body
35
36
  end
36
37
 
@@ -2,8 +2,10 @@ module OmniKassa
2
2
  class Response
3
3
  RESPONSE_CODES = {
4
4
  0 => :success,
5
- 17 => :user_cancellation,
6
- 97 => :request_timeout
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] or :unknown_failure
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'omni_kassa'
3
- s.version = '1.2.1'
3
+ s.version = '1.3.0'
4
4
  s.author = 'Pepijn Looije'
5
5
  s.email = 'pepijn@plict.nl'
6
6
  s.description = s.summary = 'Easier Rabobank OmniKassa payments'
@@ -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 :user_cancellation, @response.response
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 :request_timeout, @response.response
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.2.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-05-09 00:00:00.000000000 Z
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