Add Queue Pro billing, renewal, and scheduler.
Deploy Ladill Queue / deploy (push) Successful in 42s

Organizations can upgrade from wallet with plan expiry enforcement and nightly qms:pro-renew charges.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-30 01:07:24 +00:00
co-authored by Cursor
parent 1d50f10c3f
commit 0770faaa9f
11 changed files with 411 additions and 5 deletions
+24 -4
View File
@@ -3,27 +3,42 @@
namespace App\Services\Qms;
use App\Models\Organization;
use Carbon\Carbon;
class PlanService
{
public function planKey(Organization $organization): string
{
$settings = $organization->settings ?? [];
$plan = (string) ($settings['plan'] ?? 'free');
if ($plan === 'pro' && ! empty($settings['plan_expires_at'])) {
if (Carbon::parse($settings['plan_expires_at'])->isPast()) {
return 'free';
}
}
return array_key_exists($plan, config('qms.plans', [])) ? $plan : 'free';
}
public function plan(Organization $organization): string
{
return (string) data_get($organization->settings, 'plan', 'free');
return $this->planKey($organization);
}
public function isPro(Organization $organization): bool
{
return $this->plan($organization) === 'pro';
return $this->planKey($organization) === 'pro';
}
public function maxBranches(Organization $organization): ?int
{
return config('qms.plans.'.$this->plan($organization).'.max_branches');
return config('qms.plans.'.$this->planKey($organization).'.max_branches');
}
public function maxQueues(Organization $organization): ?int
{
return config('qms.plans.'.$this->plan($organization).'.max_queues');
return config('qms.plans.'.$this->planKey($organization).'.max_queues');
}
public function canAddBranch(Organization $organization, int $currentCount): bool
@@ -39,4 +54,9 @@ class PlanService
return $max === null || $currentCount < $max;
}
public function proPriceMinor(): int
{
return (int) config('qms.plans.pro.price_minor', 9900);
}
}