Sha256: 10cbcbbc991e761d8b3fc378f8a739d6c6c3f63a43c46860c69b1751384da333

Contents?: true

Size: 1.65 KB

Versions: 7

Compression:

Stored size: 1.65 KB

Contents

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

7 entries across 7 versions & 4 rubygems

Version Path
martinstannard-activemerchant-0.1.0 test/remote/gateways/remote_sage_virtual_check_test.rb
seamusabshere-active_merchant-1.4.2.1 test/remote/gateways/remote_sage_virtual_check_test.rb
seamusabshere-active_merchant-1.4.2.3 test/remote/gateways/remote_sage_virtual_check_test.rb
activemerchant-1.4.0 test/remote/gateways/remote_sage_virtual_check_test.rb
activemerchant-1.4.1 test/remote/gateways/remote_sage_virtual_check_test.rb
activemerchant-1.4.2 test/remote/gateways/remote_sage_virtual_check_test.rb
merb_merchant-1.4.1 test/remote/gateways/remote_sage_virtual_check_test.rb