Sha256: 1a4196456660388f3bf78fd9cdbc8e7651e9d30ac51d188decde156a29e7f51b

Contents?: true

Size: 1.81 KB

Versions: 11

Compression:

Stored size: 1.81 KB

Contents

require File.dirname(__FILE__) + '/../../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

11 entries across 11 versions & 5 rubygems

Version Path
martinstannard-activemerchant-0.1.0 test/remote/gateways/remote_exact_test.rb
seamusabshere-active_merchant-1.4.2.1 test/remote/gateways/remote_exact_test.rb
seamusabshere-active_merchant-1.4.2.3 test/remote/gateways/remote_exact_test.rb
activemerchant-1.3.1 test/remote/gateways/remote_exact_test.rb
activemerchant-1.3.0 test/remote/gateways/remote_exact_test.rb
activemerchant-1.4.1 test/remote/gateways/remote_exact_test.rb
activemerchant-1.4.0 test/remote/gateways/remote_exact_test.rb
activemerchant-1.3.2 test/remote/gateways/remote_exact_test.rb
activemerchant-1.4.2 test/remote/gateways/remote_exact_test.rb
merb_merchant-1.4.1 test/remote/gateways/remote_exact_test.rb
spree-0.2.0 vendor/plugins/active_merchant/test/remote/gateways/remote_exact_test.rb