Attach the invoice PDF to the payment-method-switched email, brand-tone copy
buildInvoiceAttachment() extracted out of sendOrderConfirmationEmail() so sendPaymentSwitchedEmail() can reuse the same invoice-PDF generation instead of duplicating it — the invoiceNumber stays the same, but paymentMethodTitle now reflects the confirmed instrument, which flips the PDF's own paid/unpaid display, so re-attaching a fresh copy matters here even though nothing else about the order changed. Default fallback copy replaced with brand-toned wording matching the existing order-confirmation fallback's voice, instead of a flat system-notice tone.
This commit is contained in:
@@ -2104,9 +2104,21 @@ switching an existing Überweisung order to Stripe, not a fresh gated
|
||||
checkout — see the Payload backend's own README on
|
||||
`switchPaymentToStripeEndpoint`). Same shape as the order-status emails
|
||||
(icon + admin-editable heading/bodyText + "Bestellung ansehen" button via
|
||||
`renderOrderStatusHtml`), no item table or invoice re-attachment — the
|
||||
invoice itself didn't change, only how it got paid, and the customer
|
||||
already received the full order-confirmation email once already. New
|
||||
`renderOrderStatusHtml`), no item table, but **does** re-attach a freshly
|
||||
generated invoice PDF — same `invoiceNumber` as always (never re-issued
|
||||
for a switch), but `paymentMethodTitle` now reflects the actually-
|
||||
confirmed instrument, which changes `@einfach-produktiv/invoicing`'s own
|
||||
`isPaidImmediately()` check from the Vorkasse notice to "✓ Bereits
|
||||
beglichen", so the customer's copy of "their invoice" should reflect
|
||||
that. `buildInvoiceAttachment()` was extracted out of
|
||||
`sendOrderConfirmationEmail()` so both senders share the exact same PDF-
|
||||
generation call instead of duplicating that ~40-line object literal.
|
||||
Default fallback copy (used whenever no admin template is saved/active)
|
||||
matches the existing brand voice (`sendOrderConfirmationEmail`'s own
|
||||
"Bestellt! Deine Ruhe kann kommen 🎉" fallback) rather than a flat
|
||||
system-notice tone: *"Erledigt! Deine Zahlung ist da 🎉" / "Deine Zahlung
|
||||
ist gerade bei uns eingetrudelt — ab jetzt läuft alles automatisch
|
||||
weiter, du musst dich um nichts mehr kümmern."* New
|
||||
`payment-method-switched` `EmailTemplateType`, added to
|
||||
`/email-preview`'s valid types too.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user