Class: VaultedBilling::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/vaulted_billing/transaction.rb

Overview

This class encapsulates the data returned by the gateway / payment processor for transaction requests. An instance of this class will be returned from all transaction requests (authorize, capture, refund, void, etc.) performed against a gateway.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Transaction

Returns a new instance of Transaction.



30
31
32
33
34
# File 'lib/vaulted_billing/transaction.rb', line 30

def initialize(attributes = {})
  attributes.each_pair do |key, value|
    send("#{key}=", value) if respond_to?("#{key}=")
  end
end

Instance Attribute Details

#authcodeObject

The authorization code for the transaction



13
14
15
# File 'lib/vaulted_billing/transaction.rb', line 13

def authcode
  @authcode
end

#avs_responseObject

The address verification service response



16
17
18
# File 'lib/vaulted_billing/transaction.rb', line 16

def avs_response
  @avs_response
end

#codeObject

The response code from the processor



22
23
24
# File 'lib/vaulted_billing/transaction.rb', line 22

def code
  @code
end

#cvv_responseObject

The card verification number response



19
20
21
# File 'lib/vaulted_billing/transaction.rb', line 19

def cvv_response
  @cvv_response
end

#idObject

The transaction identifier from the processor



10
11
12
# File 'lib/vaulted_billing/transaction.rb', line 10

def id
  @id
end

#masked_card_numberObject

The masked card number used in the transaction, if available



28
29
30
# File 'lib/vaulted_billing/transaction.rb', line 28

def masked_card_number
  @masked_card_number
end

#messageObject

The message from the processor



25
26
27
# File 'lib/vaulted_billing/transaction.rb', line 25

def message
  @message
end

Instance Method Details

#==(o) ⇒ Object



38
39
40
# File 'lib/vaulted_billing/transaction.rb', line 38

def ==(o)
  attributes == o.attributes
end

#attributesObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vaulted_billing/transaction.rb', line 42

def attributes
  {
    :id => id,
    :authcode => authcode,
    :avs_response => avs_response,
    :cvv_response => cvv_response,
    :code => code,
    :message => message,
    :masked_card_number => masked_card_number
  }
end

#to_vaulted_billingObject



36
# File 'lib/vaulted_billing/transaction.rb', line 36

def to_vaulted_billing; self; end