Skip to content
← Back to Index

OnOrderValidate

This hook runs immediately after the OnOrderCalculate hook — which itself runs after OnOrderCommands — and any commands those hooks returned have been applied to the Order Actor.

It is the place to enforce invariants that can only be checked once all OnOrderCommands and OnOrderCalculate rules have settled, and to either reject the order with a validationError effect or auto-fix it by emitting more orderCommand effects.

Commands returned from this hook are applied to the order, but do not re-trigger OnOrderCommands, OnOrderCalculate or OnOrderValidate. The hook runs once per message.

Type

filtrera
{
  hook: 'OnOrderValidate'
  before: Order // The order before the incoming message commands were applied
  order: Order // The order after OnOrderCommands has run
}

Effects

validationError Reverts the order state and returns the error to the caller.
messageActor Sends a message to another actor. Responses are ignored.
scheduleJob Schedules a job.
sendEmail Queues an email for delivery through the Sendings system.
orderCommand Applies a corrective command to the order. Commands returned from OnOrderValidate do not re-trigger OnOrderCommands or OnOrderValidate.

© 2026 Hantera AB. All rights reserved.