Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Order Status Change with Mollie Payment Links (Admin Panel Only) #788

Open
youwe-erik opened this issue Jun 18, 2024 · 5 comments
Assignees
Labels
Investigating We are working on this issue together with the customer.

Comments

@youwe-erik
Copy link

youwe-erik commented Jun 18, 2024

Describe the bug
In Magento, orders with a "Canceled" status are typically considered final. However, a specific inconsistency occurs when using the "Mollie: Payment Link" payment method within the Admin area. In this scenario, a canceled order can transition back to a "Pending payment" status only when the order is created through the Admin panel. This behavior is confusing for store owners as it deviates from the standard flow.

Used versions

  • Magento Version number(eg 2.3.5): 2.4.4-p9
  • Open source/Enterprise/B2b: Enterprise
  • Mollie version number (Check configuration): 2.38.0

To Reproduce
Steps to reproduce the behavior:

  1. Go to Admin area
  2. Create an order
  3. Open the order and click the payment link.
  4. Ignore the payment link for more than 15 minutes
  5. Click "Fetch Status" in the Admin area.

The order is now canceled and can be opened again by clicking the Payment link again.

Expected behavior
An order's status should only be marked as "Canceled" after the payment window associated with the Mollie payment link has expired, regardless of whether the order was created through the Admin panel or the storefront. This aligns with the expected lifecycle of a canceled order and prevents confusion for store owners.

Actual behavior (Admin Panel):

  • When an order is created with the "Mollie: Payment Link" method in the Admin area:
    • The order is initially submitted and after the payment link is opened and ignored for more than 15 minutes, the order appears to be canceled if you "Fetch Status" after this time.
    • However, the order status can unexpectedly revert to "Pending payment" despite being canceled.
    • The "Fetch Status" button is not initially visible.
  • Clicking the checkout URL provided in the "Payment Information" section triggers the following changes:
    • The "Payment Status" changes to "Open" and the "Order Status" changes to "Pending payment."

Actual behavior (Storefront):

  • When an order is created with the "Mollie: Payment Link" method on the storefront:
    • The "Fetch Status" button is visible immediately.
    • The "Payment Status" does not expire even after 30 minutes.
    • The "Order Status" remains "Pending payment" and can be processed normally.
    • Clicking the "Fetch Status" button does not change the order status.

Potential impact:

  • Inventory management issues: Orders that become canceled too early while they should be "Pending payment" could cause automation to remove stock reservations too early.
@Frank-Magmodules
Copy link
Collaborator

Thank you for opening this issue and providing such a detailed description @youwe-erik . It's much appreciated.
I'll investigate this with the team and get back to you with a game plan.

@Frank-Magmodules Frank-Magmodules added the Investigating We are working on this issue together with the customer. label Jun 18, 2024
@Frank-Magmodules
Copy link
Collaborator

Hi There @youwe-erik ,

Thank you for opening this issue. I understand that this behavior can be confusing, but what you are describing is actually expected. Please note that the situation you mentioned is quite uncommon. The actual order process only begins when a customer clicks on the payment link, at which point the expiration time starts running.

If we allowed canceled orders to remain canceled, it would create confusion for customers regarding how to proceed with payment. Therefore, we decided to "uncancel" the order, but only if there is sufficient stock available for the products in the order. I hope this clarifies the situation. If you have any further questions, please feel free to ask!

@youwe-erik
Copy link
Author

Hello @Frank-Magmodules ,

Thank you for your response! The point is, there is no reason to set the order to canceled in Magento when you click the "Fetch Status" button at that time. It should keep the status "Pending Payment" unless the order is actually canceled in Mollie as well.

The issue is not about the canceled orders reverting to "Pending Payment", it's about the behavior of canceling the orders at all at that point.

Could you please help us understand why this behavior is intended to be different when placing an order through the Admin area and through the storefront.

@Frank-Magmodules
Copy link
Collaborator

Hi @youwe-erik

This is a bit hard to explain, but let’s try:
The problem you are describing is only relevant to orders placed through the orders API. Any method can support the orders API, but only a few require it. When an order is placed through the orders API, you get an order object, but this also contains a payments API object. This payments API object will expire quite fast, in 15 minutes. But this doesn’t cancel the orders API object. The order object has a way longer expiration. When that gets canceled, the webhook gets triggered and the order in Magento gets canceled.

Now, when clicking the “Fetch Status” button in the backend, you are simulating an incoming webhook. This checks the state of the order and payment objects. As the payment object is canceled, the whole order gets canceled, as expected. This leads to the behavior you are seeing.

In a normal flow this doesn’t happen, the expiration is way higher.
Because you are intervening with the order, this behavior starts to occur.

@youwe-erik, please feel free to share your thoughts and ideas on how we can improve this.
Your opinion and vision are very much appreciated!

@youwe-erik
Copy link
Author

Hey @Frank-Magmodules ,

Thank you very much for your explanation! It's clear to me now how this makes sense from the Mollie side of things. However from a Magento perspective orders typically cannot go from a canceled state back into an open state. Once they are canceled a new order should be created.

To prevent this from being an issue, I would like to suggest changing the behavior of the module so that the order is only canceled by the webhook when both the Mollie payment and the Mollie order object are canceled. In practice this means that "Fetch Status" (and any other webhooks) will only cancel the order in Magento if both the Mollie payment and Mollie order object are canceled.

Please let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigating We are working on this issue together with the customer.
Projects
None yet
Development

No branches or pull requests

2 participants