Feat: Updating OrderPlaced Listeners to Decrement Stock, Creating Notifications

This commit is contained in:
2026-09-10 01:34:30 +03:00
parent 864c8b19aa
commit 99e55902ac
5 changed files with 148 additions and 2 deletions
+5
View File
@@ -6,12 +6,15 @@ use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use Lunar\Models\Order;
use Lunar\Models\Transaction;
use Modules\Core\Checkout\Events\OrderPlaced;
use Modules\Core\Notification\NotificationRegistry;
use Modules\Core\Order\Listeners\ApplyResolvedPaymentStatus;
use Modules\Core\Order\Listeners\DecrementStockOnOrderPlaced;
use Modules\Core\Order\Listeners\DeriveOrderDeliveredFromShipment;
use Modules\Core\Order\Listeners\RecordPaymentTransaction;
use Modules\Core\Order\Notifications\OrderCapturedNotification;
use Modules\Core\Order\Notifications\OrderDeliveredNotification;
use Modules\Core\Order\Notifications\OrderPlacedNotification;
use Modules\Core\Order\Notifications\OrderRefundedNotification;
use Modules\Core\Order\Notifications\OrderStatusUpdatedNotification;
use Modules\Core\Order\Observers\OrderObserver;
@@ -41,12 +44,14 @@ class OrderServiceProvider extends ServiceProvider
Event::listen(PaymentAuthorized::class, RecordPaymentTransaction::class);
Event::listen(PaymentVoided::class, RecordPaymentTransaction::class);
Event::listen(PaymentRefunded::class, RecordPaymentTransaction::class);
Event::listen(OrderPlaced::class, DecrementStockOnOrderPlaced::class);
NotificationRegistry::get()->register([
OrderDeliveredNotification::class,
OrderStatusUpdatedNotification::class,
OrderRefundedNotification::class,
OrderCapturedNotification::class,
OrderPlacedNotification::class,
]);
// Lets the consuming app override copy/markup without forking core