Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -796,7 +796,8 @@ |
797 | 797 | //can't communicate or internal error |
798 | 798 | $problemflag = true; |
799 | 799 | } |
800 | | - |
| 800 | + |
| 801 | + $order_status_results = false; |
801 | 802 | if ( !$cancelflag && !$problemflag ) { |
802 | 803 | $order_status_results = $this->getTransactionWMFStatus(); |
803 | 804 | $txn_data = $this->getTransactionData(); |
— | — | @@ -806,10 +807,9 @@ |
807 | 808 | $problemmessage = "We don't have a Transaction WMF Status after doing a GET_ORDERSTATUS."; |
808 | 809 | } |
809 | 810 | switch ( $order_status_results ){ |
810 | | - //status says no - probably no need to cancel, but why not be explicit? |
811 | 811 | case 'failed' : |
812 | 812 | case 'revised' : |
813 | | - $cancelflag = true; |
| 813 | + $cancelflag = true; //makes sure we don't try to confirm. |
814 | 814 | break; |
815 | 815 | } |
816 | 816 | } |
— | — | @@ -846,14 +846,20 @@ |
847 | 847 | $problemmessage = "SET_PAYMENT couldn't communicate properly!"; |
848 | 848 | } |
849 | 849 | } else { |
850 | | - $final = $this->do_transaction( 'CANCEL_PAYMENT' ); |
851 | | - if ( isset( $final['status'] ) && $final['status'] === true ) { |
852 | | - $this->setTransactionWMFStatus( $order_status_results ); |
853 | | - $this->unsetAllSessionData(); |
854 | | - } else { |
855 | | - $problemflag = true; |
856 | | - $problemmessage = "CANCEL_PAYMENT couldn't communicate properly!"; |
| 850 | + if ($order_status_results === false){ |
| 851 | + //we didn't do the check, because we're going to fail the thing. |
| 852 | + $final = $this->do_transaction( 'CANCEL_PAYMENT' ); |
| 853 | + if ( isset( $final['status'] ) && $final['status'] === true ) { |
| 854 | + $this->setTransactionWMFStatus( $order_status_results ); |
| 855 | + $this->unsetAllSessionData(); |
| 856 | + } else { |
| 857 | + $problemflag = true; |
| 858 | + $problemmessage = "CANCEL_PAYMENT couldn't communicate properly!"; |
| 859 | + } |
857 | 860 | } |
| 861 | + //No else. We can't be in here if we've had problems, so the |
| 862 | + //GET_STATUS must have told us no. No action required (in fact, |
| 863 | + //GC will complain if we try to can something at this point). |
858 | 864 | } |
859 | 865 | } |
860 | 866 | |