예제 #1
0
        /// <summary>
        /// Processes an order cancelled event
        /// </summary>
        /// <param name="order">Order that has been cancelled</param>
        public static void OrderCancelled(Order order)
        {
            order.Notes.Add(new OrderNote(order.OrderId, order.UserId, LocaleHelper.LocalNow, Properties.Resources.OrderCancelled, NoteType.SystemPrivate));
            order.Notes.Save();
            UpdateOrderStatus(StoreEvent.OrderCancelled, order);
            //if this is a google checkout order update google checkout
            if (!string.IsNullOrEmpty(order.GoogleOrderNumber))
            {
                GoogleCheckout instance = GoogleCheckout.GetInstance();
                string         comment  = order.GetLastPublicNote();
                if (string.IsNullOrEmpty(comment))
                {
                    comment = "N/A";
                }
                instance.CancelOrder(order.GoogleOrderNumber, comment);
            }

            // DELETE ALL ASSOCIATED SUBSCRIPTIONS
            SubscriptionDataSource.DeleteForOrder(order.OrderId);

            Hashtable parameters = new Hashtable();

            parameters["order"]    = order;
            parameters["customer"] = order.User;
            parameters["payments"] = order.Payments;
            ProcessEmails(StoreEvent.OrderCancelled, parameters);
        }