table.closed ✓ Canlı

Dine-in masa adisyonu kapatıldığında (ödeme alınıp adisyon kapanınca) eklentinin webhookUrl'ine async (fire-and-forget) imzalı POST edilir. Kapanış SONRASI bir bildirimdir.

← Event Kataloğu

table.closed (event) ≠ table.close (hook). Hook = kapatmadan ÖNCE senkron gate (allow/deny, akışı durdurabilir); event = kapandıktan SONRA async webhook (bildirim, durduramaz). Farklı uçlar, farklı amaç.

Abonelik

  • Manifest: events: ["table.closed"] + events:subscribe.
  • orders:read — adisyon/data için zorunlu.
  • Müşteri PII için customers:read + tenant consent (bu event'in temel data'sında müşteri yer almaz; PII genelde packet akışındadır).

HTTP, imza & teslimat

POST {webhookUrl}
Content-Type: application/json
X-Restomenum-Signature: t=<unixSec>,v1=<HMAC_SHA256(webhookSecret, "<t>.<rawBody>")>
X-Restomenum-Event: table.closed
X-Restomenum-Delivery: <deliveryId>
  • İmzayı ham gövde üzerinden doğrula ("<t>.<rawBody>"), ±5 dk replay toleransı — bkz. imza şeması.
  • Header'lar: X-Restomenum-Event: table.closed, X-Restomenum-Delivery: <id>.
  • Idempotency: envelope id ile dedup (at-least-once → aynı id tekrar gelebilir).
  • Ack: 2xx → tamam; 5xx/timeout → retry → tükenirse dead-letter.

Envelope (tüm event'lerde ortak)

AlanTipZorunluAçıklama
idstringIdempotency anahtarı (tableclosed_<serverId><saleId>). Aynı id tekrar gelebilir → dedup et.
typestringtable.closed
versionnumberEnvelope şema versiyonu (1).
tenantIdstringRestoran (tenant) id.
occurredAtnumberKapanış zamanı (unix ms).
dataobjectEvent'e özel gövde (aşağıda).

data alanları

AlanTipZorunluAçıklama
tableIdstringMasa id'si — tables/get?id= ile aynı.
tableNamestringMasanın görünen adı (ör. "Masa 1").
docNonumberAdisyon/belge no.
desingstringBölüm (salon/alan) adı (ör. "Bahçe") — tables/get'teki desing ile aynı.
locationstringMasanın görünen adı (ör. "Masa 1") — genelde tableName ile aynı.
personCountnumberKişi sayısı (girilmemişse 0).
orders[]arrayAdisyon satırları: id, title, quantity, options[], extra, discount, note, lineTotal. title = ürün adı; options = string array (seçenek adları); lineTotal'ı Restomenum hesaplar.
totalnumberAdisyon toplamı.
paidnumberÖdenen tutar.
totalDiscountnumberToplam indirim.
statusstring | nullMasa kapanış durumu — masa satışlarında genelde null.
channelstringKanonik kanal — masa kapanışında "TABLE".

Tam örnek payload

table.closed envelope (gerçek)
{
  "id": "tableclosed_<serverId><saleId>",
  "type": "table.closed",
  "version": "1",
  "tenantId": "<tenantId>",
  "occurredAt": 1780884616000,
  "data": {
    "tableId": "e4356402-...",
    "tableName": "Masa 1",
    "docNo": 5,
    "desing": "Bahçe",
    "location": "Masa 1",
    "personCount": 0,
    "orders": [
      { "id": "masa-1-f308", "title": "Bellavista", "quantity": 1, "options": [], "extra": 0, "discount": 0, "note": "", "lineTotal": 13 },
      { "id": "masa-1-4724", "title": "dondurma", "quantity": 1, "options": ["çilek", "oreo"], "lineTotal": 4 }
    ],
    "total": 17,
    "paid": 17,
    "totalDiscount": 0,
    "status": null,
    "channel": "TABLE"
  }
}