paykassa 0.1.15 → 0.1.18

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: 89253b68b012458e0be950f7a67bd2f146e8fbce8c3b8020ff50188a22261ada
4
- data.tar.gz: cf90611e7c91685a21d09957d2112479859dffc90ca3f16369ea971c17ebfc5b
3
+ metadata.gz: 9ca6c7d9fae130410993885a70ac79f73f0931ea070b3a2764930ebe0a4c5f60
4
+ data.tar.gz: 47ac9b82c7a7a72cdd3f6fa20bd98ac1f66c67883cafc8e4ae5c0c62d79f6604
5
5
  SHA512:
6
- metadata.gz: 52f9ed30bb2cd87f885c6d2d9518341b995407556d86fa69c79c3cf97370214c9963cc7762dd9791fc577fd4832fd5407ef4f9198b5737e713a0d9715350e217
7
- data.tar.gz: e282b93c3408baf0f5b39209ac21ad21bd931a4b8dc7b4fe65b22fbd8b729e14ebaf9f116f96144a28bda883fdbef6a776ba5ac17fca91b52df36f9af0470f64
6
+ metadata.gz: 7bf84147032c2715e7aa57fa5516f1ad16559ef3085af263784147ce47e0936ac665e82e422cced940dd0cbd353c8992719babf66c15b903e3500d40b05769d6
7
+ data.tar.gz: c9f55bc8ff40546c6da604404833fbb7ae44e3e66c61bfe1e6b9b522425fdad726e414b49d008de5350fffe3f22e0426e48e59c099f5c38cafe17433aeaf94c7
@@ -2,24 +2,61 @@ require 'net/http'
2
2
 
3
3
  class PaykassaOrder
4
4
  BASE_SCI_URI = URI('https://paykassa.pro/sci/0.3/index.php')
5
-
5
+ CURRENCIES=[
6
+ "USD", "RUB", "BTC", "ETH", "LTC", "DOGE", "DASH", "BCH", "ZEC",
7
+ "XRP", "TRX", "XLM", "BNB", "USDT", "ADA", "EOS", "GBP", "EUR",
8
+ "USDC", "BUSD"
9
+ ]
10
+ SYSTEM_IDS = {
11
+ perfectmoney: 2,
12
+ berty: 7,
13
+ bitcoin: 11,
14
+ ethereum: 12,
15
+ litecoin: 14,
16
+ dogecoin: 15,
17
+ dash: 16,
18
+ bitcoincash: 18,
19
+ zcash: 19,
20
+ ripple: 22,
21
+ tron: 27,
22
+ stellar: 28,
23
+ binancecoin: 29,
24
+ tron_trc20: 30,
25
+ binancesmartchain_bep20: 31, # available currencies USDT, BUSD, USDC, ADA, EOS, BTC, ETH, DOGE
26
+ ethereum_erc20: 32
27
+ }
6
28
 
7
29
  # def initialize(auth)
8
30
  # where auth has keys: sci_id, sci_key, domain
9
- def initialize(auth, logger = nil)
31
+ def initialize(auth, logger = nil, test = false)
10
32
  @logger = logger
11
33
  @_auth = auth
34
+ @test = test
12
35
  end
13
36
 
14
37
  # Request for create order
15
- def create_order(amount:, currency:, order_id:, comment:, system:)
38
+ def create_order(amount: , currency:, order_id:, paid_commision: , comment:, system:)
16
39
  make_request(
17
40
  func: :sci_create_order,
18
41
  amount: amount,
19
42
  currency: currency,
20
43
  order_id: order_id,
44
+ phone: "false",
45
+ paid_commission: paid_commision,
46
+ comment: comment,
47
+ system: SYSTEM_IDS[system]
48
+ )
49
+ end
50
+ def get_data(amount: , currency:, order_id:, paid_commission: , comment:, system:)
51
+ make_request(
52
+ func: :sci_create_order_get_data,
53
+ amount: amount,
54
+ currency: currency,
55
+ order_id: order_id,
56
+ phone: "false",
57
+ paid_commission: paid_commission,
21
58
  comment: comment,
22
- system: system
59
+ system: SYSTEM_IDS[system]
23
60
  )
24
61
  end
25
62
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paykassa
4
- VERSION = "0.1.15"
4
+ VERSION = "0.1.18"
5
5
  end
data/lib/paykassa.rb CHANGED
@@ -10,7 +10,7 @@ module Paykassa
10
10
  def initialize(domain:, sci_id:, sci_key:, api_id: nil, api_key: nil, test:, logger: nil)
11
11
  @logger = Logger.new(logger) unless logger.nil?
12
12
 
13
- @paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key}, @logger)
13
+ @paykassa_order = PaykassaOrder.new({domain: domain, sci_id: sci_id, sci_key: sci_key}, @logger, test)
14
14
  if api_id.nil?
15
15
  @paykassa_pay = nil
16
16
  else
@@ -42,13 +42,26 @@ module Paykassa
42
42
  def rate(c_in, c_out)
43
43
  @paykassa_pay.currency_rate(c_in, c_out)
44
44
  end
45
-
46
- def create_order(amount:, currency:, order_id:, system:, comment: "from paykassa gem")
45
+ def get_order_address(amount: , currency:, order_id:, paid_commission: , comment: "from paykassa gem", system:)
46
+ order = @paykassa_order.get_data( amount: amount,
47
+ currency: currency,
48
+ order_id: order_id,
49
+ phone: "false",
50
+ paid_commission: paid_commission,
51
+ comment: comment,
52
+ system: system
53
+ )
54
+ raise StandardError.new(order[:message]) if order[:error]
55
+ order
56
+ end
57
+ def create_order(amount: , currency:, order_id:, paid_commision: , comment: "from paykassa gem", system:)
47
58
  order = @paykassa_order.create_order(
48
- amount: amount,
49
- currency: currency,
50
- order_id: order_id,
51
- comment: comment,
59
+ amount: amount,
60
+ currency: currency,
61
+ order_id: order_id,
62
+ phone: "false",
63
+ paid_commission: paid_commision,
64
+ comment: comment,
52
65
  system: system
53
66
  )
54
67
  raise StandardError.new(order[:message]) if order[:error]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paykassa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - nottewae
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-11 00:00:00.000000000 Z
11
+ date: 2022-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet