Abo-Baustein aboStatus.js: Wechsel-Regel in laeuft/bestellbar, aboLage; Analyse nutzt ihn

aboStatus.js (Kernversion aus B5 ausgebaut): ein privater Lader lage(customerId, { altbestand })
ueber getCurrentSubscription und listContractEvents, alle Praedikate bauen darauf. laeuft kennt
altbestand (Vorgabe true: productKey || 'wartung' plus Wechsel-Regel; false: die heutige Regel der
Analyse, keine Ereignisabfrage). Wechsel-Regel: sagt der Spiegel "Wartung laeuft" und ist das
juengste wechsel-Ereignis des Abos widerrufen, laeuft das Wartungs-Abo nicht (kein_abo beim
Bestell-Gate, Freischaltung bleibt in setup). Neu aboLage ({ laeuft, art, endedAt }) und
aboMemo().lage; der Memo merkt eine Ablehnung fuer den Lauf. analyse.js nutzt
laeuft(id, { altbestand: false }); Verhalten der Analyse unveraendert (+1 Pin-Test).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-04 13:50:51 +00:00
1 parent cf9f9b30a0
commit 144b053851
6 files changed
+449 -58

No files matched your search

+14
View File
@@ -784,3 +784,17 @@ test('Abgleich: stopSite wirft => Dokument bleibt unverändert aktiv', async ()
assert.ok(!after.offSince)
assert.equal(removalTopics('F5').length, 0)
})
test('Altbestand ohne productKey: Analyse bleibt streng (kein_abo), aboStatus.laeuft grosszuegig', async () => {
const { laeuft } = await import('../server/services/aboStatus.js')
const { productKey: _entfernt, ...ohneSchluessel } = wartungDoc
aw.seed('subscriptions', { ...ohneSchluessel, $id: 'sub_w_alt', stripeSubscriptionId: 'sub_w_alt', customerId: 'c9' })
aw.seed('customers', { $id: 'c9', name: 'Kunde Neun', email: 'neun@example.invalid' })
aw.seed('websiteProjects', { $id: 'p9', customerId: 'c9', projectName: 'Altbestand', subdomain: 'altbestand', isPublic: true })
assert.equal(await laeuft('c9'), true, 'grosszuegige Regel: ohne productKey gilt als Wartung')
assert.equal(await laeuft('c9', { altbestand: false }), false, 'strenge Regel der Analyse')
assert.deepEqual(await an.analyseEligibility('c9', 'p9'), { ok: false, reason: 'kein_abo' })
await assert.rejects(an.activateAnalyse({ customerId: 'c9', projectId: 'p9', ...cust() }), { status: 403 })
assert.equal(puts.length, 0)
})