2019-09-30 10:32:43 +02:00
|
|
|
@using System.Globalization
|
2023-11-29 18:51:40 +09:00
|
|
|
@using BTCPayServer.Plugins.Altcoins;
|
2023-10-10 05:28:00 +02:00
|
|
|
@using BTCPayServer.Services
|
2019-10-02 22:41:53 -05:00
|
|
|
@using BTCPayServer.Services.Altcoins.Monero.Payments
|
2024-09-17 17:28:58 +09:00
|
|
|
@using BTCPayServer.Services.Altcoins.Monero.Services
|
2019-10-02 22:41:53 -05:00
|
|
|
@using BTCPayServer.Services.Altcoins.Monero.UI
|
2024-04-04 16:31:04 +09:00
|
|
|
@using BTCPayServer.Services.Invoices
|
2023-10-10 05:28:00 +02:00
|
|
|
@inject DisplayFormatter DisplayFormatter
|
2024-10-13 00:10:49 +09:00
|
|
|
@model InvoiceDetailsModel
|
2023-11-29 18:51:40 +09:00
|
|
|
@inject TransactionLinkProviders TransactionLinkProviders
|
2024-04-04 16:31:04 +09:00
|
|
|
@inject PaymentMethodHandlerDictionary handlers
|
2019-09-30 10:32:43 +02:00
|
|
|
|
|
|
|
@{
|
2024-10-13 00:10:49 +09:00
|
|
|
var payments = Model.Payments.Select(payment =>
|
2024-04-04 16:31:04 +09:00
|
|
|
{
|
|
|
|
if (!handlers.TryGetValue(payment.PaymentMethodId, out var h) || h is not MoneroLikePaymentMethodHandler handler)
|
|
|
|
return null;
|
2019-09-30 10:32:43 +02:00
|
|
|
var m = new MoneroPaymentViewModel();
|
2024-04-04 16:31:04 +09:00
|
|
|
var onChainPaymentData = handler.ParsePaymentDetails(payment.Details);
|
2024-10-04 16:58:13 +09:00
|
|
|
m.PaymentMethodId = handler.PaymentMethodId;
|
2024-04-04 16:31:04 +09:00
|
|
|
m.DepositAddress = payment.Destination;
|
|
|
|
m.Amount = payment.Value.ToString(CultureInfo.InvariantCulture);
|
2024-09-17 17:28:58 +09:00
|
|
|
|
|
|
|
var confReq = MoneroListener.ConfirmationsRequired(onChainPaymentData, payment.InvoiceEntity.SpeedPolicy);
|
|
|
|
var confCount = onChainPaymentData.ConfirmationCount;
|
|
|
|
confCount = Math.Min(confReq, confCount);
|
|
|
|
m.Confirmations = $"{confCount} / {confReq}";
|
2019-09-30 10:32:43 +02:00
|
|
|
|
|
|
|
m.TransactionId = onChainPaymentData.TransactionId;
|
|
|
|
m.ReceivedTime = payment.ReceivedTime;
|
2024-10-04 16:58:13 +09:00
|
|
|
m.TransactionLink = TransactionLinkProviders.GetTransactionLink(m.PaymentMethodId, onChainPaymentData.TransactionId);
|
|
|
|
m.Currency = payment.Currency;
|
2019-09-30 10:32:43 +02:00
|
|
|
return m;
|
2024-04-04 16:31:04 +09:00
|
|
|
}).Where(c => c != null).ToList();
|
2019-09-30 10:32:43 +02:00
|
|
|
}
|
|
|
|
|
2023-10-10 05:28:00 +02:00
|
|
|
@if (payments.Any())
|
2019-09-30 10:32:43 +02:00
|
|
|
{
|
2023-10-10 05:28:00 +02:00
|
|
|
<section>
|
|
|
|
<h5>Monero Payments</h5>
|
|
|
|
<table class="table table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2024-10-04 16:58:13 +09:00
|
|
|
<th class="w-75px">Payment Method</th>
|
2023-10-10 05:28:00 +02:00
|
|
|
<th class="w-175px">Destination</th>
|
|
|
|
<th class="text-nowrap">Payment Proof</th>
|
|
|
|
<th class="text-end">Confirmations</th>
|
|
|
|
<th class="w-150px text-end">Paid</th>
|
2022-06-03 17:33:22 +02:00
|
|
|
</tr>
|
2023-10-10 05:28:00 +02:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var payment in payments)
|
|
|
|
{
|
|
|
|
<tr >
|
2024-10-04 16:58:13 +09:00
|
|
|
<td>@payment.PaymentMethodId</td>
|
2023-10-10 05:28:00 +02:00
|
|
|
<td><vc:truncate-center text="@payment.DepositAddress" classes="truncate-center-id" /></td>
|
|
|
|
<td><vc:truncate-center text="@payment.TransactionId" link="@payment.TransactionLink" classes="truncate-center-id" /></td>
|
|
|
|
<td class="text-end">@payment.Confirmations</td>
|
|
|
|
<td class="payment-value text-end text-nowrap">
|
2024-10-04 16:58:13 +09:00
|
|
|
<span data-sensitive class="text-success">@DisplayFormatter.Currency(payment.Amount, payment.Currency)</span>
|
2023-10-10 05:28:00 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|
2019-09-30 10:32:43 +02:00
|
|
|
}
|