security: hard-disable all KIS trading paths (AEG-X-016)

Blocks submit, status, cancel, and settlement before HTTP or database writes and removes the KIS polling recurring job. Evidence: concrete adapter test 1/1 passed with zero HTTP calls. WBS remains IN_PROGRESS pending endpoint/startup override evidence.
This commit is contained in:
2026-08-09 02:30:39 +09:00
parent ec80337389
commit eb59cae8e3
8 changed files with 113 additions and 3 deletions
@@ -0,0 +1,35 @@
using System.Net;
using KArtSell.Modules.ModelOperations.TradeExecution;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit;
namespace KArtSell.Integration.Tests.TradeExecution;
public sealed class KisTradingHardOffTests
{
[Fact]
public async Task Every_kis_trade_operation_fails_before_any_http_call()
{
var handler = new CountingHandler();
var service = new KisTradeExecutionService(new HttpClient(handler), NullLogger<KisTradeExecutionService>.Instance);
var correlationId = Guid.NewGuid();
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.ExecuteTradeAsync(Guid.NewGuid(), 1, 1m, correlationId));
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.GetOrderStatusAsync("order", correlationId));
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.CancelOrderAsync("order", "test", correlationId));
await Assert.ThrowsAsync<KisTradingDisabledException>(() => service.ConfirmSettlementAsync("order", correlationId));
Assert.Equal(0, handler.CallCount);
}
private sealed class CountingHandler : HttpMessageHandler
{
public int CallCount { get; private set; }
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
CallCount++;
return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK));
}
}
}