Class DefaultCartNotificationService
- java.lang.Object
 - 
- com.broadleafcommerce.cart.service.messaging.DefaultCartNotificationService
 
 
- 
- All Implemented Interfaces:
 CartNotificationService
public class DefaultCartNotificationService extends Object implements CartNotificationService
Default implementation forCartNotificationService.- Author:
 - Dima Myroniuk (dmyroniuk)
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringCART_ID_REQUIREDstatic StringCHECKOUT_WORKFLOW_ERRORSThe key to theJpaCart.getInternalAttributes()containing checkout workflow errors 
- 
Constructor Summary
Constructors Constructor Description DefaultCartNotificationService(CartRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, CartNotificationRepository cartNotificationRepository, com.fasterxml.jackson.databind.ObjectMapper objectMapper) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringconvertCartRejectionEventToJson(@NonNull CartRejectionEvent event)protected CartNotificationRepositorygetCartNotificationRepository()protected com.broadleafcommerce.common.messaging.notification.NotificationManagergetNotificationManager()protected com.broadleafcommerce.common.messaging.notification.NotificationStateServicegetNotificationStateService()protected com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()protected CartRepository<com.broadleafcommerce.data.tracking.core.Trackable>getRepository()protected com.broadleafcommerce.common.extension.TypeFactorygetTypeFactory()voidsendCartApprovalRequestEvent(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartActionAudit audit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends cart approval requested event.voidsendCartApprovalRequestEvent(@NonNull CartApprovalRequestEvent event, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends cart approval request event.voidsendCartPendingPaymentFailedEventUri(@NonNull CartPendingPaymentFailedEvent event, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends cart pending payment failed event.voidsendCartRejectionEvent(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartActionAudit audit, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends cart rejection event.voidsendCartRejectionEvent(@NonNull CartRejectionEvent event, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends cart rejection event.voidsendCheckoutCompletionEvent(@NonNull CheckoutCompletionEvent event, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends checkout completion event.protected voidsendEvent(com.broadleafcommerce.data.tracking.core.Trackable cart, String messageJson, String messageName, String messageType)voidsendRollbackEvent(@NonNull CheckoutRollbackEvent event, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Sends rollback event to process the error during checkout.voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)protected voidvalidateCartApprovalRequestEvent(@NonNull CartApprovalRequestEvent event)protected voidvalidateCartFields(@NonNull com.broadleafcommerce.data.tracking.core.Trackable cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Hook point to validate the given cart's fields.protected voidvalidateCartHasPendingPaymentFailedStatus(@NonNull JpaCart cart)protected voidvalidateCartHasWorkflowErrorForRequestId(@NonNull com.broadleafcommerce.data.tracking.core.Trackable cart, @NonNull String requestId)Validates if the checkout rollback event can be resent for the given cart.protected voidvalidateCartIsRejected(@NonNull com.broadleafcommerce.data.tracking.core.Trackable cart)protected voidvalidateCartIsSubmitted(@NonNull com.broadleafcommerce.data.tracking.core.Trackable cart)protected voidvalidateCartPendingPaymentFailedEvent(@NonNull CartPendingPaymentFailedEvent event)protected voidvalidateCartRejectionEvent(@NonNull CartRejectionEvent event)protected voidvalidateCartRequiresApproval(@NonNull com.broadleafcommerce.data.tracking.core.Trackable cart)protected voidvalidateCheckoutCompletionEvent(@NonNull CheckoutCompletionEvent event)protected voidvalidateCheckoutRollbackEvent(@NonNull CheckoutRollbackEvent event) 
 - 
 
- 
- 
Field Detail
- 
CHECKOUT_WORKFLOW_ERRORS
public static final String CHECKOUT_WORKFLOW_ERRORS
The key to theJpaCart.getInternalAttributes()containing checkout workflow errors- See Also:
 - Constant Field Values
 
 
- 
CART_ID_REQUIRED
public static final String CART_ID_REQUIRED
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
DefaultCartNotificationService
public DefaultCartNotificationService(CartRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.common.messaging.notification.NotificationStateService notificationStateService, com.broadleafcommerce.common.messaging.notification.NotificationManager notificationManager, CartNotificationRepository cartNotificationRepository, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
 
 - 
 
- 
Method Detail
- 
sendRollbackEvent
public void sendRollbackEvent(@NonNull @NonNull CheckoutRollbackEvent event, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends rollback event to process the error during checkout. It uses durable sending to guarantee delivery.- Specified by:
 sendRollbackEventin interfaceCartNotificationService- Parameters:
 event- the message payloadcontextInfo- context information around sandbox and multitenant state- See Also:
 CheckoutRollbackEventProducer
 
- 
validateCheckoutRollbackEvent
protected void validateCheckoutRollbackEvent(@NonNull @NonNull CheckoutRollbackEvent event) 
- 
validateCartHasWorkflowErrorForRequestId
protected void validateCartHasWorkflowErrorForRequestId(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable cart, @NonNull @NonNull String requestId)Validates if the checkout rollback event can be resent for the given cart.- Parameters:
 cart- the cart used to validate if the event can be resentrequestId- the checkout request id
 
- 
sendCheckoutCompletionEvent
public void sendCheckoutCompletionEvent(@NonNull @NonNull CheckoutCompletionEvent event, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends checkout completion event. It uses durable sending to guarantee delivery.- Specified by:
 sendCheckoutCompletionEventin interfaceCartNotificationService- Parameters:
 event- the message payloadcontextInfo- context information around sandbox and multitenant state- See Also:
 CheckoutCompletionProducer
 
- 
sendCartRejectionEvent
public void sendCartRejectionEvent(@NonNull @NonNull CartRejectionEvent event, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends cart rejection event. It uses durable sending to guarantee delivery.- Specified by:
 sendCartRejectionEventin interfaceCartNotificationService- Parameters:
 event- the message payloadcontextInfo- context information around sandbox and multitenant state- See Also:
 CartRejectionProducer
 
- 
sendCartRejectionEvent
public void sendCartRejectionEvent(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.cart.client.domain.CartActionAudit audit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends cart rejection event. It uses durable sending to guarantee delivery.- Specified by:
 sendCartRejectionEventin interfaceCartNotificationService- Parameters:
 cart- The updatedCartaudit- TheCartActionAuditfor the updatecontextInfo- context information around sandbox and multitenant state- See Also:
 CartRejectionProducer
 
- 
sendCartApprovalRequestEvent
public void sendCartApprovalRequestEvent(@NonNull @NonNull CartApprovalRequestEvent event, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends cart approval request event. It uses durable sending to guarantee delivery.- Specified by:
 sendCartApprovalRequestEventin interfaceCartNotificationService- Parameters:
 event- the message payloadcontextInfo- context information around sandbox and multitenant state- See Also:
 CartRejectionProducer
 
- 
sendCartApprovalRequestEvent
public void sendCartApprovalRequestEvent(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.cart.client.domain.CartActionAudit audit, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends cart approval requested event. It uses durable sending to guarantee delivery.- Specified by:
 sendCartApprovalRequestEventin interfaceCartNotificationService- Parameters:
 cart- The updatedCartaudit- TheCartActionAuditfor the updatecontextInfo- context information around sandbox and multitenant state- See Also:
 CartApprovalRequestProducer
 
- 
convertCartRejectionEventToJson
protected String convertCartRejectionEventToJson(@NonNull @NonNull CartRejectionEvent event)
 
- 
sendCartPendingPaymentFailedEventUri
public void sendCartPendingPaymentFailedEventUri(@NonNull @NonNull CartPendingPaymentFailedEvent event, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartNotificationServiceSends cart pending payment failed event. It uses durable sending to guarantee delivery.- Specified by:
 sendCartPendingPaymentFailedEventUriin interfaceCartNotificationService- Parameters:
 event- the message payloadcontextInfo- context information around sandbox and multitenant state- See Also:
 CartPendingPaymentFailedProducer
 
- 
validateCheckoutCompletionEvent
protected void validateCheckoutCompletionEvent(@NonNull @NonNull CheckoutCompletionEvent event) 
- 
validateCartFields
protected void validateCartFields(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Hook point to validate the given cart's fields.Validates that the cart's order number exist by default.
- Parameters:
 cart- the cart to validate againstcontextInfo- context information related to multitenancy
 
- 
validateCartRejectionEvent
protected void validateCartRejectionEvent(@NonNull @NonNull CartRejectionEvent event) 
- 
validateCartApprovalRequestEvent
protected void validateCartApprovalRequestEvent(@NonNull @NonNull CartApprovalRequestEvent event) 
- 
validateCartPendingPaymentFailedEvent
protected void validateCartPendingPaymentFailedEvent(@NonNull @NonNull CartPendingPaymentFailedEvent event) 
- 
sendEvent
protected void sendEvent(com.broadleafcommerce.data.tracking.core.Trackable cart, String messageJson, String messageName, String messageType) 
- 
validateCartIsSubmitted
protected void validateCartIsSubmitted(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable cart) 
- 
validateCartIsRejected
protected void validateCartIsRejected(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable cart) 
- 
validateCartRequiresApproval
protected void validateCartRequiresApproval(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.Trackable cart) 
- 
validateCartHasPendingPaymentFailedStatus
protected void validateCartHasPendingPaymentFailedStatus(@NonNull @NonNull JpaCart cart) 
- 
getRepository
protected CartRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
 
- 
getNotificationStateService
protected com.broadleafcommerce.common.messaging.notification.NotificationStateService getNotificationStateService()
 
- 
getNotificationManager
protected com.broadleafcommerce.common.messaging.notification.NotificationManager getNotificationManager()
 
- 
getCartNotificationRepository
protected CartNotificationRepository getCartNotificationRepository()
 
- 
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
 
- 
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
 
- 
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
 
 - 
 
 -