public Invoice FirstInvoice() { MyOrders = new List<Order>(); var client1Orders = new FakeClient1Order().MyOrders; foreach (var order in client1Orders) { MyOrders.Add(order); } var firstOrder = MyOrders.FirstOrDefault(); if (firstOrder == null) return null; var firstOrderCharge = new OrderCharge().Calculate(firstOrder); //Add it is is a subscriptions var firstOrderInvoice = new Invoice { InvoiceId = 1, OrderId = firstOrder.OrderId, ClientId = firstOrder.ClientId, OrderDate = firstOrder.OrderDate, DeliveryDate = firstOrder.DeliveryDate, CurrencyId = firstOrder.CurrencyId, CookerId = firstOrderCharge.CookerId, OrderTypeValue = firstOrderCharge.OrderTypeValue, PaymentMethodValue = firstOrderCharge.PaymentMethodValue, PromotionTitle = firstOrderCharge.PromotionTitle, PromotionPrice = firstOrderCharge.PromotionPrice, PromotionCurrencyId = firstOrderCharge.PromotionCurrencyId, CouponTitle = firstOrderCharge.CouponTitle, CouponPrice = firstOrderCharge.CouponPrice, CouponCurrencyId = firstOrderCharge.CouponCurrencyId, PlanTitle = firstOrderCharge.PlanTitle, SalesTax = firstOrderCharge.SalesTaxes, DeliveryFees = firstOrderCharge.DeliveryFee, SubTotal = firstOrderCharge.Subtotal, Total = firstOrderCharge.TotalCharges, OrderModelTypeId = (int)Util.OrderModelType.Values.Transaction, CookerSubscriptionId = null, ServingPriceId = null, PlanId = null }; return firstOrderInvoice; }
public Invoice FirstInvoice() { MyOrders = new List<Order>(); var client2Orders = new FakeClient2Order().MyOrders; foreach (var order in client2Orders) { MyOrders.Add(order); } var firstOrder = MyOrders.FirstOrDefault(); if (firstOrder == null) return null; var firstOrderCharge = new OrderCharge().Calculate(firstOrder); var firstOrderInvoice = new Invoice { InvoiceId = 2, OrderId = firstOrder.OrderId, ClientId = firstOrder.ClientId, OrderDate = firstOrder.OrderDate, DeliveryDate = firstOrder.DeliveryDate, CurrencyId = firstOrder.CurrencyId, CookerId = firstOrderCharge.CookerId, OrderTypeValue = firstOrderCharge.OrderTypeValue, PaymentMethodValue = firstOrderCharge.PaymentMethodValue, PromotionTitle = firstOrderCharge.PromotionTitle, PromotionPrice = firstOrderCharge.PromotionPrice, PromotionCurrencyId = firstOrderCharge.PromotionCurrencyId, CouponTitle = firstOrderCharge.CouponTitle, CouponPrice = firstOrderCharge.CouponPrice, CouponCurrencyId = firstOrderCharge.CouponCurrencyId, PlanTitle = firstOrderCharge.PlanTitle, SalesTax = firstOrderCharge.SalesTaxes, DeliveryFees = firstOrderCharge.DeliveryFee, SubTotal = firstOrderCharge.Subtotal, Total = firstOrderCharge.TotalCharges }; return firstOrderInvoice; }
public Invoice FirstSubscriptionInvoice() { //TODO CHANGE IT TO REFLECT THE SUBSCRIPTION MyOrders = new List<Order>(); var client1Orders = new FakeClient1SubscriptionsOrder().MyOrders; foreach (var order in client1Orders) { MyOrders.Add(order); } var firstOrder = MyOrders.FirstOrDefault(); if (firstOrder == null) return null; var firstOrderCharge = new OrderCharge().Calculate(firstOrder); //Add it is is a subscriptions var firstOrderInvoice = new Invoice { InvoiceId = 10, #region Orders Fields OrderId = null, OrderDate = null, DeliveryDate = null, #endregion #region Subscription Fields SubscriptionStartDate = DateTime.Now.Date, SubscriptionEndDate = DateTime.Now.Date, SubscriptionInvoiceDate = DateTime.Now.Date, ClientSubscriptionId = 1, CookerSubscriptionId = 1, ServingPriceId = 3, PlanId = 1, PlanTitle = firstOrderCharge.PlanTitle, #endregion #region Common Fields ClientId = firstOrder.ClientId, CookerId = firstOrderCharge.CookerId, OrderModelTypeId = 2, OrderTypeValue = firstOrderCharge.OrderTypeValue, PaymentMethodValue = firstOrderCharge.PaymentMethodValue, CurrencyId = firstOrder.CurrencyId, PromotionTitle = firstOrderCharge.PromotionTitle, PromotionPrice = firstOrderCharge.PromotionPrice, PromotionCurrencyId = firstOrderCharge.PromotionCurrencyId, CouponTitle = firstOrderCharge.CouponTitle, CouponPrice = firstOrderCharge.CouponPrice, CouponCurrencyId = firstOrderCharge.CouponCurrencyId, SalesTax = firstOrderCharge.SalesTaxes, DeliveryFees = firstOrderCharge.DeliveryFee, SubTotal = firstOrderCharge.Subtotal, Total = firstOrderCharge.TotalCharges, #endregion }; return firstOrderInvoice; }
private Invoice CreateOrderInvoice(Order clientNewOrderTransaction) { if (clientNewOrderTransaction == null) return null; var orderCharge = new OrderCharge(uow: _uow).Calculate(clientNewOrderTransaction); var orderInvoice = new Invoice { InvoiceId = _uow.InvoiceRepository.All.ToList().Max(x => x == null ? 0 : x.InvoiceId) + 1, OrderId = clientNewOrderTransaction.OrderId, ClientId = clientNewOrderTransaction.ClientId, OrderDate = clientNewOrderTransaction.OrderDate, DeliveryDate = clientNewOrderTransaction.DeliveryDate, CurrencyId = clientNewOrderTransaction.CurrencyId, CookerId = orderCharge.CookerId, OrderTypeValue = orderCharge.OrderTypeValue, PaymentMethodValue = orderCharge.PaymentMethodValue, PromotionTitle = orderCharge.PromotionTitle, PromotionPrice = orderCharge.PromotionPrice, PromotionCurrencyId = orderCharge.PromotionCurrencyId, CouponTitle = orderCharge.CouponTitle, CouponPrice = orderCharge.CouponPrice, CouponCurrencyId = orderCharge.CouponCurrencyId, PlanTitle = orderCharge.PlanTitle, SalesTax = orderCharge.SalesTaxes, DeliveryFees = orderCharge.DeliveryFee, SubTotal = orderCharge.Subtotal, Total = orderCharge.TotalCharges, OrderModelTypeId = (int)OrderModelType.Values.Transaction, CookerSubscriptionId = null, ServingPriceId = null, PlanId = null }; return orderInvoice; }