r108522 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108521‎ | r108522 | r108523 >
Date:17:41, 10 January 2012
Author:khorn
Status:ok
Tags:
Comment:
Cleanup: Added a tiny bit of documentation and removed code that is either no longer used, or has been moved elsewhere.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/GatewayForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php
@@ -18,6 +18,10 @@
1919
2020 /**
2121 * GatewayForm
 22+ * This class is the generic unlisted special page in charge of actually
 23+ * displaying the form. Each gateway will have one or more direct descendants of
 24+ * this class, with most of the gateway-specific control logic in its execute
 25+ * function. For instance: extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
2226 *
2327 */
2428 class GatewayForm extends UnlistedSpecialPage {
@@ -29,20 +33,12 @@
3034 public $errors = array( );
3135
3236 /**
33 - * The adapter object
 37+ * The gateway adapter object
3438 * @var object $adapter
3539 */
3640 public $adapter;
3741
3842 /**
39 - * The form is assumed to be successful. Errors in the form must set this to
40 - * false.
41 - *
42 - * @var boolean
43 - */
44 - public $validateFormResult = true;
45 -
46 - /**
4743 * Constructor
4844 */
4945 public function __construct() {
@@ -206,34 +202,10 @@
207203 }
208204
209205 /**
210 - * Convert an amount for a particular currency to an amount in USD
211 - *
212 - * This is grosley rudimentary and likely wildly inaccurate.
213 - * This mimicks the hard-coded values used by the WMF to convert currencies
214 - * for validatoin on the front-end on the first step landing pages of their
215 - * donation process - the idea being that we can get a close approximation
216 - * of converted currencies to ensure that contributors are not going above
217 - * or below the price ceiling/floor, even if they are using a non-US currency.
218 - *
219 - * In reality, this probably ought to use some sort of webservice to get real-time
220 - * conversion rates.
221 - *
222 - * @param string $currency_code
223 - * @param float $amount
224 - * @return float
 206+ * logs messages to the current gateway adapter's configured log location
 207+ * @param string $msg The message to log
 208+ * @param string $log_level The severity level of the message.
225209 */
226 - static function convert_to_usd( $currency_code, $amount ) {
227 - require_once( dirname( __FILE__ ) . '/currencyRates.inc' );
228 - $rates = getCurrencyRates();
229 - $code = strtoupper( $currency_code );
230 - if ( array_key_exists( $code, $rates ) ) {
231 - $usd_amount = $amount / $rates[$code];
232 - } else {
233 - $usd_amount = $amount;
234 - }
235 - return $usd_amount;
236 - }
237 -
238210 public function log( $msg, $log_level=LOG_INFO ) {
239211 $this->adapter->log( $msg, $log_level );
240212 }
@@ -270,26 +242,6 @@
271243 }
272244
273245 /**
274 - * Get validate form result
275 - *
276 - * @return boolean
277 - */
278 - public function getValidateFormResult() {
279 -
280 - return ( boolean ) $this->validateFormResult;
281 - }
282 -
283 - /**
284 - * Set validate form result
285 - *
286 - * @param boolean $validateFormResult
287 - */
288 - public function setValidateFormResult( $validateFormResult ) {
289 -
290 - $this->validateFormResult = empty( $validateFormResult ) ? false : ( boolean ) $validateFormResult;
291 - }
292 -
293 - /**
294246 * Handle the result from the gateway
295247 *
296248 * If there are errors, then this will return to the form.

Follow-up revisions

RevisionCommit summaryAuthorDate
r112287MFT r101785, r105938, r105941, r105953, r106109, r106158, r106259, r106366, r...khorn01:29, 24 February 2012

Status & tagging log