Skip to content
← Back to Index

OnPaymentValidate

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

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

Commands returned from this hook are applied to the payment, but do not re-trigger OnPaymentCommands or OnPaymentValidate. The hook runs once per message.

Type

filtrera
{
  hook: 'OnPaymentValidate'
  before: Payment // The payment before the incoming message commands were applied
  payment: Payment // The payment after OnPaymentCommands has run
}

Effects

validationError Reverts the payment 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.
paymentCommand Applies a corrective command to the payment. Commands returned from OnPaymentValidate do not re-trigger OnPaymentCommands or OnPaymentValidate.

© 2024 Hantera AB. All rights reserved.