Sha256: a1786ded553880f6c7fbfb6d4dd7dc66afa8cb4e226d3371d768595dd4a79db1

Contents?: true

Size: 1.62 KB

Versions: 34

Compression:

Stored size: 1.62 KB

Contents

require 'test_helper'

class RemoteSageCheckTest < Test::Unit::TestCase
  
  def setup
    @gateway = SageVirtualCheckGateway.new(fixtures(:sage))
    
    @amount = 100
    @check = check
  
    @options = { 
      :order_id => generate_unique_id,
      :billing_address => address,
      :shipping_address => address,
      :email => 'longbob@example.com',
      :drivers_license_state => 'CA',
      :drivers_license_number => '12345689',
      :date_of_birth => Date.new(1978, 8, 11),
      :ssn => '078051120'
    }
  end
  
  def test_successful_check_purchase
    assert response = @gateway.purchase(@amount, @check, @options)
    assert_success response
    assert response.test?
    assert_false response.authorization.blank?
  end
  
  def test_failed_check_purchase
    @check.routing_number = ""
    
    assert response = @gateway.purchase(@amount, @check, @options)
    assert_failure response
    assert response.test?
    assert_false response.authorization.blank?
  end
  
  def test_purchase_and_void
    assert purchase = @gateway.purchase(@amount, @check, @options)
    assert_success purchase
    
    assert void = @gateway.void(purchase.authorization)
    assert_success void
  end
  
  def test_credit
    assert response = @gateway.credit(@amount, @check, @options)
    assert_success response
    assert response.test?
  end

  def test_invalid_login
    gateway = SageVirtualCheckGateway.new(
                :login => '',
                :password => ''
              )
    assert response = gateway.purchase(@amount, @check, @options)
    assert_failure response
    assert_equal 'SECURITY VIOLATION', response.message
  end
end

Version data entries

34 entries across 34 versions & 11 rubygems

Version Path
smulube-activemerchant-1.5.1.3 test/remote/gateways/remote_sage_virtual_check_test.rb
smulube-activemerchant-1.5.1.2 test/remote/gateways/remote_sage_virtual_check_test.rb
ghazel-activemerchant-1.4.2 test/remote/gateways/remote_sage_virtual_check_test.rb
activemerchant-est-1.4.2.6 test/remote/gateways/remote_sage_virtual_check_test.rb
activemerchant-1.5.0 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2.6 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2.5 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2.4 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2.3 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2.2 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2.1 test/remote/gateways/remote_sage_virtual_check_test.rb
activemerchant-est-1.4.2.5 test/remote/gateways/remote_sage_virtual_check_test.rb
patmaddox-activemerchant-1.4.2 test/remote/gateways/remote_sage_virtual_check_test.rb
abtain_billing-1.0 test/remote/gateways/remote_sage_virtual_check_test.rb