Class: RealEx::Recurring::Payer

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

20030516175919.yourmerchantid.uniqueid…smithj01



55
56
57
# File 'lib/real_ex/recurring.rb', line 55

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

#request_typeObject



14
15
16
# File 'lib/real_ex/recurring.rb', line 14

def request_type
  @request_type = update == true ? 'payer-edit' : 'payer-new'
end

#save!Object



59
60
61
# File 'lib/real_ex/recurring.rb', line 59

def save!
  authorize!
end

#to_xmlObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/real_ex/recurring.rb', line 18

def to_xml
  super do |per|
    per.payer(:type => type, :ref => reference) do |payer|
      payer.title title
      payer.firstname firstname
      payer.surname lastname
      payer.company company
      payer.address do |add|
          add.line1 address.line1
          add.line1 address.line2
          add.line3 address.line3
          add.city address.city
          add.county address.county
          add.postcode address.post_code
          add.country(address.country, :country_code => address.country_code)
      end
      if address.phone_numbers.kind_of?(Hash)
        payer.phonenumbers do |numbers|
          numbers.home address.phone_numbers[:home]
          numbers.work address.phone_numbers[:work]
          numbers.fax address.phone_numbers[:fax]
          numbers.mobile address.phone_numbers[:mobile]
        end
      end
      payer.email address.email
      if !comments.empty?
        payer.comments do |c|
          comments.each_with_index do |i,comment|
            c.comment(comment, :id => i + 1)
          end
        end
      end
    end
  end
end

#update!Object



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

def update!
  self.update = true
  authorize!
end