From 332a1da167d836c1a34cd1bb496598d6f8299b69 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Thu, 28 May 2020 08:59:48 +0200 Subject: [PATCH] POS: Updates from code review --- BTCPayServer/Controllers/AppsPublicController.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/BTCPayServer/Controllers/AppsPublicController.cs b/BTCPayServer/Controllers/AppsPublicController.cs index 15b6885bc..2c1eb8324 100644 --- a/BTCPayServer/Controllers/AppsPublicController.cs +++ b/BTCPayServer/Controllers/AppsPublicController.cs @@ -38,8 +38,8 @@ namespace BTCPayServer.Controllers private readonly AppService _AppService; private readonly BTCPayServerOptions _BtcPayServerOptions; private readonly InvoiceController _InvoiceController; - private readonly UserManager _UserManager; - + private readonly UserManager _UserManager; + [HttpGet] [Route("/apps/{appId}/pos")] [XFrameOptionsAttribute(XFrameOptionsAttribute.XFrameOptions.AllowAll)] @@ -49,11 +49,11 @@ namespace BTCPayServer.Controllers if (app == null) return NotFound(); var settings = app.GetSettings(); - PosViewType viewType = settings.DefaultView; - + PosViewType viewType = settings.EnableShoppingCart? PosViewType.Cart : settings.DefaultView; + return RedirectToAction(nameof(ViewPointOfSale), new { appId, viewType }); } - + [HttpGet] [Route("/apps/{appId}/pos/{viewType}")] [XFrameOptionsAttribute(XFrameOptionsAttribute.XFrameOptions.AllowAll)] @@ -120,6 +120,7 @@ namespace BTCPayServer.Controllers if (app == null) return NotFound(); var settings = app.GetSettings(); + settings.DefaultView = settings.EnableShoppingCart? PosViewType.Cart : settings.DefaultView; if (string.IsNullOrEmpty(choiceKey) && !settings.ShowCustomAmount && settings.DefaultView != PosViewType.Cart) { return RedirectToAction(nameof(ViewPointOfSale), new { appId = appId, viewType = viewType }); @@ -161,8 +162,8 @@ namespace BTCPayServer.Controllers title = settings.Title; //if cart IS enabled and we detect posdata that matches the cart system's, check inventory for the items - if (!string.IsNullOrEmpty(posData) && - settings.DefaultView == PosViewType.Cart && + if (!string.IsNullOrEmpty(posData) && + settings.DefaultView == PosViewType.Cart && AppService.TryParsePosCartItems(posData, out var cartItems)) {