http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72338
Revision: 72338
Author: awjrichards
Date: 2010-09-04 00:48:47 +0000 (Sat, 04 Sep 2010)
Log Message:
-----------
Fix to bug 25032; Update to improve random order_id; Update to make order_id
completely un-sticky
Modified Paths:
--------------
trunk/extensions/DonationInterface/payflowpro_gateway/includes/payflowUser.inc
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
Modified:
trunk/extensions/DonationInterface/payflowpro_gateway/includes/payflowUser.inc
===================================================================
---
trunk/extensions/DonationInterface/payflowpro_gateway/includes/payflowUser.inc
2010-09-04 00:18:01 UTC (rev 72337)
+++
trunk/extensions/DonationInterface/payflowpro_gateway/includes/payflowUser.inc
2010-09-04 00:48:47 UTC (rev 72338)
@@ -24,7 +24,7 @@
'tender' => 'C', // credit card - all transactions in this case
are credit cards
'verbosity' => 'MEDIUM', // level of detail in Payflow response
'user_ip' => $_SERVER['REMOTE_ADDR'], // current user's IP
address
- 'order_id' => date( 'ymdH' ) . rand( 1000, 9999 ), // Generate
random order number
+ 'order_id' => (double) microtime() * 1000000 . mt_rand(), //
Generate random order number
);
return $payflow_data;
Modified:
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
===================================================================
---
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
2010-09-04 00:18:01 UTC (rev 72337)
+++
trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
2010-09-04 00:48:47 UTC (rev 72338)
@@ -90,18 +90,14 @@
// track the number of attempts the user has made
$numAttempt = ( $wgRequest->getText( 'numAttempt' ) == '' ) ?
'0' : $wgRequest->getText( 'numAttempt' );
- // Populate from data
- $data = $this->fnGetFormData( $amount, $numAttempt, $token );
-
-
// Get array of default account values necessary for Payflow
require_once( 'includes/payflowUser.inc' );
$payflow_data = payflowUser();
- // assign this order ID to the $data array as well
- if ( strlen( $data['order_id'] ) < 1 ) $data['order_id'] =
$payflow_data['order_id'];
-
+ // Populate from data
+ $data = $this->fnGetFormData( $amount, $numAttempt, $token,
$payflow_data['order_id'] );
+
// Check form for errors and display
// match token
$token_check = ( $wgRequest->getText( 'token' ) ) ?
$wgRequest->getText( 'token' ) : $token;
@@ -807,6 +803,7 @@
// include date
$transaction['date'] = time();
// send both the country as text and the three digit ISO code
+ $countries = countryCodes();
$transaction['country_name'] = $countries[$data['country']];
$transaction['country_code'] = $data['country'];
// put all data into one array
@@ -1027,9 +1024,9 @@
* Provides a way to prepopulate the form with test data using
$wgPayflowGatewayTest
* @return array
*/
- public function fnGetFormData( $amount, $numAttempt, $token ) {
+ public function fnGetFormData( $amount, $numAttempt, $token, $order_id
) {
global $wgPayflowGatewayTest, $wgRequest;
- if ( !$numAttempt && $wgPayflowGatewayTest ) { // if we're in
testing mode, prepopulate the form
+ if ( $wgRequest->getText( 'email' ) && !$numAttempt &&
$wgPayflowGatewayTest ) { // if we're in testing mode, prepopulate the form
// define arrays of cc's and cc #s for random selection
$cards = array( 'visa', 'mastercard', 'american',
'discover');
$card_nums = array(
@@ -1076,7 +1073,7 @@
'cvv' => '001',
'currency' => 'USD',
'payment_method' => $wgRequest->getText(
'payment_method' ),
- 'order_id' => $wgRequest->getText( 'orderid' ),
+ 'order_id' => $order_id,
'numAttempt' => $numAttempt,
'referrer' =>
'http://www.baz.test.com/index.php?action=foo&action=bar',
'utm_source' => '.Spam.Support.cc',
@@ -1110,7 +1107,7 @@
'cvv' => $wgRequest->getText( 'cvv' ),
'currency' => $wgRequest->getText(
'currency_code' ),
'payment_method' => $wgRequest->getText(
'payment_method' ),
- 'order_id' => $wgRequest->getText( 'orderid' ),
//will be set with $payflow_data
+ 'order_id' => $order_id,
'numAttempt' => $numAttempt,
'referrer' => $wgRequest->getText( 'referrer' ),
'utm_source' => $wgRequest->getText(
'utm_source' ),
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs