diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorClient.cs b/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorClient.cs index 1c12437..7992023 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorClient.cs +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/TicketTailorClient.cs @@ -233,7 +233,7 @@ public class TicketTailorClient : IDisposable [JsonPropertyName("min_per_order")] public int? MinPerOrder { get; set; } - [JsonPropertyName("name")] public string Name { get; set; } + [JsonPropertyName("name")] public string? Name { get; set; } [JsonPropertyName("price")] public decimal Price { get; set; } diff --git a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/Receipt.cshtml b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/Receipt.cshtml index 4735def..009dd6f 100644 --- a/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/Receipt.cshtml +++ b/Plugins/BTCPayServer.Plugins.TicketTailor/Views/TicketTailor/Receipt.cshtml @@ -1,4 +1,7 @@ @using BTCPayServer.Client.Models +@using BTCPayServer.Plugins.TicketTailor +@using Microsoft.AspNetCore.Mvc.TagHelpers +@using BTCPayServer.Abstractions.TagHelpers @model BTCPayServer.Plugins.TicketTailor.TicketTailorController.TicketReceiptPage @{ Layout = "_LayoutSimple"; @@ -52,11 +55,11 @@ for (var index = 0; index < Model.Tickets.Length; index++) { var ticket = Model.Tickets[index]; - var ticketType = Model.Event.TicketTypes.First(type => type.Id == ticket.TicketTypeId); + var ticketType = Model.Event.TicketTypes.FirstOrDefault(type => type.Id == ticket.TicketTypeId) ?? new TicketTailorClient.TicketType(); var specificTicketType = Model.Settings?.SpecificTickets? .FirstOrDefault(specificTicket => specificTicket.TicketTypeId == ticket.TicketTypeId); - ticketType.Name = specificTicketType?.Name ?? ticketType.Name; + ticketType.Name = specificTicketType?.Name??ticketType.Name?? ticket.TicketTypeId; ticketType.Description = specificTicketType?.Description ?? ticketType.Description;