Currently it may happen that the onReturn() and onNotify() requests are overlapping in such a manner that an order gets placed twice. Fortunately this module is not as often concerned as other offsite payment gateways, but sometimes it happens. It's basically a Commerce core problem, reported in several issues, eg #3043180: The changes made to the order on the onNotify method are not applied on the onReturn method

In the long run, this has to be solved within Commerce by an appropriate order locking mechanism. In the meantime, we should find a proper solution for ourselves. I've implemented one for commerce_opp that can be adjusted for this module too: #3172880: Use locks in onReturn() and in webhooks controller to fight overlapping payment update problem

Comments

agoradesign created an issue. See original summary.

agoradesign’s picture

Status: Active » Needs review
StatusFileSize
new16.09 KB

Please note that this patch is completely untested yet! Try in a test environment first!

agoradesign’s picture

StatusFileSize
new16.09 KB

re-roll #2 against latest dev (patch from #2 is still the one to use with alpha2)

agoradesign’s picture

StatusFileSize
new16.32 KB

patches from #2 and #3 are both lacking the $this->orderLock = $order_lock; call inside constructor. This version works

agoradesign’s picture

StatusFileSize
new16.37 KB

  • agoradesign committed 274e3f1 on 8.x-1.x
    Issue #3177314 by agoradesign: Use locks in onReturn() and in onNotify...
agoradesign’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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