Add monetization spine + Build Your Own Case (Min Sak)
- Stripe: StripeClient.php, checkout/portal/webhook endpoints, idempotent event handling - FreeTier: tier-aware credits (free/light/pro/pro_plus), bonus_balance, hourly caps per tier - pricing.php + billing.php: 4-tier cards, 3 topups, Customer Portal, balance breakdown - Min Sak: CaseStore.php, AzureDocIntelligence.php, AzureSearchAdmin.php — per-user hybrid RAG - api/case/: upload, list, delete, ingest-callback (HMAC-auth'd from n8n) - award-survey-credits: inter-site HMAC endpoint for dobetternorge.no survey bonus - dashboard.php: tier badge, balance breakdown card, Min Sak CTA, survey CTA - KorrespondAgent + all 3 other agents: use_my_case toggle wired to dbnToolsCaseContext() - bootstrap.php: dbnToolsCaseContext(), dbnToolsIntersiteSecret(), dbnToolsCurrentTier() Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../includes/bootstrap.php';
|
||||
require_once __DIR__ . '/../../includes/CaseStore.php';
|
||||
|
||||
dbnToolsRequireMethod('POST');
|
||||
dbnToolsRequireAuth();
|
||||
|
||||
$userId = (int)($_SESSION['dbn_tools_sso_uid'] ?? 0);
|
||||
if ($userId <= 0) {
|
||||
dbnToolsError('Auth required.', 401, 'auth_required');
|
||||
}
|
||||
|
||||
$input = dbnToolsJsonInput(500);
|
||||
$docId = (int)($input['doc_id'] ?? 0);
|
||||
if ($docId <= 0) {
|
||||
dbnToolsError('doc_id required.', 400, 'bad_input');
|
||||
}
|
||||
|
||||
$ok = CaseStore::deleteDocument($userId, $docId);
|
||||
if (!$ok) {
|
||||
dbnToolsError('Dokumentet finnes ikke, eller er allerede slettet.', 404, 'not_found');
|
||||
}
|
||||
|
||||
dbnToolsRespond(['ok' => true, 'doc_id' => $docId]);
|
||||
Reference in New Issue
Block a user