Skip to content

OnOrderBeforeCreated

Back to Index

This hook runs before any command have been applied to an Order Actor from the create message. Commands returned will be applied to the order before the create message’s commands.

The order field in the input will contain only basic information, such as orderId, currencyCode. taxIncluded and createdAt. Note that orderNumber is not yet set, and generateOrderNumberByPrefix command can be used to set a different the order number serie than the default.

Type

{
hook: 'OnOrderCommands'
order: Order
}

Effects

effects.common.sendMessage Sends a message to another actor after the order has been saved. Responses from the target actor is ignored.

effects.common.validationError Aborts the creation of the order and returns the error to the caller.

effects.order.command.* Applies a command to the actor. Replace * with the type of command you want to apply.

Examples

Custom Order Number Prefix

param input: OnOrderBeforeCreated
from effects.order.command.generateOrderNumberByPrefix {
prefix = 'CUSTOM'
}
Back to Index