ipizza 0.6.1 → 0.7.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,22 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ipizza (0.6.1)
4
+ ipizza (0.7.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- configuration (0.0.5)
9
+ coderay (1.0.8)
10
10
  diff-lcs (1.1.2)
11
- guard (0.3.0)
12
- open_gem (~> 1.4.2)
13
- thor (~> 0.14.6)
14
- launchy (0.3.7)
15
- configuration (>= 0.0.5)
16
- rake (>= 0.8.1)
17
- open_gem (1.4.2)
18
- launchy (~> 0.3.5)
19
- rake (0.8.7)
11
+ guard (1.6.1)
12
+ listen (>= 0.6.0)
13
+ lumberjack (>= 1.0.2)
14
+ pry (>= 0.9.10)
15
+ thor (>= 0.14.6)
16
+ guard-rspec (1.1.0)
17
+ guard (>= 1.1)
18
+ listen (0.7.1)
19
+ lumberjack (1.0.2)
20
+ method_source (0.8.1)
21
+ pry (0.9.10)
22
+ coderay (~> 1.0.5)
23
+ method_source (~> 0.8)
24
+ slop (~> 3.3.1)
25
+ rb-fsevent (0.9.1)
20
26
  rspec (2.6.0)
21
27
  rspec-core (~> 2.6.0)
22
28
  rspec-expectations (~> 2.6.0)
@@ -25,12 +31,14 @@ GEM
25
31
  rspec-expectations (2.6.0)
26
32
  diff-lcs (~> 1.1.2)
27
33
  rspec-mocks (2.6.0)
28
- thor (0.14.6)
34
+ slop (3.3.3)
35
+ thor (0.16.0)
29
36
 
30
37
  PLATFORMS
31
38
  ruby
32
39
 
33
40
  DEPENDENCIES
34
- guard
41
+ guard-rspec
35
42
  ipizza!
43
+ rb-fsevent
36
44
  rspec (~> 2.6.0)
data/README.markdown CHANGED
@@ -1,14 +1,12 @@
1
1
  Implements iPizza protocol to communicate with Estonian Banks.
2
2
 
3
- Usage
4
- =====
3
+ # Usage
5
4
 
6
5
  Add gem dependency in your `Gemfile` and install the gem:
7
6
 
8
7
  gem 'ipizza'
9
8
 
10
- Configuration
11
- =============
9
+ # Configuration
12
10
 
13
11
  Configuration can be made in two different ways, using `Ipizza::Config.configure` block or loading configuration properties from YAML file.
14
12
 
@@ -25,8 +23,7 @@ At any time, configuration can be modified with `Ipizza::Config.configure` block
25
23
  c.swedbank_service_url = 'http://foo.bar/swedbank'
26
24
  end
27
25
 
28
- Configuration parameters
29
- ------------------------
26
+ ## Configuration parameters
30
27
 
31
28
  swedbank:
32
29
  service_url: http://foo.bar/swedbank
@@ -49,8 +46,7 @@ Configuration parameters
49
46
 
50
47
  Please note that currently only ISO-8859-4 encoding is supported with Swedbank. UTF-8 works well with other payment providers.
51
48
 
52
- Payment requests
53
- ----------------
49
+ ## Payment requests
54
50
 
55
51
  ### Building request
56
52
 
@@ -60,8 +56,7 @@ Payment requests
60
56
  )
61
57
  request = Ipizza::Provider::Swedbank.new.payment_request(@payment)
62
58
 
63
- Authentication requests
64
- -----------------------
59
+ ## Authentication requests
65
60
 
66
61
  ### Building request
67
62
 
@@ -72,33 +67,22 @@ Authentication requests
72
67
  response = Ipizza::Provider::Swedbank.new.authentication_response({'VK_PARAM_1' => 'VALUE 1', ...})
73
68
  response.valid?
74
69
 
75
- Gateway specifications
76
- ======================
70
+ # Gateway specifications
77
71
 
78
72
  This library currently works with four Estonian Banks. Here are their respective interface specifications:
79
73
 
