feat(email): split invoice email into paid/unpaid variants
Persist paymentStatus on the Invoice at generation time and use it at send
time to pick the default email body. Paid orders (paid/refunded/voided) now
get a body without the bank-transfer reference hint; outstanding orders keep
it. Custom merchant templates still override the defaults for both cases.
- Add Invoice.paymentStatus column + migration
- Split DEFAULT_EMAIL_BODY_{DE,EN} into _PAID/_UNPAID variants
- Persist paymentStatus in generateInvoice; select default in email.server
- Document behaviour on the settings page
- Add email-templates test (paid omits hint, unpaid keeps it)
This commit is contained in:
@@ -141,7 +141,12 @@ model Invoice {
|
||||
|
||||
// Snapshots (JSON strings on sqlite)
|
||||
totalsJson String @default("{}")
|
||||
customerJson String @default("{}")
|
||||
customerJson String @default("")
|
||||
|
||||
// Payment state at generation time ("paid" | "partial" | "unpaid" |
|
||||
// "refunded" | "voided"). Used to pick the paid/unpaid email template at
|
||||
// send time. Empty for legacy rows → treated as "unpaid".
|
||||
paymentStatus String @default("")
|
||||
|
||||
// Lifecycle
|
||||
issuedAt DateTime @default(now())
|
||||
|
||||
Reference in New Issue
Block a user