Abo: Uebernahmegutschrift fuer beim Altanbieter bezahlte Leistungen
- Kunde (Dashboard, nur mit laufendem Abo): Antrag mit Leistung, Anbieter, Domain, Rechnungsbetrag/-zeitraum, Grund, Rechnungsnachweis (PDF/JPG/PNG) und E-Mail fuer die Antwort; Eingangsbestaetigung per Mail, Status und Antwort auf Rueckfragen im Portal - Admin-Mail mit Link admin.html?gutschrift=<id> (Login leitet zurueck) - Admin-Tab "Gutschriften": Kunde und Vertrag, Nachweise, Verlauf, automatische Pruefungen (Duplikate per Datei-Hash/Domain, Abo, Zeitraum, DNS-Abgleich Nameserver/MX mit Anbieter), Pflicht-Checkliste, Rechner (tagesgenau anteilig), Genehmigen/Rueckfrage/Ablehnen mit Kundenmail - Genehmigte Gutschrift als Stripe-Kundenguthaben (idempotent, Nachbuchen bei Stripe-Stoerung) - Nachweise in upload-data/ (gitignored), Loeschung abgelehnter nach 6 Monaten - Stundenkontingent auch fuer Monate, die ein Guthaben komplett deckt (invoice.total statt amount_paid) - Datenschutzerklaerung Abschnitt 7 ergaenzt, PDF neu erzeugt - Collection takeoverCredits in setup-abo-collections.mjs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dbabbf1c0b
commit
48b13f4488
14 files changed
+2040
-9
No files matched your search
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Wartungs-Abo: legt die Collections subscriptions + hourCredits in woms-database an
|
||||
* und ergaenzt worksheets um das Flag countsToPlan ("zaehlt aufs Abo-Stundenkonto").
|
||||
* Wartungs-Abo: legt die Collections subscriptions, hourCredits und takeoverCredits
|
||||
* (Uebernahmegutschriften) in woms-database an und ergaenzt worksheets um das Flag
|
||||
* countsToPlan ("zaehlt aufs Abo-Stundenkonto").
|
||||
* Idempotent: existierende Collection/Attribute/Indexe werden uebersprungen.
|
||||
* Usage (im Container): docker exec -w /app webklar-kundenbereich-server node scripts/setup-abo-collections.mjs
|
||||
*/
|
||||
@@ -134,6 +135,44 @@ await ensureCollection(
|
||||
[{ key: 'idx_customer', type: 'key', attributes: ['customerId'] }]
|
||||
)
|
||||
|
||||
// Uebernahmegutschrift: Antrag (Kunde) -> Pruefung/Entscheidung (Admin) -> Verrechnung (Stripe-Guthaben).
|
||||
// Lange Texte mit size > 16381 werden in Appwrite zu TEXT-Spalten und zaehlen nicht zur Zeilenbreite.
|
||||
await ensureCollection(
|
||||
'takeoverCredits',
|
||||
'Uebernahmegutschriften',
|
||||
[
|
||||
{ type: 'string', key: 'customerId', size: 64 },
|
||||
{ type: 'string', key: 'email', size: 255 },
|
||||
{ type: 'string', key: 'services', size: 128 },
|
||||
{ type: 'string', key: 'provider', size: 200 },
|
||||
{ type: 'string', key: 'domain', size: 255 },
|
||||
{ type: 'integer', key: 'invoiceAmountCents' },
|
||||
{ type: 'integer', key: 'billingMonths' },
|
||||
{ type: 'datetime', key: 'paidUntil' },
|
||||
{ type: 'string', key: 'message', size: 20000 },
|
||||
{ type: 'string', key: 'files', size: 20000 },
|
||||
{ type: 'string', key: 'status', size: 20 },
|
||||
{ type: 'string', key: 'history', size: 60000 },
|
||||
{ type: 'datetime', key: 'takeoverFrom' },
|
||||
{ type: 'integer', key: 'amountCents' },
|
||||
{ type: 'string', key: 'calculation', size: 1000 },
|
||||
{ type: 'string', key: 'checks', size: 1000 },
|
||||
{ type: 'string', key: 'decisionNote', size: 20000 },
|
||||
{ type: 'datetime', key: 'decidedAt' },
|
||||
{ type: 'string', key: 'decidedBy', size: 255 },
|
||||
{ type: 'string', key: 'stripeCustomerId', size: 64 },
|
||||
{ type: 'string', key: 'stripeBalanceTransactionId', size: 64 },
|
||||
{ type: 'datetime', key: 'appliedAt' },
|
||||
{ type: 'string', key: 'conditionsVersion', size: 32 },
|
||||
{ type: 'datetime', key: 'consentAt' },
|
||||
{ type: 'string', key: 'consentIp', size: 64 },
|
||||
],
|
||||
[
|
||||
{ key: 'idx_customer', type: 'key', attributes: ['customerId'] },
|
||||
{ key: 'idx_status', type: 'key', attributes: ['status'] },
|
||||
]
|
||||
)
|
||||
|
||||
// Worksheet-Flag: nur markierte Arbeitszeit wird vom Abo-Guthaben abgezogen
|
||||
await ensure('worksheets.countsToPlan', () =>
|
||||
aw(`${col('worksheets')}/attributes/boolean`, {
|
||||
|
||||
Reference in new issue
Block a user