mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Renaming
This commit is contained in:
@@ -101,7 +101,7 @@ namespace BTCPayServer.Tests
|
|||||||
Rate = 10513.44m,
|
Rate = 10513.44m,
|
||||||
}.SetPaymentMethodDetails(new BTCPayServer.Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod()
|
}.SetPaymentMethodDetails(new BTCPayServer.Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod()
|
||||||
{
|
{
|
||||||
NetworkFee = Money.Coins(0.00000100m),
|
NextNetworkFee = Money.Coins(0.00000100m),
|
||||||
DepositAddress = dummy
|
DepositAddress = dummy
|
||||||
}));
|
}));
|
||||||
paymentMethods.Add(new PaymentMethod()
|
paymentMethods.Add(new PaymentMethod()
|
||||||
@@ -110,7 +110,7 @@ namespace BTCPayServer.Tests
|
|||||||
Rate = 216.79m
|
Rate = 216.79m
|
||||||
}.SetPaymentMethodDetails(new BTCPayServer.Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod()
|
}.SetPaymentMethodDetails(new BTCPayServer.Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod()
|
||||||
{
|
{
|
||||||
NetworkFee = Money.Coins(0.00010000m),
|
NextNetworkFee = Money.Coins(0.00010000m),
|
||||||
DepositAddress = dummy
|
DepositAddress = dummy
|
||||||
}));
|
}));
|
||||||
invoiceEntity.SetPaymentMethods(paymentMethods);
|
invoiceEntity.SetPaymentMethods(paymentMethods);
|
||||||
@@ -150,7 +150,7 @@ namespace BTCPayServer.Tests
|
|||||||
var entity = new InvoiceEntity();
|
var entity = new InvoiceEntity();
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
entity.Payments = new System.Collections.Generic.List<PaymentEntity>();
|
entity.Payments = new System.Collections.Generic.List<PaymentEntity>();
|
||||||
entity.SetPaymentMethod(new PaymentMethod() { CryptoCode = "BTC", Rate = 5000, NetworkFee = Money.Coins(0.1m) });
|
entity.SetPaymentMethod(new PaymentMethod() { CryptoCode = "BTC", Rate = 5000, NextNetworkFee = Money.Coins(0.1m) });
|
||||||
entity.ProductInformation = new ProductInformation() { Price = 5000 };
|
entity.ProductInformation = new ProductInformation() { Price = 5000 };
|
||||||
|
|
||||||
var paymentMethod = entity.GetPaymentMethods(null).TryGet("BTC", PaymentTypes.BTCLike);
|
var paymentMethod = entity.GetPaymentMethods(null).TryGet("BTC", PaymentTypes.BTCLike);
|
||||||
@@ -190,13 +190,13 @@ namespace BTCPayServer.Tests
|
|||||||
{
|
{
|
||||||
CryptoCode = "BTC",
|
CryptoCode = "BTC",
|
||||||
Rate = 1000,
|
Rate = 1000,
|
||||||
NetworkFee = Money.Coins(0.1m)
|
NextNetworkFee = Money.Coins(0.1m)
|
||||||
});
|
});
|
||||||
paymentMethods.Add(new PaymentMethod()
|
paymentMethods.Add(new PaymentMethod()
|
||||||
{
|
{
|
||||||
CryptoCode = "LTC",
|
CryptoCode = "LTC",
|
||||||
Rate = 500,
|
Rate = 500,
|
||||||
NetworkFee = Money.Coins(0.01m)
|
NextNetworkFee = Money.Coins(0.01m)
|
||||||
});
|
});
|
||||||
entity.SetPaymentMethods(paymentMethods);
|
entity.SetPaymentMethods(paymentMethods);
|
||||||
entity.Payments = new List<PaymentEntity>();
|
entity.Payments = new List<PaymentEntity>();
|
||||||
@@ -275,7 +275,7 @@ namespace BTCPayServer.Tests
|
|||||||
var entity = new InvoiceEntity();
|
var entity = new InvoiceEntity();
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
entity.Payments = new List<PaymentEntity>();
|
entity.Payments = new List<PaymentEntity>();
|
||||||
entity.SetPaymentMethod(new PaymentMethod() { CryptoCode = "BTC", Rate = 5000, NetworkFee = Money.Coins(0.1m) });
|
entity.SetPaymentMethod(new PaymentMethod() { CryptoCode = "BTC", Rate = 5000, NextNetworkFee = Money.Coins(0.1m) });
|
||||||
entity.ProductInformation = new ProductInformation() { Price = 5000 };
|
entity.ProductInformation = new ProductInformation() { Price = 5000 };
|
||||||
entity.PaymentTolerance = 0;
|
entity.PaymentTolerance = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ namespace BTCPayServer.Controllers
|
|||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
Status = invoice.StatusString,
|
Status = invoice.StatusString,
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
NetworkFee = paymentMethodDetails.GetNetworkFee(),
|
NetworkFee = paymentMethodDetails.GetNextNetworkFee(),
|
||||||
IsMultiCurrency = invoice.GetPayments().Select(p => p.GetPaymentMethodId()).Concat(new[] { paymentMethod.GetId() }).Distinct().Count() > 1,
|
IsMultiCurrency = invoice.GetPayments().Select(p => p.GetPaymentMethodId()).Concat(new[] { paymentMethod.GetId() }).Distinct().Count() > 1,
|
||||||
ChangellyEnabled = changelly != null,
|
ChangellyEnabled = changelly != null,
|
||||||
ChangellyMerchantId = changelly?.ChangellyMerchantId,
|
ChangellyMerchantId = changelly?.ChangellyMerchantId,
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ namespace BTCPayServer.Controllers
|
|||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
if (paymentMethod.GetId().IsBTCOnChain)
|
if (paymentMethod.GetId().IsBTCOnChain)
|
||||||
{
|
{
|
||||||
entity.TxFee = paymentMethod.NetworkFee;
|
entity.TxFee = paymentMethod.NextNetworkFee;
|
||||||
entity.Rate = paymentMethod.Rate;
|
entity.Rate = paymentMethod.Rate;
|
||||||
entity.DepositAddress = paymentMethod.DepositAddress;
|
entity.DepositAddress = paymentMethod.DepositAddress;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||||||
return DepositAddress;
|
return DepositAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public decimal GetNetworkFee()
|
public decimal GetNextNetworkFee()
|
||||||
{
|
{
|
||||||
return NetworkFee.ToDecimal(MoneyUnit.BTC);
|
return NextNetworkFee.ToDecimal(MoneyUnit.BTC);
|
||||||
}
|
}
|
||||||
public void SetPaymentDestination(string newPaymentDestination)
|
public void SetPaymentDestination(string newPaymentDestination)
|
||||||
{
|
{
|
||||||
@@ -34,7 +34,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public FeeRate FeeRate { get; set; }
|
public FeeRate FeeRate { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Money NetworkFee { get; set; }
|
public Money NextNetworkFee { get; set; }
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public String DepositAddress { get; set; }
|
public String DepositAddress { get; set; }
|
||||||
public BitcoinAddress GetDepositAddress(Network network)
|
public BitcoinAddress GetDepositAddress(Network network)
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||||||
switch (onchainMethod.NetworkFeeMode)
|
switch (onchainMethod.NetworkFeeMode)
|
||||||
{
|
{
|
||||||
case NetworkFeeMode.Always:
|
case NetworkFeeMode.Always:
|
||||||
onchainMethod.NetworkFee = onchainMethod.FeeRate.GetFee(100); // assume price for 100 bytes
|
onchainMethod.NextNetworkFee = onchainMethod.FeeRate.GetFee(100); // assume price for 100 bytes
|
||||||
break;
|
break;
|
||||||
case NetworkFeeMode.Never:
|
case NetworkFeeMode.Never:
|
||||||
case NetworkFeeMode.MultiplePaymentsOnly:
|
case NetworkFeeMode.MultiplePaymentsOnly:
|
||||||
onchainMethod.NetworkFee = Money.Zero;
|
onchainMethod.NextNetworkFee = Money.Zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
onchainMethod.DepositAddress = (await prepare.ReserveAddress).ToString();
|
onchainMethod.DepositAddress = (await prepare.ReserveAddress).ToString();
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ namespace BTCPayServer.Payments
|
|||||||
string GetPaymentDestination();
|
string GetPaymentDestination();
|
||||||
PaymentTypes GetPaymentType();
|
PaymentTypes GetPaymentType();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns what a merchant would need to pay to cashout this payment
|
/// Returns fee that the merchant charge to the customer for the next payment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
decimal GetNetworkFee();
|
decimal GetNextNetworkFee();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change the payment destination (internal plumbing)
|
/// Change the payment destination (internal plumbing)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace BTCPayServer.Payments.Lightning
|
|||||||
return PaymentTypes.LightningLike;
|
return PaymentTypes.LightningLike;
|
||||||
}
|
}
|
||||||
|
|
||||||
public decimal GetNetworkFee()
|
public decimal GetNextNetworkFee()
|
||||||
{
|
{
|
||||||
return 0.0m;
|
return 0.0m;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -729,7 +729,7 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
{
|
{
|
||||||
FeeRate = FeeRate,
|
FeeRate = FeeRate,
|
||||||
DepositAddress = string.IsNullOrEmpty(DepositAddress) ? null : DepositAddress,
|
DepositAddress = string.IsNullOrEmpty(DepositAddress) ? null : DepositAddress,
|
||||||
NetworkFee = NetworkFee
|
NextNetworkFee = NextNetworkFee
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -737,7 +737,7 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
var details = PaymentMethodExtensions.DeserializePaymentMethodDetails(GetId(), PaymentMethodDetails);
|
var details = PaymentMethodExtensions.DeserializePaymentMethodDetails(GetId(), PaymentMethodDetails);
|
||||||
if (details is Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod btcLike)
|
if (details is Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod btcLike)
|
||||||
{
|
{
|
||||||
btcLike.NetworkFee = NetworkFee;
|
btcLike.NextNetworkFee = NextNetworkFee;
|
||||||
btcLike.DepositAddress = string.IsNullOrEmpty(DepositAddress) ? null : DepositAddress;
|
btcLike.DepositAddress = string.IsNullOrEmpty(DepositAddress) ? null : DepositAddress;
|
||||||
btcLike.FeeRate = FeeRate;
|
btcLike.FeeRate = FeeRate;
|
||||||
}
|
}
|
||||||
@@ -759,7 +759,7 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
|
|
||||||
if (paymentMethod is Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod bitcoinPaymentMethod)
|
if (paymentMethod is Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod bitcoinPaymentMethod)
|
||||||
{
|
{
|
||||||
NetworkFee = bitcoinPaymentMethod.NetworkFee;
|
NextNetworkFee = bitcoinPaymentMethod.NextNetworkFee;
|
||||||
FeeRate = bitcoinPaymentMethod.FeeRate;
|
FeeRate = bitcoinPaymentMethod.FeeRate;
|
||||||
DepositAddress = bitcoinPaymentMethod.DepositAddress;
|
DepositAddress = bitcoinPaymentMethod.DepositAddress;
|
||||||
}
|
}
|
||||||
@@ -774,8 +774,8 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
[Obsolete("Use ((BitcoinLikeOnChainPaymentMethod)GetPaymentMethod()).FeeRate")]
|
[Obsolete("Use ((BitcoinLikeOnChainPaymentMethod)GetPaymentMethod()).FeeRate")]
|
||||||
public FeeRate FeeRate { get; set; }
|
public FeeRate FeeRate { get; set; }
|
||||||
[JsonProperty(PropertyName = "txFee")]
|
[JsonProperty(PropertyName = "txFee")]
|
||||||
[Obsolete("Use ((BitcoinLikeOnChainPaymentMethod)GetPaymentMethod()).TxFee")]
|
[Obsolete("Use ((BitcoinLikeOnChainPaymentMethod)GetPaymentMethod()).NextNetworkFee")]
|
||||||
public Money NetworkFee { get; set; }
|
public Money NextNetworkFee { get; set; }
|
||||||
[JsonProperty(PropertyName = "depositAddress")]
|
[JsonProperty(PropertyName = "depositAddress")]
|
||||||
[Obsolete("Use ((BitcoinLikeOnChainPaymentMethod)GetPaymentMethod()).DepositAddress")]
|
[Obsolete("Use ((BitcoinLikeOnChainPaymentMethod)GetPaymentMethod()).DepositAddress")]
|
||||||
public string DepositAddress { get; set; }
|
public string DepositAddress { get; set; }
|
||||||
@@ -840,7 +840,7 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
var method = GetPaymentMethodDetails();
|
var method = GetPaymentMethodDetails();
|
||||||
if (method == null)
|
if (method == null)
|
||||||
return 0.0m;
|
return 0.0m;
|
||||||
return method.GetNetworkFee();
|
return method.GetNextNetworkFee();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ retry:
|
|||||||
paymentMethods = entity.GetPaymentMethods(null);
|
paymentMethods = entity.GetPaymentMethods(null);
|
||||||
var paymentMethodDetails = paymentMethods.TryGet(paymentEntity.GetPaymentMethodId())?.GetPaymentMethodDetails();
|
var paymentMethodDetails = paymentMethods.TryGet(paymentEntity.GetPaymentMethodId())?.GetPaymentMethodDetails();
|
||||||
if (paymentMethodDetails != null) // == null should never happen, but we never know.
|
if (paymentMethodDetails != null) // == null should never happen, but we never know.
|
||||||
paymentEntity.NetworkFee = paymentMethodDetails.GetNetworkFee();
|
paymentEntity.NetworkFee = paymentMethodDetails.GetNextNetworkFee();
|
||||||
}
|
}
|
||||||
|
|
||||||
return paymentEntity;
|
return paymentEntity;
|
||||||
@@ -582,15 +582,15 @@ retry:
|
|||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
ReceivedTime = date.UtcDateTime,
|
ReceivedTime = date.UtcDateTime,
|
||||||
Accounted = accounted,
|
Accounted = accounted,
|
||||||
NetworkFee = paymentMethodDetails.GetNetworkFee()
|
NetworkFee = paymentMethodDetails.GetNextNetworkFee()
|
||||||
};
|
};
|
||||||
entity.SetCryptoPaymentData(paymentData);
|
entity.SetCryptoPaymentData(paymentData);
|
||||||
|
|
||||||
if (paymentMethodDetails is Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod bitcoinPaymentMethod &&
|
if (paymentMethodDetails is Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod bitcoinPaymentMethod &&
|
||||||
bitcoinPaymentMethod.NetworkFeeMode == NetworkFeeMode.MultiplePaymentsOnly &&
|
bitcoinPaymentMethod.NetworkFeeMode == NetworkFeeMode.MultiplePaymentsOnly &&
|
||||||
bitcoinPaymentMethod.NetworkFee == Money.Zero)
|
bitcoinPaymentMethod.NextNetworkFee == Money.Zero)
|
||||||
{
|
{
|
||||||
bitcoinPaymentMethod.NetworkFee = bitcoinPaymentMethod.FeeRate.GetFee(100); // assume price for 100 bytes
|
bitcoinPaymentMethod.NextNetworkFee = bitcoinPaymentMethod.FeeRate.GetFee(100); // assume price for 100 bytes
|
||||||
paymentMethod.SetPaymentMethodDetails(bitcoinPaymentMethod);
|
paymentMethod.SetPaymentMethodDetails(bitcoinPaymentMethod);
|
||||||
invoiceEntity.SetPaymentMethod(paymentMethod);
|
invoiceEntity.SetPaymentMethod(paymentMethod);
|
||||||
invoice.Blob = ToBytes(invoiceEntity, network.NBitcoinNetwork);
|
invoice.Blob = ToBytes(invoiceEntity, network.NBitcoinNetwork);
|
||||||
|
|||||||
Reference in New Issue
Block a user