unitpay 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/unitpay/service.rb +16 -6
- data/lib/unitpay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f80e17e37ec40c85f65d7db95d2081bfa69d3d1
|
4
|
+
data.tar.gz: 2df24e17305806bb4930decbe2ad3322cdc6dbe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e05e226f14007a31c53ca259fd8f808639dc24efde617e718e4f844c5da1d6f3e09a9ab15608d3463c7206812832ea96ce25b824ecd82476b785f5fdbe083db3
|
7
|
+
data.tar.gz: 985a56a9a39e6358802242e29007d5ddcd590bedb0a84e6427debf9506f28d4afc10016b81e4caa8c411cb9ad91d35d82baf4ea3b4a0f386f7007d6ffe8dc188
|
data/lib/unitpay/service.rb
CHANGED
@@ -3,8 +3,8 @@ module Unitpay
|
|
3
3
|
EXTRA_OPTIONS = [:locale, :hideHint, :hideBackUrl, :hideOrderCost, :hideMenu, :hideDesc, :hideOtherMethods]
|
4
4
|
URL = 'https://unitpay.ru/pay'
|
5
5
|
|
6
|
-
def initialize(public_key, secret_key, currency = 'RUB')
|
7
|
-
@public_key, @secret_key, @currency = public_key, secret_key, currency
|
6
|
+
def initialize(public_key, secret_key, use_sign = true, currency = 'RUB')
|
7
|
+
@public_key, @secret_key, @use_sign, @currency = public_key, secret_key, use_sign, currency
|
8
8
|
end
|
9
9
|
|
10
10
|
def payment_url(sum, account, desc, options = {})
|
@@ -12,7 +12,18 @@ module Unitpay
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def payment_params(sum, account, desc, options = {})
|
15
|
-
main_params(sum, account, desc
|
15
|
+
main_params(sum, account, desc).merge(extra_params(options))
|
16
|
+
end
|
17
|
+
|
18
|
+
def params_for_widget(sum, account, desc)
|
19
|
+
{
|
20
|
+
publicKey: public_key,
|
21
|
+
sum: sum,
|
22
|
+
account: account,
|
23
|
+
desc: desc,
|
24
|
+
currency: 'RUB',
|
25
|
+
sign: calculate_sign(sum, account, desc)
|
26
|
+
}
|
16
27
|
end
|
17
28
|
|
18
29
|
def valid_sign?(current_sign, sum, account, desc)
|
@@ -25,7 +36,7 @@ module Unitpay
|
|
25
36
|
|
26
37
|
private
|
27
38
|
|
28
|
-
attr_reader :public_key, :secret_key, :currency
|
39
|
+
attr_reader :public_key, :secret_key, :currency, :use_sign
|
29
40
|
|
30
41
|
def calculate_sign(sum, account, desc)
|
31
42
|
Digest::MD5.hexdigest( [account, currency, desc, sum, secret_key].join )
|
@@ -37,8 +48,7 @@ module Unitpay
|
|
37
48
|
Digest::MD5.hexdigest(values.join)
|
38
49
|
end
|
39
50
|
|
40
|
-
def main_params(sum, account, desc
|
41
|
-
use_sign = true if use_sign.nil?
|
51
|
+
def main_params(sum, account, desc)
|
42
52
|
sign = use_sign ? { sign: calculate_sign(sum, account, desc) } : {}
|
43
53
|
|
44
54
|
{
|
data/lib/unitpay/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unitpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ssnikolay
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|