App

Listeners

Overview

In the Laravel eCommerce API project, the Listeners/ directory contains classes responsible for handling events that occur within the application. Listeners respond to specific events, perform associated tasks, and manage the side effects of these events. This approach helps in decoupling various parts of the application and managing event-driven functionality effectively.


Listener Classes

CollectGarbage

  • Purpose: Handles garbage collection tasks.
  • Description: This listener is responsible for performing garbage collection operations. It cleans up and removes unnecessary or obsolete data to ensure that the system remains efficient and does not accumulate excess data over time.

IssueEcreboCoupons

  • Purpose: Issues Ecrebo coupons based on certain events.
  • Description: This listener handles the issuance of Ecrebo coupons when triggered by specific events. It ensures that coupons are generated and distributed as required, typically in response to certain customer actions or promotional triggers.

MarkEcreboIssuedCodesAsUsed

  • Purpose: Marks Ecrebo-issued coupon codes as used.
  • Description: Responsible for updating the status of Ecrebo coupon codes to indicate that they have been used. This listener ensures that coupon codes are not reused and that their usage is accurately tracked.

MarkNewAppPromoCodeAsUsed

  • Purpose: Updates the status of new app promotional codes.
  • Description: This listener marks newly issued promotional codes for the application as used once they have been redeemed. It helps in tracking the utilization of promo codes and ensuring that they are applied correctly.

MarkTrolleyAsOrdered

  • Purpose: Updates the status of a trolley to reflect that it has been ordered.
  • Description: This listener changes the status of a shopping trolley to indicate that the order has been placed. It is triggered by events related to order completion, ensuring that the trolley status is updated accordingly.

RemoveUsedOneTimeUseEcreboCodes

  • Purpose: Removes Ecrebo codes that are one-time use and have been used.
  • Description: Handles the removal of one-time-use Ecrebo codes from the system once they have been used. This listener ensures that these codes are not available for reuse and are appropriately deleted.

SendComestriConfirmationRequest

  • Purpose: Sends a confirmation request to Comestri.
  • Description: This listener sends confirmation requests to Comestri, typically as part of the order processing or synchronization workflow. It ensures that the necessary confirmation data is sent to the Comestri system.

SendComestriOutOfStockRequest

  • Purpose: Sends an out-of-stock request to Comestri.
  • Description: Responsible for sending requests to Comestri when products are out of stock. This listener helps in keeping the inventory data synchronized between the application and Comestri.

SendOrderConfirmationEmail

  • Purpose: Sends an order confirmation email to the customer.
  • Description: Handles the task of sending an order confirmation email when an order is placed. It ensures that customers receive an email with details about their order, including items purchased, order number, and other relevant information.

SendSDDOrderConfirmationEmail

  • Purpose: Sends an order confirmation email specifically for SDD orders.
  • Description: Similar to SendOrderConfirmationEmail, but specifically for SDD (Software Download Delivery) orders. This listener ensures that customers receive an appropriate confirmation email tailored for digital products.

Summary

The Listeners/ directory in the Laravel eCommerce API project is essential for managing event-driven functionality within the application. Each listener class is designed to respond to specific events, performing tasks such as sending emails, updating records, and managing coupon codes. This organization supports a clean and modular approach to handling application events and their associated actions.


Copyright © 2026