Files
template-app/modules/invoicing/__tests__/fixture.ts
T
2026-11-14 09:56:45 +00:00

72 lines
1.9 KiB
TypeScript

// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
import type { InvoiceTerms, InvoiceView } from "../contract/index.js"
export const id = "01900000-0000-7000-8000-000000000001"
export const invoiceId = `inv_${id}`
export const seriesId = `ser_${id}`
export const terms: InvoiceTerms = {
type_code: "380",
series_id: seriesId,
issue_date: "2026-11-03",
currency: "EUR",
buyer_reference: "Synthetic-order",
seller: {
reference: `conusai://crm/parties/pty_${id}`,
name: "Synthetic Seller",
vat_identifier: { scheme: "vat", value: "LT100000001" },
endpoint: { scheme: "0088", value: "1234567890128" },
address: { country: "LT", city: "Synthetic city" },
},
buyer: {
reference: `conusai://crm/parties/pty_${id}`,
name: "Synthetic Buyer",
endpoint: { scheme: "0088", value: "1234567890128" },
address: { country: "LT" },
},
lines: [
{
item_name: "Synthetic item",
quantity: "2",
unit: "C62",
net_price: { currency: "EUR", amount: "9007199254740993.123456789012345678" },
vat_category: "S",
vat_rate: "21",
},
],
}
export const row: InvoiceView = {
invoiceId,
revision: "9007199254740993",
status: "draft",
number: null,
data: terms,
payable: { currency: "EUR", amount: "18014398509481986.246913578024691356" },
deleted: false,
erased: false,
}
export const raw = () => ({
id: invoiceId,
revision: "RAW_REVISION",
status: "draft",
number: null,
data: { ...terms, lines: terms.lines.map((line) => ({ ...line, quantity: 2 })) },
calculated: {
line_nets: [],
totals: Object.fromEntries(
[
"allowance",
"charge",
"line_extension",
"payable",
"prepaid",
"rounding",
"tax",
"tax_exclusive",
"tax_inclusive",
].map((key) => [key, row.payable]),
),
vat_breakdown: [],
},
deleted: false,
erased: false,
})