Пример #1
0
        public void RemoveOrderLine(OrderLine orderLine)
        {
            var itemToRemove = OrderLines.Single(o => o.Id == orderLine.Id);

            DefaultPrice -= orderLine.TotalDefaultCost;
            ActualPrice  -= orderLine.TotalActualCost;

            OrderLines.Remove(itemToRemove);
        }
Пример #2
0
        public void RefundOrderLine(Guid orderLineId, int quantity, decimal amount)
        {
            if (amount <= decimal.Zero)
            {
                throw new InvalidRefundAmountException(amount);
            }

            var orderLine = OrderLines.Single(x => x.Id == orderLineId);

            orderLine.Refund(quantity, amount);

            RefundAmount += amount;
        }
Пример #3
0
        public void AddDiscount(Guid orderLineId, decimal expectedDiscountAmount)
        {
            var orderLine = OrderLines.Single(x => x.Id == orderLineId);

            orderLine.AddDiscount(expectedDiscountAmount);

            TotalDiscount    += expectedDiscountAmount;
            ActualTotalPrice -= expectedDiscountAmount;

            if (ActualTotalPrice < decimal.Zero)
            {
                throw new DiscountAmountOverflowException();
            }
        }