private void CreateOrder(HotcakesApplication app, DateTime timeOfOrder, string[] skus, int[] quantities = null, bool isPlaced = true) { var o = new Order { StoreId = app.CurrentStore.Id, TimeOfOrderUtc = timeOfOrder, IsPlaced = isPlaced }; for (var i = 0; i < skus.Length; i++) { var qty = 1; if (quantities != null && i < quantities.Length) { qty = quantities[i]; } AddProductToCart(app, o, skus[i], qty); } app.CalculateOrderAndSave(o); // Place order o.IsPlaced = isPlaced; app.OrderServices.Orders.Update(o); if (isPlaced) { // Pay for order var pm = new OrderPaymentManager(o, app); pm.OfflinePaymentAddInfo(o.TotalGrand, "Cash"); CashReceive(app, pm, o.TotalGrand, o); } }