Class: PaykassaOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/paykassa/order.rb

Constant Summary collapse

BASE_SCI_URI =
URI('https://paykassa.pro/sci/0.3/index.php')
CURRENCIES =
[
  "USD", "RUB", "BTC", "ETH", "LTC", "DOGE", "DASH", "BCH", "ZEC",
  "XRP", "TRX", "XLM", "BNB", "USDT", "ADA", "EOS", "GBP", "EUR", 
  "USDC", "BUSD"
]
SYSTEM_IDS =
{
    perfectmoney: 2,
    berty: 7,
    bitcoin: 11,
    ethereum: 12,
    litecoin: 14,
    dogecoin: 15,
    dash: 16,
    bitcoincash: 18,
    zcash: 19,
    ripple: 22,
    tron: 27,
    stellar: 28,
    binancecoin: 29,
    tron_trc20: 30,
    binancesmartchain_bep20: 31, # available currencies USDT, BUSD, USDC, ADA, EOS, BTC, ETH, DOGE    
    ethereum_erc20: 32
}

Instance Method Summary collapse

Constructor Details

#initialize(auth, logger = nil, test = false) ⇒ PaykassaOrder

def initialize(auth) where auth has keys: sci_id, sci_key, domain



31
32
33
34
35
# File 'lib/paykassa/order.rb', line 31

def initialize(auth, logger = nil, test = false)
  @logger = logger
  @_auth = auth
  @test = test
end

Instance Method Details

#confirm_order(private_hash) ⇒ Object

Check order status



72
73
74
# File 'lib/paykassa/order.rb', line 72

def confirm_order(private_hash)
  make_request({func: :sci_confirm_order, private_hash: private_hash})
end

#create_order(amount:, currency:, order_id:, paid_commision:, comment:, system:) ⇒ Object

Request for create order



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/paykassa/order.rb', line 38

def create_order(amount: , currency:, order_id:, paid_commision: , comment:, system:)
  puts "system: #{system}"
  data =  {
    func: :sci_create_order,
    amount: amount.to_f,
    currency: currency,
    order_id: order_id,
    phone: "false",
    paid_commission: paid_commision,
    comment: comment,
    system: SYSTEM_IDS[system]
  }
  puts data.inspect
  make_request(
   data
  )
end

#get_data(amount:, currency:, order_id:, paid_commission:, comment:, system:) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/paykassa/order.rb', line 55

def get_data(amount: , currency:, order_id:, paid_commission: , comment:, system:)
  puts "system: #{system}"
  data = {
    func: :sci_create_order_get_data,
    amount: amount.to_f,
    currency: currency,
    order_id: order_id,
    phone: "false",
    paid_commission: paid_commission,
    comment: comment,
    system: SYSTEM_IDS[system]
  }
  puts data.inspect
  make_request(data)
end