feat: add resource quotas, PayPal subscriptions and paid disk allowances

Calculate and enforce configurable resource consumption, expose balances in PostIt and document the rule in CGU. Add confirmed monthly PayPal credits and disk quotas of twice the free default for Discovery and five times for Premium, with payment reconciliation, migrations and regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-11-08 05:02:23 +00:00
commit 650e5f5e30
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
69 changed files with 19111 additions and 203 deletions

View file

@ -0,0 +1,30 @@
using System.Net;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Yavsc.Settings;
using Xunit;
namespace Yavsc.Org.Tests.Controllers;
public sealed class ResourceUsageTermsTests
{
[Fact]
public async Task Public_terms_describe_the_configured_rule_and_are_linked_from_the_footer()
{
using var factory = new TestWebApplicationFactory();
var options = factory.Services.GetRequiredService<IOptions<ResourceUsageOptions>>().Value;
options.DefaultLimit = 12345m;
using var client = factory.CreateClient();
using var response = await client.GetAsync("/Home/CGU", TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var html = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
Assert.Contains("12345", html);
Assert.Contains("resource_quota_exceeded", html);
Assert.Contains("I =", html);
Assert.Contains("Home/CGU", html);
Assert.Contains((Yavsc.Constants.DefaultFSQ * 5L).ToString(), html);
Assert.Contains((Yavsc.Constants.DefaultFSQ * 2L).ToString(), html);
Assert.Contains("quota disque", html);
Assert.Contains("Découverte porte le quota disque", html);
}
}