php-commerce/Notifications/SubscriptionPaused.php
Snider df167eb423
Some checks failed
CI / PHP 8.3 (pull_request) Failing after 3s
CI / PHP 8.4 (pull_request) Failing after 3s
fix(dx): add declare(strict_types=1) and fix PSR-12 compliance
Added missing strict_types declarations to 65 PHP files and ran
Laravel Pint to fix PSR-12 violations (ordered imports, unary
operator spacing, brace positioning, fully qualified strict types).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 09:08:03 +00:00

50 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace Core\Mod\Commerce\Notifications;
use Core\Mod\Commerce\Models\Subscription;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class SubscriptionPaused extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public Subscription $subscription
) {}
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$suspendDays = config('commerce.dunning.suspend_after_days', 14);
return (new MailMessage)
->subject('Subscription paused - payment required')
->greeting('Your subscription has been paused')
->line('We were unable to process your payment after multiple attempts. Your subscription has been paused to prevent further charge attempts.')
->line('Your account is still accessible, but some features may be limited.')
->line('To resume your subscription, please update your payment method and pay the outstanding balance.')
->line("If payment is not received within {$suspendDays} days, your account will be suspended.")
->action('Update Payment Method', route('hub.billing.payment-methods'))
->line('Need help? Our support team is here to assist you.')
->salutation('Host UK');
}
public function toArray(object $notifiable): array
{
return [
'subscription_id' => $this->subscription->id,
'workspace_id' => $this->subscription->workspace_id,
'paused_at' => now()->toISOString(),
];
}
}