Ejemplo n.º 1
0
        public async Task <IActionResult> GoToOrderNumber(PaymentTransactionListModel model)
        {
            if (model.OrderNumber == null)
            {
                return(RedirectToAction("List", "PaymentTransaction"));
            }

            int.TryParse(model.OrderNumber, out var id);

            var order = await _orderService.GetOrderByNumber(id);

            if (order == null)
            {
                return(RedirectToAction("List", "PaymentTransaction"));
            }

            var paymentTransaction = await _paymentTransactionService.GetByOrdeGuid(order.OrderGuid);

            if (paymentTransaction == null)
            {
                //not found
                return(RedirectToAction("List", "PaymentTransaction"));
            }

            if (await _groupService.IsStaff(_workContext.CurrentCustomer) && paymentTransaction.StoreId != _workContext.CurrentCustomer.StaffStoreId)
            {
                return(RedirectToAction("List", "PaymentTransaction"));
            }

            return(RedirectToAction("Edit", "PaymentTransaction", new { id = paymentTransaction.Id }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> List(DataSourceRequest command, PaymentTransactionListModel model)
        {
            if (await _groupService.IsStaff(_workContext.CurrentCustomer))
            {
                model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
            }
            DateTime?startDateValue = (model.StartDate == null) ? null
                : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);

            DateTime?endDateValue = (model.EndDate == null) ? null
                : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);

            var paymentTransactions = await _paymentTransactionService.SearchPaymentTransactions(
                customerEmail : model.SearchCustomerEmail,
                ts : model.SearchTransactionStatus >= 0?(TransactionStatus)model.SearchTransactionStatus : null,
                createdFromUtc : startDateValue,
                createdToUtc : endDateValue,
                storeId : model.StoreId,
                pageIndex : command.Page - 1,
                pageSize : command.PageSize);

            var dataModel = new List <PaymentTransactionModel>();

            foreach (var item in paymentTransactions)
            {
                var order = await _orderService.GetOrderByGuid(item.OrderGuid);

                var trmodel = new PaymentTransactionModel();
                trmodel.Id                      = item.Id;
                trmodel.OrderCode               = item.OrderCode;
                trmodel.CustomerEmail           = item.CustomerEmail;
                trmodel.CustomerId              = item.CustomerId;
                trmodel.CurrencyCode            = item.CurrencyCode;
                trmodel.TransactionAmount       = item.TransactionAmount;
                trmodel.PaidAmount              = item.PaidAmount;
                trmodel.PaymentMethodSystemName = item.PaymentMethodSystemName;
                trmodel.RefundedAmount          = item.RefundedAmount;
                trmodel.OrderId                 = order?.Id;
                trmodel.OrderNumber             = order?.OrderNumber;
                trmodel.CreatedOn               = _dateTimeService.ConvertToUserTime(item.CreatedOnUtc, DateTimeKind.Utc);
                trmodel.TransactionStatus       = item.TransactionStatus;
                trmodel.Status                  = item.TransactionStatus.GetTranslationEnum(_translationService, _workContext);
                dataModel.Add(trmodel);
            }

            var gridModel = new DataSourceResult
            {
                Data  = dataModel.ToList(),
                Total = paymentTransactions.TotalCount,
            };

            return(Json(gridModel));
        }
Ejemplo n.º 3
0
        public IActionResult List()
        {
            var model = new PaymentTransactionListModel
            {
                PaymentTransactionStatus = TransactionStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList()
            };

            model.PaymentTransactionStatus.Insert(0, new SelectListItem {
                Text = _translationService.GetResource("Admin.Common.All"), Value = "-1", Selected = true
            });
            return(View(model));
        }