Class NotificationCartPendingPaymentFailedListener
java.lang.Object
com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
com.broadleafcommerce.notification.service.messaging.NotificationCartPendingPaymentFailedListener
public class NotificationCartPendingPaymentFailedListener
extends AbstractEmailNotificationMessageListener
A message listener that triggers when a cart's previously pending payment failed. Responsible for
creating the cart pending payment failed notification.
- Author:
- Aastha B
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
EMAIL_DELIVERY, messages, notificationService, tenantProvider, typeFactory, userResolver -
Constructor Summary
ConstructorsConstructorDescriptionNotificationCartPendingPaymentFailedListener(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, CartPendingPaymentFailedPathProperties pathProperties, CartProvider cartProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildNotificationContext(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfofor the current messageprotected CartProviderprotected StringGet the class name to identify this listener for handling message idempotency.protected StringGet the Json path to the full name from billing address fromCartPendingPaymentFailedPathProperties.protected StringgetCustomerName(com.jayway.jsonpath.DocumentContext jsonContext) Read the customer name from the given context.protected Stringprotected StringgetMessageType(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Determine which message type should be sent.protected StringgetNotificationSubject(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Determine the subject to use for the email notification.protected CartPendingPaymentFailedPathPropertiesgetRecipients(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Determine the recipients to use for the email notification.voidhandleMessage(org.springframework.messaging.Message<String> message) protected voidmodifyNotification(Notification notification, com.jayway.jsonpath.DocumentContext jsonContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Extension point to allow modifying the notification or context before sending to the notification serviceprotected voidpopulateCartItems(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidpopulateCartItemsAndGroups(com.jayway.jsonpath.DocumentContext jsonContext, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected voidpopulateFulfillmentGroups(com.broadleafcommerce.cart.client.domain.CheckoutCart checkoutCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected booleanvalidateShouldSendNotification(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Validate that the message state is valid to send the email.Methods inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
buildNotification, buildNotification, getDocumentContext, getIdempotentConsumptionService, getMessages, getNotificationService, getObjectMapper, getPayload, getTenantProvider, getTypeFactory, getUserResolver, handleMessageInternal, modifyNotification, processMessage, resolveApplicationById, setTenantProvider, setUserResolver
-
Field Details
-
PENDING_PAYMENT_FAILED
- See Also:
-
SUBJECT_MESSAGE_PENDING_PAYMENT_FAILED
- See Also:
-
APPLICATION_ID_PATH
- See Also:
-
TENANT_ID_PATH
- See Also:
-
LOCALE
- See Also:
-
-
Constructor Details
-
NotificationCartPendingPaymentFailedListener
public NotificationCartPendingPaymentFailedListener(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, CartPendingPaymentFailedPathProperties pathProperties, CartProvider cartProvider)
-
-
Method Details
-
handleMessage
@StreamListener("cartPendingPaymentFailedNotification") public void handleMessage(org.springframework.messaging.Message<String> message) -
getClassName
Get the class name to identify this listener for handling message idempotency.- Specified by:
getClassNamein classAbstractEmailNotificationMessageListener- 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:
validateShouldSendNotificationin classAbstractEmailNotificationMessageListener- Parameters:
jsonContext- the message payload- Returns:
- whether the email should be sent
-
getMessageType
Determine which message type should be sent.- Specified by:
getMessageTypein classAbstractEmailNotificationMessageListener- 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:
getNotificationSubjectin classAbstractEmailNotificationMessageListener- 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:
getRecipientsin classAbstractEmailNotificationMessageListener- Parameters:
jsonContext- the message payload- Returns:
- the recipients to use for the email notification
-
getCustomerName
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.
-
getCustomerEmailPath
Get the Json path to the full name from billing address fromCartPendingPaymentFailedPathProperties.- Returns:
- The Json path to the full name from billing address property
-
getCustomerNamePath
-
buildNotificationContext
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildNotificationContext(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfofor the current message- Specified by:
buildNotificationContextin classAbstractEmailNotificationMessageListener- 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:AbstractEmailNotificationMessageListenerExtension point to allow modifying the notification or context before sending to the notification service- Overrides:
modifyNotificationin classAbstractEmailNotificationMessageListener- Parameters:
notification- the Notification for the current messagejsonContext- the message payloadcontext- 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
-
getCartProvider
-