Repository navigation
0.29.0 - 2026-11-23
A cancelled order can be reinstated. Moving an order to the trash can record why, and
trashing or restoring an order now moves its revision, so an external system picks the
change up.
Upgrading. No migration, and the core requirement is unchanged
(>= 3.5.0 and < 4.0.0). Read "Changes that can break a caller" below. An
OrderEvents handler with no catch-all clause has to get one before deploying.
Added
reinstate_order/3and Reinstate order on the admin order page (under
billing.manage_orders, with an optional reason). It takes acancelledorder
back to the status it was cancelled from (metadata["cancelled_from"], orpending
for an order cancelled before that was recorded), clearscancelled_atand moves the
revision on. The trail goes tometadata["reinstated"](status,reason,
by_uuid,at). A reason is also appended tointernal_notesas
Reinstated <date>: <reason>. If one of the order's invoices was paid while it was
cancelled, the order is confirmed and marked paid in the same transaction. A
payment or refund of that invoice that runs at the same time waits for the
reinstate. An order that is not cancelled is:order_not_reinstatable(refunded
stays final). An order in the trash is:order_trashedand has to be restored first.
Also delegated fromPhoenixKit.Modules.Billing.Order.reinstated_status/1andOrder.reinstate_changeset/3.- A durable
OrderEvents:reinstatedevent and an{:order_reinstated, order}
PubSub broadcast on the order topics, the per-user topic included. trash_order/2takes an optional:reason, appended tointernal_notesas
Trashed <date>: <reason>in the same write. The admin's Move to trash still asks
for no reason.- An
Errorsmessage for:order_not_reinstatable, translated in every shipped
locale.
Changed
Changes that can break a caller:
OrderEventshandlers get a new event,:reinstated. A
handle_order_event/2with no clause for it fails its job. Each handler needs a
catch-all clause, because new events will keep being added.- (order uuid, event) no longer identifies a single occurrence. If an order is
cancelled, reinstated and then cancelled again,:cancelledfires twice. A handler
that deduplicated on the order's uuid and the event has to make its effect
idempotent against the order's status instead. - Trashing and restoring an order move its revision.
trashed_atis now a
revision field, so an external system that syncs on the revision picks the order up
again (an ERP marks its document for deletion).updated_atis still not touched. - A PubSub subscriber with a strict
handle_info/2on the order topics needs a
catch-all clause for{:order_reinstated, order}.