Sha256: 5ac09923858a6b98f6e7d4a684564376619a2a7f69115db09986710eb37b4385
Contents?: true
Size: 1.53 KB
Versions: 6
Compression:
Stored size: 1.53 KB
Contents
module Recurly class Transaction < Base self.element_name = "transaction" def self.known_attributes [ "description", "amount_in_cents", "account_code", "type", "action", "date", "status", "message", "reference", "ccv_result", "avs_result", "avs_result_street", "avs_result_postal", "test", "voidable", "refundable" ] end # initialize fields with blank data def initialize(attributes = {}, persisted = false) # initialize embedded attributes attributes = attributes.with_indifferent_access attributes[:account] ||= {} super end def self.list(status = :all) options = {} if status != :all options[:params] = {:show => status.to_s} end find(:all, options) end def self.list_for_account(account_code, status = :all) results = find(:all, :from => "/accounts/#{CGI::escape(account_code.to_s)}/transactions") # filter by status if status != :all results = results.select{|t| t.status == status.to_s } end results end def self.lookup(account_code, id) find(id, :params => { :account_code => account_code }) end def void connection.delete(element_path(:action => "void"), self.class.headers) end def refund(amount_in_cents) connection.delete(element_path(:action => "refund", :amount_in_cents => amount_in_cents), self.class.headers) end end end
Version data entries
6 entries across 6 versions & 1 rubygems