Sha256: 5e63217fd62605bce15dcc892b688612e400f29d0de008e033f691fa30017e1d

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require_relative 'models/model_base'
require_relative 'utils/requestor'

module CorePro
  class Transaction < Models::ModelBase
    attr_accessor :transactionCount
    attr_accessor :customerId
    attr_accessor :transactionId
    attr_accessor :tag
    attr_accessor :createdDate
    attr_accessor :type
    attr_accessor :typeCode
    attr_accessor :status
    attr_accessor :amount
    attr_accessor :settledDate
    attr_accessor :voidedDate
    attr_accessor :nachaDescription
    attr_accessor :friendlyDescription
    attr_accessor :availableDate
    attr_accessor :returnCode
    attr_accessor :isCredit

    def self.list(customerId, accountId, status = nil, beginDate = nil, endDate = nil, pageNumber = 0, pageSize = 200, connection = nil, loggingObject = nil)
      connection ||= Connection.createFromConfig()
      start = beginDate.kind_of?(Date) ? beginDate.strftime('%Y-%m-%d') : (beginDate.kind_of?(String) ? beginDate[0..9] : nil)
      finish = endDate.kind_of?(Date) ? endDate.strftime('%Y-%m-%d') : (endDate.kind_of?(String) ? endDate[0..9] : nil)

      start ||= ''
      finish ||= ''

      if finish != '' && start == ''
        start = '1900-01-01'
      end

      CorePro::Utils::Requestor.get("/transaction/list/#{customerId}/#{accountId}/#{status}/#{start}/#{finish}?pageNumber=#{pageNumber}&pageSize=#{pageSize}", Transaction, connection, loggingObject)
    end


  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
corepro-0.0.4 lib/CorePro/transaction.rb