class Bitex::UsdDeposit
A deposit of USD to your bitex.la balance.
Attributes
amount[RW]
@!attribute amount
@return [BigDecimal] Final amount credited to your bitex USD balance.
astropay_response_body[RW]
@!attribute astropay_response_body
Response from astropay if selected as the deposit method. The 'url' field should be the astropay payment url for this deposit.
country[RW]
@!attribute country
Country of origin for this deposit.
created_at[RW]
@!attribute created_at
@return [Time] Time when this deposit was announced by you.
currency[RW]
@!attribute currency
Local currency for the country.
deposit_method[RW]
@!attribute deposit_method
The method used for this deposit * :astropay * :other
id[RW]
@!attribute id
@return [Integer] This UsdDeposit's unique ID.
kyc_profile_id[RW]
@!attribute kyc_profile_id
KYC profile on whose behalf this deposit is being created.
reason[RW]
@!attribute reason
The reason for cancellation of this deposit, if any. * :not_cancelled. * :did_not_credit funds never arrived to our end. * :sender_unknown we could not accept these funds because you're not the sender. * :other we'll contact you regarding this deposit. * :user_cancelled We cancelled this deposit per your request.
request_details[RW]
@!attribute request_details
Details for our account officers about this deposit.
requested_amount[RW]
@!attribute requested_amount
@return [BigDecimal] For pre-announced deposits, this is the amount you requested to deposit.
status[RW]
@!attribute status
The status of this deposit. * :pending your deposit notice was received, we're waiting for the funds to credit. * :done your deposit credited correctly, the funds are available in your balance. * :cancelled your deposit did not credit, check the 'reason' field.
third_party_reference[RW]
@!attribute third_party_reference
This deposit's id as issued by the third party payment processor, if any.
Public Class Methods
all()
click to toggle source
# File lib/bitex/usd_deposit.rb, line 111 def self.all Api.private(:get, '/private/usd/deposits').map { |d| from_json(d) } end
create!(country, amount, currency, method, details, profile = nil)
click to toggle source
rubocop:enable Metrics/AbcSize
# File lib/bitex/usd_deposit.rb, line 87 def self.create!(country, amount, currency, method, details, profile = nil) from_json( Api.private( :post, '/private/usd/deposits', country: country, amount: amount, currency: currency, deposit_method: method, request_details: details, kyc_profile_id: profile ) ) end
deposit_methods()
click to toggle source
# File lib/bitex/usd_deposit.rb, line 115 def self.deposit_methods { 1 => :astropay, 2 => :other } end
find(id)
click to toggle source
# File lib/bitex/usd_deposit.rb, line 102 def self.find(id) from_json(Api.private(:get, "/private/usd/deposits/#{id}")) end
from_json(json, deposit = nil)
click to toggle source
@visibility private rubocop:disable Metrics/AbcSize
# File lib/bitex/usd_deposit.rb, line 70 def self.from_json(json, deposit = nil) Api.from_json(deposit || new, json) do |thing| thing.requested_amount = (json[3].presence || 0).to_d thing.amount = (json[4].presence || 0).to_d thing.deposit_method = deposit_methods[json[5]] thing.status = statuses[json[6]] thing.reason = reasons[json[7]] thing.country = json[8] thing.currency = json[9] thing.kyc_profile_id = json[10] thing.request_details = json[11] thing.astropay_response_body = json[12] thing.third_party_reference = json[13] end end
reasons()
click to toggle source
# File lib/bitex/usd_deposit.rb, line 123 def self.reasons { 0 => :not_cancelled, 1 => :did_not_credit, 2 => :sender_unknown, 3 => :other, 4 => :user_cancelled } end
statuses()
click to toggle source
# File lib/bitex/usd_deposit.rb, line 119 def self.statuses { 1 => :pending, 2 => :done, 3 => :cancelled } end
Public Instance Methods
cancel!()
click to toggle source
# File lib/bitex/usd_deposit.rb, line 106 def cancel! path = "/private/usd/deposits/#{id}/cancel" self.class.from_json(Api.private(:post, path), self) end