Tighten Pro alert caps and move custom badges to Enterprise.
Deploy Ladill Frontdesk / deploy (push) Has been cancelled

Pro includes 5,000 email and 5,000 SMS host alerts per month with hard
monthly caps; Enterprise is unlimited. Custom badge templates are
Enterprise-only, and plan benefit copy matches the new limits.
This commit is contained in:
isaacclad
2026-07-16 08:37:06 +00:00
parent 4ce45f4989
commit b6f229ab9a
12 changed files with 298 additions and 29 deletions
@@ -29,6 +29,14 @@ class NotificationBillingService
public function emailCostMinor(Organization $organization): int
{
// Paid plan monthly cap exhausted — do not offer overage.
if ($this->plans->emailAllowanceExhausted(
$organization,
$this->usage->emailCountThisMonth($organization),
)) {
return 0;
}
if ($this->usesCustomerEmail($organization)) {
return 0;
}
@@ -41,8 +49,36 @@ class NotificationBillingService
return $this->pricing->emailCostMinor();
}
public function smsCostMinor(Organization $organization, string $message): int
{
if ($this->plans->smsAllowanceExhausted(
$organization,
$this->usage->smsCountThisMonth($organization),
)) {
return 0;
}
if ($this->usesCustomerSms($organization)) {
return 0;
}
$allowance = $this->plans->freeSmsPerMonth($organization);
if ($allowance === null || $this->usage->smsCountThisMonth($organization) < $allowance) {
return 0;
}
return $this->pricing->smsCostMinor($message);
}
public function canAffordEmail(Organization $organization): bool
{
if ($this->plans->emailAllowanceExhausted(
$organization,
$this->usage->emailCountThisMonth($organization),
)) {
return false;
}
if ($this->usesCustomerEmail($organization)) {
return true;
}
@@ -57,11 +93,18 @@ class NotificationBillingService
public function canAffordSms(Organization $organization, string $message): bool
{
if ($this->plans->smsAllowanceExhausted(
$organization,
$this->usage->smsCountThisMonth($organization),
)) {
return false;
}
if ($this->usesCustomerSms($organization)) {
return true;
}
$cost = $this->pricing->smsCostMinor($message);
$cost = $this->smsCostMinor($organization, $message);
if ($cost <= 0) {
return true;
}
@@ -75,6 +118,13 @@ class NotificationBillingService
*/
public function chargeEmail(Organization $organization, string $reference, string $description): bool
{
if ($this->plans->emailAllowanceExhausted(
$organization,
$this->usage->emailCountThisMonth($organization),
)) {
return false;
}
if ($this->usesCustomerEmail($organization)) {
$this->usage->recordEmail($organization, 0);
@@ -99,13 +149,20 @@ class NotificationBillingService
public function chargeSms(Organization $organization, string $message, string $reference, string $description): bool
{
if ($this->plans->smsAllowanceExhausted(
$organization,
$this->usage->smsCountThisMonth($organization),
)) {
return false;
}
if ($this->usesCustomerSms($organization)) {
$this->usage->recordSms($organization, 0);
return true;
}
$cost = $this->pricing->smsCostMinor($message);
$cost = $this->smsCostMinor($organization, $message);
if ($cost <= 0) {
$this->usage->recordSms($organization, 0);