Feat: Shipping functionalities redesign, elta courier integration, commenting out acs since no integration can happen, flow updates
This commit is contained in:
@@ -6,7 +6,12 @@ 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\Commands\CloseExpiredReturnWindows;
|
||||
use Modules\Core\Order\Events\OrderStatusUpdated;
|
||||
use Modules\Core\Order\Listeners\AdvanceFulfillmentOnCarrierCheckpoint;
|
||||
use Modules\Core\Order\Listeners\AdvanceFulfillmentOnDelivered;
|
||||
use Modules\Core\Order\Listeners\CompleteOrderOnPickedUp;
|
||||
use Modules\Core\Order\Services\OrderFulfillmentService;
|
||||
use Modules\Core\Order\Services\OrderStatusFlow;
|
||||
use Modules\Core\Order\Support\OrderReferenceDisplay;
|
||||
|
||||
@@ -25,12 +30,22 @@ class OrderStatusUpdatedNotification extends BaseNotification
|
||||
}
|
||||
|
||||
/**
|
||||
* 'ready-for-pickup' has its own, richer notification
|
||||
* (Modules\Core\Order\Notifications\OrderPickupReadyNotification) —
|
||||
* both listen to the same OrderStatusUpdated event via
|
||||
* NotificationRegistry, so without this the customer would get two
|
||||
* emails for that one transition. Returning no channels is the
|
||||
* standard Laravel way to suppress a notification outright.
|
||||
* Writes that send their own, richer email for the new status — the
|
||||
* generic one stays out of those, or the customer gets two. The same
|
||||
* status written any other way (staff's "Update Status", which fires
|
||||
* none of those events) still gets the generic email.
|
||||
*/
|
||||
private const OWN_EMAIL = [
|
||||
'ready_for_pickup' => [OrderFulfillmentService::class.'::markReady'], // OrderPickupReadyNotification
|
||||
'dispatched' => [AdvanceFulfillmentOnCarrierCheckpoint::class], // OrderDispatchedNotification
|
||||
'delivered' => [AdvanceFulfillmentOnDelivered::class], // OrderDeliveredNotification
|
||||
'completed' => [CompleteOrderOnPickedUp::class, CloseExpiredReturnWindows::class], // OrderCompletedNotification
|
||||
];
|
||||
|
||||
/**
|
||||
* Suppressed when a dedicated notification covers this write (see
|
||||
* OWN_EMAIL). Returning no channels is the standard Laravel way to
|
||||
* suppress a notification outright.
|
||||
*
|
||||
* Also suppressed for the order's very first transition off
|
||||
* 'awaiting_payment' — for every payment method except bank transfer,
|
||||
@@ -50,7 +65,7 @@ class OrderStatusUpdatedNotification extends BaseNotification
|
||||
*/
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
if ($this->event->newStatus === 'ready-for-pickup') {
|
||||
if (in_array($this->event->causeClass, self::OWN_EMAIL[$this->event->newStatus] ?? [], true)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user