forked from activemerchant/active_merchant
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Instapay gateway to support capture and add address, order, an…
…d invoice fields. Add support for CVV and AVS response
- Loading branch information
Cody Fauser
committed
May 4, 2009
1 parent
eeeda22
commit 39a7ce0
Showing
5 changed files
with
170 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,61 @@ | ||
require File.dirname(__FILE__) + '/../../test_helper' | ||
|
||
class RemoteInstapayTest < Test::Unit::TestCase | ||
|
||
|
||
|
||
def setup | ||
@gateway = InstapayGateway.new(fixtures(:instapay)) | ||
|
||
@amount = 100 | ||
@credit_card = credit_card('5454545454545454') | ||
@declined_card = credit_card('4000300011112220') | ||
@authorization = '92888036' | ||
|
||
@options = { | ||
:order_id => '1', | ||
:order_id => generate_unique_id, | ||
:billing_address => address, | ||
:shipping_address => address, | ||
:description => 'Store Purchase' | ||
} | ||
end | ||
|
||
def test_successful_purchase | ||
assert response = @gateway.purchase(@amount, @credit_card, @options) | ||
assert_success response | ||
assert_equal 'Accepted', response.message | ||
assert_equal InstapayGateway::SUCCESS_MESSAGE, response.message | ||
end | ||
|
||
def test_failed_purchase | ||
assert response = @gateway.purchase(@amount, @declined_card, @options) | ||
assert_failure response | ||
assert_equal 'Declined', response.message | ||
end | ||
|
||
def test_succesful_auth | ||
def test_succesful_authorization | ||
assert response = @gateway.authorize(@amount, @credit_card, @options) | ||
assert_success response | ||
assert_equal 'Accepted', response.message | ||
assert_equal InstapayGateway::SUCCESS_MESSAGE, response.message | ||
end | ||
|
||
def test_failed_auth | ||
def test_failed_authorization | ||
assert response = @gateway.authorize(@amount, @declined_card, @options) | ||
assert_failure response | ||
assert_equal 'Declined', response.message | ||
end | ||
|
||
def test_authorization_and_capture | ||
assert authorization = @gateway.authorize(@amount, @credit_card, @options) | ||
assert_success authorization | ||
|
||
assert capture = @gateway.capture(@amount, authorization.authorization) | ||
assert_success capture | ||
assert_equal InstapayGateway::SUCCESS_MESSAGE, capture.message | ||
end | ||
|
||
def test_invalid_login | ||
gateway = InstapayGateway.new( | ||
:login => 'X', | ||
:password => 'Y' | ||
) | ||
|
||
assert response = gateway.purchase(@amount, @credit_card) | ||
assert_failure response | ||
assert_equal "Invalid merchant", response.message | ||
end | ||
end |
Oops, something went wrong.