Exemplo n.º 1
0
        public Order(OrderInfo orderInfo)
        {
            Name          = orderInfo.Name;
            TermsAccepted = orderInfo.TermsAccepted;
            PaidDate      = orderInfo.PaidDate;
            FulfillDate   = orderInfo.FulfillDate;
            ConfirmDate   = orderInfo.ConfirmDate;
            OrderLines    = orderInfo.OrderLines.Select(line => new OrderLine(line)).ToList();
            CouponCodes   = orderInfo.CouponCodesData;
            CustomerInfo  = orderInfo.CustomerInfo;
            ShippingInfo  = orderInfo.ShippingInfo;
            PaymentInfo   = orderInfo.PaymentInfo;
            StoreInfo     = orderInfo.StoreInfo;
            CurrencyCode  = orderInfo.Localization.CurrencyCode;
            // todo: onderstaand kan waarschijnlijk anders (geen check = dubbel)
            Discounts    = orderInfo.Discounts.Select(discount => new OrderDiscount(orderInfo.Localization, discount, orderInfo)).ToList();          // todo: add/save used coupon code
            IncludingVAT = orderInfo.PricesAreIncludingVAT;

            VatCalculatedOverParts = orderInfo.VatCalculationStrategy is OverSmallestPartsVatCalculationStrategy;

            PaymentProviderPrice           = orderInfo.PaymentProviderAmount;
            PaymentProviderOrderPercentage = orderInfo.PaymentProviderOrderPercentage;

            ShippingProviderPrice = orderInfo.ShippingProviderAmountInCents;
            RegionalVatAmount     = orderInfo.RegionalVatInCents;

            VATCharged    = orderInfo.VATCharged;
            ChargedAmount = orderInfo.ChargedAmountInCents;

            CorrespondingOrderDocumentId = orderInfo.OrderNodeId;

            RevalidateOrderOnLoad = orderInfo.RevalidateOrderOnLoad;           // version 2.1 hack
            ReValidateSaveAction  = orderInfo.ReValidateSaveAction;            // version 2.1 hack

            StockUpdated      = orderInfo.StockUpdated;
            CreatedInTestMode = orderInfo.CreatedInTestMode;
        }
Exemplo n.º 2
0
        public void Save(OrderInfo order, bool revalidateOrderOnLoadHack = false, ValidateSaveAction validateSaveAction = ValidateSaveAction.Order)
        {
            // todo: DIP
            order.ReValidateSaveAction  = validateSaveAction;
            order.RevalidateOrderOnLoad = revalidateOrderOnLoadHack;

            order.FireBeforeOrderUpdatedEvent();

            if (order.Status == OrderStatus.Incomplete)
            {
                OrderHelper.SetOrderCookie(order);
            }

            if (order.Status == OrderStatus.Incomplete)
            {
                order.OrderDate = DateTime.Now.ToString("f");

                RemoveDiscountsWithCounterZeroFromOrder(order);
            }

            _orderRepository.SaveOrderInfo(order);

            order.FireAfterOrderUpdatedEvent();
        }
		public void Save(OrderInfo order, bool revalidateOrderOnLoadHack = false, ValidateSaveAction validateSaveAction = ValidateSaveAction.Order)
		{
			// todo: DIP
			order.ReValidateSaveAction = validateSaveAction;
			order.RevalidateOrderOnLoad = revalidateOrderOnLoadHack;

			order.FireBeforeOrderUpdatedEvent();

			if (order.Status == OrderStatus.Incomplete)
			{
				OrderHelper.SetOrderCookie(order);
			}

			if (order.Status == OrderStatus.Incomplete)
			{
				order.OrderDate = DateTime.Now.ToString("f");

				RemoveDiscountsWithCounterZeroFromOrder(order);
			}

			_orderRepository.SaveOrderInfo(order);

			order.FireAfterOrderUpdatedEvent();
		}
Exemplo n.º 4
0
		public Order(OrderInfo orderInfo)
		{
			Name = orderInfo.Name;
			TermsAccepted = orderInfo.TermsAccepted;
			PaidDate = orderInfo.PaidDate;
		    FulfillDate = orderInfo.FulfillDate;
			ConfirmDate = orderInfo.ConfirmDate;
			OrderLines = orderInfo.OrderLines.Select(line => new OrderLine(line)).ToList();
			CouponCodes = orderInfo.CouponCodesData;
			CustomerInfo = orderInfo.CustomerInfo;
			ShippingInfo = orderInfo.ShippingInfo;
			PaymentInfo = orderInfo.PaymentInfo;
			StoreInfo = orderInfo.StoreInfo;
			CurrencyCode = orderInfo.Localization.CurrencyCode;
			// todo: onderstaand kan waarschijnlijk anders (geen check = dubbel)
			Discounts = orderInfo.Discounts.Select(discount => new OrderDiscount(orderInfo.Localization, discount, orderInfo)).ToList(); // todo: add/save used coupon code
			IncludingVAT = orderInfo.PricesAreIncludingVAT;

			VatCalculatedOverParts = orderInfo.VatCalculationStrategy is OverSmallestPartsVatCalculationStrategy;

			PaymentProviderPrice = orderInfo.PaymentProviderAmount;
			PaymentProviderOrderPercentage = orderInfo.PaymentProviderOrderPercentage;

			ShippingProviderPrice = orderInfo.ShippingProviderAmountInCents;
			RegionalVatAmount = orderInfo.RegionalVatInCents;

			VATCharged = orderInfo.VATCharged;
			ChargedAmount = orderInfo.ChargedAmountInCents;

			CorrespondingOrderDocumentId = orderInfo.OrderNodeId;

			RevalidateOrderOnLoad = orderInfo.RevalidateOrderOnLoad; // version 2.1 hack
			ReValidateSaveAction = orderInfo.ReValidateSaveAction; // version 2.1 hack

			StockUpdated = orderInfo.StockUpdated;
			CreatedInTestMode = orderInfo.CreatedInTestMode;
		}