Merge pull request #6666 from btcpayserver/bugfix/paymentrequest-interpolation

Bugfixing interpolation on Payment Request
This commit is contained in:
Nicolas Dorier
2025-04-11 13:41:14 +09:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -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)

View File

@@ -89,7 +89,8 @@
<th text-translate="true">Request</th>
<td>
<code>{PaymentRequest.Id}</code>,
<code>{PaymentRequest.Price}</code>,
<code>{PaymentRequest.TrimmedId}</code>,
<code>{PaymentRequest.Amount}</code>,
<code>{PaymentRequest.Currency}</code>,
<code>{PaymentRequest.Title}</code>,
<code>{PaymentRequest.Description}</code>,