public override void Handle(OrderEvents.Created message) { OrderDto dto = this.Load(message.OrderId); if (dto != null) throw new Exception("Item with the same Id already created!"); dto = new OrderDto(); dto.OrderId = message.OrderId; this.Save(dto); }
public void OfflinePayment() { _order.Status = OrderStatus.OfflinePayment; OrderEvents.OrderStatusChanged(_order, new AfterOrderStatusChangedEventArgs { OrderInfo = _order, OrderStatus = OrderStatus.OfflinePayment, SendEmails = false }); _stockServiceMock.Verify(m => m.SetStock(TestProductService.ProductId1, 1, It.IsAny <bool>(), It.IsAny <string>())); Assert.IsTrue(_order.StockUpdated); }
public void OnlinePaymentAndCancelling() { _order.PaymentInfo.PaymentType = PaymentProviderType.OnlinePayment; _order.Status = OrderStatus.ReadyForDispatch; OrderEvents.OrderStatusChanged(_order, new AfterOrderStatusChangedEventArgs { OrderInfo = _order, OrderStatus = OrderStatus.ReadyForDispatch, SendEmails = false }); _stockServiceMock.Verify(m => m.SetStock(TestProductService.ProductId1, 1, It.IsAny <bool>(), It.IsAny <string>())); Assert.IsTrue(_order.StockUpdated); _order.Status = OrderStatus.Cancelled; OrderEvents.OrderStatusChanged(_order, new AfterOrderStatusChangedEventArgs { OrderInfo = _order, OrderStatus = OrderStatus.Cancelled, SendEmails = false }); _stockServiceMock.Verify(m => m.ReturnStock(TestProductService.ProductId1, 1, It.IsAny <bool>(), It.IsAny <string>())); Assert.IsFalse(_order.StockUpdated); }
internal static void NewOrder(OrderEvents order_event, FCSources fc_source, long func_call_id, string derived_currency, bool side, Order order) //new order => DAEMON { Queues.daemon_queue.Enqueue(new OrderMsg((int)order_event, (int)fc_source, func_call_id, derived_currency, side, order)); }
/// <summary> /// Register events /// </summary> /// <param name="services"></param> /// <returns></returns> public static IServiceCollection RegisterOrderEvents(this IServiceCollection services) { OrderEvents.RegisterEvents(); return(services); }
public override void Handle(OrderEvents.CustomerChanged message) { OrderDto dto = this.Load(message.OrderId); dto.CustomerId = message.CustomerId; this.Save(dto); }
public void When(OrderEvents.CustomerChanged e) { this.CustomerId = e.CustomerId; }
public void When(OrderEvents.Created e) { this.OrderId = e.OrderId; }
// for confirming order private static void ConfirmHandler(object sender, OrderEvents e) { Console.WriteLine(e.Message); }