paykassa 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c0f2498ccdce8c0c0832a7f19fa3584d1fc325196b1f75c21a822da9858de18
4
- data.tar.gz: 00ce0871d37bdf255ff45611af9676fd7abeefe497f59cbb5ce316a1a956eb4e
3
+ metadata.gz: 75f02c4a43333d9325751145b446d9adb6cb880fbb93e3560a51bd0aefcf0ec2
4
+ data.tar.gz: 3e757fbb742a192907a536d18431329f8fc9095d9433f3879191925246a4ea29
5
5
  SHA512:
6
- metadata.gz: abdc74633407d1181db6cc9dc83955db47969936b50e5528b5e15b2704f82265ce2e842b411d8b6d50919ac87abf823b50ed6f09c9cc281b40306e6553946a32
7
- data.tar.gz: 100f0cff3c7fe02e23f29a77cab144ada554bb675e9d7c7ba663b07ace2cc03b80b487180d2f38c51f266e8e67f691099f1ac951a3b2b6a7f2c7728077867b6f
6
+ metadata.gz: c20228bfb5205cef1d295268e434aca26186a38203f919d95296c0ed75a846456c32e1edaed77107c8108f1c3bc9aab0388bc575d7f24d3a11ee6f7b211d586d
7
+ data.tar.gz: 41330b1ba2cab4604ca2d7a62a057c431ba4ff25a79a6d2a3f8291f76783fb4129cfb06ff1c80ace48bbd6219d8355451875c5ed3ba5fb6d11b0b147b065ae96
@@ -6,7 +6,8 @@ class PaykassaOrder
6
6
 
7
7
  # def initialize(auth)
8
8
  # where auth has keys: sci_id, sci_key, domain
9
- def initialize(auth)
9
+ def initialize(auth, logger = nil)
10
+ @logger = logger
10
11
  @_auth = auth
11
12
  end
12
13
 
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 = BASE_SCI_URI if url.nil?
81
+ url = BASE_URI 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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paykassa
4
- VERSION = "0.1.10"
4
+ VERSION = "0.1.11"
5
5
  end
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
- @paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key})
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paykassa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - nottewae