Esempio n. 1
0
        public CommandResult FinishCreditCardOrder(FinishCreditCardOrderCommand command, Guid UserId)
        {
            var email = new Email(command.Email);

            var payment = new CreditCardPayment(
                command.CardHolderName,
                command.CardNumber,
                command.PaidDate,
                command.ExpireDate,
                command.Total,
                command.TotalPaid,
                command.Payer,
                email);

            var cart = new ShoppingCart(UserId, command.ListOfItems);

            var order = new Order(UserId, cart, payment);

            order.AddNonconformity(payment, cart);

            if (order.IsInvalid)
            {
                return(new CommandResult(false, "Can't finish the order request."));
            }

            _unit.Orders.CreateOrder(order);

            return(new CommandResult(true, "Order finished with success."));
        }
Esempio n. 2
0
 public CommandResult FinishCreditCardOrder([FromBody] FinishCreditCardOrderCommand order)
 {
     //todo create handler
     return(_services.FinishCreditCardOrder(order, Guid.Parse(_userManager.GetUserId(HttpContext.User))));
 }