Refactor billing configuration management to centralize expiration handling
- Updated `BillingConfigResumer` to manage billing expiration entirely on the application side, using `enable` as the sole control mechanism for client access. - Changed all relevant methods to pass `DateTimeOffset.UnixEpoch` for `expiresAt`, ensuring the panel does not enforce expiration independently of our application logic. - Modified `IXuiPanelGateway` interface to reflect the new expiration handling approach, clarifying the role of `expiresAt` in client management. - Adjusted command handlers for creating and rotating VPN configurations to set `expiresAt` to `null`, preventing unintended expiration enforcement by the panel. - Enhanced documentation to explain the new billing expiration management strategy and its implications for client configurations.
This commit is contained in:
+3
-2
@@ -127,7 +127,8 @@ public class MarkPaymentSentCommandHandlerTests
|
||||
.Handle(new MarkPaymentSentCommand(request.Id), CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
// enable:true + expiresAt в будущем — держим клиента рабочим на панели, пока заявка на проверке.
|
||||
// enable:true — держим клиента рабочим на панели, пока заявка на проверке; expiresAt всегда
|
||||
// сбрасывается в "без срока" (см. BillingConfigResumer.NoExpiry), истечение — только локально.
|
||||
await _gateway
|
||||
.Received(1)
|
||||
.UpdateClientAsync(
|
||||
@@ -137,7 +138,7 @@ public class MarkPaymentSentCommandHandlerTests
|
||||
VpnProtocol.Vless,
|
||||
Arg.Any<string>(),
|
||||
true,
|
||||
Arg.Is<DateTimeOffset?>(d => d > DateTimeOffset.UtcNow),
|
||||
Arg.Is<DateTimeOffset?>(d => d == DateTimeOffset.UnixEpoch),
|
||||
Arg.Any<CancellationToken>()
|
||||
);
|
||||
await _notifier.Received(1).NotifyBillingStatusChangedAsync(userId, Arg.Any<CancellationToken>());
|
||||
|
||||
Reference in New Issue
Block a user