paykassa 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paykassa/pay.rb +7 -3
- data/lib/paykassa/version.rb +1 -1
- data/lib/paykassa.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5b2f4e36c9dc2f7cece9acef9244b198e7137b59723089fd3d6c0387f961fe1
|
4
|
+
data.tar.gz: ab64534aa56630e37f457c95ad98d06345b9f61061db48461e57da5be87c487b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93e815ffd6c6cdf4b624cbdb0b3396ce098b3dfe49ef5133520a1a6a4c41c45ef5d5d57d175759bed01acfcd723fa468ef3cb69daf23f336405f7cedfe45bffd
|
7
|
+
data.tar.gz: 11a8fb9d2daa53cbbc3dd96723656f47f1bebf6383265fdbab1d8ac9851e8aa488daa27548bcecd0350e8cb9f1a238ba6d68c4d5127ab0553614bc4ef05c4203
|
data/lib/paykassa/pay.rb
CHANGED
@@ -58,16 +58,20 @@ class PaykassaPay
|
|
58
58
|
if !CURRENCIES.include? out
|
59
59
|
raise "#{out} not include in currencies: #{CURRENCIES}"
|
60
60
|
end
|
61
|
-
|
61
|
+
data = {
|
62
62
|
currency_in: inn,
|
63
|
-
currency_out: out
|
63
|
+
currency_out: out
|
64
|
+
}
|
65
|
+
make_request(
|
66
|
+
nil,
|
67
|
+
data,
|
64
68
|
false,
|
65
69
|
RATE_URL
|
66
70
|
)
|
67
71
|
end
|
68
72
|
private
|
69
73
|
def make_request(func,data,merge_auth = true, url= nil)
|
70
|
-
data = data.merge({func: func})
|
74
|
+
data = data.merge({func: func}) if func
|
71
75
|
data = data.merge(@_auth) if merge_auth
|
72
76
|
url = BASE_SCI_URI if url.nil?
|
73
77
|
res = Net::HTTP.post_form(url, data)
|
data/lib/paykassa/version.rb
CHANGED
data/lib/paykassa.rb
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
require_relative "paykassa/version"
|
4
4
|
require_relative "paykassa/order"
|
5
|
+
require_relative "paykassa/pay"
|
5
6
|
module Paykassa
|
6
7
|
class Error < StandardError; end
|
7
8
|
class Paykassa
|
8
|
-
def initialize(domain
|
9
|
+
def initialize(domain:, sci_id:, sci_key:, api_id: nil, api_key: nil, test:)
|
9
10
|
@paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key})
|
10
11
|
if api_id.nil?
|
11
12
|
@paykassa_pay = nil
|
@@ -17,6 +18,7 @@ module Paykassa
|
|
17
18
|
)
|
18
19
|
end
|
19
20
|
end
|
21
|
+
|
20
22
|
def pay(amount: , shop: , currency: , system_name: , paid_commission: "shop", number:, tag:, priority:)
|
21
23
|
raise "api_key not present!" if @paykassa_pay.nil?
|
22
24
|
@paykassa_pay.pay({
|
@@ -30,6 +32,7 @@ module Paykassa
|
|
30
32
|
priority: priority
|
31
33
|
})
|
32
34
|
end
|
35
|
+
|
33
36
|
def balance(shop:)
|
34
37
|
raise "api_key not present!" if @paykassa_pay.nil?
|
35
38
|
@paykassa_pay.balance(shop: shop)
|
@@ -37,10 +40,8 @@ module Paykassa
|
|
37
40
|
def rate(c_in, c_out)
|
38
41
|
@paykassa_pay.currency_rate(c_in, c_out)
|
39
42
|
end
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
def create_order(amount, currency, order_id, system, comment="from paykassa gem")
|
43
|
+
|
44
|
+
def create_order(amount:, currency:, order_id:, system:, comment: "from paykassa gem")
|
44
45
|
order = @paykassa_order.create_order(
|
45
46
|
amount: amount,
|
46
47
|
currency: currency,
|
@@ -51,7 +52,7 @@ module Paykassa
|
|
51
52
|
raise StandardError.new(order[:message]) if order[:error]
|
52
53
|
url = order[:data][:url]
|
53
54
|
end
|
54
|
-
def confirm_order(hash)
|
55
|
+
def confirm_order(hash:)
|
55
56
|
result = @paykassa_order.confirm_order(hash)
|
56
57
|
raise StandardError.new(result[:message]) if result[:error]
|
57
58
|
order_id = res[:data][:order_id]
|