Exemplo n.º 1
0
        protected override async Task <OrderCompletedEvent> Handle(CompleteOrderCommand command)
        {
            var order = AggregateWriter.GetById(command.OrderId);

            var orderCompletedEvent = new OrderCompletedEvent(order.Id);

            return(orderCompletedEvent);
        }
        protected override async Task <OrderPutDownEvent> Handle(PutDownOrderCommand command)
        {
            var order = AggregateWriter.GetById(command.OrderId);

            // Check order state

            var orderPutDowndEvent = new OrderPutDownEvent(command.OrderId);

            return(orderPutDowndEvent);
        }
        protected override async Task <SupplementaryEvidenceReceivedEvent> Handle(RegisterSupplementaryEvidenceCommand command)
        {
            var order = AggregateWriter.GetById(command.OrderId);

            // Check order state

            var supplementaryEvidenceReceivedEvent = new SupplementaryEvidenceReceivedEvent(command.OrderId, command.SupplementaryEvidence);

            return(supplementaryEvidenceReceivedEvent);
        }
Exemplo n.º 4
0
        protected override async Task <OrderPickedUpEvent> Handle(PickupOrderCommand command)
        {
            var order = AggregateWriter.GetById(command.OrderId);

            // Check order state

            var orderPickupdEvent = new OrderPickedUpEvent(command.OrderId, command.OwnerId);

            return(orderPickupdEvent);
        }
        protected override async Task <OrderFilledEvent> Handle(FillOrderCommand command)
        {
            var order = AggregateWriter.GetById(command.OrderId);

            // Check order state

            var orderFilldEvent = new OrderFilledEvent(command.OrderId, command.RFQId, command.Price, command.Quantity);

            return(orderFilldEvent);
        }
        protected override async Task <OrderRejectedEvent> Handle(RejectOrderCommand command)
        {
            var order = AggregateWriter.GetById(command.OrderId);

            // Check order state

            var orderRejectdEvent = new OrderRejectedEvent(command.OrderId, command.Reason);

            return(orderRejectdEvent);
        }
Exemplo n.º 7
0
        protected override async Task <RFQCancelledEvent> Handle(CancelRFQCommand command)
        {
            var rfq = AggregateWriter.GetById(command.RFQIdentitier);

            if (rfq == null)
            {
                // invlid request what to do here?
            }

            QuoteProvider.CancelRFQ(command.RFQIdentitier);

            var rFQCancelledEvent = new RFQCancelledEvent(command.RFQIdentitier);

            return(rFQCancelledEvent);
        }
Exemplo n.º 8
0
        protected override async Task <RFQRaisedEvent> Handle(RaiseRFQCommand command)
        {
            var rfq = AggregateWriter.GetById(command.RFQIdentitier);

            if (rfq != null)
            {
                // already processing, what to do here?
            }

            var rFQRaisedEvent = new RFQRaisedEvent(command.Instrument, command.RFQIdentitier, command.CounterParties, command.Requested);

            // Save the creation
            await base.SaveEvent(rFQRaisedEvent);

            //  and then SubmitRequest
            QuoteProvider.SubmitRFQ(command.RFQIdentitier, command.OrderId, command.CounterParties, command.Instrument, 110.25M);

            return(rFQRaisedEvent);
        }