Sha256: 33730017cd6497aa0bdd2e2f7bf22e5624f0244abf9265e6a94fc96200e960d0

Contents?: true

Size: 1.37 KB

Versions: 34

Compression:

Stored size: 1.37 KB

Contents

require 'test_helper'

class RemoteBeanstreamInteracTest < Test::Unit::TestCase
  
  def setup
    @gateway = BeanstreamInteracGateway.new(fixtures(:beanstream_interac))
    
    @amount = 100
    
    @options = { 
      :order_id => generate_unique_id,
      :billing_address => {
        :name => 'xiaobo zzz',
        :phone => '555-555-5555',
        :address1 => '1234 Levesque St.',
        :address2 => 'Apt B',
        :city => 'Montreal',
        :state => 'QC',
        :country => 'CA',
        :zip => 'H2C1X8'
      },
      :email => 'xiaobozzz@example.com',
      :subtotal => 800,
      :shipping => 100,
      :tax1 => 100,
      :tax2 => 100,
      :custom => 'reference one'
    }
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @options)
    assert_success response
    assert_equal "R", response.params["responseType"]
    assert_false response.redirect.blank?
  end
  
  def test_failed_confirmation
    assert response = @gateway.confirm("")
    assert_failure response
  end
  
  def test_invalid_login
    gateway = BeanstreamInteracGateway.new(
                :merchant_id => '',
                :login => '',
                :password => ''
              )
    assert response = gateway.purchase(@amount, @options)
    assert_failure response
    assert_equal 'Invalid merchant id (merchant_id = 0)', response.message
  end
end

Version data entries

34 entries across 34 versions & 11 rubygems

Version Path
johnideal-activemerchant-1.4.10 test/remote/gateways/remote_beanstream_interac_test.rb
johnideal-activemerchant-1.4.11 test/remote/gateways/remote_beanstream_interac_test.rb
johnideal-activemerchant-1.4.4 test/remote/gateways/remote_beanstream_interac_test.rb
johnideal-activemerchant-1.4.5 test/remote/gateways/remote_beanstream_interac_test.rb
johnideal-activemerchant-1.4.6 test/remote/gateways/remote_beanstream_interac_test.rb
johnideal-activemerchant-1.4.7 test/remote/gateways/remote_beanstream_interac_test.rb
johnideal-activemerchant-1.4.8 test/remote/gateways/remote_beanstream_interac_test.rb
mattbauer-activemerchant-1.4.2 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.3 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.5 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.6 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.7 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.8 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_beanstream_interac_test.rb
goldstar-activemerchant-1.4.2.7 test/remote/gateways/remote_beanstream_interac_test.rb
goldstar-activemerchant-1.4.2.6 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.11 test/remote/gateways/remote_beanstream_interac_test.rb
tomriley-active_merchant-1.4.2.10 test/remote/gateways/remote_beanstream_interac_test.rb
smulube-activemerchant-1.5.1.4 test/remote/gateways/remote_beanstream_interac_test.rb