payments-pl 0.4.5 → 0.5.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.
- data/VERSION +1 -1
- data/lib/payments/hash_ext.rb +32 -0
- data/lib/payments/pos.rb +4 -4
- data/lib/payments/rails.rb +2 -0
- data/lib/payments/transaction.rb +11 -32
- data/lib/payments_pl.rb +5 -6
- data/payments-pl.gemspec +6 -3
- data/rails/init.rb +1 -0
- metadata +7 -4
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.0
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Payments
|
|
2
|
+
module HashExt
|
|
3
|
+
def stringify_keys
|
|
4
|
+
inject({}) do |options, (key, value)|
|
|
5
|
+
options[key.to_s] = value
|
|
6
|
+
options
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def stringify_keys!
|
|
11
|
+
keys.each do |key|
|
|
12
|
+
self[key.to_s] = delete(key)
|
|
13
|
+
end
|
|
14
|
+
self
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def symbolize_keys
|
|
18
|
+
inject({}) do |options, (key, value)|
|
|
19
|
+
options[(key.to_sym rescue key) || key] = value
|
|
20
|
+
options
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def symbolize_keys!
|
|
25
|
+
self.replace(self.symbolize_keys)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Hash
|
|
31
|
+
include Payments::HashExt
|
|
32
|
+
end
|
data/lib/payments/pos.rb
CHANGED
|
@@ -19,10 +19,10 @@ module Payments
|
|
|
19
19
|
@test_payment = !!options[:test_payment] || false
|
|
20
20
|
@add_sig = !!options[:add_sig] || false
|
|
21
21
|
|
|
22
|
-
raise PosInvalid.new('Missing pos_id parameter') if @pos_id.
|
|
23
|
-
raise PosInvalid.new('Missing pos_auth_key parameter') if @pos_auth_key.
|
|
24
|
-
raise PosInvalid.new('Missing key1 parameter') if @key1.
|
|
25
|
-
raise PosInvalid.new('Missing key2 parameter') if @key2.
|
|
22
|
+
raise PosInvalid.new('Missing pos_id parameter') if @pos_id.nil? || @pos_id == ''
|
|
23
|
+
raise PosInvalid.new('Missing pos_auth_key parameter') if @pos_auth_key.nil? || @pos_auth_key == ''
|
|
24
|
+
raise PosInvalid.new('Missing key1 parameter') if @key1.nil? || @key1 == ''
|
|
25
|
+
raise PosInvalid.new('Missing key2 parameter') if @key2.nil? || @key2 == ''
|
|
26
26
|
raise PosInvalid.new("Invalid type parameter, expected one of these: #{Payments::POS_TYPES.join(', ')}") unless Payments::POS_TYPES.include?(@type)
|
|
27
27
|
raise PosInvalid.new("Invalid encoding parameter, expected one of these: #{Payments::ENCODINGS.join(', ')}") unless Payments::ENCODINGS.include?(@encoding)
|
|
28
28
|
end
|
data/lib/payments/transaction.rb
CHANGED
|
@@ -1,38 +1,17 @@
|
|
|
1
1
|
module Payments
|
|
2
|
-
class Transaction
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
class Transaction
|
|
3
|
+
attr_accessor :pos_id, :pos_auth_key, :pay_type, :session_id, :amount, :desc,
|
|
4
|
+
:order_id, :desc2, :trs_desc, :first_name, :last_name, :street, :street_hn,
|
|
5
|
+
:street_an, :city, :post_code, :country, :email, :phone, :language, :client_ip,
|
|
6
|
+
:js, :payback_login, :sig, :ts
|
|
6
7
|
|
|
7
|
-
def
|
|
8
|
-
|
|
9
|
-
end
|
|
8
|
+
def initialize(options)
|
|
9
|
+
options.stringify_keys!
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
column :amount, :integer
|
|
16
|
-
column :desc, :text
|
|
17
|
-
column :order_id, :integer
|
|
18
|
-
column :desc2, :text
|
|
19
|
-
column :trs_desc, :string
|
|
20
|
-
column :first_name, :string
|
|
21
|
-
column :last_name, :string
|
|
22
|
-
column :street, :string
|
|
23
|
-
column :street_hn, :string
|
|
24
|
-
column :street_an, :string
|
|
25
|
-
column :city, :string
|
|
26
|
-
column :post_code, :string
|
|
27
|
-
column :country, :string
|
|
28
|
-
column :email, :string
|
|
29
|
-
column :phone, :string
|
|
30
|
-
column :language, :string
|
|
31
|
-
column :client_ip, :string
|
|
32
|
-
column :js, :string
|
|
33
|
-
column :payback_login, :string
|
|
34
|
-
column :sig, :string
|
|
35
|
-
column :ts, :string
|
|
11
|
+
options.each do |k, v|
|
|
12
|
+
send("#{k}=", v)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
36
15
|
|
|
37
16
|
# Returns Pos object for current transaction
|
|
38
17
|
# @return [Object] Pos object
|
data/lib/payments_pl.rb
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
require 'yaml'
|
|
2
|
+
require 'active_support'
|
|
3
|
+
|
|
1
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
2
5
|
|
|
3
6
|
require 'payments/pos'
|
|
@@ -56,8 +59,7 @@ module Payments
|
|
|
56
59
|
class << self
|
|
57
60
|
|
|
58
61
|
# Loads payments.yml file and creates specified Pos objects
|
|
59
|
-
def init
|
|
60
|
-
filename = File.join(Rails.root, 'config', 'payments.yml')
|
|
62
|
+
def init(filename)
|
|
61
63
|
if File.exist?(filename)
|
|
62
64
|
config = YAML.load_file(filename)
|
|
63
65
|
config.each do |k, v|
|
|
@@ -103,7 +105,4 @@ module Payments
|
|
|
103
105
|
ERRORS[error_code.to_i]
|
|
104
106
|
end
|
|
105
107
|
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
Payments.init
|
|
109
|
-
ActionView::Base.send(:include, Payments::ViewHelpers)
|
|
108
|
+
end
|
data/payments-pl.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{payments-pl}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.5.0"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Micha\305\202 M\305\202o\305\272niak"]
|
|
12
|
-
s.date = %q{2010-08-
|
|
12
|
+
s.date = %q{2010-08-21}
|
|
13
13
|
s.description = %q{Simple library for payments via platnosci.pl}
|
|
14
14
|
s.email = %q{m.mlozniak@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -88,11 +88,14 @@ Gem::Specification.new do |s|
|
|
|
88
88
|
"doc/js/jquery.js",
|
|
89
89
|
"doc/method_list.html",
|
|
90
90
|
"doc/top-level-namespace.html",
|
|
91
|
+
"lib/payments/hash_ext.rb",
|
|
91
92
|
"lib/payments/pos.rb",
|
|
93
|
+
"lib/payments/rails.rb",
|
|
92
94
|
"lib/payments/transaction.rb",
|
|
93
95
|
"lib/payments/view_helpers.rb",
|
|
94
96
|
"lib/payments_pl.rb",
|
|
95
|
-
"payments-pl.gemspec"
|
|
97
|
+
"payments-pl.gemspec",
|
|
98
|
+
"rails/init.rb"
|
|
96
99
|
]
|
|
97
100
|
s.homepage = %q{http://github.com/ronin/payments-pl}
|
|
98
101
|
s.rdoc_options = ["--charset=UTF-8"]
|
data/rails/init.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'payments/rails'
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: payments-pl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 11
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
- 4
|
|
9
8
|
- 5
|
|
10
|
-
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.5.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- !binary |
|
|
@@ -17,7 +17,7 @@ autorequire:
|
|
|
17
17
|
bindir: bin
|
|
18
18
|
cert_chain: []
|
|
19
19
|
|
|
20
|
-
date: 2010-08-
|
|
20
|
+
date: 2010-08-21 00:00:00 +02:00
|
|
21
21
|
default_executable:
|
|
22
22
|
dependencies: []
|
|
23
23
|
|
|
@@ -102,11 +102,14 @@ files:
|
|
|
102
102
|
- doc/js/jquery.js
|
|
103
103
|
- doc/method_list.html
|
|
104
104
|
- doc/top-level-namespace.html
|
|
105
|
+
- lib/payments/hash_ext.rb
|
|
105
106
|
- lib/payments/pos.rb
|
|
107
|
+
- lib/payments/rails.rb
|
|
106
108
|
- lib/payments/transaction.rb
|
|
107
109
|
- lib/payments/view_helpers.rb
|
|
108
110
|
- lib/payments_pl.rb
|
|
109
111
|
- payments-pl.gemspec
|
|
112
|
+
- rails/init.rb
|
|
110
113
|
has_rdoc: true
|
|
111
114
|
homepage: http://github.com/ronin/payments-pl
|
|
112
115
|
licenses: []
|