Shopify/active_merchant — pull request #1315 by mendable (2014-07-21 15:15:08+00:00)
Title: correctly handle error-only responses without W_JOB element

If Wirecard is having a *really* bad day it is possible for their API to return error responses that are not contained within the W_JOB element.

The current error parsing logic has a bug causing the stack trace below because L301 calls #parse_error with incorrect arguments, and even if it worked, wouldn't return the ErrorCode.

```
/opt/rubies/ruby-2.1.2/lib/ruby/2.1.0/rexml/xpath_parser.rb:182 in "expr"
/opt/rubies/ruby-2.1.2/lib/ruby/2.1.0/rexml/xpath_parser.rb:139 in "match"
/opt/rubies/ruby-2.1.2/lib/ruby/2.1.0/rexml/xpath_parser.rb:70 in "parse"
/opt/rubies/ruby-2.1.2/lib/ruby/2.1.0/rexml/xpath.rb:67 in "each"
/bundler/gems/active_merchant-1e2bcde60d3a/lib/active_merchant/billing/gateways/wirecard.rb:361 in "errors_to_string"
/bundler/gems/active_merchant-1e2bcde60d3a/lib/active_merchant/billing/gateways/wirecard.rb:348 in "parse_error"
/bundler/gems/active_merchant-1e2bcde60d3a/lib/active_merchant/billing/gateways/wirecard.rb:301 in "parse"
/bundler/gems/active_merchant-1e2bcde60d3a/lib/active_merchant/billing/gateways/wirecard.rb:164 in "commit"
/bundler/gems/active_merchant-1e2bcde60d3a/lib/active_merchant/billing/gateways/wirecard.rb:75 in "purchase"
```

I have added a new method to correctly parse these Wirecard having-a-bad-day responses, and also pluck out the ErrorCode as well.

Unit test included, repeatable remote test not possible.