Class: MerbMerchant::Billing::Integrations::HiTrust::Helper

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

Instance Attribute Summary

Attributes inherited from MerbMerchant::Billing::Integrations::Helper

#fields

Instance Method Summary collapse

Methods inherited from MerbMerchant::Billing::Integrations::Helper

#add_field, #add_fields, #billing_address, #form_fields, mapping, #shipping_address

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/merb_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 MerbMerchant::Billing::Integrations::Helper

Instance Method Details

#amount=(money) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/merb_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