Skip to content

Cancel Order Observer not executed when scope is frontend or webapi_rest scope #40414

@bscthartmann

Description

@bscthartmann

Preconditions and environment

Magento 2.4.7-p8
PSP: Mollie

When a refund is made or an cancel of the order, this is done via webhook etc. More important it work in the scope "frontend" with Mollie. That means the event "order_cancel_after" to execute "Magento\GiftCardAccount\Observer\SalesOrderCancelAfter" is not handled since the following xml is located within etc/adminhtml/di.xml.

    <event name="order_cancel_after">
        <observer name="magento_giftcardaccount_global"
                  instance="Magento\GiftCardAccount\Observer\SalesOrderCancelAfter" />
    </event>

For me this looks like a bug since this prevents for instance gift cards from being refunded.

Steps to reproduce

  1. Make an order with a gift card
  2. Cancel the order via Mollie webhook or with a test script and emulation of frontend scope
  3. Check if gift card is restored

Expected result

Gift Card is restored with the full value

Actual result

gift card was not restored and gift card history table was not updated

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Ready for Confirmation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions