CommerceWeavers / SyliusSaferpayPlugin

Integration with Worldline Saferpay
https://www.commerceweavers.com/
MIT License
2 stars 9 forks source link

Many Transaction already Captured Messages in Log #115

Open revoltek-daniel opened 10 months ago

revoltek-daniel commented 10 months ago

Hello,

we use the Saferpay plugin in our shop and so far it looks like it is working fine.

However, we have noticed that there are a lot of "TRANSACTION_ALREADY_CAPTURED" messages in the transaction log.

We are not sure if this is the correct behaviour. Until now I can't track them down why they are happening. So any advice why there are so many errors and how we can prevent them?

Zales0123 commented 9 months ago

Hello Daniel!

Sorry for the long response time for the issue 🖖 I'm happy so far the plugin is working well for you. We will take a look at the mentioned issue and come back with some feedback/fix asap 🚀

Have a good day!

Zales0123 commented 9 months ago

Hello again, @revoltek-daniel. I've not been able to reproduce this bug. Is there any possibility you could find out more details about this issue? Thanks in advance! 🖖

revoltek-daniel commented 9 months ago

Hi,

not really, i try to reproduce the behavior on my local machine but I don't get the error there.

Could be the "heavy traffic" that causes the issues but, I can't find an schema. Or could the multi server setup be a problem? The lock is handled by "flock", but the load balancer should redirect the user back to the origin server.

Here are screenshots from today, in the first the overview this transaction all are "already captured", the second screenshot shows the response (i have redacted the ids)

grafik grafik

revoltek-daniel commented 5 months ago

I've invested some more debugging on this. It seems that this orders are handled by the webhook in the background so the payment is already captured in the capure action.

But this is a ErrorResponse so its get handled as an "Failure" and the status field in the payment details is set to "FAILED" this leads to an redirect to the sylius_shop_order_show route which displays an error because the order is already paid. https://github.com/CommerceWeavers/SyliusSaferpayPlugin/blob/main/src/Payum/Action/CaptureAction.php#L40 Correct should be an redirect to the sylius_shop_order_thank_you route if the name in the ErrorResponse field is TRANSACTION_ALREADY_CAPTURED

My not so perfect fix: https://github.com/revoltek-daniel/SyliusSaferpayPlugin/blob/feature/improve-logging/src/Payum/Action/CaptureAction.php#L44 we will try it in production and report if this works properly