Deploy Ladill Frontdesk / deploy (push) Successful in 44s
Host alerts use email/phone on the host record without requiring a Ladill account link; SMS and over-quota emails debit the org wallet at platform rates. Co-authored-by: Cursor <cursoragent@cursor.com>
27 lines
771 B
PHP
27 lines
771 B
PHP
<?php
|
|
|
|
namespace App\Services\Frontdesk;
|
|
|
|
class NotificationPricingService
|
|
{
|
|
public function emailCostMinor(): int
|
|
{
|
|
return (int) round((float) config('frontdesk.billing.email_cost_ghs', 0.0135) * 100);
|
|
}
|
|
|
|
public function smsCostMinor(string $message): int
|
|
{
|
|
$segmentLength = max(1, (int) config('frontdesk.billing.sms_segment_length', 160));
|
|
$segments = max(1, (int) ceil(mb_strlen($message) / $segmentLength));
|
|
|
|
return (int) round($segments * (float) config('frontdesk.billing.sms_cost_per_segment_ghs', 0.05) * 100);
|
|
}
|
|
|
|
public function formatMinor(int $minor): string
|
|
{
|
|
$currency = (string) config('billing.currency', 'GHS');
|
|
|
|
return $currency.' '.number_format($minor / 100, 2);
|
|
}
|
|
}
|