jenkins-bot has submitted this change and it was merged.

Change subject: Refund QC: fix missing 'use', better logging
......................................................................


Refund QC: fix missing 'use', better logging

Bug: T148880
Change-Id: Ia5c82d1cbf41007e92cc2db585c49e180971f511
---
M sites/all/modules/queue2civicrm/refund/RefundQueueConsumer.php
1 file changed, 13 insertions(+), 5 deletions(-)

Approvals:
  Eileen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/queue2civicrm/refund/RefundQueueConsumer.php 
b/sites/all/modules/queue2civicrm/refund/RefundQueueConsumer.php
index 1840b3e..9c242f8 100644
--- a/sites/all/modules/queue2civicrm/refund/RefundQueueConsumer.php
+++ b/sites/all/modules/queue2civicrm/refund/RefundQueueConsumer.php
@@ -1,5 +1,6 @@
 <?php  namespace queue2civicrm\refund;
 
+use Exception;
 use wmf_common\TransactionalWmfQueueConsumer;
 use WmfException;
 
@@ -21,6 +22,12 @@
                $gateway = strtoupper($message[ 'gateway' ]);
                $parentTxn = $message['gateway_parent_id'];
                $refundTxn = isset( $message[ 'gateway_refund_id' ] ) ? 
$message[ 'gateway_refund_id' ] : null;
+               if ( $refundTxn === null ) {
+                       $logId = $parentTxn;
+               } else {
+                       $logId = $refundTxn;
+               }
+
 
                if ( $message[ 'gross' ] < 0 ) {
                        $message[ 'gross' ] = abs( $message[ 'gross' ] );
@@ -29,21 +36,22 @@
                if ( $contributions = 
wmf_civicrm_get_contributions_from_gateway_id( $gateway, $parentTxn ) ) {
                        // Perform the refund!
                        try {
+                               watchdog( 'refund', "$logId: Marking as 
refunded", NULL, WATCHDOG_INFO );
                                wmf_civicrm_mark_refund( $contributions[0][ 
'id' ], $message[ 'type' ], true, $message[ 'date' ],
                                        $refundTxn,
                                        $message[ 'gross_currency' ],
                                        $message[ 'gross' ]
                                );
 
-                               watchdog( 'refund', "$refundTxn: Successfully 
marked as refunded", NULL, WATCHDOG_INFO );
-                       } catch (Exception $ex) {
-                               watchdog( 'refund', "$refundTxn: Could not 
refund due to internal error: " . $ex->getMessage(), NULL, WATCHDOG_ERROR );
+                               watchdog( 'refund', "$logId: Successfully 
marked as refunded", NULL, WATCHDOG_INFO );
+                       } catch ( Exception $ex ) {
+                               watchdog( 'refund', "$logId: Could not refund 
due to internal error: " . $ex->getMessage(), NULL, WATCHDOG_ERROR );
                                throw $ex;
                        }
                } else {
-                       watchdog( 'refund', "$refundTxn: Contribution not found 
for this transaction!", NULL, WATCHDOG_ERROR );
+                       watchdog( 'refund', "$logId: Contribution not found for 
this transaction!", NULL, WATCHDOG_ERROR );
                        throw new WmfException( 'MISSING_PREDECESSOR', "Parent 
not found: $gateway $parentTxn" );
                }
        }
 
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5c82d1cbf41007e92cc2db585c49e180971f511
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org>
Gerrit-Reviewer: Eileen <emcnaugh...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to