class Promisepay::WalletAccount

Manage Wallet Accounts

Public Instance Methods

deposit(options = {}) click to toggle source

Deposit funds to a Wallet Account from a specified payment account.

@see reference.promisepay.com/#deposit-funds

@param options [Hash] Optional options. @option options [String] :account_id Account to deposit from. @option options [Integer] :amount Amount (in cents) to deposit.

@return [Hash]

# File lib/promisepay/models/wallet_account.rb, line 27
def deposit(options = {})
  response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/deposit", options).body)
  response.key?('disbursements') ? response['disbursements'] : {}
end
user() click to toggle source

Show the User the Wallet Account is associated with

@return [Promisepay::User]

# File lib/promisepay/models/wallet_account.rb, line 35
def user
  response = JSON.parse(@client.get("wallet_accounts/#{send(:id)}/users").body)
  response.key?('users') ? Promisepay::User.new(@client, response['users']) : nil
end
withdraw(options = {}) click to toggle source

Withdraw funds from a Wallet Account to a specified disbursement account.

@see reference.promisepay.com/#withdraw-funds

@param options [Hash] Optional options. @option options [String] :account_id Account to withdraw to. @option options [Integer] :amount Amount (in cents) to withdraw.

@return [Hash]

# File lib/promisepay/models/wallet_account.rb, line 13
def withdraw(options = {})
  response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/withdraw", options).body)
  response.key?('disbursements') ? response['disbursements'] : {}
end