public async Task <ActionResult <IEnumerable <PaymentRequestData> > > GetPaymentRequests(string storeId)
        {
            var prs = await _paymentRequestRepository.FindPaymentRequests(
                new PaymentRequestQuery()
            {
                StoreId = storeId, IncludeArchived = false
            });

            return(Ok(prs.Items.Select(FromModel)));
        }
Beispiel #2
0
        private async Task CheckingPendingPayments(CancellationToken cancellationToken)
        {
            Logs.PayServer.LogInformation("Starting payment request expiration watcher");
            var(total, items) = await _PaymentRequestRepository.FindPaymentRequests(new PaymentRequestQuery()
            {
                Status = new[] { Client.Models.PaymentRequestData.PaymentRequestStatus.Pending }
            }, cancellationToken);

            Logs.PayServer.LogInformation($"{total} pending payment requests being checked since last run");
            await Task.WhenAll(items.Select(i => _PaymentRequestService.UpdatePaymentRequestStateIfNeeded(i))
                               .ToArray());
        }
        public async Task <IActionResult> GetPaymentRequests(int skip = 0, int count = 50)
        {
            var result = await _PaymentRequestRepository.FindPaymentRequests(new PaymentRequestQuery()
            {
                UserId = GetUserId(), Skip = skip, Count = count
            });

            return(View(new ListPaymentRequestsViewModel()
            {
                Skip = skip,
                Count = count,
                Total = result.Total,
                Items = result.Items.Select(data => new ViewPaymentRequestViewModel(data)).ToList()
            }));
        }
Beispiel #4
0
        public async Task <IActionResult> GetPaymentRequests(ListPaymentRequestsViewModel model = null)
        {
            model = this.ParseListQuery(model ?? new ListPaymentRequestsViewModel());

            var includeArchived = new SearchString(model.SearchTerm).GetFilterBool("includearchived") == true;
            var result          = await _PaymentRequestRepository.FindPaymentRequests(new PaymentRequestQuery()
            {
                UserId          = GetUserId(),
                Skip            = model.Skip,
                Count           = model.Count,
                IncludeArchived = includeArchived
            });

            model.Total = result.Total;
            model.Items = result.Items.Select(data => new ViewPaymentRequestViewModel(data)).ToList();
            return(View(model));
        }