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:
Marco
2026-07-30 11:14:18 +00:00
parent f0b2d21989
commit 18f5156fd8
4 changed files with 68 additions and 32 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ export async function sendConfirmedPaymentEmail(order: ConfirmPaymentOrderSnapsh
const { customerEmail, ...emailData } = order;
try {
if (order.paymentSwitchedAt) {
await sendPaymentSwitchedEmail(order.orderNumber, customerEmail);
await sendPaymentSwitchedEmail(emailData, customerEmail);
} else {
await sendOrderConfirmationEmail(emailData, customerEmail);
}