5f5b528db5
Validate e-invoices / mustang (push) Successful in 23s
One-off script (sample seller data, writes to /tmp) used to produce the embedded-XML sample for the e-invoicing showcase/marketing post. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { InvoiceService } from "@e-invoice-eu/core";
|
|
import { buildEInvoiceData } from "../src/einvoice/buildEInvoiceData.js";
|
|
import { SAMPLE_INVOICE_ORDER } from "../src/invoicePdf.js";
|
|
import type { InvoiceSeller } from "../src/seller.js";
|
|
|
|
const seller: InvoiceSeller = {
|
|
sellerName: "einfach produktiv",
|
|
sellerStreet: "Musterstraße 1",
|
|
sellerZip: "10115",
|
|
sellerCity: "Berlin",
|
|
sellerCountry: "Deutschland",
|
|
sellerEmail: "hallo@einfach-produktiv.de",
|
|
vatId: "DE123456789",
|
|
taxRatePercent: 19,
|
|
iban: "DE89370400440532013000",
|
|
bic: "COBADEFFXXX",
|
|
};
|
|
|
|
const invoiceData = buildEInvoiceData(SAMPLE_INVOICE_ORDER, seller);
|
|
const service = new InvoiceService(console);
|
|
|
|
async function main() {
|
|
const xml = await service.generate(invoiceData, { format: "CII", lang: "de" });
|
|
if (typeof xml !== "string") throw new Error("expected string");
|
|
const fs = await import("node:fs/promises");
|
|
await fs.writeFile("/tmp/showcase-invoice.xml", xml);
|
|
console.log("wrote /tmp/showcase-invoice.xml,", xml.length, "bytes");
|
|
}
|
|
|
|
main();
|