@using BTCPayServer.Client
@using BTCPayServer.Payments
@using BTCPayServer.Services
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using BTCPayServer.Abstractions.TagHelpers
@inject BTCPayServer.Security.ContentSecurityPolicies Csp
@inject BTCPayServerEnvironment Env
@inject BTCPayNetworkProvider BtcPayNetworkProvider
@inject DisplayFormatter DisplayFormatter
@model BTCPayServer.Models.ViewPullPaymentModel
@{
ViewData["Title"] = Model.Title;
Csp.UnsafeEval();
Layout = null;
string StatusTextClass(string status)
{
switch (status)
{
case "Completed":
case "In Progress":
return "bg-success";
case "Cancelled":
return "bg-danger";
default:
return "bg-warning";
}
}
string lnurl = null;
string lnurlUri = null;
var pms = Model.PaymentMethods.FirstOrDefault(id => id.PaymentType == LightningPaymentType.Instance && BtcPayNetworkProvider.DefaultNetwork.CryptoCode == id.CryptoCode);
if (pms is not null && Model.Currency.Equals(pms.CryptoCode, StringComparison.InvariantCultureIgnoreCase))
{
var lnurlEndpoint = new Uri(Url.Action("GetLNURLForPullPayment", "UILNURL", new
{
cryptoCode = pms.CryptoCode,
pullPaymentId = Model.Id
}, Context.Request.Scheme, Context.Request.Host.ToString()));
lnurl = LNURL.LNURL.EncodeUri(lnurlEndpoint, "withdrawRequest", true).ToString();
lnurlUri = LNURL.LNURL.EncodeUri(lnurlEndpoint, "withdrawRequest", false).ToString();
}
}
@if (Model.IsPending)
{
}
@if (!ViewContext.ModelState.IsValid)
{
@Html.ValidationSummary(string.Empty, new { @class = $"alert alert-danger mb-4 pb-0 {(ViewContext.ModelState.ErrorCount.Equals(1) ? "no-marker" : "")}" })
}
@if (!string.IsNullOrWhiteSpace(Model.Title))
{
@Model.Title
}
Start Date
@Model.StartDate.ToString("g")
Last Updated
@Model.LastRefreshed.ToString("g")
Copy Link
@if (!string.IsNullOrEmpty(Model.ResetIn))
{
Reset in
@Model.ResetIn
}
@if (!string.IsNullOrEmpty(Model.Description))
{
@Safe.Raw(Model.Description)
}
Payment Details
@DisplayFormatter.Currency(Model.AmountDue, Model.Currency)
Available claim
@DisplayFormatter.Currency(Model.AmountCollected, Model.Currency)
Already claimed
@DisplayFormatter.Currency(Model.Amount, Model.Currency)
Claim limit
Claims
@if (Model.Payouts.Any())
{
Destination
Method
Amount requested
Status
@foreach (var invoice in Model.Payouts)
{
@invoice.Destination
@invoice.PaymentMethod.ToPrettyString()
@invoice.AmountFormatted
@if (!string.IsNullOrEmpty(invoice.Link))
{
@invoice.Status.GetStateString()
}
else
{
@invoice.Status.GetStateString()
}
}
}
else
{
No claim made yet.
}
@if (lnurl is not null)
{
var note = "You can scan or open this link with a LNURL-Withdraw enabled wallet.";
if (!Model.AutoApprove)
{
note += "Please note that this pull payment does not automatically send out funds, and so will process payment after LNURL-withdraw flow is completed. ";
}
}