public IActionResult Pay([FromBody] TransactionPayRequest request)
        {
            var client = getCacheClient();

            NewTransactionDetails newTransactionDetails = client.Get <NewTransactionDetails>(NEW_REQUEST_PREFIX + request.TransactionId);

            if (newTransactionDetails == null)
            {
                return(NotFound("Invalid request details"));
            }

            TransactionDetails existingTransaction = client.Get <TransactionDetails>(TRANSACTION_PREFIX + newTransactionDetails.TransactionId);

            if (existingTransaction != null)
            {
                return(BadRequest("Transaction already exists"));
            }

            var address = RandomGenerator.GenerateAddress();
            var receipt = RandomGenerator.GenerateToken();

            var transaction = new TransactionDetails(newTransactionDetails.TransactionId, address, newTransactionDetails.Price, CURRENCY_BTC, receipt);

            var ttl   = RandomGenerator.GenerateTTL();
            var added = client.Add(TRANSACTION_PREFIX + transaction.TransactionId, transaction, ttl);

            if (!added)
            {
                return(BadRequest("Cache error"));
            }

            return(Ok(transaction));
        }
        public IActionResult Post([FromBody] NewTransactionRequest request)
        {
            var client = getCacheClient();

            var transactionId         = RandomGenerator.GenerateToken();
            var newTransactionDetails = new NewTransactionDetails(transactionId, request.Price);

            var ttl   = RandomGenerator.GenerateTTL();
            var added = client.Add(NEW_REQUEST_PREFIX + transactionId, newTransactionDetails, ttl);

            if (!added)
            {
                return(BadRequest("Cache error"));
            }

            var response = new NewTransactionResponse(transactionId);

            return(Ok(response));
        }