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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c0f2498ccdce8c0c0832a7f19fa3584d1fc325196b1f75c21a822da9858de18
4
- data.tar.gz: 00ce0871d37bdf255ff45611af9676fd7abeefe497f59cbb5ce316a1a956eb4e
3
+ metadata.gz: 97ac6966e736f2779ec3b847fc2bf88ee3b3192d1601512ecc94118078942d54
4
+ data.tar.gz: bdf6715b98585c00d3a6705e1043dcebdbf7a3995d6a4c11230f994bd5677b7c
5
5
  SHA512:
6
- metadata.gz: abdc74633407d1181db6cc9dc83955db47969936b50e5528b5e15b2704f82265ce2e842b411d8b6d50919ac87abf823b50ed6f09c9cc281b40306e6553946a32
7
- data.tar.gz: 100f0cff3c7fe02e23f29a77cab144ada554bb675e9d7c7ba663b07ace2cc03b80b487180d2f38c51f266e8e67f691099f1ac951a3b2b6a7f2c7728077867b6f
6
+ metadata.gz: 1e74e4b7e184840bc564c28937f1f858d18a8a373e641b23dd0e700fc908242d8da7d0adb45bd774801730e4f6b92dcf07d7211508ae8108708f8f4d4918c208
7
+ data.tar.gz: 2d300c7b4fc22958285a2625deeff6d9e4f263faf19765d4a263f3e317c8a6f734d96751a8fa1c3395b446f1ecc99b57a16971cf3245b1aebcb406bc0e63866b
@@ -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_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
 
@@ -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.13"
5
5
  end
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
- @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
+
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
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.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - nottewae