public async Task <IActionResult> ThreeDSecure(string source, bool livemode, string client_secret)
        {
            var order = _context.Orders.Where(x => x.StripeSource == source).Include(x => x.DeliveryType).SingleOrDefault();

            var userId    = _userManager.GetUserId(User);
            var viewModel = new CheckoutViewModel()
            {
                Basket        = OrderHelper.GetOrder(order.Id, _context),
                DeliveryTypes = _context.DeliveryTypes.
                                Where(x => x.Id > 0).
                                Include(x => x.DeliveryCompany).
                                ToList(),
                Contacts = _context.CustomerContacts.
                           Where(x => x.UserId == userId).
                           ToList()
            };

            var result = StripeHelper.ChargeSource(source, livemode, client_secret, order.Id, "OrderId");

            order.SellerMessage = result.SellerMessage;
            order.PaymentId     = result.Id;
            order.PaymentStatus = result.NetworkStatus;

            try
            {
                _context.Update(order);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            if (result.NetworkStatus == MasterStrings.StripeDeclined)
            {
                var messages = new DeclineMessageViewModel();
                messages = StripeHelper.DeclineMessage(result.Reason);

                var statusMessage = messages.StatusMessage;
                order.PaymentMessage = messages.PaymentMessage;

                return(ControllerHelper.RedirectToLocal(this, "/Checkout/Index?id=" + order.Id + "&&failureMessage=" + statusMessage));
            }

            if (result.NetworkStatus == MasterStrings.StripeApproved ||
                result.NetworkStatus == MasterStrings.StripeNotSent && result.Type == MasterStrings.StripeResultPending)
            {
                await PlaceOrder(order.Id);

                return(ControllerHelper.RedirectToLocal(this, "/Checkout/OrderPlaced?id=" + order.Id));
            }

            if (result.NetworkStatus == MasterStrings.StripeReversed ||
                (result.NetworkStatus == MasterStrings.StripeNotSent && result.Type != MasterStrings.StripeResultPending))
            {
                var statusMessage = "The payment has been declined.<br/>Please contact your card issuer for more information.";
                order.PaymentMessage = "Status reason: " + result.Reason;

                return(ControllerHelper.RedirectToLocal(this, "/Checkout/Index?id=" + order.Id + "&&failureMessage" + statusMessage));
            }

            return(View());
        }