feat(invoice): informal German tone + show payment method and status
- i18n.de: switch Sie/Ihren to du/dein for salutation, thank-you line, customer-VAT label and payment-terms paragraph. Closing line was already informal. - i18n: add paymentMethodLabel/paymentStatusLabel + per-status labels (paid/unpaid/partial/refunded) for both DE and EN, plus derivePaymentStatus helper that condenses Shopify's displayFinancialStatus (PAID, PARTIALLY_PAID, REFUNDED, …) into a 4-value enum. - loadOrderForInvoice: query Order.paymentGatewayNames and propagate it on the raw view-model. - composeInvoice + types: expose paymentStatus + paymentGatewayNames on InvoiceViewModel (filtered/trimmed). loadDraftOrderForOffer keeps paymentGatewayNames empty (drafts have no gateway yet). - InvoiceDocument: render two new meta rows on real invoices — 'Zahlart / Payment method' (joined, prettified gateway names) and 'Zahlstatus / Payment status' (translated label). Storno + offer kinds intentionally omit them. - scripts/render-sample.ts: extend smoke checks to assert the informal DE wording, the new payment-method/status rows and the paymentStatus/paymentGatewayNames composer outputs.
This commit is contained in:
@@ -11,7 +11,7 @@ import type {
|
||||
VatBreakdownEntry,
|
||||
} from "./types";
|
||||
import { addDays } from "./format";
|
||||
import { pickLanguage, type InvoiceLanguage } from "./i18n";
|
||||
import { derivePaymentStatus, pickLanguage, type InvoiceLanguage } from "./i18n";
|
||||
|
||||
interface ComposeArgs {
|
||||
order: RawOrderForInvoice;
|
||||
@@ -69,6 +69,10 @@ export function composeInvoice({
|
||||
: undefined;
|
||||
|
||||
const paid = (order.displayFinancialStatus || "").toUpperCase() === "PAID";
|
||||
const paymentStatus = derivePaymentStatus(order.displayFinancialStatus);
|
||||
const paymentGatewayNames = (order.paymentGatewayNames ?? []).filter(
|
||||
(n) => typeof n === "string" && n.trim().length > 0,
|
||||
);
|
||||
|
||||
if (storno) {
|
||||
lines = lines.map((l) => ({
|
||||
@@ -107,6 +111,8 @@ export function composeInvoice({
|
||||
totals,
|
||||
notices,
|
||||
paid,
|
||||
paymentStatus,
|
||||
paymentGatewayNames,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user