/// <summary>
        /// Gets the Transactions.
        /// </summary>
        /// <param name="transactionsParameter">The Transactions parameter request.</param>
        /// <returns></returns>
        public async Task <APIResponse> GetAllTransactions(TransactionsParameter transactionsParameter)
        {
            try
            {
                var client = httpClientFactory.CreateClient(WalletServiceOperation.serviceName);

                UriBuilder url = new UriBuilder(servicesConfig.Wallet + WalletServiceOperation.GetAllTransactions());
                url.Query = QueryStringHelper.ConvertToQueryString(transactionsParameter);
                var response = await client.GetAsync(url.ToString());

                if (response.IsSuccessStatusCode)
                {
                    var paymentBook = JsonConvert.DeserializeObject <List <TransactionsResponse> >(await response.Content.ReadAsStringAsync());
                    return(new APIResponse(paymentBook, HttpStatusCode.OK));
                }

                return(new APIResponse(response.StatusCode));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'GetAllTransactions()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
        public async Task <IActionResult> GetAllTransactions([FromQuery] TransactionsParameter transactionsParameter)
        {
            var transactions = new GetAllTransactionsQuery(transactionsParameter);

            var result = await mediator.Send(transactions);

            return(StatusCode((int)result.Code, result.Value));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetAllPaymentBookQuery"/> class.
 /// </summary>
 /// <param name="transactionsParameter">The Transactions parameters.</param>
 public GetAllTransactionsQuery(TransactionsParameter transactionsParameter)
 {
     TransactionsParameter = transactionsParameter;
 }
Beispiel #4
0
        public async Task <IActionResult> GetAllTransactions([FromQuery] TransactionsParameter transactionsParameter)
        {
            var result = await transactionsService.GetAllTransactions(transactionsParameter);

            return(StatusCode((int)result.Code, result.Value));
        }