payu 0.7.1 → 0.7.2
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 -12
- data/.travis.yml +13 -0
- data/Gemfile +1 -0
- data/README.md +3 -0
- data/Rakefile +6 -1
- data/lib/payu.rb +1 -1
- data/lib/payu/gateway.rb +3 -0
- data/lib/payu/helpers.rb +2 -0
- data/lib/payu/response.rb +8 -1
- data/lib/payu/signature.rb +7 -4
- data/lib/payu/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ODVkMzI1MTgzYmUzZjI5OGFhNDUyNmJhZWY0Mzc3MDYyM2JjOTFiYg==
|
3
|
+
metadata.gz: bd89d40d903eb3071605ebcb73c6a5ef076fe99b
|
4
|
+
data.tar.gz: bff9e1d8f70f53d4273d0494cc969021cdfb7633
|
7
5
|
!binary "U0hBNTEy":
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZDk0NTk5ZDc5OTcxNWU2YzljOWJkN2RlYmZjOTIyMjYxMTI1MzkyOTBiODg2
|
11
|
-
Yjg2OGY1Njk2Y2UzYzc0N2RjYTQ3OTkzNjI4NGIxNDZlNTY1ZmI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OWQwNjMwZjM1MjdiZDQ4MDIxNTE4ODQ0ZjZhMzMwMjhmMDQ0NmEyZWJmNjg1
|
14
|
-
YTdjNWE2ZDIwNTMxNDU1MWUxNjk2MWY3N2VkNWQxYjYzZGNlYThjY2ZkNTY1
|
15
|
-
MjA4ZmZkZjEzZTNiNWQxNTFjYzAxZTk5MTVlNjEyODMzMzJkNjM=
|
6
|
+
metadata.gz: c8c2b53abdc3fffed22a2abffc276ef0c54e44891a57026c585f4373e9b542a507590434bbeb9fe206bf38ecbe3bb8b0414ae36059471ec5d5aa14a60b0794a3
|
7
|
+
data.tar.gz: db52155ab82eecba64541f3e62fe732c7d50c1f30d15482b5d6144da7c9bd2c496892483b00964ab662b76b9ca68d53345de39cb3f61d944714e7843f471da6c
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,9 @@ Simple library for accepting payments via PayU.
|
|
4
4
|
|
5
5
|
By [Visuality](http://www.visuality.pl).
|
6
6
|
|
7
|
+
[](http://travis-ci.org/ronin/payu)
|
8
|
+
[](https://codeclimate.com/github/ronin/payu)
|
9
|
+
|
7
10
|
## Features
|
8
11
|
|
9
12
|
* No dependencies on ActiveSupport or any similar libraries, so it should work in any Ruby application or framework
|
data/Rakefile
CHANGED
data/lib/payu.rb
CHANGED
@@ -22,7 +22,7 @@ module Payu
|
|
22
22
|
|
23
23
|
class << self
|
24
24
|
|
25
|
-
# Loads
|
25
|
+
# Loads configuration from specified YAML file creates Pos objects
|
26
26
|
def load_pos_from_yaml(filename)
|
27
27
|
if File.exist?(filename)
|
28
28
|
config = YAML.load_file(filename)
|
data/lib/payu/gateway.rb
CHANGED
@@ -14,14 +14,17 @@ module Payu
|
|
14
14
|
@pos_id = options[:pos_id]
|
15
15
|
end
|
16
16
|
|
17
|
+
# Gets transaction status
|
17
18
|
def get(session_id)
|
18
19
|
send_request("/paygw/#{encoding}/Payment/get/txt", session_id)
|
19
20
|
end
|
20
21
|
|
22
|
+
# Confirms transaction
|
21
23
|
def confirm(session_id)
|
22
24
|
send_request("/paygw/#{encoding}/Payment/confirm/txt", session_id)
|
23
25
|
end
|
24
26
|
|
27
|
+
# Cancels transaction
|
25
28
|
def cancel(session_id)
|
26
29
|
send_request("/paygw/#{encoding}/Payment/cancel/txt", session_id)
|
27
30
|
end
|
data/lib/payu/helpers.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
module Payu
|
4
4
|
module Helpers
|
5
|
+
# Generates form fields for specified transaction object
|
5
6
|
def payu_hidden_fields(transaction)
|
6
7
|
html = ""
|
7
8
|
|
@@ -17,6 +18,7 @@ module Payu
|
|
17
18
|
html.html_safe
|
18
19
|
end
|
19
20
|
|
21
|
+
# Verifies signature of passed parameters from Payu request
|
20
22
|
def payu_verify_params(params)
|
21
23
|
pos_id = params['pos_id']
|
22
24
|
pos = Payu[pos_id]
|
data/lib/payu/response.rb
CHANGED
@@ -4,13 +4,20 @@ module Payu
|
|
4
4
|
class Response < OpenStruct
|
5
5
|
PATTERN = /^(\w+):(?:[ ])?(.*)$/
|
6
6
|
|
7
|
+
# Parses text response from Payu gateway
|
7
8
|
def self.parse(body)
|
8
9
|
temp = body.gsub("\r", "")
|
9
10
|
data = temp.scan(PATTERN)
|
10
11
|
|
11
|
-
|
12
|
+
data_hash = {}
|
13
|
+
data.each do |element|
|
14
|
+
data_hash[element[0]] = element[1]
|
15
|
+
end
|
16
|
+
|
17
|
+
new(data_hash)
|
12
18
|
end
|
13
19
|
|
20
|
+
# Checks if transaction was completed (payment received)
|
14
21
|
def completed?
|
15
22
|
trans_status.to_i == 99
|
16
23
|
end
|
data/lib/payu/signature.rb
CHANGED
@@ -7,12 +7,15 @@ module Payu
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class Signature
|
10
|
-
|
11
|
-
|
10
|
+
|
11
|
+
# Generates md5 signature for specified values
|
12
|
+
def self.generate(*values)
|
13
|
+
Digest::MD5.hexdigest(values.join)
|
12
14
|
end
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
# Verifies signature for specified values
|
17
|
+
def self.verify!(expected, *values)
|
18
|
+
raise SignatureInvalid if expected != generate(values)
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
data/lib/payu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Młoźniak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simple integration with PayU gateway
|
14
14
|
email: michal.mlozniak@visuality.pl
|
@@ -16,8 +16,9 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
-
- .gitignore
|
20
|
-
- .rspec
|
19
|
+
- ".gitignore"
|
20
|
+
- ".rspec"
|
21
|
+
- ".travis.yml"
|
21
22
|
- Gemfile
|
22
23
|
- LICENSE
|
23
24
|
- README.md
|
@@ -46,17 +47,17 @@ require_paths:
|
|
46
47
|
- lib
|
47
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
48
49
|
requirements:
|
49
|
-
- -
|
50
|
+
- - ">="
|
50
51
|
- !ruby/object:Gem::Version
|
51
52
|
version: '0'
|
52
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
54
|
requirements:
|
54
|
-
- -
|
55
|
+
- - ">="
|
55
56
|
- !ruby/object:Gem::Version
|
56
57
|
version: '0'
|
57
58
|
requirements: []
|
58
59
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.0.
|
60
|
+
rubygems_version: 2.0.0.preview3.1
|
60
61
|
signing_key:
|
61
62
|
specification_version: 4
|
62
63
|
summary: Simple integration with PayU gateway
|