mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
remove unused code, remove derivationscheme specific logic from InvoiceEntity
This commit is contained in:
parent
a6b92a0dd5
commit
b4f4401cdc
3 changed files with 9 additions and 26 deletions
|
@ -70,7 +70,6 @@ namespace BTCPayServer.HostedServices
|
|||
invoice.Status = "expired";
|
||||
}
|
||||
|
||||
var derivationStrategies = invoice.GetDerivationStrategies(_NetworkProvider).ToArray();
|
||||
var payments = invoice.GetPayments().Where(p => p.Accounted).ToArray();
|
||||
var allPaymentMethods = invoice.GetPaymentMethods(_NetworkProvider);
|
||||
var paymentMethod = GetNearestClearedPayment(allPaymentMethods, out var accounting, _NetworkProvider);
|
||||
|
|
|
@ -327,7 +327,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||
{
|
||||
var invoice = await _InvoiceRepository.GetInvoice(null, invoiceId, true);
|
||||
var alreadyAccounted = GetAllBitcoinPaymentData(invoice).Select(p => p.Outpoint).ToHashSet();
|
||||
var strategy = invoice.GetDerivationStrategy(network);
|
||||
var strategy = GetDerivationStrategy(invoice, network);
|
||||
if (strategy == null)
|
||||
continue;
|
||||
var cryptoId = new PaymentMethodId(network.CryptoCode, PaymentTypes.BTCLike);
|
||||
|
@ -349,6 +349,14 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||
return totalPayment;
|
||||
}
|
||||
|
||||
private DerivationStrategyBase GetDerivationStrategy(InvoiceEntity invoice, BTCPayNetwork network)
|
||||
{
|
||||
return invoice.GetDerivationStrategies(_ExplorerClients.NetworkProviders)
|
||||
.Where(d => d.Network.CryptoCode == network.CryptoCode)
|
||||
.Select(d => d.DerivationStrategyBase)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
private async Task<InvoiceEntity> ReceivedPayment(BTCPayWallet wallet, string invoiceId, PaymentEntity payment, DerivationStrategyBase strategy)
|
||||
{
|
||||
var paymentData = (BitcoinLikePaymentData)payment.GetCryptoPaymentData();
|
||||
|
|
|
@ -169,30 +169,6 @@ namespace BTCPayServer.Services.Invoices
|
|||
set;
|
||||
}
|
||||
|
||||
public DerivationStrategyBase GetDerivationStrategy(BTCPayNetwork network)
|
||||
{
|
||||
#pragma warning disable CS0618
|
||||
if (!string.IsNullOrEmpty(DerivationStrategies))
|
||||
{
|
||||
JObject strategies = JObject.Parse(DerivationStrategies);
|
||||
#pragma warning restore CS0618
|
||||
foreach (var strat in strategies.Properties())
|
||||
{
|
||||
if (strat.Name == network.CryptoCode)
|
||||
{
|
||||
return BTCPayServer.DerivationStrategy.Parse(strat.Value.Value<string>(), network).DerivationStrategyBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning disable CS0618
|
||||
if (network.IsBTC && !string.IsNullOrEmpty(DerivationStrategy))
|
||||
{
|
||||
return BTCPayServer.DerivationStrategy.Parse(DerivationStrategy, network).DerivationStrategyBase;
|
||||
}
|
||||
return null;
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
public IEnumerable<DerivationStrategy> GetDerivationStrategies(BTCPayNetworkProvider networks)
|
||||
{
|
||||
#pragma warning disable CS0618
|
||||
|
|
Loading…
Add table
Reference in a new issue