Class: RealEx::Rebate

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

Constant Summary

Constants inherited from Transaction

Transaction::REQUEST_TYPES

Instance Attribute Summary collapse

Attributes inherited from Transaction

#authcode, #comments, #pasref

Instance Method Summary collapse

Methods inherited from Transaction

#authorize!, #autosettle?, #initialize, #request_type

Methods included from Initializer

included, #initialize

Constructor Details

This class inherits a constructor from RealEx::Transaction

Instance Attribute Details

#refund_passwordObject

Returns the value of attribute refund_password.



148
149
150
# File 'lib/real_ex/transaction.rb', line 148

def refund_password
  @refund_password
end

Instance Method Details

#hashObject



170
171
172
# File 'lib/real_ex/transaction.rb', line 170

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

#refund_hashObject



150
151
152
# File 'lib/real_ex/transaction.rb', line 150

def refund_hash
  Digest::SHA1.hexdigest((refund_password || RealEx::Config.refund_password || ''))
end

#to_xml(&block) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/real_ex/transaction.rb', line 154

def to_xml(&block)
  super do |per|
    per.amount(amount, :currency => currency)
    per.autosettle :flag => autosettle? ? '1' : '0'
    per.refundhash refund_hash
    if !comments.empty?
      per.comments do |c|
        comments.each_with_index do |comment,index|
          c.comment(comment, :id => index + 1)
        end
      end
    end
  end
end