Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

USA ePay: Make response parsing more robust to avoid exceptions on mi…

…ssing values
  • Loading branch information...
commit 5c231445a56c1ad4aeacb9022c8f98f33b3d34e0 1 parent 31517c4
@Soleone Soleone authored
View
2  lib/active_merchant/billing/gateways/usa_epay.rb
@@ -134,7 +134,7 @@ def parse(body)
fields = {}
for line in body.split('&')
key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
- fields[key] = CGI.unescape(value)
+ fields[key] = CGI.unescape(value.to_s)
end
{
View
8 test/unit/gateways/usa_epay_test.rb
@@ -95,6 +95,14 @@ def test_cvv_result
assert_equal 'M', response.cvv_result['code']
end
+ def test_does_not_raise_error_on_missing_values
+ @gateway.expects(:ssl_post).returns("status")
+ assert_nothing_raised do
+ response = @gateway.purchase(@amount, @credit_card, @options)
+ assert_failure response
+ end
+ end
+
private
def assert_address(type, post)
prefix = key_prefix(type)
Please sign in to comment.
Something went wrong with that request. Please try again.