payu 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZDc2NWU3MjVkMGRjN2U0YzFlNDQzNmNlNjJmNzRkN2ZmMTZkMDI0Yg==
5
- data.tar.gz: !binary |-
6
- ODVkMzI1MTgzYmUzZjI5OGFhNDUyNmJhZWY0Mzc3MDYyM2JjOTFiYg==
3
+ metadata.gz: bd89d40d903eb3071605ebcb73c6a5ef076fe99b
4
+ data.tar.gz: bff9e1d8f70f53d4273d0494cc969021cdfb7633
7
5
  !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YjE1NzcxZTU4MTQ2ZTg4MWMyZjdmZjFjZDFlZjRjMWE2YmJhMjc2ZTI4NTFk
10
- ZDk0NTk5ZDc5OTcxNWU2YzljOWJkN2RlYmZjOTIyMjYxMTI1MzkyOTBiODg2
11
- Yjg2OGY1Njk2Y2UzYzc0N2RjYTQ3OTkzNjI4NGIxNDZlNTY1ZmI=
12
- data.tar.gz: !binary |-
13
- OWQwNjMwZjM1MjdiZDQ4MDIxNTE4ODQ0ZjZhMzMwMjhmMDQ0NmEyZWJmNjg1
14
- YTdjNWE2ZDIwNTMxNDU1MWUxNjk2MWY3N2VkNWQxYjYzZGNlYThjY2ZkNTY1
15
- MjA4ZmZkZjEzZTNiNWQxNTFjYzAxZTk5MTVlNjEyODMzMzJkNjM=
6
+ metadata.gz: c8c2b53abdc3fffed22a2abffc276ef0c54e44891a57026c585f4373e9b542a507590434bbeb9fe206bf38ecbe3bb8b0414ae36059471ec5d5aa14a60b0794a3
7
+ data.tar.gz: db52155ab82eecba64541f3e62fe732c7d50c1f30d15482b5d6144da7c9bd2c496892483b00964ab662b76b9ca68d53345de39cb3f61d944714e7843f471da6c
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.8.7"
4
+ - "1.9.2"
5
+ - "1.9.3"
6
+ - "jruby-18mode"
7
+ - "jruby-19mode"
8
+ - "rbx-18mode"
9
+ - "rbx-19mode"
10
+ - "ruby-head"
11
+ - "jruby-head"
12
+ - "ree"
13
+ - "2.0.0"
data/Gemfile CHANGED
@@ -4,5 +4,6 @@ source "http://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  group :test do
7
+ gem 'rake'
7
8
  gem 'rspec'
8
9
  end
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
+ [![Build Status](https://api.travis-ci.org/ronin/payu.png?branch=master)](http://travis-ci.org/ronin/payu)
8
+ [![Code Climate](https://codeclimate.com/github/ronin/payu.png)](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
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :default => :spec
5
+
6
+ RSpec::Core::RakeTask.new
@@ -22,7 +22,7 @@ module Payu
22
22
 
23
23
  class << self
24
24
 
25
- # Loads payments.yml file and creates specified Pos objects
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)
@@ -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
@@ -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]
@@ -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
- new(data)
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
@@ -7,12 +7,15 @@ module Payu
7
7
  end
8
8
 
9
9
  class Signature
10
- def self.generate(*params)
11
- Digest::MD5.hexdigest(params.join)
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
- def self.verify!(expected, *params)
15
- raise SignatureInvalid if expected != generate(params)
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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Payu
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
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.1
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-15 00:00:00.000000000 Z
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.3
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