public async Task <TransactionResultQuery> GetDetailsOfPayment(string id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Guid parsed = Guid.Empty;

            if (!Guid.TryParse(id, out parsed))
            {
                throw new ArgumentException("Id has to be a valid guid", nameof(id));
            }

            TransactionResult transactionResult =
                await _transactionResultRepository.GetTransactionByID(id);

            TransactionResultQuery result = null;

            if (transactionResult != null)
            {
                result = _transactionResultMapper.Map(transactionResult);
            }

            return(result);
        }
Example #2
0
        public async Task <IActionResult> Get([FromRoute] string id)
        {
            TransactionResultQuery result = null;

            try
            {
                result = await _paymentProvider.GetDetailsOfPayment(id);
            }
            catch (CosmosException exception)
            {
                if (exception.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(NotFound("Not found"));
                }
            }

            return(Ok(result));
        }