mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
fix issues around local btcpay client and no request obj
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
namespace BTCPayServer.Abstractions.Contracts
|
||||||
{
|
{
|
||||||
public interface IBTCPayServerClientFactory
|
public interface IBTCPayServerClientFactory
|
||||||
{
|
{
|
||||||
Task<BTCPayServerClient> Create(string userId, params string[] storeIds);
|
Task<BTCPayServerClient> Create(string userId, params string[] storeIds);
|
||||||
|
Task<BTCPayServerClient> Create(string userId, string[] storeIds, HttpContext httpRequest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,9 +118,23 @@ namespace BTCPayServer.Controllers.Greenfield
|
|||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<BTCPayServerClient> Create(string userId, params string[] storeIds)
|
public Task<BTCPayServerClient> Create(string userId, params string[] storeIds)
|
||||||
|
{
|
||||||
|
return Create(userId, storeIds, new DefaultHttpContext()
|
||||||
|
{
|
||||||
|
Request =
|
||||||
|
{
|
||||||
|
Scheme = "https",
|
||||||
|
Host = new HostString("dummy.com"),
|
||||||
|
Path = new PathString(),
|
||||||
|
PathBase = new PathString(),
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BTCPayServerClient> Create(string userId, string[] storeIds, HttpContext context)
|
||||||
{
|
{
|
||||||
var context = new DefaultHttpContext();
|
|
||||||
if (!string.IsNullOrEmpty(userId))
|
if (!string.IsNullOrEmpty(userId))
|
||||||
{
|
{
|
||||||
var user = await _userManager.FindByIdAsync(userId);
|
var user = await _userManager.FindByIdAsync(userId);
|
||||||
|
|||||||
Reference in New Issue
Block a user