Remove deps on NetworkProvider in AppService

This commit is contained in:
nicolas.dorier
2019-06-07 13:40:48 +09:00
parent 13c03cc0c2
commit 29cbf63346
2 changed files with 2 additions and 5 deletions

View File

@@ -361,7 +361,7 @@ namespace BTCPayServer.Payments.Bitcoin
invoice = (await UpdatePaymentStates(wallet, invoice.Id)); invoice = (await UpdatePaymentStates(wallet, invoice.Id));
if (invoice == null) if (invoice == null)
return null; return null;
var paymentMethod = invoice.GetPaymentMethod(wallet.Network, PaymentTypes.BTCLike, _ExplorerClients.NetworkProviders); var paymentMethod = invoice.GetPaymentMethod(wallet.Network, PaymentTypes.BTCLike);
if (paymentMethod != null && if (paymentMethod != null &&
paymentMethod.GetPaymentMethodDetails() is BitcoinLikeOnChainPaymentMethod btc && paymentMethod.GetPaymentMethodDetails() is BitcoinLikeOnChainPaymentMethod btc &&
btc.GetDepositAddress(wallet.Network.NBitcoinNetwork).ScriptPubKey == paymentData.Output.ScriptPubKey && btc.GetDepositAddress(wallet.Network.NBitcoinNetwork).ScriptPubKey == paymentData.Output.ScriptPubKey &&

View File

@@ -37,11 +37,9 @@ namespace BTCPayServer.Services.Apps
CurrencyNameTable _Currencies; CurrencyNameTable _Currencies;
private readonly StoreRepository _storeRepository; private readonly StoreRepository _storeRepository;
private readonly HtmlSanitizer _HtmlSanitizer; private readonly HtmlSanitizer _HtmlSanitizer;
private readonly BTCPayNetworkProvider _Networks;
public CurrencyNameTable Currencies => _Currencies; public CurrencyNameTable Currencies => _Currencies;
public AppService(ApplicationDbContextFactory contextFactory, public AppService(ApplicationDbContextFactory contextFactory,
InvoiceRepository invoiceRepository, InvoiceRepository invoiceRepository,
BTCPayNetworkProvider networks,
CurrencyNameTable currencies, CurrencyNameTable currencies,
StoreRepository storeRepository, StoreRepository storeRepository,
HtmlSanitizer htmlSanitizer) HtmlSanitizer htmlSanitizer)
@@ -51,7 +49,6 @@ namespace BTCPayServer.Services.Apps
_Currencies = currencies; _Currencies = currencies;
_storeRepository = storeRepository; _storeRepository = storeRepository;
_HtmlSanitizer = htmlSanitizer; _HtmlSanitizer = htmlSanitizer;
_Networks = networks;
} }
public async Task<object> GetAppInfo(string appId) public async Task<object> GetAppInfo(string appId)
@@ -325,7 +322,7 @@ namespace BTCPayServer.Services.Apps
var paymentMethodContribution = new Contribution(); var paymentMethodContribution = new Contribution();
paymentMethodContribution.PaymentMehtodId = pay.GetPaymentMethodId(); paymentMethodContribution.PaymentMehtodId = pay.GetPaymentMethodId();
paymentMethodContribution.Value = pay.GetCryptoPaymentData().GetValue() - pay.NetworkFee; paymentMethodContribution.Value = pay.GetCryptoPaymentData().GetValue() - pay.NetworkFee;
var rate = p.GetPaymentMethod(paymentMethodContribution.PaymentMehtodId, _Networks).Rate; var rate = p.GetPaymentMethod(paymentMethodContribution.PaymentMehtodId).Rate;
paymentMethodContribution.CurrencyValue = rate * paymentMethodContribution.Value; paymentMethodContribution.CurrencyValue = rate * paymentMethodContribution.Value;
return paymentMethodContribution; return paymentMethodContribution;
}) })