mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
100 stars 53 forks source link

[ISSUE] Orders are systematically canceled prematurely, ignoring 28 days default grace period #658

Closed nh-mdev closed 1 year ago

nh-mdev commented 1 year ago

Describe the bug Orders are canceled prematurely,ignoring the 28 days default grace period. As soon as an order has one expired transaction associated, it gets canceled. The cancellation itself is not immediate, it happens at a later point in time varying between 1-16 hours, always at full hour marks, e.g. 21:00, 01:00, 6:00.

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Create order, create a payment link.
  2. Don't pay.
  3. The initial order transaction will expire.
  4. The order will not be canceled.
  5. Ideally, wait 24 hours (can happen sooner).
  6. Check the order status in magento and mollie.
  7. It should be canceled.
  8. In the mollie "History" sidebar, it should say something along these lines: "Order ord_cs3j6e has been canceled from status created 13 June 2023 at 21:00"

Expected behavior Orders should not be automatically canceled before the configured grace period time is over, no matter how many associated transactions are expired.

Actual behavior Orders having at least one expired transaction are systematically canceled before the grace period runs out.

Screenshots image image image

Additional context We know it is happening for magento orders where the payment method is "Mollie: Payment Link". We think it is an systematic issue, because the cancellation timing looks suspiciously like a cron-job or similiar logic.
The cancellation itself is not immediate, it happens at a later point in time varying between 1-16 hours, always at full hour marks, e.g. 21:00, 01:00, 6:00.

Most likely related to: https://github.com/mollie/magento2/issues/657

simonmaass commented 1 year ago

I can confirm this issue!

Just an idea... I believe that in mollie the order is still on "created" but the transaction is expired when this happens... maybe magento is fetching the last transaction status and not the order status in mollie...

Swahjak commented 1 year ago

I think we might be seeing similar issues with a canceled and webhook executed at the exact same time + a canceled order.

Frank-Magmodules commented 1 year ago

Hi @Swahjak , @nh-mdev and @simonmaass ,

Thank you for opening this issue and for your responses on this. These orders are probably canceled due to the sales_clean_orders cron that is defaulted in Magento.

To prevent these orders from being canceled, you can set a different order status under: Stores -> Configuration -> Mollie -> Advanced -> Statuses -> Status Pending (You might need to create one first). image (14)

If that’s being set, new orders will get this status by default and will not get canceled by the Magento cron. Can you let me know if this indeed covers your issue?

simonmaass commented 1 year ago

@Frank-Magmodules After creating a new "Status" the status needs to be assigned to a "State". I believe that in the mollie module config only Status are displayed for "Status Pending" Dropdown if the Status is assinged to the magento core state "pending_payment"... but somehow after creating a new status i am not able to assign this status to the state "pending_payment"... please advise...

For now we have set the following setting as a workaround to 28 days: Stores -> Configuration -> Sales -> Sales -> Orders Cron Settings -> Pending Payment Order Lifetime (minutes)

Frank-Magmodules commented 1 year ago

Hi there @simonmaass , Just to double-check this one.

Are you sure that you added the new status to the correct state? It should be connected to “pending payment”, but it’s easy to mistake that for “pending review”. image (1)

simonmaass commented 1 year ago

@Frank-Magmodules i am not able to select "Pending Payment" state as it is not listed in the dropdown:

image
Frank-Magmodules commented 1 year ago

Hi There @simonmaass , From this point it’s hard to say what's and why this is exactly happening, as it is default Magento and we don’t touch that area. We can always take a look with you if you fill in our contact form.

Frank-Magmodules commented 1 year ago

Hello @simonmaass, any updates on this matter, or is there any way we can assist you now? Kindly inform us, so we'll work together to resolve this issue promptly! Thanks!

simonmaass commented 1 year ago

Hey @Frank-Magmodules , as stated above we are not able to "fix" this issue with the workaround provided, as we are not able to select the Order State "Payment Pending" in the dropdown as shown in the screenshot above... havent found a solution for this either...

Frank-Magmodules commented 1 year ago

Hi There @simonmaass , can you share temporary details through our contact form so we can take a look with you and help you out?

Frank-Magmodules commented 1 year ago

Hello, @simonmaass. I haven't received any messages from you regarding this matter. Is this still relevant, or can we close this ticket?

Frank-Magmodules commented 1 year ago

Hello @simonmaass, Let's continue our discussion within our email thread regarding this matter. It appears that this issue is more closely tied to the environment rather than being a direct problem with the Mollie plugin. Nonetheless, we're more than willing to assist you in reaching a resolution. Looking forward to working together towards a solution.