paykassa 0.1.10 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paykassa/order.rb +2 -1
- data/lib/paykassa/pay.rb +8 -2
- data/lib/paykassa/version.rb +1 -1
- data/lib/paykassa.rb +6 -3
- 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: 97ac6966e736f2779ec3b847fc2bf88ee3b3192d1601512ecc94118078942d54
|
4
|
+
data.tar.gz: bdf6715b98585c00d3a6705e1043dcebdbf7a3995d6a4c11230f994bd5677b7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e74e4b7e184840bc564c28937f1f858d18a8a373e641b23dd0e700fc908242d8da7d0adb45bd774801730e4f6b92dcf07d7211508ae8108708f8f4d4918c208
|
7
|
+
data.tar.gz: 2d300c7b4fc22958285a2625deeff6d9e4f263faf19765d4a263f3e317c8a6f734d96751a8fa1c3395b446f1ecc99b57a16971cf3245b1aebcb406bc0e63866b
|
data/lib/paykassa/order.rb
CHANGED
data/lib/paykassa/pay.rb
CHANGED
@@ -27,7 +27,8 @@ class PaykassaPay
|
|
27
27
|
binancesmartchain_bep20: 31, # available currencies USDT, BUSD, USDC, ADA, EOS, BTC, ETH, DOGE
|
28
28
|
ethereum_erc20: 32
|
29
29
|
}
|
30
|
-
def initialize(domain:, api_id:, api_key:, test: false)
|
30
|
+
def initialize(domain:, api_id:, api_key:, test: false, logger: nil)
|
31
|
+
@logger.info("Initialize class Pay with params: domain: #{domain}, api_id: #{api_id}, api_key: #{api_key}, test: #{test}") if !@logger.nil?
|
31
32
|
@token = api_key
|
32
33
|
@_auth = {domain: domain, api_id: api_id, api_key: api_key, test: test}
|
33
34
|
end
|
@@ -42,6 +43,7 @@ class PaykassaPay
|
|
42
43
|
tag: tag,
|
43
44
|
priority: priority
|
44
45
|
}
|
46
|
+
@logger.info("Pay.pay with data: #{data.inspect}") if !@logger.nil?
|
45
47
|
make_request("api_payment",data)
|
46
48
|
end
|
47
49
|
def balance(shop: )
|
@@ -50,6 +52,7 @@ class PaykassaPay
|
|
50
52
|
pi_id: @_auth[:api_id],
|
51
53
|
api_key: @_auth[:api_key]
|
52
54
|
}
|
55
|
+
@logger.info("Pay.balance with data: #{data.inspect}") if !@logger.nil?
|
53
56
|
make_request("api_get_shop_balance", data, false)
|
54
57
|
end
|
55
58
|
def currency_rate(inn:,out:)
|
@@ -63,6 +66,7 @@ class PaykassaPay
|
|
63
66
|
currency_in: inn,
|
64
67
|
currency_out: out
|
65
68
|
}
|
69
|
+
@logger.info("Pay.currency_rate with data: #{data.inspect}") if !@logger.nil?
|
66
70
|
make_request(
|
67
71
|
nil,
|
68
72
|
data,
|
@@ -74,8 +78,10 @@ class PaykassaPay
|
|
74
78
|
def make_request(func,data,merge_auth = true, url= nil)
|
75
79
|
data = data.merge({func: func}) if !func.nil?
|
76
80
|
data = data.merge(@_auth) if merge_auth
|
77
|
-
url =
|
81
|
+
url = BASE_URL if url.nil?
|
82
|
+
@logger.info("private Pay.make_request with params: url: #{url.inspect}, data: #{data.inspect}") if !@logger.nil?
|
78
83
|
res = Net::HTTP.post_form(url, data)
|
84
|
+
@logger.info("private Pay.make_request: result: #{res.inspect}") if !@logger.nil?
|
79
85
|
JSON.parse(res.body).deep_symbolize_keys
|
80
86
|
end
|
81
87
|
|
data/lib/paykassa/version.rb
CHANGED
data/lib/paykassa.rb
CHANGED
@@ -6,14 +6,17 @@ require_relative "paykassa/pay"
|
|
6
6
|
module Paykassa
|
7
7
|
class Error < StandardError; end
|
8
8
|
class Paykassa
|
9
|
-
def initialize(domain:, sci_id:, sci_key:, api_id: nil, api_key: nil, test:)
|
10
|
-
|
9
|
+
def initialize(domain:, sci_id:, sci_key:, api_id: nil, api_key: nil, test:, logger: nil)
|
10
|
+
|
11
|
+
@logger=logger
|
12
|
+
puts "logger paykassa: #{@logger.inspect}"
|
13
|
+
@paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key}, logger)
|
11
14
|
if api_id.nil?
|
12
15
|
@paykassa_pay = nil
|
13
16
|
else
|
14
17
|
@paykassa_pay = PaykassaPay.new(
|
15
18
|
domain: domain, api_id: api_id,
|
16
|
-
api_key: api_key, test: test
|
19
|
+
api_key: api_key, test: test, logger: logger
|
17
20
|
)
|
18
21
|
end
|
19
22
|
end
|