ipizza 0.5.5 → 0.6.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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipizza (0.5.4)
4
+ ipizza (0.6.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.markdown CHANGED
@@ -100,5 +100,5 @@ Todo
100
100
  Authors
101
101
  =======
102
102
 
103
- * Priit Haamer
103
+ * Thanks to [all contributors](https://github.com/priithaamer/ipizza/graphs/contributors)!
104
104
  * Tarmo Talu (Thanks for the 7-3-1 algorithm)
@@ -1,6 +1,6 @@
1
1
  module Ipizza
2
2
  module Provider
3
-
3
+
4
4
  class << self
5
5
  def get(provider_name)
6
6
  case provider_name.downcase
@@ -14,6 +14,8 @@ module Ipizza
14
14
  Ipizza::Provider::Seb.new
15
15
  when 'sampo'
16
16
  Ipizza::Provider::Sampo.new
17
+ when 'sampopank'
18
+ Ipizza::Provider::Sampo.new
17
19
  when 'nordea'
18
20
  Ipizza::Provider::Nordea.new
19
21
  end
@@ -1,13 +1,13 @@
1
1
  module Ipizza::Provider
2
-
2
+
3
3
  # TODO: configure whether use sha-1 or md5 for signing and verification
4
4
  class Nordea
5
-
5
+
6
6
  require 'ipizza/provider/nordea/payment_request'
7
7
  require 'ipizza/provider/nordea/payment_response'
8
8
  require 'ipizza/provider/nordea/authentication_request'
9
9
  require 'ipizza/provider/nordea/authentication_response'
10
-
10
+
11
11
  class << self
12
12
  attr_accessor :payments_service_url, :payments_return_url, :payments_reject_url, :payments_cancel_url
13
13
  attr_accessor :payments_rcv_id, :payments_language
@@ -15,7 +15,7 @@ module Ipizza::Provider
15
15
  attr_accessor :auth_rcv_id
16
16
  attr_accessor :file_key, :rcv_account, :rcv_name, :confirm, :keyvers
17
17
  end
18
-
18
+
19
19
  def payment_request(payment, service = 1002)
20
20
  req = Ipizza::Provider::Nordea::PaymentRequest.new
21
21
  req.service_url = self.class.payments_service_url
@@ -37,17 +37,17 @@ module Ipizza::Provider
37
37
  'RETURN' => self.class.payments_return_url,
38
38
  'CANCEL' => self.class.payments_cancel_url
39
39
  }
40
-
40
+
41
41
  req.sign(self.class.file_key)
42
42
  req
43
43
  end
44
-
44
+
45
45
  def payment_response(params)
46
46
  response = Ipizza::Provider::Nordea::PaymentResponse.new(params)
47
- response.verify(self.class.key)
47
+ response.verify(self.class.file_key)
48
48
  return response
49
49
  end
50
-
50
+
51
51
  def authentication_request
52
52
  req = Ipizza::Provider::Nordea::AuthenticationRequest.new
53
53
  req.service_url = self.class.auth_service_url
@@ -67,7 +67,7 @@ module Ipizza::Provider
67
67
  req.sign(self.class.file_key)
68
68
  req
69
69
  end
70
-
70
+
71
71
  def authentication_response(params)
72
72
  response = Ipizza::Provider::Nordea::AuthenticationResponse.new(params)
73
73
  response.verify(self.class.file_key)
@@ -1,48 +1,48 @@
1
1
  module Ipizza::Provider
2
2
  class Sampo
3
-
3
+
4
4
  class << self
5
5
  attr_accessor :service_url, :return_url, :file_key, :key_secret, :file_cert, :snd_id, :lang, :rec_acc, :rec_name
6
6
  end
7
-
7
+
8
8
  def payment_request(payment, service = 1002)
9
9
  req = Ipizza::PaymentRequest.new
10
- req.service_url = self.service_url
10
+ req.service_url = self.class.service_url
11
11
  req.sign_params = {
12
12
  'VK_SERVICE' => service.to_s,
13
13
  'VK_VERSION' => '008',
14
- 'VK_SND_ID' => self.snd_id,
14
+ 'VK_SND_ID' => self.class.snd_id,
15
15
  'VK_STAMP' => payment.stamp,
16
16
  'VK_AMOUNT' => sprintf('%.2f', payment.amount),
17
17
  'VK_CURR' => payment.currency,
18
18
  'VK_REF' => Ipizza::Util.sign_731(payment.refnum),
19
19
  'VK_MSG' => payment.message
20
20
  }
21
-
21
+
22
22
  if service == 1001
23
- req.sign_params['VK_ACC'] = self.rec_acc
24
- req.sign_params['VK_NAME'] = self.rec_name
23
+ req.sign_params['VK_ACC'] = self.class.rec_acc
24
+ req.sign_params['VK_NAME'] = self.class.rec_name
25
25
  end
26
-
26
+
27
27
  req.extra_params = {
28
- 'VK_RETURN' => self.return_url,
29
- 'VK_LANG' => self.lang
28
+ 'VK_RETURN' => self.class.return_url,
29
+ 'VK_LANG' => self.class.lang
30
30
  }
31
-
31
+
32
32
  if service == 1001
33
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
34
  else
35
35
  param_order = ['VK_SERVICE', 'VK_VERSION', 'VK_SND_ID', 'VK_STAMP', 'VK_AMOUNT', 'VK_CURR', 'VK_REF', 'VK_MSG']
36
36
  end
37
-
38
- req.sign(self.key, self.key_secret, param_order)
37
+
38
+ req.sign(self.class.file_key, self.class.key_secret, param_order)
39
39
  req
40
40
  end
41
-
41
+
42
42
  def payment_response(params)
43
43
  response = Ipizza::PaymentResponse.new(params)
44
44
  response.verify(self.class.file_cert)
45
-
45
+
46
46
  return response
47
47
  end
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module Ipizza
2
- VERSION = '0.5.5'
2
+ VERSION = '0.6.1'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipizza
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 5
10
- version: 0.5.5
8
+ - 6
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Priit Haamer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-01 00:00:00 +03:00
18
+ date: 2012-06-22 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency