Created
July 21, 2010 10:45
-
-
Save manufaktor/484331 to your computer and use it in GitHub Desktop.
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
def test_void | |
@gateway.expects(:post_xml).returns(post_xml_void_accepted)` | |
assert response = @gateway.void(2826987, @options_void)` | |
assert_equal true, response.success?, 'Check if the transaction existst.' | |
assert_equal 'cancellation succeeded', response.message.to_s | |
end |
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
def post_xml_void_accepted | |
<<-RESPONSE | |
<?xml version='1.0' encoding='UTF-8'?> | |
<paymentService version='1'> | |
<body merchantId='1000011011' testOnly='yes' status='accepted'> | |
<transaction refno='628a069429b4453bb2' trxStatus='response'> | |
<request> | |
<amount>100</amount> | |
<currency>CHF</currency> | |
<authorizationCode>800247117</authorizationCode> | |
<reqtype>DOA</reqtype> | |
<transtype>05</transtype> | |
</request> | |
<response> | |
<responseCode>01</responseCode> | |
<responseMessage>cancellation succeeded</responseMessage> | |
</response> | |
</transaction> | |
</body> | |
</paymentService> | |
RESPONSE | |
end |
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
@gateway = DatatransGateway.new( | |
:login => 'login', | |
:password => 'password', | |
:merchant_id => '2100011304' | |
) |
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
response = @gateway.capture(:amount, | |
:authorization, | |
:options => { :refno => '23232301' } |
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
response = @gateway.void(:authorization, | |
:options => {:refno => '23232301', | |
:amount => '1000' | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment