Sha256: 118b0b76c0711abf0bd8e8f41bab0c1e9e990eff6180ee14695fb485ebe0d2bc

Contents?: true

Size: 1.42 KB

Versions: 34

Compression:

Stored size: 1.42 KB

Contents

require 'test_helper'

class RemoveUsaEpayTest < Test::Unit::TestCase
  def setup
    Base.gateway_mode = :test
    @gateway = UsaEpayGateway.new(fixtures(:usa_epay))
    @creditcard = credit_card('4000100011112224')
    @declined_card = credit_card('4000300011112220')
    @options = { :billing_address => address }
    @amount = 100
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @creditcard, @options)
    assert_equal 'Success', response.message
    assert_success response
  end

  def test_unsuccessful_purchase
    assert response = @gateway.purchase(@amount, @declined_card, @options)
    assert_equal 'Card Declined', response.message
    assert_failure response
  end

  def test_authorize_and_capture
    assert auth = @gateway.authorize(@amount, @creditcard, @options)
    assert_success auth
    assert_equal 'Success', auth.message
    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_equal 'Unable to find original transaciton.', response.message
  end

  def test_invalid_key
    gateway = UsaEpayGateway.new(:login => '')
    assert response = gateway.purchase(@amount, @creditcard, @options)
    assert_equal 'Specified source key not found.', 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_usa_epay_test.rb
johnideal-activemerchant-1.4.11 test/remote/gateways/remote_usa_epay_test.rb
johnideal-activemerchant-1.4.4 test/remote/gateways/remote_usa_epay_test.rb
johnideal-activemerchant-1.4.5 test/remote/gateways/remote_usa_epay_test.rb
johnideal-activemerchant-1.4.6 test/remote/gateways/remote_usa_epay_test.rb
johnideal-activemerchant-1.4.7 test/remote/gateways/remote_usa_epay_test.rb
johnideal-activemerchant-1.4.8 test/remote/gateways/remote_usa_epay_test.rb
mattbauer-activemerchant-1.4.2 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.3 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.5 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.6 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.7 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.8 test/remote/gateways/remote_usa_epay_test.rb
tomriley-tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_usa_epay_test.rb
goldstar-activemerchant-1.4.2.7 test/remote/gateways/remote_usa_epay_test.rb
goldstar-activemerchant-1.4.2.6 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.11 test/remote/gateways/remote_usa_epay_test.rb
tomriley-active_merchant-1.4.2.10 test/remote/gateways/remote_usa_epay_test.rb
smulube-activemerchant-1.5.1.4 test/remote/gateways/remote_usa_epay_test.rb