Allowing copying of Payment Request URL

This commit is contained in:
rockstardev
2025-03-28 23:10:29 -05:00
committed by nicolas.dorier
parent d2debaa842
commit fdde3096d0
2 changed files with 20 additions and 0 deletions

View File

@@ -92,5 +92,17 @@ namespace BTCPayServer.Services
pathBase: request.PathBase
) ?? throw Bug();
}
public string PaymentRequestLink(string payReqId, HttpRequest request)
{
return LinkGenerator.GetUriByAction(
action: nameof(UIPaymentRequestController.ViewPaymentRequest),
controller: "UIPaymentRequest",
values: new { payReqId },
scheme: request.Scheme,
host: request.Host,
pathBase: request.PathBase
) ?? throw Bug();
}
}
}

View File

@@ -3,6 +3,9 @@
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using BTCPayServer.Components
@using BTCPayServer.Client
@using BTCPayServer.Services
@using BTCPayServer.TagHelpers
@inject CallbackGenerator CallbackGenerator
@model BTCPayServer.Models.PaymentRequestViewModels.ListPaymentRequestsViewModel
@{
Layout = "_Layout";
@@ -119,6 +122,11 @@
<td class="text-end">
<div class="d-inline-flex align-items-center gap-3">
<a asp-action="ViewPaymentRequest" asp-route-payReqId="@item.Id" id="PaymentRequest-@item.Id" target="_blank" text-translate="true">View</a>
<button type="button" class="btn btn-link p-0 clipboard-button"
data-clipboard="@CallbackGenerator.PaymentRequestByIdLink(item.Id, this.Context.Request)"
title="Copy Link">
<vc:icon symbol="actions-copy" />
</button>
<div class="dropdown">
<button class="btn btn-link dropdown-toggle p-0 dropdown-toggle-no-caret text-body" type="button" data-bs-toggle="dropdown" aria-expanded="false" id="ToggleActions-@item.Id">
<vc:icon symbol="dots" />