Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php |
— | — | @@ -50,7 +50,6 @@ |
51 | 51 | */ |
52 | 52 | public $validateFormResult = true; |
53 | 53 | |
54 | | - |
55 | 54 | /** |
56 | 55 | * Constructor |
57 | 56 | */ |
— | — | @@ -349,8 +348,18 @@ |
350 | 349 | return $this->form_class; |
351 | 350 | } |
352 | 351 | |
353 | | - function displayResultsForDebug( $results ) { |
| 352 | + /** |
| 353 | + * Get the currently set form class |
| 354 | + * |
| 355 | + * Will set the form class if the form class not already set |
| 356 | + * Using logic in setFormClass() |
| 357 | + * @return string |
| 358 | + */ |
| 359 | + protected function displayResultsForDebug( $results = array() ) { |
354 | 360 | global $wgOut; |
| 361 | + |
| 362 | + $results = empty( $results ) ? $this->adapter->getTransactionAllResults() : $results; |
| 363 | + |
355 | 364 | if ( $this->adapter->getGlobal( 'DisplayDebug' ) !== true ){ |
356 | 365 | return; |
357 | 366 | } |
— | — | @@ -553,6 +562,41 @@ |
554 | 563 | $this->validateFormResult = empty( $validateFormResult ) ? false : ( boolean ) $validateFormResult; |
555 | 564 | } |
556 | 565 | |
| 566 | + /** |
| 567 | + * Handle the result from the gateway |
| 568 | + * |
| 569 | + * @todo |
| 570 | + * - This is being implemented in GlobalCollect |
| 571 | + * - Do we need to implement this for PayFlow Pro? Not yet! |
| 572 | + */ |
| 573 | + protected function resultHandler() { |
| 574 | + global $wgOut; |
| 575 | + |
| 576 | + // If transaction was successful, go to the thank you page. |
| 577 | + if ( $this->adapter->getTransactionStatus() ) { |
| 578 | + $thankyoupage = $this->adapter->getGlobal( 'ThankYouPage' ); |
| 579 | + |
| 580 | + if ( $thankyoupage ) { |
| 581 | + return $wgOut->redirect( $thankyoupage . "/" . $this->adapter->getTransactionDataLanguage() ); |
| 582 | + } |
| 583 | + } |
| 584 | + |
| 585 | + // If we did not go to the Thank you page, there must be an error. |
| 586 | + return $this->resultHandlerError(); |
| 587 | + |
| 588 | + } |
| 589 | + |
| 590 | + /** |
| 591 | + * Handle the error result from the gateway |
| 592 | + * |
| 593 | + * Override this method in the payment gateway body class. |
| 594 | + */ |
| 595 | + protected function resultHandlerError() { |
| 596 | + |
| 597 | + // Display debugging results |
| 598 | + $this->displayResultsForDebug(); |
| 599 | + } |
| 600 | + |
557 | 601 | } |
558 | 602 | |
559 | 603 | //end of GatewayForm class definiton |