Hi, I've ogt an unusual problem with Drupal/Ubercart and this module although I'm not sure which.

The problem is in the payment log for one of the orders on the site, the payment, which should just be a one-off payment, is occuring every 10 minutes almost to the second. The Payment log entries look like this:

Received User Method Amount Balance Comment
25/08/2010
10:44:41 - Credit Card via PaymentExpress $72.00 -$144.00 Order ID: 45
25/08/2010
10:54:42 - Credit Card via PaymentExpress $72.00 -$215.99 Order ID: 45
25/08/2010
11:04:45 - Credit Card via PaymentExpress $72.00 -$287.99 Order ID: 45
25/08/2010
11:14:48 - Credit Card via PaymentExpress $72.00 -$359.99 Order ID: 45
25/08/2010
11:24:49 - Credit Card via PaymentExpress $72.00 -$431.99 Order ID: 45

And it's still going as I write this :p

The Drupal Log report looks like this:

Type Date User
uc_dps_pxaccess 25/08/2010 - 11:04 Anonymous
uc_dps_pxaccess 25/08/2010 - 11:14 Anonymous
uc_dps_pxaccess 25/08/2010 - 11:24 Anonymous

I Checked with DPS and they only recieved the first transaction (Good News!), not all the others every 10 minutes... I guess it's good we use a 'hosted' payment page ;)

So there's something in the system that's automatically entering these payments against the order... Any ideas?

Drupal 6.16
Ubercart 6.x-2.2
Ubercart PaymentExpress (PXAccess, PXPay and PXPost from DPS) 6.x-1.0

Comments

dean.p’s picture

I've just noticed on other orders, there is duplicate entries for payment (but only two entries), e.g.:

10/08/2010
15:31:17 - Credit Card via PaymentExpress $12.50 $0.00 Order ID: 27
10/08/2010
15:31:22 - Credit Card via PaymentExpress $12.50 -$12.50 Order ID: 27

tristanworley’s picture

The repeated orders every 10 minutes was an issue with DPS's FPRN system which has long since been resolved. This highlighted an issue with the code that does not check if the transaction has previously been recorded before it records it. This means if you happened to refresh your browser when on the payment success page your payment would be recorded twice.

I have worked around this with the following code

Replace this line

uc_payment_enter($txn->order_id, 'uc_dps_pxaccess', $txn->order_total, $order->uid, NULL, $comment);  

with this code

// check if payment already received.
	  $payments = uc_payment_load_payments($txn->order_id);
	   if($payments){
		  foreach($payments as &$value){
				if($value->data == $result->dpstxnref){
					// payment recoreded already don't add this payment just show success page
					$output = theme("uc_dps_pxaccess_returnpage_output_success", $result, $txn);     
					drupal_set_message( 'Your transaction was completed' ) ;
					return $output;
				}
		  }
	  }
	  
	  uc_payment_enter($txn->order_id, 'uc_dps_pxaccess', $txn->order_total, $order->uid, $result->dpstxnref, $comment);   

What this is doing is storing the dpstxnref (a unique value for every transaction) with each payment. On receiving a payment notification it checks to see if there are any payments already listed with the returned dpstxnref. If one is found then it exits the code and displays the transaction completed message.

I believe this code should also stop duplicate emails being sent due to the FPRN request but have not tested this.

tristanworley’s picture

Sorry forgot to mention this was in the file uc_dps_pxaccess.module

xurizaemon’s picture

Assigned: Unassigned » xurizaemon
Status: Active » Fixed

Marking this support request fixed.

Tristan's workaround is now in a separate issue, #923718: No FPRN Handling/Payments duplicated.

Thanks Tristan for looking into this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.