jenkins-bot has submitted this change and it was merged.
Change subject: Start chipping away at getTransactionAllResults
......................................................................
Start chipping away at getTransactionAllResults
Just the easy stuff for starters. The ultimate goal here is to
return a PaymentTransactionResponse object from do_transaction
Bug: T98063
Change-Id: I33c2ac793200221e9020bc747451107503ccace3
---
M extras/conversion_log/conversion_log.body.php
M gateway_common/gateway.adapter.php
M tests/Adapter/Astropay/AstropayTest.php
3 files changed, 15 insertions(+), 6 deletions(-)
Approvals:
Awight: Looks good to me, approved
jenkins-bot: Verified
diff --git a/extras/conversion_log/conversion_log.body.php
b/extras/conversion_log/conversion_log.body.php
index 7528cc6..8c4723d 100644
--- a/extras/conversion_log/conversion_log.body.php
+++ b/extras/conversion_log/conversion_log.body.php
@@ -17,7 +17,7 @@
}
// make sure the response property has been set (signifying a
transaction has been made)
- if ( !$this->gateway_adapter->getTransactionAllResults() )
+ if ( !$this->gateway_adapter->getTransactionResponse() )
return FALSE;
$this->log(
diff --git a/gateway_common/gateway.adapter.php
b/gateway_common/gateway.adapter.php
index 6726379..82c5aa9 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1143,7 +1143,7 @@
$this->getStopwatch( __FUNCTION__, true );
$txn_ok = $this->curl_transaction( $curlme );
if ( $txn_ok === true ) { //We have something to slice and dice.
- $this->logger->info( "RETURNED FROM CURL:" . print_r(
$this->getTransactionAllResults(), true ) );
+ $this->logger->info( "RETURNED FROM CURL:" . print_r(
$this->transaction_response->getRawResponse(), true ) );
// Decode the response according to
$this->getResponseType
$formatted = $this->getFormattedResponse(
$this->transaction_response->getRawResponse() );
@@ -1162,13 +1162,14 @@
}
} elseif ( $txn_ok === false ) { //nothing to process, so we
have to build it manually
- $this->logger->error( 'Transaction Communication
failed' . print_r( $this->getTransactionAllResults(), true ) );
+ $logMessage = 'Transaction Communication failed' .
print_r( $this->transaction_response, true );
+ $this->logger->error( $logMessage );
$this->transaction_response->setCommunicationStatus(
false );
$this->transaction_response->setMessage(
$this->getErrorMapByCodeAndTranslate( 'internal-0002' ) );
$this->transaction_response->setErrors( array(
'internal-0002' => array(
- 'debugInfo' => 'Transaction
Communication failed' . print_r( $this->getTransactionAllResults(), true ),
+ 'debugInfo' => $logMessage,
'message' =>
$this->getErrorMapByCodeAndTranslate( 'internal-0002' ),
'logLevel' => LogLevel::ERROR
)
@@ -2171,6 +2172,14 @@
}
/**
+ * Public accessor to the $transaction_response variable
+ * @return PaymentTransactionResponse
+ */
+ public function getTransactionResponse() {
+ return $this->transaction_response;
+ }
+
+ /**
* TODO: get rid of this shim, expose the getters we need externally
* The results of the most recent cURL transaction.
*
diff --git a/tests/Adapter/Astropay/AstropayTest.php
b/tests/Adapter/Astropay/AstropayTest.php
index c9898c5..c3de0ff 100644
--- a/tests/Adapter/Astropay/AstropayTest.php
+++ b/tests/Adapter/Astropay/AstropayTest.php
@@ -158,8 +158,8 @@
// from the test response
$expected =
'https://sandbox.astropaycard.com/go_to_bank?id=A5jvKfK1iHIRUTPXXt8lDFGaRRLzPgBg';
- $results = $gateway->getTransactionAllResults();
- $this->assertEquals( $expected, $results['redirect'],
+ $response = $gateway->getTransactionResponse();
+ $this->assertEquals( $expected, $response->getRedirect(),
'do_transaction is not setting the right redirect' );
}
--
To view, visit https://gerrit.wikimedia.org/r/209791
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I33c2ac793200221e9020bc747451107503ccace3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits