Enable gated multi-level referral profit and harden chat/SMS notify paths.

Honor enable_customer_level_profit for order referral payouts, and tighten support-chat webhook/SMS plus SuperAdmin SMS panel sync settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-10 16:48:53 +03:30
co-authored by Cursor
parent f421fcb83f
commit 279e4bc881
8 changed files with 277 additions and 110 deletions
@@ -134,16 +134,18 @@ class SupportChatNotifyController extends Controller
/**
* ثبت/تازه‌سازی وب‌هوک روی ah_chat (از پنل ادمین).
* همیشه HTTP 200 — شکست ثبت best-effort است و نباید toast خطای 422 بسازد.
*/
public function ensureWebhook()
{
$service = app(ChatWebhookService::class);
$ok = $service->ensureRegistered();
$result = app(ChatWebhookService::class)->ensureRegisteredDetailed();
return response()->json([
'ok' => $ok,
'webhook_url' => $service->webhookUrl(),
'message' => $ok ? 'webhook registered' : 'webhook register skipped or failed',
], $ok ? 200 : 422);
'ok' => (bool) ($result['ok'] ?? false),
'webhook_url' => (string) ($result['webhook_url'] ?? ''),
'reason' => (string) ($result['reason'] ?? ''),
'message' => (string) ($result['message'] ?? ''),
'attempts' => (int) ($result['attempts'] ?? 0),
]);
}
}