r102020 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102019‎ | r102020 | r102021 >
Date:18:13, 4 November 2011
Author:awjrichards
Status:deferred
Tags:
Comment:
Modified paths:
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php
@@ -739,7 +739,14 @@
740740 */
741741 protected function stage_returnto( $type = 'request' ) {
742742 if ( $type === 'request' ) {
743 - $this->postdata['returnto'] = $this->postdata['returnto'] . '?' . wfArrayToCGI( array( 'order_id' => $this->postdata['order_id'] ) );
 743+ // Add order ID to the returnto URL, only if it's not already there.
 744+ //TODO: This needs to be more robust (like actually pulling the
 745+ //qstring keys, resetting the values, and putting it all back)
 746+ //but for now it'll keep us alive.
 747+ if ( !strpos( $this->postdata['returnto'], 'order_id' ) ){
 748+ $queryArray = array( 'order_id' => $this->postdata['order_id'] );
 749+ $this->postdata['returnto'] = wfAppendQuery( $this->postdata['returnto'], $queryArray );
 750+ }
744751 }
745752 }
746753
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php
@@ -244,6 +244,29 @@
245245 unset( $this->normalized[$key] );
246246 }
247247 }
 248+
 249+ /**
 250+ * Returns an array of all the fields that get re-calculated during a
 251+ * normalizeAndSanitize.
 252+ * This will most likely be used on the outside when in the process of
 253+ * adding data.
 254+ * @return array An array of values matching all recauculated fields.
 255+ */
 256+ function getCalculatedFields() {
 257+ $fields = array(
 258+ 'utm_source',
 259+ 'amount',
 260+ 'order_id',
 261+ 'i_order_id',
 262+ 'gateway',
 263+ 'optout',
 264+ 'anonymous',
 265+ 'language',
 266+ 'contribution_tracking_id', //sort of...
 267+ 'currency'
 268+ );
 269+ return $fields;
 270+ }
248271
249272 function normalizeAndSanitize() {
250273 if ( !empty( $this->normalized ) ) {
@@ -254,11 +277,26 @@
255278 $this->setNormalizedOptOuts();
256279 $this->setLanguage();
257280 $this->handleContributionTrackingID();
 281+ $this->setCurrencyCode();
258282 array_walk( $this->normalized, array( $this, 'sanitizeInput' ) );
259283 }
260284 }
261285
262286 /**
 287+ * normalizeAndSanitize helper function
 288+ * Setting the currency code correctly.
 289+ */
 290+ function setCurrencyCode() {
 291+ global $wgRequest;
 292+ if ( !$this->isSomething('currency') ){
 293+ $code = $wgRequest->getVal('currency', null);
 294+ if (!is_null($code)){
 295+ $this->setVal('currency', $code);
 296+ }
 297+ }
 298+ }
 299+
 300+ /**
263301 * normalizeAndSanitize helper function.
264302 * Assures that if no contribution_tracking_id is present, a row is created
265303 * in the Contribution tracking table, and that row is assigned to the
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
266304 Merged /trunk/extensions/DonationInterface:r102011-102012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102011The currency code was not being received all the way, from an api transaction...khorn17:11, 4 November 2011
r102012Last commit did some unnecessary stuff. Undoing....khorn17:18, 4 November 2011

Status & tagging log