Class AutoFulfillVirtualOrderCreatedListener


  • public class AutoFulfillVirtualOrderCreatedListener
    extends AbstractAutoStatusChangeOrderCreatedListener
    Event listener that listens for OrderCreatedEvents, identifies the OrderFulfillments that should be fulfilled immediately, and fulfills them.

    This functionality is most relevant for any goods that should be fulfilled immediately - e.g. virtual goods.

    • Constructor Detail

      • AutoFulfillVirtualOrderCreatedListener

        public AutoFulfillVirtualOrderCreatedListener​(com.broadleafcommerce.common.extension.TypeFactory typeFactory,
                                                      FulfillmentOperationService fulfillmentOperationService,
                                                      com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService,
                                                      FulfillmentProcessingProperties fulfillmentProcessingProperties)
    • Method Detail

      • listen

        @StreamListener("orderOperationsOrderCreatedInput")
        public void listen​(org.springframework.messaging.Message<OrderCreatedEvent> message)
      • shouldChangeStatus

        protected boolean shouldChangeStatus​(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment,
                                             com.broadleafcommerce.order.client.domain.Order order)
        Determine whether or not the OrderFulfillment status should be automatically changed. Extend this method to use some other criteria.

        By default, only inventory type of VIRTUAL will automatically have status changed.

        Specified by:
        shouldChangeStatus in class AbstractAutoStatusChangeListener<OrderCreatedEvent>
        Parameters:
        fulfillment - The fulfillment to possibly change status
        Returns:
        whether the fulfillment should have status changed