class Remitano::Client::MerchantWithdrawals

Attributes

config[R]

Public Class Methods

new(config:) click to toggle source
# File lib/remitano/client/merchant_withdrawals.rb, line 7
def initialize(config:)
  @config = config
end

Public Instance Methods

create( merchant_withdrawal_ref:, coin_currency:, coin_amount:, receiver_pay_fee:, cancelled_or_completed_callback_url: nil, coin_address: nil, destination_tag: nil, remitano_username: nil, remitano_phone_number: nil ) click to toggle source
# File lib/remitano/client/merchant_withdrawals.rb, line 15
def create(
  merchant_withdrawal_ref:, coin_currency:, coin_amount:, receiver_pay_fee:,
  cancelled_or_completed_callback_url: nil, coin_address: nil, destination_tag: nil,
  remitano_username: nil, remitano_phone_number: nil
)
  withdrawal = config.net.post(
    "/merchant/merchant_withdrawals",
    merchant_withdrawal_ref: merchant_withdrawal_ref,
    coin_currency: coin_currency,
    coin_amount: coin_amount,
    receiver_pay_fee: receiver_pay_fee,
    cancelled_or_completed_callback_url: cancelled_or_completed_callback_url,
    coin_address: coin_address,
    destination_tag: destination_tag,
    remitano_username: remitano_username,
    remitano_phone_number: remitano_phone_number
  ).execute
  if (action_confirmation_id = withdrawal["action_confirmation_id"]).present?
    config.action_confirmations.confirm_by_hotp!(action_confirmation_id, withdrawal["otp_counter"])
  end

  withdrawal
end
get(id) click to toggle source
# File lib/remitano/client/merchant_withdrawals.rb, line 11
def get(id)
  config.net.get("/merchant/merchant_withdrawals/#{id}").execute
end
list(status: nil, page: nil, per_page: nil) click to toggle source
# File lib/remitano/client/merchant_withdrawals.rb, line 39
def list(status: nil, page: nil, per_page: nil)
  params = {
    status: status,
    page: page,
    per_page: per_page
  }
  params.reject! { |_k, v| v.nil? }
  config.net.get(
    "/merchant/merchant_withdrawals",
    params
  ).execute
end