public void RemoveOrderLine(OrderLine orderLine) { var itemToRemove = OrderLines.Single(o => o.Id == orderLine.Id); DefaultPrice -= orderLine.TotalDefaultCost; ActualPrice -= orderLine.TotalActualCost; OrderLines.Remove(itemToRemove); }
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; }
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(); } }