From 24d84e6f8f8666a54e9f74a5962435c76ce121fc Mon Sep 17 00:00:00 2001 From: rockstardev <5191402+rockstardev@users.noreply.github.com> Date: Mon, 12 May 2025 23:58:31 -0500 Subject: [PATCH] Adding links to invoice for review --- BTCPayServer/Services/CallbackGenerator.cs | 12 ++++++++++++ .../Views/UIStores/StoreEmailRulesManage.cshtml | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Services/CallbackGenerator.cs b/BTCPayServer/Services/CallbackGenerator.cs index 3b0bb9f71..2e8dbd9ae 100644 --- a/BTCPayServer/Services/CallbackGenerator.cs +++ b/BTCPayServer/Services/CallbackGenerator.cs @@ -116,5 +116,17 @@ namespace BTCPayServer.Services pathBase: request.PathBase ) ?? throw Bug(); } + + public string InvoiceLink(string invoiceId, HttpRequest request) + { + return LinkGenerator.GetUriByAction( + action: nameof(UIInvoiceController.Invoice), + controller: "UIInvoice", + values: new { invoiceId }, + scheme: request.Scheme, + host: request.Host, + pathBase: request.PathBase + ) ?? throw Bug(); + } } } diff --git a/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml b/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml index bd52653f1..2a04c5aa5 100644 --- a/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml +++ b/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml @@ -163,13 +163,16 @@ subject: 'Invoice {Invoice.Id} payment settled', body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) payment settled.' }, + @{ var invoiceLink = CallbackGenerator.InvoiceLink("INVOICE_ID", this.Context.Request).Replace("INVOICE_ID", ""); } @WebhookEventType.InvoiceExpiredPaidPartial: { subject: 'Invoice {Invoice.Id} Expired Paid Partial', - body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) has expired partially paid.' + body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) has expired partially paid. '+ + '\nPlease review and take appropriate action: ' + @Safe.Json(invoiceLink) + '{Invoice.Id}' }, @WebhookEventType.InvoicePaidAfterExpiration: { subject: 'Invoice {Invoice.Id} Expired Paid Late', - body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) has been paid after expiration.' + body: 'Invoice {Invoice.Id} (Order Id: {Invoice.OrderId}) has been paid after expiration. '+ + '\nPlease review and take appropriate action: ' + @Safe.Json(invoiceLink) + '{Invoice.Id}' }, @{ var paymentRequestsLink = CallbackGenerator.PaymentRequestListLink(storeId, this.Context.Request); } @WebhookEventType.PaymentRequestCompleted: {