class MangoPay::BankAccount

See docs.mangopay.com/api-references/bank-accounts/

Public Class Methods

create(user_id, params, idempotency_key = nil) click to toggle source
# File lib/mangopay/bank_account.rb, line 7
def create(user_id, params, idempotency_key = nil)
  type = params.fetch(:Type) { |no_symbol_key| params.fetch('Type') }
  MangoPay.request(:post, "#{url(user_id)}/#{type}", params, {}, idempotency_key)
end
fetch(user_id, bank_account_id_or_filters={}) click to toggle source

Fetches:

  • list of bank accounts belonging to the given user_id

  • or single bank account belonging to the given user_id with the given bank_account_id.

In case of list query, optional filters is a hash accepting pagination and sorting params (page, per_page, sort; see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)

# File lib/mangopay/bank_account.rb, line 19
def fetch(user_id, bank_account_id_or_filters={})
  bank_account_id, filters = HTTPCalls::Fetch.parse_id_or_filters(bank_account_id_or_filters)
  MangoPay.request(:get, url(user_id, bank_account_id), {}, filters)
end
transactions(bank_account_id, filters = {}) click to toggle source

Fetches list of transactions belonging to given bank_account_id.

Optional filters is a hash accepting following keys:

# File lib/mangopay/bank_account.rb, line 35
def transactions(bank_account_id, filters = {})
  url = "#{MangoPay.api_path}/bankaccounts/#{bank_account_id}/transactions"
  MangoPay.request(:get, url, {}, filters)
end
update(user_id, bank_account_id, params = {}) click to toggle source

see docs.mangopay.com/endpoints/v2.01/bank-accounts#e306_disactivate-a-bank-account

# File lib/mangopay/bank_account.rb, line 25
def update(user_id, bank_account_id, params = {})
  MangoPay.request(:put, url(user_id, bank_account_id), params)
end
url(user_id, bank_account_id = nil) click to toggle source
# File lib/mangopay/bank_account.rb, line 40
def url(user_id, bank_account_id = nil)
  if bank_account_id
    "#{MangoPay.api_path}/users/#{CGI.escape(user_id.to_s)}/bankaccounts/#{CGI.escape(bank_account_id.to_s)}"
  else
    "#{MangoPay.api_path}/users/#{CGI.escape(user_id.to_s)}/bankaccounts"
  end
end