small fixes

This commit is contained in:
Andrew Camilleri
2018-05-11 12:21:25 +02:00
parent c326998381
commit ee4f83ddba
2 changed files with 12 additions and 5 deletions

View File

@@ -198,7 +198,11 @@ namespace BTCPayServer.HostedServices
PosData = dto.PosData, PosData = dto.PosData,
Price = dto.Price, Price = dto.Price,
Status = dto.Status, 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 // We keep backward compatibility with bitpay by passing BTC info to the notification

View File

@@ -352,7 +352,7 @@ namespace BTCPayServer.Services.Invoices
{ {
var accounting = info.Calculate(); var accounting = info.Calculate();
var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo();
var price = accounting.TotalDue - accounting.NetworkFee; var subtotalPrice = accounting.TotalDue - accounting.NetworkFee;
var cryptoCode = info.GetId().CryptoCode; var cryptoCode = info.GetId().CryptoCode;
var address = info.GetPaymentMethodDetails()?.GetPaymentDestination(); var address = info.GetPaymentMethodDetails()?.GetPaymentDestination();
var exrates = new Dictionary<string, decimal> var exrates = new Dictionary<string, decimal>
@@ -363,7 +363,7 @@ namespace BTCPayServer.Services.Invoices
cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.CryptoCode = cryptoCode;
cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.PaymentType = info.GetId().PaymentType.ToString();
cryptoInfo.Rate = info.Rate; cryptoInfo.Rate = info.Rate;
cryptoInfo.Price = price.ToString(); cryptoInfo.Price = subtotalPrice.ToString();
cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Due = accounting.Due.ToString();
cryptoInfo.Paid = accounting.Paid.ToString(); cryptoInfo.Paid = accounting.Paid.ToString();
@@ -413,8 +413,8 @@ namespace BTCPayServer.Services.Invoices
#pragma warning restore CS0618 #pragma warning restore CS0618
dto.CryptoInfo.Add(cryptoInfo); dto.CryptoInfo.Add(cryptoInfo);
dto.PaymentSubtotals.Add(cryptoCode, price.ToDecimal(MoneyUnit.BTC)); dto.PaymentSubtotals.Add(cryptoCode, subtotalPrice.ToDecimal(MoneyUnit.Satoshi));
dto.PaymentTotals.Add(cryptoCode, accounting.CryptoPaid.ToDecimal(MoneyUnit.BTC)); dto.PaymentTotals.Add(cryptoCode, accounting.TotalDue.ToDecimal(MoneyUnit.Satoshi));
dto.SupportedTransactionCurrencies.Add(cryptoCode, new InvoiceSupportedTransactionCurrency() dto.SupportedTransactionCurrencies.Add(cryptoCode, new InvoiceSupportedTransactionCurrency()
{ {
Enabled = true Enabled = true
@@ -422,6 +422,9 @@ namespace BTCPayServer.Services.Invoices
dto.Addresses.Add(cryptoCode, address); dto.Addresses.Add(cryptoCode, address);
dto.ExchangeRates.Add(cryptoCode, exrates); dto.ExchangeRates.Add(cryptoCode, exrates);
} }
//TODO: Populate dto.AmountPaid
//TODO: Populate dto.TransactionCurrency
Populate(ProductInformation, dto); Populate(ProductInformation, dto);
Populate(BuyerInformation, dto); Populate(BuyerInformation, dto);