Sha256: 46743d6b6d263e8f76e57cb8f03cbe654ee4f5d8d9d8f3c653ea81011464b77c

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

module MangoPay
  class Transaction < Resource
    class << self
      # Fetches list of transactions belonging to the given +wallet_id+.
      # See also transactions for user: MangoPay::User#transactions
      # 
      # Optional +filters+ is a hash accepting following keys:
      # - +page+, +per_page+, +sort+: pagination and sorting 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 fetch(wallet_id, filters={})
        MangoPay.request(:get, url(wallet_id), {}, filters)
      end

      def url(wallet_id)
        "#{MangoPay.api_path}/wallets/#{CGI.escape(wallet_id.to_s)}/transactions"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mangopay-3.0.19 lib/mangopay/transaction.rb
mangopay-3.0.18 lib/mangopay/transaction.rb
mangopay-3.0.17 lib/mangopay/transaction.rb
mangopay-3.0.16 lib/mangopay/transaction.rb
mangopay-3.0.15 lib/mangopay/transaction.rb
mangopay-3.0.14 lib/mangopay/transaction.rb
mangopay-3.0.13 lib/mangopay/transaction.rb