class Bitex::Payment
Documentation here!
Attributes
address[RW]
amount[RW]
confirmed_quantity[RW]
currency_id[RW]
customer_reference[RW]
expected_quantity[RW]
id[RW]
keep[RW]
last_quoted_on[RW]
merchant_reference[RW]
previous_expected_quantity[RW]
quote_valid_until[RW]
settlement_amount[RW]
settlement_currency_id[RW]
status[RW]
unconfirmed_quantity[RW]
user_id[RW]
valid_until[RW]
Public Class Methods
all()
click to toggle source
# File lib/bitex/payment.rb, line 40 def self.all Api.private(:get, base_uri).map { |payment| from_json(payment) } end
create!(params)
click to toggle source
# File lib/bitex/payment.rb, line 32 def self.create!(params) from_json(Api.private(:post, base_uri, params)) end
find(id)
click to toggle source
# File lib/bitex/payment.rb, line 36 def self.find(id) from_json(Api.private(:get, "#{base_uri}/#{id}")) end
from_callback(callback_params)
click to toggle source
Validate a callback and parse the given payment from it. Returns nil if the callback was invalid.
# File lib/bitex/payment.rb, line 46 def self.from_callback(callback_params) from_json(callback_params['payment']) if callback_params['api_key'] == Bitex.api_key end
from_json(json)
click to toggle source
@visibility private
# File lib/bitex/payment.rb, line 11 def self.from_json(json) new.tap do |thing| json.each do |key, raw_value| next if raw_value.nil? value = if %i[valid_until quote_valid_until last_quoted_on].include?(key) Time.at(raw_value) else raw_value end begin thing.send("#{key}=", value) rescue NoMethodError nil end end end end
pos_setup!(params)
click to toggle source
Sets up the web-pos
# File lib/bitex/payment.rb, line 51 def self.pos_setup!(params) Api.private(:post, "#{base_uri}/pos_setup", params) end
Private Class Methods
base_uri()
click to toggle source
# File lib/bitex/payment.rb, line 55 def self.base_uri '/private/payments' end