Sha256: cd5623e43243c5d7946b8ac07868798ab3848567151a3d69ccb488271c3bdd71

Contents?: true

Size: 1.44 KB

Versions: 34

Compression:

Stored size: 1.44 KB

Contents

require 'test_helper'

class PsigateRemoteTest < Test::Unit::TestCase

  def setup
    Base.mode = :test
    @gateway = PsigateGateway.new(fixtures(:psigate))

    @amount = 2400
    @creditcard = credit_card('4242424242424242')
    @options = { 
      :order_id => generate_unique_id, 
      :billing_address => address,
      :email => 'jack@example.com' 
    }
  end
  
  def test_successful_authorization
    assert response = @gateway.authorize(@amount, @creditcard, @options)
    assert_success response
    assert_equal @options[:order_id], response.authorization
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @creditcard, @options)
    assert_success response
    assert_equal @options[:order_id], response.authorization
  end
  
  def test_successful_authorization_and_capture
    assert authorization = @gateway.authorize(@amount, @creditcard, @options)
    assert_success authorization
    
    assert capture = @gateway.capture(@amount, authorization.authorization)
    assert_success capture
  end
  
  def test_successful_purchase_and_credit
    assert purchase = @gateway.purchase(@amount, @creditcard, @options)
    assert_success purchase
    
    assert credit = @gateway.credit(@amount, purchase.authorization)
    assert_success credit
  end
  
  def test_failed_purchase
    assert response = @gateway.purchase(@amount, @creditcard, @options.update(:test_result => 'D'))
    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_psigate_test.rb
johnideal-activemerchant-1.4.11 test/remote/gateways/remote_psigate_test.rb
johnideal-activemerchant-1.4.4 test/remote/gateways/remote_psigate_test.rb
johnideal-activemerchant-1.4.5 test/remote/gateways/remote_psigate_test.rb
johnideal-activemerchant-1.4.6 test/remote/gateways/remote_psigate_test.rb
johnideal-activemerchant-1.4.7 test/remote/gateways/remote_psigate_test.rb
johnideal-activemerchant-1.4.8 test/remote/gateways/remote_psigate_test.rb
mattbauer-activemerchant-1.4.2 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.3 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.5 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.6 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.7 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.8 test/remote/gateways/remote_psigate_test.rb
tomriley-tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_psigate_test.rb
goldstar-activemerchant-1.4.2.7 test/remote/gateways/remote_psigate_test.rb
goldstar-activemerchant-1.4.2.6 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.11 test/remote/gateways/remote_psigate_test.rb
tomriley-active_merchant-1.4.2.10 test/remote/gateways/remote_psigate_test.rb
smulube-activemerchant-1.5.1.4 test/remote/gateways/remote_psigate_test.rb