paykassa 0.1.9 → 0.1.12
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 +12 -6
- data/lib/paykassa/version.rb +1 -1
- data/lib/paykassa.rb +4 -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: 66e7ca1344f94243c132cb9b2c33e795d0df597f4230f1d2d1d7f19c1900fe0d
|
4
|
+
data.tar.gz: 1d859254cb366502c46c58b98941b413d0eaf421faccffa3d0685ee06a1d3567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95b4388874b808ace088fe7f9f1639fd251fb3f02c445d4c1c935e0da6680aa50f8019b19ed48f1ed06cb484b92c53074d52351db5065be1405e29c9494f74d1
|
7
|
+
data.tar.gz: 95cfeacd0ddc674b4ef9761c6bdf354732a18f0c2acd806f3c476fed8200882327e1e1838b7037ef307b127f722df9fada8818f3ee7756db443a69ae99de6f04
|
data/lib/paykassa/order.rb
CHANGED
data/lib/paykassa/pay.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
|
3
3
|
class PaykassaPay
|
4
|
-
BASE_URL = "https://paykassa.app/api/0.5/index.php"
|
5
|
-
RATE_URL = "https://currency.paykassa.pro/index.php"
|
6
|
-
BASE_SCI_URI = 'https://paykassa.pro/sci/0.3/index.php'
|
4
|
+
BASE_URL = URI("https://paykassa.app/api/0.5/index.php")
|
5
|
+
RATE_URL = URI("https://currency.paykassa.pro/index.php")
|
6
|
+
BASE_SCI_URI = URI('https://paykassa.pro/sci/0.3/index.php')
|
7
7
|
CURRENCIES=[
|
8
8
|
"USD", "RUB", "BTC", "ETH", "LTC", "DOGE", "DASH", "BCH", "ZEC",
|
9
9
|
"XRP", "TRX", "XLM", "BNB", "USDT", "ADA", "EOS", "GBP", "EUR",
|
@@ -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,
|
@@ -72,10 +76,12 @@ class PaykassaPay
|
|
72
76
|
end
|
73
77
|
private
|
74
78
|
def make_request(func,data,merge_auth = true, url= nil)
|
75
|
-
data = data.merge({func: func}) if func
|
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,15 @@ 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
|
+
@logger=logger
|
11
|
+
@paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key}, logger)
|
11
12
|
if api_id.nil?
|
12
13
|
@paykassa_pay = nil
|
13
14
|
else
|
14
15
|
@paykassa_pay = PaykassaPay.new(
|
15
16
|
domain: domain, api_id: api_id,
|
16
|
-
api_key: api_key, test: test
|
17
|
+
api_key: api_key, test: test, logger: logger
|
17
18
|
)
|
18
19
|
end
|
19
20
|
end
|