feat(invoice): per-line + cart discounts, fulfillment delivery date, pickup label, header layout refresh

- discounts: read discountedUnitPriceSet (per-line) and discountCode/discountCodes
  (order-level) from Shopify; render discounted unit price with strikethrough
  original on the invoice line and add a 'Rabattcode'/'Discount code' meta row
  when codes were used.
- delivery date: pick the latest fulfillment.createdAt for §11 UStG instead of
  hard-coding processedAt; fall back to invoice date when unfulfilled.
- pickup: detect Shopify Local Pickup (and 'Abholung'/'Pickup' custom rates) via
  shippingLine.source/code/title; suppress the pickup-location 'shipping address'
  block and render localized 'Abholung'/'Pick-up' as the shipping method.
- layout: move the company logo to the top-left and the meta block to the
  top-right, putting recipient (and any separate delivery address) on its own
  row below; drop the standalone invoice-/order-number meta rows and surface
  them inside the title (e.g. 'Rechnung Nr. RE-1004 · Bestellnummer: #1004') to
  recover vertical space.
- tests: smoke fixtures cover discount, pickup, and fulfillment-date variants
  without disturbing the AT B2B totals.
This commit is contained in:
Gerhard Scheikl
2026-05-15 13:59:08 +02:00
parent 8780b4a68a
commit 415a9dd462
7 changed files with 297 additions and 37 deletions
+6
View File
@@ -63,6 +63,8 @@ export interface InvoiceStrings {
shippingMethodLabel: string;
trackingLabel: string;
shippingItemPrefix: string;
discountCodeLabel: string;
pickupLabel: string;
}
/** Status displayed for the order's payment, derived from Shopify's
@@ -163,6 +165,8 @@ const de: InvoiceStrings = {
shippingMethodLabel: "Versandart",
trackingLabel: "Sendungsnummer",
shippingItemPrefix: "Versand",
discountCodeLabel: "Rabattcode",
pickupLabel: "Abholung",
};
const en: InvoiceStrings = {
@@ -230,6 +234,8 @@ const en: InvoiceStrings = {
shippingMethodLabel: "Shipping method",
trackingLabel: "Tracking no.",
shippingItemPrefix: "Shipping",
discountCodeLabel: "Discount code",
pickupLabel: "Pick-up",
};
// Locale → invoice language. We only render in German (`de`) when the