//public async Task<IActionResult> Details(int? id)
        //{
        //    var order = await context.Orders
        //        .FirstOrDefaultAsync();
        //    if (order == null)
        //        return NotFound();

        //    var paymentOrder = await swedbankPayClient.PaymentOrder.Get(new Uri(order.PaymentOrderLink, UriKind.RelativeOrAbsolute));

        //    var paymentOrderOperations = paymentOrder.Operations.Where(r => r.Key.Value.Contains("paymentorder")).Select(x => x.Value);

        //    var operations = new OperationList(paymentOrderOperations);

        //    return View(new OrderViewModel
        //    {
        //        Order = order,
        //        OperationList = operations
        //    });
        //}

        public async Task <IActionResult> LoadSwishPaymentMenu()
        {
            var response = await CreateSwishPayment();

            var jsSource = response.Operations.ViewSales.Href;

            var swedbankPaySource = new SwedbankPayCheckoutSource
            {
                JavascriptSource     = jsSource,
                Culture              = CultureInfo.GetCultureInfo("sv-SE"),
                UseAnonymousCheckout = true,
                AbortOperationLink   = response.Operations[LinkRelation.UpdateAbort].Href
            };

            return(View("Checkout", swedbankPaySource));
        }
        public async Task <IActionResult> InitiateConsumerSession()
        {
            var initiateConsumerRequest = new ConsumerRequest(new Language("sv-SE"));

            initiateConsumerRequest.ShippingAddressRestrictedToCountryCodes.Add(new CountryCode("SE"));

            var response = await this.swedbankPayClient.Consumers.InitiateSession(initiateConsumerRequest);

            var jsSource = response.Operations.ViewConsumerIdentification?.Href;

            var swedbankPaySource = new SwedbankPayCheckoutSource
            {
                JavascriptSource     = jsSource,
                Culture              = CultureInfo.GetCultureInfo("sv-SE"),
                UseAnonymousCheckout = false
            };

            return(View("Checkout", swedbankPaySource));
        }