diff --git a/src/Billing/License/Plan/Plan.php b/src/Billing/License/Plan/Plan.php index 46c017c..5efb46d 100644 --- a/src/Billing/License/Plan/Plan.php +++ b/src/Billing/License/Plan/Plan.php @@ -32,8 +32,10 @@ public function __construct( * Usually, if one plan has a group, all plans should have a group */ public ?string $group = null, + + // plan will only be available as an annual subscription + public bool $annualOnly = false, ) { $this->nameReadable = $nameReadable ?? ucfirst($this->name); } - } diff --git a/src/Billing/License/Plan/PlanAbstract.php b/src/Billing/License/Plan/PlanAbstract.php index ea796fb..4675d99 100644 --- a/src/Billing/License/Plan/PlanAbstract.php +++ b/src/Billing/License/Plan/PlanAbstract.php @@ -48,6 +48,7 @@ protected function plan( License $license, ?string $nameReadable = null, ?string $group = null, + bool $annualOnly = false, ): void { assert($this->currentVersionForConfig !== null); $plan = new Plan( @@ -57,6 +58,7 @@ protected function plan( $license, $nameReadable, $group, + $annualOnly, ); $currentVersionPlans = $this->versions[$this->currentVersionForConfig]; @@ -106,5 +108,4 @@ public function tryGetPlan(string $name, ?int $version = null): ?Plan $version ??= $this->getCurrentVersion(); return $this->versions[$version][$name] ?? null; } - } diff --git a/src/Billing/License/Plan/TalkPlan.php b/src/Billing/License/Plan/TalkPlan.php index 2b1cb32..009cfdf 100644 --- a/src/Billing/License/Plan/TalkPlan.php +++ b/src/Billing/License/Plan/TalkPlan.php @@ -35,6 +35,24 @@ protected function config(): void }); $this->version(2, function () { + $this->plan( + 'personal', + 5, + new TalkLicense( + credits: 2500, + comments: -1, + storage: 5 * 10 ** 9, + sso: false, + noBranding: false, + webhooks: false, + websites: 1, + moderators: 1, + rules: false, + ), + nameReadable: "Personal", + annualOnly: true, + ); + $this->premiumPlan(100_000, 12); $this->premiumPlan(500_000, 35); $this->premiumPlan(1_000_000, 65); @@ -59,6 +77,9 @@ private function premiumPlan(int $credits, float $monthlyPrice): void sso: false, noBranding: false, webhooks: false, + websites: 0, + moderators: 0, + rules: true, ); $nameSuffix = $credits / 1_000_000; @@ -84,6 +105,9 @@ private function businessPlan(int $credits, float $monthlyPrice): void sso: true, noBranding: true, webhooks: true, + websites: 0, + moderators: 0, + rules: true, ); $nameSuffix = $credits / 1_000_000; @@ -109,5 +133,4 @@ private function getStorageBytesFromCredits(int $credits): int $gbBytes = 10 ** 9; return $creditsMil * 100 * $gbBytes; } - } diff --git a/src/Billing/License/TalkLicense.php b/src/Billing/License/TalkLicense.php index b8f2a5c..c9943a6 100644 --- a/src/Billing/License/TalkLicense.php +++ b/src/Billing/License/TalkLicense.php @@ -14,8 +14,10 @@ public function __construct( public bool $sso, public bool $noBranding, public bool $webhooks, - ) { - } + public int $websites, // 0 for unlimited + public int $moderators, // 0 for unlimited + public bool $rules, + ) {} public static function properties(): array { @@ -46,6 +48,20 @@ public static function properties(): array LicenseProperty::bool('webhooks') ->name('Webhooks') ->description('Enable Webhooks to integrate with other services'), + + LicenseProperty::int('websites') + ->name('Websites') + ->description('Number of websites allowed under this license.') + ->note('Set to 0 for unlimited'), + + LicenseProperty::int('moderators') + ->name('Moderators') + ->description('Number of moderators allowed under this license.') + ->note('Set to 0 for unlimited'), + + LicenseProperty::bool('rules') + ->name('Rules') + ->description('Enable advanced moderation rules to automate your moderation process'), ]; } @@ -57,8 +73,10 @@ public static function trial(): static storage: 100_000_000, sso: true, noBranding: false, - webhooks: true + webhooks: true, + websites: 0, + moderators: 0, + rules: true, ); } - }