private void CleanupOrder(MyHLShoppingCart cart, string distributorId)
        {
            if (!IsPostBack)
            {
                if (PurchasingLimitProvider.RequirePurchasingLimits(distributorId, _country))
                {
                    PurchasingLimitProvider.ReconcileAfterPurchase(cart, distributorId, _country);
                }

                if (cart != null)
                {
                    // take out quantities from inventory
                    ShoppingCartProvider.UpdateInventory(cart, cart.CountryCode, cart.Locale, true);
                }

                cart.CloseCart();
            }
        }
        private void SubmitOrder(string orderNumber)
        {
            string           distributorId = string.Empty;
            string           locale        = string.Empty;
            string           error         = string.Empty;
            MyHLShoppingCart shoppingCart  = null;
            var holder   = new SerializedOrderHolder();
            var response = new PagoSeguroPaymentGatewayResponse();

            response.OrderNumber = orderNumber;
            response.IsApproved  = true;

            if (OrderProvider.deSerializeAndSubmitOrder(response, out error, out holder))
            {
                locale = holder.Locale;
                if (!String.IsNullOrEmpty(holder.Email))
                {
                    //DistributorProvider.LoadDistributor(holder.DistributorId, holder.Token);
                    shoppingCart = ShoppingCartProvider.GetBasicShoppingCartFromService(holder.ShoppingCartId,
                                                                                        holder.DistributorId, locale);
                    shoppingCart.EmailAddress = holder.Email;
                    shoppingCart.Totals       = (holder.Order as Order_V01).Pricing as OrderTotals_V01;
                    EmailHelper.SendEmail(shoppingCart, holder.Order as Order_V01);
                }
                if (null != shoppingCart)
                {
                    ShoppingCartProvider.UpdateInventory(shoppingCart, shoppingCart.CountryCode, shoppingCart.Locale,
                                                         true);
                    shoppingCart.CloseCart();
                }
            }
            else
            {
                PaymentGatewayInvoker.LogMessage(PaymentGatewayLogEntryType.Error, orderNumber, distributorId,
                                                 "PagoSeguroPaymentGateway", PaymentGatewayRecordStatusType.InError,
                                                 error);
            }
        }