Class NotificationCartAwaitingPaymentResultsListener

java.lang.Object
com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
com.broadleafcommerce.notification.service.messaging.NotificationCartAwaitingPaymentResultsListener

public class NotificationCartAwaitingPaymentResultsListener extends AbstractEmailNotificationMessageListener
A message listener that triggers when a cart is awaiting payment results to finalize checkout. Responsible for creating the cart awaiting payment results notification.
Author:
Aastha B
  • Field Details

  • Constructor Details

    • NotificationCartAwaitingPaymentResultsListener

      public NotificationCartAwaitingPaymentResultsListener(com.broadleafcommerce.common.messaging.service.IdempotentMessageConsumptionService idempotentConsumptionService, NotificationService<Notification> notificationService, org.springframework.context.MessageSource messages, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, CartAwaitingPaymentResultsPathProperties pathProperties, CartProvider cartProvider)
  • Method Details

    • handleMessage

      @StreamListener("cartAwaitingPaymentResultsNotification") public void handleMessage(org.springframework.messaging.Message<String> message)
    • getClassName

      protected String getClassName()
      Get the class name to identify this listener for handling message idempotency.
      Specified by:
      getClassName in class AbstractEmailNotificationMessageListener
      Returns:
      the listener's class name
    • validateShouldSendNotification

      protected boolean validateShouldSendNotification(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext)
      Validate that the message state is valid to send the email.
      Specified by:
      validateShouldSendNotification in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the message payload
      Returns:
      whether the email should be sent
    • getMessageType

      protected String getMessageType(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext)
      Determine which message type should be sent.
      Specified by:
      getMessageType in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the message payload
      Returns:
      the message type to send
    • getNotificationSubject

      protected String getNotificationSubject(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext)
      Determine the subject to use for the email notification.
      Specified by:
      getNotificationSubject in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the message payload
      Returns:
      the subject to use for the email notification
    • getRecipients

      protected List<Recipient> getRecipients(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext)
      Determine the recipients to use for the email notification.
      Specified by:
      getRecipients in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the message payload
      Returns:
      the recipients to use for the email notification
    • getCustomerName

      @Nullable protected String getCustomerName(com.jayway.jsonpath.DocumentContext jsonContext)

      Read the customer name from the given context.

      If the customer is registered, the full name from #getRequesterNamePath() will be returned. Otherwise, it returns the customer name from the billing address.

      This method will check the deprecated name path if the configured path does not exist in the given context.

      Parameters:
      jsonContext - the message payload.
      Returns:
      The name of the customer from the given payload.
    • getBillingAddressFullNamePath

      protected String getBillingAddressFullNamePath()
      Get the Json path to the full name from billing address from CartAwaitingPaymentResultsPathProperties.
      Returns:
      The Json path to the full name from billing address property
    • getCustomerEmailPath

      protected String getCustomerEmailPath()
    • getCustomerNamePath

      protected String getCustomerNamePath()
    • buildNotificationContext

      protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildNotificationContext(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext)
      Build the ContextInfo for the current message
      Specified by:
      buildNotificationContext in class AbstractEmailNotificationMessageListener
      Parameters:
      jsonContext - the payload of the message
      Returns:
      the NotificationContext for the current message
    • modifyNotification

      protected void modifyNotification(Notification notification, com.jayway.jsonpath.DocumentContext jsonContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from class: AbstractEmailNotificationMessageListener
      Extension point to allow modifying the notification or context before sending to the notification service
      Overrides:
      modifyNotification in class AbstractEmailNotificationMessageListener
      Parameters:
      notification - the Notification for the current message
      jsonContext - the message payload
      context - The context of the request
    • populateCartItemsAndGroups

      protected void populateCartItemsAndGroups(com.jayway.jsonpath.DocumentContext jsonContext, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • populateCartItems

      protected void populateCartItems(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • populateFulfillmentGroups

      protected void populateFulfillmentGroups(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getPathProperties

      protected CartAwaitingPaymentResultsPathProperties getPathProperties()
    • getCartProvider

      protected CartProvider getCartProvider()