Sha256: b742ec27c0c30dc877a3f9939dde61e1894100c085464396ea657d24b9596a98

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class RemoteViaklixTest < Test::Unit::TestCase
  include ActiveMerchant::Billing
  
  
  def setup
    @gateway = ViaklixGateway.new(fixtures(:viaklix))
    
    @credit_card = credit_card('4242424242424242')
    
    @bad_credit_card = credit_card('invalid')
    
    @options = {
      :order_id => '#1000.1',
      :email => "paul@domain.com",   
      :description => 'Test Transaction',
      :address => { 
         :address1 => '164 Waverley Street', 
         :address2 => 'APT #7', 
         :country => 'US', 
         :city => 'Boulder', 
         :state => 'CO', 
         :zip => '12345'
      }     
    }
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(100, @credit_card, @options)
    
    assert_success response
    assert response.test?
    assert_equal 'APPROVED', response.message
    assert response.authorization
  end
  
  def test_failed_purchase
    assert response = @gateway.purchase(100, @bad_credit_card, @options)
  
    assert_failure response
    assert response.test?
    assert_equal 'The Credit Card Number supplied in the authorization request appears invalid.', response.message
  end
  
  def test_credit
    assert purchase = @gateway.purchase(100, @credit_card, @options)
    assert_success purchase
    
    assert credit = @gateway.credit(100, @credit_card)
    assert_success credit
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activemerchant-1.2.0 test/remote_tests/remote_viaklix_test.rb
activemerchant-1.2.1 test/remote_tests/remote_viaklix_test.rb