Ejegg has uploaded a new change for review.

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

Change subject: Add CT_ID to Astropay audit refund messages
......................................................................

Add CT_ID to Astropay audit refund messages

For Astropay, we need to look up log lines by CT_ID instead of
gateway_txn_id.

Bug: T90507
Change-Id: Iccb936309b0f1977b74fbc9aa9065b530a605da8
---
M PaymentProviders/Astropay/Audit/AstropayAudit.php
M PaymentProviders/Astropay/Tests/phpunit/AuditTest.php
2 files changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/22/223122/1

diff --git a/PaymentProviders/Astropay/Audit/AstropayAudit.php 
b/PaymentProviders/Astropay/Audit/AstropayAudit.php
index ddf728f..cfe4af6 100644
--- a/PaymentProviders/Astropay/Audit/AstropayAudit.php
+++ b/PaymentProviders/Astropay/Audit/AstropayAudit.php
@@ -93,6 +93,7 @@
        }
 
        protected function parseRefund( array $row, array &$msg ) {
+               $msg['contribution_tracking_id'] = 
$this->getContributionTrackingId( $row['Transaction Invoice'] );
                $msg['gateway_parent_id'] = $row['Transaction Reference'];
                $msg['gateway_refund_id'] = "refund:{$row['Reference']}";
                $msg['gross_currency'] = 'BRL'; // FIXME when AP adds this 
column!
@@ -100,8 +101,7 @@
        }
 
        protected function parseDonation( array $row, array &$msg ) {
-               $parts = explode( '.', $row['Invoice'] );
-               $msg['contribution_tracking_id'] = $parts[0];
+               $msg['contribution_tracking_id'] = 
$this->getContributionTrackingId( $row['Invoice'] );
                $msg['country'] = $row['Country'];
                $msg['currency'] = 'BRL'; // FIXME when AP adds this column!
                $msg['email'] = $row['User Mail'];
@@ -117,4 +117,9 @@
                        $msg['settled_gross'] = $row['Amount (USD)'];
                }
        }
+
+       protected function getContributionTrackingId( $invoice ) {
+               $parts = explode( '.', $invoice );
+               return $parts[0];
+       }
 }
diff --git a/PaymentProviders/Astropay/Tests/phpunit/AuditTest.php 
b/PaymentProviders/Astropay/Tests/phpunit/AuditTest.php
index bf02552..1669fcc 100644
--- a/PaymentProviders/Astropay/Tests/phpunit/AuditTest.php
+++ b/PaymentProviders/Astropay/Tests/phpunit/AuditTest.php
@@ -43,6 +43,7 @@
                $actual = $output[0];
                $expected = array(
                        'gateway' => 'astropay',
+                       'contribution_tracking_id' => '314159265',
                        'date' => 1434747909,
                        'gross' => '5.00',
                        'gateway_parent_id' => '7654321',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iccb936309b0f1977b74fbc9aa9065b530a605da8
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
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