Portable audit receipt for one governed delivery decision.
Summary
Functions
Re-authorizes a due :deferred/:digest receipt, or transitions an
:authorized receipt to :delivered or :failed.
Validates the receipt's identity, target, status, timestamps and portability.
Same as validate/1 but returns the receipt, raising ArgumentError when invalid.
Types
@type t() :: %Spectre.Operation.Delivery.Receipt{ channel: term(), consent_id: term(), decided_at: term(), dedupe_key: term(), delivered_at: term(), destination: term(), event_id: term(), external_receipt: term(), id: term(), loop_id: term(), metadata: term(), not_before: term(), reason: term(), status: term(), subject_id: term() }
Functions
@spec transition(t(), :authorized | :delivered | :failed, term(), non_neg_integer()) :: {:ok, t()} | {:error, term()}
Re-authorizes a due :deferred/:digest receipt, or transitions an
:authorized receipt to :delivered or :failed.
For :delivered, detail is stored as the external receipt and at as the
delivery time; for :failed, detail becomes the failure reason. Repeating a
transition with the same detail is idempotent. Returns {:ok, receipt} or
{:error, reason} when the transition is not allowed from the current status.
Validates the receipt's identity, target, status, timestamps and portability.
Returns :ok, or {:error, reason} naming the first invalid field or the
status whose required fields are inconsistent.
Same as validate/1 but returns the receipt, raising ArgumentError when invalid.