Sha256: c8d1e2db4efcff1056175e7750a6ad0baaace513b08f1081796acf46ec5af9c2

Contents?: true

Size: 988 Bytes

Versions: 5

Compression:

Stored size: 988 Bytes

Contents

module MangoPay
  class Transaction < Resource

    # 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

5 entries across 5 versions & 1 rubygems

Version Path
mangopay-3.0.9 lib/mangopay/transaction.rb
mangopay-3.0.8 lib/mangopay/transaction.rb
mangopay-3.0.7 lib/mangopay/transaction.rb
mangopay-3.0.6 lib/mangopay/transaction.rb
mangopay-3.0.5 lib/mangopay/transaction.rb