We encountered a situation where a customer reversed a PayPal payment, disputed payment, then cancelled the reversal, but the dispute and reversal cancellations were never recorded in Ubercart.
The attached PDF shows a screen grab from the watchdog log (newest at top), showing the original order, the reversal, a posting of a dispute, and the cancellation. You can see that on the latter two, watchdog posted "IPN transaction ID has been processed before."
The relevant code in file uc_paypal.pages.inc is this (beginning at line 92), which happens BEFORE any IPN processing takes place:
$duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_paypal_ipn} WHERE txn_id = :id AND status <> :status', 0, 1, array(':id' => $txn_id, ':status' => 'Pending'))->fetchField();
if ($duplicate) {
if ($order->payment_method != 'credit') {
watchdog('uc_paypal', 'IPN transaction ID has been processed before.', array(), WATCHDOG_NOTICE);
}
return;
}
Clearly, if 'IPN transaction ID has been processed before.' is getting posted to the watchdog, there is no further processing of the order, which means that the program flow never gets down to the case 'Canceled_Reversal' at line 114 that is supposed to handle the reversal.
In addition to ignoring the Canceled_Reversal IPN action, it looks like there is no code branch to handle the posting of the dispute, even if the duplicate check hadn't eliminated it.
The duplicate-checking code above seems to ignore any IPNs with the same txn_id if the order status is anything but Pending. But clearly, reversals, reversal cancellations, refunds, and disputes can all happen with Completed orders. So it would seem that the duplicate-checking code logic should be a bit more complex than the above.
Comments?
Robert
| Comment | File | Size | Author |
|---|---|---|---|
| order logs.pdf | 523.43 KB | rjlang |
Comments
Comment #1
tr commentedAll true. The original authors of Ubercart didn't include support for refunds/returns/cancellations/etc. It is something we would like to add. If it's important to you, perhaps you can work on this and post a patch so we can get this functionality into Ubercart.
If you search all the issues in this queue (not just open issues) you will find much discussion and explanation of this:
https://www.drupal.org/project/issues/ubercart?text=refund&status=All&pr...
Closing this current issue in favor of #781720: Refactor the Paypal WPS IPN code, which I think is the closest to what you're reporting. You should post your above comment in there and perhaps try out / work on the patch to help bring it to completion.