Class AutoFulfillVirtualOrderCreatedListener
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.messaging.AbstractAutoStatusChangeListener<OrderCreatedEvent>
-
- com.broadleafcommerce.orderoperation.service.messaging.ordercreated.AbstractAutoStatusChangeOrderCreatedListener
-
- com.broadleafcommerce.orderoperation.service.messaging.ordercreated.AutoFulfillVirtualOrderCreatedListener
-
public class AutoFulfillVirtualOrderCreatedListener extends AbstractAutoStatusChangeOrderCreatedListener
Event listener that listens forOrderCreatedEvents
, identifies theOrderFulfillments
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 Summary
Constructors Constructor Description AutoFulfillVirtualOrderCreatedListener(com.broadleafcommerce.common.extension.TypeFactory typeFactory, FulfillmentOperationService fulfillmentOperationService, com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService, FulfillmentProcessingProperties fulfillmentProcessingProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FulfillmentProcessingProperties
getFulfillmentProcessingProperties()
protected com.broadleafcommerce.order.client.domain.OrderFulfillmentStatus
getNewStatus()
IfFulfillmentProcessingProperties.isEnableFulfillingStep()
is active, then transition into theOrderFulfillmentStatus.FULFILLING
status so external fulfillment can occur.void
listen(org.springframework.messaging.Message<OrderCreatedEvent> message)
protected boolean
shouldChangeStatus(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.order.client.domain.Order order)
Determine whether or not theOrderFulfillment
status should be automatically changed.-
Methods inherited from class com.broadleafcommerce.orderoperation.service.messaging.ordercreated.AbstractAutoStatusChangeOrderCreatedListener
getContextInfo, getFulfillments, getOrder
-
Methods inherited from class com.broadleafcommerce.orderoperation.service.messaging.AbstractAutoStatusChangeListener
getFulfillmentOperationService, getIdempotentMessageService, getTypeFactory, performChangeStatus, processEvent
-
-
-
-
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 theOrderFulfillment
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 classAbstractAutoStatusChangeListener<OrderCreatedEvent>
- Parameters:
fulfillment
- The fulfillment to possibly change status- Returns:
- whether the fulfillment should have status changed
-
getNewStatus
protected com.broadleafcommerce.order.client.domain.OrderFulfillmentStatus getNewStatus()
IfFulfillmentProcessingProperties.isEnableFulfillingStep()
is active, then transition into theOrderFulfillmentStatus.FULFILLING
status so external fulfillment can occur. Otherwise, immediately mark asOrderFulfillmentStatus.FULFILLED
, indicating that fulfillment is complete.- Specified by:
getNewStatus
in classAbstractAutoStatusChangeListener<OrderCreatedEvent>
- Returns:
- the new status to transition to
-
getFulfillmentProcessingProperties
protected FulfillmentProcessingProperties getFulfillmentProcessingProperties()
-
-