public async Task <IActionResult> CheckoutRedirect([FromQuery][Required] string checkout_id)
        {
            Console.WriteLine(Request.GetEncodedUrl());
            if (string.IsNullOrEmpty(checkout_id))
            {
                throw new KnownException("Invalid checkout_id");
            }

            var order = await OrdersRepo.FindOne(o => o.WePayCheckoutId == checkout_id);

            if (order == null)
            {
                throw new KnownException("Nu am găsit o comandă asociată");
            }

            var wePayRequestBody     = new { checkout_id };
            var wePayRequestBodyJson = new StringContent(JsonConvert.SerializeObject(wePayRequestBody), Encoding.UTF8,
                                                         "application/json");
            var response =
                await WePayHttpClient.PostAsync("https://stage.wepayapi.com/v2/checkout", wePayRequestBodyJson);

            var responseText = await response.Content.ReadAsStringAsync();

            try
            {
                response.EnsureSuccessStatusCode();
                var responseJson = JsonConvert.DeserializeObject <Dictionary <string, object> >(responseText);
                var state        = responseJson["state"].ToString();
                if (state == "released" || state == "authorized")
                {
                    order.State = OrderState.Paid;
                    await DataLayer.SaveChangesAsync();
                    await ProcessOrder();
                }

                return(Ok(state));
            }
            catch
            {
                throw;
            }

            return(Ok());
        }