Class: RealEx::Recurring::Authorization

Inherits:
Transaction show all
Defined in:
lib/real_ex/recurring.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!

Methods inherited from Transaction

#authorize!, #autosettle?, #initialize

Methods included from Initializer

included, #initialize

Constructor Details

This class inherits a constructor from RealEx::Transaction

Instance Method Details

#hashObject

timesttimestamp.merchantid.orderid.amount.currency.payerref



166
167
168
# File 'lib/real_ex/recurring.rb', line 166

def hash
  RealEx::Client.build_hash([RealEx::Client.timestamp, RealEx::Config.merchant_id, order_id, amount, currency, payer.reference])
end

#request_typeObject



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

def request_type
  'receipt-in'
end

#to_xmlObject



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/real_ex/recurring.rb', line 138

def to_xml
  super do |per|
    per.amount(amount, :currency => currency)
    per.payerref payer.reference
    per.paymentmethod reference
    if customer_number or variable_reference or billing_address or shipping_address
      per.tssinfo do |t|
        t.custnum customer_number if customer_number
        t.varref variable_reference if variable_reference
        t.prodid product_id if product_id
        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