mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Receipts: Fix amount paid discrepancy (#4287)
Displays the actual amount paid instead of the total invoice price. Fixes #4242.
This commit is contained in:
@@ -180,17 +180,8 @@ namespace BTCPayServer.Controllers
|
||||
JToken? receiptData = null;
|
||||
i.Metadata?.AdditionalData?.TryGetValue("receiptData", out receiptData);
|
||||
|
||||
return View(new InvoiceReceiptViewModel
|
||||
{
|
||||
StoreName = store.StoreName,
|
||||
Status = i.Status.ToModernStatus(),
|
||||
Amount = i.Price,
|
||||
Currency = i.Currency,
|
||||
Timestamp = i.InvoiceTime,
|
||||
InvoiceId = i.Id,
|
||||
OrderId = i.Metadata?.OrderId,
|
||||
OrderUrl = i.Metadata?.OrderUrl,
|
||||
Payments = receipt.ShowPayments is false ? null : i.GetPayments(true).Select(paymentEntity =>
|
||||
var payments = i.GetPayments(true)
|
||||
.Select(paymentEntity =>
|
||||
{
|
||||
var paymentData = paymentEntity.GetCryptoPaymentData();
|
||||
var paymentMethodId = paymentEntity.GetPaymentMethodId();
|
||||
@@ -220,7 +211,19 @@ namespace BTCPayServer.Controllers
|
||||
};
|
||||
})
|
||||
.Where(payment => payment != null)
|
||||
.ToList(),
|
||||
.ToList();
|
||||
|
||||
return View(new InvoiceReceiptViewModel
|
||||
{
|
||||
StoreName = store.StoreName,
|
||||
Status = i.Status.ToModernStatus(),
|
||||
Amount = payments.Sum(p => p!.Paid),
|
||||
Currency = i.Currency,
|
||||
Timestamp = i.InvoiceTime,
|
||||
InvoiceId = i.Id,
|
||||
OrderId = i.Metadata?.OrderId,
|
||||
OrderUrl = i.Metadata?.OrderUrl,
|
||||
Payments = receipt.ShowPayments is false ? null : payments,
|
||||
ReceiptOptions = receipt,
|
||||
AdditionalData = receiptData is null
|
||||
? new Dictionary<string, object>()
|
||||
|
||||
Reference in New Issue
Block a user