- Issue created by @DiDebru
- Merge request !43463076: Add 30 seconds sleep. Not tested yet. Might cause the request to fail... → (Open) created by DiDebru
- 🇦🇹Austria agoradesign
I'll copy here my comment in the Slack thread:
I have seen that there is 📌 Add Capture, Void and Refund / Partial Refund capabilities RTBC adding refund capability. The MR5 of that issue is incorporating further changes into one MR. It handles the API version issue as well ( ✨ Make it compatible with latest Saferpay API Active ), and also tries to solve the concurrency issue with the sleep() command ( 🐛 Saferpay webhook faster than customer Active )
Additionally, I needed to allow not collecting billing information from ✨ Allow not collecting billing information Active
As I'm not a big fan of the sleep() solution, I've worked toward the solution I have done in commerce_opp, to:
do process the payment in onReturn()
add a dependency on advancedqueue and implement a JobType for processing the payment
only do some basic checks inside onNotify(), but instead processing it, create a queue item and let it handle by cron
additionally, to avoid clashing with a cron run in the same second, I've delayed the processing of the queue item to 60 seconds (which we could make configurable)
I've done different test payments now in staging. If the customer returns, the payment is processed successfully. On cron, the job can early exit, as the order is already paid. It's also easy to close the browser tab after finishing the payment but before the customer has returned to the page. So the order stays as cart, until the queue job has been processed, where the payment is processed and the order placed
So the big question is, if we wanna add a dependency on advancedqueue?! Alternatively, we could do a moduleExists() check and either use the queue or do the sleep (and optionally locking) stuff - 🇦🇹Austria agoradesign
While it's not ideal to have a jungle of different patches and merge requests that cover multiple issues at once, I do not want to hide my solution and share my patch with you