From 772b9f9b4e68738ee383a293aeb2924c94b9260a Mon Sep 17 00:00:00 2001 From: rockstardev <5191402+rockstardev@users.noreply.github.com> Date: Thu, 10 Apr 2025 15:45:34 -0500 Subject: [PATCH] Bugfixing interpolation on PaymentRequest Adding TrimmerId as field as well --- .../Webhooks/PaymentRequestWebhookDeliveryRequest.cs | 8 ++++++-- BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/BTCPayServer/HostedServices/Webhooks/PaymentRequestWebhookDeliveryRequest.cs b/BTCPayServer/HostedServices/Webhooks/PaymentRequestWebhookDeliveryRequest.cs index d62fe5010..7130442d2 100644 --- a/BTCPayServer/HostedServices/Webhooks/PaymentRequestWebhookDeliveryRequest.cs +++ b/BTCPayServer/HostedServices/Webhooks/PaymentRequestWebhookDeliveryRequest.cs @@ -37,9 +37,13 @@ public class PaymentRequestWebhookDeliveryRequest : WebhookSender.WebhookDeliver private string Interpolate(string str, Data.PaymentRequestData data) { + var id = data.Id; + string trimmedId = $"{id.Substring(0, 7)}...{id.Substring(id.Length - 7)}"; + var blob = data.GetBlob(); - var res = str.Replace("{PaymentRequest.Id}", _evt.Data.Id) - .Replace("{PaymentRequest.Price}", data.Amount.ToString(CultureInfo.InvariantCulture)) + var res = str.Replace("{PaymentRequest.Id}", id) + .Replace("{PaymentRequest.TrimmedId}", trimmedId) + .Replace("{PaymentRequest.Amount}", data.Amount.ToString(CultureInfo.InvariantCulture)) .Replace("{PaymentRequest.Currency}", data.Currency) .Replace("{PaymentRequest.Title}", blob.Title) .Replace("{PaymentRequest.Description}", blob.Description) diff --git a/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml b/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml index 43b6bd614..fc03cea1e 100644 --- a/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml +++ b/BTCPayServer/Views/UIStores/StoreEmailRulesManage.cshtml @@ -89,7 +89,8 @@ Request {PaymentRequest.Id}, - {PaymentRequest.Price}, + {PaymentRequest.TrimmedId}, + {PaymentRequest.Amount}, {PaymentRequest.Currency}, {PaymentRequest.Title}, {PaymentRequest.Description},