mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-05-01 02:03 pm

[dw-free] Show the PayPal error message to the user instead of just 'generic error'.

[commit: http://hg.dwscoalition.org/dw-free/rev/61481e10ee39]

Show the PayPal error message to the user instead of just 'generic error'.

Patch by [staff profile] mark.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/DW/Shop/Engine/PayPal.pm
--------------------------------------------------------------------------------
diff -r a18f6166e808 -r 61481e10ee39 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Fri May 01 12:56:58 2009 +0000
+++ b/bin/upgrading/en.dat	Fri May 01 14:03:39 2009 +0000
@@ -1328,7 +1328,7 @@ error.pay.paypal.engbadstate=Payment eng
 
 error.pay.paypal.flownotfinished=PayPal order flow not finished.  Please try again later.
 
-error.pay.paypal.generic=PayPal error.  Please try again later.
+error.pay.paypal.generic=PayPal error.  Please try again later.<br /><br />Short error: [[shorterr]]<br />Long error: [[longerr]]
 
 error.pay.paypal.noschwartz=Unable to contact job queue system.  Please try again later.
 
diff -r a18f6166e808 -r 61481e10ee39 cgi-bin/DW/Shop/Engine/PayPal.pm
--- a/cgi-bin/DW/Shop/Engine/PayPal.pm	Fri May 01 12:56:58 2009 +0000
+++ b/cgi-bin/DW/Shop/Engine/PayPal.pm	Fri May 01 14:03:39 2009 +0000
@@ -212,7 +212,11 @@ sub confirm_order {
         amt           => $cart->display_total,
         paymentaction => 'Sale',
     );
-    return $self->temp_error( 'paypal.generic' )
+    return $self->temp_error(
+        'paypal.generic',
+        shorterr => ( $res->{l_shortmessage0} || 'none/unknown error' ),
+        longerr => ( $res->{l_longmessage0} || 'none/unknown error' ),
+    )
         unless $res && $res->{transactionid};
 
     # okay, so we got something from them.  have to record this in the
--------------------------------------------------------------------------------