Permalink
Browse files

Improved message and error message handling

Signed-off-by: Cody Fauser <cody@jadedpixel.com>
  • Loading branch information...
1 parent cd2a58b commit 9ca5ac8d992cd2e57c3ef2682814353ec89e0f18 @Soleone Soleone committed with Cody Fauser Jul 10, 2008
Showing with 12 additions and 6 deletions.
  1. +1 −0 CHANGELOG
  2. +11 −6 lib/active_merchant/billing/gateways/wirecard.rb
View
1 CHANGELOG
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG
+* Improved message and error message handling [Soleone]
* Get Wirecard working in the Live environment [Soleone]
* Remove dead code in PayPal Common API files [cody]
* Use the PayPal short error message if the long message is empty [cody]
View
17 lib/active_merchant/billing/gateways/wirecard.rb
@@ -240,13 +240,18 @@ def parse_response(response, root)
end
end
# Get message
- response[:Message] = \
- if info = status.elements['Info']
- info.text
- else
- errors_to_string(status)
+ message = ''
+ if info = status.elements['Info']
+ message << info.text
end
-
+ # Get errors if available and append them to the message
+ errors = errors_to_string(status)
+ unless errors.strip.blank?
+ message << ' - ' unless message.strip.blank?
+ message << errors
+ end
+ response[:Message] = message
+
# Get basic response information
status.elements.to_a.each do |node|
response[node.name.to_sym] = (node.text || '').strip

0 comments on commit 9ca5ac8

Please sign in to comment.