<?xml version="1.0"?>
<!--
/**
 * Mageplaza
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Mageplaza.com license that is
 * available through the world-wide-web at this URL:
 * https://www.mageplaza.com/LICENSE.txt
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category    Mageplaza
 * @package     Mageplaza_GiftCard
 * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
 * @license     https://www.mageplaza.com/LICENSE.txt
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="sales_model_service_quote_submit_before">
        <observer name="sales_convert_quote_giftcard" instance="Mageplaza\GiftCard\Observer\SalesConvertQuote"/>
    </event>
    <event name="checkout_type_multishipping_create_orders_single">
        <observer name="sales_convert_quote_giftcard" instance="Mageplaza\GiftCard\Observer\SalesConvertQuote"/>
    </event>
    <event name="sales_model_service_quote_submit_failure">
        <observer name="sales_revert_quote_giftcard" instance="Mageplaza\GiftCard\Observer\OrderCancel"/>
    </event>
    <event name="sales_order_save_after">
        <observer name="sales_order_save_after_giftcard" instance="Mageplaza\GiftCard\Observer\OrderSaveAfter"/>
    </event>
    <event name="sales_order_invoice_save_after">
        <observer name="sales_order_invoice_save_after_giftcard" instance="Mageplaza\GiftCard\Observer\InvoiceSaveAfter"/>
    </event>
    <event name="sales_order_creditmemo_save_after">
        <observer name="sales_order_creditmemo_save_after_giftcard" instance="Mageplaza\GiftCard\Observer\CreditmemoSaveAfter"/>
    </event>
    <event name="payment_cart_collect_items_and_amounts">
        <observer name="mageplaza_gift_card_papal_prepare" instance="Mageplaza\GiftCard\Observer\PaypalPrepareItems"/>
    </event>
    <event name="checkout_cart_product_add_before">
        <observer name="mageplaza_gift_card_restrict_product_addtocart" instance="Mageplaza\GiftCard\Observer\RestrictProductAddToCart" />
    </event>
    <event name="controller_action_postdispatch_sales_order_reorder">
        <observer name="mageplaza_gift_card_restrict_product_reoder" instance="Mageplaza\GiftCard\Observer\CustomerReorder"/>
    </event>
    <event name="sales_convert_order_to_quote">
        <observer name="mageplaza_gift_card_restrict_product_reoder_admin" instance="Mageplaza\GiftCard\Observer\AdminReorder"/>
    </event>
</config>
