diff --git a/BTCPayServer/HostedServices/InvoiceNotificationManager.cs b/BTCPayServer/HostedServices/InvoiceNotificationManager.cs index 0a2d9a057..6605e11c8 100644 --- a/BTCPayServer/HostedServices/InvoiceNotificationManager.cs +++ b/BTCPayServer/HostedServices/InvoiceNotificationManager.cs @@ -198,7 +198,11 @@ namespace BTCPayServer.HostedServices PosData = dto.PosData, Price = dto.Price, Status = dto.Status, - BuyerFields = invoice.RefundMail == null ? null : new Newtonsoft.Json.Linq.JObject() { new JProperty("buyerEmail", invoice.RefundMail) } + BuyerFields = invoice.RefundMail == null ? null : new Newtonsoft.Json.Linq.JObject() { new JProperty("buyerEmail", invoice.RefundMail) }, + PaymentSubtotals = dto.PaymentSubtotals, + PaymentTotals = dto.PaymentTotals, + AmountPaid = dto.AmountPaid, + ExchangeRates = dto.ExchangeRates }; // We keep backward compatibility with bitpay by passing BTC info to the notification diff --git a/BTCPayServer/Services/Invoices/InvoiceEntity.cs b/BTCPayServer/Services/Invoices/InvoiceEntity.cs index 29789acef..021d3c928 100644 --- a/BTCPayServer/Services/Invoices/InvoiceEntity.cs +++ b/BTCPayServer/Services/Invoices/InvoiceEntity.cs @@ -352,7 +352,7 @@ namespace BTCPayServer.Services.Invoices { var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); - var price = accounting.TotalDue - accounting.NetworkFee; + var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; var cryptoCode = info.GetId().CryptoCode; var address = info.GetPaymentMethodDetails()?.GetPaymentDestination(); var exrates = new Dictionary @@ -363,7 +363,7 @@ namespace BTCPayServer.Services.Invoices cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.Rate = info.Rate; - cryptoInfo.Price = price.ToString(); + cryptoInfo.Price = subtotalPrice.ToString(); cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Paid = accounting.Paid.ToString(); @@ -413,8 +413,8 @@ namespace BTCPayServer.Services.Invoices #pragma warning restore CS0618 dto.CryptoInfo.Add(cryptoInfo); - dto.PaymentSubtotals.Add(cryptoCode, price.ToDecimal(MoneyUnit.BTC)); - dto.PaymentTotals.Add(cryptoCode, accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC)); + dto.PaymentSubtotals.Add(cryptoCode, subtotalPrice.ToDecimal(MoneyUnit.Satoshi)); + dto.PaymentTotals.Add(cryptoCode, accounting.TotalDue.ToDecimal(MoneyUnit.Satoshi)); dto.SupportedTransactionCurrencies.Add(cryptoCode, new InvoiceSupportedTransactionCurrency() { Enabled = true @@ -422,6 +422,9 @@ namespace BTCPayServer.Services.Invoices dto.Addresses.Add(cryptoCode, address); dto.ExchangeRates.Add(cryptoCode, exrates); } + + //TODO: Populate dto.AmountPaid + //TODO: Populate dto.TransactionCurrency Populate(ProductInformation, dto); Populate(BuyerInformation, dto);