Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Admin panel - Payment transaction - Allow searching by order number

KrzysztofPajak7686804072d1
diff --git a/src/Business/Grand.Business.Checkout/Queries/Handlers/Orders/GetPaymentTransactionQueryHandler.cs b/src/Business/Grand.Business.Checkout/Queries/Handlers/Orders/GetPaymentTransactionQueryHandler.cs
index 1e7e8a643..dad8b4039 100644
--- a/src/Business/Grand.Business.Checkout/Queries/Handlers/Orders/GetPaymentTransactionQueryHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Queries/Handlers/Orders/GetPaymentTransactionQueryHandler.cs
@@ -29,7 +29,7 @@ namespace Grand.Business.Checkout.Queries.Handlers.Orders
query = query.Where(rr => request.CustomerEmail == rr.CustomerEmail.ToLowerInvariant());
if (request.OrderGuid.HasValue)
- query = query.Where(rr => request.OrderGuid == request.OrderGuid.Value);
+ query = query.Where(rr => rr.OrderGuid == request.OrderGuid.Value);
if (request.Ts.HasValue)
query = query.Where(rr => rr.TransactionStatus == request.Ts.Value);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PaymentTransaction/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PaymentTransaction/List.cshtml
index 0d851b57b..c949a0d06 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PaymentTransaction/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PaymentTransaction/List.cshtml
@@ -165,11 +165,12 @@
});
</script>
- <script>
+<script>
function additionalData() {
var data = {
SearchTransactionStatus: $('#@Html.IdFor(model => model.SearchTransactionStatus)').val(),
SearchCustomerEmail: $('#@Html.IdFor(model => model.SearchCustomerEmail)').val(),
+ OrderNumber: $('#@Html.IdFor(model => model.OrderNumber)').val(),
StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
EndDate: $('#@Html.IdFor(model => model.EndDate)').val()
};
@@ -198,4 +199,4 @@
}
});
});
- </script>
+</script>
diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
index 8692bda9c..86cdee10e 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
@@ -93,12 +93,23 @@ namespace Grand.Web.Admin.Controllers
DateTime? endDateValue = (model.EndDate == null) ? null
: (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);
+ Guid? orderGuid = null;
+ if (!string.IsNullOrEmpty(model.OrderNumber))
+ {
+ if (int.TryParse(model.OrderNumber, out var ordernumber))
+ {
+ var order = await _orderService.GetOrderByNumber(ordernumber);
+ if (order != null)
+ orderGuid = order.OrderGuid;
+ }
+ }
var paymentTransactions = await _paymentTransactionService.SearchPaymentTransactions(
customerEmail: model.SearchCustomerEmail,
ts: model.SearchTransactionStatus >= 0 ? (TransactionStatus)model.SearchTransactionStatus : null,
createdFromUtc: startDateValue,
createdToUtc: endDateValue,
storeId: model.StoreId,
+ orderguid: orderGuid,
pageIndex: command.Page - 1,
pageSize: command.PageSize);