Class NotificationCartRejectionMessageListener
java.lang.Object
com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
com.broadleafcommerce.notification.service.messaging.NotificationCartRejectionMessageListener
public class NotificationCartRejectionMessageListener
extends AbstractEmailNotificationMessageListener
A message listener that triggers when a cart is rejected. Responsible for creating the cart
rejection notification.
- Author:
- Kyrylo Boiko (kboiko2)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
Fields inherited from class com.broadleafcommerce.notification.service.messaging.AbstractEmailNotificationMessageListener
EMAIL_DELIVERY, messages, notificationService, tenantProvider, typeFactory, userResolver
-
Constructor Summary
ConstructorsConstructorDescriptionNotificationCartRejectionMessageListener
(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) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfo
buildNotificationContext
(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfo
for the current messageprotected String
getAccountId
(com.jayway.jsonpath.DocumentContext jsonContext) protected String
Get the class name to identify this listener for handling message idempotency.protected String
getCustomerId
(com.jayway.jsonpath.DocumentContext jsonContext) protected String
getMessageType
(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Determine which message type should be sent.protected String
getNotificationSubject
(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Determine the subject to use for the email notification.protected String
getRecipientCommunicationPreferences
(String accountId, String accountMemberId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) getRecipients
(@NonNull com.jayway.jsonpath.DocumentContext jsonContext) Determine the recipients to use for the email notification.void
handleMessage
(org.springframework.messaging.Message<String> message) protected boolean
validateShouldSendNotification
(@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, modifyNotification, processMessage, resolveApplicationById, setTenantProvider, setUserResolver
-
Field Details
-
REJECTED
- See Also:
-
REQUIRES_APPROVAL
- See Also:
-
CART_REJECTION
- See Also:
-
SUBJECT_MESSAGE
- See Also:
-
APPLICATION_ID_PATH
- See Also:
-
TENANT_ID_PATH
- See Also:
-
CUSTOMER_CONTEXT_ID_PATH
- See Also:
-
CART_CUSTOMER_EMAIL_PATH
- See Also:
-
CART_CUSTOMER_NAME_PATH
- See Also:
-
CART_REVIEWER_EMAIL_PATH
- See Also:
-
CART_OLD_STATUS_PATH
- See Also:
-
CART_NEW_STATUS_PATH
- See Also:
-
LOCALE
- See Also:
-
ACCOUNT_ID_PATH
- See Also:
-
CUSTOMER_ID_PATH
- See Also:
-
-
Constructor Details
-
NotificationCartRejectionMessageListener
public NotificationCartRejectionMessageListener(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)
-
-
Method Details
-
handleMessage
@StreamListener("cartRejectionInputNotification") public void handleMessage(org.springframework.messaging.Message<String> message) -
getClassName
Get the class name to identify this listener for handling message idempotency.- Specified by:
getClassName
in 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:
validateShouldSendNotification
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- whether the email should be sent
-
getMessageType
Determine which message type should be sent.- Specified by:
getMessageType
in 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:
getNotificationSubject
in 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:
getRecipients
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the message payload- Returns:
- the recipients to use for the email notification
-
getAccountId
-
getCustomerId
-
getRecipientCommunicationPreferences
-
buildNotificationContext
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildNotificationContext(@NonNull @NonNull com.jayway.jsonpath.DocumentContext jsonContext) Build theContextInfo
for the current message- Specified by:
buildNotificationContext
in classAbstractEmailNotificationMessageListener
- Parameters:
jsonContext
- the payload of the message- Returns:
- the NotificationContext for the current message
-