require 'test_helper' class PaymentechOrbitalTest < Test::Unit::TestCase def setup @gateway = PaymentechOrbitalGateway.new( :login => 'login', :password => 'password', :merchant_id => '000000', :terminal_id => '000', :bin => '000000' ) @credit_card = credit_card @amount = 100 @options = { :order_id => '1', :billing_address => address, :description => 'Store Purchase' } end def test_successful_purchase @gateway.expects(:ssl_post).returns(successful_purchase_response) assert response = @gateway.purchase(@amount, @credit_card, @options) assert_instance_of PaymentechOrbitalResponse, response assert_success response assert_equal '1', response.authorization assert response.test? end def test_unsuccessful_request @gateway.expects(:ssl_post).returns(failed_purchase_response) assert response = @gateway.purchase(@amount, @credit_card, @options) assert_failure response assert response.test? end private def successful_purchase_response <<-RESPONSE AC 000000 000 MC 5454545454545454 1 4A785F5106CCDC41A936BFF628BF73036FEC5401 1 0 1 00 B M tst554 Approved 100 I3 M 2145108 JOE SMITH 0 Profile Created 121825 RESPONSE end def failed_purchase_response <<-RESPONSE 841 Error validating card/account number range 9576 Profile: Unable to Perform Profile Transaction. The Associated Transaction Failed. RESPONSE end end