To use slot messaging, set the PricingTools.sendUserMessages property to true. The default is false.

The PricingTools.messageTools component includes a sendUserMessage() method that resolves the MessageTools component and sends the message to it.

/*
* @param pMessage UserMessage to send
* @param pMessageTools MessageTools component to use (optional)
* @param pExtraParameters Map of extra parameters
*/

public void sendUserMessage(UserMessage pMessage, MessageTools
pMessageTools, Map pExtraParameters)

The MessageTools class allows you to configure a single slot using the userMessagingSlot property. MultiSlotMessageTools allows you to configure multiple slots to store messages, as shown in this example:

/**
   * Adds message to one or more user messaging slots for storage until the UI is
ready to view the messages.
   * <br>If the message identifier maps to any slots via the
<code>slotMessages</code> mapping then
   * <br>we send the message to those slots otherwise
   * <br>If the message group maps to any slots via the
<code>slotMessageGroups</code> mapping then
   * <br>we send the message to those slots otherwise
   *  the superclass implementation of this method is invoked.
   *
   * @param pMessage The user message to store in the slots
   */
  @Override
  public void addMessage(UserMessage pMessage)

Configure the slotMessages Map property of the MyMultiSlotMessageTools component with the slot paths and strings that identify user messages. When a message is added, it is sent to the slots configured in the map.

Alternatively, configure the slotMessagesGroups property, which maps slot components to a user message group string. If a user group mapping is added, any messages with that message group are sent to the slots configured in the map.

If you want to remove messages from slots, set the slotsToClean property of MyMultiSlotMessageTools with the names of the slots from which to remove messages. Message removal takes place at the start of the pricing operation.

You can configure a default slot in the userMessagingSlot property, or explicitly send a message to the default slot by adding a mapping with this key:

[default]

The following example Map includes these slots:

# Slot messages property
slotMessages=\
  [default]=GWPQualified\
  /app/GWPSlot=GWPQualified\
  /app/GWPFailureSlot=GWPPartialFailure,GWPFullFailure

This example does not use groups. Note that in this example the failure messages have an explicitly configured slot and do not go to the default slot.

The UserMessage class has the following properties:

Property

Data Type

Description

identifier

String

The unique message identifier

messageGroup

String

A group to which this message belongs, such as GiftWithPurchaseMessages.

summary

String

A string description for the message.

priority

int

An integer priority, Validation=10, Form Error (not validation)=5, Error (default)=0, Confirmation=0, Warning=-5, Information=-10

type

String

Message type: error (default), confirmation, warning, information

params

Object[]

Optional message specific array of object parameters that relate to the message.