MultiSafepay / Magento2Msp

MultiSafepay plugin for Magento 2 (Deprecated) see: https://github.com/MultiSafepay/magento2
Open Software License 3.0
29 stars 25 forks source link

Order status is on processing before invoice is created #143

Closed davekleijn closed 4 years ago

davekleijn commented 4 years ago

Magento version 2.3.5-p2 MSP version: 1.14.0

When I create an order with for example iDeal, the order has the status processing already, while no invoice has yet been created. This ultimately causes problems. This is not normal Magento behaviour. That is because the status is updated from pending to processing when the invoice is created.

After 10-15 minutes the invoice is created and the status remains the same. But if we create a shipment in the meantime (because the order is in processing state) the order will never get a status complete.

Jasper-MultiSafepay commented 4 years ago

@Davie82 The notification or webhooks will call your Magento2 to create the invoice immediately. Not after 10-15 minutes. See also https://docs.multisafepay.com/faq/api/how-does-the-notification-url-work/

Our systems cannot reach your .test domain, so then you will see this weird behaviour. Please make sure to use a domain that is publicly reachable.

davekleijn commented 4 years ago

@Jasper-MultiSafepay

I understand that in most cases this happens immediately, but this is not always the case in our production environment. We see callbacks after 10-15 minutes for many orders.

screenshot

I also understand that the systems cannot reach my .test domain, that is not my point. Even if I test this locally the status is still changed to processing even if the invoice is not created yet and the webhook can not be called.

I tested this on our staging environment and all order statuses are changed immediately after they are placed and before the webhook is called.

Inside \MultiSafepay\Connect\Controller\Connect\Success::execute method $paymentMethod->notification(); is called. This will eventually change the order status to processing without creating an invoice.

So I do not understand why this is happening. Is this expected behaviour? And why is the invoice not created during this method call.

Jasper-MultiSafepay commented 4 years ago

@Davie82 Yes, currently this is expected behaviour. On the success page, we would like the customer to be able to see/check his order that has been placed. If we do not set the order status to processing, the customer will not be able to check his placed order, due to the order still be pending.

Of course, the order status will be set to processing with the notifications, but there are cases where the customer will be on the success page before the notification is handled.

We will only create an invoice on the notification and not on the success page to prevent double invoices (which happens sometimes)