r79211 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79210‎ | r79211 | r79212 >
Date:22:02, 29 December 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Added configurable price floor and price cieling variables; Modified donation amount validation to check donation amount against set price floor and price cieling
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -279,6 +279,8 @@
280280 * Checks posted form data for errors and returns array of messages
281281 */
282282 private function fnPayflowValidateForm( &$data, &$error ) {
 283+ global $wgPayflowPriceFloor, $wgPayflowPriceCieling;
 284+
283285 // begin with no errors
284286 $error_result = '0';
285287
@@ -310,7 +312,9 @@
311313 }
312314
313315 // check amount
314 - if ( !preg_match( '/^\d+(\.(\d+)?)?$/', $data['amount'] ) || $data['amount'] == "0.00" ) {
 316+ if ( !preg_match( '/^\d+(\.(\d+)?)?$/', $data[ 'amount' ] ) ||
 317+ ( (float) $data[ 'amount' ] < (float) $wgPayflowPriceFloor ||
 318+ (float) $data[ 'amount' ] > (float) $wgPayflowPriceCieling ) ) {
315319 $error['invalidamount'] = wfMsg( 'payflowpro_gateway-error-msg-invalid-amount' );
316320 $error_result = '1';
317321 }
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php
@@ -147,6 +147,12 @@
148148 $wgPayflowGatewayUseSyslog = false;
149149
150150 /**
 151+ * Configure price cieling and floor for valid contribution amount
 152+ */
 153+$wgPayflowPriceFloor = '1.00';
 154+$wgPayflowPriceCieling = '10000.00';
 155+
 156+/**
151157 * Hooks required to interface with the donation extension (include <donate> on page)
152158 *
153159 * gwValue supplies the value of the form option, the name that appears on the form

Status & tagging log