Ejegg has uploaded a new change for review.

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

Change subject: Revert "Revert "Check payments_init for 'failed' in pending QC""
......................................................................

Revert "Revert "Check payments_init for 'failed' in pending QC""

We can restore this now that we've got the PDO overlap fixed

This reverts commit ac6a0f04aad1b5519e8ee3a112dacf2a53efff30.

Change-Id: Ib8d63bb5ac409cd860bc7b4611562a1260c971fa
---
M Core/DataStores/PaymentsInitialDatabase.php
M Core/QueueConsumers/PendingQueueConsumer.php
2 files changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/60/317560/1

diff --git a/Core/DataStores/PaymentsInitialDatabase.php 
b/Core/DataStores/PaymentsInitialDatabase.php
index 5411c58..dbd33e2 100644
--- a/Core/DataStores/PaymentsInitialDatabase.php
+++ b/Core/DataStores/PaymentsInitialDatabase.php
@@ -10,21 +10,20 @@
 
        /**
         * Return true if the message already exists in the payments-init table,
-        * and has a very final status indicating we don't expect to do any more
-        * processing.
+        * and is marked as having failed.
         *
         * @param array $message Payments initial message
         *      FIXME: Or pass ID parameters explicitly and call this
         *      isTransactionFinalizedByGatewayOrderId??
         * @return boolean
         */
-       public function isTransactionFinalized( $message ) {
+       public function isTransactionFailed( $message ) {
                $message = $this->fetchMessageByGatewayOrderId(
                        $message['gateway'], $message['order_id'] );
                if ( $message === null ) {
                        return false;
                }
-               if ( in_array( $message['payments_final_status'], array( 
'failed', 'complete' ) ) ) {
+               if ( $message['payments_final_status'] === 'failed' ) {
                        return true;
                }
                return false;
diff --git a/Core/QueueConsumers/PendingQueueConsumer.php 
b/Core/QueueConsumers/PendingQueueConsumer.php
index b0b8ce9..51706e1 100644
--- a/Core/QueueConsumers/PendingQueueConsumer.php
+++ b/Core/QueueConsumers/PendingQueueConsumer.php
@@ -25,14 +25,13 @@
        public function processMessage( $message ) {
                $logIdentifier = "message with gateway {$message['gateway']}" .
                        " and order ID {$message['order_id']}";
-               /* FIXME: Broken due to bad credentials.
-               if ( $this->paymentsInitialDatabase->isTransactionFinalized( 
$message ) ) {
-                       // Throw the message out if it's already completed or 
failed, and
-                       // exists in the fredge database.
-                       Logger::info( "Skipping finalized $logIdentifier" );
-               } else {*/
+
+               if ( $this->paymentsInitialDatabase->isTransactionFailed( 
$message ) ) {
+                       // Throw the message out if it's already failed
+                       Logger::info( "Skipping failed $logIdentifier" );
+               } else {
                        Logger::info( "Storing $logIdentifier in database" );
                        $this->pendingDatabase->storeMessage( $message );
-               //}
+               }
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8d63bb5ac409cd860bc7b4611562a1260c971fa
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to