2019-08-24 16:10:13 +02:00
|
|
|
@using BTCPayServer.Payments
|
|
|
|
@using BTCPayServer.Payments.Lightning
|
2023-04-04 03:59:14 +02:00
|
|
|
@using BTCPayServer.Services
|
|
|
|
@using BTCPayServer.Components.TruncateCenter
|
|
|
|
@using BTCPayServer.Lightning
|
2024-04-04 16:31:04 +09:00
|
|
|
@using BTCPayServer.Services.Invoices
|
2023-04-04 03:59:14 +02:00
|
|
|
@inject DisplayFormatter DisplayFormatter
|
2024-04-04 16:31:04 +09:00
|
|
|
@inject PaymentMethodHandlerDictionary handlers
|
|
|
|
@inject PrettyNameProvider prettyName
|
2019-08-24 16:10:13 +02:00
|
|
|
@model IEnumerable<BTCPayServer.Services.Invoices.PaymentEntity>
|
|
|
|
|
|
|
|
@{
|
2024-04-04 16:31:04 +09:00
|
|
|
var payments = Model
|
|
|
|
.Select(payment =>
|
|
|
|
{
|
|
|
|
|
|
|
|
if (handlers.TryGet(payment.PaymentMethodId) is not ILightningPaymentHandler handler)
|
|
|
|
return null;
|
|
|
|
var offChainPaymentData = handler.ParsePaymentDetails(payment.Details);
|
|
|
|
return new OffChainPaymentViewModel
|
|
|
|
{
|
|
|
|
Type = prettyName.PrettyName(payment.PaymentMethodId),
|
|
|
|
BOLT11 = offChainPaymentData.BOLT11,
|
|
|
|
PaymentProof = offChainPaymentData.Preimage?.ToString(),
|
|
|
|
Amount = DisplayFormatter.Currency(payment.Value, handler.Network.CryptoCode)
|
|
|
|
};
|
|
|
|
})
|
2023-04-04 03:59:14 +02:00
|
|
|
.Where(model => model != null)
|
|
|
|
.ToList();
|
2019-08-24 16:10:13 +02:00
|
|
|
}
|
|
|
|
|
2023-04-04 03:59:14 +02:00
|
|
|
@if (payments.Any())
|
2019-08-24 16:10:13 +02:00
|
|
|
{
|
2023-03-26 13:44:05 +02:00
|
|
|
<section>
|
|
|
|
<h5>Off-Chain Payments</h5>
|
2023-04-04 03:59:14 +02:00
|
|
|
<div class="invoice-payments table-responsive mt-0">
|
|
|
|
<table class="table table-hover mb-0">
|
2023-10-10 05:28:00 +02:00
|
|
|
<thead>
|
2023-03-26 13:44:05 +02:00
|
|
|
<tr>
|
2024-04-04 16:31:04 +09:00
|
|
|
<th class="w-75px">Type</th>
|
2023-04-04 03:59:14 +02:00
|
|
|
<th class="w-175px">Destination</th>
|
|
|
|
<th class="text-nowrap">Payment Proof</th>
|
2023-10-10 05:28:00 +02:00
|
|
|
<th class="w-150px text-end">Paid</th>
|
2023-03-26 13:44:05 +02:00
|
|
|
</tr>
|
2023-04-04 03:59:14 +02:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var payment in payments)
|
|
|
|
{
|
|
|
|
<tr>
|
2024-04-04 16:31:04 +09:00
|
|
|
<td>@payment.Type</td>
|
2023-04-04 03:59:14 +02:00
|
|
|
<td>
|
|
|
|
<vc:truncate-center text="@payment.BOLT11" classes="truncate-center-id" />
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<vc:truncate-center text="@payment.PaymentProof" classes="truncate-center-id" />
|
|
|
|
</td>
|
|
|
|
<td class="payment-value text-end text-nowrap">
|
2023-10-10 05:28:00 +02:00
|
|
|
<span data-sensitive class="text-success">@payment.Amount</span>
|
2023-04-04 03:59:14 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2023-03-26 13:44:05 +02:00
|
|
|
</section>
|
2019-08-24 16:10:13 +02:00
|
|
|
}
|