ipizza 2.2.0 → 2.2.1

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: 5ed9393a3cf761d93af6cacfe5ab9f5290bd9f9fa07df805eba6e8923c302b80
4
- data.tar.gz: 8543fd69e9b7c1c523bdbed2f20ac511b8fef3f3661987d4a960c27df9827bab
3
+ metadata.gz: e9c5412ec33e90edd4a844538b824892cf5ba61bc0ce33c0a6fa6064f3cb34c5
4
+ data.tar.gz: 4269a6f26b82a874d0bf8ed8b63ac6a1a848801da916302137e7f869eca310c9
5
5
  SHA512:
6
- metadata.gz: 9172fb1cbe9b620439a73b41b12d53f0e6bfd5f4ce2d219f0398ab6c4136716200463885ba692cf34b70675e4151f3536398c10a4bf59e9817b09f2c3b52eb69
7
- data.tar.gz: 01010f397f8c724adcf89e9db463f7ba6ba9277501ef243957e58b8a7e2eb863c840d9a533e921ec4f953dd10d76479676b0ade0b7bf24da69891bc8fc6cfd7e
6
+ metadata.gz: fdb522e4222a13436e0667c4e86265d807d9706805cdfba5d19d73e1cd1e95ed5767ca97c3156daba9136f93631ebbe77f6a3f3c7a708a2f3cd12c947e51d6fb
7
+ data.tar.gz: 323684d2243fc17941728e7da668bf7059bec1e18bfbc6d88af048b5907a7fd465678209b6bd931eb8064619fbe4990ab503cc713201ce127a3c90c6a3948bd6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipizza (2.2.0)
4
+ ipizza (2.2.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.markdown CHANGED
@@ -1,6 +1,6 @@
1
1
  Implements iPizza protocol to communicate with Estonian Banks.
2
2
 
3
- Gem implements support for iPizza services (`1011`, `1012`, `4011` and `4012`) that are supported by members of the Estonian Banking Association [since October 2014](http://pangaliit.ee/et/arveldused/pangalingi-spetsifikatsioon).
3
+ Gem implements support for iPizza services (`1011`, `1012`, `4011` and `4012`) that are supported by members of the Estonian Banking Association [since October 2014](https://pangaliit.ee/arveldused/pangalingi-spetsifikatsioon).
4
4
 
5
5
  If you need to use this gem with old iPizza services implementations (`1001`, `1002`, `4001` and `4002`), use 1.0.0 version of this gem (NB! support for these services will end on 31 December 2015).
6
6
 
@@ -37,20 +37,24 @@ At any time, configuration can be modified with `Ipizza::Config.configure` block
37
37
  service_url: http://foo.bar/swedbank
38
38
  return_url: http://mycompany.com/store
39
39
  cancel_url: http://mycompany.com/cancel
40
-
40
+
41
41
  # Your private key file path. Can be specified relatively
42
42
  # to YAML file
43
43
  file_key: ./certificates/my_private.key
44
-
44
+
45
45
  # If your private key is protected with password,
46
46
  # provide it here
47
47
  key_secret: private_key_password
48
-
48
+
49
49
  # Path to bank's public key file. Can be specified
50
50
  # relatively to YAML file
51
51
  file_cert: ./certificates/bank_public.crt
52
+ login: dealer
52
53
  snd_id: dealer
53
54
  encoding: UTF-8
55
+ sign_algorithm: sha256 # default is sha1
56
+ verification_algorithm: sha256 # default is sha1
57
+ vk_version: "009" # VK_VERSION. Default is "008"
54
58
 
55
59
  ## Payment requests
56
60
 
@@ -77,20 +81,17 @@ At any time, configuration can be modified with `Ipizza::Config.configure` block
77
81
 
78
82
  This library currently works with four Estonian Banks. Here are their respective interface specifications:
79
83
 
80
- * [Swedbank](https://www.swedbank.ee/business/cash/ecommerce/banklink/description?language=EST)
81
- * [SEB](http://www.seb.ee/ari/maksete-kogumine/maksete-kogumine-internetis/tehniline-spetsifikatsioon)
82
- * [Danske Bank](http://www.danskebank.ee/et/14732.html)
83
- * [Krediidipank](http://www.krediidipank.ee/business/settlements/bank-link/index.html)
84
- * [LHV Bank](https://www.lhv.ee/pangateenused/pangalink/)
85
- * [Nordea](http://www.nordea.ee/Teenused+%C3%A4rikliendile/Igap%C3%A4evapangandus/Maksete+kogumine/E-makse/1562142.html) (*uses SOLO protocol*)
84
+ * [Swedbank](https://www.swedbank.ee/business/cash/ecommerce/support)
85
+ * [SEB](https://www.seb.ee/en/business/daily-banking/bank-link)
86
+ * [LHV Bank](https://partners.lhv.ee/en/banklink)
86
87
 
87
88
  # Helpful links
88
89
 
89
90
  * [pangalink.net](https://pangalink.net/et/info)
90
- * [Repository](http://github.com/priithaamer/ipizza)
91
- * [Issue tracker](http://github.com/priithaamer/ipizza/issues)
91
+ * [Repository](https://github.com/Voog/ipizza)
92
+ * [Issue tracker](https://github.com/Voog/ipizza/issues)
92
93
 
93
94
  # Authors
94
95
 
95
- * Thanks to [all contributors](https://github.com/priithaamer/ipizza/graphs/contributors)!
96
+ * Thanks to [all contributors](https://github.com/Voog/ipizza/graphs/contributors)!
96
97
  * Tarmo Talu (Thanks for the 7-3-1 algorithm)
@@ -1,6 +1,7 @@
1
1
  module Ipizza::Provider
2
2
  class Base
3
3
 
4
+ DEFAULT_VK_VERSION = '008'
4
5
  SUPPORTED_ENCODINGS = %w(UTF-8 ISO-8859-1 WINDOWS-1257)
5
6
 
6
7
  class << self
@@ -17,7 +18,8 @@ module Ipizza::Provider
17
18
  :rec_acc,
18
19
  :rec_name,
19
20
  :encoding,
20
- :lang
21
+ :lang,
22
+ :vk_version
21
23
  end
22
24
 
23
25
  def payment_request(payment, service_no = 1012)
@@ -25,7 +27,7 @@ module Ipizza::Provider
25
27
  req.service_url = self.class.service_url
26
28
  req.sign_params = {
27
29
  'VK_SERVICE' => service_no,
28
- 'VK_VERSION' => '008',
30
+ 'VK_VERSION' => vk_version,
29
31
  'VK_SND_ID' => self.class.snd_id,
30
32
  'VK_STAMP' => payment.stamp,
31
33
  'VK_AMOUNT' => sprintf('%.2f', payment.amount),
@@ -65,7 +67,7 @@ module Ipizza::Provider
65
67
  req.service_url = self.class.service_url
66
68
  req.sign_params = {
67
69
  'VK_SERVICE' => service_no,
68
- 'VK_VERSION' => '008',
70
+ 'VK_VERSION' => vk_version,
69
71
  'VK_SND_ID' => self.class.snd_id,
70
72
  'VK_RETURN' => self.class.return_url,
71
73
  'VK_DATETIME' => Ipizza::Util.time_to_iso8601(Time.now),
@@ -105,5 +107,10 @@ module Ipizza::Provider
105
107
  def get_encoding(val)
106
108
  SUPPORTED_ENCODINGS.include?(val.to_s.upcase) ? val.to_s.upcase : 'UTF-8'
107
109
  end
110
+
111
+ def vk_version
112
+ str = self.class.vk_version.to_s.strip
113
+ str.empty? ? DEFAULT_VK_VERSION : str
114
+ end
108
115
  end
109
116
  end
@@ -1,3 +1,3 @@
1
1
  module Ipizza
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -41,6 +41,7 @@ seb:
41
41
  key_secret: foobar
42
42
  encoding: UTF-8
43
43
  snd_id: sender
44
+ vk_version: '009'
44
45
  sign_algorithm: 'sha256'
45
46
  verification_algorithm: 'sha256'
46
47
 
@@ -11,5 +11,6 @@ swedbank:
11
11
 
12
12
  seb:
13
13
  service_url: https://www.seb.ee/banklink
14
+ vk_version: '009'
14
15
  sign_algorithm: 'sha256'
15
16
  verification_algorithm: 'sha1'
@@ -6,7 +6,7 @@ describe Ipizza::Config do
6
6
  before(:each) do
7
7
  Ipizza::Config.load_from_file(File.expand_path(File.dirname(__FILE__) + '/../config/plain_config.yml'))
8
8
  end
9
-
9
+
10
10
  it 'should load configuration from yml file' do
11
11
  Ipizza::Provider::Swedbank.service_url.should == 'https://www.swedbank.ee/banklink'
12
12
  Ipizza::Provider::Swedbank.return_url.should == 'http://test.local/return'
@@ -14,28 +14,30 @@ describe Ipizza::Config do
14
14
  Ipizza::Provider::Swedbank.key_secret.should == 'foobar'
15
15
  Ipizza::Provider::Swedbank.snd_id.should == 'dealer'
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
19
  Ipizza::Provider::Seb.sign_algorithm.should == 'sha256'
20
20
  Ipizza::Provider::Seb.verification_algorithm.should == 'sha1'
21
+ Ipizza::Provider::Seb.vk_version.should == '009'
22
+
21
23
  end
22
-
24
+
23
25
  it 'should load certificates from path relative to configuration file' do
24
26
  Ipizza::Provider::Swedbank.file_key.should == File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_swedbank_user_key.pem')
25
27
  Ipizza::Provider::Swedbank.file_cert.should == File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_swedbank_bank_cert.pem')
26
28
  end
27
-
29
+
28
30
  it 'should load certificates from absolute file paths' do
29
31
  cfg = {'swedbank' => YAML::load_file(File.expand_path(File.dirname(__FILE__) + '/../config/config.yml'))['swedbank']}
30
32
  cfg['swedbank']['file_key'] = File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_swedbank_user_key.pem')
31
33
  cfg['swedbank']['file_cert'] = File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_swedbank_bank_cert.pem')
32
-
34
+
33
35
  Tempfile::open('config.yml') do |tmp|
34
36
  tmp << cfg.to_yaml
35
37
  tmp.flush
36
-
38
+
37
39
  config = Ipizza::Config.load_from_file(File.expand_path(tmp.path))
38
-
40
+
39
41
  Ipizza::Provider::Swedbank.file_key.should == File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_swedbank_user_key.pem')
40
42
  Ipizza::Provider::Swedbank.file_cert.should == File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_swedbank_bank_cert.pem')
41
43
  end
@@ -50,18 +52,18 @@ describe Ipizza::Config do
50
52
 
51
53
  Ipizza::Provider::Swedbank.service_url.should == 'http://foo.bar/swedbank'
52
54
  end
53
-
55
+
54
56
  it 'should raise an error if configuration parameter does not exist' do
55
57
  lambda { Ipizza::Config.configure { |c| c.swedbank_unknown_attr = 'foo' } }.should raise_error
56
58
  lambda { Ipizza::Config.configure { |c| c.spermbank_service_url = 'foo' } }.should raise_error
57
59
  end
58
-
60
+
59
61
  it 'loads certificates from directory specified by certs_root' do
60
62
  Ipizza::Config.configure do |c|
61
63
  c.certs_root = File.expand_path(File.dirname(__FILE__) + '/../certificates')
62
64
  c.swedbank_file_cert = 'pangalink_seb_bank_cert.pem'
63
65
  end
64
-
66
+
65
67
  Ipizza::Provider::Swedbank.file_cert.should == File.expand_path(File.dirname(__FILE__) + '/../certificates/pangalink_seb_bank_cert.pem')
66
68
  end
67
69
  end
@@ -16,7 +16,7 @@ describe Ipizza::Provider::Seb do
16
16
  req = Ipizza::Provider::Seb.new.payment_request(payment)
17
17
  params = {
18
18
  'VK_SERVICE' => '1012',
19
- 'VK_VERSION' => '008',
19
+ 'VK_VERSION' => '009',
20
20
  'VK_SND_ID' => Ipizza::Provider::Seb.snd_id,
21
21
  'VK_STAMP' => payment.stamp,
22
22
  'VK_AMOUNT' => sprintf('%.2f', payment.amount),
@@ -65,7 +65,7 @@ describe Ipizza::Provider::Seb do
65
65
  req = Ipizza::Provider::Seb.new.authentication_request
66
66
  params = {
67
67
  'VK_SERVICE' => '4011',
68
- 'VK_VERSION' => '008',
68
+ 'VK_VERSION' => '009',
69
69
  'VK_SND_ID' => Ipizza::Provider::Seb.snd_id,
70
70
  'VK_RETURN' => Ipizza::Provider::Seb.return_url,
71
71
  'VK_DATETIME' => Ipizza::Util.time_to_iso8601(Time.now),
@@ -50,4 +50,32 @@ describe Ipizza::Provider do
50
50
  Ipizza::Provider.get('unkn').should be_nil
51
51
  end
52
52
  end
53
+
54
+ describe 'VK_VERSION override' do
55
+ let(:payment) do
56
+ Ipizza::Payment.new(stamp: 1, amount: '1.00', refnum: 1, message: 'Msg', currency: 'EUR')
57
+ end
58
+
59
+ before do
60
+ # Reset any custom value potentially set by other specs
61
+ Ipizza::Provider::Swedbank.vk_version = nil
62
+ end
63
+
64
+ it 'defaults to 008 when not set' do
65
+ req = Ipizza::Provider::Swedbank.new.payment_request(payment)
66
+ req.sign_params['VK_VERSION'].should == '008'
67
+ end
68
+
69
+ it 'uses overridden static value' do
70
+ Ipizza::Provider::Swedbank.vk_version = '009'
71
+ req = Ipizza::Provider::Swedbank.new.payment_request(payment)
72
+ req.sign_params['VK_VERSION'].should == '009'
73
+ end
74
+
75
+ it 'falls back when blank string provided' do
76
+ Ipizza::Provider::Swedbank.vk_version = ' '
77
+ req = Ipizza::Provider::Swedbank.new.authentication_request
78
+ req.sign_params['VK_VERSION'].should == '008'
79
+ end
80
+ end
53
81
  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.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Priit Haamer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-08 00:00:00.000000000 Z
12
+ date: 2025-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec