ipizza 2.2.1 → 2.2.2

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
  SHA256:
3
- metadata.gz: e9c5412ec33e90edd4a844538b824892cf5ba61bc0ce33c0a6fa6064f3cb34c5
4
- data.tar.gz: 4269a6f26b82a874d0bf8ed8b63ac6a1a848801da916302137e7f869eca310c9
3
+ metadata.gz: b51199bfdb214aa4b638a72b87308e7377749b8e08094b630f960ba2287a030f
4
+ data.tar.gz: 413c63448960f66ad1e5d740ef5cf2fbe3bbc96ae66258064ef793c345e3157d
5
5
  SHA512:
6
- metadata.gz: fdb522e4222a13436e0667c4e86265d807d9706805cdfba5d19d73e1cd1e95ed5767ca97c3156daba9136f93631ebbe77f6a3f3c7a708a2f3cd12c947e51d6fb
7
- data.tar.gz: 323684d2243fc17941728e7da668bf7059bec1e18bfbc6d88af048b5907a7fd465678209b6bd931eb8064619fbe4990ab503cc713201ce127a3c90c6a3948bd6
6
+ metadata.gz: 2fed4f773566efcadb0ad2a14fb370347381465553c3c691e1855905135a8165e8cfe00de5e61dc0f628a357b7ed101341e9a20577db27ff78bd5ed17340d3e1
7
+ data.tar.gz: 8fce210209665ae8b111da0c76ada6dcf25f25ee530ef15a36c5e3b0bd23ad208e6b35b3be390bee223672494e35cfcf333e9d1a705b1e0247f681c04e873931
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipizza (2.2.1)
4
+ ipizza (2.2.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.markdown CHANGED
@@ -52,8 +52,8 @@ At any time, configuration can be modified with `Ipizza::Config.configure` block
52
52
  login: dealer
53
53
  snd_id: dealer
54
54
  encoding: UTF-8
55
- sign_algorithm: sha256 # default is sha1
56
- verification_algorithm: sha256 # default is sha1
55
+ sign_algorithm: sha512 # default is sha1
56
+ verification_algorithm: sha512 # default is sha1
57
57
  vk_version: "009" # VK_VERSION. Default is "008"
58
58
 
59
59
  ## Payment requests
@@ -49,7 +49,13 @@ module Ipizza::Provider
49
49
  'VK_LANG' => self.class.lang
50
50
  }
51
51
 
52
- req.sign(self.class.file_key, self.class.key_secret, Ipizza::Request::PARAM_ORDER[service_no.to_s])
52
+ req.sign(
53
+ self.class.file_key,
54
+ self.class.key_secret,
55
+ Ipizza::Request::PARAM_ORDER[service_no.to_s],
56
+ Ipizza::Request::DEFAULT_MAC_PARAM,
57
+ self.class.sign_algorithm || Ipizza::Util::DEFAULT_HASH_ALGORITHM
58
+ )
53
59
  req
54
60
  end
55
61
 
@@ -89,7 +95,13 @@ module Ipizza::Provider
89
95
  'VK_LANG' => self.class.lang
90
96
  }
91
97
 
92
- req.sign(self.class.file_key, self.class.key_secret, Ipizza::Request::PARAM_ORDER[service_no.to_s])
98
+ req.sign(
99
+ self.class.file_key,
100
+ self.class.key_secret,
101
+ Ipizza::Request::PARAM_ORDER[service_no.to_s],
102
+ Ipizza::Request::DEFAULT_MAC_PARAM,
103
+ self.class.sign_algorithm || Ipizza::Util::DEFAULT_HASH_ALGORITHM
104
+ )
93
105
  req
94
106
  end
95
107
 
@@ -1,6 +1,8 @@
1
1
  module Ipizza
2
2
  class Request
3
3
 
4
+ DEFAULT_MAC_PARAM = 'VK_MAC'
5
+
4
6
  attr_accessor :extra_params
5
7
  attr_accessor :sign_params
6
8
  attr_accessor :service_url
@@ -12,9 +14,14 @@ module Ipizza
12
14
  '4012' => %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_NONCE VK_RETURN VK_DATETIME VK_RID)
13
15
  }
14
16
 
