r100769 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100768‎ | r100769 | r100770 >
Date:01:12, 26 October 2011
Author:kaldari
Status:ok
Tags:fundraising 
Comment:
better error handling for globalcollect - localize error messages
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js
@@ -171,7 +171,9 @@
172172 if ( data.result.errors ) {
173173 var errors = new Array();
174174 $.each( data.result.errors, function( index, value ) {
175 - alert( value );
 175+ alert( value ); // Show them the error
 176+ $( "#paymentContinue" ).show(); // Show continue button in 2nd section
 177+ showStep2(); // Switch back to 2nd section of form
176178 } );
177179 } else {
178180 if ( data.result.formaction ) {
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -499,7 +499,14 @@
500500 $message = $childnode->nodeValue;
501501 }
502502 }
503 - $errors[$code] = $message;
 503+
 504+ // If we have a localized version of the error message, output that
 505+ if ( substr( wfMsg( 'globalcollect_gateway-response-'.$code ), 0, 4 ) === '<' ) {
 506+ $errors[$code] = $message;
 507+ } else {
 508+ $errors[$code] = wfMsg( 'globalcollect_gateway-response-'.$code );
 509+ }
 510+
504511 }
505512 return $errors;
506513 }
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.i18n.php
@@ -12,6 +12,10 @@
1313 $messages['en'] = array(
1414 'globalcollectgateway' => 'Make your donation now',
1515 'globalcollect_gateway-desc' => 'GlobalCollect payment processing',
 16+ 'globalcollect_gateway-response-9130' => 'Invalid country.',
 17+ 'globalcollect_gateway-response-9140' => 'Invalid currency.',
 18+ 'globalcollect_gateway-response-9150' => 'Invalid language.',
 19+ 'globalcollect_gateway-response-400530' => 'Invalid payment method.',
1620 'globalcollect_gateway-response-default' => 'There was an error processing your transaction.
1721 Please try again later.',
1822 );
@@ -22,5 +26,9 @@
2327 $messages['qqq'] = array(
2428 'globalcollectgateway' => '{{Identical|Support Wikimedia}}',
2529 'globalcollect_gateway-desc' => '{{desc}}',
 30+ 'globalcollect_gateway-response-9130' => 'Error message for invalid country.',
 31+ 'globalcollect_gateway-response-9140' => 'Error message for invalid currency.',
 32+ 'globalcollect_gateway-response-9150' => 'Error message for invalid language.',
 33+ 'globalcollect_gateway-response-400530' => 'Error message for invalid payment method, for example, not a valid credit card type.',
2634 'globalcollect_gateway-response-default' => 'Error message if something went wrong on our side.',
2735 );

Status & tagging log