class Promisepay::BatchTransactionResource

Resource for the Items API

Public Instance Methods

find(id) click to toggle source

Get a single batch transaction

@see reference.promisepay.com/#show-batch-transaction

@param id [String] Transaction ID.

@return [Promisepay::BatchTransaction]

# File lib/promisepay/resources/batch_transaction_resource.rb, line 39
def find(id)
  response = JSON.parse(@client.get("batch_transactions/#{id}").body)
  Promisepay::BatchTransaction.new(@client, response['batch_transactions'])
end
find_all(options = {}) click to toggle source

List all batch transactions

@see reference.promisepay.com/#list-batch-transactions

@param options [Hash] Optional options. @option options [Integer] :limit Can ask for up to 200 batch transactions. default: 10 @option options [Integer] :offset Pagination help. default: 0 @option options [Integer] :account_id Bank, Card, PayPal or Wallet Account ID. @option options [Integer] :batch_id Batch ID. This appears on a bank reference. @option options [Integer] :item_id Item ID. @option options [String] :transaction_type The type of transaction.

Available values: payment, refund, disbursement, fee, deposit, withdrawal.

@option options [String] :transaction_type_method The method the transaction was carried out with.

Available values: bundle_direct_debit, direct_debit, credit_card, wire_transfer, direct_credit, paypal_payout.

@option options [debit, credit] :direction Direction of the transaction.

Available values: debit, credit.

@return [Array<Promisepay::BatchTransaction>] List all batch transactions.

# File lib/promisepay/resources/batch_transaction_resource.rb, line 26
def find_all(options = {})
  response = JSON.parse(@client.get('batch_transactions', options).body)
  batch_transactions = response.key?('batch_transactions') ? response['batch_transactions'] : []
  batch_transactions.map { |attributes| Promisepay::BatchTransaction.new(@client, attributes) }
end
model() click to toggle source
# File lib/promisepay/resources/batch_transaction_resource.rb, line 4
def model
  Promisepay::BatchTransaction
end