Class AutoFulfillPaymentCapturedListener
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.messaging.AbstractAutoStatusChangeListener<PaymentCaptureAttemptResult>
-
- com.broadleafcommerce.orderoperation.service.messaging.capture.AutoFulfillPaymentCapturedListener
-
public class AutoFulfillPaymentCapturedListener extends AbstractAutoStatusChangeListener<PaymentCaptureAttemptResult>
Event listener that listens for successfulPaymentCaptureAttemptResult
and automatically updates the fulfillment to fulfilled.This functionality is most relevant for any goods that should be fulfilled immediately.
-
-
Constructor Summary
Constructors Constructor Description AutoFulfillPaymentCapturedListener(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 com.broadleafcommerce.data.tracking.core.context.ContextInfo
getContextInfo(PaymentCaptureAttemptResult event)
protected FulfillmentProcessingProperties
getFulfillmentProcessingProperties()
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillment>
getFulfillments(PaymentCaptureAttemptResult event)
protected com.broadleafcommerce.order.client.domain.OrderFulfillmentStatus
getNewStatus()
IfFulfillmentProcessingProperties.isEnableFulfillingStep()
is active, then transition into theOrderFulfillmentStatus.FULFILLING
status so external fulfillment can occur.protected com.broadleafcommerce.order.client.domain.Order
getOrder(PaymentCaptureAttemptResult event)
void
listen(org.springframework.messaging.Message<PaymentCaptureAttemptResult> message)
protected boolean
shouldChangeStatus(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.order.client.domain.Order order)
Determine whether or not theOrderFulfillment
should be automatically fulfilled.-
Methods inherited from class com.broadleafcommerce.orderoperation.service.messaging.AbstractAutoStatusChangeListener
getFulfillmentOperationService, getIdempotentMessageService, getTypeFactory, performChangeStatus, processEvent
-
-
-
-
Constructor Detail
-
AutoFulfillPaymentCapturedListener
public AutoFulfillPaymentCapturedListener(com.broadleafcommerce.common.extension.TypeFactory typeFactory, FulfillmentOperationService fulfillmentOperationService, com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentMessageService, FulfillmentProcessingProperties fulfillmentProcessingProperties)
-
-
Method Detail
-
listen
@StreamListener(value="orderOperationsPaymentCaptureAttemptedInput", condition="headers[\'CAPTURE_ATTEMPT_RESULT\']==\'SUCCESS\' or headers[\'CAPTURE_ATTEMPT_RESULT\']==\'UNNECESSARY\'") public void listen(org.springframework.messaging.Message<PaymentCaptureAttemptResult> message)
-
shouldChangeStatus
protected boolean shouldChangeStatus(com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.order.client.domain.Order order)
Determine whether or not theOrderFulfillment
should be automatically fulfilled. Extend this method to use some other criteria to auto-fulfill.By default, all fulfillments can be auto-fulfilled.
- Specified by:
shouldChangeStatus
in classAbstractAutoStatusChangeListener<PaymentCaptureAttemptResult>
- Parameters:
fulfillment
- The fulfillment to possibly auto-fulfill- Returns:
- whether the fulfillment should be auto-fulfilled
-
getFulfillments
protected List<com.broadleafcommerce.order.client.domain.OrderFulfillment> getFulfillments(PaymentCaptureAttemptResult event)
- Specified by:
getFulfillments
in classAbstractAutoStatusChangeListener<PaymentCaptureAttemptResult>
-
getOrder
protected com.broadleafcommerce.order.client.domain.Order getOrder(PaymentCaptureAttemptResult event)
- Specified by:
getOrder
in classAbstractAutoStatusChangeListener<PaymentCaptureAttemptResult>
-
getContextInfo
@Nullable protected com.broadleafcommerce.data.tracking.core.context.ContextInfo getContextInfo(PaymentCaptureAttemptResult event)
- Specified by:
getContextInfo
in classAbstractAutoStatusChangeListener<PaymentCaptureAttemptResult>
-
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<PaymentCaptureAttemptResult>
- Returns:
- the new status to transition to
-
getFulfillmentProcessingProperties
protected FulfillmentProcessingProperties getFulfillmentProcessingProperties()
-
-