Class AutoCaptureVirtualOrderCreatedListener


  • public class AutoCaptureVirtualOrderCreatedListener
    extends AbstractAutoStatusChangeOrderCreatedListener
    Event listener that listens for OrderCreatedEvents, identifies the OrderFulfillments that should be processed immediately, and puts them into the OrderFulfillmentStatus.CAPTURING_PAYMENT status to be captured.

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

    • Constructor Detail

      • AutoCaptureVirtualOrderCreatedListener

        public AutoCaptureVirtualOrderCreatedListener​(com.broadleafcommerce.common.extension.TypeFactory typeFactory,
                                                      FulfillmentOperationService fulfillmentOperationService,
                                                      com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService)
    • 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