public async Task <IActionResult> PostDownloadKey(TebexPayment tebexPayment)
        {
            //_context.DownloadKeys.Add(downloadKey);
            //await _context.SaveChangesAsync();

            if (Startup.AppSettings.TebexSecret != null)
            {
                if (!Request.Headers.ContainsKey("X-BC-Sig"))
                {
                    return(NotFound());
                }
                using (var sha256 = SHA256.Create())
                {
                    var authorizationHeaders = Request.Headers["X-BC-Sig"].ToString().ToUpper();

                    var hash = BitConverter.ToString(sha256.ComputeHash(Encoding.UTF8.GetBytes(Startup.AppSettings.TebexSecret + tebexPayment.Payment.TxnId + tebexPayment.Payment.Status + tebexPayment.Customer.Email))).Replace("-", "");
                    if (hash != authorizationHeaders)
                    {
                        return(NotFound());
                    }
                }
            }

            if (tebexPayment.Packages == null)
            {
                return(Ok());
            }

            foreach (var package in tebexPayment.Packages)
            {
                var resource = await _context.Resources.FirstOrDefaultAsync(p => p.PackageId == package.PackageId);

                if (resource != null)
                {
                    var randomString = RandomString(24);
                    while (await _context.DownloadKeys.AnyAsync(p => p.Key == randomString))
                    {
                        randomString = RandomString(24);
                    }
                    _context.DownloadKeys.Add(new DownloadKey
                    {
                        ResourceId = resource.Id,
                        Key        = randomString
                    });
                }
            }

            await _context.SaveChangesAsync();

            _logger.LogError(JsonConvert.SerializeObject(tebexPayment));
            //return CreatedAtAction("GetDownloadKey", new { id = downloadKey.Id }, downloadKey);
            return(Ok());
        }
        public async Task <IActionResult> GetTebexPayment(TebexPayment tebexPayment)
        {
            _logger.LogError(JsonConvert.SerializeObject(tebexPayment));

            return(Ok());
        }