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

@ -2,9 +2,7 @@ namespace Yavsc.Abstract.Resources;
/// <summary>
/// Lightweight usage snapshot for PostIt / Yavsc resource accounting.
/// The initial implementation is intentionally intentionally small and
/// serialisable so it can be exposed through the API and consumed by the
/// PostIt client without requiring a full database model yet.
/// Counters are cumulative; consumption is expressed in points, not currency.
/// </summary>
public sealed class ResourceUsageSummary
{
@ -17,6 +15,17 @@ public sealed class ResourceUsageSummary
public decimal BandwidthMb { get; set; }
public decimal StorageMb { get; set; }
public decimal Consumption { get; set; }
public decimal GrossConsumption { get; set; }
public decimal CreditBalance { get; set; }
public decimal AppliedCredits { get; set; }
public decimal ConsumptionLimit { get; set; }
public decimal RemainingConsumption { get; set; }
public bool IsQuotaReached { get; set; }
public long? DiskQuota { get; set; }
public DateTimeOffset? PremiumDiskQuotaUntil { get; set; }
public DateTimeOffset? DiscoveryDiskQuotaUntil { get; set; }
public decimal EstimatedCompensation { get; set; }
public string Currency { get; set; } = Constants.ResourceUsageDefaultCurrency;
}