From 2f86ad5f3b93d67d410f9b2759937a324f8d378d Mon Sep 17 00:00:00 2001 From: Kukks Date: Fri, 19 Jan 2024 10:07:57 +0100 Subject: [PATCH] fix tt and update promo code error display --- .../BTCPayServer.Plugins.TicketTailor.csproj | 2 +- .../TicketTailorController.cs | 15 +++++ .../UpdateTicketTailorSettings.cshtml | 4 +- .../Views/TicketTailor/View.cshtml | 63 ++++++++++++++++++- 4 files changed, 79 insertions(+), 5 deletions(-) diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj b/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj index 0f608c2..f5c5505 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/BTCPayServer.Plugins.TicketTailor.csproj @@ -9,7 +9,7 @@ TicketTailor Allows you to integrate with TicketTailor.com to sell tickets for Bitcoin - 2.0.0 + 2.0.1 true diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorController.cs b/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorController.cs index f4610cf..cd1c8d8 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorController.cs +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorController.cs @@ -152,6 +152,13 @@ namespace BTCPayServer.Plugins.TicketTailor !new[] {"on_sale", "locked"}.Contains(ticketType.Status.ToLowerInvariant()) || specificTicket?.Hidden is true) { + if (preview) + { + return Json(new + { + Error = "The ticket was not found." + }); + } TempData.SetStatusMessageModel(new StatusMessageModel { Severity = StatusMessageModel.StatusSeverity.Error, @@ -163,6 +170,14 @@ namespace BTCPayServer.Plugins.TicketTailor if (purchaseRequestItem.Quantity > ticketType.MaxPerOrder || purchaseRequestItem.Quantity < ticketType.MinPerOrder) { + if (preview) + { + return Json(new + { + Error = "The amount of tickets was not allowed." + }); + } + TempData.SetStatusMessageModel(new StatusMessageModel { Severity = StatusMessageModel.StatusSeverity.Error, diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/UpdateTicketTailorSettings.cshtml b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/UpdateTicketTailorSettings.cshtml index 844a995..71a6f04 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/UpdateTicketTailorSettings.cshtml +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/UpdateTicketTailorSettings.cshtml @@ -54,7 +54,7 @@
- +
@@ -86,7 +86,7 @@
- +
diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml index 6733a5f..ef208a5 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/View.cshtml @@ -29,8 +29,67 @@ { @Safe.Raw(Model.Settings.CustomCSS) } - - + +