Skip to content
← Back to Index

OnOrderValidate

This hook runs immediately after the OnOrderCommands hook and any commands it returned have been applied to the Order Actor.

It is the place to enforce invariants that can only be checked once all OnOrderCommands 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 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.

© 2024 Hantera AB. All rights reserved.