mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-24 06:47:50 +01:00
113 lines
5 KiB
Text
113 lines
5 KiB
Text
@using System.Globalization
|
|
@using BTCPayServer.Payments
|
|
@using BTCPayServer.Payments.Bitcoin
|
|
@using BTCPayServer.Services
|
|
@inject DisplayFormatter DisplayFormatter
|
|
@inject TransactionLinkProviders TransactionLinkProviders
|
|
@model IEnumerable<BTCPayServer.Services.Invoices.PaymentEntity>
|
|
@{
|
|
PayjoinInformation payjoinInformation = null;
|
|
var payments = Model
|
|
.Where(entity => entity.GetPaymentMethodId()?.PaymentType == BitcoinPaymentType.Instance)
|
|
.Select(payment =>
|
|
{
|
|
var pmi = payment.GetPaymentMethodId();
|
|
var m = new OnchainPaymentViewModel();
|
|
var onChainPaymentData = payment.GetCryptoPaymentData() as BitcoinLikePaymentData;
|
|
if (onChainPaymentData is null)
|
|
{
|
|
return null;
|
|
}
|
|
m.Crypto = pmi.CryptoCode;
|
|
m.DepositAddress = onChainPaymentData.GetDestination();
|
|
|
|
var confirmationCount = onChainPaymentData.ConfirmationCount;
|
|
var network = payment.Network as BTCPayNetwork;
|
|
if (confirmationCount >= network.MaxTrackedConfirmation)
|
|
{
|
|
m.Confirmations = "At least " + (network.MaxTrackedConfirmation);
|
|
}
|
|
else
|
|
{
|
|
m.Confirmations = confirmationCount.ToString(CultureInfo.InvariantCulture);
|
|
}
|
|
if (onChainPaymentData.PayjoinInformation is PayjoinInformation pj)
|
|
{
|
|
payjoinInformation = pj;
|
|
m.AdditionalInformation = "Original transaction";
|
|
}
|
|
if (payjoinInformation is PayjoinInformation &&
|
|
payjoinInformation.CoinjoinTransactionHash == onChainPaymentData?.Outpoint.Hash)
|
|
{
|
|
m.AdditionalInformation = "Payjoin transaction";
|
|
}
|
|
m.TransactionId = onChainPaymentData.Outpoint.Hash.ToString();
|
|
m.ReceivedTime = payment.ReceivedTime;
|
|
m.TransactionLink = TransactionLinkProviders.GetTransactionLink(pmi, onChainPaymentData.Outpoint.ToString());
|
|
m.Replaced = !payment.Accounted;
|
|
m.CryptoPaymentData = onChainPaymentData;
|
|
m.NetworkFee = payment.NetworkFee;
|
|
m.PaymentProof = onChainPaymentData.Outpoint.ToString();
|
|
return m;
|
|
})
|
|
.Where(model => model != null)
|
|
.ToList();
|
|
}
|
|
|
|
@if (payments.Any())
|
|
{
|
|
var hasNetworkFee = payments.Sum(a => a.NetworkFee) > 0;
|
|
<section>
|
|
<h5>On-Chain Payments</h5>
|
|
<div class="invoice-payments table-responsive mt-0">
|
|
<table class="table table-hover mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th class="w-75px">Crypto</th>
|
|
<th class="w-100px">Index</th>
|
|
<th class="w-175px">Destination</th>
|
|
<th class="text-nowrap">Payment Proof</th>
|
|
@if (hasNetworkFee)
|
|
{
|
|
<th class="text-end">
|
|
Network Fee
|
|
<a href="https://docs.btcpayserver.org/FAQ/Stores/#allow-anyone-to-create-invoice" target="_blank" rel="noreferrer noopener" title="More information...">
|
|
<vc:icon symbol="info" />
|
|
</a>
|
|
</th>
|
|
}
|
|
<th class="text-end">Confirmations</th>
|
|
<th class="w-150px text-end">Paid</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var payment in payments)
|
|
{
|
|
<tr style="@(payment.Replaced ? "text-decoration: line-through" : "")">
|
|
<td>@payment.Crypto</td>
|
|
<td>@(payment.CryptoPaymentData.KeyPath?.ToString()?? "Unknown")</td>
|
|
<td>
|
|
<vc:truncate-center text="@payment.DepositAddress.ToString()" classes="truncate-center-id" />
|
|
</td>
|
|
<td>
|
|
<vc:truncate-center text="@payment.PaymentProof" link="@payment.TransactionLink" classes="truncate-center-id" />
|
|
</td>
|
|
@if (hasNetworkFee)
|
|
{
|
|
<td class="text-end text-nowrap">@payment.NetworkFee</td>
|
|
}
|
|
<td class="text-end">@payment.Confirmations</td>
|
|
<td class="payment-value text-end text-nowrap">
|
|
<span data-sensitive class="text-success">@DisplayFormatter.Currency(payment.CryptoPaymentData.GetValue(), payment.Crypto)</span>
|
|
@if (!string.IsNullOrEmpty(payment.AdditionalInformation))
|
|
{
|
|
<div>(@payment.AdditionalInformation)</div>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
}
|