Class: RealEx::Authorization

Inherits:
Transaction show all
Defined in:
lib/real_ex/transaction.rb

Constant Summary

Constants inherited from Transaction

Transaction::REQUEST_TYPES

Instance Attribute Summary

Attributes inherited from Transaction

#authcode, #comments, #pasref

Instance Method Summary collapse

Methods inherited from Transaction

#authorize!, #autosettle?

Methods included from Initializer

included

Constructor Details

#initialize(hash = {}) ⇒ Authorization

Returns a new instance of Authorization.



62
63
64
65
66
# File 'lib/real_ex/transaction.rb', line 62

def initialize(hash = {})
  super(hash)
  self.manual ||= false
  self.offline ||= false
end

Instance Method Details

#hashObject



121
122
123
# File 'lib/real_ex/transaction.rb', line 121

def hash
  RealEx::Client.build_hash([RealEx::Client.timestamp, RealEx::Config.merchant_id, order_id, (amount unless offline?), (currency unless offline?), (card.number unless offline?)])
end

#rebate!Object



125
126
127
# File 'lib/real_ex/transaction.rb', line 125

def rebate!
  
end

#request_typeObject



80
81
82
# File 'lib/real_ex/transaction.rb', line 80

def request_type
  @request_type ||= 'auth'
end

#request_type=(type) ⇒ Object



84
85
86
# File 'lib/real_ex/transaction.rb', line 84

def request_type=(type)
  @request_type = type if REQUEST_TYPES.include?(type)
end

#settle!Object



133
134
135
# File 'lib/real_ex/transaction.rb', line 133

def settle!
  
end

#to_xmlObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/real_ex/transaction.rb', line 88

def to_xml
  super do |r|
    r.amount(amount, :currency => currency) unless offline?
    if !offline?
      r.card do |c|
        c.number card.number
        c.expdate card.expiry_date
        c.chname card.clean_name
        c.type card.type
      end
      r.autosettle :flag => autosettle? ? '1' : '0'
      r.tssinfo do |t|
        t.custnum customer_number if customer_number
        t.varref variable_reference if variable_reference
        t.prodid product_id if product_id
        t.custipaddress customer_ip_address if customer_ip_address
        if billing_address
          t.address :type => 'billing' do |a|
            a.code billing_address.post_code
            a.country billing_address.country
          end
        end
        if shipping_address
          t.address :type => 'shipping' do |a|
            a.code shipping_address.post_code
            a.country shipping_address.country
          end
        end
      end
    end
  end
end

#void!Object



129
130
131
# File 'lib/real_ex/transaction.rb', line 129

def void!
  
end