Hi,

I have noticed a problem with the pxaccess module.

If a user refreshes their browser when on the payment result page(Url success page) the payment is recorded again. That is every time the success page is reached even with the same transaction data(result query string) another payment is recorded. This causes the ability for multiple payments to be recorded against an order when only one actual payment has taken place. DPS have a Fail Proof Result Notification (FPRN) which means by default for every transaction the website will get 2 notifications. This can cause payments to be recorded twice.

My solution for this is (editing the uc_dps_pxaccess.module file) editing the function uc_dps_pxaccess_callback_process.

I have added this code on line 350. It checks to see if the payment has been recorded previously.

// 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;
				}
		  }
	  }

If the payment is not found then this line (modified - NULL replaced with $result->dpstxnref) records the payment

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

i'm not sure if this is a good way to resolve the issue but it seems to work.

I think this also should stop duplicate emails being sent due to the FPRN requests, but I have not tested this.

Comments

xurizaemon’s picture

Assigned: Unassigned » xurizaemon
Status: Active » Needs work

Thanks for reporting and debugging, Tristan.

This issue relates to #892606: Repeating Payment error - Payments every 10 minutes.

Care to provide a patch as well?

xurizaemon’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
StatusFileSize
new4.74 KB

Here's a patch to test for this issue. It's against current dev. This issue appears to be duplicated in #1077756: Status not updating to Payment Received (PxAccess) (although that issue has some CA support questions too).

xurizaemon’s picture

Status: Needs work » Needs review
timtunbridge’s picture

I can confirm this patch fixed the duplicate payment issue as noted under #1077756: Status not updating to Payment Received (PxAccess).

xurizaemon’s picture

Status: Needs review » Fixed

Looks like this patch was committed in #1077756: Status not updating to Payment Received (PxAccess).

Status: Fixed » Closed (fixed)

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