mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 05:54:26 +01:00
Remove LocalBTCPayClient
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Client;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace BTCPayServer.Abstractions.Contracts
|
||||
{
|
||||
public interface IBTCPayServerClientFactory
|
||||
{
|
||||
Task<BTCPayServerClient> Create(string userId, params string[] storeIds);
|
||||
Task<BTCPayServerClient> Create(string userId, string[] storeIds, HttpContext httpRequest);
|
||||
}
|
||||
}
|
||||
@@ -52,41 +52,6 @@ namespace BTCPayServer.Tests
|
||||
{
|
||||
}
|
||||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
[Trait("Integration", "Integration")]
|
||||
[Trait("Lightning", "Lightning")]
|
||||
public async Task LocalClientTests()
|
||||
{
|
||||
using var tester = CreateServerTester();
|
||||
tester.ActivateLightning();
|
||||
await tester.StartAsync();
|
||||
await tester.EnsureChannelsSetup();
|
||||
var user = tester.NewAccount();
|
||||
await user.GrantAccessAsync();
|
||||
await user.MakeAdmin();
|
||||
user.RegisterLightningNode("BTC", LightningConnectionType.CLightning);
|
||||
var factory = tester.PayTester.GetService<IBTCPayServerClientFactory>();
|
||||
Assert.NotNull(factory);
|
||||
var client = await factory.Create(user.UserId, user.StoreId);
|
||||
await client.GetCurrentUser();
|
||||
await client.GetStores();
|
||||
var store = await client.GetStore(user.StoreId);
|
||||
Assert.NotNull(store);
|
||||
var addr = await client.GetLightningDepositAddress(user.StoreId, "BTC");
|
||||
Assert.NotNull(BitcoinAddress.Create(addr, Network.RegTest));
|
||||
|
||||
await user.CreateStoreAsync();
|
||||
var store1 = user.StoreId;
|
||||
await user.CreateStoreAsync();
|
||||
var store2 = user.StoreId;
|
||||
var store1Client = await factory.Create(null, store1);
|
||||
var store2Client = await factory.Create(null, store2);
|
||||
var store1Res = await store1Client.GetStore(store1);
|
||||
var store2Res = await store2Client.GetStore(store2);
|
||||
Assert.Equal(store1, store1Res.Id);
|
||||
Assert.Equal(store2, store2Res.Id);
|
||||
}
|
||||
|
||||
[Fact(Timeout = TestTimeout)]
|
||||
[Trait("Integration", "Integration")]
|
||||
public async Task MissingPermissionTest()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -481,10 +481,6 @@ o.GetRequiredService<IEnumerable<IPaymentLinkExtension>>().ToDictionary(o => o.P
|
||||
services.AddSingleton<EmailSenderFactory>();
|
||||
services.AddSingleton<InvoiceActivator>();
|
||||
|
||||
//create a simple client which hooks up to the http scope
|
||||
services.AddScoped<BTCPayServerClient, LocalBTCPayServerClient>();
|
||||
//also provide a factory that can impersonate user/store id
|
||||
services.AddSingleton<IBTCPayServerClientFactory, BTCPayServerClientFactory>();
|
||||
services.AddPayoutProcesors();
|
||||
services.AddForms();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user