Awight has uploaded a new change for review.

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

Change subject: Log completed donations
......................................................................

Log completed donations

This is to debug an active issue where the queue message body is missing, so we
circumvent the possibly buggy getStompTransaction.

Bug: T140515
Change-Id: Iab065e0d70184040e47260d6d54334daa5db88ca
---
M README.txt
M extension.json
M gateway_common/gateway.adapter.php
3 files changed, 23 insertions(+), 1 deletion(-)


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

diff --git a/README.txt b/README.txt
index 60dd3f4..d00546c 100644
--- a/README.txt
+++ b/README.txt
@@ -128,6 +128,10 @@
 $wgDonationInterfaceDebugLog = false
 
 
+As donations are sent to the "completed" queue, also log the json blob.
+
+$wgDonationInterfaceLogCompleted = false
+
 ==== Currency and amounts ====
 
 Configure price ceiling and floor for valid contribution amount.  Values
diff --git a/extension.json b/extension.json
index ba0b7d9..c765731 100644
--- a/extension.json
+++ b/extension.json
@@ -441,6 +441,7 @@
                "DonationInterfaceDisplayDebug": false,
                "DonationInterfaceUseSyslog": false,
                "DonationInterfaceSaveCommStats": false,
+               "DonationInterfaceLogCompleted": false,
                "DonationInterfaceTimeout": 5,
                "DonationInterfaceFallbackCurrency": false,
                "DonationInterfaceFallbackCurrencyByCountry": false,
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index c0cb320..f294885 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -31,6 +31,12 @@
 abstract class GatewayAdapter implements GatewayType, LogPrefixProvider {
 
        /**
+        * Don't change these strings without fixing cross-repo usages.
+        */
+       const REDIRECT_PREFACE = 'Redirecting for transaction: ';
+       const COMPLETED_PREFACE = 'Completed donation: ';
+
+       /**
         * config tree
         */
        protected $config = array();
@@ -1696,6 +1702,7 @@
                        case FinalStatus::COMPLETE:
                                // This transaction completed successfully.  
Send to the CRM
                                // for filing.
+                               $this->logCompletedPayment();
                                $this->pushMessage( 'complete' );
                                break;
 
@@ -3707,7 +3714,17 @@
 
        protected function logPaymentDetails() {
                $details = $this->getStompTransaction();
-               $this->logger->info( 'Redirecting for transaction: ' . 
json_encode( $details ) );
+               $this->logger->info( self::REDIRECT_PREFACE . json_encode( 
$details ) );
+       }
+
+       protected function logCompletedPayment() {
+               if ( $this->getGlobal( 'LogCompleted' ) ) {
+                       // FIXME: We probably want to dial this down to log the 
same fields
+                       // as getStompTransaction, but I'm currently debugging 
that
+                       // function, so dump it all:
+                       $dump = json_encode( $this->getData_Unstaged_Escaped() 
);
+                       $this->logger->info( self::COMPLETED_PREFACE . $dump );
+               }
        }
 
        protected function runApiCallHooks() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab065e0d70184040e47260d6d54334daa5db88ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: deployment
Gerrit-Owner: Awight <awi...@wikimedia.org>

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

Reply via email to