Add getTrialUntil to BillingContract; Allow delete endpoints after blocking

This commit is contained in:
Constantin Graf
2024-09-05 13:53:36 +02:00
committed by Constantin Graf
parent 83301d03ca
commit 01dd13b947
5 changed files with 45 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ class HandleInertiaRequests extends Middleware
'billing' => $billing !== null && $currentOrganization !== null ? [
'has_subscription' => $billing->hasSubscription($currentOrganization),
'has_trial' => $billing->hasTrial($currentOrganization),
'trial_until' => $billing->getTrialUntil($currentOrganization)?->toIso8601ZuluString(),
'is_blocked' => $billing->isBlocked($currentOrganization),
] : null,
'flash' => [

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Service;
use App\Models\Organization;
use Illuminate\Support\Carbon;
/**
* This class is a contract for the billing system
@@ -33,6 +34,15 @@ class BillingContract
return false;
}
/**
* Get the date until which the organization's trial subscription is valid
* If the organization does not have a trial subscription, this method should return null
*/
public function getTrialUntil(Organization $organization): ?Carbon
{
return null;
}
/**
* Check if the organization is blocked
* A blocked organization is an organization that has more than 1 non-placeholder member but no subscription/trial