Class DefaultCartNotificationService

    • 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: CartNotificationService
        Sends rollback event to process the error during checkout. It uses durable sending to guarantee delivery.
        Specified by:
        sendRollbackEvent in interface CartNotificationService
        Parameters:
        event - the message payload
        contextInfo - 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 resent
        requestId - 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: CartNotificationService
        Sends checkout completion event. It uses durable sending to guarantee delivery.
        Specified by:
        sendCheckoutCompletionEvent in interface CartNotificationService
        Parameters:
        event - the message payload
        contextInfo - 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: CartNotificationService
        Sends cart rejection event. It uses durable sending to guarantee delivery.
        Specified by:
        sendCartRejectionEvent in interface CartNotificationService
        Parameters:
        event - the message payload
        contextInfo - 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: CartNotificationService
        Sends cart rejection event. It uses durable sending to guarantee delivery.
        Specified by:
        sendCartRejectionEvent in interface CartNotificationService
        Parameters:
        cart - The updated Cart
        audit - The CartActionAudit for the update
        contextInfo - 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: CartNotificationService
        Sends cart approval requested event. It uses durable sending to guarantee delivery.
        Specified by:
        sendCartApprovalRequestEvent in interface CartNotificationService
        Parameters:
        cart - The updated Cart
        audit - The CartActionAudit for the update
        contextInfo - context information around sandbox and multitenant state
        See Also:
        CartApprovalRequestProducer
      • convertCartRejectionEventToJson

        protected String convertCartRejectionEventToJson​(@NonNull
                                                         @NonNull CartRejectionEvent event)
      • 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 against
        contextInfo - 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()
      • 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)