btcpayserver/BTCPayServer/Views/Shared/Zcash/ViewZcashLikePaymentData.cshtml

63 lines
2.3 KiB
Plaintext

@using System.Globalization
@using BTCPayServer.Services.Altcoins.Zcash.Payments
@using BTCPayServer.Services.Altcoins.Zcash.UI
@model IEnumerable<BTCPayServer.Services.Invoices.PaymentEntity>
@{
var onchainPayments = Model.Where(entity => entity.GetPaymentMethodId().PaymentType == ZcashPaymentType.Instance).Select(payment =>
{
var m = new ZcashPaymentViewModel();
var onChainPaymentData = payment.GetCryptoPaymentData() as ZcashLikePaymentData;
m.Crypto = payment.GetPaymentMethodId().CryptoCode;
m.DepositAddress = onChainPaymentData.GetDestination();
m.Amount = onChainPaymentData.GetValue().ToString(CultureInfo.InvariantCulture);
var confirmationCount = onChainPaymentData.ConfirmationCount;
var network = payment.Network as ZcashLikeSpecificBtcPayNetwork;
if (confirmationCount >= network.MaxTrackedConfirmation)
{
m.Confirmations = "At least " + (network.MaxTrackedConfirmation);
}
else
{
m.Confirmations = confirmationCount.ToString(CultureInfo.InvariantCulture);
}
m.TransactionId = onChainPaymentData.TransactionId;
m.ReceivedTime = payment.ReceivedTime;
m.TransactionLink = string.Format(CultureInfo.InvariantCulture, payment.Network.BlockExplorerLink, m.TransactionId);
return m;
});
}
@if (onchainPayments.Any())
{
<h5>Zcash Payments</h5>
<table class="table table-hover">
<thead class="thead-inverse">
<tr>
<th>Crypto</th>
<th>Deposit address</th>
<th>Amount</th>
<th>Transaction Id</th>
<th class="text-right">Confirmations</th>
</tr>
</thead>
<tbody>
@foreach (var payment in onchainPayments)
{
<tr >
<td>@payment.Crypto</td>
<td>@payment.DepositAddress</td>
<td>@payment.Amount</td>
<td>
<a href="@payment.TransactionLink" class="text-break" target="_blank" rel="noreferrer noopener">
@payment.TransactionId
</a>
</td>
<td class="text-right">@payment.Confirmations</td>
</tr>
}
</tbody>
</table>
}