Sha256: a6447e8c7b2ddd7300f820a438237d6f42f723c713f4af600743eef48a2dec0c

Contents?: true

Size: 1.78 KB

Versions: 34

Compression:

Stored size: 1.78 KB

Contents

require 'test_helper'

class RemoteExactTest < Test::Unit::TestCase

  def setup
    
    @gateway = ExactGateway.new(fixtures(:exact))
    @credit_card = credit_card
    @amount = 100
    @options = { 
      :order_id => '1',
      :billing_address => address,
      :description => 'Store Purchase'
    }
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_match /Transaction Normal/, response.message
    assert_success response
  end

  def test_unsuccessful_purchase
    # ask for error 13 response (Amount Error) via dollar amount 5,000 + error
    @amount = 501300
    assert response = @gateway.purchase(@amount, @credit_card, @options )
    assert_match /Transaction Normal/, response.message
    assert_failure response
  end

  def test_purchase_and_credit
    assert purchase = @gateway.purchase(@amount, @credit_card, @options)
    assert_success purchase
    assert purchase.authorization
    assert credit = @gateway.credit(@amount, purchase.authorization)
    assert_success credit
  end
  
  def test_authorize_and_capture
    assert auth = @gateway.authorize(@amount, @credit_card, @options)
    assert_success auth
    assert auth.authorization
    assert capture = @gateway.capture(@amount, auth.authorization)
    assert_success capture
  end
  
  def test_failed_capture
    assert response = @gateway.capture(@amount, '')
    assert_failure response
    assert_match /Precondition Failed/i, response.message
  end
  
  def test_invalid_login
    gateway = ExactGateway.new( :login    => "NotARealUser",
                                :password => "NotARealPassword" )
    assert response = gateway.purchase(@amount, @credit_card, @options)
    assert_equal "Invalid Logon", response.message
    assert_failure response
  end
end

Version data entries

34 entries across 34 versions & 11 rubygems

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