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.



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

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

Instance Method Details

#hashObject



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

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



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

def rebate!
  
end

#request_typeObject



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

def request_type
  @request_type ||= 'auth'
end

#request_type=(type) ⇒ Object



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

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

#settle!Object



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

def settle!
  
end

#to_xmlObject



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
120
# File 'lib/real_ex/transaction.rb', line 89

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



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

def void!
  
end