https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102011

Revision: 102011
Author:   khorn
Date:     2011-11-04 17:11:46 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
The currency code was not being received all the way, from an api transaction. 
This will fix several aspects of that.

Modified Paths:
--------------
    trunk/extensions/DonationInterface/gateway_common/DonationData.php
    trunk/extensions/DonationInterface/gateway_common/donation.api.php
    
trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php

Modified: trunk/extensions/DonationInterface/gateway_common/DonationData.php
===================================================================
--- trunk/extensions/DonationInterface/gateway_common/DonationData.php  
2011-11-04 17:07:44 UTC (rev 102010)
+++ trunk/extensions/DonationInterface/gateway_common/DonationData.php  
2011-11-04 17:11:46 UTC (rev 102011)
@@ -262,7 +262,8 @@
                        'optout',
                        'anonymous',
                        'language',
-                       'contribution_tracking_id', //sort of...                
+                       'contribution_tracking_id', //sort of...
+                       'currency'
                );
                return $fields;
        }
@@ -280,11 +281,26 @@
                        $this->setNormalizedOptOuts();
                        $this->setLanguage();
                        $this->handleContributionTrackingID();
+                       $this->setCurrencyCode();
                        array_walk( $this->normalized, array( $this, 
'sanitizeInput' ) );
                }
        }
        
        /**
+        * normalizeAndSanitize helper function
+        * Setting the currency code correctly. 
+        */
+       function setCurrencyCode() {
+               global $wgRequest;
+               if ( !$this->isSomething('currency') ){
+                       $code = $wgRequest->getVal('currency', null);
+                       if (!is_null($code)){
+                               $this->setVal('currency', $code);
+                       }
+               }
+       }
+       
+       /**
         * normalizeAndSanitize helper function.
         * Assures that if no contribution_tracking_id is present, a row is 
created 
         * in the Contribution tracking table, and that row is assigned to the 

Modified: trunk/extensions/DonationInterface/gateway_common/donation.api.php
===================================================================
--- trunk/extensions/DonationInterface/gateway_common/donation.api.php  
2011-11-04 17:07:44 UTC (rev 102010)
+++ trunk/extensions/DonationInterface/gateway_common/donation.api.php  
2011-11-04 17:11:46 UTC (rev 102011)
@@ -32,6 +32,8 @@
                        }
                } else if ( $this->gateway == 'globalcollect' ) {
                        $gatewayObj = new GlobalCollectAdapter();
+                       //I have NO IDEA how this worked before you were 
explicitly adding the data here. 
+                       $gatewayObj->addData( $this->donationData );
                        switch ( $method ) {
                                // TODO: add other payment methods
                                case 'cc':

Modified: 
trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
===================================================================
--- 
trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
  2011-11-04 17:07:44 UTC (rev 102010)
+++ 
trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
  2011-11-04 17:11:46 UTC (rev 102011)
@@ -1139,9 +1139,14 @@
         */
        protected function stage_returnto( $type = 'request' ) {
                if ( $type === 'request' ) {
-                       // Add order ID to the returnto URL
-                       $queryArray = array( 'order_id' => 
$this->postdata['order_id'] );
-                       $this->postdata['returnto'] = wfAppendQuery( 
$this->postdata['returnto'], $queryArray );
+                       // Add order ID to the returnto URL, only if it's not 
already there. 
+                       //TODO: This needs to be more robust (like actually 
pulling the 
+                       //qstring keys, resetting the values, and putting it 
all back)
+                       //but for now it'll keep us alive. 
+                       if ( !strpos( $this->postdata['returnto'], 'order_id' ) 
){
+                               $queryArray = array( 'order_id' => 
$this->postdata['order_id'] );
+                               $this->postdata['returnto'] = wfAppendQuery( 
$this->postdata['returnto'], $queryArray );
+                       }
                }
        }
        


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

Reply via email to