Files
ladill-merchant/app/Services/Billing/PlanEntitlementService.php
T
isaaccladandCursor 5166cd8a64
Deploy Ladill Merchant / deploy (push) Successful in 44s
Add optional owner gateway routing to Merchant.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 19:47:13 +00:00

28 lines
687 B
PHP

<?php
namespace App\Services\Billing;
use App\Models\User;
use Throwable;
class PlanEntitlementService
{
public const CUSTOM_PAYMENT_GATEWAY = 'custom_payment_gateway';
public function __construct(private readonly BillingClient $billing) {}
public function has(User $owner, string $feature): bool
{
try {
return in_array($feature, (array) ($this->billing->suiteEntitlement((string) $owner->public_id)['features'] ?? []), true);
} catch (Throwable) {
return false;
}
}
public function canUseCustomPaymentGateway(User $owner): bool
{
return $this->has($owner, self::CUSTOM_PAYMENT_GATEWAY);
}
}