diff --git a/BTCPayServer/Models/InvoiceResponse.cs b/BTCPayServer/Models/InvoiceResponse.cs index 69382c8bf..c7ad99dff 100644 --- a/BTCPayServer/Models/InvoiceResponse.cs +++ b/BTCPayServer/Models/InvoiceResponse.cs @@ -226,12 +226,17 @@ namespace BTCPayServer.Models } [JsonProperty("paymentSubtotals")] - public Dictionary PaymentSubtotals { get; set; } + public Dictionary PaymentSubtotals { get; set; } [JsonProperty("paymentTotals")] - public Dictionary PaymentTotals { get; set; } + public Dictionary PaymentTotals { get; set; } + [JsonProperty("amountPaid")] - public decimal AmountPaid { get; set; } + public long AmountPaid { get; set; } + + [JsonProperty("minerFees")] + public long MinerFees { get; set; } + [JsonProperty("exchangeRates")] public Dictionary> ExchangeRates{ get; set; } diff --git a/BTCPayServer/Services/Invoices/InvoiceEntity.cs b/BTCPayServer/Services/Invoices/InvoiceEntity.cs index ae50df206..7529f2e6a 100644 --- a/BTCPayServer/Services/Invoices/InvoiceEntity.cs +++ b/BTCPayServer/Services/Invoices/InvoiceEntity.cs @@ -339,8 +339,8 @@ namespace BTCPayServer.Services.Invoices Currency = ProductInformation.Currency, Flags = new Flags() { Refundable = Refundable }, - PaymentSubtotals = new Dictionary(), - PaymentTotals= new Dictionary(), + PaymentSubtotals = new Dictionary(), + PaymentTotals= new Dictionary(), SupportedTransactionCurrencies = new Dictionary(), Addresses = new Dictionary(), PaymentCodes = new Dictionary(), @@ -351,6 +351,7 @@ namespace BTCPayServer.Services.Invoices dto.CryptoInfo = new List(); foreach (var info in this.GetPaymentMethods(networkProvider)) { + var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; @@ -414,8 +415,8 @@ namespace BTCPayServer.Services.Invoices #pragma warning restore CS0618 dto.CryptoInfo.Add(cryptoInfo); - dto.PaymentSubtotals.Add(cryptoCode, subtotalPrice.ToDecimal(MoneyUnit.Satoshi)); - dto.PaymentTotals.Add(cryptoCode, accounting.TotalDue.ToDecimal(MoneyUnit.Satoshi)); + dto.PaymentSubtotals.Add(cryptoCode, subtotalPrice.Satoshi); + dto.PaymentTotals.Add(cryptoCode, accounting.TotalDue.Satoshi); dto.SupportedTransactionCurrencies.Add(cryptoCode, new InvoiceSupportedTransactionCurrency() { Enabled = true @@ -424,8 +425,11 @@ namespace BTCPayServer.Services.Invoices dto.ExchangeRates.Add(cryptoCode, exrates); } + //TODO: Populate dto.AmountPaid + //TODO: Populate dto.MinerFees //TODO: Populate dto.TransactionCurrency + Populate(ProductInformation, dto); Populate(BuyerInformation, dto);