Sha256: c380701efe97e08eb8474fea8148789b9cc7465d2948d34c2838679f29df345c

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

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

class RemoteModernPaymentTest < Test::Unit::TestCase
  

  def setup
    @gateway = ModernPaymentsGateway.new(fixtures(:modern_payments))
    
    @amount = 100
    @credit_card = credit_card('4111111111111111')
    @declined_card = credit_card('4000000000000000')
    
    @options = { 
      :order_id => '1',
      :billing_address => address,
      :description => 'Store Purchase'
    }
  end
  
  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    assert_match /RESPONSECODE=A/, response.params["auth_string"]
    assert_equal ModernPaymentsCimGateway::SUCCESS_MESSAGE, response.message
  end

  def test_unsuccessful_purchase
    assert response = @gateway.purchase(@amount, @declined_card, @options)
    assert_success response
    assert_match /RESPONSECODE=D/, response.params["auth_string"]
    assert_equal ModernPaymentsCimGateway::SUCCESS_MESSAGE, response.message
  end

  def test_invalid_login
    gateway = ModernPaymentsGateway.new(
                :login => '',
                :password => ''
              )
    assert response = gateway.purchase(@amount, @credit_card, @options)
    assert_failure response
    assert_equal ModernPaymentsCimGateway::ERROR_MESSAGE, 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_modern_payments_test.rb
seamusabshere-active_merchant-1.4.2.1 test/remote/gateways/remote_modern_payments_test.rb
seamusabshere-active_merchant-1.4.2.3 test/remote/gateways/remote_modern_payments_test.rb
activemerchant-1.4.1 test/remote/gateways/remote_modern_payments_test.rb
activemerchant-1.4.0 test/remote/gateways/remote_modern_payments_test.rb
activemerchant-1.4.2 test/remote/gateways/remote_modern_payments_test.rb
merb_merchant-1.4.1 test/remote/gateways/remote_modern_payments_test.rb