Class: ActiveMerchant::Billing::Integrations::HiTrust::Helper

Inherits:
ActiveMerchant::Billing::Integrations::Helper show all
Defined in:
lib/active_merchant/billing/integrations/hi_trust/helper.rb

Instance Attribute Summary

Attributes inherited from ActiveMerchant::Billing::Integrations::Helper

#fields

Instance Method Summary collapse

Methods inherited from ActiveMerchant::Billing::Integrations::Helper

#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_fields, #form_method, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

#initialize(order, account, options = {}) ⇒ Helper

Transaction types

  • Auth

  • AuthRe

  • Capture

  • CaptureRe

  • Refund

  • RefundRe

  • Query



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_merchant/billing/integrations/hi_trust/helper.rb', line 15

def initialize(order, , options = {})
  super  
  # Perform an authorization by default
  add_field('Type', 'Auth')
  
  # Capture the payment right away
  add_field('depositflag', '1')
  
  # Disable auto query - who knows what it does?
  add_field('queryflag', '1')
  
  add_field('orderdesc', 'Store purchase')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveMerchant::Billing::Integrations::Helper

Instance Method Details

#amount=(money) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/active_merchant/billing/integrations/hi_trust/helper.rb', line 32

def amount=(money)
  cents = money.respond_to?(:cents) ? money.cents : money 

  if money.is_a?(String) or cents.to_i < 0
    raise ArgumentError, 'money amount must be either a Money object or a positive integer in cents.' 
  end
  
  add_field(mappings[:amount], cents)
end