Sha256: af288dd44bfd1e841c07e2fa6f3ca3bc1daafd58cd868d3a64972180f9582f36

Contents?: true

Size: 1.29 KB

Versions: 19

Compression:

Stored size: 1.29 KB

Contents

require '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

19 entries across 19 versions & 6 rubygems

Version Path
johnideal-activemerchant-1.4.10 test/remote/gateways/remote_modern_payments_test.rb
johnideal-activemerchant-1.4.11 test/remote/gateways/remote_modern_payments_test.rb
johnideal-activemerchant-1.4.4 test/remote/gateways/remote_modern_payments_test.rb
johnideal-activemerchant-1.4.5 test/remote/gateways/remote_modern_payments_test.rb
johnideal-activemerchant-1.4.6 test/remote/gateways/remote_modern_payments_test.rb
johnideal-activemerchant-1.4.7 test/remote/gateways/remote_modern_payments_test.rb
johnideal-activemerchant-1.4.8 test/remote/gateways/remote_modern_payments_test.rb
mattbauer-activemerchant-1.4.2 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.3 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.5 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.6 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.7 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.8 test/remote/gateways/remote_modern_payments_test.rb
tomriley-tomriley-active_merchant-1.4.2.4 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.11 test/remote/gateways/remote_modern_payments_test.rb
tomriley-active_merchant-1.4.2.10 test/remote/gateways/remote_modern_payments_test.rb
ghazel-activemerchant-1.4.2 test/remote/gateways/remote_modern_payments_test.rb
abtain_billing-1.0 test/remote/gateways/remote_modern_payments_test.rb