mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
@@ -147,6 +147,7 @@ namespace BTCPayServer.Controllers
|
|||||||
var details = InvoicePopulatePayments(invoice);
|
var details = InvoicePopulatePayments(invoice);
|
||||||
model.CryptoPayments = details.CryptoPayments;
|
model.CryptoPayments = details.CryptoPayments;
|
||||||
model.Payments = details.Payments;
|
model.Payments = details.Payments;
|
||||||
|
model.Overpaid = details.Overpaid;
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
@@ -467,15 +468,25 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
private InvoiceDetailsModel InvoicePopulatePayments(InvoiceEntity invoice)
|
private InvoiceDetailsModel InvoicePopulatePayments(InvoiceEntity invoice)
|
||||||
{
|
{
|
||||||
return new InvoiceDetailsModel
|
|
||||||
|
var overpaid = false;
|
||||||
|
var model = new InvoiceDetailsModel
|
||||||
{
|
{
|
||||||
Archived = invoice.Archived,
|
Archived = invoice.Archived,
|
||||||
Payments = invoice.GetPayments(false),
|
Payments = invoice.GetPayments(false),
|
||||||
|
Overpaid = true,
|
||||||
CryptoPayments = invoice.GetPaymentMethods().Select(
|
CryptoPayments = invoice.GetPaymentMethods().Select(
|
||||||
data =>
|
data =>
|
||||||
{
|
{
|
||||||
var accounting = data.Calculate();
|
var accounting = data.Calculate();
|
||||||
var paymentMethodId = data.GetId();
|
var paymentMethodId = data.GetId();
|
||||||
|
var overpaidAmount = accounting.OverpaidHelper.ToDecimal(MoneyUnit.BTC);
|
||||||
|
|
||||||
|
if (overpaidAmount > 0)
|
||||||
|
{
|
||||||
|
overpaid = true;
|
||||||
|
}
|
||||||
|
|
||||||
return new InvoiceDetailsModel.CryptoPayment
|
return new InvoiceDetailsModel.CryptoPayment
|
||||||
{
|
{
|
||||||
PaymentMethodId = paymentMethodId,
|
PaymentMethodId = paymentMethodId,
|
||||||
@@ -486,13 +497,16 @@ namespace BTCPayServer.Controllers
|
|||||||
accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC),
|
accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC),
|
||||||
paymentMethodId.CryptoCode),
|
paymentMethodId.CryptoCode),
|
||||||
Overpaid = _CurrencyNameTable.DisplayFormatCurrency(
|
Overpaid = _CurrencyNameTable.DisplayFormatCurrency(
|
||||||
accounting.OverpaidHelper.ToDecimal(MoneyUnit.BTC), paymentMethodId.CryptoCode),
|
overpaidAmount, paymentMethodId.CryptoCode),
|
||||||
Address = data.GetPaymentMethodDetails().GetPaymentDestination(),
|
Address = data.GetPaymentMethodDetails().GetPaymentDestination(),
|
||||||
Rate = ExchangeRate(data),
|
Rate = ExchangeRate(data),
|
||||||
PaymentMethodRaw = data
|
PaymentMethodRaw = data
|
||||||
};
|
};
|
||||||
}).ToList()
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
model.Overpaid = overpaid;
|
||||||
|
|
||||||
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("invoices/{invoiceId}/archive")]
|
[HttpPost("invoices/{invoiceId}/archive")]
|
||||||
|
|||||||
@@ -134,5 +134,6 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||||||
public bool CanMarkStatus => CanMarkSettled || CanMarkInvalid;
|
public bool CanMarkStatus => CanMarkSettled || CanMarkInvalid;
|
||||||
public List<RefundData> Refunds { get; set; }
|
public List<RefundData> Refunds { get; set; }
|
||||||
public bool ShowReceipt { 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)
|
@model (InvoiceDetailsModel Invoice, bool ShowAddress)
|
||||||
@{ var invoice = Model.Invoice; }
|
@{ var invoice = Model.Invoice; }
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@
|
|||||||
<th class="text-end">Rate</th>
|
<th class="text-end">Rate</th>
|
||||||
<th class="text-end">Paid</th>
|
<th class="text-end">Paid</th>
|
||||||
<th class="text-end">Due</th>
|
<th class="text-end">Due</th>
|
||||||
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
|
@if (invoice.Overpaid)
|
||||||
{
|
{
|
||||||
<th class="text-end">Overpaid</th>
|
<th class="text-end">Overpaid</th>
|
||||||
}
|
}
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
<td class="text-end">@payment.Rate</td>
|
<td class="text-end">@payment.Rate</td>
|
||||||
<td class="text-end">@payment.Paid</td>
|
<td class="text-end">@payment.Paid</td>
|
||||||
<td class="text-end">@payment.Due</td>
|
<td class="text-end">@payment.Due</td>
|
||||||
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
|
@if (invoice.Overpaid)
|
||||||
{
|
{
|
||||||
<td class="text-end">@payment.Overpaid</td>
|
<td class="text-end">@payment.Overpaid</td>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user