@kreiseck/kasseneck-api 1.28.0 → 1.29.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 +11 -0
- package/README.md +84 -0
- package/dist/cjs/client/api.d.ts +15 -0
- package/dist/cjs/client/api.js +8 -0
- package/dist/cjs/client/aufrufe.d.ts +3 -3
- package/dist/cjs/client/aufrufe.js +28 -0
- package/dist/cjs/client/index.d.ts +1 -0
- package/dist/cjs/client/index.js +17 -1
- package/dist/cjs/client/terminal.d.ts +206 -0
- package/dist/cjs/client/terminal.js +288 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +17 -1
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/api.d.ts +15 -0
- package/dist/esm/client/api.js +8 -0
- package/dist/esm/client/aufrufe.d.ts +3 -3
- package/dist/esm/client/aufrufe.js +28 -0
- package/dist/esm/client/index.d.ts +1 -0
- package/dist/esm/client/index.js +1 -0
- package/dist/esm/client/terminal.d.ts +206 -0
- package/dist/esm/client/terminal.js +278 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/pos-texts.json +1 -1
- package/fixtures/surface.json +19 -3
- package/fixtures/v3/antworten/belege.json +1 -1
- package/fixtures/v3/antworten/belegmail.json +1 -1
- package/fixtures/v3/antworten/berichte.json +1 -1
- package/fixtures/v3/antworten/kasse-belege.json +1 -1
- package/fixtures/v3/antworten/kasse.json +2 -2
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +1 -1
- package/fixtures/v3/antworten/storno.json +1 -1
- package/fixtures/v3/stored/belege.json +1 -1
- package/fixtures/v3/stored/kasse.json +2 -2
- package/fixtures/v3/stored/rechnungen.json +1 -1
- package/fixtures/v3/v3-vokabular.json +55 -4
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { InternerTransport } from './aufrufe.js';
|
|
2
|
+
/**
|
|
3
|
+
* Kartenterminal am Handy (nur unter `/v3`): Kasseneck verwaltet die Zugaenge
|
|
4
|
+
* der Terminal-App, die Terminal-IDs (TID) je Betrieb und den Code, den der
|
|
5
|
+
* Anbieter beim Umzug einer TID auf ein anderes Geraet per E-Mail schickt.
|
|
6
|
+
* Die App holt sich Zugang, TID und Code von hier; am Geraet tippt niemand
|
|
7
|
+
* E-Mail, Passwort oder TID.
|
|
8
|
+
*
|
|
9
|
+
* **Anmeldung:** der `api_key` des Betriebs als Bearer. Ein `cashregister-token`
|
|
10
|
+
* (wie ihn `apiKeyAuth` mitsendet) stoert nicht, wird aber nicht gebraucht; eine
|
|
11
|
+
* App ohne Kasse nimmt eine Anmeldung nur mit dem Schluessel (etwa
|
|
12
|
+
* `inventoryKeyAuth` aus `./inventory`). Das Geraet weist sich zusaetzlich mit
|
|
13
|
+
* `deviceId` + `deviceSecret` aus, die es einmal mit [registerTerminalDevice]
|
|
14
|
+
* bekommt. Am Kassenweg gibt es die Aufrufe noch nicht.
|
|
15
|
+
*
|
|
16
|
+
* **Geheimnisse:** `deviceSecret`, `password` und `code` stehen nur in den
|
|
17
|
+
* Antworten bzw. Anfragen. Das Paket schreibt sie in kein Log und in keinen
|
|
18
|
+
* Fehler (das Geraetegeheimnis geht als `secretParams` an den Transport); die
|
|
19
|
+
* App darf sie ebenfalls nie loggen und speichert `deviceSecret` im sicheren
|
|
20
|
+
* Speicher des Geraets.
|
|
21
|
+
*
|
|
22
|
+
* Geprueft wird hier nur die Form; was der Server nicht annimmt, lehnt er mit
|
|
23
|
+
* einem Code aus [TERMINAL_ERROR_CODES] ab.
|
|
24
|
+
*/
|
|
25
|
+
/** Plattform des Geraets. */
|
|
26
|
+
export declare const TERMINAL_PLATFORMS: readonly ["android", "ios"];
|
|
27
|
+
export type TerminalPlatform = (typeof TERMINAL_PLATFORMS)[number];
|
|
28
|
+
/**
|
|
29
|
+
* Einrichtungsstand der Terminal-App am Geraet: TID zugewiesen, wartet auf den
|
|
30
|
+
* Code, wird eingerichtet, bereit, fehlgeschlagen.
|
|
31
|
+
*/
|
|
32
|
+
export declare const TERMINAL_SETUP_STATES: readonly ["assigned", "waiting_for_code", "setting_up", "ready", "failed"];
|
|
33
|
+
export type TerminalSetupState = (typeof TERMINAL_SETUP_STATES)[number];
|
|
34
|
+
/**
|
|
35
|
+
* Stand einer Code-Anfrage: keine Anfrage, sucht, gefunden, zugestellt,
|
|
36
|
+
* unklar (mehrere Geraete warteten gleichzeitig), kein Code gefunden,
|
|
37
|
+
* abgelaufen.
|
|
38
|
+
*/
|
|
39
|
+
export declare const TERMINAL_CODE_STATUSES: readonly ["none", "searching", "found", "delivered", "unclear", "no_code", "expired"];
|
|
40
|
+
export type TerminalCodeStatus = (typeof TERMINAL_CODE_STATUSES)[number];
|
|
41
|
+
/** Woher ein Code kam: aus dem Postfach oder vom Support eingetragen. */
|
|
42
|
+
export declare const TERMINAL_CODE_SOURCES: readonly ["mailbox", "support"];
|
|
43
|
+
export type TerminalCodeSource = (typeof TERMINAL_CODE_SOURCES)[number];
|
|
44
|
+
/**
|
|
45
|
+
* Fehlercodes der sieben Aufrufe (`code` des [KasseneckApiError]) wie im
|
|
46
|
+
* Vertrag des Backends (`errorCodes.terminal` in `fixtures/v3/v3-vokabular.json`),
|
|
47
|
+
* in dessen Reihenfolge; dazu kommen die gemeinsamen Codes von Anmeldung und
|
|
48
|
+
* Rand. Ein Code ausserhalb bleibt ueber `KasseneckApiError.code` lesbar.
|
|
49
|
+
*/
|
|
50
|
+
export declare const TERMINAL_ERROR_CODES: readonly ["terminal_not_enabled", "terminal_test_environment", "terminal_device_unknown", "terminal_device_blocked", "invalid_terminal_device", "too_many_terminal_devices", "terminal_not_in_business", "terminal_code_manual", "terminal_code_rate_limited", "terminal_not_assigned", "server_error"];
|
|
51
|
+
export type TerminalErrorCode = (typeof TERMINAL_ERROR_CODES)[number];
|
|
52
|
+
/** Laengen der Texte, die der Server annimmt (nach Abzug von Leerraum am Rand). */
|
|
53
|
+
export declare const TERMINAL_LABEL_MAX = 60;
|
|
54
|
+
export declare const TERMINAL_APP_MAX = 40;
|
|
55
|
+
export declare const TERMINAL_REQUESTED_BY_MAX = 80;
|
|
56
|
+
/** Ausweis des Geraets, aus [registerTerminalDevice]. */
|
|
57
|
+
export interface TerminalDeviceCredentials {
|
|
58
|
+
deviceId: string;
|
|
59
|
+
/** Geheimnis des Geraets: nur im sicheren Speicher ablegen, nie loggen. */
|
|
60
|
+
deviceSecret: string;
|
|
61
|
+
}
|
|
62
|
+
/** Eingabe von [registerTerminalDevice]. */
|
|
63
|
+
export interface RegisterTerminalDeviceOptions {
|
|
64
|
+
/** Anzeige des Geraets, 1 bis 60 Zeichen (etwa Modell und Fahrer). */
|
|
65
|
+
label: string;
|
|
66
|
+
platform: TerminalPlatform;
|
|
67
|
+
/** App und Version, 1 bis 40 Zeichen, z. B. `karteck/1.6.21`. */
|
|
68
|
+
app: string;
|
|
69
|
+
/** Wer das Geraet anmeldet, hoechstens 80 Zeichen; steht im Protokoll. */
|
|
70
|
+
requestedBy?: string;
|
|
71
|
+
}
|
|
72
|
+
/** Antwort von [registerTerminalDevice]. `deviceSecret` kommt nur in dieser Antwort, danach nie wieder. */
|
|
73
|
+
export type RegisteredTerminalDevice = TerminalDeviceCredentials;
|
|
74
|
+
/** Eingabe von [getTerminalAccess]: Ausweis, dazu optional neue Anzeigewerte des Geraets. */
|
|
75
|
+
export interface GetTerminalAccessOptions extends TerminalDeviceCredentials {
|
|
76
|
+
platform?: TerminalPlatform;
|
|
77
|
+
/** App und Version, 1 bis 40 Zeichen. */
|
|
78
|
+
app?: string;
|
|
79
|
+
/** Anzeige des Geraets, 1 bis 60 Zeichen. */
|
|
80
|
+
label?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Eingabe von [claimTerminal]. */
|
|
83
|
+
export interface ClaimTerminalOptions extends TerminalDeviceCredentials {
|
|
84
|
+
/** TID aus `TerminalAccessUnavailable.terminals`. */
|
|
85
|
+
terminalId: string;
|
|
86
|
+
/** Anzeige des Geraets, 1 bis 60 Zeichen. */
|
|
87
|
+
label?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Eingabe von [requestTerminalCode]. */
|
|
90
|
+
export interface RequestTerminalCodeOptions extends TerminalDeviceCredentials {
|
|
91
|
+
platform: TerminalPlatform;
|
|
92
|
+
/** Wer den Code anfragt, hoechstens 80 Zeichen; steht im Protokoll. */
|
|
93
|
+
requestedBy?: string;
|
|
94
|
+
}
|
|
95
|
+
/** Eingabe von [reportTerminalLogin]. */
|
|
96
|
+
export interface ReportTerminalLoginOptions extends TerminalDeviceCredentials {
|
|
97
|
+
/** TID, mit der sich die Terminal-App angemeldet hat. */
|
|
98
|
+
terminalId: string;
|
|
99
|
+
success: boolean;
|
|
100
|
+
/** Erste Anmeldung dieser TID auf diesem Geraet. */
|
|
101
|
+
newOnDevice: boolean;
|
|
102
|
+
}
|
|
103
|
+
/** Einrichtungsstand mit Zeitpunkt (ISO 8601, UTC). Ein spaeter ergaenzter Stand kommt unveraendert an. */
|
|
104
|
+
export interface TerminalSetup {
|
|
105
|
+
state: TerminalSetupState | (string & {});
|
|
106
|
+
since: string | null;
|
|
107
|
+
}
|
|
108
|
+
/** Wie die App einen eingefuegten Code prueft: Laenge und Bezeichnungen vor dem Code in der Mail. */
|
|
109
|
+
export interface TerminalCodeFormat {
|
|
110
|
+
length: number;
|
|
111
|
+
labels: string[];
|
|
112
|
+
}
|
|
113
|
+
/** Zugang fuer die Terminal-App ([getTerminalAccess], [claimTerminal]). */
|
|
114
|
+
export interface TerminalAccess {
|
|
115
|
+
available: true;
|
|
116
|
+
/** Login der Terminal-App. */
|
|
117
|
+
username: string;
|
|
118
|
+
/** Passwort der Terminal-App: nie loggen, nie dauerhaft ausserhalb des sicheren Speichers ablegen. */
|
|
119
|
+
password: string;
|
|
120
|
+
terminalId: string;
|
|
121
|
+
terminalName: string | null;
|
|
122
|
+
accountId: string;
|
|
123
|
+
/** `true`: der Code kommt automatisch ([requestTerminalCode]); sonst fragt die App den Menschen danach. */
|
|
124
|
+
autoCode: boolean;
|
|
125
|
+
codeFormat: TerminalCodeFormat;
|
|
126
|
+
setup: TerminalSetup;
|
|
127
|
+
/** Letzte Aenderung von Konto oder Zuordnung (ISO 8601), `null` unbekannt. */
|
|
128
|
+
updatedAt: string | null;
|
|
129
|
+
}
|
|
130
|
+
/** Eine TID des eigenen Betriebs, die gerade ein anderes Geraet nutzt. */
|
|
131
|
+
export interface TerminalListEntry {
|
|
132
|
+
terminalId: string;
|
|
133
|
+
name: string | null;
|
|
134
|
+
/** Anzeige des Geraets, das sie zuletzt nutzte. */
|
|
135
|
+
lastUsedBy: string | null;
|
|
136
|
+
lastUsedAt: string | null;
|
|
137
|
+
}
|
|
138
|
+
/** Keine TID frei: die TIDs des eigenen Betriebs zur Auswahl fuer [claimTerminal]. */
|
|
139
|
+
export interface TerminalAccessUnavailable {
|
|
140
|
+
available: false;
|
|
141
|
+
reason: 'no_free_terminal' | (string & {});
|
|
142
|
+
terminals: TerminalListEntry[];
|
|
143
|
+
}
|
|
144
|
+
/** Antwort von [getTerminalAccess]: Zugang oder Liste. */
|
|
145
|
+
export type TerminalAccessResult = TerminalAccess | TerminalAccessUnavailable;
|
|
146
|
+
/** Antwort von [requestTerminalCode]. */
|
|
147
|
+
export interface TerminalCodeRequest {
|
|
148
|
+
status: TerminalCodeStatus | (string & {});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Antwort von [getTerminalCode]. `code` (6 Zeichen, Gross-/Kleinschreibung
|
|
152
|
+
* zaehlt) nur bei `found` bzw. auf iOS auch bei `delivered` bis `validUntil`.
|
|
153
|
+
*/
|
|
154
|
+
export interface TerminalCode {
|
|
155
|
+
status: TerminalCodeStatus | (string & {});
|
|
156
|
+
/** Der Code: nie loggen. */
|
|
157
|
+
code?: string;
|
|
158
|
+
source?: TerminalCodeSource | (string & {});
|
|
159
|
+
validUntil?: string | null;
|
|
160
|
+
setup: TerminalSetup;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Meldet ein Geraet einmal an (`registerTerminalDevice`) und liefert seinen
|
|
164
|
+
* Ausweis. `deviceSecret` steht nur in dieser Antwort: im sicheren Speicher
|
|
165
|
+
* ablegen, nie loggen. Hoechstens 20 Geraete je Betrieb und 10 Anmeldungen je
|
|
166
|
+
* Tag (`too_many_terminal_devices`). Eine Wiederholung nach unklarem Ausgang
|
|
167
|
+
* legt ein weiteres Geraet an.
|
|
168
|
+
*/
|
|
169
|
+
export declare function registerTerminalDevice(transport: InternerTransport, options: RegisterTerminalDeviceOptions): Promise<RegisteredTerminalDevice>;
|
|
170
|
+
/**
|
|
171
|
+
* Zugang und TID fuer dieses Geraet (`getTerminalAccess`). Das Geraet behaelt
|
|
172
|
+
* seine TID; ohne eine bekommt es eine freie seines Betriebs. Ist keine frei,
|
|
173
|
+
* kommt `available: false` mit den TIDs des eigenen Betriebs zur Auswahl fuer
|
|
174
|
+
* [claimTerminal]. Die App ruft das bei jedem Start und mindestens einmal am
|
|
175
|
+
* Tag. `password` nie loggen.
|
|
176
|
+
*/
|
|
177
|
+
export declare function getTerminalAccess(transport: InternerTransport, options: GetTerminalAccessOptions): Promise<TerminalAccessResult>;
|
|
178
|
+
/**
|
|
179
|
+
* Uebernimmt eine TID des eigenen Betriebs (`claimTerminal`); das Geraet, das
|
|
180
|
+
* sie bisher nutzte, verliert sie. Antwort wie [getTerminalAccess] mit
|
|
181
|
+
* Zugang. Eine fremde oder unbekannte TID ist `terminal_not_in_business`.
|
|
182
|
+
*/
|
|
183
|
+
export declare function claimTerminal(transport: InternerTransport, options: ClaimTerminalOptions): Promise<TerminalAccess>;
|
|
184
|
+
/**
|
|
185
|
+
* Fragt den Code fuer die TID dieses Geraets an (`requestTerminalCode`); nur
|
|
186
|
+
* bei Konten mit Postfach (`TerminalAccess.autoCode`), sonst
|
|
187
|
+
* `terminal_code_manual`. Eine offene Anfrage juenger als 6 Minuten bleibt
|
|
188
|
+
* (doppeltes Tippen schadet nicht); hoechstens 6 Anfragen je Stunde
|
|
189
|
+
* (`terminal_code_rate_limited`). Den Code holt danach [getTerminalCode].
|
|
190
|
+
*/
|
|
191
|
+
export declare function requestTerminalCode(transport: InternerTransport, options: RequestTerminalCodeOptions): Promise<TerminalCodeRequest>;
|
|
192
|
+
/**
|
|
193
|
+
* Stand der Code-Anfrage und der Einrichtung (`getTerminalCode`); ohne Anfrage
|
|
194
|
+
* `status: 'none'`. Bei `found` steht der Code genau in dieser Antwort: auf
|
|
195
|
+
* Android wird er dabei verbraucht (eine verlorene Antwort verliert ihn), auf
|
|
196
|
+
* iOS bleibt er bis `validUntil` lesbar. Den Code nie loggen.
|
|
197
|
+
*/
|
|
198
|
+
export declare function getTerminalCode(transport: InternerTransport, options: TerminalDeviceCredentials): Promise<TerminalCode>;
|
|
199
|
+
/**
|
|
200
|
+
* Meldet den Ausgang der Anmeldung in der Terminal-App (`reportTerminalLogin`).
|
|
201
|
+
* Antwort: nichts. Eine andere als die zugewiesene TID schreibt der Server
|
|
202
|
+
* nicht.
|
|
203
|
+
*/
|
|
204
|
+
export declare function reportTerminalLogin(transport: InternerTransport, options: ReportTerminalLoginOptions): Promise<void>;
|
|
205
|
+
/** Meldet, dass die Terminal-App fertig eingerichtet ist (`reportTerminalReady`). Antwort: nichts. */
|
|
206
|
+
export declare function reportTerminalReady(transport: InternerTransport, options: TerminalDeviceCredentials): Promise<void>;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { KasseneckValidationError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Kartenterminal am Handy (nur unter `/v3`): Kasseneck verwaltet die Zugaenge
|
|
4
|
+
* der Terminal-App, die Terminal-IDs (TID) je Betrieb und den Code, den der
|
|
5
|
+
* Anbieter beim Umzug einer TID auf ein anderes Geraet per E-Mail schickt.
|
|
6
|
+
* Die App holt sich Zugang, TID und Code von hier; am Geraet tippt niemand
|
|
7
|
+
* E-Mail, Passwort oder TID.
|
|
8
|
+
*
|
|
9
|
+
* **Anmeldung:** der `api_key` des Betriebs als Bearer. Ein `cashregister-token`
|
|
10
|
+
* (wie ihn `apiKeyAuth` mitsendet) stoert nicht, wird aber nicht gebraucht; eine
|
|
11
|
+
* App ohne Kasse nimmt eine Anmeldung nur mit dem Schluessel (etwa
|
|
12
|
+
* `inventoryKeyAuth` aus `./inventory`). Das Geraet weist sich zusaetzlich mit
|
|
13
|
+
* `deviceId` + `deviceSecret` aus, die es einmal mit [registerTerminalDevice]
|
|
14
|
+
* bekommt. Am Kassenweg gibt es die Aufrufe noch nicht.
|
|
15
|
+
*
|
|
16
|
+
* **Geheimnisse:** `deviceSecret`, `password` und `code` stehen nur in den
|
|
17
|
+
* Antworten bzw. Anfragen. Das Paket schreibt sie in kein Log und in keinen
|
|
18
|
+
* Fehler (das Geraetegeheimnis geht als `secretParams` an den Transport); die
|
|
19
|
+
* App darf sie ebenfalls nie loggen und speichert `deviceSecret` im sicheren
|
|
20
|
+
* Speicher des Geraets.
|
|
21
|
+
*
|
|
22
|
+
* Geprueft wird hier nur die Form; was der Server nicht annimmt, lehnt er mit
|
|
23
|
+
* einem Code aus [TERMINAL_ERROR_CODES] ab.
|
|
24
|
+
*/
|
|
25
|
+
/** Plattform des Geraets. */
|
|
26
|
+
export const TERMINAL_PLATFORMS = Object.freeze(['android', 'ios']);
|
|
27
|
+
/**
|
|
28
|
+
* Einrichtungsstand der Terminal-App am Geraet: TID zugewiesen, wartet auf den
|
|
29
|
+
* Code, wird eingerichtet, bereit, fehlgeschlagen.
|
|
30
|
+
*/
|
|
31
|
+
export const TERMINAL_SETUP_STATES = Object.freeze(['assigned', 'waiting_for_code', 'setting_up', 'ready', 'failed']);
|
|
32
|
+
/**
|
|
33
|
+
* Stand einer Code-Anfrage: keine Anfrage, sucht, gefunden, zugestellt,
|
|
34
|
+
* unklar (mehrere Geraete warteten gleichzeitig), kein Code gefunden,
|
|
35
|
+
* abgelaufen.
|
|
36
|
+
*/
|
|
37
|
+
export const TERMINAL_CODE_STATUSES = Object.freeze(['none', 'searching', 'found', 'delivered', 'unclear', 'no_code', 'expired']);
|
|
38
|
+
/** Woher ein Code kam: aus dem Postfach oder vom Support eingetragen. */
|
|
39
|
+
export const TERMINAL_CODE_SOURCES = Object.freeze(['mailbox', 'support']);
|
|
40
|
+
/**
|
|
41
|
+
* Fehlercodes der sieben Aufrufe (`code` des [KasseneckApiError]) wie im
|
|
42
|
+
* Vertrag des Backends (`errorCodes.terminal` in `fixtures/v3/v3-vokabular.json`),
|
|
43
|
+
* in dessen Reihenfolge; dazu kommen die gemeinsamen Codes von Anmeldung und
|
|
44
|
+
* Rand. Ein Code ausserhalb bleibt ueber `KasseneckApiError.code` lesbar.
|
|
45
|
+
*/
|
|
46
|
+
export const TERMINAL_ERROR_CODES = Object.freeze([
|
|
47
|
+
'terminal_not_enabled', // dem Betrieb ist keine aktive TID zugeordnet
|
|
48
|
+
'terminal_test_environment', // nur in der Live-Umgebung (kein kr_test_-Schluessel)
|
|
49
|
+
'terminal_device_unknown', // deviceId oder deviceSecret falsch (gleiche Antwort fuer beides)
|
|
50
|
+
'terminal_device_blocked', // das Geraet ist gesperrt
|
|
51
|
+
'invalid_terminal_device', // Angaben zum Geraet unvollstaendig oder ungueltig
|
|
52
|
+
'too_many_terminal_devices', // Obergrenze der Geraete je Betrieb oder der Anmeldungen je Tag erreicht
|
|
53
|
+
'terminal_not_in_business', // die TID gibt es nicht oder sie gehoert einem anderen Betrieb (gleiche Antwort)
|
|
54
|
+
'terminal_code_manual', // Konto ohne Postfach: die App fragt nach dem Code
|
|
55
|
+
'terminal_code_rate_limited', // hoechstens 6 Code-Anfragen je Geraet und Stunde
|
|
56
|
+
'terminal_not_assigned', // dem Geraet ist keine TID zugeordnet: zuerst getTerminalAccess
|
|
57
|
+
'server_error',
|
|
58
|
+
]);
|
|
59
|
+
/** Laengen der Texte, die der Server annimmt (nach Abzug von Leerraum am Rand). */
|
|
60
|
+
export const TERMINAL_LABEL_MAX = 60;
|
|
61
|
+
export const TERMINAL_APP_MAX = 40;
|
|
62
|
+
export const TERMINAL_REQUESTED_BY_MAX = 80;
|
|
63
|
+
// ---- Hilfen -------------------------------------------------------------------------------------
|
|
64
|
+
function eingabefehler(name, grund) {
|
|
65
|
+
return new KasseneckValidationError(name, grund, 'request');
|
|
66
|
+
}
|
|
67
|
+
function antwortfehler(name, grund) {
|
|
68
|
+
return new KasseneckValidationError(name, grund, 'response');
|
|
69
|
+
}
|
|
70
|
+
const istObjekt = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
71
|
+
const istText = (v) => typeof v === 'string' && v.trim() !== '';
|
|
72
|
+
const textOderNull = (v) => (typeof v === 'string' ? v : null);
|
|
73
|
+
/** Pflichttext mit Hoechstlaenge (nach Abzug von Leerraum am Rand, wie der Server). */
|
|
74
|
+
function pruefeText(name, feld, wert, max) {
|
|
75
|
+
if (typeof wert !== 'string' || wert.trim() === '')
|
|
76
|
+
throw eingabefehler(name, `${feld} fehlt oder ist leer`);
|
|
77
|
+
if (wert.trim().length > max)
|
|
78
|
+
throw eingabefehler(name, `${feld}: hoechstens ${max} Zeichen`);
|
|
79
|
+
return wert;
|
|
80
|
+
}
|
|
81
|
+
function pruefePlattform(name, wert) {
|
|
82
|
+
if (!TERMINAL_PLATFORMS.includes(wert))
|
|
83
|
+
throw eingabefehler(name, 'platform muss android oder ios sein');
|
|
84
|
+
return wert;
|
|
85
|
+
}
|
|
86
|
+
/** Ausweis des Geraets pruefen; die Meldung nennt nie das Geheimnis. */
|
|
87
|
+
function ausweis(name, options) {
|
|
88
|
+
if (!istObjekt(options))
|
|
89
|
+
throw eingabefehler(name, 'Anfrage muss ein Objekt sein');
|
|
90
|
+
if (!istText(options.deviceId))
|
|
91
|
+
throw eingabefehler(name, 'deviceId fehlt oder ist leer');
|
|
92
|
+
if (!istText(options.deviceSecret))
|
|
93
|
+
throw eingabefehler(name, 'deviceSecret fehlt oder ist leer');
|
|
94
|
+
return { params: { deviceId: options.deviceId, deviceSecret: options.deviceSecret }, geheim: options.deviceSecret };
|
|
95
|
+
}
|
|
96
|
+
/** Optionale Felder nur, wenn gesetzt. */
|
|
97
|
+
function optional(name, params, options) {
|
|
98
|
+
if (options.platform !== undefined)
|
|
99
|
+
params['platform'] = pruefePlattform(name, options.platform);
|
|
100
|
+
if (options.app !== undefined)
|
|
101
|
+
params['app'] = pruefeText(name, 'app', options.app, TERMINAL_APP_MAX);
|
|
102
|
+
if (options.label !== undefined)
|
|
103
|
+
params['label'] = pruefeText(name, 'label', options.label, TERMINAL_LABEL_MAX);
|
|
104
|
+
if (options.requestedBy !== undefined)
|
|
105
|
+
params['requestedBy'] = pruefeText(name, 'requestedBy', options.requestedBy, TERMINAL_REQUESTED_BY_MAX);
|
|
106
|
+
}
|
|
107
|
+
function setupAus(name, wert) {
|
|
108
|
+
if (!istObjekt(wert) || typeof wert['state'] !== 'string')
|
|
109
|
+
throw antwortfehler(name, 'Antwort ohne setup.state');
|
|
110
|
+
return { state: wert['state'], since: textOderNull(wert['since']) };
|
|
111
|
+
}
|
|
112
|
+
/** Zugang aus der Antwort; die Meldungen nennen nie Login, Passwort oder TID. */
|
|
113
|
+
function zugangAus(name, d) {
|
|
114
|
+
if (!istText(d['username']) || !istText(d['password']) || !istText(d['terminalId']) || typeof d['accountId'] !== 'string') {
|
|
115
|
+
throw antwortfehler(name, 'Zugang unvollstaendig (username, password, terminalId, accountId)');
|
|
116
|
+
}
|
|
117
|
+
if (typeof d['autoCode'] !== 'boolean')
|
|
118
|
+
throw antwortfehler(name, 'Antwort ohne autoCode');
|
|
119
|
+
const format = d['codeFormat'];
|
|
120
|
+
if (!istObjekt(format) || !(typeof format['length'] === 'number' && Number.isSafeInteger(format['length']) && format['length'] > 0) ||
|
|
121
|
+
!Array.isArray(format['labels']) || !format['labels'].every((l) => typeof l === 'string')) {
|
|
122
|
+
throw antwortfehler(name, 'Antwort ohne gueltiges codeFormat (length, labels)');
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
available: true,
|
|
126
|
+
username: d['username'],
|
|
127
|
+
password: d['password'],
|
|
128
|
+
terminalId: d['terminalId'],
|
|
129
|
+
terminalName: textOderNull(d['terminalName']),
|
|
130
|
+
accountId: d['accountId'],
|
|
131
|
+
autoCode: d['autoCode'],
|
|
132
|
+
codeFormat: { length: format['length'], labels: [...format['labels']] },
|
|
133
|
+
setup: setupAus(name, d['setup']),
|
|
134
|
+
updatedAt: textOderNull(d['updatedAt']),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function listeAus(name, d) {
|
|
138
|
+
const roh = d['terminals'];
|
|
139
|
+
if (typeof d['reason'] !== 'string' || !Array.isArray(roh))
|
|
140
|
+
throw antwortfehler(name, 'Antwort ohne reason oder terminals');
|
|
141
|
+
const terminals = [];
|
|
142
|
+
for (const t of roh) {
|
|
143
|
+
if (!istObjekt(t) || !istText(t['terminalId']))
|
|
144
|
+
throw antwortfehler(name, 'Eintrag in terminals ohne terminalId');
|
|
145
|
+
terminals.push({
|
|
146
|
+
terminalId: t['terminalId'],
|
|
147
|
+
name: textOderNull(t['name']),
|
|
148
|
+
lastUsedBy: textOderNull(t['lastUsedBy']),
|
|
149
|
+
lastUsedAt: textOderNull(t['lastUsedAt']),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return { available: false, reason: d['reason'], terminals };
|
|
153
|
+
}
|
|
154
|
+
async function zugangRufen(transport, name, params, geheim) {
|
|
155
|
+
const daten = await transport(name, params, undefined, [geheim]);
|
|
156
|
+
if (!istObjekt(daten) || typeof daten['available'] !== 'boolean')
|
|
157
|
+
throw antwortfehler(name, 'Antwort ohne available');
|
|
158
|
+
return daten['available'] ? zugangAus(name, daten) : listeAus(name, daten);
|
|
159
|
+
}
|
|
160
|
+
// ---- Aufrufe ------------------------------------------------------------------------------------
|
|
161
|
+
/**
|
|
162
|
+
* Meldet ein Geraet einmal an (`registerTerminalDevice`) und liefert seinen
|
|
163
|
+
* Ausweis. `deviceSecret` steht nur in dieser Antwort: im sicheren Speicher
|
|
164
|
+
* ablegen, nie loggen. Hoechstens 20 Geraete je Betrieb und 10 Anmeldungen je
|
|
165
|
+
* Tag (`too_many_terminal_devices`). Eine Wiederholung nach unklarem Ausgang
|
|
166
|
+
* legt ein weiteres Geraet an.
|
|
167
|
+
*/
|
|
168
|
+
export async function registerTerminalDevice(transport, options) {
|
|
169
|
+
const name = 'registerTerminalDevice';
|
|
170
|
+
if (!istObjekt(options))
|
|
171
|
+
throw eingabefehler(name, 'Anfrage muss ein Objekt sein');
|
|
172
|
+
const params = {
|
|
173
|
+
label: pruefeText(name, 'label', options.label, TERMINAL_LABEL_MAX),
|
|
174
|
+
platform: pruefePlattform(name, options.platform),
|
|
175
|
+
app: pruefeText(name, 'app', options.app, TERMINAL_APP_MAX),
|
|
176
|
+
};
|
|
177
|
+
optional(name, params, { requestedBy: options.requestedBy });
|
|
178
|
+
const daten = await transport(name, params);
|
|
179
|
+
if (!istObjekt(daten) || !istText(daten['deviceId']) || !istText(daten['deviceSecret'])) {
|
|
180
|
+
throw antwortfehler(name, 'Antwort ohne deviceId oder deviceSecret');
|
|
181
|
+
}
|
|
182
|
+
return { deviceId: daten['deviceId'], deviceSecret: daten['deviceSecret'] };
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Zugang und TID fuer dieses Geraet (`getTerminalAccess`). Das Geraet behaelt
|
|
186
|
+
* seine TID; ohne eine bekommt es eine freie seines Betriebs. Ist keine frei,
|
|
187
|
+
* kommt `available: false` mit den TIDs des eigenen Betriebs zur Auswahl fuer
|
|
188
|
+
* [claimTerminal]. Die App ruft das bei jedem Start und mindestens einmal am
|
|
189
|
+
* Tag. `password` nie loggen.
|
|
190
|
+
*/
|
|
191
|
+
export async function getTerminalAccess(transport, options) {
|
|
192
|
+
const name = 'getTerminalAccess';
|
|
193
|
+
const { params, geheim } = ausweis(name, options);
|
|
194
|
+
optional(name, params, { platform: options.platform, app: options.app, label: options.label });
|
|
195
|
+
return zugangRufen(transport, name, params, geheim);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Uebernimmt eine TID des eigenen Betriebs (`claimTerminal`); das Geraet, das
|
|
199
|
+
* sie bisher nutzte, verliert sie. Antwort wie [getTerminalAccess] mit
|
|
200
|
+
* Zugang. Eine fremde oder unbekannte TID ist `terminal_not_in_business`.
|
|
201
|
+
*/
|
|
202
|
+
export async function claimTerminal(transport, options) {
|
|
203
|
+
const name = 'claimTerminal';
|
|
204
|
+
const { params, geheim } = ausweis(name, options);
|
|
205
|
+
if (!istText(options.terminalId))
|
|
206
|
+
throw eingabefehler(name, 'terminalId fehlt oder ist leer');
|
|
207
|
+
params['terminalId'] = options.terminalId;
|
|
208
|
+
optional(name, params, { label: options.label });
|
|
209
|
+
const ergebnis = await zugangRufen(transport, name, params, geheim);
|
|
210
|
+
if (!ergebnis.available)
|
|
211
|
+
throw antwortfehler(name, 'Antwort ohne Zugang');
|
|
212
|
+
return ergebnis;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Fragt den Code fuer die TID dieses Geraets an (`requestTerminalCode`); nur
|
|
216
|
+
* bei Konten mit Postfach (`TerminalAccess.autoCode`), sonst
|
|
217
|
+
* `terminal_code_manual`. Eine offene Anfrage juenger als 6 Minuten bleibt
|
|
218
|
+
* (doppeltes Tippen schadet nicht); hoechstens 6 Anfragen je Stunde
|
|
219
|
+
* (`terminal_code_rate_limited`). Den Code holt danach [getTerminalCode].
|
|
220
|
+
*/
|
|
221
|
+
export async function requestTerminalCode(transport, options) {
|
|
222
|
+
const name = 'requestTerminalCode';
|
|
223
|
+
const { params, geheim } = ausweis(name, options);
|
|
224
|
+
params['platform'] = pruefePlattform(name, options.platform);
|
|
225
|
+
optional(name, params, { requestedBy: options.requestedBy });
|
|
226
|
+
const daten = await transport(name, params, undefined, [geheim]);
|
|
227
|
+
if (!istObjekt(daten) || typeof daten['status'] !== 'string')
|
|
228
|
+
throw antwortfehler(name, 'Antwort ohne status');
|
|
229
|
+
return { status: daten['status'] };
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Stand der Code-Anfrage und der Einrichtung (`getTerminalCode`); ohne Anfrage
|
|
233
|
+
* `status: 'none'`. Bei `found` steht der Code genau in dieser Antwort: auf
|
|
234
|
+
* Android wird er dabei verbraucht (eine verlorene Antwort verliert ihn), auf
|
|
235
|
+
* iOS bleibt er bis `validUntil` lesbar. Den Code nie loggen.
|
|
236
|
+
*/
|
|
237
|
+
export async function getTerminalCode(transport, options) {
|
|
238
|
+
const name = 'getTerminalCode';
|
|
239
|
+
const { params, geheim } = ausweis(name, options);
|
|
240
|
+
const daten = await transport(name, params, undefined, [geheim]);
|
|
241
|
+
if (!istObjekt(daten) || typeof daten['status'] !== 'string')
|
|
242
|
+
throw antwortfehler(name, 'Antwort ohne status');
|
|
243
|
+
const ergebnis = { status: daten['status'], setup: setupAus(name, daten['setup']) };
|
|
244
|
+
if (daten['code'] !== undefined && daten['code'] !== null) {
|
|
245
|
+
if (!istText(daten['code']))
|
|
246
|
+
throw antwortfehler(name, 'code ist kein Text');
|
|
247
|
+
ergebnis.code = daten['code'];
|
|
248
|
+
if (typeof daten['source'] === 'string')
|
|
249
|
+
ergebnis.source = daten['source'];
|
|
250
|
+
ergebnis.validUntil = textOderNull(daten['validUntil']);
|
|
251
|
+
}
|
|
252
|
+
return ergebnis;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Meldet den Ausgang der Anmeldung in der Terminal-App (`reportTerminalLogin`).
|
|
256
|
+
* Antwort: nichts. Eine andere als die zugewiesene TID schreibt der Server
|
|
257
|
+
* nicht.
|
|
258
|
+
*/
|
|
259
|
+
export async function reportTerminalLogin(transport, options) {
|
|
260
|
+
const name = 'reportTerminalLogin';
|
|
261
|
+
const { params, geheim } = ausweis(name, options);
|
|
262
|
+
if (!istText(options.terminalId))
|
|
263
|
+
throw eingabefehler(name, 'terminalId fehlt oder ist leer');
|
|
264
|
+
if (typeof options.success !== 'boolean')
|
|
265
|
+
throw eingabefehler(name, 'success muss true oder false sein');
|
|
266
|
+
if (typeof options.newOnDevice !== 'boolean')
|
|
267
|
+
throw eingabefehler(name, 'newOnDevice muss true oder false sein');
|
|
268
|
+
params['terminalId'] = options.terminalId;
|
|
269
|
+
params['success'] = options.success;
|
|
270
|
+
params['newOnDevice'] = options.newOnDevice;
|
|
271
|
+
await transport(name, params, undefined, [geheim]);
|
|
272
|
+
}
|
|
273
|
+
/** Meldet, dass die Terminal-App fertig eingerichtet ist (`reportTerminalReady`). Antwort: nichts. */
|
|
274
|
+
export async function reportTerminalReady(transport, options) {
|
|
275
|
+
const name = 'reportTerminalReady';
|
|
276
|
+
const { params, geheim } = ausweis(name, options);
|
|
277
|
+
await transport(name, params, undefined, [geheim]);
|
|
278
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ReceiptType, type ReceiptTypeKey, VatRate, type VatRateKey, KeckPaymentMethod, type KeckPaymentMethodKey, CreditCardProvider, type CreditCardProviderKey, VoucherType, type VoucherTypeKey, VoucherAction, type VoucherActionKey, StripeLinkMode, type StripeLinkModeKey, } from './enums/index.js';
|
|
2
2
|
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isVoucherItem, isVoucherFloatItem, type Voucher, type VoucherArticle, type IssuedVoucher, type ReturnIssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, RECEIPT_OUTPUT_KINDS, type ReceiptOutputKind, RECEIPT_OUTPUT_LOG_KINDS, type ReceiptOutputLogKind, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputResult, RECEIPT_OUTPUT_ENTRIES_MAX, type ReceiptOutput, type ReceiptOutputActor, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, type ReceiptOutputEntryErrorCode, RECEIPT_OUTPUT_ERROR_CODES, type ReceiptOutputErrorCode, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, type ReceiptOutputFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
|
|
3
|
-
export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type TransportCallOptions, type KasseneckTransport, type KasseneckBinaryTransport, type KasseneckPdfOrDataTransport, type PdfOrData, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, createPdfOrDataTransport, createFileOrDataTransport, type FileOrData, type FileOrDataCallOptions, type KasseneckFileOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, createDepExport, getDepExport, waitForDepExport, getDepExportFile, createDepHandoverLink, revokeDepHandoverLink, DepExportTimeoutError, DepExportChecksumError, DEP_EXPORT_STATUSES, DEP_EXPORT_FILES, DEP_EXPORT_ERROR_CODES, DEP_EXPORT_FAILURES, DEP_EXPORT_POLL_START_MS, DEP_EXPORT_POLL_FACTOR, DEP_EXPORT_POLL_MAX_MS, DEP_EXPORT_WAIT_TIMEOUT_MS, DEP_EXPORT_DOWNLOAD_TIMEOUT_MS, type DepExportStatus, type DepExportFileKind, type DepExportErrorCode, type DepExportFailure, type CreateDepExportOptions, type CreateDepExportResult, type DepExportGap, type DepExportChainBreak, type DepExportFindings, type DepExportItems, type DepHandoverLinkInfo, type DepExport, type WaitForDepExportOptions, type GetDepExportFileOptions, type DepExportFile, type DepHandoverLink, type RevokedDepHandoverLink, type ListedFullReceipt, type ListReceiptsHeader, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
|
|
3
|
+
export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type TransportCallOptions, type KasseneckTransport, type KasseneckBinaryTransport, type KasseneckPdfOrDataTransport, type PdfOrData, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, createPdfOrDataTransport, createFileOrDataTransport, type FileOrData, type FileOrDataCallOptions, type KasseneckFileOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, createDepExport, getDepExport, waitForDepExport, getDepExportFile, createDepHandoverLink, revokeDepHandoverLink, DepExportTimeoutError, DepExportChecksumError, DEP_EXPORT_STATUSES, DEP_EXPORT_FILES, DEP_EXPORT_ERROR_CODES, DEP_EXPORT_FAILURES, DEP_EXPORT_POLL_START_MS, DEP_EXPORT_POLL_FACTOR, DEP_EXPORT_POLL_MAX_MS, DEP_EXPORT_WAIT_TIMEOUT_MS, DEP_EXPORT_DOWNLOAD_TIMEOUT_MS, type DepExportStatus, type DepExportFileKind, type DepExportErrorCode, type DepExportFailure, type CreateDepExportOptions, type CreateDepExportResult, type DepExportGap, type DepExportChainBreak, type DepExportFindings, type DepExportItems, type DepHandoverLinkInfo, type DepExport, type WaitForDepExportOptions, type GetDepExportFileOptions, type DepExportFile, type DepHandoverLink, type RevokedDepHandoverLink, registerTerminalDevice, getTerminalAccess, claimTerminal, requestTerminalCode, getTerminalCode, reportTerminalLogin, reportTerminalReady, TERMINAL_PLATFORMS, TERMINAL_SETUP_STATES, TERMINAL_CODE_STATUSES, TERMINAL_CODE_SOURCES, TERMINAL_ERROR_CODES, TERMINAL_LABEL_MAX, TERMINAL_APP_MAX, TERMINAL_REQUESTED_BY_MAX, type TerminalPlatform, type TerminalSetupState, type TerminalCodeStatus, type TerminalCodeSource, type TerminalErrorCode, type TerminalDeviceCredentials, type RegisterTerminalDeviceOptions, type RegisteredTerminalDevice, type GetTerminalAccessOptions, type ClaimTerminalOptions, type RequestTerminalCodeOptions, type ReportTerminalLoginOptions, type TerminalSetup, type TerminalCodeFormat, type TerminalAccess, type TerminalListEntry, type TerminalAccessUnavailable, type TerminalAccessResult, type TerminalCodeRequest, type TerminalCode, type ListedFullReceipt, type ListReceiptsHeader, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
|
|
4
4
|
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, type VoucherDueInfo, type VoucherDueArticle, type VoucherDueType, type VoucherRedeemContext, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './receipt/due.js';
|
|
5
5
|
export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
|
|
6
6
|
export { type PosBusinessSettings, type PosDeviceSettings, type PosSettings, type ArticleGroup, type PosArticle, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, mergePosSettings, fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, distributeDiscount, cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, } from './pos/index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ReceiptType, VatRate, KeckPaymentMethod, CreditCardProvider, VoucherType, VoucherAction, StripeLinkMode, } from './enums/index.js';
|
|
2
2
|
export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, isVoucherItem, isVoucherFloatItem, toVoucherPayload, fromVoucherPayload, voucherIsValid, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, fromReceiptPaymentPayload, toReceiptPaymentPayload, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_LOG_KINDS, RECEIPT_OUTPUT_RESULTS, RECEIPT_OUTPUT_ENTRIES_MAX, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, RECEIPT_OUTPUT_ERROR_CODES, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, fromReceiptCompanyPayload, receiptCompanyTaxInfo, fromCashregisterPayload, fromReceiptSummaryPayload, ZERO_KINDS, isZeroKind, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
|
|
3
|
-
export { apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, ALL_CALLS, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, createTransport, createBinaryTransport, createPdfOrDataTransport, createFileOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, CLIENT_ERROR_CODES, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, listMyCashregisters, checkVoucherCombinationError, sendReceiptEmail, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, createDepExport, getDepExport, waitForDepExport, getDepExportFile, createDepHandoverLink, revokeDepHandoverLink, DepExportTimeoutError, DepExportChecksumError, DEP_EXPORT_STATUSES, DEP_EXPORT_FILES, DEP_EXPORT_ERROR_CODES, DEP_EXPORT_FAILURES, DEP_EXPORT_POLL_START_MS, DEP_EXPORT_POLL_FACTOR, DEP_EXPORT_POLL_MAX_MS, DEP_EXPORT_WAIT_TIMEOUT_MS, DEP_EXPORT_DOWNLOAD_TIMEOUT_MS, getCashboxStatus, getSignatureStatus, createKasseneckApi, } from './client/index.js';
|
|
3
|
+
export { apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, ALL_CALLS, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, createTransport, createBinaryTransport, createPdfOrDataTransport, createFileOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, CLIENT_ERROR_CODES, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, listMyCashregisters, checkVoucherCombinationError, sendReceiptEmail, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, createDepExport, getDepExport, waitForDepExport, getDepExportFile, createDepHandoverLink, revokeDepHandoverLink, DepExportTimeoutError, DepExportChecksumError, DEP_EXPORT_STATUSES, DEP_EXPORT_FILES, DEP_EXPORT_ERROR_CODES, DEP_EXPORT_FAILURES, DEP_EXPORT_POLL_START_MS, DEP_EXPORT_POLL_FACTOR, DEP_EXPORT_POLL_MAX_MS, DEP_EXPORT_WAIT_TIMEOUT_MS, DEP_EXPORT_DOWNLOAD_TIMEOUT_MS, registerTerminalDevice, getTerminalAccess, claimTerminal, requestTerminalCode, getTerminalCode, reportTerminalLogin, reportTerminalReady, TERMINAL_PLATFORMS, TERMINAL_SETUP_STATES, TERMINAL_CODE_STATUSES, TERMINAL_CODE_SOURCES, TERMINAL_ERROR_CODES, TERMINAL_LABEL_MAX, TERMINAL_APP_MAX, TERMINAL_REQUESTED_BY_MAX, getCashboxStatus, getSignatureStatus, createKasseneckApi, } from './client/index.js';
|
|
4
4
|
export { receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './receipt/due.js';
|
|
5
5
|
export { parseServerTimeStamp, toViennaWallClock } from './vienna-time.js';
|
|
6
6
|
export { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, mergePosSettings, fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, distributeDiscount, cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, } from './pos/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
|
|
2
|
-
export declare const VOKABULAR_QUELLE = "
|
|
2
|
+
export declare const VOKABULAR_QUELLE = "c137b0f64dd1a06c8cddd9d9164bd2360ecbc3133cc04ca2b82d0e37f9d4fe5d";
|
|
3
3
|
/** Schema-Notation des Vertrags: Blatt 'aussen': 'innen', Objekt { __: 'innen', ... }, Liste [ { __: 'innen', ... } ]. */
|
|
4
4
|
export type SchemaEintrag = string | SchemaObjekt | readonly [SchemaObjekt];
|
|
5
5
|
export interface SchemaObjekt {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Erzeugt von scripts/stored-vokabular.mjs aus fixtures/v3/v3-vokabular.json.
|
|
2
2
|
// Nicht von Hand aendern: test/stored.test.ts vergleicht mit dem Vertrag.
|
|
3
3
|
/** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
|
|
4
|
-
export const VOKABULAR_QUELLE = "
|
|
4
|
+
export const VOKABULAR_QUELLE = "c137b0f64dd1a06c8cddd9d9164bd2360ecbc3133cc04ca2b82d0e37f9d4fe5d";
|
|
5
5
|
/** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
|
|
6
6
|
export const SCHEMAS = {
|
|
7
7
|
"getReceipt": {
|
package/dist/esm/version.d.ts
CHANGED
package/dist/esm/version.js
CHANGED
package/fixtures/pos-texts.json
CHANGED