public CreateOrderOptions()
        {
            var section = ECommerceSection.GetSection();

            OrderIdPrefix        = section.OrderIdPrefix;
            MinimumOrderIdLength = section.MinimumOrderIdLength;
            Currency             = section.DefaultCurrency;
        }
Ejemplo n.º 2
0
        private static void Upgrade()
        {
            var defaultCurrency = ECommerceSection.GetSection().DefaultCurrency;

            using (var data = new DataConnection())
            {
                var update = new List <IShopOrder>();

                var orders = data.Get <IShopOrder>().Where(o => o.Currency == null || o.Currency.Length == 0).ToList();
                foreach (var order in orders)
                {
                    order.Currency = defaultCurrency.ToString();

                    update.Add(order);
                }

                data.Update <IShopOrder>(update);

                orders = data.Get <IShopOrder>().Where(o => o.AuthorizationXml != null || o.AuthorizationTransactionId != null || o.CreditCardType != null).ToList();
                foreach (var order in orders)
                {
                    var paymentRequest = data.Get <IPaymentRequest>().SingleOrDefault(p => p.ShopOrderId == order.Id);
                    if (paymentRequest == null)
                    {
                        paymentRequest = data.CreateNew <IPaymentRequest>();

                        paymentRequest.ShopOrderId = order.Id;
                    }

                    paymentRequest.ProviderName               = ECommerceSection.GetSection().DefaultProvider;
                    paymentRequest.AuthorizationData          = order.AuthorizationXml;
                    paymentRequest.AuthorizationTransactionId = order.AuthorizationTransactionId;
                    paymentRequest.PaymentMethod              = order.CreditCardType;
                    paymentRequest.Accepted = (PaymentStatus)order.PaymentStatus == PaymentStatus.Authorized;

                    if (paymentRequest.DataSourceId.ExistsInStore)
                    {
                        data.Update(paymentRequest);
                    }
                    else
                    {
                        data.Add(paymentRequest);
                    }

                    order.AuthorizationXml           = null;
                    order.AuthorizationTransactionId = null;
                    order.CreditCardType             = null;

                    update.Add(order);
                }

                data.Update <IShopOrder>(update);
            }
        }
Ejemplo n.º 3
0
        public virtual string HandleCancel(HttpContextBase context)
        {
            var config = ECommerceSection.GetSection();

            var pageUrl = GetPageUrl(config.MainPageId);

            if (String.IsNullOrEmpty(pageUrl))
            {
                pageUrl = "/";
            }

            return(pageUrl + "?reason=cancel");
        }
        public static void CreatePaymentRequest(this IShopOrder order)
        {
            var defaultProvider = ECommerceSection.GetSection().DefaultProvider;

            CreatePaymentRequest(order, defaultProvider);
        }