Feature: Order Updates, Events, Order Flows, Shipment And COD support
This commit is contained in:
@@ -6,19 +6,21 @@ use Illuminate\Notifications\AnonymousNotifiable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Support\Facades\Notification as NotificationFacade;
|
||||
use Modules\Core\Notification\BaseNotification;
|
||||
use Modules\Core\Order\Events\OrderStatusUpdated;
|
||||
use Modules\Core\Order\Events\OrderReadyForPickup;
|
||||
|
||||
/**
|
||||
* "Your order is ready to collect" — fires on the same OrderStatusUpdated
|
||||
* event Modules\Core\Order\Notifications\OrderStatusUpdatedNotification
|
||||
* listens to, but only for the 'ready-for-pickup' transition; that other
|
||||
* notification suppresses itself for this same transition (see its own
|
||||
* via()) so a customer gets this richer, pickup-specific email instead of
|
||||
* the generic "order updated" one, not both.
|
||||
* "Your order is ready to collect" — listens to the specific
|
||||
* OrderReadyForPickup event (dispatched by Modules\Core\Shipping\
|
||||
* Extensions\OrderViewExtension's "Mark Ready" action, store-pickup
|
||||
* branch only), not the generic OrderStatusUpdated. Modules\Core\Order\
|
||||
* Notifications\OrderStatusUpdatedNotification still separately
|
||||
* suppresses itself for the legacy 'ready-for-pickup' status string, kept
|
||||
* defensively even though nothing writes that literal value to
|
||||
* Order::status anymore after this redesign.
|
||||
*/
|
||||
class OrderPickupReadyNotification extends BaseNotification
|
||||
{
|
||||
public function __construct(private readonly OrderStatusUpdated $event) {}
|
||||
public function __construct(private readonly OrderReadyForPickup $event) {}
|
||||
|
||||
public static function getKey(): string
|
||||
{
|
||||
@@ -27,15 +29,11 @@ class OrderPickupReadyNotification extends BaseNotification
|
||||
|
||||
public static function listensTo(): string
|
||||
{
|
||||
return OrderStatusUpdated::class;
|
||||
return OrderReadyForPickup::class;
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
if ($this->event->newStatus !== 'ready-for-pickup') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user