onpayruclient 0.0.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/README +0 -0
- data/lib/onpayruclient.rb +64 -0
- metadata +56 -0
data/README
ADDED
File without changes
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'digest/md5'
|
5
|
+
require 'builder'
|
6
|
+
|
7
|
+
module OnPayRuClient
|
8
|
+
VERSION = '0.0.1'
|
9
|
+
|
10
|
+
class Client
|
11
|
+
attr_accessor :login, :key, :url
|
12
|
+
|
13
|
+
def initialize(login, key, url)
|
14
|
+
@login = login
|
15
|
+
@key = key
|
16
|
+
@url = url
|
17
|
+
end
|
18
|
+
|
19
|
+
def check(type, pay_for, amount, order_currency, code)
|
20
|
+
md5 = Digest::MD5.hexdigest(
|
21
|
+
type.to_s + ";" + pay_for.to_s + ";" + amount.to_s + ";" +
|
22
|
+
order_currency.to_s + ";" + code.to_s + ";" + @key.to_s
|
23
|
+
).upcase
|
24
|
+
|
25
|
+
query = String.new
|
26
|
+
xml = Builder::XmlMarkup.new(:target => query)
|
27
|
+
|
28
|
+
xml.result {
|
29
|
+
xml.code code.to_s
|
30
|
+
xml.pay_for pay_for.to_s
|
31
|
+
xml.comment "OK"
|
32
|
+
xml.md5 md5.to_s
|
33
|
+
}
|
34
|
+
|
35
|
+
return query
|
36
|
+
end
|
37
|
+
|
38
|
+
def pay(type, pay_for, onpay_id, order_id, amount, order_currency, code)
|
39
|
+
md5 = Digest::MD5.hexdigest(
|
40
|
+
type.to_s + ";" + pay_for.to_s + ";" + onpay_id.to_s + ";" +
|
41
|
+
order_id.to_s + ";" + amount.to_s + ";" + order_currency.to_s + ";" +
|
42
|
+
code.to_s + ";" + @key.to_s
|
43
|
+
).upcase
|
44
|
+
|
45
|
+
query = String.new
|
46
|
+
xml = Builder::XmlMarkup.new(:target => query)
|
47
|
+
|
48
|
+
xml.result {
|
49
|
+
xml.code code.to_s
|
50
|
+
xml.comment "OK"
|
51
|
+
xml.onpay_id onpay_id.to_s
|
52
|
+
xml.pay_for pay_for.to_s
|
53
|
+
xml.order_id order_id.to_s
|
54
|
+
xml.md5 md5.to_s
|
55
|
+
}
|
56
|
+
|
57
|
+
return query
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_url(pay_for, amount, email, url_success, url_fail)
|
61
|
+
return "http://secure.onpay.ru/pay/#{@login}?pay_mode=fix&price=#{amount.to_s}&pay_for=#{pay_for.to_s}&user_email=#{email}&url_success=#{url_success}&url_fail=#{url_fail}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: onpayruclient
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nikolay BUrlov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-07-06 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: OnPayRu Service Consumer
|
17
|
+
email:
|
18
|
+
- kohgpat@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- README
|
27
|
+
- lib/onpayruclient.rb
|
28
|
+
homepage: http://github.com/kohgpat/onpayruclient
|
29
|
+
licenses: []
|
30
|
+
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: "0"
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.6
|
48
|
+
requirements: []
|
49
|
+
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 1.8.5
|
52
|
+
signing_key:
|
53
|
+
specification_version: 3
|
54
|
+
summary: OnPayRu Service Consumer
|
55
|
+
test_files: []
|
56
|
+
|