Übernahmegutschrift: Verrechnung nach Wechsel, Mail K09, Leitfaden, Admin zeigt das Abo, Tests
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
0c2e50fc20
commit
e456c3de69
9 files changed
+80
-23
No files matched your search
@@ -42,8 +42,8 @@ a{color:#111111;}
|
||||
<tr><td class="px" style="padding:24px 40px 0 40px;"><table role="presentation" class="box" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f7f6f3;border:1px solid #e8e6e0;border-radius:12px;"><tr><td class="ink" style="padding:20px 22px;font-family:Arial,Helvetica,sans-serif;font-size:14px;line-height:21px;color:#111111;"><div class="ink" style="font-size:16px;line-height:25px;color:#111111;">{{anmerkung}}</div></td></tr></table></td></tr>
|
||||
<!-- ENDE anmerkung -->
|
||||
|
||||
<tr><td class="px mut" style="padding:24px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:25px;mso-line-height-rule:exactly;color:#4a4843;">Die Gutschrift verrechnen wir automatisch mit den nächsten Monatsgebühren Ihres Wartungs-Abos. Auf Ihren Rechnungen erscheint sie als angerechnetes Guthaben.</td></tr>
|
||||
<tr><td class="px mut" style="padding:12px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:20px;mso-line-height-rule:exactly;color:#6b6964;">Eine Auszahlung ist nicht möglich; ein bei Vertragsende noch nicht verrechneter Rest entfällt.</td></tr>
|
||||
<tr><td class="px mut" style="padding:24px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:25px;mso-line-height-rule:exactly;color:#4a4843;">Die Gutschrift verrechnen wir automatisch mit den nächsten Monatsgebühren Ihres Abos. Auf Ihren Rechnungen erscheint sie als angerechnetes Guthaben.</td></tr>
|
||||
<tr><td class="px mut" style="padding:12px 40px 0 40px;font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:20px;mso-line-height-rule:exactly;color:#6b6964;">Eine Auszahlung ist nicht möglich. Wechseln Sie in ein anderes Abo, verrechnen wir die Gutschrift weiter; endet Ihr Abo ohne einen solchen Wechsel, entfällt ein noch nicht verrechneter Rest.</td></tr>
|
||||
<tr><td class="px ink" style="padding:28px 40px 44px 40px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:24px;color:#111111;">Viele Grüße<br><strong>Ihr WEBklar-Team</strong></td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { domainToASCII, domainToUnicode } from 'node:url'
|
||||
import { config } from '../config.js'
|
||||
import { createDocument, getDocument, listDocuments, Query, updateDocument } from './appwriteAdmin.js'
|
||||
import { sendAdminNotice, sendCustomerMail } from './mailer.js'
|
||||
import { getProduct } from './products.js'
|
||||
import { getProduct, PRODUCT_KEYS } from './products.js'
|
||||
import { ACTIVE_STATUSES, getCurrentSubscription, getStripe, isStripeConfigured } from './stripeBilling.js'
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ export const STATUS = {
|
||||
export const SERVICE_LABELS = {
|
||||
domain: 'Domain',
|
||||
hosting: 'Hosting / Website-Betrieb',
|
||||
email: 'E-Mail-Postfach',
|
||||
email: 'E-Mail-Postfächer',
|
||||
sonstiges: 'Sonstiges',
|
||||
}
|
||||
|
||||
@@ -349,6 +349,8 @@ function withHistory(doc, entry) {
|
||||
|
||||
const serviceStartOf = (sub) => sub?.trialEnd || sub?.startedAt || null
|
||||
const isActiveSub = (sub) => Boolean(sub && ACTIVE_STATUSES.has(sub.status))
|
||||
// Produkt des Abos: Altbestand ohne productKey und unbekannte Schluessel gelten als Wartungs-Abo
|
||||
const productKeyOf = (sub) => (PRODUCT_KEYS.includes(sub?.productKey) ? sub.productKey : 'wartung')
|
||||
|
||||
export async function getTakeoverRequest(id) {
|
||||
return getDocument(COLLECTION(), id)
|
||||
@@ -638,9 +640,9 @@ export async function runAutoChecks(doc, { allRequests, subscription, calc }) {
|
||||
)
|
||||
}
|
||||
|
||||
// Plausibilitaet gegen die Monatsgebuehr des Abos des Kunden; Abos ohne productKey (Altbestand) gelten als Wartungs-Abo
|
||||
// Plausibilitaet gegen die Monatsgebuehr des Abos des Kunden (productKeyOf: ohne bzw. mit unbekanntem Schluessel = Wartungs-Abo)
|
||||
const monthly = doc.invoiceAmountCents / Math.max(1, doc.billingMonths)
|
||||
const aboCents = getProduct(subscription?.productKey || 'wartung').amountCents
|
||||
const aboCents = getProduct(productKeyOf(subscription)).amountCents
|
||||
if (monthly > aboCents) {
|
||||
checks.push({
|
||||
key: 'amount',
|
||||
@@ -735,6 +737,8 @@ export async function getAdminDetail(id) {
|
||||
? {
|
||||
status: subscription.status,
|
||||
active: isActiveSub(subscription),
|
||||
productKey: productKeyOf(subscription),
|
||||
productName: getProduct(productKeyOf(subscription)).name,
|
||||
startedAt: subscription.startedAt,
|
||||
serviceStart: serviceStartOf(subscription),
|
||||
currentPeriodEnd: subscription.currentPeriodEnd,
|
||||
|
||||
Reference in new issue
Block a user