Ejegg has uploaded a new change for review.

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

Change subject: Add exception for Alipay mismatches
......................................................................

Add exception for Alipay mismatches

Alipay can accept currency in CNY and pay out in EUR/USD, which
looks funky on the audit.  This commit adds an exception for Alipay
when currency fields don't match, and selects Invoice-currency-deliv.
It also checks an additional amount field ( Invoice-amount-deliv ),
and uses that for Alipay.

Change-Id: I1fb6a082a5400913f2824123f4f7a9e6e1f6b190
---
M sites/all/modules/globalcollect_audit/globalcollect_audit.module
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/95/183895/1

diff --git a/sites/all/modules/globalcollect_audit/globalcollect_audit.module 
b/sites/all/modules/globalcollect_audit/globalcollect_audit.module
index c623cc8..c8dc490 100644
--- a/sites/all/modules/globalcollect_audit/globalcollect_audit.module
+++ b/sites/all/modules/globalcollect_audit/globalcollect_audit.module
@@ -1894,6 +1894,7 @@
        $ordered_keys = array(
                'Payment-amount',
                'Amount-due',
+               'Invoice-amount-deliv',
        );
        return gca_wr1_key_grinder($record, $ordered_keys, 'amount');
 }
@@ -1952,6 +1953,20 @@
                                                        $die = false;
                                                }
 
+                                               //Alipay charges in CNY and 
pays out in EUR
+                                               //We'll record it as though it 
was the CNY amount
+                                               if ( $record['WbC Payment 
method ID'] === '8'
+                                                       && $record['WbC Payment 
product ID'] === '861'
+                                                       && in_array( $name, 
array( 'currency', 'amount' ) ) ){
+                                                       if ( $name === 
'currency' ) {
+                                                               $ret = 
$record['Invoice-currency-deliv'];
+                                                       } else {
+                                                               $ret = 
$record['Invoice-amount-deliv'];
+                                                       }
+                                                       
globalcollect_audit_echo("...but that's how Alipay rolls. Setting $name to 
$ret");
+                                                       $die = false;
+                                               }
+
                                                if ( $die && !( variable_get( 
'globalcollect_audit_mismatch_override', false ) ) ){
                                                        die();
                                                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1fb6a082a5400913f2824123f4f7a9e6e1f6b190
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to