r101955 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101954‎ | r101955 | r101956 >
Date:05:14, 4 November 2011
Author:jpostlethwaite
Status:ok
Tags:fundraising 
Comment:
Added resultHandler() and resultHandlerError().
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -516,36 +516,55 @@
517517 /**
518518 * Handle the result from the gateway
519519 *
 520+ * If there are errors, then this will return to the form.
 521+ *
520522 * @todo
521523 * - This is being implemented in GlobalCollect
522524 * - Do we need to implement this for PayFlow Pro? Not yet!
 525+ * - Do we only want to skip the Thank you page on getTransactionWMFStatus() => failed?
 526+ *
 527+ * @return null
523528 */
524529 protected function resultHandler() {
 530+
525531 global $wgOut;
526532
527 - // If transaction was successful, go to the thank you page.
528 - if ( $this->adapter->getTransactionStatus() ) {
 533+ // If transaction is anything, except failed, go to the thank you page.
 534+
 535+ if ( in_array( $this->adapter->getTransactionWMFStatus(), $this->adapter->getGoToThankYouOn() ) ) {
 536+
529537 $thankyoupage = $this->adapter->getGlobal( 'ThankYouPage' );
530538
531539 if ( $thankyoupage ) {
532 - return $wgOut->redirect( $thankyoupage . "/" . $this->adapter->getTransactionDataLanguage() );
 540+ return $wgOut->redirect( $thankyoupage . '/' . $this->adapter->getTransactionDataLanguage() );
533541 }
534542 }
535543
536544 // If we did not go to the Thank you page, there must be an error.
537545 return $this->resultHandlerError();
538 -
539546 }
540547
541548 /**
542549 * Handle the error result from the gateway
543550 *
544 - * Override this method in the payment gateway body class.
 551+ * @todo
 552+ * - logging may need be added to this method
 553+ *
 554+ * @return null
545555 */
546556 protected function resultHandlerError() {
547557
548558 // Display debugging results
549559 $this->displayResultsForDebug();
 560+
 561+ $this->errors['general'] = ( !isset( $this->errors['general'] ) || empty( $this->errors['general'] ) ) ? array() : (array) $this->errors['general'];
 562+
 563+ foreach ( $this->adapter->getTransactionErrors() as $code => $message ) {
 564+
 565+ $this->errors['general'][ $code ] = $message;
 566+ }
 567+
 568+ return $this->displayForm( $this->errors );
550569 }
551570
552571 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r101956Added $error_map, getErrorMap(), getErrorMapByCodeAndTranslate(), getTransact...jpostlethwaite05:18, 4 November 2011
r102236MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:06, 7 November 2011
r102237MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:07, 7 November 2011

Status & tagging log