test/remote/gateways/remote_quickpay_test.rb in activemerchant-1.4.1 vs test/remote/gateways/remote_quickpay_test.rb in activemerchant-1.4.2

- old
+ new

@@ -4,11 +4,11 @@ def setup @gateway = QuickpayGateway.new(fixtures(:quickpay)) @amount = 100 @options = { - :order_id => generate_unique_id, + :order_id => generate_unique_id[0...10], :billing_address => address } @visa_no_cvv2 = credit_card('4000300011112220', :verification_value => nil) @visa = credit_card('4000100011112224') @@ -63,21 +63,21 @@ assert !response.authorization.blank? assert_equal 'Visa-Electron-DK', response.params['cardtype'] end def test_successful_diners_club_authorization - assert response = @gateway.authorize(@amount, @diners_club, @options) + assert response = @gateway.authorize(@amount, @diners_club, @options) assert_success response assert !response.authorization.blank? assert_equal 'Diners', response.params['cardtype'] end def test_successful_diners_club_dk_authorization assert response = @gateway.authorize(@amount, @diners_club_dk, @options) assert_success response assert !response.authorization.blank? - assert_equal 'Diners', response.params['cardtype'] + assert_equal 'Diners-DK', response.params['cardtype'] end def test_successful_maestro_authorization assert response = @gateway.authorize(@amount, @maestro, @options) assert_success response @@ -87,11 +87,11 @@ def test_successful_maestro_dk_authorization assert response = @gateway.authorize(@amount, @maestro_dk, @options) assert_success response assert !response.authorization.blank? - assert_equal 'Maestro', response.params['cardtype'] + assert_equal 'Maestro-DK', response.params['cardtype'] end def test_successful_mastercard_dk_authorization assert response = @gateway.authorize(@amount, @mastercard_dk, @options) assert_success response @@ -120,13 +120,14 @@ assert_equal 'FBG-1886', response.params['cardtype'] end def test_unsuccessful_purchase_with_missing_cvv2 assert response = @gateway.purchase(@amount, @visa_no_cvv2, @options) - assert_equal 'Missing/error in card verification data', response.message - assert_failure response - assert response.authorization.blank? + # Quickpay has made the cvd field optional in order to support forbrugsforeningen cards which don't have them + assert_equal 'OK', response.message + assert_success response + assert !response.authorization.blank? end def test_successful_authorize_and_capture assert auth = @gateway.authorize(@amount, @visa, @options) assert_success auth @@ -138,11 +139,11 @@ end def test_failed_capture assert response = @gateway.capture(@amount, '') assert_failure response - assert_equal 'Missing/error in transaction number', response.message + assert_equal 'Missing field: transaction', response.message end def test_successful_purchase_and_void assert auth = @gateway.authorize(@amount, @visa, @options) assert_success auth @@ -168,15 +169,22 @@ assert_success purchase assert credit = @gateway.credit(@amount, purchase.authorization) assert_success credit end + def test_successful_store_and_reference_purchase + assert store = @gateway.store(@visa, @options.merge(:description => "New subscription")) + assert_success store + assert purchase = @gateway.purchase(@amount, store.authorization, @options.merge(:order_id => generate_unique_id[0...10])) + assert_success purchase + end + def test_invalid_login gateway = QuickpayGateway.new( :login => '', :password => '' ) assert response = gateway.purchase(@amount, @visa, @options) - assert_equal 'Missing/error in merchant', response.message + assert_equal 'Invalid merchant id', response.message assert_failure response end end