added AdminBonusAddedNotification.php and InsufficientBalanceNotification.php

This commit is contained in:
Čarodej
2022-03-16 11:45:08 +01:00
parent bc197cbb5e
commit 1d1e6823c7
17 changed files with 128 additions and 31 deletions
@@ -0,0 +1,41 @@
<?php
namespace Domain\Subscriptions\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
class AdminBonusAddedNotification extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(
public string $bonus
) {
}
/**
* Get the notification's delivery channels.
*/
public function via(mixed $notifiable): array
{
return ['database', 'broadcast'];
}
/**
* Get the array representation of the notification.
*/
public function toArray(mixed $notifiable): array
{
return [
'category' => 'gift',
'title' => "You Received {$this->bonus}",
'description' => "You received credit bonus $this->bonus from us. Happy spending!",
];
}
}
@@ -29,7 +29,7 @@ class BillingAlertTriggeredNotification extends Notification implements ShouldQu
return [
'category' => 'billing-alert',
'title' => 'billing Alert Reached!',
'description' => "The billing alert you set previously has been reached. Please revise your spending.",
'description' => 'The billing alert you set previously has been reached. Please revise your spending.',
'action' => [
'type' => 'route',
'params' => [
@@ -0,0 +1,42 @@
<?php
namespace Domain\Subscriptions\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class InsufficientBalanceNotification extends Notification implements ShouldQueue
{
use Queueable;
public function via(): array
{
return ['mail', 'database', 'broadcast'];
}
public function toMail(): MailMessage
{
return (new MailMessage)
->subject(__('Uh-oh! Your credit withdrawal for your pre-paid subscription failed'))
->greeting(__('Hi there'))
->line(__("It looks like your subscription credit withdrawal for your account didn't go through. Please make sure you have sufficient funds on your account and we'll give it another try!"))
->action(__('Fund Your Account'), url('/user/settings/billing'));
}
public function toArray(): array
{
return [
'category' => 'insufficient-balance',
'title' => 'Withdrawal failed',
'description' => "Your credit withdrawal for your account didn't go through. Please make sure you have sufficient funds on your account.",
'action' => [
'type' => 'route',
'params' => [
'route' => 'Billing',
'button' => 'Show Billing',
],
],
];
}
}
@@ -13,7 +13,8 @@ class SubscriptionWasCreatedNotification extends Notification implements ShouldQ
public function __construct(
public Subscription $subscription,
) {}
) {
}
public function via(): array
{