r102332 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102331‎ | r102332 | r102333 >
Date:21:59, 7 November 2011
Author:khorn
Status:ok
Tags:fundraising 
Comment:
Fixes the following issue:
GlobalCollect cc transactions don't need to do an explicit cancel on payments we tried to insert, if GlobalCollect fails them. This will prevent us from sending a cancel_payment in those cases.
Modified paths:
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -796,7 +796,8 @@
797797 //can't communicate or internal error
798798 $problemflag = true;
799799 }
800 -
 800+
 801+ $order_status_results = false;
801802 if ( !$cancelflag && !$problemflag ) {
802803 $order_status_results = $this->getTransactionWMFStatus();
803804 $txn_data = $this->getTransactionData();
@@ -806,10 +807,9 @@
807808 $problemmessage = "We don't have a Transaction WMF Status after doing a GET_ORDERSTATUS.";
808809 }
809810 switch ( $order_status_results ){
810 - //status says no - probably no need to cancel, but why not be explicit?
811811 case 'failed' :
812812 case 'revised' :
813 - $cancelflag = true;
 813+ $cancelflag = true; //makes sure we don't try to confirm.
814814 break;
815815 }
816816 }
@@ -846,14 +846,20 @@
847847 $problemmessage = "SET_PAYMENT couldn't communicate properly!";
848848 }
849849 } 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+ }
857860 }
 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).
858864 }
859865 }
860866

Follow-up revisions

RevisionCommit summaryAuthorDate
r102732MFT r100644, r100785, r101785, r102120, r102318, r102332, r102341, r102342, r...awjrichards01:31, 11 November 2011
r104098Dumb error of mine from r102332 - setWMFStatus should always be set to one of...khorn23:06, 23 November 2011

Status & tagging log