mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-20 13:34:37 +01:00
parent
8155841a1d
commit
d9f8c8d3b1
3 changed files with 19 additions and 5 deletions
|
@ -147,6 +147,7 @@ namespace BTCPayServer.Controllers
|
|||
var details = InvoicePopulatePayments(invoice);
|
||||
model.CryptoPayments = details.CryptoPayments;
|
||||
model.Payments = details.Payments;
|
||||
model.Overpaid = details.Overpaid;
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
@ -467,15 +468,25 @@ namespace BTCPayServer.Controllers
|
|||
|
||||
private InvoiceDetailsModel InvoicePopulatePayments(InvoiceEntity invoice)
|
||||
{
|
||||
return new InvoiceDetailsModel
|
||||
|
||||
var overpaid = false;
|
||||
var model = new InvoiceDetailsModel
|
||||
{
|
||||
Archived = invoice.Archived,
|
||||
Payments = invoice.GetPayments(false),
|
||||
Overpaid = true,
|
||||
CryptoPayments = invoice.GetPaymentMethods().Select(
|
||||
data =>
|
||||
{
|
||||
var accounting = data.Calculate();
|
||||
var paymentMethodId = data.GetId();
|
||||
var overpaidAmount = accounting.OverpaidHelper.ToDecimal(MoneyUnit.BTC);
|
||||
|
||||
if (overpaidAmount > 0)
|
||||
{
|
||||
overpaid = true;
|
||||
}
|
||||
|
||||
return new InvoiceDetailsModel.CryptoPayment
|
||||
{
|
||||
PaymentMethodId = paymentMethodId,
|
||||
|
@ -486,13 +497,16 @@ namespace BTCPayServer.Controllers
|
|||
accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC),
|
||||
paymentMethodId.CryptoCode),
|
||||
Overpaid = _CurrencyNameTable.DisplayFormatCurrency(
|
||||
accounting.OverpaidHelper.ToDecimal(MoneyUnit.BTC), paymentMethodId.CryptoCode),
|
||||
overpaidAmount, paymentMethodId.CryptoCode),
|
||||
Address = data.GetPaymentMethodDetails().GetPaymentDestination(),
|
||||
Rate = ExchangeRate(data),
|
||||
PaymentMethodRaw = data
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
model.Overpaid = overpaid;
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
[HttpPost("invoices/{invoiceId}/archive")]
|
||||
|
|
|
@ -134,5 +134,6 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||
public bool CanMarkStatus => CanMarkSettled || CanMarkInvalid;
|
||||
public List<RefundData> Refunds { get; set; }
|
||||
public bool ShowReceipt { get; set; }
|
||||
public bool Overpaid { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
@using BTCPayServer.Client.Models
|
||||
@model (InvoiceDetailsModel Invoice, bool ShowAddress)
|
||||
@{ var invoice = Model.Invoice; }
|
||||
|
||||
|
@ -14,7 +13,7 @@
|
|||
<th class="text-end">Rate</th>
|
||||
<th class="text-end">Paid</th>
|
||||
<th class="text-end">Due</th>
|
||||
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
|
||||
@if (invoice.Overpaid)
|
||||
{
|
||||
<th class="text-end">Overpaid</th>
|
||||
}
|
||||
|
@ -34,7 +33,7 @@
|
|||
<td class="text-end">@payment.Rate</td>
|
||||
<td class="text-end">@payment.Paid</td>
|
||||
<td class="text-end">@payment.Due</td>
|
||||
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
|
||||
@if (invoice.Overpaid)
|
||||
{
|
||||
<td class="text-end">@payment.Overpaid</td>
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue