r102011 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102010‎ | r102011 | r102012 >
Date:17:11, 4 November 2011
Author:khorn
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_common/donation.api.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -1139,9 +1139,14 @@
11401140 */
11411141 protected function stage_returnto( $type = 'request' ) {
11421142 if ( $type === 'request' ) {
1143 - // Add order ID to the returnto URL
1144 - $queryArray = array( 'order_id' => $this->postdata['order_id'] );
1145 - $this->postdata['returnto'] = wfAppendQuery( $this->postdata['returnto'], $queryArray );
 1143+ // Add order ID to the returnto URL, only if it's not already there.
 1144+ //TODO: This needs to be more robust (like actually pulling the
 1145+ //qstring keys, resetting the values, and putting it all back)
 1146+ //but for now it'll keep us alive.
 1147+ if ( !strpos( $this->postdata['returnto'], 'order_id' ) ){
 1148+ $queryArray = array( 'order_id' => $this->postdata['order_id'] );
 1149+ $this->postdata['returnto'] = wfAppendQuery( $this->postdata['returnto'], $queryArray );
 1150+ }
11461151 }
11471152 }
11481153
Index: trunk/extensions/DonationInterface/gateway_common/donation.api.php
@@ -32,6 +32,8 @@
3333 }
3434 } else if ( $this->gateway == 'globalcollect' ) {
3535 $gatewayObj = new GlobalCollectAdapter();
 36+ //I have NO IDEA how this worked before you were explicitly adding the data here.
 37+ $gatewayObj->addData( $this->donationData );
3638 switch ( $method ) {
3739 // TODO: add other payment methods
3840 case 'cc':
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php
@@ -262,7 +262,8 @@
263263 'optout',
264264 'anonymous',
265265 'language',
266 - 'contribution_tracking_id', //sort of...
 266+ 'contribution_tracking_id', //sort of...
 267+ 'currency'
267268 );
268269 return $fields;
269270 }
@@ -280,11 +281,26 @@
281282 $this->setNormalizedOptOuts();
282283 $this->setLanguage();
283284 $this->handleContributionTrackingID();
 285+ $this->setCurrencyCode();
284286 array_walk( $this->normalized, array( $this, 'sanitizeInput' ) );
285287 }
286288 }
287289
288290 /**
 291+ * normalizeAndSanitize helper function
 292+ * Setting the currency code correctly.
 293+ */
 294+ function setCurrencyCode() {
 295+ global $wgRequest;
 296+ if ( !$this->isSomething('currency') ){
 297+ $code = $wgRequest->getVal('currency', null);
 298+ if (!is_null($code)){
 299+ $this->setVal('currency', $code);
 300+ }
 301+ }
 302+ }
 303+
 304+ /**
289305 * normalizeAndSanitize helper function.
290306 * Assures that if no contribution_tracking_id is present, a row is created
291307 * in the Contribution tracking table, and that row is assigned to the

Follow-up revisions

RevisionCommit summaryAuthorDate
r102012Last commit did some unnecessary stuff. Undoing....khorn17:18, 4 November 2011
r102020MFT r102011, r102012awjrichards18:13, 4 November 2011

Status & tagging log