Class AutoCaptureVirtualOrderCreatedListener
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.messaging.AbstractAutoStatusChangeListener<OrderCreatedEvent>
-
- com.broadleafcommerce.orderoperation.service.messaging.ordercreated.AbstractAutoStatusChangeOrderCreatedListener
-
- com.broadleafcommerce.orderoperation.service.messaging.ordercreated.AutoCaptureVirtualOrderCreatedListener
-
public class AutoCaptureVirtualOrderCreatedListener extends AbstractAutoStatusChangeOrderCreatedListener
Event listener that listens forOrderCreatedEvents
, identifies theOrderFulfillments
that should be processed immediately, and puts them into theOrderFulfillmentStatus.CAPTURING_PAYMENT
status to be captured.This functionality is most relevant for any goods that should be captured immediately - e.g. virtual goods.
-
-
Constructor Summary
Constructors Constructor Description AutoCaptureVirtualOrderCreatedListener(com.broadleafcommerce.common.extension.TypeFactory typeFactory, FulfillmentOperationService fulfillmentOperationService, com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.broadleafcommerce.order.client.domain.OrderFulfillmentStatus
getNewStatus()
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
-
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)
-
getNewStatus
protected com.broadleafcommerce.order.client.domain.OrderFulfillmentStatus getNewStatus()
- Specified by:
getNewStatus
in classAbstractAutoStatusChangeListener<OrderCreatedEvent>
-
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
-
-