Skip to content

Instantly share code, notes, and snippets.

@manufaktor
Created July 21, 2010 10:45
Show Gist options
  • Save manufaktor/484331 to your computer and use it in GitHub Desktop.
Save manufaktor/484331 to your computer and use it in GitHub Desktop.
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
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
@gateway = DatatransGateway.new(
:login => 'login',
:password => 'password',
:merchant_id => '2100011304'
)
response = @gateway.capture(:amount,
:authorization,
:options => { :refno => '23232301' }
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