class Promisepay::BankAccountResource

Resource for the BankAccounts API

Public Instance Methods

create(attributes) click to toggle source

Create a bank account for a user on a marketplace.

@see reference.promisepay.com/#create-bank-account

@param attributes [Hash] Bank Account's attributes.

@return [Promisepay::BankAccount]

# File lib/promisepay/resources/bank_account_resource.rb, line 27
def create(attributes)
  response = JSON.parse(@client.post('bank_accounts', attributes).body)
  Promisepay::BankAccount.new(@client, response['bank_accounts'])
end
find(id) click to toggle source

Get bank account for a user on a marketplace.

@see reference.promisepay.com/#show-bank-account

@param id [String] Bank Account ID.

@return [Promisepay::BankAccount]

# File lib/promisepay/resources/bank_account_resource.rb, line 15
def find(id)
  response = JSON.parse(@client.get("bank_accounts/#{id}").body)
  Promisepay::BankAccount.new(@client, response['bank_accounts'])
end
model() click to toggle source
# File lib/promisepay/resources/bank_account_resource.rb, line 4
def model
  Promisepay::BankAccount
end
validate(routing_number) click to toggle source

Validate a US bank routing number before creating an account. This can be used to provide on-demand verification, and further information of the bank information a User is providing.

@see reference.promisepay.com/#validate-routing-number

@param routing_number [String] Bank account Routing Number

@return [Hash]

# File lib/promisepay/resources/bank_account_resource.rb, line 41
def validate(routing_number)
  response = @client.get('tools/routing_number', { routing_number: routing_number }, true)
  (response.status == 200) ? JSON.parse(response.body)['routing_number'] : {}
end