public ActionResult <OrderRequestDTO> RespondOrder(OrderAcceptanceResponse orderAcceptance)
        {
            var response = new OrderRequestDTO();

            var dbOrder = Orders.Where(o => o.Id == orderAcceptance.OrderId).FirstOrDefault();

            if (dbOrder != null)
            {
                if (orderAcceptance.AcceptOrder)
                {
                    dbOrder.Status = OrderStatus.Requested;
                    dbOrder.Links.AddRange(orderAcceptance.Links);
                    //chamar api lojista com status novo

                    var processor = new OrdersProcessor();
                    processor.Notify(dbOrder);
                }
                else
                {
                    dbOrder.Status = OrderStatus.Rejected;
                }

                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Beispiel #2
0
        public void RespondOrder()
        {
            // Arrange
            var controller = new OrdersController();
            var request    = new OrderAcceptanceResponse();

            // Act
            var response = controller.RespondOrder(request);

            // Assert
            Assert.NotNull(response);
        }