コード例 #1
0
        public async Task <PaginatedPaymentsModel> GetPendingPaymentRequestsForCustomerAsync(string customerId, int currentPage, int pageSize)
        {
            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var(paymentRequests, totalCount) = await _paymentsRepository.GetPendingPaymentRequestsForCustomerAsync(customerId, skip, take);

            return(new PaginatedPaymentsModel
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                PaymentRequests = paymentRequests,
                TotalCount = totalCount
            });
        }
コード例 #2
0
        public async Task <TransactionReportResult> GetPaginatedAsync(
            int currentPage, int pageSize,
            DateTime from, DateTime to)
        {
            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var reports = await _transactionReportRepository.GetPaginatedAsync(skip, take, from, to);

            return(new TransactionReportResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                TotalCount = reports.Count,
                TransactionReports = reports
            });
        }
コード例 #3
0
        public async Task <TransactionsResult> GetFilteredAsync(TransactionsFilter filter, int currentPage, int pageSize)
        {
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var items = await _transactionRepository.GetFilteredAsync(filter, skip, take);

            return(new TransactionsResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                Transactions = items
            });
        }
コード例 #4
0
        public async Task <TransactionReportResult> GetPaginatedAsync(
            int currentPage, int pageSize,
            DateTime from, DateTime to, string[] partnerIds, Guid?campaignId,
            string transactionType = null, string status = null)
        {
            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var reports = await _transactionReportRepository.GetPaginatedAsync(skip, take, from, to, partnerIds,
                                                                               transactionType, status, campaignId);

            return(new TransactionReportResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                TotalCount = reports.Count,
                TransactionReports = reports
            });
        }
コード例 #5
0
        public async Task <TransactionsResult> GetByBlockAsync(string blockHash, int currentPage, int pageSize)
        {
            if (string.IsNullOrEmpty(blockHash))
            {
                throw new ArgumentException("Block hash can't be empty", nameof(blockHash));
            }

            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var queryResult = await _transactionRepository.GetByBlockHashAsync(blockHash, skip, take);

            return(new TransactionsResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                Transactions = queryResult.Item2,
                TotalCount = queryResult.total
            });
        }
コード例 #6
0
        public async Task <TransactionsResult> GetByBlockAsync(long blockNumber, int currentPage, int pageSize)
        {
            if (blockNumber < 0)
            {
                throw new ArgumentException("Block number can't be negative", nameof(blockNumber));
            }

            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var queryResult = await _transactionRepository.GetByBlockNumberAsync(blockNumber, skip, take);

            return(new TransactionsResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                Transactions = queryResult.Item2,
                TotalCount = queryResult.total
            });
        }
コード例 #7
0
        public async Task <EventsResult> GetByTransactionAsync(string txHash, int currentPage, int pageSize)
        {
            if (string.IsNullOrEmpty(txHash))
            {
                throw new ArgumentException("Transaction hash can't be empty", nameof(txHash));
            }

            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var queryResult = await _eventRepository.GetByTransactionAsync(txHash, skip, take);

            return(new EventsResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                Events = queryResult.Item2,
                TotalCount = queryResult.total
            });
        }