Click or drag to resize

OrderOnBeforeSendingOrderToErp Field

Occurs before a cart or order is sent to the ERP.

Namespace:  Dynamicweb.Ecommerce.LiveIntegration.Notifications
Assembly:  Dynamicweb.Ecommerce.LiveIntegration (in Dynamicweb.Ecommerce.LiveIntegration.dll) Version: 3.0.1
Syntax
public const string OnBeforeSendingOrderToErp = "Dynamicweb.Ecommerce.LiveIntegration.Notifications.LiveIntegration.OnBeforeSendingOrderToErp"

Field Value

Type: String
Examples
C#
using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Ecommerce.LiveIntegration.Notifications;

namespace Dynamicweb.Ecommerce.LiveIntegration.Examples.Notifications
{    
    /// <summary>
    /// Class OrderBeforeSendToErpSubscriber.
    /// </summary>
    /// <seealso cref="NotificationSubscriber" />
    [Subscribe(Order.OnBeforeSendingOrderToErp)]
    public class OrderBeforeSendToErpSubscriber : NotificationSubscriber
    {
        /// <summary>
        /// Call to invoke observer.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <param name="args">The args.</param>
        public override void OnNotify(string notification, NotificationArgs args)
        {
            var myArgs = (Order.OnBeforeSendingOrderToErpArgs)args;

            // TODO: Add code here
            // Sample: when order price less than 1000 cancel order sending
            if (myArgs.CreateOrder && myArgs.Order.Price.PriceWithVAT < 1000)
            {
                myArgs.Cancel = true;
            }
        }
    }
}
See Also