Ana içeriğe geç

Webhooks

Bayi webhook endpoint kayit yonetimi (Faz 3.W.3). Bayi, abone oldugu event'ler gerceklestiginde (orn: service.suspended, product.price_changed) kendi sunucusunda bir HTTP endpoint'ine imzali POST almak icin kayit yapar.

ABONELIK PATTERN'LERI (event_types):

  • * → tum eventler (catch-all)
  • prefix.* → namespace wildcard (service., product.) — tek segment
  • exact → tam event ismi (service.suspended)

GECERLI EVENT'LER (V1): service.created, service.suspended, service.unsuspended, service.terminated, product.price_changed, product.stock_changed, product.disabled, credit.added. Bilinmeyen event tipi 422 doner.

service.created (Faz 3.W.4): siparis edilen VPS provisioning'i Rabisu tarafinda tamamlanip aktif olunca gonderilir (WHMCS domainstatus 'Pending' → 'Active'; cron polling tespiti). Bayi bu event ile servisin hazir oldugunu ANINDA ogrenir (GET /orders/{id} polling fallback olarak kalir). Payload: {provision_id, service_id, order_id, product_id, vps_id, status='active', occurred_at, schema_version}. provision_id = POST /orders yanitindaki id (bayi korelasyon anahtari).

credit.added (Faz 3.B): bayiye kredi yuklendiginde (admin manuel kredi veya fatura iadesi) gonderilir. Payload: {reseller_id, amount, currency, reason (manual_credit|refund), description, related_invoice_id, new_balance, occurred_at}. Bu event SADECE ilgili bayiye gider (broadcast degil). Kaynak: WHMCS tblcredit polling (bin/credit-event-emitter.php). NOT: apply_credit (siparis odemesi) bu event'i URETMEZ — o GET /auth/balance/movements audit'ine OrderService tarafindan real-time yazilir.

SECRET: POST yanitindaki secret plain HMAC secret YALNIZCA bir kez gosterilir. Dispatcher her teslimatta X-Rabisu-Signature: sha256=HMAC header'i ekler. Kaybedilirse endpoint silinip yeniden olusturulmalidir.

CIRCUIT BREAKER: 5 ardisik basarisiz teslimat endpoint'i otomatik pasif yapar (is_active=0). Bayi PATCH {is_active: true} ile reaktive eder.