Sha256: d442b562e180dc94a5579d580bc71d92b4ab475568b397708f76153fd5e50e02

Contents?: true

Size: 1.73 KB

Versions: 177

Compression:

Stored size: 1.73 KB

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module Integrations #:nodoc:
      module HiTrust
        class Helper < ActiveMerchant::Billing::Integrations::Helper
          
          # Transaction types
          # * Auth
          # * AuthRe
          # * Capture
          # * CaptureRe
          # * Refund
          # * RefundRe
          # * Query
          def initialize(order, account, 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
          
          mapping :account, 'storeid'
          mapping :amount, 'amount'
          
          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
          # Supported currencies include:
          # * CNY:Chinese Yuan (Renminbi)
          # * TWD:New Taiwan Dollar 
          # * HKD:Hong Kong Dollar 
          # * USD:US Dollar 
          # * AUD:Austrian Dollar 
          mapping :currency, 'currency'
        
          mapping :order, 'ordernumber'
          mapping :description, 'orderdesc'

          mapping :notify_url, 'merUpdateURL'
          mapping :return_url, 'returnURL'
        end
      end
    end
  end
end

Version data entries

177 entries across 177 versions & 35 rubygems

Version Path
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.10 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.11 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.4 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.5 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.6 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.7 lib/active_merchant/billing/integrations/hi_trust/helper.rb
johnideal-activemerchant-1.4.8 lib/active_merchant/billing/integrations/hi_trust/helper.rb
martinstannard-activemerchant-0.1.0 lib/active_merchant/billing/integrations/hi_trust/helper.rb
mattbauer-activemerchant-1.4.2 lib/active_merchant/billing/integrations/hi_trust/helper.rb
seamusabshere-active_merchant-1.4.2.1 lib/active_merchant/billing/integrations/hi_trust/helper.rb
seamusabshere-active_merchant-1.4.2.3 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tomriley-active_merchant-1.4.2.3 lib/active_merchant/billing/integrations/hi_trust/helper.rb
tomriley-active_merchant-1.4.2.4 lib/active_merchant/billing/integrations/hi_trust/helper.rb