mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
POS: Updates from code review
This commit is contained in:
@@ -38,8 +38,8 @@ namespace BTCPayServer.Controllers
|
|||||||
private readonly AppService _AppService;
|
private readonly AppService _AppService;
|
||||||
private readonly BTCPayServerOptions _BtcPayServerOptions;
|
private readonly BTCPayServerOptions _BtcPayServerOptions;
|
||||||
private readonly InvoiceController _InvoiceController;
|
private readonly InvoiceController _InvoiceController;
|
||||||
private readonly UserManager<ApplicationUser> _UserManager;
|
private readonly UserManager<ApplicationUser> _UserManager;
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/apps/{appId}/pos")]
|
[Route("/apps/{appId}/pos")]
|
||||||
[XFrameOptionsAttribute(XFrameOptionsAttribute.XFrameOptions.AllowAll)]
|
[XFrameOptionsAttribute(XFrameOptionsAttribute.XFrameOptions.AllowAll)]
|
||||||
@@ -49,11 +49,11 @@ namespace BTCPayServer.Controllers
|
|||||||
if (app == null)
|
if (app == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
var settings = app.GetSettings<PointOfSaleSettings>();
|
var settings = app.GetSettings<PointOfSaleSettings>();
|
||||||
PosViewType viewType = settings.DefaultView;
|
PosViewType viewType = settings.EnableShoppingCart? PosViewType.Cart : settings.DefaultView;
|
||||||
|
|
||||||
return RedirectToAction(nameof(ViewPointOfSale), new { appId, viewType });
|
return RedirectToAction(nameof(ViewPointOfSale), new { appId, viewType });
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/apps/{appId}/pos/{viewType}")]
|
[Route("/apps/{appId}/pos/{viewType}")]
|
||||||
[XFrameOptionsAttribute(XFrameOptionsAttribute.XFrameOptions.AllowAll)]
|
[XFrameOptionsAttribute(XFrameOptionsAttribute.XFrameOptions.AllowAll)]
|
||||||
@@ -120,6 +120,7 @@ namespace BTCPayServer.Controllers
|
|||||||
if (app == null)
|
if (app == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
var settings = app.GetSettings<PointOfSaleSettings>();
|
var settings = app.GetSettings<PointOfSaleSettings>();
|
||||||
|
settings.DefaultView = settings.EnableShoppingCart? PosViewType.Cart : settings.DefaultView;
|
||||||
if (string.IsNullOrEmpty(choiceKey) && !settings.ShowCustomAmount && settings.DefaultView != PosViewType.Cart)
|
if (string.IsNullOrEmpty(choiceKey) && !settings.ShowCustomAmount && settings.DefaultView != PosViewType.Cart)
|
||||||
{
|
{
|
||||||
return RedirectToAction(nameof(ViewPointOfSale), new { appId = appId, viewType = viewType });
|
return RedirectToAction(nameof(ViewPointOfSale), new { appId = appId, viewType = viewType });
|
||||||
@@ -161,8 +162,8 @@ namespace BTCPayServer.Controllers
|
|||||||
title = settings.Title;
|
title = settings.Title;
|
||||||
|
|
||||||
//if cart IS enabled and we detect posdata that matches the cart system's, check inventory for the items
|
//if cart IS enabled and we detect posdata that matches the cart system's, check inventory for the items
|
||||||
if (!string.IsNullOrEmpty(posData) &&
|
if (!string.IsNullOrEmpty(posData) &&
|
||||||
settings.DefaultView == PosViewType.Cart &&
|
settings.DefaultView == PosViewType.Cart &&
|
||||||
AppService.TryParsePosCartItems(posData, out var cartItems))
|
AppService.TryParsePosCartItems(posData, out var cartItems))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user