mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Maintaining BitPay compatibility
Ref: https://github.com/btcpayserver/btcpayserver/issues/180
This commit is contained in:
committed by
nicolas.dorier
parent
eeb522fe7d
commit
fe5347aa86
@@ -224,21 +224,21 @@ namespace BTCPayServer.Models
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("paymentSubtotals")]
|
[JsonProperty("paymentSubtotals")]
|
||||||
public Dictionary<string, long> PaymentSubtotals { get; set; }
|
public Dictionary<string, long> PaymentSubtotals { get; set; }
|
||||||
|
|
||||||
[JsonProperty("paymentTotals")]
|
[JsonProperty("paymentTotals")]
|
||||||
public Dictionary<string, long> PaymentTotals { get; set; }
|
public Dictionary<string, long> PaymentTotals { get; set; }
|
||||||
|
|
||||||
[JsonProperty("amountPaid")]
|
[JsonProperty("amountPaid", DefaultValueHandling = DefaultValueHandling.Include)]
|
||||||
public long AmountPaid { get; set; }
|
public long AmountPaid { get; set; }
|
||||||
|
|
||||||
[JsonProperty("minerFees")]
|
[JsonProperty("minerFees")]
|
||||||
public long MinerFees { get; set; }
|
public long MinerFees { get; set; }
|
||||||
|
|
||||||
[JsonProperty("exchangeRates")]
|
[JsonProperty("exchangeRates")]
|
||||||
public Dictionary<string, Dictionary<string, decimal>> ExchangeRates{ get; set; }
|
public Dictionary<string, Dictionary<string, decimal>> ExchangeRates { get; set; }
|
||||||
|
|
||||||
[JsonProperty("supportedTransactionCurrencies")]
|
[JsonProperty("supportedTransactionCurrencies")]
|
||||||
public Dictionary<string, NBitpayClient.InvoiceSupportedTransactionCurrency> SupportedTransactionCurrencies { get; set; }
|
public Dictionary<string, NBitpayClient.InvoiceSupportedTransactionCurrency> SupportedTransactionCurrencies { get; set; }
|
||||||
@@ -246,7 +246,7 @@ namespace BTCPayServer.Models
|
|||||||
[JsonProperty("addresses")]
|
[JsonProperty("addresses")]
|
||||||
public Dictionary<string, string> Addresses { get; set; }
|
public Dictionary<string, string> Addresses { get; set; }
|
||||||
[JsonProperty("paymentCodes")]
|
[JsonProperty("paymentCodes")]
|
||||||
public Dictionary<string, NBitpayClient.InvoicePaymentUrls> PaymentCodes{get; set;}
|
public Dictionary<string, NBitpayClient.InvoicePaymentUrls> PaymentCodes { get; set; }
|
||||||
}
|
}
|
||||||
public class Flags
|
public class Flags
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -338,9 +338,8 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
Status = Status,
|
Status = Status,
|
||||||
Currency = ProductInformation.Currency,
|
Currency = ProductInformation.Currency,
|
||||||
Flags = new Flags() { Refundable = Refundable },
|
Flags = new Flags() { Refundable = Refundable },
|
||||||
|
|
||||||
PaymentSubtotals = new Dictionary<string, long>(),
|
PaymentSubtotals = new Dictionary<string, long>(),
|
||||||
PaymentTotals= new Dictionary<string, long>(),
|
PaymentTotals = new Dictionary<string, long>(),
|
||||||
SupportedTransactionCurrencies = new Dictionary<string, InvoiceSupportedTransactionCurrency>(),
|
SupportedTransactionCurrencies = new Dictionary<string, InvoiceSupportedTransactionCurrency>(),
|
||||||
Addresses = new Dictionary<string, string>(),
|
Addresses = new Dictionary<string, string>(),
|
||||||
PaymentCodes = new Dictionary<string, InvoicePaymentUrls>(),
|
PaymentCodes = new Dictionary<string, InvoicePaymentUrls>(),
|
||||||
@@ -351,7 +350,6 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
dto.CryptoInfo = new List<NBitpayClient.InvoiceCryptoInfo>();
|
dto.CryptoInfo = new List<NBitpayClient.InvoiceCryptoInfo>();
|
||||||
foreach (var info in this.GetPaymentMethods(networkProvider))
|
foreach (var info in this.GetPaymentMethods(networkProvider))
|
||||||
{
|
{
|
||||||
|
|
||||||
var accounting = info.Calculate();
|
var accounting = info.Calculate();
|
||||||
var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo();
|
var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo();
|
||||||
var subtotalPrice = accounting.TotalDue - accounting.NetworkFee;
|
var subtotalPrice = accounting.TotalDue - accounting.NetworkFee;
|
||||||
@@ -375,7 +373,7 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString();
|
cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString();
|
||||||
|
|
||||||
cryptoInfo.Address = address;
|
cryptoInfo.Address = address;
|
||||||
|
|
||||||
cryptoInfo.ExRates = exrates;
|
cryptoInfo.ExRates = exrates;
|
||||||
var paymentId = info.GetId();
|
var paymentId = info.GetId();
|
||||||
var scheme = info.Network.UriScheme;
|
var scheme = info.Network.UriScheme;
|
||||||
@@ -392,7 +390,7 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
BIP21 = $"{scheme}:{cryptoInfo.Address}?amount={cryptoInfo.Due}",
|
BIP21 = $"{scheme}:{cryptoInfo.Address}?amount={cryptoInfo.Due}",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paymentId.PaymentType == PaymentTypes.LightningLike)
|
if (paymentId.PaymentType == PaymentTypes.LightningLike)
|
||||||
{
|
{
|
||||||
cryptoInfo.PaymentUrls = new NBitpayClient.InvoicePaymentUrls()
|
cryptoInfo.PaymentUrls = new NBitpayClient.InvoicePaymentUrls()
|
||||||
|
|||||||
Reference in New Issue
Block a user