MultiSafepay / magento2

MultiSafepay plugin for Magento 2
Open Software License 3.0
19 stars 8 forks source link

MSP end point should not change the status of On Hold orders. #40

Closed Hexmage closed 1 year ago

Hexmage commented 1 year ago

Is your feature request related to a problem? Please describe. We installed a module that does some checks based on values on the order and then places that order on "On Hold". But when Multisafepay creates the invoice it moves the order to processing, ignoring the "On Hold" status.

Describe the solution you'd like When an order is on "On Hold" the module notification endpoint should not update the product status.

vinodsowdagar commented 1 year ago

Hi @Hexmage ,

Thanks, we are currently looking into this and come back to you later.

vinodsowdagar commented 1 year ago

Hi @Hexmage ,

It seems that this could maybe be a race condition, where our webhook comes in, fetches the order in pending_payment state, creates the invoice and after that, your module puts it in 'on hold' state. After that our module is done with the creation of the invoice and saves the order. But the instance of the order that our module had is still the one which was in 'processing' state.

I think this is the case, because if i try to manually set an order on hold and after that try to process the webhook, our module will actually not set the order to processing and will not create an invoice, because $order->canInvoice() is false at this point.

We are actually currently refactoring our notification/webhook process, which will hopefully solve this issue. It will be a major release, which is currently not yet scheduled. But when we have released it, we will give you an update.

vinodsowdagar commented 1 year ago

Hi @Hexmage ,

We have released version 3.0.0 with the refactoring of the webhook processes: https://github.com/MultiSafepay/magento2/releases/tag/3.0.0

Please note that this is a major version and we recommend to thoroughly test it on a staging environment first. We expect this issue to not happen anymore after upgrading.

For now i am closing this issue. If you are still experiencing this issue after the upgrade, please place a comment here again so we can reopen it.