- v1 · current
- v0 · deprecated
You’re viewing the current (v1)
store.business_day_closed contract — a thin payload: close identity, timing, closedBy, and a minimal store ref. It no longer carries the day’s aggregate metrics, breakdowns, or anomaly detail — fetch those by businessDayId when you need them.store.business_day_closed fires when Fire’s automated business-day-close pipeline finishes building the immutable snapshot for a store’s operational day. The payload is thin: it carries the close identity (businessDayId), timing, who closed it, and a minimal store ref — enough to react to “the day closed” and match it on your side. The heavy aggregates (sales, metrics, per-channel/payment breakdowns, force-closed and cancellation detail) live in the snapshot and are retrievable by businessDayId — they are not embedded in the event.
Unlike order-level events, this is a store-level event: one per store closed, not one per order.
Trigger condition
Fire emitsstore.business_day_closed once per (storeId, businessDayDate) snapshot, the first time all of these are true:
- The store had an open business day (
isBusinessDayOpen === true) for the date being closed - The close pipeline (
CloseBusinessDayService.execute()) completed all steps without error (force-close, metric calculation, snapshot persistence) - No snapshot already exists for that
(storeId, businessDayDate)pair (idempotency guard)
What’s in trigger.data
A thin payload: identity (businessDayId, businessDayDate, timezone, status), timing (openedAt, closedAt), the resolved closedBy, and a minimal store ref (uid, code, externalId, countryCode, timezone, currencyCode). No metrics, breakdowns, or anomaly arrays — query the snapshot by businessDayId if you need the detail.
Example — real payload (sanitized)
data.* reference
Identity & temporal
string
UUID of the persisted business-day snapshot in Fire’s database. Also surfaced as
_meta.triggerEntityId. Use it as the idempotency key on your side — re-deliveries of the same close share the same businessDayId — and as the lookup key to fetch the day’s aggregates from Fire’s snapshot API when you need them.string
Calendar date the close represents, in the store’s timezone (e.g.
"2026-03-31"). Not the UTC date the event fired.string
IANA timezone of the store (e.g.
"America/Sao_Paulo"). Use it to interpret businessDayDate.string
Always
"CLOSED" for this event. No other value is possible here.string | null
ISO 8601 UTC timestamp the business day opened. May be
null for stores that never explicitly opened (legacy data); for v1 cron-closed stores it’s always present.string
ISO 8601 UTC timestamp the close pipeline persisted the snapshot. Use this for SLI/SLO measurements rather than
event.createdAt (which is the queue dispatch time).closedBy — operator identity
object
Already-resolved operator identity. No runtime lookups needed downstream.
store — minimal store ref
object
A minimal store reference — just identity plus country/timezone/currency. The full canonical store block (name, address, vendor, account, fiscal config) is not included here; if you need it, take it from the
order.completed events for the same store.Handler example
Common pitfalls
- The day’s metrics are NOT in this event.
sales,metrics,byChannel,byPaymentMethod,forceClosedOrders,closureStats,cancelledOrdersandmetadatano longer ship inline. If you relied on them, fetch the snapshot bybusinessDayId. snapshotIdwas renamed tobusinessDayId. If you parseddata.snapshotId, switch todata.businessDayId(same value — the snapshot row id).closedBy.uidmay be the nil UUID"00000000-0000-0000-0000-000000000000"— for system closes where the account hasn’t configured a custom system user. Detect system closes viaclosedBy.type === "system", not by parsinguid.businessDayDateis the store’s calendar date, not UTC. Interpret it withtimezone.store.*fields can benullfor incomplete store configuration. Don’t assume non-null.
Related events
order.completed
Fires per individual order as it completes. The full store block lives here.
order.cancelled
Per-cancellation event. Use it for cancellation detail instead of the day-close payload.

