paykassa 0.1.16 → 0.1.19

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: 8f08dc918608da07c348a716eb133e57187372b3158adc369bbbb0cb41a6cf53
4
- data.tar.gz: 68bc52b31422fb2786d8ee7e0f998ecac762e2b4143114e92cdb876e6986075d
3
+ metadata.gz: 70a713697194fdb5fd26d597affdbd11f99ede103c580120f9ec6a4ede4c8b4e
4
+ data.tar.gz: 850ad95ef63c237a96723798d274b86c187c99887ca6485b36639ee1341e9f9c
5
5
  SHA512:
6
- metadata.gz: 1c4d4c81018e7276636b68f2c1b73950ba31725c9704ebd35b8e357543c2b65fe50a0f37b15a2842dfd685e6a19e8ce6e9db559b42ad9f136828f2cf20a5b10e
7
- data.tar.gz: bf549917ae04e06a5c85be261b1d3003ceae524e20c29e6afc6587898bca17b4cf008b6e262734ceedcfd230c336ca11b50fc8632e3fcb7856bb2610cbd9bb93
6
+ metadata.gz: ec7af94670998882aa912ff51649bba3644298a12cdaea7798d396087dcbc6bb6da8f336265cc0ffdb3514911cb4f0e69de096f0b4029d76f7099aaf018754c1
7
+ data.tar.gz: 6e8cf3a0a482bffd547fd9755fc9811a1b854b0a9525b0f44517fac4ad1728e051965ea2e065e8d9bd55ce007bf6fb14182982fd35b871b1670f0f0323a282b1
@@ -2,7 +2,29 @@ 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
@@ -15,28 +37,30 @@ class PaykassaOrder
15
37
  # Request for create order
16
38
  def create_order(amount: , currency:, order_id:, paid_commision: , comment:, system:)
17
39
  make_request(
18
- func: :sci_create_order,
19
- amount: amount,
20
- currency: currency,
21
- order_id: order_id,
22
- phone: "false",
23
- paid_commission: paid_commision,
24
- comment: comment,
25
- system: system,
26
- test: @test.to_s
40
+ {
41
+ func: :sci_create_order,
42
+ amount: amount,
43
+ currency: currency,
44
+ order_id: order_id,
45
+ phone: "false",
46
+ paid_commission: paid_commision,
47
+ comment: comment,
48
+ system: SYSTEM_IDS[system]
49
+ }
27
50
  )
28
51
  end
29
- def get_data(amount: , currency:, order_id:, paid_commision: , comment:, system:)
52
+ def get_data(amount: , currency:, order_id:, paid_commission: , comment:, system:)
30
53
  make_request(
31
- func: :sci_create_order_get_data,
32
- amount: amount,
33
- currency: currency,
34
- order_id: order_id,
35
- phone: "false",
36
- paid_commission: paid_commision,
37
- comment: comment,
38
- system: system,
39
- test: @test.to_s
54
+ {
55
+ func: :sci_create_order_get_data,
56
+ amount: amount,
57
+ currency: currency,
58
+ order_id: order_id,
59
+ phone: "false",
60
+ paid_commission: paid_commission,
61
+ comment: comment,
62
+ system: SYSTEM_IDS[system]
63
+ }
40
64
  )
41
65
  end
42
66
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paykassa
4
- VERSION = "0.1.16"
4
+ VERSION = "0.1.19"
5
5
  end
data/lib/paykassa.rb CHANGED
@@ -42,15 +42,17 @@ module Paykassa
42
42
  def rate(c_in, c_out)
43
43
  @paykassa_pay.currency_rate(c_in, c_out)
44
44
  end
45
- def get_order_address(amount: , currency:, order_id:, paid_commision: , comment: "from paykassa gem", system:)
45
+ def get_order_address(amount: , currency:, order_id:, paid_commission: , comment: "from paykassa gem", system:)
46
46
  order = @paykassa_order.get_data( amount: amount,
47
47
  currency: currency,
48
48
  order_id: order_id,
49
49
  phone: "false",
50
- paid_commission: paid_commision,
50
+ paid_commission: paid_commission,
51
51
  comment: comment,
52
52
  system: system
53
53
  )
54
+ raise StandardError.new(order[:message]) if order[:error]
55
+ order
54
56
  end
55
57
  def create_order(amount: , currency:, order_id:, paid_commision: , comment: "from paykassa gem", system:)
56
58
  order = @paykassa_order.create_order(
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.16
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - nottewae