ipizza 0.7.1 → 2.1.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 +7 -0
- data/.gitignore +3 -1
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +28 -24
- data/Guardfile +2 -2
- data/README.markdown +15 -7
- data/Rakefile +1 -1
- data/ipizza.gemspec +12 -11
- data/lib/ipizza/authentication.rb +15 -0
- data/lib/ipizza/authentication_request.rb +1 -1
- data/lib/ipizza/authentication_response.rb +22 -9
- data/lib/ipizza/config.rb +13 -13
- data/lib/ipizza/payment.rb +4 -4
- data/lib/ipizza/payment_request.rb +1 -1
- data/lib/ipizza/payment_response.rb +15 -7
- data/lib/ipizza/provider/base.rb +90 -0
- data/lib/ipizza/provider/krediidipank.rb +1 -47
- data/lib/ipizza/provider/lhv.rb +4 -0
- data/lib/ipizza/provider/luminor.rb +4 -0
- data/lib/ipizza/provider/nordea/authentication_request.rb +2 -2
- data/lib/ipizza/provider/nordea/authentication_response.rb +7 -3
- data/lib/ipizza/provider/nordea/payment_request.rb +2 -2
- data/lib/ipizza/provider/nordea/payment_response.rb +4 -4
- data/lib/ipizza/provider/nordea.rb +1 -74
- data/lib/ipizza/provider/sampo.rb +1 -46
- data/lib/ipizza/provider/seb.rb +1 -78
- data/lib/ipizza/provider/swedbank.rb +1 -66
- data/lib/ipizza/provider.rb +9 -15
- data/lib/ipizza/request.rb +9 -2
- data/lib/ipizza/response.rb +7 -9
- data/lib/ipizza/util.rb +18 -11
- data/lib/ipizza/version.rb +2 -2
- data/lib/ipizza.rb +4 -0
- data/spec/certificates/pangalink_danske_bank_cert.pem +22 -0
- data/spec/certificates/pangalink_danske_bank_key.pem +27 -0
- data/spec/certificates/pangalink_danske_user_key.pem +27 -0
- data/spec/certificates/pangalink_krediidipank_bank_cert.pem +22 -0
- data/spec/certificates/pangalink_krediidipank_bank_key.pem +27 -0
- data/spec/certificates/pangalink_krediidipank_user_key.pem +27 -0
- data/spec/certificates/pangalink_lhv_bank_cert.pem +22 -0
- data/spec/certificates/pangalink_lhv_bank_key.pem +27 -0
- data/spec/certificates/pangalink_lhv_user_key.pem +27 -0
- data/spec/certificates/pangalink_luminor_bank.cert.pem +18 -0
- data/spec/certificates/pangalink_luminor_bank_cert.pem +17 -0
- data/spec/certificates/pangalink_seb_bank_cert.pem +16 -0
- data/spec/certificates/pangalink_seb_bank_key.pem +15 -0
- data/spec/certificates/pangalink_seb_user_key.pem +15 -0
- data/spec/certificates/pangalink_swedbank_bank_cert.pem +22 -0
- data/spec/certificates/pangalink_swedbank_bank_key.pem +27 -0
- data/spec/certificates/pangalink_swedbank_user_key.pem +27 -0
- data/spec/config/config.yml +50 -6
- data/spec/config/plain_config.yml +3 -3
- data/spec/ipizza/authentication_response_spec.rb +11 -9
- data/spec/ipizza/config_spec.rb +9 -10
- data/spec/ipizza/provider/krediidipank_spec.rb +89 -0
- data/spec/ipizza/provider/lhv_spec.rb +89 -0
- data/spec/ipizza/provider/luminor_spec.rb +89 -0
- data/spec/ipizza/provider/nordea/authentication_response_spec.rb +3 -3
- data/spec/ipizza/provider/sampo_spec.rb +85 -0
- data/spec/ipizza/provider/seb_spec.rb +60 -30
- data/spec/ipizza/provider/swedbank_spec.rb +63 -34
- data/spec/ipizza/provider_spec.rb +25 -5
- data/spec/ipizza/util_spec.rb +5 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/pizza.rb +1 -1
- metadata +121 -104
- data/spec/certificates/bank.crt +0 -21
- data/spec/certificates/bank.csr +0 -17
- data/spec/certificates/bank.key +0 -27
- data/spec/certificates/bank.pub +0 -1
- data/spec/certificates/dealer.key +0 -30
- data/spec/certificates/dealer.pub +0 -1
- data/spec/certificates/seb_test_priv.pem +0 -16
- data/spec/certificates/seb_test_pub.crt +0 -20
- data/spec/certificates/seb_test_pub.pem +0 -20
- data/spec/certificates/swedbank_production.pem +0 -48
@@ -1,50 +1,4 @@
|
|
1
1
|
module Ipizza::Provider
|
2
|
-
class Krediidipank
|
3
|
-
|
4
|
-
class << self
|
5
|
-
attr_accessor :service_url, :return_url, :file_key, :key_secret, :file_cert, :snd_id, :encoding, :lang, :rec_acc, :rec_name
|
6
|
-
end
|
7
|
-
|
8
|
-
def payment_request(payment, service = 1002)
|
9
|
-
req = Ipizza::PaymentRequest.new
|
10
|
-
req.service_url = self.class.service_url
|
11
|
-
req.sign_params = {
|
12
|
-
'VK_SERVICE' => service.to_s,
|
13
|
-
'VK_VERSION' => '008',
|
14
|
-
'VK_SND_ID' => self.class.snd_id,
|
15
|
-
'VK_STAMP' => payment.stamp,
|
16
|
-
'VK_AMOUNT' => sprintf('%.2f', payment.amount),
|
17
|
-
'VK_CURR' => payment.currency,
|
18
|
-
'VK_REF' => Ipizza::Util.sign_731(payment.refnum),
|
19
|
-
'VK_MSG' => payment.message
|
20
|
-
}
|
21
|
-
|
22
|
-
if service == 1001
|
23
|
-
req.sign_params['VK_ACC'] = self.class.rec_acc
|
24
|
-
req.sign_params['VK_NAME'] = self.class.rec_name
|
25
|
-
end
|
26
|
-
|
27
|
-
req.extra_params = {
|
28
|
-
'VK_CHARSET' => self.class.encoding,
|
29
|
-
'VK_RETURN' => self.class.return_url,
|
30
|
-
'VK_LANG' => self.class.lang
|
31
|
-
}
|
32
|
-
|
33
|
-
if service == 1001
|
34
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_ACC', 'VK_NAME', 'VK_REF', 'VK_MSG']
|
35
|
-
else
|
36
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_REF', 'VK_MSG']
|
37
|
-
end
|
38
|
-
|
39
|
-
req.sign(self.class.file_key, self.class.key_secret, param_order)
|
40
|
-
req
|
41
|
-
end
|
42
|
-
|
43
|
-
def payment_response(params)
|
44
|
-
response = Ipizza::PaymentResponse.new(params)
|
45
|
-
response.verify(self.class.file_cert)
|
46
|
-
|
47
|
-
return response
|
48
|
-
end
|
2
|
+
class Krediidipank < Ipizza::Provider::Base
|
49
3
|
end
|
50
4
|
end
|
@@ -18,7 +18,7 @@ module Ipizza::Provider
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def mac_data_string(key)
|
21
|
-
order =
|
21
|
+
order = %w(ACTION_ID VERS RCVID LANGCODE STAMP IDTYPE RETLINK CANLINK REJLINK KEYVERS ALG)
|
22
22
|
|
23
23
|
datastr = order.inject('') do |memo, param|
|
24
24
|
memo << params[param].to_s << '&'
|
@@ -26,4 +26,4 @@ module Ipizza::Provider
|
|
26
26
|
datastr << key << '&'
|
27
27
|
end
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
@@ -27,11 +27,15 @@ module Ipizza::Provider
|
|
27
27
|
def info_social_security_id
|
28
28
|
valid? ? @params['B02K_CUSTID'] : ''
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
|
+
def authentication_info
|
32
|
+
@authentication_info ||= Ipizza::Authentication.new(user_name: info_name, user_id: info_social_security_id)
|
33
|
+
end
|
34
|
+
|
31
35
|
private
|
32
36
|
|
33
37
|
def mac_data_string(key)
|
34
|
-
order =
|
38
|
+
order = %w(VERS TIMESTMP IDNBR STAMP CUSTNAME KEYVERS ALG CUSTID CUSTTYPE)
|
35
39
|
|
36
40
|
datastr = order.inject('') do |memo, param|
|
37
41
|
memo << @params["B02K_#{param}"].to_s << '&'
|
@@ -39,4 +43,4 @@ module Ipizza::Provider
|
|
39
43
|
datastr << key << '&'
|
40
44
|
end
|
41
45
|
end
|
42
|
-
end
|
46
|
+
end
|
@@ -18,7 +18,7 @@ module Ipizza::Provider
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def mac_data_string(key)
|
21
|
-
order =
|
21
|
+
order = %w(VERSION STAMP RCV_ID AMOUNT REF DATE CUR)
|
22
22
|
|
23
23
|
datastr = order.inject('') do |memo, param|
|
24
24
|
memo << params[param].to_s
|
@@ -30,4 +30,4 @@ module Ipizza::Provider
|
|
30
30
|
datastr
|
31
31
|
end
|
32
32
|
end
|
33
|
-
end
|
33
|
+
end
|
@@ -13,7 +13,7 @@ module Ipizza::Provider
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def success?
|
16
|
-
|
16
|
+
@valid && !@params['RETURN_PAID'].blank?
|
17
17
|
end
|
18
18
|
|
19
19
|
def valid?
|
@@ -21,13 +21,13 @@ module Ipizza::Provider
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def payment_info
|
24
|
-
@payment_info ||= Ipizza::Payment.new(:
|
24
|
+
@payment_info ||= Ipizza::Payment.new(stamp: @params['RETURN_STAMP'], refnum: @params['RETURN_REF'])
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def mac_data_string(key)
|
30
|
-
order =
|
30
|
+
order = %w(RETURN_VERSION RETURN_STAMP RETURN_REF RETURN_PAID)
|
31
31
|
|
32
32
|
datastr = order.inject('') do |memo, param|
|
33
33
|
memo << @params[param].to_s
|
@@ -40,4 +40,4 @@ module Ipizza::Provider
|
|
40
40
|
datastr
|
41
41
|
end
|
42
42
|
end
|
43
|
-
end
|
43
|
+
end
|
@@ -1,77 +1,4 @@
|
|
1
1
|
module Ipizza::Provider
|
2
|
-
|
3
|
-
# TODO: configure whether use sha-1 or md5 for signing and verification
|
4
|
-
class Nordea
|
5
|
-
|
6
|
-
require 'ipizza/provider/nordea/payment_request'
|
7
|
-
require 'ipizza/provider/nordea/payment_response'
|
8
|
-
require 'ipizza/provider/nordea/authentication_request'
|
9
|
-
require 'ipizza/provider/nordea/authentication_response'
|
10
|
-
|
11
|
-
class << self
|
12
|
-
attr_accessor :payments_service_url, :payments_return_url, :payments_reject_url, :payments_cancel_url
|
13
|
-
attr_accessor :payments_rcv_id, :payments_language
|
14
|
-
attr_accessor :auth_service_url, :auth_return_url, :auth_reject_url, :auth_cancel_url, :auth_language
|
15
|
-
attr_accessor :auth_rcv_id
|
16
|
-
attr_accessor :file_key, :rcv_account, :rcv_name, :confirm, :keyvers
|
17
|
-
end
|
18
|
-
|
19
|
-
def payment_request(payment, service = 1002)
|
20
|
-
req = Ipizza::Provider::Nordea::PaymentRequest.new
|
21
|
-
req.service_url = self.class.payments_service_url
|
22
|
-
req.params = {
|
23
|
-
'VERSION' => '0003',
|
24
|
-
'STAMP' => payment.stamp,
|
25
|
-
'RCV_ID' => self.class.payments_rcv_id,
|
26
|
-
# 'RCV_ACCOUNT' => self.rcv_account,
|
27
|
-
# 'RCV_NAME' => self.rcv_name,
|
28
|
-
'LANGUAGE' => self.class.payments_language,
|
29
|
-
'AMOUNT' => sprintf('%.2f', payment.amount),
|
30
|
-
'REF' => Ipizza::Util.sign_731(payment.refnum),
|
31
|
-
'DATE' => 'EXPRESS',
|
32
|
-
'MSG' => payment.message,
|
33
|
-
'CONFIRM' => self.class.confirm,
|
34
|
-
'CUR' => payment.currency,
|
35
|
-
'KEYVERS' => self.class.keyvers,
|
36
|
-
'REJECT' => self.class.payments_reject_url,
|
37
|
-
'RETURN' => self.class.payments_return_url,
|
38
|
-
'CANCEL' => self.class.payments_cancel_url
|
39
|
-
}
|
40
|
-
|
41
|
-
req.sign(self.class.file_key)
|
42
|
-
req
|
43
|
-
end
|
44
|
-
|
45
|
-
def payment_response(params)
|
46
|
-
response = Ipizza::Provider::Nordea::PaymentResponse.new(params)
|
47
|
-
response.verify(self.class.file_key)
|
48
|
-
return response
|
49
|
-
end
|
50
|
-
|
51
|
-
def authentication_request
|
52
|
-
req = Ipizza::Provider::Nordea::AuthenticationRequest.new
|
53
|
-
req.service_url = self.class.auth_service_url
|
54
|
-
req.params = {
|
55
|
-
'ACTION_ID' => '701',
|
56
|
-
'VERS' => '0002',
|
57
|
-
'RCVID' => self.class.auth_rcv_id,
|
58
|
-
'LANGCODE' => self.class.auth_language,
|
59
|
-
'STAMP' => Time.now.strftime('%Y%m%d%H%M%S'),
|
60
|
-
'IDTYPE' => '02',
|
61
|
-
'KEYVERS' => self.class.keyvers,
|
62
|
-
'RETLINK' => self.class.auth_return_url,
|
63
|
-
'CANLINK' => self.class.auth_cancel_url,
|
64
|
-
'REJLINK' => self.class.auth_reject_url,
|
65
|
-
'ALG' => '01'
|
66
|
-
}
|
67
|
-
req.sign(self.class.file_key)
|
68
|
-
req
|
69
|
-
end
|
70
|
-
|
71
|
-
def authentication_response(params)
|
72
|
-
response = Ipizza::Provider::Nordea::AuthenticationResponse.new(params)
|
73
|
-
response.verify(self.class.file_key)
|
74
|
-
return response
|
75
|
-
end
|
2
|
+
class Nordea < Ipizza::Provider::Base
|
76
3
|
end
|
77
4
|
end
|
@@ -1,49 +1,4 @@
|
|
1
1
|
module Ipizza::Provider
|
2
|
-
class Sampo
|
3
|
-
|
4
|
-
class << self
|
5
|
-
attr_accessor :service_url, :return_url, :file_key, :key_secret, :file_cert, :snd_id, :lang, :rec_acc, :rec_name
|
6
|
-
end
|
7
|
-
|
8
|
-
def payment_request(payment, service = 1002)
|
9
|
-
req = Ipizza::PaymentRequest.new
|
10
|
-
req.service_url = self.class.service_url
|
11
|
-
req.sign_params = {
|
12
|
-
'VK_SERVICE' => service.to_s,
|
13
|
-
'VK_VERSION' => '008',
|
14
|
-
'VK_SND_ID' => self.class.snd_id,
|
15
|
-
'VK_STAMP' => payment.stamp,
|
16
|
-
'VK_AMOUNT' => sprintf('%.2f', payment.amount),
|
17
|
-
'VK_CURR' => payment.currency,
|
18
|
-
'VK_REF' => Ipizza::Util.sign_731(payment.refnum),
|
19
|
-
'VK_MSG' => payment.message
|
20
|
-
}
|
21
|
-
|
22
|
-
if service == 1001
|
23
|
-
req.sign_params['VK_ACC'] = self.class.rec_acc
|
24
|
-
req.sign_params['VK_NAME'] = self.class.rec_name
|
25
|
-
end
|
26
|
-
|
27
|
-
req.extra_params = {
|
28
|
-
'VK_RETURN' => self.class.return_url,
|
29
|
-
'VK_LANG' => self.class.lang
|
30
|
-
}
|
31
|
-
|
32
|
-
if service == 1001
|
33
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_ACC', 'VK_NAME', 'VK_REF', 'VK_MSG']
|
34
|
-
else
|
35
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_REF', 'VK_MSG']
|
36
|
-
end
|
37
|
-
|
38
|
-
req.sign(self.class.file_key, self.class.key_secret, param_order)
|
39
|
-
req
|
40
|
-
end
|
41
|
-
|
42
|
-
def payment_response(params)
|
43
|
-
response = Ipizza::PaymentResponse.new(params)
|
44
|
-
response.verify(self.class.file_cert)
|
45
|
-
|
46
|
-
return response
|
47
|
-
end
|
2
|
+
class Sampo < Ipizza::Provider::Base
|
48
3
|
end
|
49
4
|
end
|
data/lib/ipizza/provider/seb.rb
CHANGED
@@ -1,81 +1,4 @@
|
|
1
1
|
module Ipizza::Provider
|
2
|
-
class Seb
|
3
|
-
|
4
|
-
class << self
|
5
|
-
attr_accessor :service_url, :return_url, :cancel_url, :file_key, :key_secret, :file_cert, :snd_id, :encoding, :rec_acc, :rec_name
|
6
|
-
end
|
7
|
-
|
8
|
-
def payment_request(payment, service = 1002)
|
9
|
-
req = Ipizza::PaymentRequest.new
|
10
|
-
req.service_url = self.class.service_url
|
11
|
-
req.sign_params = {
|
12
|
-
'VK_SERVICE' => service.to_s,
|
13
|
-
'VK_VERSION' => '008',
|
14
|
-
'VK_SND_ID' => self.class.snd_id,
|
15
|
-
'VK_STAMP' => payment.stamp,
|
16
|
-
'VK_AMOUNT' => sprintf('%.2f', payment.amount),
|
17
|
-
'VK_CURR' => payment.currency,
|
18
|
-
'VK_REF' => Ipizza::Util.sign_731(payment.refnum),
|
19
|
-
'VK_MSG' => payment.message
|
20
|
-
}
|
21
|
-
|
22
|
-
# TODO: add 1001 support
|
23
|
-
# if service == 1001
|
24
|
-
# req.sign_params['VK_ACC'] = self.rec_acc
|
25
|
-
# req.sign_params['VK_NAME'] = self.rec_name
|
26
|
-
# end
|
27
|
-
|
28
|
-
req.extra_params = {
|
29
|
-
'VK_CHARSET' => self.class.encoding,
|
30
|
-
'VK_RETURN' => self.class.return_url,
|
31
|
-
'VK_CANCEL' => self.class.cancel_url
|
32
|
-
}
|
33
|
-
|
34
|
-
if service == 1001
|
35
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_ACC', 'VK_NAME', 'VK_REF', 'VK_MSG']
|
36
|
-
else
|
37
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_REF', 'VK_MSG']
|
38
|
-
end
|
39
|
-
|
40
|
-
req.sign(self.class.file_key, self.class.key_secret, param_order)
|
41
|
-
req
|
42
|
-
end
|
43
|
-
|
44
|
-
def payment_response(params)
|
45
|
-
response = Ipizza::PaymentResponse.new(params)
|
46
|
-
response.verify(self.class.file_cert)
|
47
|
-
|
48
|
-
return response
|
49
|
-
end
|
50
|
-
|
51
|
-
def authentication_request(service_no = 4001)
|
52
|
-
req = Ipizza::AuthenticationRequest.new
|
53
|
-
req.service_url = self.class.service_url
|
54
|
-
req.sign_params = {
|
55
|
-
'VK_SERVICE' => service_no,
|
56
|
-
'VK_VERSION' => '008',
|
57
|
-
'VK_SND_ID' => self.class.snd_id,
|
58
|
-
'VK_REPLY' => '3002',
|
59
|
-
'VK_RETURN' => self.class.return_url,
|
60
|
-
'VK_DATE' => Date.today.strftime('%d.%m.%Y'),
|
61
|
-
'VK_TIME' => Time.now.strftime('%H:%M:%S')
|
62
|
-
}
|
63
|
-
|
64
|
-
req.extra_params = {
|
65
|
-
'VK_CHARSET' => self.class.encoding
|
66
|
-
}
|
67
|
-
|
68
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_REPLY', 'VK_RETURN', 'VK_DATE', 'VK_TIME']
|
69
|
-
|
70
|
-
req.sign(self.class.file_key, self.class.key_secret, param_order)
|
71
|
-
req
|
72
|
-
end
|
73
|
-
|
74
|
-
def authentication_response(params)
|
75
|
-
response = Ipizza::AuthenticationResponse.new(params)
|
76
|
-
response.verify(self.class.file_cert)
|
77
|
-
return response
|
78
|
-
end
|
79
|
-
|
2
|
+
class Seb < Ipizza::Provider::Base
|
80
3
|
end
|
81
4
|
end
|
@@ -1,69 +1,4 @@
|
|
1
1
|
module Ipizza::Provider
|
2
|
-
class Swedbank
|
3
|
-
|
4
|
-
class << self
|
5
|
-
attr_accessor :service_url, :return_url, :cancel_url, :file_key, :key_secret, :file_cert, :snd_id, :encoding
|
6
|
-
end
|
7
|
-
|
8
|
-
def payment_request(payment, service = 1002)
|
9
|
-
req = Ipizza::PaymentRequest.new
|
10
|
-
req.service_url = self.class.service_url
|
11
|
-
req.sign_params = {
|
12
|
-
'VK_SERVICE' => '1002',
|
13
|
-
'VK_VERSION' => '008',
|
14
|
-
'VK_SND_ID' => self.class.snd_id,
|
15
|
-
'VK_STAMP' => payment.stamp,
|
16
|
-
'VK_AMOUNT' => sprintf('%.2f', payment.amount),
|
17
|
-
'VK_CURR' => payment.currency,
|
18
|
-
'VK_REF' => Ipizza::Util.sign_731(payment.refnum),
|
19
|
-
'VK_MSG' => payment.message
|
20
|
-
}
|
21
|
-
|
22
|
-
req.extra_params = {
|
23
|
-
'VK_CHARSET' => self.class.encoding,
|
24
|
-
'VK_RETURN' => self.class.return_url,
|
25
|
-
'VK_CANCEL' => self.class.cancel_url
|
26
|
-
}
|
27
|
-
|
28
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_REF', 'VK_MSG']
|
29
|
-
|
30
|
-
req.sign(self.class.file_key, self.class.key_secret, param_order)
|
31
|
-
req
|
32
|
-
end
|
33
|
-
|
34
|
-
def payment_response(params)
|
35
|
-
response = Ipizza::PaymentResponse.new(params)
|
36
|
-
response.verify(self.class.file_cert)
|
37
|
-
return response
|
38
|
-
end
|
39
|
-
|
40
|
-
def authentication_request(service_no = 4001)
|
41
|
-
req = Ipizza::AuthenticationRequest.new
|
42
|
-
req.service_url = self.class.service_url
|
43
|
-
req.sign_params = {
|
44
|
-
'VK_SERVICE' => service_no,
|
45
|
-
'VK_VERSION' => '008',
|
46
|
-
'VK_SND_ID' => self.class.snd_id,
|
47
|
-
'VK_REPLY' => '3002',
|
48
|
-
'VK_RETURN' => self.class.return_url,
|
49
|
-
'VK_DATE' => Date.today.strftime('%d.%m.%Y'),
|
50
|
-
'VK_TIME' => Time.now.strftime('%H:%M:%S')
|
51
|
-
}
|
52
|
-
|
53
|
-
req.extra_params = {
|
54
|
-
'VK_ENCODING' => self.class.encoding
|
55
|
-
}
|
56
|
-
|
57
|
-
param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_REPLY', 'VK_RETURN', 'VK_DATE', 'VK_TIME']
|
58
|
-
|
59
|
-
req.sign(self.class.file_key, self.class.key_secret, param_order)
|
60
|
-
req
|
61
|
-
end
|
62
|
-
|
63
|
-
def authentication_response(params)
|
64
|
-
response = Ipizza::AuthenticationResponse.new(params)
|
65
|
-
response.verify(self.class.file_cert, self.class.encoding)
|
66
|
-
return response
|
67
|
-
end
|
2
|
+
class Swedbank < Ipizza::Provider::Base
|
68
3
|
end
|
69
4
|
end
|
data/lib/ipizza/provider.rb
CHANGED
@@ -3,25 +3,19 @@ module Ipizza
|
|
3
3
|
|
4
4
|
class << self
|
5
5
|
def get(provider_name)
|
6
|
-
case provider_name.downcase
|
7
|
-
when '
|
6
|
+
case provider_name.to_s.downcase
|
7
|
+
when 'lhv'
|
8
|
+
Ipizza::Provider::Lhv.new
|
9
|
+
when 'swedbank', 'hp'
|
8
10
|
Ipizza::Provider::Swedbank.new
|
9
|
-
when '
|
10
|
-
Ipizza::Provider::Swedbank.new
|
11
|
-
when 'eyp'
|
12
|
-
Ipizza::Provider::Seb.new
|
13
|
-
when 'seb'
|
11
|
+
when 'eyp', 'seb'
|
14
12
|
Ipizza::Provider::Seb.new
|
15
|
-
when 'sampo'
|
13
|
+
when 'sampo', 'sampopank', 'danske'
|
16
14
|
Ipizza::Provider::Sampo.new
|
17
|
-
when '
|
18
|
-
Ipizza::Provider::Sampo.new
|
19
|
-
when 'krep'
|
20
|
-
Ipizza::Provider::Krediidipank.new
|
21
|
-
when 'krediidipank'
|
15
|
+
when 'krep', 'krediidipank'
|
22
16
|
Ipizza::Provider::Krediidipank.new
|
23
|
-
when '
|
24
|
-
Ipizza::Provider::
|
17
|
+
when 'luminor', 'testluminor'
|
18
|
+
Ipizza::Provider::Luminor.new
|
25
19
|
end
|
26
20
|
end
|
27
21
|
end
|