Add FruitBank SANDBOX for isolated SignalR endpoint testing

Introduces a new SANDBOX environment with a dedicated web app (`Mango.Sandbox.EndPoints`) for testing SignalR endpoints in isolation from the main application. Adds null plugin manager implementations to avoid plugin dependencies. Includes automated MSTest tests (`Mango.Sandbox.EndPoints.Tests`), a manual SignalR test client, and a PowerShell script for building and running the sandbox. Provides configuration files and health endpoints for robust, independent development and testing of FruitBank SignalR logic.
This commit is contained in:
Loretta 2025-12-10 09:47:06 +01:00
parent d3659779ee
commit 9a3720f053
21 changed files with 1681 additions and 2 deletions

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32002.185
# Visual Studio Version 18
VisualStudioVersion = 18.0.11222.15
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E4ACA93B-D3DE-4557-B069-F1DB42925A4B}"
EndProject
@ -87,6 +87,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nop.Plugin.Misc.MangoCore",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mango.Nop.Data", "..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Data\Mango.Nop.Data.csproj", "{EE44B558-F1DA-433A-BD4C-D275986A4679}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mango.Sandbox.EndPoints", "Tests\Mango.Sandbox\Mango.Sandbox.EndPoints\Mango.Sandbox.EndPoints.csproj", "{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mango.Sandbox.EndPoints.Tests", "Tests\Mango.Sandbox\Mango.Sandbox.EndPoints.Tests\Mango.Sandbox.EndPoints.Tests.csproj", "{B8491E5C-DBB5-1594-052E-744D78D7A4DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mango.Sandbox.SignalRTestClient", "Tests\Mango.Sandbox\Mango.Sandbox.SignalRTestClient\Mango.Sandbox.SignalRTestClient.csproj", "{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -507,6 +513,42 @@ Global
{EE44B558-F1DA-433A-BD4C-D275986A4679}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{EE44B558-F1DA-433A-BD4C-D275986A4679}.Release|x86.ActiveCfg = Release|Any CPU
{EE44B558-F1DA-433A-BD4C-D275986A4679}.Release|x86.Build.0 = Release|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Debug|x86.ActiveCfg = Debug|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Debug|x86.Build.0 = Debug|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Release|Any CPU.Build.0 = Release|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Release|x86.ActiveCfg = Release|Any CPU
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C}.Release|x86.Build.0 = Release|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Debug|x86.ActiveCfg = Debug|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Debug|x86.Build.0 = Debug|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Release|Any CPU.Build.0 = Release|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Release|x86.ActiveCfg = Release|Any CPU
{B8491E5C-DBB5-1594-052E-744D78D7A4DE}.Release|x86.Build.0 = Release|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Debug|x86.ActiveCfg = Debug|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Debug|x86.Build.0 = Debug|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Release|Any CPU.Build.0 = Release|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Release|x86.ActiveCfg = Release|Any CPU
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -550,6 +592,9 @@ Global
{3E893AC2-29F1-48FC-B33F-F73C6EE2BE90} = {0742FDF3-0F2E-4C64-9521-E58A7FF2ED26}
{3976CB1D-8080-4B84-8C01-1F98BFCAF2B3} = {0742FDF3-0F2E-4C64-9521-E58A7FF2ED26}
{EE44B558-F1DA-433A-BD4C-D275986A4679} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{D22DB269-2490-4A3D-B0B4-2CD2BB626F9C} = {E8FC6874-E230-468A-9685-4747354B92FF}
{B8491E5C-DBB5-1594-052E-744D78D7A4DE} = {E8FC6874-E230-468A-9685-4747354B92FF}
{B2FBDB33-24F4-E0B1-0EA7-7939A387F88F} = {E8FC6874-E230-468A-9685-4747354B92FF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EE72A8B2-332A-4175-9319-6726D36E9D25}

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,218 @@
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Diagnostics;
using System.Text;
using System.Text.Json;
namespace Mango.Sandbox.EndPoints.Tests;
/// <summary>
/// SignalR Endpoint tesztek.
/// FONTOS: A SANDBOX-ot manuálisan kell elindítani a tesztek futtatása elõtt!
// Indítás: dotnet run --project Mango.Sandbox.EndPoints --urls http://localhost:59579
/// </summary>
[TestClass]
public class SignalREndpointTests
{
private static readonly string SandboxUrl = "http://localhost:59579";
private static readonly string HubUrl = $"{SandboxUrl}/fbHub";
// SignalR Tags from FruitBank.Common.SignalRs.SignalRTags
private const int GetMeasuringUsersTag = 70;
private const int GetStockQuantityHistoryDtosTag = 40;
private const int GetStockQuantityHistoryDtosByProductIdTag = 41;
private const int GetShippingDocumentsByShippingIdTag = 60;
private const int GetOrderDtoByIdTag = 21;
private const int GetStockTakingItemsByIdTag = 81;
[ClassInitialize]
public static async Task ClassInitialize(TestContext context)
{
using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
try
{
var response = await httpClient.GetAsync($"{SandboxUrl}/health");
Assert.IsTrue(response.IsSuccessStatusCode,
"SANDBOX is not running! Start it manually: dotnet run --project Mango.Sandbox.EndPoints --urls http://localhost:59579");
}
catch (Exception ex)
{
Assert.Fail($"SANDBOX is not running! Error: {ex.Message}\n" +
"Start it manually: dotnet run --project Mango.Sandbox.EndPoints --urls http://localhost:59579");
}
}
#region HTTP Endpoint Tests
[TestMethod]
public async Task HealthEndpoint_ReturnsSuccess()
{
using var httpClient = new HttpClient();
var response = await httpClient.GetAsync($"{SandboxUrl}/health");
Assert.IsTrue(response.IsSuccessStatusCode, $"Health endpoint returned {response.StatusCode}");
}
[TestMethod]
public async Task RootEndpoint_ReturnsSandboxIsRunning()
{
using var httpClient = new HttpClient();
var response = await httpClient.GetStringAsync(SandboxUrl);
Assert.AreEqual("SANDBOX is running!", response);
}
#endregion
#region SignalR Connection Tests
[TestMethod]
public async Task SignalR_Negotiate_ReturnsSuccess()
{
using var httpClient = new HttpClient();
var response = await httpClient.PostAsync($"{HubUrl}/negotiate?negotiateVersion=1", null);
Assert.IsTrue(response.IsSuccessStatusCode, $"SignalR negotiate returned {response.StatusCode}");
}
[TestMethod]
public async Task SignalR_Connect_Succeeds()
{
var connection = new HubConnectionBuilder()
.WithUrl(HubUrl)
.Build();
try
{
await connection.StartAsync();
Assert.AreEqual(HubConnectionState.Connected, connection.State);
}
finally
{
await connection.StopAsync();
}
}
#endregion
#region SignalR Business Endpoint Tests
[TestMethod]
public async Task SignalR_GetMeasuringUsers_ReturnsJson()
{
await TestSignalREndpoint(GetMeasuringUsersTag, null, "GetMeasuringUsers");
}
[TestMethod]
public async Task SignalR_GetStockQuantityHistoryDtos_ReturnsJson()
{
await TestSignalREndpoint(GetStockQuantityHistoryDtosTag, null, "GetStockQuantityHistoryDtos");
}
[TestMethod]
public async Task SignalR_GetStockQuantityHistoryDtosByProductId_ReturnsJson()
{
// ProductId = 10
await TestSignalREndpoint(GetStockQuantityHistoryDtosByProductIdTag, 10, "GetStockQuantityHistoryDtosByProductId");
}
[TestMethod]
public async Task SignalR_GetShippingDocumentsByShippingId_ReturnsJson()
{
// ShippingId = 5
await TestSignalREndpoint(GetShippingDocumentsByShippingIdTag, 5, "GetShippingDocumentsByShippingId");
}
[TestMethod]
public async Task SignalR_GetOrderDtoById_ReturnsJson()
{
// OrderId = 15
await TestSignalREndpoint(GetOrderDtoByIdTag, 15, "GetOrderDtoById");
}
[TestMethod]
public async Task SignalR_GetStockTakingItemsById_ReturnsJson()
{
// StockTakingItemId = 200
await TestSignalREndpoint(GetStockTakingItemsByIdTag, 200, "GetStockTakingItemsById");
}
#endregion
#region Helper Methods
private async Task TestSignalREndpoint(int tag, object? parameter, string endpointName)
{
var connection = new HubConnectionBuilder()
.WithUrl(HubUrl)
.Build();
string? receivedJson = null;
int receivedTag = -1;
var responseReceived = new TaskCompletionSource<bool>();
connection.On<int, byte[]>("ReceiveMessage", (responseTag, data) =>
{
receivedTag = responseTag;
if (data != null && data.Length > 0)
{
receivedJson = Encoding.UTF8.GetString(data);
}
responseReceived.TrySetResult(true);
});
try
{
await connection.StartAsync();
Assert.AreEqual(HubConnectionState.Connected, connection.State, $"Failed to connect to SignalR hub for {endpointName}");
// Készítsük el a request data-t
byte[] requestData = parameter != null
? Encoding.UTF8.GetBytes(JsonSerializer.Serialize(parameter))
: Array.Empty<byte>();
await connection.InvokeAsync("ReceiveMessage", tag, requestData);
var completed = await Task.WhenAny(responseReceived.Task, Task.Delay(15000));
if (completed == responseReceived.Task)
{
Console.WriteLine($"[{endpointName}] Response tag: {receivedTag}");
Console.WriteLine($"[{endpointName}] Response JSON: {receivedJson?.Substring(0, Math.Min(500, receivedJson?.Length ?? 0))}...");
// Ellenõrizzük, hogy valid JSON-e (ha van adat)
if (!string.IsNullOrEmpty(receivedJson))
{
try
{
var jsonDoc = JsonDocument.Parse(receivedJson);
Assert.IsTrue(
jsonDoc.RootElement.ValueKind == JsonValueKind.Array ||
jsonDoc.RootElement.ValueKind == JsonValueKind.Object ||
jsonDoc.RootElement.ValueKind == JsonValueKind.Null,
$"[{endpointName}] Response is not a valid JSON");
}
catch (JsonException ex)
{
Assert.Fail($"[{endpointName}] Invalid JSON response: {ex.Message}");
}
}
}
else
{
Assert.AreEqual(HubConnectionState.Connected, connection.State,
$"[{endpointName}] Connection was closed - check SANDBOX logs for DI errors");
}
}
catch (Exception ex)
{
Assert.Fail($"[{endpointName}] SignalR error: {ex.Message}. Check SANDBOX logs for missing DI registrations.");
}
finally
{
if (connection.State == HubConnectionState.Connected)
{
await connection.StopAsync();
}
}
}
#endregion
}

