@kreiseck/kasseneck-api 0.16.0 → 0.18.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 +57 -0
- package/README.md +61 -0
- package/dist/cjs/client/aufrufe.d.ts +1 -1
- package/dist/cjs/client/aufrufe.js +2 -0
- package/dist/cjs/rechnung/api.d.ts +10 -3
- package/dist/cjs/rechnung/api.js +3 -1
- package/dist/cjs/rechnung/endpunkte.d.ts +23 -4
- package/dist/cjs/rechnung/endpunkte.js +41 -3
- package/dist/cjs/rechnung/index.d.ts +4 -3
- package/dist/cjs/rechnung/index.js +11 -1
- package/dist/cjs/rechnung/texte.d.ts +202 -0
- package/dist/cjs/rechnung/texte.js +377 -0
- package/dist/cjs/rechnung/typen.d.ts +70 -2
- package/dist/cjs/rechnung/vertrag.d.ts +47 -2
- package/dist/cjs/rechnung/vertrag.js +181 -2
- package/dist/esm/client/aufrufe.d.ts +1 -1
- package/dist/esm/client/aufrufe.js +2 -0
- package/dist/esm/rechnung/api.d.ts +10 -3
- package/dist/esm/rechnung/api.js +4 -2
- package/dist/esm/rechnung/endpunkte.d.ts +23 -4
- package/dist/esm/rechnung/endpunkte.js +39 -3
- package/dist/esm/rechnung/index.d.ts +4 -3
- package/dist/esm/rechnung/index.js +3 -2
- package/dist/esm/rechnung/texte.d.ts +202 -0
- package/dist/esm/rechnung/texte.js +373 -0
- package/dist/esm/rechnung/typen.d.ts +70 -2
- package/dist/esm/rechnung/vertrag.d.ts +47 -2
- package/dist/esm/rechnung/vertrag.js +180 -1
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/kasse-texte.json +1 -1
- package/fixtures/oberflaeche.json +75 -3
- package/fixtures/rechnung-api-beispiele/brands-ok.json +8 -0
- package/fixtures/rechnung-api-beispiele/issue-bezahlt.json +32 -0
- package/fixtures/rechnung-api-beispiele/issue-englisch.json +30 -0
- package/fixtures/rechnung-api-beispiele/issue-fehler-einheit.json +26 -0
- package/fixtures/rechnung-api-beispiele/issue-fehler-sprache.json +26 -0
- package/fixtures/rechnung-api-beispiele/issue-fehler-zahlungsart.json +26 -0
- package/fixtures/rechnung-api-beispiele/issue-netto-20.json +1 -1
- package/fixtures/rechnung-api-beispiele/zahlung-fehler-ohne-schluessel.json +14 -0
- package/fixtures/rechnung-api-beispiele/zahlung-nachtrag.json +14 -0
- package/fixtures/rechnung-api.schema.json +222 -6
- package/fixtures/rechnung-texte.json +424 -0
- package/package.json +2 -1
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Nummer, Summen — ist bewusst **nicht** setzbar.
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.RECHNUNG_MINDESTENS_EINS = exports.RECHNUNG_GENAU_EINS = exports.RECHNUNG_ANFRAGEN = exports.POSITION_FELDER = exports.KUNDE_FELDER = exports.INVOICE_SETUP_REQUIREMENTS = exports.EINVOICE_FORMATS = exports.DOC_TYPES = exports.INVOICE_LIST_STATUS = exports.CUSTOMER_TYPES = exports.VAT_RATES = exports.PRICE_MODES = exports.TAX_SCHEMES = exports.CREDIT_NOTE_REASONS = exports.INVOICE_ERROR_CODES = exports.RECHNUNG_AUFRUFE = exports.RECHNUNG_VERTRAG_VERSION = void 0;
|
|
22
|
+
exports.RECHNUNG_MINDESTENS_EINS = exports.RECHNUNG_GENAU_EINS = exports.RECHNUNG_ANFRAGEN = exports.PAYMENT_FELDER = exports.POSITION_FELDER = exports.KUNDE_FELDER = exports.INVOICE_SETUP_REQUIREMENTS = exports.RECHNUNG_EINHEITEN_CODES = exports.INVOICE_UNITS = exports.INVOICE_NOTICE_CODES = exports.INVOICE_PAYMENT_METHODS = exports.INVOICE_LANGUAGES = exports.EINVOICE_FORMATS = exports.DOC_TYPES = exports.INVOICE_LIST_STATUS = exports.CUSTOMER_TYPES = exports.VAT_RATES = exports.PRICE_MODES = exports.TAX_SCHEMES = exports.CREDIT_NOTE_REASONS = exports.INVOICE_ERROR_CODES = exports.RECHNUNG_AUFRUFE = exports.RECHNUNG_VERTRAG_VERSION = void 0;
|
|
23
23
|
exports.RECHNUNG_VERTRAG_VERSION = 1;
|
|
24
24
|
exports.RECHNUNG_AUFRUFE = [
|
|
25
25
|
'createCustomer',
|
|
@@ -34,6 +34,8 @@ exports.RECHNUNG_AUFRUFE = [
|
|
|
34
34
|
'getInvoicePdf',
|
|
35
35
|
'getInvoiceXml',
|
|
36
36
|
'getInvoiceSetupStatus',
|
|
37
|
+
'listBrands',
|
|
38
|
+
'recordInvoicePayment',
|
|
37
39
|
];
|
|
38
40
|
/**
|
|
39
41
|
* Stabile Fehlercodes. Das Fremdsystem verzweigt am Code, der Text darf sich
|
|
@@ -57,6 +59,10 @@ exports.INVOICE_ERROR_CODES = [
|
|
|
57
59
|
'einvoice_incomplete',
|
|
58
60
|
'invoice_api_not_enabled',
|
|
59
61
|
'invoice_setup_incomplete',
|
|
62
|
+
'language_not_allowed',
|
|
63
|
+
'brand_not_found',
|
|
64
|
+
'not_payable',
|
|
65
|
+
'payment_exceeds_invoice',
|
|
60
66
|
];
|
|
61
67
|
/** Gruende einer Gutschrift. Der Server druckt den deutschen Anzeigetext. */
|
|
62
68
|
exports.CREDIT_NOTE_REASONS = [
|
|
@@ -73,6 +79,142 @@ exports.CUSTOMER_TYPES = ['private', 'company'];
|
|
|
73
79
|
exports.INVOICE_LIST_STATUS = ['final', 'paid', 'cancelled', 'open', 'overdue'];
|
|
74
80
|
exports.DOC_TYPES = ['RE', 'GU'];
|
|
75
81
|
exports.EINVOICE_FORMATS = ['ubl', 'cii'];
|
|
82
|
+
/**
|
|
83
|
+
* Sprachen einer Rechnung. Die Sprache wird beim Festschreiben eingefroren;
|
|
84
|
+
* fehlt sie an Kunde oder Rechnung, gilt `de`. Behoerden bekommen immer `de`
|
|
85
|
+
* (`language_not_allowed`). Datum und Betraege bleiben in jeder Sprache
|
|
86
|
+
* oesterreichisch formatiert.
|
|
87
|
+
*/
|
|
88
|
+
exports.INVOICE_LANGUAGES = ['de', 'en'];
|
|
89
|
+
/**
|
|
90
|
+
* Wie eine Rechnung bezahlt wurde. Der Vermerk ist Buchhaltung, kein Beleg:
|
|
91
|
+
* `cash` wird gebucht, die Antwort traegt dann zusaetzlich den Hinweis
|
|
92
|
+
* `cash_receipt_required` — eine Barzahlung ist ein Barumsatz und braucht
|
|
93
|
+
* einen Beleg (§ 132a BAO), bei Registrierkassenpflicht ueber die Kasse.
|
|
94
|
+
*/
|
|
95
|
+
exports.INVOICE_PAYMENT_METHODS = ['transfer', 'card', 'online', 'cash'];
|
|
96
|
+
/**
|
|
97
|
+
* Hinweise, die eine erfolgreiche Antwort zusaetzlich tragen kann (`data.notice`).
|
|
98
|
+
* Sie sind keine Fehler: der Aufruf hat gewirkt, es gibt nur etwas zu wissen.
|
|
99
|
+
*/
|
|
100
|
+
exports.INVOICE_NOTICE_CODES = ['cash_receipt_required'];
|
|
101
|
+
/**
|
|
102
|
+
* Einheiten einer Position. Die API nimmt nur diese Schluessel an; gedruckt
|
|
103
|
+
* wird das Kuerzel in der Sprache der Rechnung (`RECHNUNG_TEXTE`,
|
|
104
|
+
* `einheit.<schluessel>`), die E-Rechnung fuehrt den UN/ECE-Code
|
|
105
|
+
* (`RECHNUNG_EINHEITEN_CODES`). Ohne Angabe gilt `piece`.
|
|
106
|
+
*/
|
|
107
|
+
exports.INVOICE_UNITS = [
|
|
108
|
+
'piece',
|
|
109
|
+
'pair',
|
|
110
|
+
'set',
|
|
111
|
+
'dozen',
|
|
112
|
+
'second',
|
|
113
|
+
'minute',
|
|
114
|
+
'hour',
|
|
115
|
+
'day',
|
|
116
|
+
'night',
|
|
117
|
+
'week',
|
|
118
|
+
'month',
|
|
119
|
+
'quarter',
|
|
120
|
+
'half_year',
|
|
121
|
+
'year',
|
|
122
|
+
'milligram',
|
|
123
|
+
'gram',
|
|
124
|
+
'kilogram',
|
|
125
|
+
'tonne',
|
|
126
|
+
'millimetre',
|
|
127
|
+
'centimetre',
|
|
128
|
+
'metre',
|
|
129
|
+
'running_metre',
|
|
130
|
+
'kilometre',
|
|
131
|
+
'square_metre',
|
|
132
|
+
'hectare',
|
|
133
|
+
'millilitre',
|
|
134
|
+
'litre',
|
|
135
|
+
'cubic_metre',
|
|
136
|
+
'kilowatt_hour',
|
|
137
|
+
'megawatt_hour',
|
|
138
|
+
'gigabyte',
|
|
139
|
+
'terabyte',
|
|
140
|
+
'flat_rate',
|
|
141
|
+
'person',
|
|
142
|
+
'licence',
|
|
143
|
+
'user',
|
|
144
|
+
'device',
|
|
145
|
+
'session',
|
|
146
|
+
'trip',
|
|
147
|
+
'page',
|
|
148
|
+
'sheet',
|
|
149
|
+
'package',
|
|
150
|
+
'box',
|
|
151
|
+
'carton',
|
|
152
|
+
'bottle',
|
|
153
|
+
'can',
|
|
154
|
+
'roll',
|
|
155
|
+
'bag',
|
|
156
|
+
'pallet',
|
|
157
|
+
];
|
|
158
|
+
/**
|
|
159
|
+
* UN/ECE-Code je Einheit (Recommendation 20, Verpackungen aus Recommendation 21
|
|
160
|
+
* mit `X`). Mehrere Einheiten duerfen denselben Code tragen (Meter und
|
|
161
|
+
* Laufmeter; Lizenz, Benutzer, Geraet als Stueck). Die Validatoren der
|
|
162
|
+
* E-Rechnung pruefen jeden Code im Backend (Beispiel `api-einheiten`).
|
|
163
|
+
*/
|
|
164
|
+
exports.RECHNUNG_EINHEITEN_CODES = Object.freeze({
|
|
165
|
+
piece: 'C62',
|
|
166
|
+
pair: 'PR',
|
|
167
|
+
set: 'SET',
|
|
168
|
+
dozen: 'DZN',
|
|
169
|
+
second: 'SEC',
|
|
170
|
+
minute: 'MIN',
|
|
171
|
+
hour: 'HUR',
|
|
172
|
+
day: 'DAY',
|
|
173
|
+
night: 'C62',
|
|
174
|
+
week: 'WEE',
|
|
175
|
+
month: 'MON',
|
|
176
|
+
quarter: 'QAN',
|
|
177
|
+
half_year: 'SAN',
|
|
178
|
+
year: 'ANN',
|
|
179
|
+
milligram: 'MGM',
|
|
180
|
+
gram: 'GRM',
|
|
181
|
+
kilogram: 'KGM',
|
|
182
|
+
tonne: 'TNE',
|
|
183
|
+
millimetre: 'MMT',
|
|
184
|
+
centimetre: 'CMT',
|
|
185
|
+
metre: 'MTR',
|
|
186
|
+
running_metre: 'MTR',
|
|
187
|
+
kilometre: 'KMT',
|
|
188
|
+
square_metre: 'MTK',
|
|
189
|
+
// Rec 20 fuehrt fuer Hektar HAR, EN 16931 laesst davon nur H18
|
|
190
|
+
// („square hectometre", Synonym hectare) zu.
|
|
191
|
+
hectare: 'H18',
|
|
192
|
+
millilitre: 'MLT',
|
|
193
|
+
litre: 'LTR',
|
|
194
|
+
cubic_metre: 'MTQ',
|
|
195
|
+
kilowatt_hour: 'KWH',
|
|
196
|
+
megawatt_hour: 'MWH',
|
|
197
|
+
gigabyte: 'E34',
|
|
198
|
+
terabyte: 'E35',
|
|
199
|
+
flat_rate: 'LS',
|
|
200
|
+
person: 'IE',
|
|
201
|
+
licence: 'C62',
|
|
202
|
+
user: 'C62',
|
|
203
|
+
device: 'C62',
|
|
204
|
+
session: 'C62',
|
|
205
|
+
trip: 'C62',
|
|
206
|
+
page: 'ZP',
|
|
207
|
+
// Ebenso: ST („sheet") steht nicht in der Liste von EN 16931, LEF („leaf") schon.
|
|
208
|
+
sheet: 'LEF',
|
|
209
|
+
package: 'XPK',
|
|
210
|
+
box: 'XBX',
|
|
211
|
+
carton: 'XCT',
|
|
212
|
+
bottle: 'XBO',
|
|
213
|
+
can: 'XCA',
|
|
214
|
+
roll: 'XRO',
|
|
215
|
+
bag: 'XSA',
|
|
216
|
+
pallet: 'XPX',
|
|
217
|
+
});
|
|
76
218
|
/**
|
|
77
219
|
* Was erfuellt sein muss, bevor ueber die API ausgestellt werden darf — in
|
|
78
220
|
* dieser Reihenfolge meldet `getInvoiceSetupStatus`, was fehlt, und dieselben
|
|
@@ -120,6 +262,8 @@ exports.KUNDE_FELDER = Object.freeze({
|
|
|
120
262
|
isAuthority: { typ: 'boolean', pflicht: false },
|
|
121
263
|
note: text(1000),
|
|
122
264
|
externalId: { typ: 'string', pflicht: false, min: 1, max: 120 },
|
|
265
|
+
/** Sprache der Rechnungen an diesen Kunden; fehlt = `de`. */
|
|
266
|
+
language: { typ: 'enum', pflicht: false, werte: exports.INVOICE_LANGUAGES },
|
|
123
267
|
});
|
|
124
268
|
/** Beim Aendern ist jedes Kundenfeld optional. */
|
|
125
269
|
const KUNDE_PATCH = Object.freeze(Object.fromEntries(Object.entries(exports.KUNDE_FELDER).map(([name, feld]) => [name, { ...feld, pflicht: false }])));
|
|
@@ -128,12 +272,26 @@ exports.POSITION_FELDER = Object.freeze({
|
|
|
128
272
|
description: text(300, true),
|
|
129
273
|
subtitle: text(1000),
|
|
130
274
|
quantity: { typ: 'number', pflicht: true, min: 0, exklusivMin: true, max: 1_000_000, nachkomma: 3 },
|
|
131
|
-
|
|
275
|
+
/** Einheit aus `INVOICE_UNITS`; ohne Angabe `piece`. */
|
|
276
|
+
unit: { typ: 'enum', pflicht: false, werte: exports.INVOICE_UNITS },
|
|
132
277
|
unitPriceCents: { typ: 'integer', pflicht: true, min: 0, max: 100_000_000 },
|
|
133
278
|
vatRate: { typ: 'enum', pflicht: true, werte: exports.VAT_RATES },
|
|
134
279
|
discountPct: { typ: 'number', pflicht: false, min: 0, max: 100, nachkomma: 2 },
|
|
135
280
|
});
|
|
136
281
|
const positionen = { typ: 'list', pflicht: true, min: 1, max: 500, eintrag: { typ: 'object', pflicht: true, felder: exports.POSITION_FELDER } };
|
|
282
|
+
/**
|
|
283
|
+
* Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
|
|
284
|
+
* Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
|
|
285
|
+
* Zahlungskennung des Fremdsystems (z. B. `pi_3Q...`) — sie wird gespeichert,
|
|
286
|
+
* aber **nicht gedruckt**: die Rechnung wird aufbewahrt und vervielfaeltigt,
|
|
287
|
+
* und dem Empfaenger nuetzt sie nichts.
|
|
288
|
+
*/
|
|
289
|
+
exports.PAYMENT_FELDER = Object.freeze({
|
|
290
|
+
method: { typ: 'enum', pflicht: true, werte: exports.INVOICE_PAYMENT_METHODS },
|
|
291
|
+
amountCents: { typ: 'integer', pflicht: false, min: 1, max: 100_000_000 },
|
|
292
|
+
paidAt: datum(),
|
|
293
|
+
reference: text(100),
|
|
294
|
+
});
|
|
137
295
|
exports.RECHNUNG_ANFRAGEN = Object.freeze({
|
|
138
296
|
createCustomer: {
|
|
139
297
|
customer: { typ: 'object', pflicht: true, felder: exports.KUNDE_FELDER },
|
|
@@ -171,6 +329,16 @@ exports.RECHNUNG_ANFRAGEN = Object.freeze({
|
|
|
171
329
|
tracking: { typ: 'boolean', pflicht: false },
|
|
172
330
|
items: positionen,
|
|
173
331
|
metadata: { typ: 'map', pflicht: false, maxSchluessel: 20, schluesselMuster: '^[a-zA-Z0-9_]{1,40}$', wertMax: 500 },
|
|
332
|
+
/** Sprache dieser Rechnung; sonst die des Kunden, sonst `de`. */
|
|
333
|
+
language: { typ: 'enum', pflicht: false, werte: exports.INVOICE_LANGUAGES },
|
|
334
|
+
/** Marke (Kennung aus `listBrands`); sonst die Standardmarke. */
|
|
335
|
+
brandId: id,
|
|
336
|
+
/**
|
|
337
|
+
* Schon bezahlt: die Zahlung entsteht in **derselben** Transaktion wie das
|
|
338
|
+
* Festschreiben. Sonst gaebe es einen Moment, in dem die Rechnung offen ist
|
|
339
|
+
* und ein sofort geholtes PDF Zahlungsinformationen traegt.
|
|
340
|
+
*/
|
|
341
|
+
payment: { typ: 'object', pflicht: false, felder: exports.PAYMENT_FELDER },
|
|
174
342
|
},
|
|
175
343
|
cancelInvoice: {
|
|
176
344
|
idempotencyKey: idempotencyKey(true),
|
|
@@ -200,12 +368,23 @@ exports.RECHNUNG_ANFRAGEN = Object.freeze({
|
|
|
200
368
|
},
|
|
201
369
|
getInvoicePdf: {
|
|
202
370
|
invoiceId: idPflicht,
|
|
371
|
+
/** Andere Sprache als die der Rechnung: gekennzeichnete Uebersetzungskopie, keine eigene Rechnung. */
|
|
372
|
+
language: { typ: 'enum', pflicht: false, werte: exports.INVOICE_LANGUAGES },
|
|
203
373
|
},
|
|
204
374
|
getInvoiceXml: {
|
|
205
375
|
invoiceId: idPflicht,
|
|
206
376
|
format: { typ: 'enum', pflicht: false, werte: exports.EINVOICE_FORMATS },
|
|
207
377
|
},
|
|
208
378
|
getInvoiceSetupStatus: {},
|
|
379
|
+
listBrands: {},
|
|
380
|
+
recordInvoicePayment: {
|
|
381
|
+
idempotencyKey: idempotencyKey(true),
|
|
382
|
+
invoiceId: idPflicht,
|
|
383
|
+
method: { typ: 'enum', pflicht: true, werte: exports.INVOICE_PAYMENT_METHODS },
|
|
384
|
+
amountCents: { typ: 'integer', pflicht: false, min: 1, max: 100_000_000 },
|
|
385
|
+
paidAt: datum(),
|
|
386
|
+
reference: text(100),
|
|
387
|
+
},
|
|
209
388
|
});
|
|
210
389
|
/** Genau eines dieser Felder muss gesetzt sein (je Aufruf, je Gruppe). */
|
|
211
390
|
exports.RECHNUNG_GENAU_EINS = Object.freeze({
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* umhuellt, muss ihn weiterhin absetzen koennen.
|
|
14
14
|
*/
|
|
15
15
|
import type { TransportBodyFields } from './transport.js';
|
|
16
|
-
export declare const AUFRUFE: readonly ["activateCashregister", "cancelInvoice", "cancelReceipt", "createCreditNote", "createCustomer", "createCustomerCashregister", "createPartnerCustomer", "checkPartnerCustomerEmail", "createPartnerWebhook", "createPaymentLinkStripe", "createPrintJob", "createReceipt", "deletePartnerWebhook", "downloadDailyReport", "downloadReport", "endRegisterSession", "financeWebService", "generateFullReceiptId", "getCustomer", "getCustomerCredentials", "getCustomerSignatureStatus", "getFirstReceiptDate", "getInvoice", "getInvoicePdf", "getInvoiceSetupStatus", "getInvoiceXml", "getKasseSettings", "getPartnerCustomer", "getPartnerInfo", "getPrintJob", "getReceipt", "hobexPayApi", "hobexRefundApi", "issueInvoice", "listCustomerCashregisters", "listInvoices", "listMyArticleGroups", "listMyArticles", "listMyCashregisters", "listMyPrinters", "listMyReceipts", "listMyTipRecipients", "listPartnerCustomers", "listPartnerWebhookDeliveries", "listPartnerWebhooks", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "pairRegisterDevice", "registerPinLogin", "registerUserLogin", "renewRegisterSession", "requestCustomerSignature", "searchCustomers", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "unpairRegisterDevice", "rotatePartnerWebhookSecret", "updateCustomer", "updatePartnerWebhook"];
|
|
16
|
+
export declare const AUFRUFE: readonly ["activateCashregister", "cancelInvoice", "cancelReceipt", "createCreditNote", "createCustomer", "createCustomerCashregister", "createPartnerCustomer", "checkPartnerCustomerEmail", "createPartnerWebhook", "createPaymentLinkStripe", "createPrintJob", "createReceipt", "deletePartnerWebhook", "downloadDailyReport", "downloadReport", "endRegisterSession", "financeWebService", "generateFullReceiptId", "getCustomer", "getCustomerCredentials", "getCustomerSignatureStatus", "getFirstReceiptDate", "getInvoice", "getInvoicePdf", "getInvoiceSetupStatus", "getInvoiceXml", "getKasseSettings", "getPartnerCustomer", "getPartnerInfo", "getPrintJob", "getReceipt", "hobexPayApi", "hobexRefundApi", "issueInvoice", "listCustomerCashregisters", "listInvoices", "listBrands", "listMyArticleGroups", "listMyArticles", "listMyCashregisters", "listMyPrinters", "listMyReceipts", "listMyTipRecipients", "listPartnerCustomers", "listPartnerWebhookDeliveries", "listPartnerWebhooks", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "pairRegisterDevice", "recordInvoicePayment", "registerPinLogin", "registerUserLogin", "renewRegisterSession", "requestCustomerSignature", "searchCustomers", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "unpairRegisterDevice", "rotatePartnerWebhookSecret", "updateCustomer", "updatePartnerWebhook"];
|
|
17
17
|
export type Aufruf = typeof AUFRUFE[number];
|
|
18
18
|
/** Wie [KasseneckTransport], nur mit bekanntem Aufrufnamen. Nicht exportiert nach aussen. */
|
|
19
19
|
export type InternerTransport = <T = unknown>(functionName: Aufruf, params?: Record<string, unknown>, extraBodyFields?: TransportBodyFields, secretParams?: readonly string[]) => Promise<T>;
|
|
@@ -35,6 +35,7 @@ export const AUFRUFE = [
|
|
|
35
35
|
'issueInvoice',
|
|
36
36
|
'listCustomerCashregisters',
|
|
37
37
|
'listInvoices',
|
|
38
|
+
'listBrands',
|
|
38
39
|
'listMyArticleGroups',
|
|
39
40
|
'listMyArticles',
|
|
40
41
|
'listMyCashregisters',
|
|
@@ -47,6 +48,7 @@ export const AUFRUFE = [
|
|
|
47
48
|
'listRegisterUsersForDevice',
|
|
48
49
|
'listRegisterSessionsForDevice',
|
|
49
50
|
'pairRegisterDevice',
|
|
51
|
+
'recordInvoicePayment',
|
|
50
52
|
'registerPinLogin',
|
|
51
53
|
'registerUserLogin',
|
|
52
54
|
'renewRegisterSession',
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Funktionen (endpunkte.ts) und bleiben einzeln importierbar.
|
|
6
6
|
*/
|
|
7
7
|
import { type FetchLike } from '../client/transport.js';
|
|
8
|
-
import type { EInvoiceFormat } from './vertrag.js';
|
|
9
|
-
import type { CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, InvoiceDetail, InvoiceListQuery, InvoicePage, InvoiceSetupStatus, IssueInvoiceRequest, IssueResult } from './typen.js';
|
|
8
|
+
import type { EInvoiceFormat, InvoiceLanguage } from './vertrag.js';
|
|
9
|
+
import type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, InvoiceDetail, InvoiceListQuery, InvoicePage, InvoiceSetupStatus, IssueInvoiceRequest, IssueResult, RecordPaymentRequest, RecordPaymentResult } from './typen.js';
|
|
10
10
|
export interface RechnungApiOptions {
|
|
11
11
|
/** `api_key` des Kontos (`kr_live_…` / `kr_test_…`). Gehoert auf einen Server. */
|
|
12
12
|
apiKey: string;
|
|
@@ -37,9 +37,16 @@ export interface RechnungApi {
|
|
|
37
37
|
number: string;
|
|
38
38
|
}): Promise<InvoiceDetail>;
|
|
39
39
|
listInvoices(abfrage?: InvoiceListQuery): Promise<InvoicePage>;
|
|
40
|
-
|
|
40
|
+
/** Eine spaeter eingetroffene Zahlung nachtragen; `idempotencyKey` ist Pflicht. */
|
|
41
|
+
recordInvoicePayment(anfrage: RecordPaymentRequest): Promise<RecordPaymentResult>;
|
|
42
|
+
/** Mit `language` ungleich der Rechnungssprache: gekennzeichnete Uebersetzungskopie. */
|
|
43
|
+
getInvoicePdf(invoiceId: string, optionen?: {
|
|
44
|
+
language?: InvoiceLanguage;
|
|
45
|
+
}): Promise<Uint8Array>;
|
|
41
46
|
getInvoiceXml(invoiceId: string, format?: EInvoiceFormat): Promise<string>;
|
|
42
47
|
/** Darf dieses Konto ausstellen, und was fehlt noch? Laeuft auch ohne Freigabe. */
|
|
43
48
|
getInvoiceSetupStatus(): Promise<InvoiceSetupStatus>;
|
|
49
|
+
/** Die Marken des Kontos; `id` geht als `brandId` in `issueInvoice`. */
|
|
50
|
+
listBrands(): Promise<Brand[]>;
|
|
44
51
|
}
|
|
45
52
|
export declare function createRechnungApi(optionen: RechnungApiOptions): RechnungApi;
|
package/dist/esm/rechnung/api.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { createBinaryTransport, createTransport } from '../client/transport.js';
|
|
8
8
|
import { rechnungKeyAuth } from './auth.js';
|
|
9
|
-
import { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listInvoices, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
9
|
+
import { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
10
10
|
export function createRechnungApi(optionen) {
|
|
11
11
|
const transportOptionen = {
|
|
12
12
|
auth: rechnungKeyAuth({ apiKey: optionen.apiKey }),
|
|
@@ -26,8 +26,10 @@ export function createRechnungApi(optionen) {
|
|
|
26
26
|
createCreditNote: (anfrage) => createCreditNote(rufen, anfrage),
|
|
27
27
|
getInvoice: (kennung) => getInvoice(rufen, kennung),
|
|
28
28
|
listInvoices: (abfrage) => listInvoices(rufen, abfrage),
|
|
29
|
-
getInvoicePdf: (id) => getInvoicePdf(rufenBinaer, id),
|
|
29
|
+
getInvoicePdf: (id, o) => getInvoicePdf(rufenBinaer, id, o),
|
|
30
30
|
getInvoiceXml: (id, format) => getInvoiceXml(rufen, id, format),
|
|
31
31
|
getInvoiceSetupStatus: () => getInvoiceSetupStatus(rufen),
|
|
32
|
+
recordInvoicePayment: (anfrage) => recordInvoicePayment(rufen, anfrage),
|
|
33
|
+
listBrands: () => listBrands(rufen),
|
|
32
34
|
};
|
|
33
35
|
}
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* der Aufruf `KasseneckValidationError` mit `scope:'response'`.
|
|
18
18
|
*/
|
|
19
19
|
import type { InternerBinaerTransport, InternerTransport } from '../client/aufrufe.js';
|
|
20
|
-
import type { EInvoiceFormat } from './vertrag.js';
|
|
21
|
-
import type { CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, InvoiceDetail, InvoiceListQuery, InvoicePage, InvoiceSetupStatus, IssueInvoiceRequest, IssueResult } from './typen.js';
|
|
20
|
+
import type { EInvoiceFormat, InvoiceLanguage } from './vertrag.js';
|
|
21
|
+
import type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, InvoiceDetail, InvoiceListQuery, InvoicePage, InvoiceSetupStatus, IssueInvoiceRequest, IssueResult, RecordPaymentRequest, RecordPaymentResult } from './typen.js';
|
|
22
22
|
export declare function createCustomer(rufen: InternerTransport, customer: CustomerInput, optionen?: {
|
|
23
23
|
idempotencyKey?: string;
|
|
24
24
|
}): Promise<Customer>;
|
|
@@ -44,8 +44,27 @@ export declare function listInvoices(rufen: InternerTransport, abfrage?: Invoice
|
|
|
44
44
|
* Antwort. Vor dem ersten `issueInvoice` aufrufen und `missing` anzeigen.
|
|
45
45
|
*/
|
|
46
46
|
export declare function getInvoiceSetupStatus(rufen: InternerTransport): Promise<InvoiceSetupStatus>;
|
|
47
|
-
/**
|
|
48
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Das PDF der Rechnung (bei Gutschriften: der Gutschrift), mit eingebetteter
|
|
49
|
+
* Factur-X-Datei. Mit `language` in der anderen Sprache als der Rechnung kommt
|
|
50
|
+
* eine **Uebersetzungskopie**: dieselbe Nummer, auf jeder Seite als Uebersetzung
|
|
51
|
+
* gekennzeichnet, ohne eingebettete E-Rechnung — keine eigene Rechnung.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getInvoicePdf(rufenBinaer: InternerBinaerTransport, invoiceId: string, optionen?: {
|
|
54
|
+
language?: InvoiceLanguage;
|
|
55
|
+
}): Promise<Uint8Array>;
|
|
56
|
+
/**
|
|
57
|
+
* Eine Zahlung nachtragen, die nach dem Ausstellen eingetroffen ist
|
|
58
|
+
* (Ueberweisung, Teilzahlung). Der `idempotencyKey` ist Pflicht: ohne ihn
|
|
59
|
+
* bucht ein Wiederholungslauf nach einem Zeitlimit eine zweite Zahlung.
|
|
60
|
+
*
|
|
61
|
+
* Bei `method: 'cash'` wird die Zahlung gebucht und die Antwort traegt
|
|
62
|
+
* zusaetzlich `notice` — eine Barzahlung ist ein Barumsatz und braucht einen
|
|
63
|
+
* Beleg (§ 132a BAO), den dieser Vermerk nicht ersetzt.
|
|
64
|
+
*/
|
|
65
|
+
export declare function recordInvoicePayment(rufen: InternerTransport, anfrage: RecordPaymentRequest): Promise<RecordPaymentResult>;
|
|
66
|
+
/** Die Marken des Kontos — die Kennung geht als `brandId` in `issueInvoice`. */
|
|
67
|
+
export declare function listBrands(rufen: InternerTransport): Promise<Brand[]>;
|
|
49
68
|
/**
|
|
50
69
|
* Die E-Rechnung als XML-Text. Sie kommt im gewohnten Umschlag (`data.xml`)
|
|
51
70
|
* und nicht als rohe Datei: so bleibt ein fachlicher Fehler
|
|
@@ -114,9 +114,45 @@ export async function getInvoiceSetupStatus(rufen) {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
// ---- Dateien ----------------------------------------------------------------
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Das PDF der Rechnung (bei Gutschriften: der Gutschrift), mit eingebetteter
|
|
119
|
+
* Factur-X-Datei. Mit `language` in der anderen Sprache als der Rechnung kommt
|
|
120
|
+
* eine **Uebersetzungskopie**: dieselbe Nummer, auf jeder Seite als Uebersetzung
|
|
121
|
+
* gekennzeichnet, ohne eingebettete E-Rechnung — keine eigene Rechnung.
|
|
122
|
+
*/
|
|
123
|
+
export function getInvoicePdf(rufenBinaer, invoiceId, optionen = {}) {
|
|
124
|
+
const params = { invoiceId };
|
|
125
|
+
if (optionen.language)
|
|
126
|
+
params['language'] = optionen.language;
|
|
127
|
+
return rufenBinaer('getInvoicePdf', params);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Eine Zahlung nachtragen, die nach dem Ausstellen eingetroffen ist
|
|
131
|
+
* (Ueberweisung, Teilzahlung). Der `idempotencyKey` ist Pflicht: ohne ihn
|
|
132
|
+
* bucht ein Wiederholungslauf nach einem Zeitlimit eine zweite Zahlung.
|
|
133
|
+
*
|
|
134
|
+
* Bei `method: 'cash'` wird die Zahlung gebucht und die Antwort traegt
|
|
135
|
+
* zusaetzlich `notice` — eine Barzahlung ist ein Barumsatz und braucht einen
|
|
136
|
+
* Beleg (§ 132a BAO), den dieser Vermerk nicht ersetzt.
|
|
137
|
+
*/
|
|
138
|
+
export async function recordInvoicePayment(rufen, anfrage) {
|
|
139
|
+
const daten = await rufen('recordInvoicePayment', nutzlast(anfrage));
|
|
140
|
+
const roh = objekt(daten);
|
|
141
|
+
const ergebnis = {
|
|
142
|
+
invoice: pflichtObjekt('recordInvoicePayment', daten, 'invoice'),
|
|
143
|
+
payment: pflichtObjekt('recordInvoicePayment', daten, 'payment'),
|
|
144
|
+
replayed: roh['replayed'] === true,
|
|
145
|
+
};
|
|
146
|
+
if (roh['notice'])
|
|
147
|
+
ergebnis.notice = roh['notice'];
|
|
148
|
+
return ergebnis;
|
|
149
|
+
}
|
|
150
|
+
/** Die Marken des Kontos — die Kennung geht als `brandId` in `issueInvoice`. */
|
|
151
|
+
export async function listBrands(rufen) {
|
|
152
|
+
const brands = objekt(await rufen('listBrands', {}))['brands'];
|
|
153
|
+
if (!Array.isArray(brands))
|
|
154
|
+
throw new KasseneckValidationError('listBrands', 'Antwort ohne brands', 'response');
|
|
155
|
+
return brands;
|
|
120
156
|
}
|
|
121
157
|
/**
|
|
122
158
|
* Die E-Rechnung als XML-Text. Sie kommt im gewohnten Umschlag (`data.xml`)
|
|
@@ -13,6 +13,7 @@
|
|
|
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, listInvoices, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
17
|
-
export type { CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, IssueInvoiceRequest, IssueResult, } from './typen.js';
|
|
18
|
-
export {
|
|
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';
|
|
18
|
+
export { RECHNUNG_TEXTE, rechnungText, type RechnungTextSchluessel } from './texte.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, 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 InvoiceNoticeCode, type InvoiceUnit, type InvoiceSetupRequirement, type Format, type Feld, } from './vertrag.js';
|
|
@@ -13,5 +13,6 @@
|
|
|
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, listInvoices, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
17
|
-
export {
|
|
16
|
+
export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
|
|
17
|
+
export { RECHNUNG_TEXTE, rechnungText } from './texte.js';
|
|
18
|
+
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, 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';
|