Sha256: a905bbf42b3281e563180b51f4171e87c07e26f6a76a5b0de03bacf99266ea2f

Contents?: true

Size: 1.57 KB

Versions: 53

Compression:

Stored size: 1.57 KB

Contents

require File.dirname(__FILE__) + '/beanstream/beanstream_core'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class BeanstreamInteracResponse < Response
      def redirect
        params['pageContents']
      end
    end
    
    class BeanstreamInteracGateway < Gateway
      include BeanstreamCore

      # Confirm a transaction posted back from the bank to Beanstream.
      # Confirming a transaction does not require any credentials,
      # and in an application with many merchants sharing a funded
      # URL the application may not yet know which merchant the 
      # post back is for until the response of the confirmation is
      # received, which contains the order number.
      def self.confirm(transaction)
        gateway = new(:login => '')
        gateway.confirm(transaction)
      end
      
      def purchase(money, options = {})
        post = {}
        add_amount(post, money)
        add_invoice(post, options)
        add_address(post, options)
        add_interac_details(post, options)
        add_transaction_type(post, :purchase)
        commit(post)
      end
      
      # Confirm a transaction posted back from the bank to Beanstream.
      def confirm(transaction)
        post(transaction)
      end
      
      private
      
      def add_interac_details(post, options)
        address = options[:billing_address] || options[:address] || {}
        post[:trnCardOwner] = address[:name]
        post[:paymentMethod] = 'IO'
      end
      
      def build_response(*args)
        BeanstreamInteracResponse.new(*args)
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 6 rubygems

Version Path
tanga_activemerchant-1.38.0.5 lib/active_merchant/billing/gateways/beanstream_interac.rb
tanga_activemerchant-1.38.0.4 lib/active_merchant/billing/gateways/beanstream_interac.rb
tanga_activemerchant-1.38.0.3 lib/active_merchant/billing/gateways/beanstream_interac.rb
tanga_activemerchant-1.38.0.2 lib/active_merchant/billing/gateways/beanstream_interac.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.44.1/lib/active_merchant/billing/gateways/beanstream_interac.rb
tanga_activemerchant-1.38.0.1 lib/active_merchant/billing/gateways/beanstream_interac.rb
tanga_activemerchant-1.38.0 lib/active_merchant/billing/gateways/beanstream_interac.rb
tanga_activemerchant-1.37.0 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.45.0 lib/active_merchant/billing/gateways/beanstream_interac.rb
aktivemerchant-2.0.0 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.44.1 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.44.0 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.43.3 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.43.1 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.43.0 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.42.9 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.42.8 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.42.7 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.42.6 lib/active_merchant/billing/gateways/beanstream_interac.rb
activemerchant-1.42.5 lib/active_merchant/billing/gateways/beanstream_interac.rb