From b0f00773d620e50efe28b9451dc4c21d9241fc71 Mon Sep 17 00:00:00 2001 From: Kukks Date: Wed, 30 Mar 2022 15:04:51 +0200 Subject: [PATCH] fix issues around local btcpay client and no request obj --- .../Contracts/IBTCPayServerClientFactory.cs | 2 ++ .../GreenField/LocalBTCPayServerClient.cs | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/BTCPayServer.Abstractions/Contracts/IBTCPayServerClientFactory.cs b/BTCPayServer.Abstractions/Contracts/IBTCPayServerClientFactory.cs index db814b310..e23ab709b 100644 --- a/BTCPayServer.Abstractions/Contracts/IBTCPayServerClientFactory.cs +++ b/BTCPayServer.Abstractions/Contracts/IBTCPayServerClientFactory.cs @@ -1,10 +1,12 @@ using System.Threading.Tasks; using BTCPayServer.Client; +using Microsoft.AspNetCore.Http; namespace BTCPayServer.Abstractions.Contracts { public interface IBTCPayServerClientFactory { Task Create(string userId, params string[] storeIds); + Task Create(string userId, string[] storeIds, HttpContext httpRequest); } } diff --git a/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs b/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs index 0ce789306..129aeb0a3 100644 --- a/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs +++ b/BTCPayServer/Controllers/GreenField/LocalBTCPayServerClient.cs @@ -118,9 +118,23 @@ namespace BTCPayServer.Controllers.Greenfield _serviceProvider = serviceProvider; } - public async Task Create(string userId, params string[] storeIds) + public Task 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 Create(string userId, string[] storeIds, HttpContext context) { - var context = new DefaultHttpContext(); if (!string.IsNullOrEmpty(userId)) { var user = await _userManager.FindByIdAsync(userId);