Ejegg has uploaded a new change for review.

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

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

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

It's looking in the wrong db for some reason...

This reverts commit e62d0dd5d8eb290d63418b910cad5c212cfec48d.

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


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/76/315576/1

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

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I39f8fa62fe883f8940adc1ff4d2005415eebec50
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