Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php |
— | — | @@ -18,6 +18,10 @@ |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * 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 |
22 | 26 | * |
23 | 27 | */ |
24 | 28 | class GatewayForm extends UnlistedSpecialPage { |
— | — | @@ -29,20 +33,12 @@ |
30 | 34 | public $errors = array( ); |
31 | 35 | |
32 | 36 | /** |
33 | | - * The adapter object |
| 37 | + * The gateway adapter object |
34 | 38 | * @var object $adapter |
35 | 39 | */ |
36 | 40 | public $adapter; |
37 | 41 | |
38 | 42 | /** |
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 | | - /** |
47 | 43 | * Constructor |
48 | 44 | */ |
49 | 45 | public function __construct() { |
— | — | @@ -206,34 +202,10 @@ |
207 | 203 | } |
208 | 204 | |
209 | 205 | /** |
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. |
225 | 209 | */ |
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 | | - |
238 | 210 | public function log( $msg, $log_level=LOG_INFO ) { |
239 | 211 | $this->adapter->log( $msg, $log_level ); |
240 | 212 | } |
— | — | @@ -270,26 +242,6 @@ |
271 | 243 | } |
272 | 244 | |
273 | 245 | /** |
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 | | - /** |
294 | 246 | * Handle the result from the gateway |
295 | 247 | * |
296 | 248 | * If there are errors, then this will return to the form. |