80
74
  * [Swedbank](https://www.swedbank.ee/static/pdf/business/d2d/paymentcollection/info_banklink_techspec_est.pdf)
81
75
  * [SEB](http://www.seb.ee/ari/maksete-kogumine/maksete-kogumine-internetis/tehniline-spetsifikatsioon)
82
76
  * [Sampo](http://www.sampopank.ee/et/14732.html)
77
+ * [Krediidipank](http://www.krediidipank.ee/business/settlements/bank-link/tehniline_kirjeldus.pdf)
83
78
  * [Nordea](http://www.nordea.ee/Teenused+ärikliendile/E-lahendused/787802.html)
84
79
 
85
- Helpful links
86
- =============
80
+ # Helpful links
87
81
 
88
82
  * [Repository](http://github.com/priithaamer/ipizza)
89
83
  * [Issue tracker](http://github.com/priithaamer/ipizza/issues)
90
84
 
91
- Todo
92
- ====
93
-
94
- * Raise reasonable exception during configuration when certificates or keys cannot be loaded
95
- * Write ipizza-rails module:
96
- * Proper Rails initialization
97
- * Write Rails controller and model generator
98
- * Rails helper to generate iPizza request forms
99
-
100
- Authors
101
- =======
85
+ # Authors
102
86
 
103
87
  * Thanks to [all contributors](https://github.com/priithaamer/ipizza/graphs/contributors)!
104
88
  * Tarmo Talu (Thanks for the 7-3-1 algorithm)
data/ipizza.gemspec CHANGED
@@ -13,7 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.description = %q{Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.}
14
14
 
15
15
  s.add_development_dependency 'rspec', '~> 2.6.0'
16
- s.add_development_dependency 'guard'
16
+ s.add_development_dependency 'guard-rspec'
17
+ s.add_development_dependency 'rb-fsevent'
17
18
 
18
19
  s.files = `git ls-files`.split("\n")
19
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/lib/ipizza.rb CHANGED
@@ -11,4 +11,5 @@ require 'ipizza/provider'
11
11
  require 'ipizza/provider/swedbank'
12
12
  require 'ipizza/provider/seb'
13
13
  require 'ipizza/provider/sampo'
14
+ require 'ipizza/provider/krediidipank'
14
15
  require 'ipizza/provider/nordea'
data/lib/ipizza/config.rb CHANGED
@@ -27,7 +27,7 @@ module Ipizza
27
27
  end
28
28
 
29
29
  def method_missing(m, *args)
30
- if /^(swedbank|seb|sampo|nordea)_(.*)=$/ =~ m.to_s
30
+ if /^(swedbank|seb|sampo|krediidipank|nordea)_(.*)=$/ =~ m.to_s
31
31
  clz = Ipizza::Provider.const_get($1.capitalize)
32
32
  key = $2
33
33
  value = args.first
@@ -16,6 +16,10 @@ module Ipizza
16
16
  Ipizza::Provider::Sampo.new
17
17
  when 'sampopank'
18
18
  Ipizza::Provider::Sampo.new
19
+ when 'krep'
20
+ Ipizza::Provider::Krediidipank.new
21
+ when 'krediidipank'
22
+ Ipizza::Provider::Krediidipank.new
19
23
  when 'nordea'
20
24
  Ipizza::Provider::Nordea.new
21
25
  end
@@ -0,0 +1,50 @@
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
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module Ipizza
2
- VERSION = '0.6.1'
2
+ VERSION = '0.7.1'
3
3
  end
@@ -21,6 +21,15 @@ describe Ipizza::Provider do
21
21
  it 'returns sampo provider for "sampo" attribute' do
22
22
  Ipizza::Provider.get('sampo').should be_a(Ipizza::Provider::Sampo)
23
23
  end
24
+
25
+ it 'returns krediidipank provider for "krep" attribute' do
26
+ Ipizza::Provider.get('krep').should be_a(Ipizza::Provider::Krediidipank)
27
+ end
28
+
29
+ it 'returns krediidipank provider for "krediidipank" attribute' do
30
+ Ipizza::Provider.get('krediidipank').should be_a(Ipizza::Provider::Krediidipank)
31
+ end
32
+
24
33
  it 'returns nordea provider for "nordea" attribute' do
25
34
  Ipizza::Provider.get('nordea').should be_a(Ipizza::Provider::Nordea)
26
35
  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: 5
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
8
+ - 7
9
9
  - 1
10
- version: 0.6.1
10
+ version: 0.7.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: 2012-06-22 00:00:00 +03:00
18
+ date: 2013-04-10 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -35,7 +35,7 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: guard
38
+ name: guard-rspec
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
@@ -48,6 +48,20 @@ dependencies:
48
48
  version: "0"
49
49
  type: :development
50
50
  version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rb-fsevent
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
51
65
  description: Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.
52
66
  email:
53
67
  - priit@fraktal.ee
@@ -75,6 +89,7 @@ files:
75
89
  - lib/ipizza/payment_request.rb
76
90
  - lib/ipizza/payment_response.rb
77
91
  - lib/ipizza/provider.rb
92
+ - lib/ipizza/provider/krediidipank.rb
78
93
  - lib/ipizza/provider/nordea.rb
79
94
  - lib/ipizza/provider/nordea/authentication_request.rb
80
95
  - lib/ipizza/provider/nordea/authentication_response.rb