ipizza 2.0.0 → 2.0.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ipizza/provider.rb +1 -3
- data/lib/ipizza/provider/base.rb +1 -1
- data/lib/ipizza/util.rb +9 -5
- data/lib/ipizza/version.rb +1 -1
- data/spec/ipizza/provider_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d02b88f8dee566651de91c705c95c91e586d1de
|
4
|
+
data.tar.gz: 05caaaaa4d249c3ae8ffed1809cc6474254886ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ce76b70d0e5e1e8ba12fb81e37904649533f7afad1dddb8f3faf875491099595e1c835de1353a29fa490c10b579ff93a7420635e6a8aaae6b5cc4c4e9a9100
|
7
|
+
data.tar.gz: 7a482f0d83491fc29ef7aa8bdd39d1d35dbfd3b6744a6a01df35ae3616d31a683f4979bb777b7354435e8fd99e4836ac56beefedd871d3725f6c4a6c4bd76990
|
data/Gemfile.lock
CHANGED
data/lib/ipizza/provider.rb
CHANGED
@@ -3,7 +3,7 @@ module Ipizza
|
|
3
3
|
|
4
4
|
class << self
|
5
5
|
def get(provider_name)
|
6
|
-
case provider_name.downcase
|
6
|
+
case provider_name.to_s.downcase
|
7
7
|
when 'lhv'
|
8
8
|
Ipizza::Provider::Lhv.new
|
9
9
|
when 'swedbank', 'hp'
|
@@ -16,8 +16,6 @@ module Ipizza
|
|
16
16
|
Ipizza::Provider::Krediidipank.new
|
17
17
|
when 'nordea'
|
18
18
|
Ipizza::Provider::Nordea.new
|
19
|
-
else
|
20
|
-
Ipizza::Provider::Base.new
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
data/lib/ipizza/provider/base.rb
CHANGED
data/lib/ipizza/util.rb
CHANGED
@@ -7,8 +7,12 @@ module Ipizza
|
|
7
7
|
class << self
|
8
8
|
|
9
9
|
def verify_signature(certificate_path, signature, data)
|
10
|
-
|
11
|
-
|
10
|
+
if !certificate_path.to_s.empty? && !signature.to_s.empty? && File.file?(certificate_path)
|
11
|
+
certificate = OpenSSL::X509::Certificate.new(File.read(certificate_path).gsub(/ /, '')).public_key
|
12
|
+
certificate.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(signature), data)
|
13
|
+
else
|
14
|
+
false
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
def sign(privkey_path, privkey_secret, data)
|
@@ -45,12 +49,12 @@ module Ipizza
|
|
45
49
|
#
|
46
50
|
# p(x1)||x1||p(x2)||x2||...||p(xn)||xn
|
47
51
|
#
|
48
|
-
# Where || is string concatenation, p(x) is length of the field x represented by three digits.
|
52
|
+
# Where || is string concatenation, p(x) is length of the (stripped) field x represented by three digits.
|
49
53
|
#
|
50
54
|
# Parameters val1, val2, value3 would be turned into "003val1003val2006value3".
|
51
55
|
def mac_data_string(params, sign_param_order)
|
52
|
-
sign_param_order.inject('') do |memo, param|
|
53
|
-
val = params[param].to_s
|
56
|
+
(sign_param_order || []).inject('') do |memo, param|
|
57
|
+
val = params[param].to_s.strip
|
54
58
|
memo << func_p(val) << val
|
55
59
|
memo
|
56
60
|
end
|
data/lib/ipizza/version.rb
CHANGED
@@ -41,5 +41,9 @@ describe Ipizza::Provider do
|
|
41
41
|
it 'returns nordea provider for "nordea" attribute' do
|
42
42
|
Ipizza::Provider.get('nordea').should be_a(Ipizza::Provider::Nordea)
|
43
43
|
end
|
44
|
+
|
45
|
+
it 'returns nothing for "unkn" attribute' do
|
46
|
+
Ipizza::Provider.get('unkn').should be_nil
|
47
|
+
end
|
44
48
|
end
|
45
49
|
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.0.
|
4
|
+
version: 2.0.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: 2015-02-
|
12
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|