Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php |
— | — | @@ -516,36 +516,55 @@ |
517 | 517 | /** |
518 | 518 | * Handle the result from the gateway |
519 | 519 | * |
| 520 | + * If there are errors, then this will return to the form. |
| 521 | + * |
520 | 522 | * @todo |
521 | 523 | * - This is being implemented in GlobalCollect |
522 | 524 | * - 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 |
523 | 528 | */ |
524 | 529 | protected function resultHandler() { |
| 530 | + |
525 | 531 | global $wgOut; |
526 | 532 | |
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 | + |
529 | 537 | $thankyoupage = $this->adapter->getGlobal( 'ThankYouPage' ); |
530 | 538 | |
531 | 539 | if ( $thankyoupage ) { |
532 | | - return $wgOut->redirect( $thankyoupage . "/" . $this->adapter->getTransactionDataLanguage() ); |
| 540 | + return $wgOut->redirect( $thankyoupage . '/' . $this->adapter->getTransactionDataLanguage() ); |
533 | 541 | } |
534 | 542 | } |
535 | 543 | |
536 | 544 | // If we did not go to the Thank you page, there must be an error. |
537 | 545 | return $this->resultHandlerError(); |
538 | | - |
539 | 546 | } |
540 | 547 | |
541 | 548 | /** |
542 | 549 | * Handle the error result from the gateway |
543 | 550 | * |
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 |
545 | 555 | */ |
546 | 556 | protected function resultHandlerError() { |
547 | 557 | |
548 | 558 | // Display debugging results |
549 | 559 | $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 ); |
550 | 569 | } |
551 | 570 | |
552 | 571 | } |