public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
        {
            using (LogContext.PushProperty("IntegrationEventContext", $"{@event.Id}-{Program.AppName}"))
            {
                _logger.LogInformation("----- Handling integration event: {IntegrationEventId} at {AppName} - ({@IntegrationEvent})", @event.Id, Program.AppName, @event);

                IntegrationEvent orderPaymentIntegrationEvent;

                //Business feature comment:
                // When OrderStatusChangedToStockConfirmed Integration Event is handled.
                // Here we're simulating that we'd be performing the payment against any payment gateway
                // Instead of a real payment we just take the env. var to simulate the payment
                // The payment can be successful or it can fail

                if (_settings.PaymentSucceded)
                {
                    orderPaymentIntegrationEvent = new OrderPaymentSuccededIntegrationEvent(@event.OrderId);
                }
                else
                {
                    orderPaymentIntegrationEvent = new OrderPaymentFailedIntegrationEvent(@event.OrderId);
                }

                _logger.LogInformation("----- Publishing integration event: {IntegrationEventId} from {AppName} - ({@IntegrationEvent})", orderPaymentIntegrationEvent.Id, Program.AppName, orderPaymentIntegrationEvent);

                _eventBus.Publish(orderPaymentIntegrationEvent);

                await Task.CompletedTask;
            }
        }
        public Task Handle(OrderPaymentSuccededIntegrationEvent message, IMessageHandlerContext context)
        {
            // TODO: Publish this, but perhaps create a saga in stock as wel???
            //new OrderStatusChangedToPaidIntegrationEvent(Data.OrderIdentifier, )

            MarkAsComplete();

            return(Task.CompletedTask);
        }
        public async Task HandleAsync(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
        {
            IntegrationEvent orderPaymentIntegrationEvent;

            if (this._settings.PaymentSuccessed)
            {
                orderPaymentIntegrationEvent = new OrderPaymentSuccededIntegrationEvent(@event.OrderId);
            }
            else
            {
                orderPaymentIntegrationEvent = new OrderPaymentFailedIntegrationEvent(@event.OrderId);
            }

            this._eventBus.Publish(orderPaymentIntegrationEvent);

            await Task.CompletedTask;
        }
        public async Task Handle(OrderStatusChangedToStockConfirmedIntegrationEvent @event)
        {
            IntegrationEvent orderPaymentIntegrationEvent;

            //Business feature comment:
            // When OrderStatusChangedToStockConfirmed Integration Event is handled.
            // Here we're simulating that we'd be performing the payment against any payment gateway
            // Instead of a real payment we just take the env. var to simulate the payment
            // The payment can be successful or it can fail

            if (_settings.PaymentSucceded)
            {
                orderPaymentIntegrationEvent = new OrderPaymentSuccededIntegrationEvent(@event.OrderId);
            }
            else
            {
                orderPaymentIntegrationEvent = new OrderPaymentFailedIntegrationEvent(@event.OrderId);
            }

            _eventBus.Publish(orderPaymentIntegrationEvent);
        }
        public Task Handle(OrderPaymentSuccededIntegrationEvent message, IMessageHandlerContext context)
        {
            MarkAsComplete();

            return(Task.CompletedTask);
        }