View File

@ -0,0 +1,144 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Ne generáljon duplikált assembly info-t -->
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<!--
Projekt helye: H:\Applications\Mango\Source\FruitBank\Tests\Mango.Sandbox\Mango.Sandbox.EndPoints
FruitBank helye: H:\Applications\Mango\Source\FruitBank
-->
<FruitBankRoot>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..'))\</FruitBankRoot>
<SourceRoot>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..\..'))\</SourceRoot>
<PluginOutputDir>$(FruitBankRoot)Presentation\Nop.Web\Plugins\Misc.FruitBankPlugin\</PluginOutputDir>
<FruitBankHybridRoot>$(SourceRoot)FruitBankHybridApp\</FruitBankHybridRoot>
</PropertyGroup>
<!-- ===========================================
NuGet Packages - SANDBOX specifikus + NopCommerce szolgáltatásokhoz szükséges
=========================================== -->
<ItemGroup>
<!-- SignalR -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.11" />
<!-- FluentValidation (Nop.Web.Framework használja) -->
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
<!-- WebOptimizer (Nop.Web.Framework használja) -->
<PackageReference Include="LigerShark.WebOptimizer.Core" Version="3.0.426" />
<!-- WebMarkupMin (Nop.Web.Framework használja) -->
<PackageReference Include="WebMarkupMin.AspNetCoreLatest" Version="2.18.0" />
<PackageReference Include="WebMarkupMin.NUglify" Version="2.18.0" />
<!-- Nop.Services - Azure, Mail, PDF, stb. -->
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="ClosedXML" Version="0.104.2" />
<PackageReference Include="Google.Apis.Auth" Version="1.68.0" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2.5" />
<PackageReference Include="MailKit" Version="4.5.0" />
<PackageReference Include="MaxMind.GeoIP2" Version="5.2.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.66.2" />
<PackageReference Include="QuestPDF" Version="2022.12.15" />
<PackageReference Include="System.ServiceModel.Http" Version="8.1.2" />
<PackageReference Include="SkiaSharp" Version="2.88.9" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.9" />
<PackageReference Include="Svg.Skia" Version="2.0.0.4" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.9" />
<!-- Nop.Data - Database, Migration -->
<PackageReference Include="FluentMigrator" Version="6.2.0" />
<PackageReference Include="FluentMigrator.Runner" Version="6.2.0" />
<PackageReference Include="linq2db" Version="5.4.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />
<PackageReference Include="Npgsql" Version="9.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.11" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<!-- Nop.Core - Autofac, AutoMapper, Redis, stb. -->
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.3.4" />
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.2.4" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="9.0.11" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.3" />
</ItemGroup>
<!-- ===========================================
NopCommerce projekt referenciák - TELJES INFRASTRUKTÚRA
=========================================== -->
<ItemGroup>
<!-- Nop.Web - Admin Model Factories, Controllers, stb. -->
<ProjectReference Include="$(FruitBankRoot)Presentation\Nop.Web\Nop.Web.csproj" />
<!-- Nop.Web.Framework - MVC infrastruktúra, Themes, stb. -->
<ProjectReference Include="$(FruitBankRoot)Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
</ItemGroup>
<!-- FruitBank Plugin és kapcsolódó DLL-ek a PROD build output-ból -->
<ItemGroup>
<Reference Include="Nop.Plugin.Misc.FruitBankPlugin">
<HintPath>$(PluginOutputDir)Nop.Plugin.Misc.FruitBankPlugin.dll</HintPath>
</Reference>
<Reference Include="Mango.Nop.Core">
<HintPath>$(PluginOutputDir)Mango.Nop.Core.dll</HintPath>
</Reference>
<Reference Include="Mango.Nop.Services">
<HintPath>$(PluginOutputDir)Mango.Nop.Services.dll</HintPath>
</Reference>
</ItemGroup>
<!-- FruitBank DLL referenciák -->
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Database">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Database.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models.Server">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Services.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services.Server">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Utils">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Utils.dll</HintPath>
</Reference>
<Reference Include="FruitBank.Common">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\FruitBank.Common.dll</HintPath>
</Reference>
<Reference Include="FruitBank.Common.Server">
<HintPath>$(FruitBankHybridRoot)FruitBank.Common.Server\bin\Debug\net9.0\FruitBank.Common.Server.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,739 @@
using AyCode.Core.Loggers;
using FluentValidation;
using FluentValidation.AspNetCore;
using FruitBank.Common;
using FruitBank.Common.Interfaces;
using FruitBank.Common.Server.Interfaces;
using FruitBank.Common.Server.Services.Loggers;
using FruitBank.Common.Server.Services.SignalRs;
using Mango.Nop.Services;
using Mango.Nop.Services.Loggers;
using Mango.Sandbox.EndPoints.Services;
using Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Nop.Core;
using Nop.Core.Caching;
using Nop.Core.Configuration;
using Nop.Core.Domain;
using Nop.Core.Domain.Blogs;
using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Directory;
using Nop.Core.Domain.Forums;
using Nop.Core.Domain.Gdpr;
using Nop.Core.Domain.Localization;
using Nop.Core.Domain.Media;
using Nop.Core.Domain.Messages;
using Nop.Core.Domain.News;
using Nop.Core.Domain.Orders;
using Nop.Core.Domain.Payments;
using Nop.Core.Domain.Security;
using Nop.Core.Domain.Seo;
using Nop.Core.Domain.Shipping;
using Nop.Core.Domain.Stores;
using Nop.Core.Domain.Tax;
using Nop.Core.Domain.Vendors;
using Nop.Core.Events;
using Nop.Core.Http;
using Nop.Core.Infrastructure;
using Nop.Core.Security;
using Nop.Data;
using Nop.Data.DataProviders;
using Nop.Data.Mapping;
using Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
using Nop.Plugin.Misc.FruitBankPlugin.Controllers;
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
using Nop.Plugin.Misc.FruitBankPlugin.Factories;
using Nop.Plugin.Misc.FruitBankPlugin.Mapping;
using Nop.Plugin.Misc.FruitBankPlugin.Services;
using Nop.Services.Affiliates;
using Nop.Services.Attributes;
using Nop.Services.Authentication;
using Nop.Services.Authentication.External;
using Nop.Services.Authentication.MultiFactor;
using Nop.Services.Blogs;
using Nop.Services.Caching;
using Nop.Services.Catalog;
using Nop.Services.Cms;
using Nop.Services.Common;
using Nop.Services.Configuration;
using Nop.Services.Customers;
using Nop.Services.Directory;
using Nop.Services.Discounts;
using Nop.Services.Events;
using Nop.Services.ExportImport;
using Nop.Services.Forums;
using Nop.Services.Gdpr;
using Nop.Services.Helpers;
using Nop.Services.Html;
using Nop.Services.Installation;
using Nop.Services.Localization;
using Nop.Services.Logging;
using Nop.Services.Media;
using Nop.Services.Media.RoxyFileman;
using Nop.Services.Messages;
using Nop.Services.News;
using Nop.Services.Orders;
using Nop.Services.Payments;
using Nop.Services.Plugins;
using Nop.Services.Plugins.Marketplace;
using Nop.Services.Polls;
using Nop.Services.ScheduleTasks;
using Nop.Services.Security;
using Nop.Services.Seo;
using Nop.Services.Shipping;
using Nop.Services.Shipping.Date;
using Nop.Services.Shipping.Pickup;
using Nop.Services.Stores;
using Nop.Services.Tax;
using Nop.Services.Themes;
using Nop.Services.Topics;
using Nop.Services.Vendors;
using Nop.Web.Areas.Admin.Factories;
using Nop.Web.Areas.Admin.Helpers;
using Nop.Web.Framework;
using Nop.Web.Framework.Factories;
using Nop.Web.Framework.Infrastructure;
using Nop.Web.Framework.Menu;
using Nop.Web.Framework.Mvc.Routing;
using Nop.Web.Framework.Themes;
using Nop.Web.Framework.UI;
using Nop.Web.Infrastructure.Installation;
using System.Net.Http.Headers;
var builder = WebApplication.CreateBuilder(args);
// ===========================================
// === KONFIGURÁCIÓ ===
// ===========================================
var prodAppSettingsPath = Path.GetFullPath(Path.Combine(
builder.Environment.ContentRootPath,
"..", "..", "..",
"Presentation", "Nop.Web", "App_Data", "appsettings.json"));
if (File.Exists(prodAppSettingsPath))
{
builder.Configuration.AddJsonFile(prodAppSettingsPath, optional: false, reloadOnChange: true);
Console.WriteLine($"[SANDBOX] PROD config loaded: {prodAppSettingsPath}");
}
else
{
Console.WriteLine($"[SANDBOX] WARNING: PROD appsettings.json not found at: {prodAppSettingsPath}");
}
builder.Configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
Console.WriteLine("[SANDBOX] SANDBOX config overrides applied");
// ===========================================
// === NAME COMPATIBILITY - LinqToDB tábla mapping ===
// ===========================================
NameCompatibilityManager.AdditionalNameCompatibilities.Add(typeof(NameCompatibility));
Console.WriteLine("[SANDBOX] FruitBank NameCompatibility registered for LinqToDB table mapping");
// ===========================================
// === FILE PROVIDER (STATIC) ===
// ===========================================
CommonHelper.DefaultFileProvider = new NopFileProvider(builder.Environment);
// ===========================================
// === TYPE FINDER ===
// ===========================================
var typeFinder = new WebAppTypeFinder();
Singleton<ITypeFinder>.Instance = typeFinder;
builder.Services.AddSingleton<ITypeFinder>(typeFinder);
Console.WriteLine("[SANDBOX] TypeFinder registered");
// ===========================================
// === ENGINE ===
// ===========================================
var engine = new NopEngine();
Singleton<IEngine>.Instance = engine;
builder.Services.AddSingleton<IEngine>(engine);
Console.WriteLine("[SANDBOX] NopEngine registered");
// ===========================================
// === CORS ===
// ===========================================
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
});
options.AddPolicy("SignalR", policy =>
{
policy.SetIsOriginAllowed(_ => true).AllowAnyMethod().AllowAnyHeader().AllowCredentials();
});
});
// ===========================================
// === DI VALIDÁCIÓ KIKAPCSOLÁSA ===
// ===========================================
builder.Host.UseDefaultServiceProvider(options =>
{
options.ValidateScopes = false;
options.ValidateOnBuild = false;
});
// ===========================================
// === MVC INFRASTRUKTÚRA ===
// ===========================================
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
builder.Services.AddSession();
// ===========================================
// === ALAPVETÕ INFRASTRUKTÚRA ===
// ===========================================
builder.Services.AddHttpContextAccessor();
builder.Services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
builder.Services.AddMemoryCache();
// ===========================================
// === APP SETTINGS ===
// ===========================================
var appSettings = new AppSettings();
builder.Configuration.Bind(appSettings);
builder.Services.AddSingleton(appSettings);
Singleton<AppSettings>.Instance = appSettings;
// ===========================================
// === FILE PROVIDER (DI) ===
// ===========================================
builder.Services.AddScoped<INopFileProvider, NopFileProvider>();
// ===========================================
// === ADATBÁZIS ÉS REPOSITORY ===
// ===========================================
builder.Services.AddScoped<INopDataProvider, MsSqlNopDataProvider>();
builder.Services.AddScoped(typeof(IRepository<>), typeof(EntityRepository<>));
// ===========================================
// === CACHE SZOLGÁLTATÁSOK ===
// ===========================================
builder.Services.AddTransient(typeof(IConcurrentCollection<>), typeof(ConcurrentTrie<>));
builder.Services.AddSingleton<ICacheKeyManager, CacheKeyManager>();
builder.Services.AddScoped<IShortTermCacheManager, PerRequestCacheManager>();
builder.Services.AddSingleton<ILocker, MemoryCacheLocker>();
builder.Services.AddSingleton<IStaticCacheManager, MemoryCacheManager>();
builder.Services.AddScoped<ICacheKeyService, MemoryCacheManager>();
// ===========================================
// === EVENT PUBLISHER ===
// ===========================================
builder.Services.AddSingleton<IEventPublisher, EventPublisher>();
// ===========================================
// === LAZY WRAPPERS ===
// ===========================================
builder.Services.AddScoped(typeof(Lazy<>), typeof(LazyInstance<>));
// ===========================================
// === NOP SETTINGS (Domain Settings) - DINAMIKUS REGISZTRÁCIÓ ===
// ===========================================
// Alapvetõ Settings-ek fix értékekkel (amik a SANDBOX mûködéséhez szükségesek)
builder.Services.AddScoped(sp => new CookieSettings());
builder.Services.AddScoped(sp => new CurrencySettings { PrimaryStoreCurrencyId = 1 });
builder.Services.AddScoped(sp => new LocalizationSettings { DefaultAdminLanguageId = 1, AutomaticallyDetectLanguage = false });
builder.Services.AddScoped(sp => new TaxSettings { TaxDisplayType = TaxDisplayType.IncludingTax });
builder.Services.AddScoped(sp => new CatalogSettings());
builder.Services.AddScoped(sp => new OrderSettings());
builder.Services.AddScoped(sp => new ShippingSettings());
builder.Services.AddScoped(sp => new RewardPointsSettings());
builder.Services.AddScoped(sp => new CustomerSettings());
builder.Services.AddScoped(sp => new CommonSettings());
builder.Services.AddScoped(sp => new ShoppingCartSettings());
builder.Services.AddScoped(sp => new MediaSettings());
builder.Services.AddScoped(sp => new StoreInformationSettings());
builder.Services.AddScoped(sp => new SeoSettings());
builder.Services.AddScoped(sp => new SecuritySettings());
builder.Services.AddScoped(sp => new AdminAreaSettings());
builder.Services.AddScoped(sp => new EmailAccountSettings());
builder.Services.AddScoped(sp => new MessagesSettings());
builder.Services.AddScoped(sp => new ExternalAuthenticationSettings());
builder.Services.AddScoped(sp => new VendorSettings());
builder.Services.AddScoped(sp => new BlogSettings());
builder.Services.AddScoped(sp => new NewsSettings());
builder.Services.AddScoped(sp => new ForumSettings());
builder.Services.AddScoped(sp => new GdprSettings());
builder.Services.AddScoped(sp => new PaymentSettings());
builder.Services.AddScoped(sp => new AddressSettings());
builder.Services.AddScoped(sp => new DateTimeSettings());
builder.Services.AddScoped(sp => new CaptchaSettings());
builder.Services.AddScoped(sp => new DisplayDefaultMenuItemSettings());
builder.Services.AddScoped(sp => new DisplayDefaultFooterItemSettings());
builder.Services.AddScoped(sp => new PdfSettings());
builder.Services.AddScoped(sp => new RobotsTxtSettings());
builder.Services.AddScoped(sp => new SitemapSettings());
builder.Services.AddScoped(sp => new SitemapXmlSettings());
builder.Services.AddScoped(sp => new MeasureSettings());
builder.Services.AddScoped(sp => new MultiFactorAuthenticationSettings());
builder.Services.AddScoped(sp => new ProxySettings());
// További Settings-ek (Nop.Core.Domain namespace-ekbõl)
builder.Services.AddScoped(sp => new Nop.Core.Domain.Catalog.ProductEditorSettings());
builder.Services.AddScoped(sp => new Nop.Core.Domain.Messages.MessageTemplatesSettings());
// ===========================================
// === NOP CORE SZOLGÁLTATÁSOK ===
// ===========================================
// Web & Utils
builder.Services.AddScoped<IWebHelper, WebHelper>();
builder.Services.AddScoped<IUserAgentHelper, UserAgentHelper>();
builder.Services.AddScoped<IDateTimeHelper, DateTimeHelper>();
// Context
builder.Services.AddScoped<IWorkContext, WebWorkContext>();
builder.Services.AddScoped<IStoreContext, WebStoreContext>();
// Plugins
builder.Services.AddScoped<IPluginService, PluginService>();
builder.Services.AddScoped<OfficialFeedManager>();
// Settings & Config
builder.Services.AddScoped<ISettingService, SettingService>();
// Security & Permission
builder.Services.AddScoped<IPermissionService, PermissionService>();
builder.Services.AddScoped<IAclService, AclService>();
builder.Services.AddScoped<IEncryptionService, EncryptionService>();
// Authentication
builder.Services.AddScoped<IAuthenticationService, CookieAuthenticationService>();
builder.Services.AddScoped<IExternalAuthenticationService, NullExternalAuthenticationService>();
// Store
builder.Services.AddScoped<IStoreService, StoreService>();
builder.Services.AddScoped<IStoreMappingService, StoreMappingService>();
// Localization
builder.Services.AddScoped<ILanguageService, LanguageService>();
builder.Services.AddScoped<ILocalizationService, LocalizationService>();
builder.Services.AddScoped<ILocalizedEntityService, LocalizedEntityService>();
// Currency & Directory
builder.Services.AddScoped<ICurrencyService, CurrencyService>();
builder.Services.AddScoped<ICountryService, CountryService>();
builder.Services.AddScoped<IStateProvinceService, StateProvinceService>();
builder.Services.AddScoped<IMeasureService, MeasureService>();
builder.Services.AddScoped<IGeoLookupService, GeoLookupService>();
// Customer
builder.Services.AddScoped<ICustomerService, CustomerService>();
builder.Services.AddScoped<ICustomerRegistrationService, CustomerRegistrationService>();
builder.Services.AddScoped<ICustomerReportService, CustomerReportService>();
builder.Services.AddScoped<ICustomerActivityService, CustomerActivityService>();
builder.Services.AddScoped<INewsLetterSubscriptionService, NewsLetterSubscriptionService>();
// Address & Vendor & Affiliate
builder.Services.AddScoped<IAddressService, AddressService>();
builder.Services.AddScoped<IVendorService, VendorService>();
builder.Services.AddScoped<IAffiliateService, AffiliateService>();
// Generic Attribute
builder.Services.AddScoped<IGenericAttributeService, GenericAttributeService>();
// Maintenance
builder.Services.AddScoped<IMaintenanceService, MaintenanceService>();
// Catalog
builder.Services.AddScoped<IBackInStockSubscriptionService, BackInStockSubscriptionService>();
builder.Services.AddScoped<ICategoryService, CategoryService>();
builder.Services.AddScoped<ICompareProductsService, CompareProductsService>();
builder.Services.AddScoped<IRecentlyViewedProductsService, RecentlyViewedProductsService>();
builder.Services.AddScoped<IManufacturerService, ManufacturerService>();
builder.Services.AddScoped<IProductAttributeFormatter, ProductAttributeFormatter>();
builder.Services.AddScoped<IProductAttributeParser, ProductAttributeParser>();
builder.Services.AddScoped<IProductAttributeService, ProductAttributeService>();
builder.Services.AddScoped<IProductService, ProductService>();
builder.Services.AddScoped<ICopyProductService, CopyProductService>();
builder.Services.AddScoped<ISpecificationAttributeService, SpecificationAttributeService>();
builder.Services.AddScoped<IProductTemplateService, ProductTemplateService>();
builder.Services.AddScoped<ICategoryTemplateService, CategoryTemplateService>();
builder.Services.AddScoped<IManufacturerTemplateService, ManufacturerTemplateService>();
builder.Services.AddScoped<IProductTagService, ProductTagService>();
builder.Services.AddScoped<IReviewTypeService, ReviewTypeService>();
// Pricing (CustomPriceCalculationService a FruitBank-ból)
builder.Services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>();
builder.Services.AddScoped<PriceCalculationService, CustomPriceCalculationService>();
builder.Services.AddScoped<IPriceFormatter, PriceFormatter>();
// Search
builder.Services.AddScoped<ISearchTermService, SearchTermService>();
// Orders
builder.Services.AddScoped<IOrderService, OrderService>();
builder.Services.AddScoped<IOrderReportService, OrderReportService>();
builder.Services.AddScoped<IOrderProcessingService, OrderProcessingService>();
builder.Services.AddScoped<IOrderTotalCalculationService, OrderTotalCalculationService>();
builder.Services.AddScoped<IShoppingCartService, ShoppingCartService>();
builder.Services.AddScoped<ICheckoutAttributeFormatter, CheckoutAttributeFormatter>();
builder.Services.AddScoped<IGiftCardService, GiftCardService>();
builder.Services.AddScoped<IReturnRequestService, ReturnRequestService>();
builder.Services.AddScoped<IRewardPointService, RewardPointService>();
builder.Services.AddScoped<ICustomNumberFormatter, CustomNumberFormatter>();
// Shipping
builder.Services.AddScoped<IShipmentService, ShipmentService>();
builder.Services.AddScoped<IShippingService, ShippingService>();
builder.Services.AddScoped<IDateRangeService, DateRangeService>();
// Tax
builder.Services.AddScoped<ITaxCategoryService, TaxCategoryService>();
builder.Services.AddScoped<ICheckVatService, CheckVatService>();
builder.Services.AddScoped<ITaxService, TaxService>();
// Payment
builder.Services.AddScoped<IPaymentService, PaymentService>();
// Discounts
builder.Services.AddScoped<IDiscountService, DiscountService>();
// Media
builder.Services.AddScoped<IDownloadService, DownloadService>();
builder.Services.AddScoped<IPictureService, PictureService>();
builder.Services.AddScoped<IVideoService, VideoService>();
// Messages & Notifications
builder.Services.AddScoped<IMessageTemplateService, MessageTemplateService>();
builder.Services.AddScoped<IQueuedEmailService, QueuedEmailService>();
builder.Services.AddScoped<ICampaignService, CampaignService>();
builder.Services.AddScoped<IEmailAccountService, EmailAccountService>();
builder.Services.AddScoped<IWorkflowMessageService, WorkflowMessageService>();
builder.Services.AddScoped<IMessageTokenProvider, MessageTokenProvider>();
builder.Services.AddScoped<ITokenizer, Tokenizer>();
builder.Services.AddScoped<ISmtpBuilder, SmtpBuilder>();
builder.Services.AddScoped<IEmailSender, EmailSender>();
builder.Services.AddScoped<INotificationService, NotificationService>();
// SEO & HTML
builder.Services.AddScoped<IUrlRecordService, UrlRecordService>();
builder.Services.AddScoped<IBBCodeHelper, BBCodeHelper>();
builder.Services.AddScoped<IHtmlFormatter, HtmlFormatter>();
builder.Services.AddScoped<INopUrlHelper, NopUrlHelper>();
// Logging
builder.Services.AddScoped<Nop.Services.Logging.ILogger, DefaultLogger>();
// Topics & Content
builder.Services.AddScoped<ITopicService, TopicService>();
builder.Services.AddScoped<ITopicTemplateService, TopicTemplateService>();
builder.Services.AddScoped<IBlogService, BlogService>();
builder.Services.AddScoped<INewsService, NewsService>();
builder.Services.AddScoped<IForumService, ForumService>();
builder.Services.AddScoped<IPollService, PollService>();
// GDPR
builder.Services.AddScoped<IGdprService, GdprService>();
// Export/Import
builder.Services.AddScoped<IExportManager, ExportManager>();
builder.Services.AddScoped<IImportManager, ImportManager>();
builder.Services.AddScoped<IPdfService, PdfService>();
builder.Services.AddScoped<IUploadService, UploadService>();
// Themes
builder.Services.AddScoped<IThemeProvider, ThemeProvider>();
builder.Services.AddScoped<IThemeContext, ThemeContext>();
// Schedule Tasks
builder.Services.AddSingleton<ITaskScheduler, Nop.Services.ScheduleTasks.TaskScheduler>();
builder.Services.AddTransient<IScheduleTaskRunner, ScheduleTaskRunner>();
builder.Services.AddScoped<IScheduleTaskService, ScheduleTaskService>();
// Installation
builder.Services.AddScoped<IInstallationService, InstallationService>();
builder.Services.AddScoped<IInstallationLocalizationService, InstallationLocalizationService>();
// Slug Route Transformer (ha van adatbázis)
builder.Services.AddScoped<SlugRouteTransformer>();
// Routing
builder.Services.AddSingleton<IRoutePublisher, RoutePublisher>();
// Roxy File Manager
builder.Services.AddScoped<IRoxyFilemanService, RoxyFilemanService>();
builder.Services.AddScoped<IRoxyFilemanFileProvider, RoxyFilemanFileProvider>();
// Web Framework
builder.Services.AddScoped<INopHtmlHelper, NopHtmlHelper>();
builder.Services.AddScoped<Nop.Web.Framework.Factories.IWidgetModelFactory, Nop.Web.Framework.Factories.WidgetModelFactory>();
builder.Services.AddScoped<IAdminMenu, AdminMenu>();
// Attribute Services (generic)
builder.Services.AddScoped(typeof(IAttributeService<,>), typeof(AttributeService<,>));
builder.Services.AddScoped(typeof(IAttributeParser<,>), typeof(Nop.Services.Attributes.AttributeParser<,>));
builder.Services.AddScoped(typeof(IAttributeFormatter<,>), typeof(AttributeFormatter<,>));
// Plugin Managers (generic)
builder.Services.AddScoped(typeof(IPluginManager<>), typeof(PluginManager<>));
// ===========================================
// === PLUGIN MANAGEREK (Null implementációk) ===
// ===========================================
builder.Services.AddScoped<IExchangeRatePluginManager, NullExchangeRatePluginManager>();
builder.Services.AddScoped<ISearchPluginManager, NullSearchPluginManager>();
builder.Services.AddScoped<IDiscountPluginManager, NullDiscountPluginManager>();
builder.Services.AddScoped<IMultiFactorAuthenticationPluginManager, NullMultiFactorAuthenticationPluginManager>();
builder.Services.AddScoped<IWidgetPluginManager, NullWidgetPluginManager>();
builder.Services.AddScoped<IPaymentPluginManager, NullPaymentPluginManager>();
builder.Services.AddScoped<IPickupPluginManager, NullPickupPluginManager>();
builder.Services.AddScoped<IShippingPluginManager, NullShippingPluginManager>();
builder.Services.AddScoped<ITaxPluginManager, NullTaxPluginManager>();
builder.Services.AddScoped<IAuthenticationPluginManager, NullAuthenticationPluginManager>();
// ===========================================
// === NOP.WEB COMMON FACTORIES (Nop.Web\Infrastructure\NopStartup.cs) ===
// ===========================================
builder.Services.AddScoped<IDiscountSupportedModelFactory, DiscountSupportedModelFactory>();
builder.Services.AddScoped<ILocalizedModelFactory, LocalizedModelFactory>();
builder.Services.AddScoped<IStoreMappingSupportedModelFactory, StoreMappingSupportedModelFactory>();
// ===========================================
// === NOP.WEB ADMIN MODEL FACTORIES (Nop.Web\Infrastructure\NopStartup.cs) ===
// ===========================================
builder.Services.AddScoped<IAclSupportedModelFactory, AclSupportedModelFactory>();
builder.Services.AddScoped<IBaseAdminModelFactory, BaseAdminModelFactory>();
builder.Services.AddScoped<IActivityLogModelFactory, ActivityLogModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IAddressModelFactory, Nop.Web.Areas.Admin.Factories.AddressModelFactory>();
builder.Services.AddScoped<IAddressAttributeModelFactory, AddressAttributeModelFactory>();
builder.Services.AddScoped<IAffiliateModelFactory, AffiliateModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IBlogModelFactory, Nop.Web.Areas.Admin.Factories.BlogModelFactory>();
builder.Services.AddScoped<ICampaignModelFactory, CampaignModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICategoryModelFactory, Nop.Web.Areas.Admin.Factories.CategoryModelFactory>();
builder.Services.AddScoped<ICheckoutAttributeModelFactory, CheckoutAttributeModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICommonModelFactory, Nop.Web.Areas.Admin.Factories.CommonModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICountryModelFactory, Nop.Web.Areas.Admin.Factories.CountryModelFactory>();
builder.Services.AddScoped<ICurrencyModelFactory, CurrencyModelFactory>();
builder.Services.AddScoped<ICustomerAttributeModelFactory, CustomerAttributeModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ICustomerModelFactory, Nop.Web.Areas.Admin.Factories.CustomerModelFactory>();
builder.Services.AddScoped<ICustomerRoleModelFactory, CustomerRoleModelFactory>();
builder.Services.AddScoped<IDiscountModelFactory, DiscountModelFactory>();
builder.Services.AddScoped<IEmailAccountModelFactory, EmailAccountModelFactory>();
builder.Services.AddScoped<IExternalAuthenticationMethodModelFactory, ExternalAuthenticationMethodModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IForumModelFactory, Nop.Web.Areas.Admin.Factories.ForumModelFactory>();
builder.Services.AddScoped<IGiftCardModelFactory, GiftCardModelFactory>();
builder.Services.AddScoped<IHomeModelFactory, HomeModelFactory>();
builder.Services.AddScoped<ILanguageModelFactory, LanguageModelFactory>();
builder.Services.AddScoped<ILogModelFactory, LogModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IManufacturerModelFactory, Nop.Web.Areas.Admin.Factories.ManufacturerModelFactory>();
builder.Services.AddScoped<IMeasureModelFactory, MeasureModelFactory>();
builder.Services.AddScoped<IMessageTemplateModelFactory, MessageTemplateModelFactory>();
builder.Services.AddScoped<IMultiFactorAuthenticationMethodModelFactory, MultiFactorAuthenticationMethodModelFactory>();
builder.Services.AddScoped<INewsletterSubscriptionModelFactory, NewsletterSubscriptionModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.INewsModelFactory, Nop.Web.Areas.Admin.Factories.NewsModelFactory>();
// IOrderModelFactory - FruitBank CustomOrderModelFactory felülírja!
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IOrderModelFactory, CustomOrderModelFactory>();
builder.Services.AddScoped<IPaymentModelFactory, PaymentModelFactory>();
builder.Services.AddScoped<IPluginModelFactory, PluginModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IPollModelFactory, Nop.Web.Areas.Admin.Factories.PollModelFactory>();
// IProductModelFactory - FruitBank CustomProductModelFactory felülírja!
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IProductModelFactory, CustomProductModelFactory>();
builder.Services.AddScoped<IProductAttributeModelFactory, ProductAttributeModelFactory>();
builder.Services.AddScoped<IProductReviewModelFactory, ProductReviewModelFactory>();
builder.Services.AddScoped<IReportModelFactory, ReportModelFactory>();
builder.Services.AddScoped<IQueuedEmailModelFactory, QueuedEmailModelFactory>();
builder.Services.AddScoped<IRecurringPaymentModelFactory, RecurringPaymentModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IReturnRequestModelFactory, Nop.Web.Areas.Admin.Factories.ReturnRequestModelFactory>();
builder.Services.AddScoped<IReviewTypeModelFactory, ReviewTypeModelFactory>();
builder.Services.AddScoped<IScheduleTaskModelFactory, ScheduleTaskModelFactory>();
builder.Services.AddScoped<ISecurityModelFactory, SecurityModelFactory>();
builder.Services.AddScoped<ISettingModelFactory, SettingModelFactory>();
builder.Services.AddScoped<IShippingModelFactory, ShippingModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IShoppingCartModelFactory, Nop.Web.Areas.Admin.Factories.ShoppingCartModelFactory>();
builder.Services.AddScoped<ISpecificationAttributeModelFactory, SpecificationAttributeModelFactory>();
builder.Services.AddScoped<IStoreModelFactory, StoreModelFactory>();
builder.Services.AddScoped<ITaxModelFactory, TaxModelFactory>();
builder.Services.AddScoped<ITemplateModelFactory, TemplateModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.ITopicModelFactory, Nop.Web.Areas.Admin.Factories.TopicModelFactory>();
builder.Services.AddScoped<IVendorAttributeModelFactory, VendorAttributeModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IVendorModelFactory, Nop.Web.Areas.Admin.Factories.VendorModelFactory>();
builder.Services.AddScoped<Nop.Web.Areas.Admin.Factories.IWidgetModelFactory, Nop.Web.Areas.Admin.Factories.WidgetModelFactory>();
// ===========================================
// === NOP.WEB PUBLIC FACTORIES (Nop.Web\Infrastructure\NopStartup.cs) ===
// ===========================================
builder.Services.AddScoped<Nop.Web.Factories.IAddressModelFactory, Nop.Web.Factories.AddressModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IBlogModelFactory, Nop.Web.Factories.BlogModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ICatalogModelFactory, Nop.Web.Factories.CatalogModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ICheckoutModelFactory, Nop.Web.Factories.CheckoutModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ICommonModelFactory, Nop.Web.Factories.CommonModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ICountryModelFactory, Nop.Web.Factories.CountryModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ICustomerModelFactory, Nop.Web.Factories.CustomerModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IForumModelFactory, Nop.Web.Factories.ForumModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IExternalAuthenticationModelFactory, Nop.Web.Factories.ExternalAuthenticationModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IJsonLdModelFactory, Nop.Web.Factories.JsonLdModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.INewsModelFactory, Nop.Web.Factories.NewsModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.INewsletterModelFactory, Nop.Web.Factories.NewsletterModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IOrderModelFactory, Nop.Web.Factories.OrderModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IPollModelFactory, Nop.Web.Factories.PollModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IPrivateMessagesModelFactory, Nop.Web.Factories.PrivateMessagesModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IProductModelFactory, Nop.Web.Factories.ProductModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IProfileModelFactory, Nop.Web.Factories.ProfileModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IReturnRequestModelFactory, Nop.Web.Factories.ReturnRequestModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IShoppingCartModelFactory, Nop.Web.Factories.ShoppingCartModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ISitemapModelFactory, Nop.Web.Factories.SitemapModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.ITopicModelFactory, Nop.Web.Factories.TopicModelFactory>();
builder.Services.AddScoped<Nop.Web.Factories.IVendorModelFactory, Nop.Web.Factories.VendorModelFactory>();
// ===========================================
// === NOP.WEB HELPERS ===
// ===========================================
builder.Services.AddScoped<ITinyMceHelper, TinyMceHelper>();
// ===========================================
// === FRUITBANK PLUGIN SZOLGÁLTATÁSOK (PluginNopStartup-ból) ===
// ===========================================;
// Logger
builder.Services.AddScoped<IAcLogWriterBase, ConsoleLogWriter>();
builder.Services.AddTransient<INopLoggerMsSqlNopDataProvider, NopLoggerMsSqlNopDataProvider>();
builder.Services.AddScoped<IAcLogWriterBase, NopLogWriter>();
builder.Services.AddSingleton<LoggerToLoggerApiController>();
// Core
builder.Services.AddSingleton<ILockService, LockService>();
builder.Services.AddScoped<FruitBankAttributeService>();
// Event Consumer
builder.Services.AddScoped<IConsumer<OrderPlacedEvent>, EventConsumer>();
// Business Services
builder.Services.AddScoped<IOrderMeasurementService, OrderMeasurementService>();
builder.Services.AddScoped<MeasurementService>();
builder.Services.AddScoped<InnVoiceApiService>();
builder.Services.AddScoped<InnVoiceOrderService>();
builder.Services.AddScoped<CerebrasAPIService>();
builder.Services.AddScoped<OpenAIApiService>();
builder.Services.AddScoped<AICalculationService>();
builder.Services.AddScoped<PdfToImageService>();
// ReplicateService with HttpClient
builder.Services.AddScoped<ReplicateService>();
builder.Services.AddHttpClient<ReplicateService>(client =>
{
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "r8_MUApXYIE5mRjxqy20tsGLehWBJkCzNj0Cwvrh");
});
// DbTable Services
builder.Services.AddScoped<ProductDtoDbTable>();
builder.Services.AddScoped<OrderDtoDbTable>();
builder.Services.AddScoped<OrderItemDtoDbTable>();
builder.Services.AddScoped<OrderItemPalletDbTable>();
builder.Services.AddScoped<PartnerDbTable>();
builder.Services.AddScoped<ShippingDbTable>();
builder.Services.AddScoped<ShippingDocumentDbTable>();
builder.Services.AddScoped<ShippingItemDbTable>();
builder.Services.AddScoped<ShippingItemPalletDbTable>();
builder.Services.AddScoped<FilesDbTable>();
builder.Services.AddScoped<ShippingDocumentToFilesDbTable>();
builder.Services.AddScoped<StockQuantityHistoryDtoDbTable>();
builder.Services.AddScoped<StockTakingDbTable>();
builder.Services.AddScoped<StockTakingItemDbTable>();
builder.Services.AddScoped<StockTakingItemPalletDbTable>();
// DbContext Services
builder.Services.AddScoped<StockTakingDbContext>();
builder.Services.AddScoped<FruitBankDbContext>();
// SignalR Services
builder.Services.AddScoped<SignalRSendToClientService>();
builder.Services.AddScoped<IFruitBankDataControllerServer, FruitBankDataController>();
builder.Services.AddScoped<ICustomOrderSignalREndpointServer, CustomOrderSignalREndpoint>();
builder.Services.AddScoped<IStockSignalREndpointServer, StockSignalREndpointServer>();
// ===========================================
// === SIGNALR KONFIGURÁCIÓ ===
// ===========================================
builder.Services.AddSignalR(hubOptions =>
{
hubOptions.EnableDetailedErrors = true;
hubOptions.MaximumReceiveMessageSize = 30_000_000;
hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignalRKeepAliveIntervalSecond);
hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignarlRTimeoutIntervalSecond);
hubOptions.StatefulReconnectBufferSize = 30_000_000;
});
// ===========================================
// === APP BUILD ===
// ===========================================
var app = builder.Build();
app.UseCors("SignalR");
app.UseSession();
var fruitBankHubEndPoint = $"/{FruitBankConstClient.DefaultHubName}";
app.MapHub<DevAdminSignalRHub>(fruitBankHubEndPoint, options =>
{
options.Transports = HttpTransportType.WebSockets;
options.WebSockets.CloseTimeout = TimeSpan.FromSeconds(10);
options.AllowStatefulReconnects = true;
options.TransportMaxBufferSize = 30_000_000;
options.ApplicationMaxBufferSize = 30_000_000;
options.TransportSendTimeout = TimeSpan.FromSeconds(60);
});
var loggerHubEndPoint = $"/{FruitBankConstClient.LoggerHubName}";
app.MapHub<LoggerSignalRHub>(loggerHubEndPoint, options =>
{
options.AllowStatefulReconnects = false;
});
app.MapGet("/", () => "SANDBOX is running!");
app.MapGet("/health", () => Results.Ok(new { status = "healthy", timestamp = DateTime.UtcNow }));
// ===========================================
// === CONSOLE OUTPUT ===
// ===========================================
var finalConnectionString = app.Configuration.GetConnectionString("ConnectionString") ?? "";
var databaseName = "Unknown";
if (!string.IsNullOrEmpty(finalConnectionString))
{
var match = System.Text.RegularExpressions.Regex.Match(finalConnectionString, @"Initial Catalog=([^;]+)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
if (match.Success)
{
databaseName = match.Groups[1].Value;
}
}
Console.Title = $"[SB] - {databaseName}";
Console.WriteLine("===========================================");
Console.WriteLine($" FRUITBANK SANDBOX - {databaseName}");
Console.WriteLine("===========================================");
Console.WriteLine($" Database: {databaseName}");
Console.WriteLine($" Base URL: http://localhost:59579");
Console.WriteLine($" SignalR Hub: {fruitBankHubEndPoint}");
Console.WriteLine($" Logger Hub: {loggerHubEndPoint}");
Console.WriteLine("===========================================");
app.Run();

View File

@ -0,0 +1,30 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Authentication.External;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
public class NullAuthenticationPluginManager : IAuthenticationPluginManager
{
public Task<IExternalAuthenticationMethod?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IExternalAuthenticationMethod?>(null);
public Task<IList<IExternalAuthenticationMethod>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IExternalAuthenticationMethod>>(new List<IExternalAuthenticationMethod>());
public Task<IList<IExternalAuthenticationMethod>> LoadActivePluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IExternalAuthenticationMethod>>(new List<IExternalAuthenticationMethod>());
public Task<IList<IExternalAuthenticationMethod>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IExternalAuthenticationMethod>>(new List<IExternalAuthenticationMethod>());
public bool IsPluginActive(IExternalAuthenticationMethod plugin, List<string> systemNames) => false;
public bool IsPluginActive(IExternalAuthenticationMethod plugin) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(IExternalAuthenticationMethod plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,26 @@
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Discounts;
using Nop.Services.Discounts;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
/// <summary>
/// Null implementation of IDiscountPluginManager for SANDBOX
/// </summary>
public class NullDiscountPluginManager : IDiscountPluginManager
{
public Task<IDiscountRequirementRule?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IDiscountRequirementRule?>(null);
public Task<IList<IDiscountRequirementRule>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IDiscountRequirementRule>>(new List<IDiscountRequirementRule>());
public Task<IList<IDiscountRequirementRule>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IDiscountRequirementRule>>(new List<IDiscountRequirementRule>());
public bool IsPluginActive(IDiscountRequirementRule plugin, List<string> systemNames) => false;
public Task<string> GetPluginLogoUrlAsync(IDiscountRequirementRule plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,31 @@
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Directory;
using Nop.Services.Directory;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
/// <summary>
/// Null implementation of IExchangeRatePluginManager for SANDBOX
/// </summary>
public class NullExchangeRatePluginManager : IExchangeRatePluginManager
{
public Task<IExchangeRateProvider?> LoadPrimaryPluginAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IExchangeRateProvider?>(null);
public bool IsPluginActive(IExchangeRateProvider exchangeRateProvider) => false;
public Task<IExchangeRateProvider?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IExchangeRateProvider?>(null);
public Task<IList<IExchangeRateProvider>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IExchangeRateProvider>>(new List<IExchangeRateProvider>());
public bool IsPluginActive(IExchangeRateProvider plugin, List<string> systemNames) => false;
public Task<IList<IExchangeRateProvider>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IExchangeRateProvider>>(new List<IExchangeRateProvider>());
public Task<string> GetPluginLogoUrlAsync(IExchangeRateProvider plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Mvc;
using Nop.Core.Domain.Customers;
using Nop.Services.Authentication.External;
namespace Mango.Sandbox.EndPoints.Services;
/// <summary>
/// Null implementation of IExternalAuthenticationService for SANDBOX
/// </summary>
public class NullExternalAuthenticationService : IExternalAuthenticationService
{
public Task<IActionResult> AuthenticateAsync(ExternalAuthenticationParameters parameters, string returnUrl = null!)
=> Task.FromResult<IActionResult>(new NotFoundResult());
public Task<ExternalAuthenticationRecord?> GetExternalAuthenticationRecordByIdAsync(int externalAuthenticationRecordId)
=> Task.FromResult<ExternalAuthenticationRecord?>(null);
public Task<IList<ExternalAuthenticationRecord>> GetCustomerExternalAuthenticationRecordsAsync(Customer customer)
=> Task.FromResult<IList<ExternalAuthenticationRecord>>(new List<ExternalAuthenticationRecord>());
public Task DeleteExternalAuthenticationRecordAsync(ExternalAuthenticationRecord externalAuthenticationRecord)
=> Task.CompletedTask;
public Task<ExternalAuthenticationRecord?> GetExternalAuthenticationRecordByExternalAuthenticationParametersAsync(ExternalAuthenticationParameters parameters)
=> Task.FromResult<ExternalAuthenticationRecord?>(null);
public Task AssociateExternalAccountWithUserAsync(Customer customer, ExternalAuthenticationParameters parameters)
=> Task.CompletedTask;
public Task<Customer?> GetUserByExternalAuthenticationParametersAsync(ExternalAuthenticationParameters parameters)
=> Task.FromResult<Customer?>(null);
public Task RemoveAssociationAsync(ExternalAuthenticationParameters parameters)
=> Task.CompletedTask;
}

View File

@ -0,0 +1,36 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Authentication.MultiFactor;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
/// <summary>
/// Null implementation of IMultiFactorAuthenticationPluginManager for SANDBOX
/// </summary>
public class NullMultiFactorAuthenticationPluginManager : IMultiFactorAuthenticationPluginManager
{
public Task<IMultiFactorAuthenticationMethod?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IMultiFactorAuthenticationMethod?>(null);
public Task<IList<IMultiFactorAuthenticationMethod>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IMultiFactorAuthenticationMethod>>(new List<IMultiFactorAuthenticationMethod>());
public Task<IList<IMultiFactorAuthenticationMethod>> LoadActivePluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IMultiFactorAuthenticationMethod>>(new List<IMultiFactorAuthenticationMethod>());
public Task<IList<IMultiFactorAuthenticationMethod>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IMultiFactorAuthenticationMethod>>(new List<IMultiFactorAuthenticationMethod>());
public Task<bool> HasActivePluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public bool IsPluginActive(IMultiFactorAuthenticationMethod plugin) => false;
public bool IsPluginActive(IMultiFactorAuthenticationMethod plugin, List<string> systemNames) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(IMultiFactorAuthenticationMethod plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,36 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Payments;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
public class NullPaymentPluginManager : IPaymentPluginManager
{
public Task<IPaymentMethod?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IPaymentMethod?>(null);
public Task<IList<IPaymentMethod>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IPaymentMethod>>(new List<IPaymentMethod>());
public Task<IList<IPaymentMethod>> LoadActivePluginsAsync(Customer? customer = null, int storeId = 0, int filterByCountryId = 0)
=> Task.FromResult<IList<IPaymentMethod>>(new List<IPaymentMethod>());
public Task<IList<IPaymentMethod>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IPaymentMethod>>(new List<IPaymentMethod>());
public bool IsPluginActive(IPaymentMethod plugin, List<string> systemNames) => false;
public bool IsPluginActive(IPaymentMethod plugin) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(IPaymentMethod plugin)
=> Task.FromResult(string.Empty);
public Task<IList<int>> GetRestrictedCountryIdsAsync(IPaymentMethod paymentMethod)
=> Task.FromResult<IList<int>>(new List<int>());
public Task SaveRestrictedCountriesAsync(IPaymentMethod paymentMethod, IList<int> countryIds)
=> Task.CompletedTask;
}

View File

@ -0,0 +1,30 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Plugins;
using Nop.Services.Shipping.Pickup;
namespace Mango.Sandbox.EndPoints.Services;
public class NullPickupPluginManager : IPickupPluginManager
{
public Task<IPickupPointProvider?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IPickupPointProvider?>(null);
public Task<IList<IPickupPointProvider>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IPickupPointProvider>>(new List<IPickupPointProvider>());
public Task<IList<IPickupPointProvider>> LoadActivePluginsAsync(Customer? customer = null, int storeId = 0, string filterByCountryId = null!)
=> Task.FromResult<IList<IPickupPointProvider>>(new List<IPickupPointProvider>());
public Task<IList<IPickupPointProvider>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IPickupPointProvider>>(new List<IPickupPointProvider>());
public bool IsPluginActive(IPickupPointProvider plugin, List<string> systemNames) => false;
public bool IsPluginActive(IPickupPointProvider plugin) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(IPickupPointProvider plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,33 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Catalog;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
/// <summary>
/// Null implementation of ISearchPluginManager for SANDBOX
/// </summary>
public class NullSearchPluginManager : ISearchPluginManager
{
public Task<ISearchProvider?> LoadPrimaryPluginAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<ISearchProvider?>(null);
public bool IsPluginActive(ISearchProvider searchProvider) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<ISearchProvider?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<ISearchProvider?>(null);
public Task<IList<ISearchProvider>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<ISearchProvider>>(new List<ISearchProvider>());
public bool IsPluginActive(ISearchProvider plugin, List<string> systemNames) => false;
public Task<IList<ISearchProvider>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<ISearchProvider>>(new List<ISearchProvider>());
public Task<string> GetPluginLogoUrlAsync(ISearchProvider plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,36 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Plugins;
using Nop.Services.Shipping;
namespace Mango.Sandbox.EndPoints.Services;
public class NullShippingPluginManager : IShippingPluginManager
{
public Task<IShippingRateComputationMethod?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IShippingRateComputationMethod?>(null);
public Task<IList<IShippingRateComputationMethod>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IShippingRateComputationMethod>>(new List<IShippingRateComputationMethod>());
public Task<IList<IShippingRateComputationMethod>> LoadActivePluginsAsync(Customer? customer = null, int storeId = 0, string filterByCountryId = null!)
=> Task.FromResult<IList<IShippingRateComputationMethod>>(new List<IShippingRateComputationMethod>());
public Task<IList<IShippingRateComputationMethod>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IShippingRateComputationMethod>>(new List<IShippingRateComputationMethod>());
public bool IsPluginActive(IShippingRateComputationMethod plugin, List<string> systemNames) => false;
public bool IsPluginActive(IShippingRateComputationMethod plugin) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(IShippingRateComputationMethod plugin)
=> Task.FromResult(string.Empty);
public Task<IList<int>> GetRestrictedCountryIdsAsync(IShippingRateComputationMethod shippingMethod)
=> Task.FromResult<IList<int>>(new List<int>());
public Task SaveRestrictedCountriesAsync(IShippingRateComputationMethod shippingMethod, IList<int> countryIds)
=> Task.CompletedTask;
}

View File

@ -0,0 +1,30 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Plugins;
using Nop.Services.Tax;
namespace Mango.Sandbox.EndPoints.Services;
public class NullTaxPluginManager : ITaxPluginManager
{
public Task<ITaxProvider?> LoadPrimaryPluginAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<ITaxProvider?>(null);
public Task<ITaxProvider?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<ITaxProvider?>(null);
public Task<IList<ITaxProvider>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<ITaxProvider>>(new List<ITaxProvider>());
public Task<IList<ITaxProvider>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<ITaxProvider>>(new List<ITaxProvider>());
public bool IsPluginActive(ITaxProvider plugin, List<string> systemNames) => false;
public bool IsPluginActive(ITaxProvider plugin) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(ITaxProvider plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,30 @@
using Nop.Core.Domain.Customers;
using Nop.Services.Cms;
using Nop.Services.Plugins;
namespace Mango.Sandbox.EndPoints.Services;
public class NullWidgetPluginManager : IWidgetPluginManager
{
public Task<IList<IWidgetPlugin>> LoadActivePluginsAsync(Customer? customer = null, int storeId = 0, string widgetZone = null!)
=> Task.FromResult<IList<IWidgetPlugin>>(new List<IWidgetPlugin>());
public Task<IWidgetPlugin?> LoadPluginBySystemNameAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IWidgetPlugin?>(null);
public Task<IList<IWidgetPlugin>> LoadAllPluginsAsync(Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IWidgetPlugin>>(new List<IWidgetPlugin>());
public Task<IList<IWidgetPlugin>> LoadActivePluginsAsync(List<string> systemNames, Customer? customer = null, int storeId = 0)
=> Task.FromResult<IList<IWidgetPlugin>>(new List<IWidgetPlugin>());
public bool IsPluginActive(IWidgetPlugin plugin, List<string> systemNames) => false;
public bool IsPluginActive(IWidgetPlugin plugin) => false;
public Task<bool> IsPluginActiveAsync(string systemName, Customer? customer = null, int storeId = 0)
=> Task.FromResult(false);
public Task<string> GetPluginLogoUrlAsync(IWidgetPlugin plugin)
=> Task.FromResult(string.Empty);
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,13 @@
{
"ConnectionStrings": {
"ConnectionString": "Data Source=195.26.231.218;Initial Catalog=FruitBank_DEV;Integrated Security=False;Persist Security Info=False;User ID=sa;Password=v6f_?xNfg9N1;Trust Server Certificate=True"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.SignalR": "Debug"
}
},
"AllowedHosts": "*"
}

View File

@ -0,0 +1,81 @@
# SANDBOX Tesztelõ Script
# Futtatás: .\test-sandbox.ps1
$ErrorActionPreference = "Continue"
$projectPath = $PSScriptRoot
$url = "http://localhost:59579"
Write-Host "=== SANDBOX TESZTELÕ ===" -ForegroundColor Cyan
# 1. Build
Write-Host "`n[1/5] Building..." -ForegroundColor Yellow
$buildResult = dotnet build $projectPath --verbosity quiet 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "BUILD FAILED!" -ForegroundColor Red
$buildResult | Where-Object { $_ -match "error" } | ForEach-Object { Write-Host $_ -ForegroundColor Red }
exit 1
}
Write-Host "Build OK" -ForegroundColor Green
# 2. Ellenõrizzük, fut-e már
$existingProcess = Get-Process -Name "Mango.Sandbox.EndPoints" -ErrorAction SilentlyContinue
if ($existingProcess) {
Write-Host "`n[2/5] Stopping existing SANDBOX..." -ForegroundColor Yellow
Stop-Process -Name "Mango.Sandbox.EndPoints" -Force
Start-Sleep -Seconds 2
}
# 3. Indítás háttérben
Write-Host "`n[3/5] Starting SANDBOX..." -ForegroundColor Yellow
$process = Start-Process -FilePath "dotnet" -ArgumentList "run", "--project", $projectPath, "--urls", $url -PassThru -RedirectStandardOutput "$projectPath\sandbox-stdout.log" -RedirectStandardError "$projectPath\sandbox-stderr.log"
Start-Sleep -Seconds 10
# 4. Health check
Write-Host "`n[4/5] Testing endpoints..." -ForegroundColor Yellow
try {
$response = Invoke-WebRequest -Uri "$url/" -UseBasicParsing -TimeoutSec 5
if ($response.StatusCode -eq 200) {
Write-Host " / endpoint: OK" -ForegroundColor Green
}
} catch {
Write-Host " / endpoint: FAILED - $_" -ForegroundColor Red
}
try {
$response = Invoke-WebRequest -Uri "$url/health" -UseBasicParsing -TimeoutSec 5
if ($response.StatusCode -eq 200) {
Write-Host " /health endpoint: OK" -ForegroundColor Green
}
} catch {
Write-Host " /health endpoint: FAILED - $_" -ForegroundColor Red
}
# SignalR negotiate teszt
try {
$response = Invoke-WebRequest -Uri "$url/fbHub/negotiate?negotiateVersion=1" -Method POST -UseBasicParsing -TimeoutSec 5
Write-Host " SignalR negotiate: OK" -ForegroundColor Green
} catch {
Write-Host " SignalR negotiate: FAILED - $_" -ForegroundColor Red
}
# 5. SignalR Hub hívás teszt (GetMeasuringUsers - tag 70)
Write-Host "`n[5/5] Testing SignalR Hub method..." -ForegroundColor Yellow
Write-Host " GetMeasuringUsers (tag 70) - Check SANDBOX console for logs" -ForegroundColor Gray
# Hibák kiírása
Write-Host "`n=== STDERR LOG (last 50 lines) ===" -ForegroundColor Cyan
if (Test-Path "$projectPath\sandbox-stderr.log") {
Get-Content "$projectPath\sandbox-stderr.log" -Tail 50 | ForEach-Object {
if ($_ -match "error|fail|exception") {
Write-Host $_ -ForegroundColor Red
} elseif ($_ -match "warn") {
Write-Host $_ -ForegroundColor Yellow
} else {
Write-Host $_ -ForegroundColor Gray
}
}
}
Write-Host "`n=== SANDBOX PID: $($process.Id) ===" -ForegroundColor Cyan
Write-Host "Leállítás: Stop-Process -Id $($process.Id)" -ForegroundColor Gray

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,48 @@
// SignalR Test Client - teszteli a SANDBOX kapcsolatot
using Microsoft.AspNetCore.SignalR.Client;
using System.Text.Json;
Console.WriteLine("=== SANDBOX SignalR Test Client ===");
var hubUrl = "http://localhost:59579/fbHub";
Console.WriteLine($"Connecting to: {hubUrl}");
var connection = new HubConnectionBuilder()
.WithUrl(hubUrl)
.WithAutomaticReconnect()
.Build();
connection.On<int, byte[]>("ReceiveMessage", (tag, data) =>
{
Console.WriteLine($"Received message - Tag: {tag}, Data length: {data?.Length ?? 0}");
});
try
{
await connection.StartAsync();
Console.WriteLine($"Connected! State: {connection.State}");
// Teszt: GetMeasuringUsers (tag 70) hívása
Console.WriteLine("\nTesting GetMeasuringUsers (tag 70)...");
// A SignalR metódus hívása - a szerver "ReceiveMessage" metódusát hívjuk
// MessagePack formátumban küldjük az adatot
var requestData = new { Tag = 70, Data = Array.Empty<byte>() };
await connection.InvokeAsync("ReceiveMessage", 70, Array.Empty<byte>());
Console.WriteLine("Message sent! Waiting for response...");
await Task.Delay(3000);
Console.WriteLine("\nTest completed!");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Stack: {ex.StackTrace}");
}
finally
{
await connection.StopAsync();
Console.WriteLine("Disconnected.");
}