Sha256: 6f11e4a9a2c9f48d6c5e67109368be5603481ec8be0b21b295905e6d985d7c0f

Contents?: true

Size: 1.72 KB

Versions: 7

Compression:

Stored size: 1.72 KB

Contents

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

class RemoteModernPaymentsCimTest < Test::Unit::TestCase
  

  def setup
    @gateway = ModernPaymentsCimGateway.new(fixtures(:modern_payments))
    
    @amount = 100
    @credit_card = credit_card('4111111111111111')
    @declined_card = credit_card('4000000000000000')
    
    @options = { 
      :billing_address => address,
      :customer => 'JIMSMITH2000'
    }
  end
  
  def test_successful_create_customer
    response = @gateway.create_customer(@options)
    assert_success response
    assert !response.params["create_customer_result"].blank?
  end
  
  def test_successful_modify_customer_credit_card
    customer = @gateway.create_customer(@options)
    assert_success customer
    
    customer_id = customer.params["create_customer_result"]
    
    credit_card = @gateway.modify_customer_credit_card(customer_id, @credit_card)
    assert_success credit_card
    assert !credit_card.params["modify_customer_credit_card_result"].blank?
  end
  
  def test_succsessful_authorize_credit_card_payment
    customer = @gateway.create_customer(@options)
    assert_success customer
    
    customer_id = customer.params["create_customer_result"]
    
    credit_card = @gateway.modify_customer_credit_card(customer_id, @credit_card)
    assert_success credit_card
    
    payment = @gateway.authorize_credit_card_payment(customer_id, @amount)
    assert_success payment
  end

  def test_invalid_login
    gateway = ModernPaymentsCimGateway.new(
                :login => '',
                :password => ''
              )
    assert response = gateway.create_customer(@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_cim_test.rb
seamusabshere-active_merchant-1.4.2.1 test/remote/gateways/remote_modern_payments_cim_test.rb
seamusabshere-active_merchant-1.4.2.3 test/remote/gateways/remote_modern_payments_cim_test.rb
activemerchant-1.4.0 test/remote/gateways/remote_modern_payments_cim_test.rb
activemerchant-1.4.1 test/remote/gateways/remote_modern_payments_cim_test.rb
activemerchant-1.4.2 test/remote/gateways/remote_modern_payments_cim_test.rb
merb_merchant-1.4.1 test/remote/gateways/remote_modern_payments_cim_test.rb