@kreiseck/kasseneck-api 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/README.md +37 -2
- package/dist/cjs/client/errors.d.ts +0 -1
- package/dist/cjs/client/errors.js +24 -1
- package/dist/cjs/rechnung/api.d.ts +3 -1
- package/dist/cjs/rechnung/api.js +1 -0
- package/dist/cjs/rechnung/endpunkte.d.ts +12 -1
- package/dist/cjs/rechnung/endpunkte.js +56 -3
- package/dist/cjs/rechnung/index.d.ts +4 -3
- package/dist/cjs/rechnung/index.js +7 -1
- package/dist/cjs/rechnung/summen.d.ts +41 -0
- package/dist/cjs/rechnung/summen.js +81 -0
- package/dist/cjs/rechnung/texte.d.ts +19 -0
- package/dist/cjs/rechnung/texte.js +40 -0
- package/dist/cjs/rechnung/typen.d.ts +71 -9
- package/dist/cjs/rechnung/vertrag.d.ts +78 -3
- package/dist/cjs/rechnung/vertrag.js +82 -4
- package/dist/esm/client/errors.d.ts +0 -1
- package/dist/esm/client/errors.js +24 -1
- package/dist/esm/rechnung/api.d.ts +3 -1
- package/dist/esm/rechnung/api.js +2 -1
- package/dist/esm/rechnung/endpunkte.d.ts +12 -1
- package/dist/esm/rechnung/endpunkte.js +55 -3
- package/dist/esm/rechnung/index.d.ts +4 -3
- package/dist/esm/rechnung/index.js +3 -2
- package/dist/esm/rechnung/summen.d.ts +41 -0
- package/dist/esm/rechnung/summen.js +77 -0
- package/dist/esm/rechnung/texte.d.ts +19 -0
- package/dist/esm/rechnung/texte.js +40 -0
- package/dist/esm/rechnung/typen.d.ts +71 -9
- package/dist/esm/rechnung/vertrag.d.ts +78 -3
- package/dist/esm/rechnung/vertrag.js +81 -3
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/kasse-texte.json +1 -1
- package/fixtures/oberflaeche.json +27 -4
- package/fixtures/rechnung-api.schema.json +42 -4
- package/fixtures/rechnung-summen.json +154 -0
- package/fixtures/rechnung-texte.json +39 -1
- package/package.json +1 -1
|
@@ -39,6 +39,33 @@ function seite(aufruf, daten, feld) {
|
|
|
39
39
|
return { eintraege: o[feld], nextCursor: typeof o['nextCursor'] === 'string' ? o['nextCursor'] : null };
|
|
40
40
|
}
|
|
41
41
|
const zahl = (wert) => (typeof wert === 'number' && Number.isFinite(wert) ? wert : 0);
|
|
42
|
+
/**
|
|
43
|
+
* Die Hinweise einer Antwort (`data.notice`) — immer eine Liste, `undefined`
|
|
44
|
+
* ohne Hinweis. Ein einzelnes Objekt (Server vor der Vereinheitlichung) wird
|
|
45
|
+
* zur Liste.
|
|
46
|
+
*
|
|
47
|
+
* Ein unbrauchbarer Eintrag wird uebergangen, nicht geworfen: der Aufruf hat
|
|
48
|
+
* schon gewirkt (die Rechnung ist ausgestellt, die Zahlung gebucht). Ein
|
|
49
|
+
* Fehler an dieser Stelle liesse den Aufrufer glauben, es sei nichts
|
|
50
|
+
* entstanden — und eine Wiederholung liefert die Hinweise nicht noch einmal.
|
|
51
|
+
*/
|
|
52
|
+
function hinweise(daten) {
|
|
53
|
+
const roh = objekt(daten)['notice'];
|
|
54
|
+
if (roh === undefined || roh === null)
|
|
55
|
+
return undefined;
|
|
56
|
+
const liste = (Array.isArray(roh) ? roh : [roh]).filter((h) => typeof objekt(h)['code'] === 'string' && typeof objekt(h)['message'] === 'string');
|
|
57
|
+
return liste.length ? liste : undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Eine Kennung muss ein Objekt sein (`{ invoiceId }`, `{ customerId }` …). Ein
|
|
61
|
+
* blosser Text wuerde sonst Zeichen fuer Zeichen zu Feldern `0`, `1`, …
|
|
62
|
+
* zerlegt, und der Server koennte nur „Bitte Eingaben pruefen" antworten.
|
|
63
|
+
*/
|
|
64
|
+
function kennungVerlangen(aufruf, kennung, felder) {
|
|
65
|
+
if (kennung === null || typeof kennung !== 'object' || Array.isArray(kennung)) {
|
|
66
|
+
throw new KasseneckValidationError(aufruf, `Kennung als Objekt erwartet: ${felder}`, 'request');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
42
69
|
/** Anfrageobjekt als Nutzlast — flache Kopie, damit der Aufrufer sein Objekt behaelt. */
|
|
43
70
|
const nutzlast = (anfrage) => ({ ...anfrage });
|
|
44
71
|
// ---- Kunden -----------------------------------------------------------------
|
|
@@ -50,6 +77,7 @@ export async function createCustomer(rufen, customer, optionen = {}) {
|
|
|
50
77
|
return pflichtObjekt('createCustomer', daten, 'customer');
|
|
51
78
|
}
|
|
52
79
|
export async function getCustomer(rufen, kennung) {
|
|
80
|
+
kennungVerlangen('getCustomer', kennung, '{ customerId } oder { externalId }');
|
|
53
81
|
const daten = await rufen('getCustomer', nutzlast(kennung));
|
|
54
82
|
return pflichtObjekt('getCustomer', daten, 'customer');
|
|
55
83
|
}
|
|
@@ -65,10 +93,32 @@ export async function searchCustomers(rufen, suche) {
|
|
|
65
93
|
// ---- Rechnungen -------------------------------------------------------------
|
|
66
94
|
export async function issueInvoice(rufen, anfrage) {
|
|
67
95
|
const daten = await rufen('issueInvoice', nutzlast(anfrage));
|
|
68
|
-
|
|
96
|
+
const ergebnis = {
|
|
69
97
|
invoice: pflichtObjekt('issueInvoice', daten, 'invoice'),
|
|
70
98
|
replayed: objekt(daten)['replayed'] === true,
|
|
71
99
|
};
|
|
100
|
+
const notice = hinweise(daten);
|
|
101
|
+
if (notice)
|
|
102
|
+
ergebnis.notice = notice;
|
|
103
|
+
return ergebnis;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Probelauf von `issueInvoice`: dieselbe Anfrage wird geprueft und gerechnet
|
|
107
|
+
* wie beim Ausstellen, aber nichts festgeschrieben. Die Antwort nennt Summen,
|
|
108
|
+
* Steuerfall, Sprache, Marke und die Hinweise — oder scheitert mit demselben
|
|
109
|
+
* Fehlercode, mit dem das Ausstellen scheitern wuerde.
|
|
110
|
+
*
|
|
111
|
+
* Der `idempotencyKey` wird nicht verbraucht: dieselbe Anfrage laesst sich
|
|
112
|
+
* danach unveraendert ausstellen. Verbindlich ist das Ausstellen — zwischen
|
|
113
|
+
* Probelauf und Ausstellen kann sich der Kunde oder das Konto aendern.
|
|
114
|
+
*/
|
|
115
|
+
export async function previewInvoice(rufen, anfrage) {
|
|
116
|
+
const daten = await rufen('issueInvoice', { ...nutzlast(anfrage), dryRun: true });
|
|
117
|
+
const ergebnis = { preview: pflichtObjekt('issueInvoice', daten, 'preview') };
|
|
118
|
+
const notice = hinweise(daten);
|
|
119
|
+
if (notice)
|
|
120
|
+
ergebnis.notice = notice;
|
|
121
|
+
return ergebnis;
|
|
72
122
|
}
|
|
73
123
|
export async function cancelInvoice(rufen, anfrage) {
|
|
74
124
|
const daten = await rufen('cancelInvoice', nutzlast(anfrage));
|
|
@@ -88,6 +138,7 @@ export async function createCreditNote(rufen, anfrage) {
|
|
|
88
138
|
};
|
|
89
139
|
}
|
|
90
140
|
export async function getInvoice(rufen, kennung) {
|
|
141
|
+
kennungVerlangen('getInvoice', kennung, '{ invoiceId } oder { number }');
|
|
91
142
|
const daten = await rufen('getInvoice', nutzlast(kennung));
|
|
92
143
|
return pflichtObjekt('getInvoice', daten, 'invoice');
|
|
93
144
|
}
|
|
@@ -143,8 +194,9 @@ export async function recordInvoicePayment(rufen, anfrage) {
|
|
|
143
194
|
payment: pflichtObjekt('recordInvoicePayment', daten, 'payment'),
|
|
144
195
|
replayed: roh['replayed'] === true,
|
|
145
196
|
};
|
|
146
|
-
|
|
147
|
-
|
|
197
|
+
const notice = hinweise(daten);
|
|
198
|
+
if (notice)
|
|
199
|
+
ergebnis.notice = notice;
|
|
148
200
|
return ergebnis;
|
|
149
201
|
}
|
|
150
202
|
/** Die Marken des Kontos — die Kennung geht als `brandId` in `issueInvoice`. */
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
export { createRechnungApi, type RechnungApi, type RechnungApiOptions } from './api.js';
|
|
14
14
|
export { rechnungKeyAuth, type RechnungKeyAuthOptions } from './auth.js';
|
|
15
15
|
export { istRechnungFehler, rechnungFehlerCode, rechnungFeldFehler, type RechnungFeldFehler, } from './fehler.js';
|
|
16
|
-
export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
17
|
-
export type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, InvoiceNotice, InvoicePayment, IssueInvoiceRequest, IssueResult, PaymentInput, RecordPaymentRequest, RecordPaymentResult, } from './typen.js';
|
|
16
|
+
export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, previewInvoice, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
17
|
+
export type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, InvoiceNotice, InvoicePayment, InvoicePreview, InvoiceRateTotals, IssueInvoiceRequest, IssueResult, PaymentInput, PreviewResult, RecordPaymentRequest, RecordPaymentResult, } from './typen.js';
|
|
18
18
|
export { RECHNUNG_TEXTE, rechnungText, type RechnungTextSchluessel } from './texte.js';
|
|
19
|
-
export {
|
|
19
|
+
export { rechnungSummen, STEUERFREIE_FAELLE, type SummenPosition } from './summen.js';
|
|
20
|
+
export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, type RechnungAufruf, type InvoiceErrorCode, type CreditNoteReason, type TaxScheme, type PriceMode, type VatRatePercent, type CustomerType, type InvoiceListStatus, type DocType, type EInvoiceFormat, type InvoiceLanguage, type InvoicePaymentMethod, type ItemKind, type ReverseChargeReason, type InvoiceNoticeCode, type InvoiceUnit, type InvoiceSetupRequirement, type Format, type Feld, } from './vertrag.js';
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
export { createRechnungApi } from './api.js';
|
|
14
14
|
export { rechnungKeyAuth } from './auth.js';
|
|
15
15
|
export { istRechnungFehler, rechnungFehlerCode, rechnungFeldFehler, } from './fehler.js';
|
|
16
|
-
export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
16
|
+
export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, previewInvoice, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
17
17
|
export { RECHNUNG_TEXTE, rechnungText } from './texte.js';
|
|
18
|
-
export {
|
|
18
|
+
export { rechnungSummen, STEUERFREIE_FAELLE } from './summen.js';
|
|
19
|
+
export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, } from './vertrag.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summen einer Rechnung vorab rechnen — genau so, wie der Server sie beim
|
|
3
|
+
* Ausstellen rechnet. Fuer Shops, die kassieren, bevor die Rechnung entsteht,
|
|
4
|
+
* und denselben Betrag brauchen, den die Rechnung spaeter ausweist.
|
|
5
|
+
*
|
|
6
|
+
* Die Regel (je USt-Satz, Betraege in Cent, kaufmaennisch gerundet):
|
|
7
|
+
*
|
|
8
|
+
* | Modus | Netto | USt | Brutto |
|
|
9
|
+
* |---------|--------------------------------|----------------------------|--------------------|
|
|
10
|
+
* | `net` | round(Σ Zeilen) | round(Σ Zeilen × Satz/100) | Netto + USt |
|
|
11
|
+
* | `gross` | round(B × 100 / (100 + Satz)) | B − Netto | B = round(Σ Zeilen)|
|
|
12
|
+
*
|
|
13
|
+
* Zeile = Einzelpreis × Menge × (1 − Rabatt/100), ungerundet. Im Brutto-Modus
|
|
14
|
+
* ist das Brutto der vereinbarte Preis und bleibt, wie die Zeilen es ergeben.
|
|
15
|
+
* Bei einem steuerfreien Steuerfall zaehlt jede Zeile zu 0 %.
|
|
16
|
+
*
|
|
17
|
+
* `fixtures/rechnung-summen.json` haelt die Prueffaelle; Backend und
|
|
18
|
+
* Dart-Zwilling pruefen gegen dieselbe Datei. Verbindlich bleibt, was der
|
|
19
|
+
* Server rechnet — mit `previewInvoice` laesst sich das vorab abfragen.
|
|
20
|
+
*/
|
|
21
|
+
import type { InvoiceTotals } from './typen.js';
|
|
22
|
+
import type { PriceMode, TaxScheme } from './vertrag.js';
|
|
23
|
+
/** Was fuer die Summe zaehlt — `InvoiceItemInput` passt unveraendert. */
|
|
24
|
+
export interface SummenPosition {
|
|
25
|
+
quantity: number;
|
|
26
|
+
unitPriceCents: number;
|
|
27
|
+
vatRate: number;
|
|
28
|
+
discountPct?: number;
|
|
29
|
+
}
|
|
30
|
+
/** Steuerfaelle, in denen die Rechnung keine Steuer ausweist: jede Zeile zaehlt zu 0 %. */
|
|
31
|
+
export declare const STEUERFREIE_FAELLE: readonly TaxScheme[];
|
|
32
|
+
/**
|
|
33
|
+
* Netto, USt und Brutto einer Rechnung in Cent, je Satz absteigend — dieselbe
|
|
34
|
+
* Form wie `invoice.totals` in den Antworten.
|
|
35
|
+
*
|
|
36
|
+
* `taxScheme` ist der Steuerfall der Rechnung; ohne Angabe `normal`. Leitet der
|
|
37
|
+
* Server einen steuerfreien Fall ab (etwa eine ig. Lieferung), gehoert dieser
|
|
38
|
+
* Fall hierher — sonst rechnet die Funktion Steuer, die die Rechnung nicht
|
|
39
|
+
* ausweist.
|
|
40
|
+
*/
|
|
41
|
+
export declare function rechnungSummen(items: readonly SummenPosition[], priceMode: PriceMode, taxScheme?: TaxScheme): InvoiceTotals;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summen einer Rechnung vorab rechnen — genau so, wie der Server sie beim
|
|
3
|
+
* Ausstellen rechnet. Fuer Shops, die kassieren, bevor die Rechnung entsteht,
|
|
4
|
+
* und denselben Betrag brauchen, den die Rechnung spaeter ausweist.
|
|
5
|
+
*
|
|
6
|
+
* Die Regel (je USt-Satz, Betraege in Cent, kaufmaennisch gerundet):
|
|
7
|
+
*
|
|
8
|
+
* | Modus | Netto | USt | Brutto |
|
|
9
|
+
* |---------|--------------------------------|----------------------------|--------------------|
|
|
10
|
+
* | `net` | round(Σ Zeilen) | round(Σ Zeilen × Satz/100) | Netto + USt |
|
|
11
|
+
* | `gross` | round(B × 100 / (100 + Satz)) | B − Netto | B = round(Σ Zeilen)|
|
|
12
|
+
*
|
|
13
|
+
* Zeile = Einzelpreis × Menge × (1 − Rabatt/100), ungerundet. Im Brutto-Modus
|
|
14
|
+
* ist das Brutto der vereinbarte Preis und bleibt, wie die Zeilen es ergeben.
|
|
15
|
+
* Bei einem steuerfreien Steuerfall zaehlt jede Zeile zu 0 %.
|
|
16
|
+
*
|
|
17
|
+
* `fixtures/rechnung-summen.json` haelt die Prueffaelle; Backend und
|
|
18
|
+
* Dart-Zwilling pruefen gegen dieselbe Datei. Verbindlich bleibt, was der
|
|
19
|
+
* Server rechnet — mit `previewInvoice` laesst sich das vorab abfragen.
|
|
20
|
+
*/
|
|
21
|
+
/** Steuerfaelle, in denen die Rechnung keine Steuer ausweist: jede Zeile zaehlt zu 0 %. */
|
|
22
|
+
export const STEUERFREIE_FAELLE = Object.freeze([
|
|
23
|
+
'smallBusiness',
|
|
24
|
+
'reverseCharge',
|
|
25
|
+
'igLieferung',
|
|
26
|
+
'exportThirdCountry',
|
|
27
|
+
'domesticReverseCharge',
|
|
28
|
+
'outsideScope',
|
|
29
|
+
]);
|
|
30
|
+
/** Auf Cent gerundete Euro — dieselbe Rundung wie am Server (halber Cent vom Nullpunkt weg). */
|
|
31
|
+
function euroRund(n) {
|
|
32
|
+
return ((n < 0 ? -1 : 1) * Math.round((Math.abs(n) + Number.EPSILON) * 100)) / 100;
|
|
33
|
+
}
|
|
34
|
+
const euroZuCent = (euro) => Math.round(euroRund(euro) * 100) || 0;
|
|
35
|
+
/** Ganze Cent kaufmaennisch; ein Gleitkomma-Rest wie x,4999999… zaehlt als halber Cent. */
|
|
36
|
+
function centRund(x) {
|
|
37
|
+
const betrag = Math.round(Math.abs(x) * 1e6) / 1e6;
|
|
38
|
+
return (x < 0 ? -1 : 1) * Math.round(betrag) || 0;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Netto, USt und Brutto einer Rechnung in Cent, je Satz absteigend — dieselbe
|
|
42
|
+
* Form wie `invoice.totals` in den Antworten.
|
|
43
|
+
*
|
|
44
|
+
* `taxScheme` ist der Steuerfall der Rechnung; ohne Angabe `normal`. Leitet der
|
|
45
|
+
* Server einen steuerfreien Fall ab (etwa eine ig. Lieferung), gehoert dieser
|
|
46
|
+
* Fall hierher — sonst rechnet die Funktion Steuer, die die Rechnung nicht
|
|
47
|
+
* ausweist.
|
|
48
|
+
*/
|
|
49
|
+
export function rechnungSummen(items, priceMode, taxScheme = 'normal') {
|
|
50
|
+
const steuerfrei = STEUERFREIE_FAELLE.includes(taxScheme);
|
|
51
|
+
const bruttoPreise = priceMode === 'gross' && !steuerfrei;
|
|
52
|
+
// Ungerundete Zeilen je Satz, in Euro wie am Server.
|
|
53
|
+
const jeSatz = new Map();
|
|
54
|
+
for (const p of items) {
|
|
55
|
+
const satz = steuerfrei ? 0 : p.vatRate;
|
|
56
|
+
const zeile = (p.unitPriceCents / 100) * p.quantity * (1 - (p.discountPct ?? 0) / 100);
|
|
57
|
+
jeSatz.set(satz, (jeSatz.get(satz) ?? 0) + zeile);
|
|
58
|
+
}
|
|
59
|
+
const byRate = [];
|
|
60
|
+
for (const [rate, roh] of jeSatz) {
|
|
61
|
+
let netCents;
|
|
62
|
+
let vatCents;
|
|
63
|
+
if (bruttoPreise) {
|
|
64
|
+
const grossCents = euroZuCent(roh);
|
|
65
|
+
netCents = centRund((grossCents * 100) / (100 + rate));
|
|
66
|
+
vatCents = grossCents - netCents;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
netCents = euroZuCent(roh);
|
|
70
|
+
vatCents = euroZuCent((roh * rate) / 100);
|
|
71
|
+
}
|
|
72
|
+
byRate.push({ rate, netCents, vatCents, grossCents: netCents + vatCents });
|
|
73
|
+
}
|
|
74
|
+
byRate.sort((a, b) => b.rate - a.rate);
|
|
75
|
+
const summe = (feld) => byRate.reduce((s, r) => s + r[feld], 0);
|
|
76
|
+
return { netCents: summe('netCents'), vatCents: summe('vatCents'), grossCents: summe('grossCents'), byRate };
|
|
77
|
+
}
|
|
@@ -35,8 +35,12 @@ declare const DE: {
|
|
|
35
35
|
readonly 'pdf.tabelle.ust': "UST";
|
|
36
36
|
readonly 'pdf.tabelle.einzelNetto': "EINZEL NETTO";
|
|
37
37
|
readonly 'pdf.tabelle.betragNetto': "BETRAG NETTO";
|
|
38
|
+
readonly 'pdf.tabelle.einzelBrutto': "EINZEL BRUTTO";
|
|
39
|
+
readonly 'pdf.tabelle.betragBrutto': "BETRAG BRUTTO";
|
|
40
|
+
readonly 'pdf.position.rabatt': "abzüglich {prozent} % Rabatt";
|
|
38
41
|
readonly 'pdf.summe.zwischensumme': "Zwischensumme netto";
|
|
39
42
|
readonly 'pdf.summe.umsatzsteuer': "Umsatzsteuer {satz}%";
|
|
43
|
+
readonly 'pdf.summe.darinUst': "darin {satz}% USt von {netto} netto";
|
|
40
44
|
readonly 'pdf.summe.gesamt.rechnung': "Gesamtbetrag";
|
|
41
45
|
readonly 'pdf.summe.gesamt.gutschrift': "Gutschriftsbetrag";
|
|
42
46
|
readonly 'steuer.kleinunternehmer': "Gemäß § 6 Abs. 1 Z 27 UStG wird keine Umsatzsteuer verrechnet (Kleinunternehmer).";
|
|
@@ -46,6 +50,20 @@ declare const DE: {
|
|
|
46
50
|
readonly 'steuer.reverseCharge.titel': "Steuerschuldnerschaft des Leistungsempfängers. ";
|
|
47
51
|
readonly 'steuer.reverseCharge.text': "Übergang der Steuerschuld gem. Art. 196 MwSt-RL 2006/112/EG (innergemeinschaftliche Leistung). Die Leistung ist nicht steuerfrei — die Umsatzsteuer schuldet und entrichtet der Leistungsempfänger in seinem Land.";
|
|
48
52
|
readonly 'steuer.uidZeile': "UID Leistungserbringer: {verkaeufer} · UID Leistungsempfänger: {kaeufer}";
|
|
53
|
+
readonly 'steuer.rcGrund.construction': "Bauleistung gemäß § 19 Abs. 1a UStG.";
|
|
54
|
+
readonly 'steuer.rcGrund.scrap': "Schrott und Abfallstoffe gemäß Schrott-Umsatzsteuerverordnung (BGBl. II Nr. 129/2007).";
|
|
55
|
+
readonly 'steuer.rcGrund.mobile_devices': "Mobilfunkgeräte bzw. integrierte Schaltkreise gemäß § 19 Abs. 1e lit. b UStG.";
|
|
56
|
+
readonly 'steuer.rcGrund.it_devices': "Laptops, Tablets bzw. Videospielkonsolen gemäß § 2 Z 1 Umsatzsteuerbetrugsbekämpfungsverordnung (BGBl. II Nr. 369/2013).";
|
|
57
|
+
readonly 'steuer.rcGrund.metals': "Metalle gemäß § 2 Z 4 Umsatzsteuerbetrugsbekämpfungsverordnung.";
|
|
58
|
+
readonly 'steuer.rcGrund.emission_certificates': "Treibhausgasemissionszertifikate gemäß § 19 Abs. 1e lit. a UStG.";
|
|
59
|
+
readonly 'steuer.rcGrund.gas_electricity': "Lieferung von Gas oder Elektrizität an einen Wiederverkäufer gemäß § 2 Z 2 Umsatzsteuerbetrugsbekämpfungsverordnung.";
|
|
60
|
+
readonly 'steuer.rcGrund.energy_certificates': "Gas- und Elektrizitätszertifikate gemäß § 2 Z 3 Umsatzsteuerbetrugsbekämpfungsverordnung.";
|
|
61
|
+
readonly 'steuer.rcGrund.investment_gold': "Steuerpflichtige Lieferung von Anlagegold gemäß § 2 Z 5 Umsatzsteuerbetrugsbekämpfungsverordnung.";
|
|
62
|
+
readonly 'steuer.rcGrund.security_transfer': "Lieferung von Sicherungs- bzw. Vorbehaltseigentum gemäß § 19 Abs. 1b UStG.";
|
|
63
|
+
readonly 'steuer.rcGrund.foreign_supplier': "Leistung eines nicht im Inland ansässigen Unternehmers gemäß § 19 Abs. 1 zweiter Satz UStG.";
|
|
64
|
+
readonly 'steuer.domestic.text': "Die Umsatzsteuer schuldet und entrichtet der Leistungsempfänger. Die Leistung ist nicht steuerfrei.";
|
|
65
|
+
readonly 'steuer.outsideScope.titel': "Nicht steuerbarer Umsatz. ";
|
|
66
|
+
readonly 'steuer.outsideScope.text': "Der Leistungsort liegt gemäß § 3a Abs. 6 UStG im Ansässigkeitsstaat des Leistungsempfängers; in Österreich fällt keine Umsatzsteuer an.";
|
|
49
67
|
readonly 'pdf.zahlung.titel': "ZAHLUNGSINFORMATIONEN";
|
|
50
68
|
readonly 'pdf.zahlung.empfaenger': "Empfänger";
|
|
51
69
|
readonly 'pdf.zahlung.iban': "IBAN";
|
|
@@ -95,6 +113,7 @@ declare const DE: {
|
|
|
95
113
|
readonly 'einvoice.befreiung.reverseCharge': "Steuerschuldnerschaft des Leistungsempfängers (Reverse Charge)";
|
|
96
114
|
readonly 'einvoice.befreiung.kleinunternehmer': "Steuerbefreit — Kleinunternehmer gemäß §6 Abs. 1 Z 27 UStG";
|
|
97
115
|
readonly 'einvoice.befreiung.igLieferung': "Steuerfreie innergemeinschaftliche Lieferung gemäß Art. 6 Abs. 1 UStG";
|
|
116
|
+
readonly 'einvoice.befreiung.outsideScope': "Nicht steuerbarer Umsatz — Leistungsort im Ausland (§ 3a Abs. 6 UStG)";
|
|
98
117
|
readonly 'einvoice.befreiung.ausfuhr': "Steuerfreie Ausfuhrlieferung gemäß §6 Abs. 1 Z 1 UStG";
|
|
99
118
|
readonly 'einvoice.zahlbarBis': "Zahlbar bis {datum}";
|
|
100
119
|
readonly 'einheit.piece': "Stk";
|
|
@@ -20,8 +20,12 @@ const DE = {
|
|
|
20
20
|
'pdf.tabelle.ust': 'UST',
|
|
21
21
|
'pdf.tabelle.einzelNetto': 'EINZEL NETTO',
|
|
22
22
|
'pdf.tabelle.betragNetto': 'BETRAG NETTO',
|
|
23
|
+
'pdf.tabelle.einzelBrutto': 'EINZEL BRUTTO',
|
|
24
|
+
'pdf.tabelle.betragBrutto': 'BETRAG BRUTTO',
|
|
25
|
+
'pdf.position.rabatt': 'abzüglich {prozent} % Rabatt',
|
|
23
26
|
'pdf.summe.zwischensumme': 'Zwischensumme netto',
|
|
24
27
|
'pdf.summe.umsatzsteuer': 'Umsatzsteuer {satz}%',
|
|
28
|
+
'pdf.summe.darinUst': 'darin {satz}% USt von {netto} netto',
|
|
25
29
|
'pdf.summe.gesamt.rechnung': 'Gesamtbetrag',
|
|
26
30
|
'pdf.summe.gesamt.gutschrift': 'Gutschriftsbetrag',
|
|
27
31
|
'steuer.kleinunternehmer': 'Gemäß § 6 Abs. 1 Z 27 UStG wird keine Umsatzsteuer verrechnet (Kleinunternehmer).',
|
|
@@ -37,6 +41,22 @@ const DE = {
|
|
|
37
41
|
// Beide UID-Nummern: bei Reverse Charge § 11 Abs. 1a, bei der ig. Lieferung
|
|
38
42
|
// Art. 11 Abs. 2 UStG.
|
|
39
43
|
'steuer.uidZeile': 'UID Leistungserbringer: {verkaeufer} · UID Leistungsempfänger: {kaeufer}',
|
|
44
|
+
// Inlands-Reverse-Charge: je Grund ein Satz, der die Gesetzesstelle nennt —
|
|
45
|
+
// sie traegt den Hinweis nach § 11 Abs. 1a UStG.
|
|
46
|
+
'steuer.rcGrund.construction': 'Bauleistung gemäß § 19 Abs. 1a UStG.',
|
|
47
|
+
'steuer.rcGrund.scrap': 'Schrott und Abfallstoffe gemäß Schrott-Umsatzsteuerverordnung (BGBl. II Nr. 129/2007).',
|
|
48
|
+
'steuer.rcGrund.mobile_devices': 'Mobilfunkgeräte bzw. integrierte Schaltkreise gemäß § 19 Abs. 1e lit. b UStG.',
|
|
49
|
+
'steuer.rcGrund.it_devices': 'Laptops, Tablets bzw. Videospielkonsolen gemäß § 2 Z 1 Umsatzsteuerbetrugsbekämpfungsverordnung (BGBl. II Nr. 369/2013).',
|
|
50
|
+
'steuer.rcGrund.metals': 'Metalle gemäß § 2 Z 4 Umsatzsteuerbetrugsbekämpfungsverordnung.',
|
|
51
|
+
'steuer.rcGrund.emission_certificates': 'Treibhausgasemissionszertifikate gemäß § 19 Abs. 1e lit. a UStG.',
|
|
52
|
+
'steuer.rcGrund.gas_electricity': 'Lieferung von Gas oder Elektrizität an einen Wiederverkäufer gemäß § 2 Z 2 Umsatzsteuerbetrugsbekämpfungsverordnung.',
|
|
53
|
+
'steuer.rcGrund.energy_certificates': 'Gas- und Elektrizitätszertifikate gemäß § 2 Z 3 Umsatzsteuerbetrugsbekämpfungsverordnung.',
|
|
54
|
+
'steuer.rcGrund.investment_gold': 'Steuerpflichtige Lieferung von Anlagegold gemäß § 2 Z 5 Umsatzsteuerbetrugsbekämpfungsverordnung.',
|
|
55
|
+
'steuer.rcGrund.security_transfer': 'Lieferung von Sicherungs- bzw. Vorbehaltseigentum gemäß § 19 Abs. 1b UStG.',
|
|
56
|
+
'steuer.rcGrund.foreign_supplier': 'Leistung eines nicht im Inland ansässigen Unternehmers gemäß § 19 Abs. 1 zweiter Satz UStG.',
|
|
57
|
+
'steuer.domestic.text': 'Die Umsatzsteuer schuldet und entrichtet der Leistungsempfänger. Die Leistung ist nicht steuerfrei.',
|
|
58
|
+
'steuer.outsideScope.titel': 'Nicht steuerbarer Umsatz. ',
|
|
59
|
+
'steuer.outsideScope.text': 'Der Leistungsort liegt gemäß § 3a Abs. 6 UStG im Ansässigkeitsstaat des Leistungsempfängers; in Österreich fällt keine Umsatzsteuer an.',
|
|
40
60
|
'pdf.zahlung.titel': 'ZAHLUNGSINFORMATIONEN',
|
|
41
61
|
'pdf.zahlung.empfaenger': 'Empfänger',
|
|
42
62
|
'pdf.zahlung.iban': 'IBAN',
|
|
@@ -86,6 +106,7 @@ const DE = {
|
|
|
86
106
|
'einvoice.befreiung.reverseCharge': 'Steuerschuldnerschaft des Leistungsempfängers (Reverse Charge)',
|
|
87
107
|
'einvoice.befreiung.kleinunternehmer': 'Steuerbefreit — Kleinunternehmer gemäß §6 Abs. 1 Z 27 UStG',
|
|
88
108
|
'einvoice.befreiung.igLieferung': 'Steuerfreie innergemeinschaftliche Lieferung gemäß Art. 6 Abs. 1 UStG',
|
|
109
|
+
'einvoice.befreiung.outsideScope': 'Nicht steuerbarer Umsatz — Leistungsort im Ausland (§ 3a Abs. 6 UStG)',
|
|
89
110
|
'einvoice.befreiung.ausfuhr': 'Steuerfreie Ausfuhrlieferung gemäß §6 Abs. 1 Z 1 UStG',
|
|
90
111
|
'einvoice.zahlbarBis': 'Zahlbar bis {datum}',
|
|
91
112
|
'einheit.piece': 'Stk',
|
|
@@ -209,8 +230,12 @@ const EN = {
|
|
|
209
230
|
'pdf.tabelle.ust': 'VAT',
|
|
210
231
|
'pdf.tabelle.einzelNetto': 'UNIT NET',
|
|
211
232
|
'pdf.tabelle.betragNetto': 'AMOUNT NET',
|
|
233
|
+
'pdf.tabelle.einzelBrutto': 'UNIT GROSS',
|
|
234
|
+
'pdf.tabelle.betragBrutto': 'AMOUNT GROSS',
|
|
235
|
+
'pdf.position.rabatt': 'less {prozent}% discount',
|
|
212
236
|
'pdf.summe.zwischensumme': 'Subtotal net',
|
|
213
237
|
'pdf.summe.umsatzsteuer': 'VAT {satz}%',
|
|
238
|
+
'pdf.summe.darinUst': 'incl. {satz}% VAT on {netto} net',
|
|
214
239
|
'pdf.summe.gesamt.rechnung': 'Total',
|
|
215
240
|
'pdf.summe.gesamt.gutschrift': 'Credit total',
|
|
216
241
|
'steuer.kleinunternehmer': 'No VAT charged pursuant to § 6 (1) no. 27 UStG (small business exemption).',
|
|
@@ -220,6 +245,20 @@ const EN = {
|
|
|
220
245
|
'steuer.reverseCharge.titel': 'Reverse charge – VAT liability of the recipient. ',
|
|
221
246
|
'steuer.reverseCharge.text': 'VAT liability transferred pursuant to Art. 196 of VAT Directive 2006/112/EC (intra-Community service). The service is not VAT-exempt — the recipient owes and accounts for the VAT in their country.',
|
|
222
247
|
'steuer.uidZeile': 'VAT ID supplier: {verkaeufer} · VAT ID recipient: {kaeufer}',
|
|
248
|
+
'steuer.rcGrund.construction': 'Construction work pursuant to § 19 (1a) UStG.',
|
|
249
|
+
'steuer.rcGrund.scrap': 'Scrap and waste materials pursuant to the Austrian scrap VAT regulation (BGBl. II No. 129/2007).',
|
|
250
|
+
'steuer.rcGrund.mobile_devices': 'Mobile phones or integrated circuits pursuant to § 19 (1e) (b) UStG.',
|
|
251
|
+
'steuer.rcGrund.it_devices': 'Laptops, tablets or games consoles pursuant to § 2 no. 1 of the Austrian VAT anti-fraud regulation (BGBl. II No. 369/2013).',
|
|
252
|
+
'steuer.rcGrund.metals': 'Metals pursuant to § 2 no. 4 of the Austrian VAT anti-fraud regulation.',
|
|
253
|
+
'steuer.rcGrund.emission_certificates': 'Greenhouse gas emission allowances pursuant to § 19 (1e) (a) UStG.',
|
|
254
|
+
'steuer.rcGrund.gas_electricity': 'Supply of gas or electricity to a reseller pursuant to § 2 no. 2 of the Austrian VAT anti-fraud regulation.',
|
|
255
|
+
'steuer.rcGrund.energy_certificates': 'Gas and electricity certificates pursuant to § 2 no. 3 of the Austrian VAT anti-fraud regulation.',
|
|
256
|
+
'steuer.rcGrund.investment_gold': 'Taxable supply of investment gold pursuant to § 2 no. 5 of the Austrian VAT anti-fraud regulation.',
|
|
257
|
+
'steuer.rcGrund.security_transfer': 'Supply of goods under a security or retention of title arrangement pursuant to § 19 (1b) UStG.',
|
|
258
|
+
'steuer.rcGrund.foreign_supplier': 'Supply by a business not established in Austria pursuant to § 19 (1) second sentence UStG.',
|
|
259
|
+
'steuer.domestic.text': 'The recipient owes and accounts for the VAT. The supply is not VAT-exempt.',
|
|
260
|
+
'steuer.outsideScope.titel': 'Outside the scope of Austrian VAT. ',
|
|
261
|
+
'steuer.outsideScope.text': 'The place of supply is the recipient\'s country pursuant to § 3a (6) UStG; no Austrian VAT applies.',
|
|
223
262
|
'pdf.zahlung.titel': 'PAYMENT DETAILS',
|
|
224
263
|
'pdf.zahlung.empfaenger': 'Payee',
|
|
225
264
|
'pdf.zahlung.iban': 'IBAN',
|
|
@@ -269,6 +308,7 @@ const EN = {
|
|
|
269
308
|
'einvoice.befreiung.reverseCharge': 'Reverse charge – VAT liability of the recipient',
|
|
270
309
|
'einvoice.befreiung.kleinunternehmer': 'VAT exempt — small business pursuant to § 6 (1) no. 27 UStG',
|
|
271
310
|
'einvoice.befreiung.igLieferung': 'VAT-exempt intra-Community supply pursuant to Art. 6 (1) UStG',
|
|
311
|
+
'einvoice.befreiung.outsideScope': 'Outside the scope of VAT — place of supply abroad (§ 3a (6) UStG)',
|
|
272
312
|
'einvoice.befreiung.ausfuhr': 'VAT-exempt export delivery pursuant to § 6 (1) no. 1 UStG',
|
|
273
313
|
'einvoice.zahlbarBis': 'Payable by {datum}',
|
|
274
314
|
'einheit.piece': 'pcs',
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Betraege sind ueberall ganze Cent. Datumsangaben sind `YYYY-MM-DD` nach
|
|
6
6
|
* Wiener Kalender.
|
|
7
7
|
*/
|
|
8
|
-
import type { CreditNoteReason, CustomerType, DocType, InvoiceLanguage, InvoiceNoticeCode, InvoicePaymentMethod, InvoiceUnit, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent } from './vertrag.js';
|
|
8
|
+
import type { CreditNoteReason, CustomerType, DocType, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent } from './vertrag.js';
|
|
9
9
|
export interface CustomerInput {
|
|
10
10
|
type: CustomerType;
|
|
11
11
|
name: string;
|
|
@@ -71,6 +71,8 @@ export interface InvoiceItemInput {
|
|
|
71
71
|
quantity: number;
|
|
72
72
|
/** Einheit aus `INVOICE_UNITS`; ohne Angabe `piece`. */
|
|
73
73
|
unit?: InvoiceUnit;
|
|
74
|
+
/** Ware oder Leistung; ohne Angabe `goods`. Entscheidet ueber den Steuerfall. */
|
|
75
|
+
kind?: ItemKind;
|
|
74
76
|
/** Einzelpreis in ganzen Cent, im `priceMode` der Rechnung (netto oder brutto). */
|
|
75
77
|
unitPriceCents: number;
|
|
76
78
|
vatRate: VatRatePercent;
|
|
@@ -82,7 +84,10 @@ export interface IssueInvoiceRequest {
|
|
|
82
84
|
idempotencyKey: string;
|
|
83
85
|
/** Pflicht ueber 400 € brutto sowie bei Reverse Charge und ig. Lieferung. */
|
|
84
86
|
customerId?: string;
|
|
85
|
-
|
|
87
|
+
/** Optional: der Server leitet den Fall ab und prueft eine Angabe dagegen. */
|
|
88
|
+
taxScheme?: TaxScheme;
|
|
89
|
+
/** Pflicht bei `domesticReverseCharge`. */
|
|
90
|
+
reverseChargeReason?: ReverseChargeReason;
|
|
86
91
|
priceMode: PriceMode;
|
|
87
92
|
/** Leistungsdatum bzw. Beginn des Leistungszeitraums. */
|
|
88
93
|
serviceStart: string;
|
|
@@ -141,7 +146,7 @@ export interface InvoicePayment {
|
|
|
141
146
|
}
|
|
142
147
|
/**
|
|
143
148
|
* Ein Hinweis zu einer erfolgreichen Antwort — kein Fehler, sondern etwas,
|
|
144
|
-
* das der Aufrufer wissen sollte
|
|
149
|
+
* das der Aufrufer wissen sollte. Die Codes stehen in `INVOICE_NOTICE_CODES`.
|
|
145
150
|
*/
|
|
146
151
|
export interface InvoiceNotice {
|
|
147
152
|
code: InvoiceNoticeCode;
|
|
@@ -151,7 +156,11 @@ export interface RecordPaymentResult {
|
|
|
151
156
|
invoice: Invoice;
|
|
152
157
|
payment: InvoicePayment;
|
|
153
158
|
replayed: boolean;
|
|
154
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Hinweise zu dieser Zahlung — eine **Liste** wie bei `issueInvoice`
|
|
161
|
+
* (bis 0.21.0 ein einzelnes Objekt). Fehlt, wenn es keinen gibt.
|
|
162
|
+
*/
|
|
163
|
+
notice?: InvoiceNotice[];
|
|
155
164
|
}
|
|
156
165
|
export interface CancelInvoiceRequest {
|
|
157
166
|
idempotencyKey: string;
|
|
@@ -162,15 +171,23 @@ export interface CancelInvoiceRequest {
|
|
|
162
171
|
export interface CreditNoteRequest extends CancelInvoiceRequest {
|
|
163
172
|
items: InvoiceItemInput[];
|
|
164
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Summen einer Rechnung in Cent, **immer positiv** — auch bei einer Gutschrift
|
|
176
|
+
* (`docType: 'GU'`); das Vorzeichen steht im Belegtyp, nicht im Betrag.
|
|
177
|
+
* Gerechnet wird je Satz wie in [rechnungSummen].
|
|
178
|
+
*/
|
|
165
179
|
export interface InvoiceTotals {
|
|
166
180
|
netCents: number;
|
|
167
181
|
vatCents: number;
|
|
168
182
|
grossCents: number;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
183
|
+
/** Je USt-Satz, absteigend. `grossCents` ist `netCents + vatCents` (seit 0.22.0 mitgeliefert). */
|
|
184
|
+
byRate: InvoiceRateTotals[];
|
|
185
|
+
}
|
|
186
|
+
export interface InvoiceRateTotals {
|
|
187
|
+
rate: number;
|
|
188
|
+
netCents: number;
|
|
189
|
+
vatCents: number;
|
|
190
|
+
grossCents: number;
|
|
174
191
|
}
|
|
175
192
|
export interface EInvoiceStatus {
|
|
176
193
|
level: string;
|
|
@@ -227,6 +244,8 @@ export interface InvoiceItem {
|
|
|
227
244
|
subtitle: string;
|
|
228
245
|
quantity: number;
|
|
229
246
|
unit: string;
|
|
247
|
+
/** Ware oder Leistung — Altbestand ohne Angabe zaehlt als `goods`. */
|
|
248
|
+
kind: ItemKind;
|
|
230
249
|
unitPriceCents: number;
|
|
231
250
|
vatRate: number;
|
|
232
251
|
discountPct: number;
|
|
@@ -235,6 +254,10 @@ export interface InvoiceDetail extends Invoice {
|
|
|
235
254
|
items: InvoiceItem[];
|
|
236
255
|
customer: InvoiceRecipient | null;
|
|
237
256
|
taxScheme: TaxScheme;
|
|
257
|
+
/** Nur bei `domesticReverseCharge`. */
|
|
258
|
+
reverseChargeReason: ReverseChargeReason | null;
|
|
259
|
+
/** Land, dessen Steuer die Rechnung traegt; Altbestand `AT`. */
|
|
260
|
+
taxCountry: string;
|
|
238
261
|
priceMode: PriceMode;
|
|
239
262
|
serviceStart: string | null;
|
|
240
263
|
serviceEnd: string | null;
|
|
@@ -280,6 +303,45 @@ export interface IssueResult {
|
|
|
280
303
|
invoice: Invoice;
|
|
281
304
|
/** `true`, wenn die Anfrage schon einmal ausgefuehrt wurde und die bestehende Rechnung zurueckkommt. */
|
|
282
305
|
replayed: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Hinweise zu dieser Rechnung — kein Fehler, sondern etwas, das der Aufrufer
|
|
308
|
+
* wissen sollte. Eine **Liste**, weil mehrere zugleich anfallen koennen: eine
|
|
309
|
+
* bar bezahlte ig. Lieferung traegt sowohl `cash_receipt_required` als auch
|
|
310
|
+
* `recapitulative_statement_due`.
|
|
311
|
+
*/
|
|
312
|
+
notice?: InvoiceNotice[];
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Was `issueInvoice` mit dieser Anfrage ausstellen wuerde — ohne Nummer, ohne
|
|
316
|
+
* Dokument, ohne Zahlung. Der Probelauf prueft wie das Ausstellen (Einrichtung,
|
|
317
|
+
* Kunde, Steuerfall, Pflichtangaben, Marke, Zahlung) und scheitert mit
|
|
318
|
+
* denselben Fehlercodes.
|
|
319
|
+
*/
|
|
320
|
+
export interface InvoicePreview {
|
|
321
|
+
docType: 'RE';
|
|
322
|
+
/** Heutiger Wiener Tag — der Tag, den eine sofort ausgestellte Rechnung truege. */
|
|
323
|
+
invoiceDate: string;
|
|
324
|
+
dueDate: string | null;
|
|
325
|
+
customerId: string | null;
|
|
326
|
+
/** Der abgeleitete Steuerfall. */
|
|
327
|
+
taxScheme: TaxScheme;
|
|
328
|
+
/** Warum dieser Fall gilt (z. B. `customer_country_eu_with_vat_id`). */
|
|
329
|
+
taxSchemeReason: string;
|
|
330
|
+
reverseChargeReason: ReverseChargeReason | null;
|
|
331
|
+
taxCountry: string;
|
|
332
|
+
priceMode: PriceMode;
|
|
333
|
+
totals: InvoiceTotals;
|
|
334
|
+
language: InvoiceLanguage;
|
|
335
|
+
brand: {
|
|
336
|
+
id: string | null;
|
|
337
|
+
name: string | null;
|
|
338
|
+
} | null;
|
|
339
|
+
einvoice: EInvoiceStatus;
|
|
340
|
+
}
|
|
341
|
+
export interface PreviewResult {
|
|
342
|
+
preview: InvoicePreview;
|
|
343
|
+
/** Dieselben Hinweise, die das Ausstellen liefern wuerde. */
|
|
344
|
+
notice?: InvoiceNotice[];
|
|
283
345
|
}
|
|
284
346
|
export interface CancelResult {
|
|
285
347
|
creditNote: Invoice;
|
|
@@ -24,13 +24,88 @@ export type RechnungAufruf = (typeof RECHNUNG_AUFRUFE)[number];
|
|
|
24
24
|
* Stabile Fehlercodes. Das Fremdsystem verzweigt am Code, der Text darf sich
|
|
25
25
|
* aendern. `validation` traegt zusaetzlich `errors: [{ field, message }]`.
|
|
26
26
|
*/
|
|
27
|
-
export declare const INVOICE_ERROR_CODES: readonly ["validation", "idempotency_conflict", "module_inactive", "customer_not_found", "customer_exists", "short_code_taken", "short_code_immutable", "recipient_required", "invoice_requirements_missing", "invoice_not_found", "invoice_ambiguous", "not_cancellable", "partial_credit_exists", "credit_exceeds_invoice", "einvoice_incomplete", "invoice_api_not_enabled", "invoice_setup_incomplete", "language_not_allowed", "brand_not_found", "not_payable", "payment_exceeds_invoice"];
|
|
27
|
+
export declare const INVOICE_ERROR_CODES: readonly ["validation", "idempotency_conflict", "module_inactive", "customer_not_found", "customer_exists", "short_code_taken", "short_code_immutable", "recipient_required", "invoice_requirements_missing", "invoice_not_found", "invoice_ambiguous", "not_cancellable", "partial_credit_exists", "credit_exceeds_invoice", "einvoice_incomplete", "invoice_api_not_enabled", "invoice_setup_incomplete", "language_not_allowed", "brand_not_found", "not_payable", "payment_exceeds_invoice", "tax_scheme_mismatch", "vat_rate_not_in_country", "reverse_charge_reason_required", "reverse_charge_threshold", "mixed_supply_not_allowed", "oss_not_enabled"];
|
|
28
28
|
export type InvoiceErrorCode = (typeof INVOICE_ERROR_CODES)[number];
|
|
29
29
|
/** Gruende einer Gutschrift. Der Server druckt den deutschen Anzeigetext. */
|
|
30
30
|
export declare const CREDIT_NOTE_REASONS: readonly ["cancellation", "price_reduction", "return", "incorrect_invoice", "other"];
|
|
31
31
|
export type CreditNoteReason = (typeof CREDIT_NOTE_REASONS)[number];
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Der Steuerfall einer Rechnung. Er wird vom Server **abgeleitet** (Kundenland,
|
|
34
|
+
* Kundenart, UID, Ware oder Leistung); eine mitgeschickte Angabe muss dazu
|
|
35
|
+
* passen, sonst `tax_scheme_mismatch`. Neue Faelle stehen hinten, damit
|
|
36
|
+
* gespeicherte Reihenfolgen gueltig bleiben.
|
|
37
|
+
*
|
|
38
|
+
* - `normal` oesterreichische Umsatzsteuer
|
|
39
|
+
* - `smallBusiness` Kleinunternehmer (§ 6 Abs. 1 Z 27 UStG)
|
|
40
|
+
* - `reverseCharge` Leistung an ein Unternehmen in der EU (Art. 196 MwSt-RL)
|
|
41
|
+
* - `igLieferung` Ware an ein Unternehmen in der EU (Art. 6 Abs. 1 UStG)
|
|
42
|
+
* - `exportThirdCountry` Ware ins Drittland (§ 6 Abs. 1 Z 1 UStG)
|
|
43
|
+
* - `domesticReverseCharge` Uebergang der Steuerschuld im Inland, Grund aus `REVERSE_CHARGE_REASONS`
|
|
44
|
+
* - `oss` B2C in der EU ueber den One-Stop-Shop, Satz des Ziellandes
|
|
45
|
+
* - `outsideScope` Leistung an ein Drittlandsunternehmen — in Oesterreich nicht steuerbar
|
|
46
|
+
*/
|
|
47
|
+
export declare const TAX_SCHEMES: readonly ["normal", "smallBusiness", "reverseCharge", "igLieferung", "exportThirdCountry", "domesticReverseCharge", "oss", "outsideScope"];
|
|
33
48
|
export type TaxScheme = (typeof TAX_SCHEMES)[number];
|
|
49
|
+
/**
|
|
50
|
+
* Gruende fuer den Uebergang der Steuerschuld **im Inland**. Ohne Grund gibt es
|
|
51
|
+
* kein `domesticReverseCharge`: die Bedingungen sind je Fall verschieden, und
|
|
52
|
+
* keine davon laesst sich aus Betrag und Land erraten.
|
|
53
|
+
*
|
|
54
|
+
* `schwelleCents` ist das Entgelt, ab dem der Fall greift — maßgeblich ist das
|
|
55
|
+
* **in der Rechnung ausgewiesene** Entgelt, nicht der Einzelpreis; ein
|
|
56
|
+
* einheitlicher Liefervorgang darf dafuer nicht auf mehrere Rechnungen
|
|
57
|
+
* aufgeteilt werden (UStR Rz 2605d).
|
|
58
|
+
*/
|
|
59
|
+
export declare const REVERSE_CHARGE_REASONS: Readonly<{
|
|
60
|
+
construction: {
|
|
61
|
+
stelle: string;
|
|
62
|
+
schwelleCents: null;
|
|
63
|
+
};
|
|
64
|
+
scrap: {
|
|
65
|
+
stelle: string;
|
|
66
|
+
schwelleCents: null;
|
|
67
|
+
};
|
|
68
|
+
mobile_devices: {
|
|
69
|
+
stelle: string;
|
|
70
|
+
schwelleCents: number;
|
|
71
|
+
};
|
|
72
|
+
it_devices: {
|
|
73
|
+
stelle: string;
|
|
74
|
+
schwelleCents: number;
|
|
75
|
+
};
|
|
76
|
+
metals: {
|
|
77
|
+
stelle: string;
|
|
78
|
+
schwelleCents: null;
|
|
79
|
+
};
|
|
80
|
+
emission_certificates: {
|
|
81
|
+
stelle: string;
|
|
82
|
+
schwelleCents: null;
|
|
83
|
+
};
|
|
84
|
+
gas_electricity: {
|
|
85
|
+
stelle: string;
|
|
86
|
+
schwelleCents: null;
|
|
87
|
+
};
|
|
88
|
+
energy_certificates: {
|
|
89
|
+
stelle: string;
|
|
90
|
+
schwelleCents: null;
|
|
91
|
+
};
|
|
92
|
+
investment_gold: {
|
|
93
|
+
stelle: string;
|
|
94
|
+
schwelleCents: null;
|
|
95
|
+
};
|
|
96
|
+
security_transfer: {
|
|
97
|
+
stelle: string;
|
|
98
|
+
schwelleCents: null;
|
|
99
|
+
};
|
|
100
|
+
foreign_supplier: {
|
|
101
|
+
stelle: string;
|
|
102
|
+
schwelleCents: null;
|
|
103
|
+
};
|
|
104
|
+
}>;
|
|
105
|
+
export type ReverseChargeReason = keyof typeof REVERSE_CHARGE_REASONS;
|
|
106
|
+
/** Ware oder Leistung — ohne das laesst sich ig. Lieferung nicht von Reverse Charge trennen. */
|
|
107
|
+
export declare const ITEM_KINDS: readonly ["goods", "service"];
|
|
108
|
+
export type ItemKind = (typeof ITEM_KINDS)[number];
|
|
34
109
|
export declare const PRICE_MODES: readonly ["net", "gross"];
|
|
35
110
|
export type PriceMode = (typeof PRICE_MODES)[number];
|
|
36
111
|
export declare const VAT_RATES: readonly [0, 10, 13, 20];
|
|
@@ -66,7 +141,7 @@ export type InvoicePaymentMethod = (typeof INVOICE_PAYMENT_METHODS)[number];
|
|
|
66
141
|
* Hinweise, die eine erfolgreiche Antwort zusaetzlich tragen kann (`data.notice`).
|
|
67
142
|
* Sie sind keine Fehler: der Aufruf hat gewirkt, es gibt nur etwas zu wissen.
|
|
68
143
|
*/
|
|
69
|
-
export declare const INVOICE_NOTICE_CODES: readonly ["cash_receipt_required"];
|
|
144
|
+
export declare const INVOICE_NOTICE_CODES: readonly ["cash_receipt_required", "recapitulative_statement_due", "place_of_supply_check"];
|
|
70
145
|
export type InvoiceNoticeCode = (typeof INVOICE_NOTICE_CODES)[number];
|
|
71
146
|
/**
|
|
72
147
|
* Einheiten einer Position. Die API nimmt nur diese Schluessel an; gedruckt
|