Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/209779

Change subject: Get rid of more setTransactionResult calls
......................................................................

Get rid of more setTransactionResult calls

Potentially funky, if transaction_response is null.  Should we set
that to a new PaymentTransactionResponse object in the gateway
constructor?

Change-Id: Id5e0f5f9a01b892dbd6673ec356399d5b0e4c858
---
M amazon_gateway/amazon.adapter.php
M astropay_gateway/astropay.adapter.php
M globalcollect_gateway/globalcollect.adapter.php
M globalcollect_gateway/scripts/orphan_adapter.php
M worldpay_gateway/worldpay.adapter.php
5 files changed, 7 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/79/209779/1

diff --git a/amazon_gateway/amazon.adapter.php 
b/amazon_gateway/amazon.adapter.php
index 38bd107..b695872 100644
--- a/amazon_gateway/amazon.adapter.php
+++ b/amazon_gateway/amazon.adapter.php
@@ -215,6 +215,7 @@
                $this->session_addDonorData();
 
                $this->setCurrentTransaction( $transaction );
+               $this->transaction_response = new PaymentTransactionResponse();
 
                $override_url = $this->transaction_option( 'url' );
                if ( !empty( $override_url ) ) {
@@ -311,7 +312,7 @@
                if ( $this->getFinalStatus() === false ) {
 
                        $txnid = $this->dataObj->getVal_Escaped( 
'gateway_txn_id' );
-                       $this->setTransactionResult( $txnid, 'gateway_txn_id' );
+                       $this->transaction_response->setGatewayTransactionId( 
$txnid );
 
                        // Second make sure that the inbound request had a 
matching outbound session. If it
                        // doesn't we drop it.
diff --git a/astropay_gateway/astropay.adapter.php 
b/astropay_gateway/astropay.adapter.php
index 132757c..79cc325 100644
--- a/astropay_gateway/astropay.adapter.php
+++ b/astropay_gateway/astropay.adapter.php
@@ -452,7 +452,7 @@
                case 'NewInvoice':
                        $this->processNewInvoiceResponse( $response );
                        if ( isset( $response['link'] ) ) {
-                               $this->setTransactionResult( $response['link'], 
'redirect' );
+                               $this->transaction_response->setRedirect( 
$response['link'] );
                        }
                        break;
                }
diff --git a/globalcollect_gateway/globalcollect.adapter.php 
b/globalcollect_gateway/globalcollect.adapter.php
index 8fab22b..2124fd5 100644
--- a/globalcollect_gateway/globalcollect.adapter.php
+++ b/globalcollect_gateway/globalcollect.adapter.php
@@ -1354,7 +1354,7 @@
                                if ( isset( $final['status'] ) && 
$final['status'] === true ) {
                                        $this->finalizeInternalStatus( 
FinalStatus::COMPLETE );
                                        //get the old status from the first 
txn, and add in the part where we set the payment.
-                                       $this->setTransactionResult( "Original 
Response Status (pre-SET_PAYMENT): " . $original_status_code, 'txn_message' );
+                                       
$this->transaction_response->setTxnMessage( "Original Response Status 
(pre-SET_PAYMENT): " . $original_status_code );
                                        $this->runPostProcessHooks();  //stomp 
is in here
                                        $add_antimessage = true; //TODO: use or 
remove
                                } else {
@@ -1443,7 +1443,7 @@
                                        } else {
                                                $this->finalizeInternalStatus( 
FinalStatus::FAILED );
                                                //get the old status from the 
first txn, and add in the part where we set the payment.
-                                               $this->setTransactionResult( 
"Original Response Status (pre-SET_PAYMENT): " . $original_status_code, 
'txn_message' );
+                                               
$this->transaction_response->setTxnMessage( "Original Response Status 
(pre-SET_PAYMENT): " . $original_status_code );
                                        }
                                }
             }
diff --git a/globalcollect_gateway/scripts/orphan_adapter.php 
b/globalcollect_gateway/scripts/orphan_adapter.php
index bc700b8..545e23a 100644
--- a/globalcollect_gateway/scripts/orphan_adapter.php
+++ b/globalcollect_gateway/scripts/orphan_adapter.php
@@ -45,7 +45,7 @@
        public function loadDataAndReInit( $data, $useDB = true ) {
                //re-init all these arrays, because this is a batch thing.
                $this->session_killAllEverything(); // just to be sure
-               $this->setTransactionResult();
+               $this->transaction_response = new PaymentTransactionResponse();
                $this->hard_data = array( );
                $this->unstaged_data = array( );
                $this->staged_data = array( );
diff --git a/worldpay_gateway/worldpay.adapter.php 
b/worldpay_gateway/worldpay.adapter.php
index 8bd8076..a0e2b49 100644
--- a/worldpay_gateway/worldpay.adapter.php
+++ b/worldpay_gateway/worldpay.adapter.php
@@ -764,7 +764,7 @@
 
                        case 'QueryAuthorizeDeposit':
                                $result = 
$this->do_transaction_QueryAuthorizeDeposit();
-                               $this->setTransactionResult( 
$this->getData_Unstaged_Escaped( 'order_id' ), 'gateway_txn_id' );
+                               
$this->transaction_response->setGatewayTransactionId( 
$this->getData_Unstaged_Escaped( 'order_id' ) );
                                $this->runPostProcessHooks();
                                return $result;
                                break;

-- 
To view, visit https://gerrit.wikimedia.org/r/209779
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5e0f5f9a01b892dbd6673ec356399d5b0e4c858
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to