logging response

25 views
Skip to first unread message

truchty

unread,
May 30, 2008, 9:38:45 AM5/30/08
to Active Merchant
Hi,

this is a simple debugging request: how do I log the data returned by
a gateway? i don't want a response object yet, but rather just the
actual data. My gateway is a subclass of the authorize.net gateway,
and the response object is coming back empty. I'm trying to figure out
what the gateway is replying with so I can create the correct response
object. here's what i figured out:

-auth.net gateway's purchase method calls auth.net gateway's commit
method
-inside commit method (line 230 in authorize_net.rb) i want to log the
results of the variable "url".
-after typing 'require logger' at the top, i typed this line after the
url variable is set:
-Logger.new(STDOUT).info('URL is #{url}')

Nothing happens. Help, gurus?

thanks!


Cody Fauser

unread,
May 30, 2008, 2:25:59 PM5/30/08
to activem...@googlegroups.com
In posts_data.rb ssl_post method you can add the following line to
dump the HTTP request and response to standard output:

http.set_debug_output(STDOUT)

--
Cody Fauser
http://shopify.com - e-commerce done right
http://www.codyfauser.com - blog
http://peepcode.com/products/activemerchant-pdf - ActiveMerchant PeepCode
http://www.oreilly.com/catalog/rjsrails - RJS Templates for Rails

truchty

unread,
May 30, 2008, 4:10:52 PM5/30/08
to Active Merchant
Can someone post what a successful authorize.net request and response
look like? Since I'm trying to subclass the authorize.net gateway
class, this would help a lot.

That worked, Cody, thank you.

-JG

Cody Fauser

unread,
May 30, 2008, 7:18:41 PM5/30/08
to activem...@googlegroups.com
Look in test/unit/gateways/authorize_net_test.rb. There are successful
responses in the file that are used for the tests.

--

Reply all
Reply to author
Forward
0 new messages