jeffersongirao/dwolla — pull request #5 by tylergannon (2012-07-06 02:28:00+00:00)
Title: Catch HTTP 500 Errors and allow test transactions

Hi ... maybe you can suggest an easy way to test this stuff. I didn't spend the time I would need to in order to understand your test setup.

BUT

I think this is useful functionality.
1) in transaction.rb I added the ability to have the requests go to Dwolla's test api, which basically always succeeds as long as the request is formatted correctly and the AUTH_TOKEN is valid.
2) In cases where there is an invalid auth token, such as if the auth token was stored and the user deauthorized the app at dwolla, the #send_money_to method will throw an error.
This is apparently due to a problem with Dwolla's API. In that event, they throw an HTTP 500 error and return a SOAP message. It's a little ugly. Anyways, as you can see, I added a new middleware that catches 500 errors and parses for access denied. It's an ugly workaround to an ugly problem. Hopefully the new Dwolla api that's rumored to be coming out will solve inconsistencies like this.

Let me know if you have some suggestions for how to make this prettier.
and thanks for the helpful Gem!