Sha256: 74877cde81f1b045068925244b4922f930961dbb7d3177bdd72e424cf7b8302c

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module MangoPay
  class Transaction < Resource
    include MangoPay::HTTPCalls::Fetch

    # Fetches list of transactions belonging to the given +wallet_id+.
    # 
    # Optional +filters+ is a hash accepting following keys:
    # - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
    # - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
    # - +Type+: TransactionType {PAYIN, PAYOUT, TRANSFER}
    # - +Nature+: TransactionNature {NORMAL, REFUND, REPUDIATION}
    # - +Direction+: TransactionDirection {DEBIT, CREDIT}
    # - +BeforeDate+ (timestamp): filters transactions with CreationDate _before_ this date
    # - +AfterDate+ (timestamp): filters transactions with CreationDate _after_ this date
    #
    def self.fetch(wallet_id, filters={})
      MangoPay.request(:get, url(wallet_id), {}, filters)
    end

    private

    def self.url(wallet_id)
      "/v2/#{MangoPay.configuration.client_id}/wallets/#{CGI.escape(wallet_id.to_s)}/transactions"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mangopay-3.0.4 lib/mangopay/transaction.rb
mangopay-3.0.3 lib/mangopay/transaction.rb
mangopay-3.0.2 lib/mangopay/transaction.rb