15
- def sign(privkey_path, privkey_secret, order, mac_param = 'VK_MAC')
16
- signature = Ipizza::Util.sign(privkey_path, privkey_secret, Ipizza::Util.mac_data_string(sign_params, order))
17
- self.sign_params[mac_param] = signature
17
+ def sign(privkey_path, privkey_secret, order, mac_param = nil, hash_algorithm = nil)
18
+ signature = Ipizza::Util.sign(
19
+ privkey_path,
20
+ privkey_secret,
21
+ Ipizza::Util.mac_data_string(sign_params, order),
22
+ hash_algorithm || Ipizza::Util::DEFAULT_HASH_ALGORITHM
23
+ )
24
+ self.sign_params[mac_param || DEFAULT_MAC_PARAM] = signature
18
25
  end
19
26
 
20
27
  def request_params
@@ -1,3 +1,3 @@
1
1
  module Ipizza
2
- VERSION = '2.2.1'
2
+ VERSION = '2.2.2'
3
3
  end
@@ -42,8 +42,8 @@ seb:
42
42
  encoding: UTF-8
43
43
  snd_id: sender
44
44
  vk_version: '009'
45
- sign_algorithm: 'sha256'
46
- verification_algorithm: 'sha256'
45
+ sign_algorithm: 'sha512'
46
+ verification_algorithm: 'sha512'
47
47
 
48
48
  luminor:
49
49
  service_url: https://banklink.luminor.ee/test
@@ -12,5 +12,5 @@ swedbank:
12
12
  seb:
13
13
  service_url: https://www.seb.ee/banklink
14
14
  vk_version: '009'
15
- sign_algorithm: 'sha256'
16
- verification_algorithm: 'sha1'
15
+ sign_algorithm: 'sha512'
16
+ verification_algorithm: 'sha512'
@@ -16,10 +16,9 @@ describe Ipizza::Config do
16
16
  Ipizza::Provider::Swedbank.encoding.should == 'UTF-8'
17
17
 
18
18
  Ipizza::Provider::Seb.service_url.should == 'https://www.seb.ee/banklink'
19
- Ipizza::Provider::Seb.sign_algorithm.should == 'sha256'
20
- Ipizza::Provider::Seb.verification_algorithm.should == 'sha1'
19
+ Ipizza::Provider::Seb.sign_algorithm.should == 'sha512'
20
+ Ipizza::Provider::Seb.verification_algorithm.should == 'sha512'
21
21
  Ipizza::Provider::Seb.vk_version.should == '009'
22
-
23
22
  end
24
23
 
25
24
  it 'should load certificates from path relative to configuration file' do
@@ -27,7 +27,12 @@ describe Ipizza::Provider::Seb do
27
27
  'VK_CANCEL' => Ipizza::Provider::Seb.cancel_url,
28
28
  'VK_DATETIME' => Ipizza::Util.time_to_iso8601(Time.now)
29
29
  }
30
- signature = Ipizza::Util.sign(Ipizza::Provider::Seb.file_key, Ipizza::Provider::Seb.key_secret, Ipizza::Util.mac_data_string(params, Ipizza::Request::PARAM_ORDER['1012']))
30
+ signature = Ipizza::Util.sign(
31
+ Ipizza::Provider::Seb.file_key,
32
+ Ipizza::Provider::Seb.key_secret,
33
+ Ipizza::Util.mac_data_string(params, Ipizza::Request::PARAM_ORDER['1012']),
34
+ Ipizza::Provider::Seb.sign_algorithm || Ipizza::Util::DEFAULT_HASH_ALGORITHM
35
+ )
31
36
  req.sign_params['VK_MAC'].should == signature
32
37
  end
33
38
  end
@@ -72,7 +77,12 @@ describe Ipizza::Provider::Seb do
72
77
  'VK_RID' => '',
73
78
  'VK_REPLY' => '3012'
74
79
  }
75
- signature = Ipizza::Util.sign(Ipizza::Provider::Seb.file_key, Ipizza::Provider::Seb.key_secret, Ipizza::Util.mac_data_string(params, Ipizza::Request::PARAM_ORDER['4011']))
80
+ signature = Ipizza::Util.sign(
81
+ Ipizza::Provider::Seb.file_key,
82
+ Ipizza::Provider::Seb.key_secret,
83
+ Ipizza::Util.mac_data_string(params, Ipizza::Request::PARAM_ORDER['4011']),
84
+ Ipizza::Provider::Seb.sign_algorithm || Ipizza::Util::DEFAULT_HASH_ALGORITHM
85
+ )
76
86
  req.sign_params['VK_MAC'].should == signature
77
87
  end
78
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipizza
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Priit Haamer