CommerceWeavers/SyliusSaferpayPlugin

Many Transaction already Captured Messages in Log

Opened this issue ยท 4 comments

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?

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!

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! ๐Ÿ––

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

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