示例#1
0
        public IActionResult Confirm(string hash, [FromServices] IConfiguration config, [FromServices] HttpClient client)
        {
            TicketOrder order = _orderCacheService.Get(hash);

            order.OrderCacheService = _orderCacheService;
            order.TicketData        = _ticketData;

            // #PATTERN CHAIN OF RESPONSIBILITY
            IMessageSender mailSender = new EmailSender(config["SendGrid"]);
            IMessageSender smsSender  = new SMSSender(config["Mobizon"], client);

            smsSender.Successor = mailSender;
            smsSender.SendTicketLinks(order);

            order.ConfirmPayment();
            return(RedirectToAction("Success", new { hash = hash }));
        }