@kreiseck/kasseneck-api 1.27.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 +27 -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 +4 -4
- package/dist/cjs/client/aufrufe.js +31 -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/pos/aufrunden.d.ts +6 -0
- package/dist/cjs/pos/aufrunden.js +59 -0
- package/dist/cjs/pos/client.js +12 -1
- package/dist/cjs/pos/index.d.ts +4 -3
- package/dist/cjs/pos/index.js +17 -4
- package/dist/cjs/pos/schicht-lesen.d.ts +2 -1
- package/dist/cjs/pos/schicht-lesen.js +48 -1
- package/dist/cjs/pos/schicht-typen.d.ts +106 -3
- package/dist/cjs/pos/schicht-typen.js +14 -4
- package/dist/cjs/pos/schicht.d.ts +28 -2
- package/dist/cjs/pos/schicht.js +19 -0
- package/dist/cjs/pos/settings.d.ts +39 -0
- package/dist/cjs/pos/settings.js +65 -4
- package/dist/cjs/pos/texte.d.ts +292 -0
- package/dist/cjs/pos/texte.js +108 -0
- package/dist/cjs/receipt/shift-sheet.js +29 -0
- package/dist/cjs/stored/einstellungen.js +31 -4
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +29 -2
- 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 +4 -4
- package/dist/esm/client/aufrufe.js +31 -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/pos/aufrunden.d.ts +6 -0
- package/dist/esm/pos/aufrunden.js +56 -0
- package/dist/esm/pos/client.js +13 -2
- package/dist/esm/pos/index.d.ts +4 -3
- package/dist/esm/pos/index.js +5 -4
- package/dist/esm/pos/schicht-lesen.d.ts +2 -1
- package/dist/esm/pos/schicht-lesen.js +47 -1
- package/dist/esm/pos/schicht-typen.d.ts +106 -3
- package/dist/esm/pos/schicht-typen.js +13 -3
- package/dist/esm/pos/schicht.d.ts +28 -2
- package/dist/esm/pos/schicht.js +19 -1
- package/dist/esm/pos/settings.d.ts +39 -0
- package/dist/esm/pos/settings.js +60 -3
- package/dist/esm/pos/texte.d.ts +292 -0
- package/dist/esm/pos/texte.js +108 -0
- package/dist/esm/receipt/shift-sheet.js +29 -0
- package/dist/esm/stored/einstellungen.js +32 -5
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +29 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/duplicate-cases.json +6 -0
- package/fixtures/expected/duplicate.shift-close.hex +28 -27
- package/fixtures/expected/shift-close-blind.grid32.txt +1 -0
- package/fixtures/expected/shift-close-blind.grid48.txt +1 -0
- package/fixtures/expected/shift-close-blind.lines.json +6 -0
- package/fixtures/expected/shift-close-put-in.grid32.txt +1 -0
- package/fixtures/expected/shift-close-put-in.grid48.txt +1 -0
- package/fixtures/expected/shift-close-put-in.lines.json +6 -0
- package/fixtures/expected/shift-close-take-out.grid32.txt +1 -0
- package/fixtures/expected/shift-close-take-out.grid48.txt +1 -0
- package/fixtures/expected/shift-close-take-out.lines.json +6 -0
- package/fixtures/expected/shift-close.grid32.txt +1 -0
- package/fixtures/expected/shift-close.grid48.txt +1 -0
- package/fixtures/expected/shift-close.lines.json +6 -0
- package/fixtures/expected/shift-interim.grid32.txt +1 -0
- package/fixtures/expected/shift-interim.grid48.txt +1 -0
- package/fixtures/expected/shift-interim.lines.json +6 -0
- 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 +337 -1
- package/fixtures/renames-1.0.json +30 -0
- package/fixtures/shift-ablauf-cases.json +182 -0
- package/fixtures/shift-receipts.json +15 -15
- package/fixtures/surface.json +59 -4
- package/fixtures/tip-round-up-cases.json +27 -0
- package/fixtures/v3/antworten/belege.json +2 -2
- package/fixtures/v3/antworten/belegmail.json +2 -2
- package/fixtures/v3/antworten/berichte.json +2 -2
- package/fixtures/v3/antworten/kasse-belege.json +2 -2
- package/fixtures/v3/antworten/kasse.json +504 -4
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +2 -2
- package/fixtures/v3/antworten/storno.json +2 -2
- package/fixtures/v3/stored/belege.json +2 -2
- package/fixtures/v3/stored/kasse.json +520 -12
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +184 -11
- package/fixtures/v3/zahlbetrag-faelle.json +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TERMINAL_REQUESTED_BY_MAX = exports.TERMINAL_APP_MAX = exports.TERMINAL_LABEL_MAX = exports.TERMINAL_ERROR_CODES = exports.TERMINAL_CODE_SOURCES = exports.TERMINAL_CODE_STATUSES = exports.TERMINAL_SETUP_STATES = exports.TERMINAL_PLATFORMS = void 0;
|
|
4
|
+
exports.registerTerminalDevice = registerTerminalDevice;
|
|
5
|
+
exports.getTerminalAccess = getTerminalAccess;
|
|
6
|
+
exports.claimTerminal = claimTerminal;
|
|
7
|
+
exports.requestTerminalCode = requestTerminalCode;
|
|
8
|
+
exports.getTerminalCode = getTerminalCode;
|
|
9
|
+
exports.reportTerminalLogin = reportTerminalLogin;
|
|
10
|
+
exports.reportTerminalReady = reportTerminalReady;
|
|
11
|
+
const errors_js_1 = require("./errors.js");
|
|
12
|
+
/**
|
|
13
|
+
* Kartenterminal am Handy (nur unter `/v3`): Kasseneck verwaltet die Zugaenge
|
|
14
|
+
* der Terminal-App, die Terminal-IDs (TID) je Betrieb und den Code, den der
|
|
15
|
+
* Anbieter beim Umzug einer TID auf ein anderes Geraet per E-Mail schickt.
|
|
16
|
+
* Die App holt sich Zugang, TID und Code von hier; am Geraet tippt niemand
|
|
17
|
+
* E-Mail, Passwort oder TID.
|
|
18
|
+
*
|
|
19
|
+
* **Anmeldung:** der `api_key` des Betriebs als Bearer. Ein `cashregister-token`
|
|
20
|
+
* (wie ihn `apiKeyAuth` mitsendet) stoert nicht, wird aber nicht gebraucht; eine
|
|
21
|
+
* App ohne Kasse nimmt eine Anmeldung nur mit dem Schluessel (etwa
|
|
22
|
+
* `inventoryKeyAuth` aus `./inventory`). Das Geraet weist sich zusaetzlich mit
|
|
23
|
+
* `deviceId` + `deviceSecret` aus, die es einmal mit [registerTerminalDevice]
|
|
24
|
+
* bekommt. Am Kassenweg gibt es die Aufrufe noch nicht.
|
|
25
|
+
*
|
|
26
|
+
* **Geheimnisse:** `deviceSecret`, `password` und `code` stehen nur in den
|
|
27
|
+
* Antworten bzw. Anfragen. Das Paket schreibt sie in kein Log und in keinen
|
|
28
|
+
* Fehler (das Geraetegeheimnis geht als `secretParams` an den Transport); die
|
|
29
|
+
* App darf sie ebenfalls nie loggen und speichert `deviceSecret` im sicheren
|
|
30
|
+
* Speicher des Geraets.
|
|
31
|
+
*
|
|
32
|
+
* Geprueft wird hier nur die Form; was der Server nicht annimmt, lehnt er mit
|
|
33
|
+
* einem Code aus [TERMINAL_ERROR_CODES] ab.
|
|
34
|
+
*/
|
|
35
|
+
/** Plattform des Geraets. */
|
|
36
|
+
exports.TERMINAL_PLATFORMS = Object.freeze(['android', 'ios']);
|
|
37
|
+
/**
|
|
38
|
+
* Einrichtungsstand der Terminal-App am Geraet: TID zugewiesen, wartet auf den
|
|
39
|
+
* Code, wird eingerichtet, bereit, fehlgeschlagen.
|
|
40
|
+
*/
|
|
41
|
+
exports.TERMINAL_SETUP_STATES = Object.freeze(['assigned', 'waiting_for_code', 'setting_up', 'ready', 'failed']);
|
|
42
|
+
/**
|
|
43
|
+
* Stand einer Code-Anfrage: keine Anfrage, sucht, gefunden, zugestellt,
|
|
44
|
+
* unklar (mehrere Geraete warteten gleichzeitig), kein Code gefunden,
|
|
45
|
+
* abgelaufen.
|
|
46
|
+
*/
|
|
47
|
+
exports.TERMINAL_CODE_STATUSES = Object.freeze(['none', 'searching', 'found', 'delivered', 'unclear', 'no_code', 'expired']);
|
|
48
|
+
/** Woher ein Code kam: aus dem Postfach oder vom Support eingetragen. */
|
|
49
|
+
exports.TERMINAL_CODE_SOURCES = Object.freeze(['mailbox', 'support']);
|
|
50
|
+
/**
|
|
51
|
+
* Fehlercodes der sieben Aufrufe (`code` des [KasseneckApiError]) wie im
|
|
52
|
+
* Vertrag des Backends (`errorCodes.terminal` in `fixtures/v3/v3-vokabular.json`),
|
|
53
|
+
* in dessen Reihenfolge; dazu kommen die gemeinsamen Codes von Anmeldung und
|
|
54
|
+
* Rand. Ein Code ausserhalb bleibt ueber `KasseneckApiError.code` lesbar.
|
|
55
|
+
*/
|
|
56
|
+
exports.TERMINAL_ERROR_CODES = Object.freeze([
|
|
57
|
+
'terminal_not_enabled', // dem Betrieb ist keine aktive TID zugeordnet
|
|
58
|
+
'terminal_test_environment', // nur in der Live-Umgebung (kein kr_test_-Schluessel)
|
|
59
|
+
'terminal_device_unknown', // deviceId oder deviceSecret falsch (gleiche Antwort fuer beides)
|
|
60
|
+
'terminal_device_blocked', // das Geraet ist gesperrt
|
|
61
|
+
'invalid_terminal_device', // Angaben zum Geraet unvollstaendig oder ungueltig
|
|
62
|
+
'too_many_terminal_devices', // Obergrenze der Geraete je Betrieb oder der Anmeldungen je Tag erreicht
|
|
63
|
+
'terminal_not_in_business', // die TID gibt es nicht oder sie gehoert einem anderen Betrieb (gleiche Antwort)
|
|
64
|
+
'terminal_code_manual', // Konto ohne Postfach: die App fragt nach dem Code
|
|
65
|
+
'terminal_code_rate_limited', // hoechstens 6 Code-Anfragen je Geraet und Stunde
|
|
66
|
+
'terminal_not_assigned', // dem Geraet ist keine TID zugeordnet: zuerst getTerminalAccess
|
|
67
|
+
'server_error',
|
|
68
|
+
]);
|
|
69
|
+
/** Laengen der Texte, die der Server annimmt (nach Abzug von Leerraum am Rand). */
|
|
70
|
+
exports.TERMINAL_LABEL_MAX = 60;
|
|
71
|
+
exports.TERMINAL_APP_MAX = 40;
|
|
72
|
+
exports.TERMINAL_REQUESTED_BY_MAX = 80;
|
|
73
|
+
// ---- Hilfen -------------------------------------------------------------------------------------
|
|
74
|
+
function eingabefehler(name, grund) {
|
|
75
|
+
return new errors_js_1.KasseneckValidationError(name, grund, 'request');
|
|
76
|
+
}
|
|
77
|
+
function antwortfehler(name, grund) {
|
|
78
|
+
return new errors_js_1.KasseneckValidationError(name, grund, 'response');
|
|
79
|
+
}
|
|
80
|
+
const istObjekt = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
81
|
+
const istText = (v) => typeof v === 'string' && v.trim() !== '';
|
|
82
|
+
const textOderNull = (v) => (typeof v === 'string' ? v : null);
|
|
83
|
+
/** Pflichttext mit Hoechstlaenge (nach Abzug von Leerraum am Rand, wie der Server). */
|
|
84
|
+
function pruefeText(name, feld, wert, max) {
|
|
85
|
+
if (typeof wert !== 'string' || wert.trim() === '')
|
|
86
|
+
throw eingabefehler(name, `${feld} fehlt oder ist leer`);
|
|
87
|
+
if (wert.trim().length > max)
|
|
88
|
+
throw eingabefehler(name, `${feld}: hoechstens ${max} Zeichen`);
|
|
89
|
+
return wert;
|
|
90
|
+
}
|
|
91
|
+
function pruefePlattform(name, wert) {
|
|
92
|
+
if (!exports.TERMINAL_PLATFORMS.includes(wert))
|
|
93
|
+
throw eingabefehler(name, 'platform muss android oder ios sein');
|
|
94
|
+
return wert;
|
|
95
|
+
}
|
|
96
|
+
/** Ausweis des Geraets pruefen; die Meldung nennt nie das Geheimnis. */
|
|
97
|
+
function ausweis(name, options) {
|
|
98
|
+
if (!istObjekt(options))
|
|
99
|
+
throw eingabefehler(name, 'Anfrage muss ein Objekt sein');
|
|
100
|
+
if (!istText(options.deviceId))
|
|
101
|
+
throw eingabefehler(name, 'deviceId fehlt oder ist leer');
|
|
102
|
+
if (!istText(options.deviceSecret))
|
|
103
|
+
throw eingabefehler(name, 'deviceSecret fehlt oder ist leer');
|
|
104
|
+
return { params: { deviceId: options.deviceId, deviceSecret: options.deviceSecret }, geheim: options.deviceSecret };
|
|
105
|
+
}
|
|
106
|
+
/** Optionale Felder nur, wenn gesetzt. */
|
|
107
|
+
function optional(name, params, options) {
|
|
108
|
+
if (options.platform !== undefined)
|
|
109
|
+
params['platform'] = pruefePlattform(name, options.platform);
|
|
110
|
+
if (options.app !== undefined)
|
|
111
|
+
params['app'] = pruefeText(name, 'app', options.app, exports.TERMINAL_APP_MAX);
|
|
112
|
+
if (options.label !== undefined)
|
|
113
|
+
params['label'] = pruefeText(name, 'label', options.label, exports.TERMINAL_LABEL_MAX);
|
|
114
|
+
if (options.requestedBy !== undefined)
|
|
115
|
+
params['requestedBy'] = pruefeText(name, 'requestedBy', options.requestedBy, exports.TERMINAL_REQUESTED_BY_MAX);
|
|
116
|
+
}
|
|
117
|
+
function setupAus(name, wert) {
|
|
118
|
+
if (!istObjekt(wert) || typeof wert['state'] !== 'string')
|
|
119
|
+
throw antwortfehler(name, 'Antwort ohne setup.state');
|
|
120
|
+
return { state: wert['state'], since: textOderNull(wert['since']) };
|
|
121
|
+
}
|
|
122
|
+
/** Zugang aus der Antwort; die Meldungen nennen nie Login, Passwort oder TID. */
|
|
123
|
+
function zugangAus(name, d) {
|
|
124
|
+
if (!istText(d['username']) || !istText(d['password']) || !istText(d['terminalId']) || typeof d['accountId'] !== 'string') {
|
|
125
|
+
throw antwortfehler(name, 'Zugang unvollstaendig (username, password, terminalId, accountId)');
|
|
126
|
+
}
|
|
127
|
+
if (typeof d['autoCode'] !== 'boolean')
|
|
128
|
+
throw antwortfehler(name, 'Antwort ohne autoCode');
|
|
129
|
+
const format = d['codeFormat'];
|
|
130
|
+
if (!istObjekt(format) || !(typeof format['length'] === 'number' && Number.isSafeInteger(format['length']) && format['length'] > 0) ||
|
|
131
|
+
!Array.isArray(format['labels']) || !format['labels'].every((l) => typeof l === 'string')) {
|
|
132
|
+
throw antwortfehler(name, 'Antwort ohne gueltiges codeFormat (length, labels)');
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
available: true,
|
|
136
|
+
username: d['username'],
|
|
137
|
+
password: d['password'],
|
|
138
|
+
terminalId: d['terminalId'],
|
|
139
|
+
terminalName: textOderNull(d['terminalName']),
|
|
140
|
+
accountId: d['accountId'],
|
|
141
|
+
autoCode: d['autoCode'],
|
|
142
|
+
codeFormat: { length: format['length'], labels: [...format['labels']] },
|
|
143
|
+
setup: setupAus(name, d['setup']),
|
|
144
|
+
updatedAt: textOderNull(d['updatedAt']),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function listeAus(name, d) {
|
|
148
|
+
const roh = d['terminals'];
|
|
149
|
+
if (typeof d['reason'] !== 'string' || !Array.isArray(roh))
|
|
150
|
+
throw antwortfehler(name, 'Antwort ohne reason oder terminals');
|
|
151
|
+
const terminals = [];
|
|
152
|
+
for (const t of roh) {
|
|
153
|
+
if (!istObjekt(t) || !istText(t['terminalId']))
|
|
154
|
+
throw antwortfehler(name, 'Eintrag in terminals ohne terminalId');
|
|
155
|
+
terminals.push({
|
|
156
|
+
terminalId: t['terminalId'],
|
|
157
|
+
name: textOderNull(t['name']),
|
|
158
|
+
lastUsedBy: textOderNull(t['lastUsedBy']),
|
|
159
|
+
lastUsedAt: textOderNull(t['lastUsedAt']),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return { available: false, reason: d['reason'], terminals };
|
|
163
|
+
}
|
|
164
|
+
async function zugangRufen(transport, name, params, geheim) {
|
|
165
|
+
const daten = await transport(name, params, undefined, [geheim]);
|
|
166
|
+
if (!istObjekt(daten) || typeof daten['available'] !== 'boolean')
|
|
167
|
+
throw antwortfehler(name, 'Antwort ohne available');
|
|
168
|
+
return daten['available'] ? zugangAus(name, daten) : listeAus(name, daten);
|
|
169
|
+
}
|
|
170
|
+
// ---- Aufrufe ------------------------------------------------------------------------------------
|
|
171
|
+
/**
|
|
172
|
+
* Meldet ein Geraet einmal an (`registerTerminalDevice`) und liefert seinen
|
|
173
|
+
* Ausweis. `deviceSecret` steht nur in dieser Antwort: im sicheren Speicher
|
|
174
|
+
* ablegen, nie loggen. Hoechstens 20 Geraete je Betrieb und 10 Anmeldungen je
|
|
175
|
+
* Tag (`too_many_terminal_devices`). Eine Wiederholung nach unklarem Ausgang
|
|
176
|
+
* legt ein weiteres Geraet an.
|
|
177
|
+
*/
|
|
178
|
+
async function registerTerminalDevice(transport, options) {
|
|
179
|
+
const name = 'registerTerminalDevice';
|
|
180
|
+
if (!istObjekt(options))
|
|
181
|
+
throw eingabefehler(name, 'Anfrage muss ein Objekt sein');
|
|
182
|
+
const params = {
|
|
183
|
+
label: pruefeText(name, 'label', options.label, exports.TERMINAL_LABEL_MAX),
|
|
184
|
+
platform: pruefePlattform(name, options.platform),
|
|
185
|
+
app: pruefeText(name, 'app', options.app, exports.TERMINAL_APP_MAX),
|
|
186
|
+
};
|
|
187
|
+
optional(name, params, { requestedBy: options.requestedBy });
|
|
188
|
+
const daten = await transport(name, params);
|
|
189
|
+
if (!istObjekt(daten) || !istText(daten['deviceId']) || !istText(daten['deviceSecret'])) {
|
|
190
|
+
throw antwortfehler(name, 'Antwort ohne deviceId oder deviceSecret');
|
|
191
|
+
}
|
|
192
|
+
return { deviceId: daten['deviceId'], deviceSecret: daten['deviceSecret'] };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Zugang und TID fuer dieses Geraet (`getTerminalAccess`). Das Geraet behaelt
|
|
196
|
+
* seine TID; ohne eine bekommt es eine freie seines Betriebs. Ist keine frei,
|
|
197
|
+
* kommt `available: false` mit den TIDs des eigenen Betriebs zur Auswahl fuer
|
|
198
|
+
* [claimTerminal]. Die App ruft das bei jedem Start und mindestens einmal am
|
|
199
|
+
* Tag. `password` nie loggen.
|
|
200
|
+
*/
|
|
201
|
+
async function getTerminalAccess(transport, options) {
|
|
202
|
+
const name = 'getTerminalAccess';
|
|
203
|
+
const { params, geheim } = ausweis(name, options);
|
|
204
|
+
optional(name, params, { platform: options.platform, app: options.app, label: options.label });
|
|
205
|
+
return zugangRufen(transport, name, params, geheim);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Uebernimmt eine TID des eigenen Betriebs (`claimTerminal`); das Geraet, das
|
|
209
|
+
* sie bisher nutzte, verliert sie. Antwort wie [getTerminalAccess] mit
|
|
210
|
+
* Zugang. Eine fremde oder unbekannte TID ist `terminal_not_in_business`.
|
|
211
|
+
*/
|
|
212
|
+
async function claimTerminal(transport, options) {
|
|
213
|
+
const name = 'claimTerminal';
|
|
214
|
+
const { params, geheim } = ausweis(name, options);
|
|
215
|
+
if (!istText(options.terminalId))
|
|
216
|
+
throw eingabefehler(name, 'terminalId fehlt oder ist leer');
|
|
217
|
+
params['terminalId'] = options.terminalId;
|
|
218
|
+
optional(name, params, { label: options.label });
|
|
219
|
+
const ergebnis = await zugangRufen(transport, name, params, geheim);
|
|
220
|
+
if (!ergebnis.available)
|
|
221
|
+
throw antwortfehler(name, 'Antwort ohne Zugang');
|
|
222
|
+
return ergebnis;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Fragt den Code fuer die TID dieses Geraets an (`requestTerminalCode`); nur
|
|
226
|
+
* bei Konten mit Postfach (`TerminalAccess.autoCode`), sonst
|
|
227
|
+
* `terminal_code_manual`. Eine offene Anfrage juenger als 6 Minuten bleibt
|
|
228
|
+
* (doppeltes Tippen schadet nicht); hoechstens 6 Anfragen je Stunde
|
|
229
|
+
* (`terminal_code_rate_limited`). Den Code holt danach [getTerminalCode].
|
|
230
|
+
*/
|
|
231
|
+
async function requestTerminalCode(transport, options) {
|
|
232
|
+
const name = 'requestTerminalCode';
|
|
233
|
+
const { params, geheim } = ausweis(name, options);
|
|
234
|
+
params['platform'] = pruefePlattform(name, options.platform);
|
|
235
|
+
optional(name, params, { requestedBy: options.requestedBy });
|
|
236
|
+
const daten = await transport(name, params, undefined, [geheim]);
|
|
237
|
+
if (!istObjekt(daten) || typeof daten['status'] !== 'string')
|
|
238
|
+
throw antwortfehler(name, 'Antwort ohne status');
|
|
239
|
+
return { status: daten['status'] };
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Stand der Code-Anfrage und der Einrichtung (`getTerminalCode`); ohne Anfrage
|
|
243
|
+
* `status: 'none'`. Bei `found` steht der Code genau in dieser Antwort: auf
|
|
244
|
+
* Android wird er dabei verbraucht (eine verlorene Antwort verliert ihn), auf
|
|
245
|
+
* iOS bleibt er bis `validUntil` lesbar. Den Code nie loggen.
|
|
246
|
+
*/
|
|
247
|
+
async function getTerminalCode(transport, options) {
|
|
248
|
+
const name = 'getTerminalCode';
|
|
249
|
+
const { params, geheim } = ausweis(name, options);
|
|
250
|
+
const daten = await transport(name, params, undefined, [geheim]);
|
|
251
|
+
if (!istObjekt(daten) || typeof daten['status'] !== 'string')
|
|
252
|
+
throw antwortfehler(name, 'Antwort ohne status');
|
|
253
|
+
const ergebnis = { status: daten['status'], setup: setupAus(name, daten['setup']) };
|
|
254
|
+
if (daten['code'] !== undefined && daten['code'] !== null) {
|
|
255
|
+
if (!istText(daten['code']))
|
|
256
|
+
throw antwortfehler(name, 'code ist kein Text');
|
|
257
|
+
ergebnis.code = daten['code'];
|
|
258
|
+
if (typeof daten['source'] === 'string')
|
|
259
|
+
ergebnis.source = daten['source'];
|
|
260
|
+
ergebnis.validUntil = textOderNull(daten['validUntil']);
|
|
261
|
+
}
|
|
262
|
+
return ergebnis;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Meldet den Ausgang der Anmeldung in der Terminal-App (`reportTerminalLogin`).
|
|
266
|
+
* Antwort: nichts. Eine andere als die zugewiesene TID schreibt der Server
|
|
267
|
+
* nicht.
|
|
268
|
+
*/
|
|
269
|
+
async function reportTerminalLogin(transport, options) {
|
|
270
|
+
const name = 'reportTerminalLogin';
|
|
271
|
+
const { params, geheim } = ausweis(name, options);
|
|
272
|
+
if (!istText(options.terminalId))
|
|
273
|
+
throw eingabefehler(name, 'terminalId fehlt oder ist leer');
|
|
274
|
+
if (typeof options.success !== 'boolean')
|
|
275
|
+
throw eingabefehler(name, 'success muss true oder false sein');
|
|
276
|
+
if (typeof options.newOnDevice !== 'boolean')
|
|
277
|
+
throw eingabefehler(name, 'newOnDevice muss true oder false sein');
|
|
278
|
+
params['terminalId'] = options.terminalId;
|
|
279
|
+
params['success'] = options.success;
|
|
280
|
+
params['newOnDevice'] = options.newOnDevice;
|
|
281
|
+
await transport(name, params, undefined, [geheim]);
|
|
282
|
+
}
|
|
283
|
+
/** Meldet, dass die Terminal-App fertig eingerichtet ist (`reportTerminalReady`). Antwort: nichts. */
|
|
284
|
+
async function reportTerminalReady(transport, options) {
|
|
285
|
+
const name = 'reportTerminalReady';
|
|
286
|
+
const { params, geheim } = ausweis(name, options);
|
|
287
|
+
await transport(name, params, undefined, [geheim]);
|
|
288
|
+
}
|
package/dist/cjs/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/cjs/index.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RECEIPT_OUTPUT_LOG_KINDS = exports.RECEIPT_OUTPUT_KINDS = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptValueVoucherSign = exports.receiptSumCents = exports.receiptSubSumCents = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isVoucherFloatItem = exports.isVoucherItem = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = exports.StripeLinkMode = exports.VoucherAction = exports.VoucherType = exports.CreditCardProvider = exports.KeckPaymentMethod = exports.VatRate = exports.ReceiptType = void 0;
|
|
4
4
|
exports.createPdfOrDataTransport = exports.createBinaryTransport = exports.createTransport = exports.UNKNOWN_OUTCOME_CALLS = exports.POS_CALLS = exports.PUBLIC_CALLS = exports.ALL_CALLS = exports.DEFAULT_TIMEOUT_MS = exports.POS_BASE_URL = exports.DEFAULT_BASE_URL = exports.registerUserAuth = exports.apiKeyAuth = exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptOutputFieldErrors = exports.isReceiptOutputError = exports.receiptOutputErrorCode = exports.isReceiptOutputErrorCode = exports.RECEIPT_OUTPUT_ERROR_CODES = exports.RECEIPT_OUTPUT_ENTRY_ERROR_CODES = exports.RECEIPT_OUTPUT_ENTRIES_MAX = exports.RECEIPT_OUTPUT_RESULTS = void 0;
|
|
5
5
|
exports.DepExportTimeoutError = exports.revokeDepHandoverLink = exports.createDepHandoverLink = exports.getDepExportFile = exports.waitForDepExport = exports.getDepExport = exports.createDepExport = exports.LIST_RECEIPTS_ERROR_CODES = exports.LIST_ALL_RECEIPTS_MAX_PAGES = exports.LIST_RECEIPTS_DAYS_MAX = exports.LIST_RECEIPTS_LIMIT_MAX = exports.LIST_RECEIPTS_ORDERS = exports.LIST_RECEIPTS_VIEWS = exports.listedReceiptWithCompany = exports.fromListReceiptsSummaryPayload = exports.listAllReceipts = exports.listReceipts = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = exports.logReceiptOutputs = exports.sendReceiptEmail = exports.checkVoucherCombinationError = exports.listMyCashregisters = exports.listMyReceipts = exports.getFirstReceiptDate = exports.generateFullReceiptId = exports.getReceiptWithCompany = exports.getReceipt = exports.zeroReceipt = exports.cancelReceipt = exports.receiptLayoutFromResult = exports.cardRefundReference = exports.paymentsExpectedCents = exports.sellReceiptWithCompany = exports.sellReceipt = exports.isOutcomeUnknown = exports.isKasseneckValidationError = exports.isKasseneckNetworkError = exports.isKasseneckHttpError = exports.isKasseneckAuthError = exports.isKasseneckApiError = exports.CLIENT_ERROR_CODES = exports.KasseneckValidationError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckAuthError = exports.KasseneckApiError = exports.createFileOrDataTransport = void 0;
|
|
6
|
-
exports.
|
|
6
|
+
exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.mergePosSettings = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.toViennaWallClock = exports.parseServerTimeStamp = exports.VOUCHER_ZERO_RATE_BUCKET_FROM = exports.voucherRedeemMaxCents = exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.TERMINAL_REQUESTED_BY_MAX = exports.TERMINAL_APP_MAX = exports.TERMINAL_LABEL_MAX = exports.TERMINAL_ERROR_CODES = exports.TERMINAL_CODE_SOURCES = exports.TERMINAL_CODE_STATUSES = exports.TERMINAL_SETUP_STATES = exports.TERMINAL_PLATFORMS = exports.reportTerminalReady = exports.reportTerminalLogin = exports.getTerminalCode = exports.requestTerminalCode = exports.claimTerminal = exports.getTerminalAccess = exports.registerTerminalDevice = exports.DEP_EXPORT_DOWNLOAD_TIMEOUT_MS = exports.DEP_EXPORT_WAIT_TIMEOUT_MS = exports.DEP_EXPORT_POLL_MAX_MS = exports.DEP_EXPORT_POLL_FACTOR = exports.DEP_EXPORT_POLL_START_MS = exports.DEP_EXPORT_FAILURES = exports.DEP_EXPORT_ERROR_CODES = exports.DEP_EXPORT_FILES = exports.DEP_EXPORT_STATUSES = exports.DepExportChecksumError = void 0;
|
|
7
|
+
exports.voucherPermsOf = exports.stockViewOf = void 0;
|
|
7
8
|
var index_js_1 = require("./enums/index.js");
|
|
8
9
|
Object.defineProperty(exports, "ReceiptType", { enumerable: true, get: function () { return index_js_1.ReceiptType; } });
|
|
9
10
|
Object.defineProperty(exports, "VatRate", { enumerable: true, get: function () { return index_js_1.VatRate; } });
|
|
@@ -167,6 +168,21 @@ Object.defineProperty(exports, "DEP_EXPORT_POLL_FACTOR", { enumerable: true, get
|
|
|
167
168
|
Object.defineProperty(exports, "DEP_EXPORT_POLL_MAX_MS", { enumerable: true, get: function () { return index_js_3.DEP_EXPORT_POLL_MAX_MS; } });
|
|
168
169
|
Object.defineProperty(exports, "DEP_EXPORT_WAIT_TIMEOUT_MS", { enumerable: true, get: function () { return index_js_3.DEP_EXPORT_WAIT_TIMEOUT_MS; } });
|
|
169
170
|
Object.defineProperty(exports, "DEP_EXPORT_DOWNLOAD_TIMEOUT_MS", { enumerable: true, get: function () { return index_js_3.DEP_EXPORT_DOWNLOAD_TIMEOUT_MS; } });
|
|
171
|
+
Object.defineProperty(exports, "registerTerminalDevice", { enumerable: true, get: function () { return index_js_3.registerTerminalDevice; } });
|
|
172
|
+
Object.defineProperty(exports, "getTerminalAccess", { enumerable: true, get: function () { return index_js_3.getTerminalAccess; } });
|
|
173
|
+
Object.defineProperty(exports, "claimTerminal", { enumerable: true, get: function () { return index_js_3.claimTerminal; } });
|
|
174
|
+
Object.defineProperty(exports, "requestTerminalCode", { enumerable: true, get: function () { return index_js_3.requestTerminalCode; } });
|
|
175
|
+
Object.defineProperty(exports, "getTerminalCode", { enumerable: true, get: function () { return index_js_3.getTerminalCode; } });
|
|
176
|
+
Object.defineProperty(exports, "reportTerminalLogin", { enumerable: true, get: function () { return index_js_3.reportTerminalLogin; } });
|
|
177
|
+
Object.defineProperty(exports, "reportTerminalReady", { enumerable: true, get: function () { return index_js_3.reportTerminalReady; } });
|
|
178
|
+
Object.defineProperty(exports, "TERMINAL_PLATFORMS", { enumerable: true, get: function () { return index_js_3.TERMINAL_PLATFORMS; } });
|
|
179
|
+
Object.defineProperty(exports, "TERMINAL_SETUP_STATES", { enumerable: true, get: function () { return index_js_3.TERMINAL_SETUP_STATES; } });
|
|
180
|
+
Object.defineProperty(exports, "TERMINAL_CODE_STATUSES", { enumerable: true, get: function () { return index_js_3.TERMINAL_CODE_STATUSES; } });
|
|
181
|
+
Object.defineProperty(exports, "TERMINAL_CODE_SOURCES", { enumerable: true, get: function () { return index_js_3.TERMINAL_CODE_SOURCES; } });
|
|
182
|
+
Object.defineProperty(exports, "TERMINAL_ERROR_CODES", { enumerable: true, get: function () { return index_js_3.TERMINAL_ERROR_CODES; } });
|
|
183
|
+
Object.defineProperty(exports, "TERMINAL_LABEL_MAX", { enumerable: true, get: function () { return index_js_3.TERMINAL_LABEL_MAX; } });
|
|
184
|
+
Object.defineProperty(exports, "TERMINAL_APP_MAX", { enumerable: true, get: function () { return index_js_3.TERMINAL_APP_MAX; } });
|
|
185
|
+
Object.defineProperty(exports, "TERMINAL_REQUESTED_BY_MAX", { enumerable: true, get: function () { return index_js_3.TERMINAL_REQUESTED_BY_MAX; } });
|
|
170
186
|
Object.defineProperty(exports, "getCashboxStatus", { enumerable: true, get: function () { return index_js_3.getCashboxStatus; } });
|
|
171
187
|
Object.defineProperty(exports, "getSignatureStatus", { enumerable: true, get: function () { return index_js_3.getSignatureStatus; } });
|
|
172
188
|
Object.defineProperty(exports, "createKasseneckApi", { enumerable: true, get: function () { return index_js_3.createKasseneckApi; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aufrunden-Vorschlaege fuer Trinkgeld: genau drei aufsteigende Gesamtbetraege
|
|
3
|
+
* in Cent ueber dem Bezugsbetrag. Nur Ganzzahlen; die Pruefaelle stehen in
|
|
4
|
+
* `fixtures/tip-round-up-cases.json` (gleich im Dart-Zwilling).
|
|
5
|
+
*/
|
|
6
|
+
export declare function roundUpSuggestions(amountCents: number): number[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Aufrunden-Vorschlaege fuer Trinkgeld: genau drei aufsteigende Gesamtbetraege
|
|
4
|
+
* in Cent ueber dem Bezugsbetrag. Nur Ganzzahlen; die Pruefaelle stehen in
|
|
5
|
+
* `fixtures/tip-round-up-cases.json` (gleich im Dart-Zwilling).
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.roundUpSuggestions = roundUpSuggestions;
|
|
9
|
+
function steps(t) {
|
|
10
|
+
if (t < 1500)
|
|
11
|
+
return [50, 100];
|
|
12
|
+
if (t < 5000)
|
|
13
|
+
return [100, 500];
|
|
14
|
+
if (t < 20000)
|
|
15
|
+
return [500, 1000];
|
|
16
|
+
return [1000, 5000];
|
|
17
|
+
}
|
|
18
|
+
const ceilDiv = (a, b) => Math.floor((a + b - 1) / b);
|
|
19
|
+
function roundUpSuggestions(amountCents) {
|
|
20
|
+
if (!Number.isInteger(amountCents) || amountCents <= 0)
|
|
21
|
+
return [];
|
|
22
|
+
const t = amountCents;
|
|
23
|
+
const [small, large] = steps(t);
|
|
24
|
+
const lo = Math.max(ceilDiv(t * 102, 100), t + 20);
|
|
25
|
+
const hi = Math.floor((t * (t < 1000 ? 125 : 120)) / 100);
|
|
26
|
+
const set = new Set();
|
|
27
|
+
for (const s of [small, large])
|
|
28
|
+
for (let m = ceilDiv(lo, s) * s; m <= hi; m += s)
|
|
29
|
+
set.add(m);
|
|
30
|
+
const candidates = [...set].sort((a, b) => a - b);
|
|
31
|
+
const chosen = new Set();
|
|
32
|
+
if (candidates.length > 0) {
|
|
33
|
+
const firstRound = candidates.find((k) => k % large === 0);
|
|
34
|
+
chosen.add(firstRound !== undefined && (firstRound - t) * 100 <= t * 10 ? firstRound : candidates[0]);
|
|
35
|
+
}
|
|
36
|
+
for (const target of [110, 115]) {
|
|
37
|
+
const free = candidates.filter((k) => !chosen.has(k));
|
|
38
|
+
if (free.length === 0)
|
|
39
|
+
break;
|
|
40
|
+
const dist = (k) => Math.abs(k * 100 - t * target);
|
|
41
|
+
const round = free.find((k) => k % large === 0 && dist(k) <= t * 3);
|
|
42
|
+
if (round !== undefined) {
|
|
43
|
+
chosen.add(round);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
let best = free[0];
|
|
47
|
+
for (const k of free)
|
|
48
|
+
if (dist(k) < dist(best))
|
|
49
|
+
best = k;
|
|
50
|
+
chosen.add(best);
|
|
51
|
+
}
|
|
52
|
+
let next = chosen.size > 0 ? Math.max(...chosen) : ceilDiv(lo, small) * small - small;
|
|
53
|
+
while (chosen.size < 3) {
|
|
54
|
+
next = (Math.floor(next / small) + 1) * small;
|
|
55
|
+
if (next >= lo)
|
|
56
|
+
chosen.add(next);
|
|
57
|
+
}
|
|
58
|
+
return [...chosen].sort((a, b) => a - b);
|
|
59
|
+
}
|
package/dist/cjs/pos/client.js
CHANGED
|
@@ -151,10 +151,21 @@ function pruefeTeil(name, teil, block, standard, werte) {
|
|
|
151
151
|
throw new errors_js_1.KasseneckValidationError(name, `${teil}.${schluessel}: true oder false erwartet`, 'request');
|
|
152
152
|
continue;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
const wahl = teil === 'business' ? settings_js_1.POS_BUSINESS_OPTIONAL_CHOICES : settings_js_1.POS_DEVICE_OPTIONAL_CHOICES;
|
|
155
|
+
if (!Object.prototype.hasOwnProperty.call(standard, schluessel) && !wahl.includes(schluessel)) {
|
|
155
156
|
throw new errors_js_1.KasseneckValidationError(name, `${teil}.${schluessel}: unbekanntes Feld`, 'request');
|
|
156
157
|
}
|
|
157
158
|
const erlaubt = Object.prototype.hasOwnProperty.call(werte, schluessel) ? werte[schluessel] : undefined;
|
|
159
|
+
if (schluessel === 'tipKinds' && !Array.isArray(wert)) {
|
|
160
|
+
throw new errors_js_1.KasseneckValidationError(name, `${teil}.${schluessel}: eine Liste von Trinkgeld-Arten erwartet`, 'request');
|
|
161
|
+
}
|
|
162
|
+
// Eine Liste (tipKinds): nichtleer, jeder Eintrag aus der Wertemenge, ohne Dubletten.
|
|
163
|
+
if (erlaubt && Array.isArray(wert)) {
|
|
164
|
+
if (wert.length === 0 || new Set(wert).size !== wert.length || !wert.every((e) => erlaubt.includes(e))) {
|
|
165
|
+
throw new errors_js_1.KasseneckValidationError(name, `${teil}.${schluessel}: ungueltiger Wert (erlaubt: ${erlaubt.join(', ')}, jede Art hoechstens einmal)`, 'request');
|
|
166
|
+
}
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
158
169
|
if (erlaubt && !erlaubt.includes(wert)) {
|
|
159
170
|
// Kein Altwert: dann ein Wert, den der Server kennt und dieses Paket
|
|
160
171
|
// nicht. Er kam beim Lesen herein; wer den ganzen Block zurueckschickt,
|
package/dist/cjs/pos/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
|
|
7
7
|
* und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
|
|
8
8
|
*/
|
|
9
|
-
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, posTipKeptByDefault, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
9
|
+
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
|
|
10
10
|
export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
11
11
|
export { REFERENCE_MODES, type ReferenceMode, type PosReference, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, type ReferenceCheckResult, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
|
|
12
12
|
export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
|
|
@@ -24,9 +24,10 @@ export { type ListMyStocktakesOptions, type ListMyStocktakeItemsOptions, type Li
|
|
|
24
24
|
export type { Stocktake, StocktakeItem, StocktakeCount, StocktakeCountResult, StocktakeItemPage, StocktakeCountPage, StocktakeActor, StocktakeProgress, StocktakeReview, StocktakeRecount, StocktakeScope, } from '../inventory/typen.js';
|
|
25
25
|
export type { StocktakeStatus } from '../inventory/vertrag.js';
|
|
26
26
|
export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, type VoucherKind, type VoucherStatus, type VoucherValidity, type VoucherArticle, type VoucherCheck, type PosVoucherSettings, type PosVoucherReturnType, type VoucherPayout, type VoucherTypeKind, type PosVoucherType, type VoucherLabelTemplate, } from './gutschein.js';
|
|
27
|
-
export { type GetMyDrawerStateOptions, type OpenMyShiftOptions, type RecordMyCashMovementOptions, type DrawerOpeningEntry, type LogMyDrawerOpeningsOptions, type GetMyShiftReportOptions, type TipPayout, type CloseMyShiftOptions, type AfterCountOption, getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, type ShiftTipLine, type ShiftTipLineKey, } from './schicht.js';
|
|
28
|
-
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
|
|
27
|
+
export { type GetMyDrawerStateOptions, type OpenMyShiftOptions, type RecordMyCashMovementOptions, type DrawerOpeningEntry, type LogMyDrawerOpeningsOptions, type GetMyShiftReportOptions, type TipPayout, type CloseMyShiftOptions, type AfterCountOption, type RecordMyShiftCountOptions, getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, recordMyShiftCount, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, type ShiftTipLine, type ShiftTipLineKey, } from './schicht.js';
|
|
28
|
+
export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, EXPECTED_PART_KEYS, DIFFERENCE_PART_TYPES, type ExpectedPartKey, type ShiftExpectedPart, type DifferencePartType, type ShiftDifferencePart, type LastShift, type ShiftCountResult, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftOwnerTip, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
|
|
29
29
|
export { type ShiftReceiptLayoutOptions, shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
|
|
30
30
|
export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
31
31
|
export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
|
|
32
32
|
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
33
|
+
export { roundUpSuggestions } from './aufrunden.js';
|
package/dist/cjs/pos/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = void 0;
|
|
3
|
+
exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = exports.posShortcutConflict = exports.POS_SHORTCUT_SHARED_PAIRS = exports.posSettingsChanges = exports.unknownPosSettingValues = exports.sanitizePosSettings = exports.mergePosSettings = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.posCartWidth = exports.posTipStart = exports.posTipKinds = exports.posTipKeptByDefault = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = void 0;
|
|
4
|
+
exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = exports.voucherPermsOf = exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.posFieldErrors = exports.isPosError = exports.posErrorCode = exports.isPosErrorCode = exports.POS_ERROR_CODES = exports.posSettingsFromWire = exports.setMyPosLogo = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.orderAddOnLines = exports.addOnDisplayOrder = exports.addOnRemap = exports.addOnsOfItem = exports.addOnReferencesValid = exports.addOnsFor = exports.isSelectableAddOn = exports.ADD_ON_BLOCK_REASONS = exports.ADD_ONS_MAX = exports.fromReferencePayload = exports.referenceLineName = exports.checkReference = exports.isDigitsOnlyPattern = exports.isValidReferencePattern = exports.cleanReferenceText = exports.REFERENCE_PATTERN_TEMPLATES = exports.REFERENCE_PATTERN_MAX = exports.REFERENCE_HINT_MAX = exports.REFERENCE_LABEL_MAX = exports.REFERENCE_INPUT_MAX = exports.REFERENCE_MODES = exports.tilePrompts = exports.isBookableArticle = exports.allowedQuantity = exports.quantityDefaults = exports.quantityRuleForUnit = exports.QUANTITY_RULES = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = void 0;
|
|
5
|
+
exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = exports.durationText = exports.shiftTipLines = exports.newIdempotencyKey = exports.parseCentsAllowZero = exports.sumDenominations = exports.recordMyShiftCount = exports.closeMyShift = exports.getMyShiftReport = exports.logMyDrawerOpenings = exports.recordMyCashMovement = exports.openMyShift = exports.getMyDrawerState = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.posVoucherSettingsFromWire = exports.VOUCHER_SETTINGS_DEFAULTS = exports.reprintVoucherLabel = exports.checkVoucher = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = exports.parseQuantityMilli = exports.voidMyStocktakeCount = exports.recordMyStocktakeCount = exports.listMyStocktakeCounts = exports.listMyStocktakeItems = exports.listMyStocktakes = exports.setMyCashregisterStockLocation = exports.listMyStock = exports.listMyStockLocations = exports.STOCK_LOCATION_TYPES = exports.reportConnectState = exports.inspectionInfoLines = exports.inspectionInfoRows = exports.getRegisterInspectionInfo = exports.depFolderName = exports.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = void 0;
|
|
6
|
+
exports.roundUpSuggestions = exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.DIFFERENCE_PART_TYPES = exports.EXPECTED_PART_KEYS = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
|
|
9
9
|
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger, Lager (Standorte, Bestand,
|
|
@@ -19,7 +19,12 @@ Object.defineProperty(exports, "POS_BUSINESS_DEFAULTS", { enumerable: true, get:
|
|
|
19
19
|
Object.defineProperty(exports, "POS_DEVICE_DEFAULTS", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_DEFAULTS; } });
|
|
20
20
|
Object.defineProperty(exports, "POS_DEVICE_OPTIONAL_FIELDS", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_OPTIONAL_FIELDS; } });
|
|
21
21
|
Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_FIELDS", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_OPTIONAL_FIELDS; } });
|
|
22
|
+
Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_CHOICES", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_OPTIONAL_CHOICES; } });
|
|
23
|
+
Object.defineProperty(exports, "POS_DEVICE_OPTIONAL_CHOICES", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_OPTIONAL_CHOICES; } });
|
|
22
24
|
Object.defineProperty(exports, "posTipKeptByDefault", { enumerable: true, get: function () { return settings_js_1.posTipKeptByDefault; } });
|
|
25
|
+
Object.defineProperty(exports, "posTipKinds", { enumerable: true, get: function () { return settings_js_1.posTipKinds; } });
|
|
26
|
+
Object.defineProperty(exports, "posTipStart", { enumerable: true, get: function () { return settings_js_1.posTipStart; } });
|
|
27
|
+
Object.defineProperty(exports, "posCartWidth", { enumerable: true, get: function () { return settings_js_1.posCartWidth; } });
|
|
23
28
|
Object.defineProperty(exports, "POS_BUSINESS_VALUES", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_VALUES; } });
|
|
24
29
|
Object.defineProperty(exports, "POS_DEVICE_VALUES", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_VALUES; } });
|
|
25
30
|
Object.defineProperty(exports, "mergePosSettings", { enumerable: true, get: function () { return settings_js_1.mergePosSettings; } });
|
|
@@ -34,6 +39,9 @@ Object.defineProperty(exports, "FONT_SIZE", { enumerable: true, get: function ()
|
|
|
34
39
|
Object.defineProperty(exports, "WATERMARK", { enumerable: true, get: function () { return settings_js_1.WATERMARK; } });
|
|
35
40
|
Object.defineProperty(exports, "QUANTITY", { enumerable: true, get: function () { return settings_js_1.QUANTITY; } });
|
|
36
41
|
Object.defineProperty(exports, "TIP_MODE", { enumerable: true, get: function () { return settings_js_1.TIP_MODE; } });
|
|
42
|
+
Object.defineProperty(exports, "TIP_KINDS", { enumerable: true, get: function () { return settings_js_1.TIP_KINDS; } });
|
|
43
|
+
Object.defineProperty(exports, "TIP_START", { enumerable: true, get: function () { return settings_js_1.TIP_START; } });
|
|
44
|
+
Object.defineProperty(exports, "CART_WIDTH", { enumerable: true, get: function () { return settings_js_1.CART_WIDTH; } });
|
|
37
45
|
Object.defineProperty(exports, "CHECKOUT_MODE", { enumerable: true, get: function () { return settings_js_1.CHECKOUT_MODE; } });
|
|
38
46
|
Object.defineProperty(exports, "CARD_PROVIDER", { enumerable: true, get: function () { return settings_js_1.CARD_PROVIDER; } });
|
|
39
47
|
Object.defineProperty(exports, "RECEIPT_OUTPUT", { enumerable: true, get: function () { return settings_js_1.RECEIPT_OUTPUT; } });
|
|
@@ -165,6 +173,7 @@ Object.defineProperty(exports, "recordMyCashMovement", { enumerable: true, get:
|
|
|
165
173
|
Object.defineProperty(exports, "logMyDrawerOpenings", { enumerable: true, get: function () { return schicht_js_1.logMyDrawerOpenings; } });
|
|
166
174
|
Object.defineProperty(exports, "getMyShiftReport", { enumerable: true, get: function () { return schicht_js_1.getMyShiftReport; } });
|
|
167
175
|
Object.defineProperty(exports, "closeMyShift", { enumerable: true, get: function () { return schicht_js_1.closeMyShift; } });
|
|
176
|
+
Object.defineProperty(exports, "recordMyShiftCount", { enumerable: true, get: function () { return schicht_js_1.recordMyShiftCount; } });
|
|
168
177
|
Object.defineProperty(exports, "sumDenominations", { enumerable: true, get: function () { return schicht_js_1.sumDenominations; } });
|
|
169
178
|
Object.defineProperty(exports, "parseCentsAllowZero", { enumerable: true, get: function () { return schicht_js_1.parseCentsAllowZero; } });
|
|
170
179
|
Object.defineProperty(exports, "newIdempotencyKey", { enumerable: true, get: function () { return schicht_js_1.newIdempotencyKey; } });
|
|
@@ -179,6 +188,8 @@ Object.defineProperty(exports, "OPENING_REASONS", { enumerable: true, get: funct
|
|
|
179
188
|
Object.defineProperty(exports, "MANUAL_OPENING_REASONS", { enumerable: true, get: function () { return schicht_typen_js_1.MANUAL_OPENING_REASONS; } });
|
|
180
189
|
Object.defineProperty(exports, "SHIFT_RECEIPT_KINDS", { enumerable: true, get: function () { return schicht_typen_js_1.SHIFT_RECEIPT_KINDS; } });
|
|
181
190
|
Object.defineProperty(exports, "AFTER_COUNT_TYPES", { enumerable: true, get: function () { return schicht_typen_js_1.AFTER_COUNT_TYPES; } });
|
|
191
|
+
Object.defineProperty(exports, "EXPECTED_PART_KEYS", { enumerable: true, get: function () { return schicht_typen_js_1.EXPECTED_PART_KEYS; } });
|
|
192
|
+
Object.defineProperty(exports, "DIFFERENCE_PART_TYPES", { enumerable: true, get: function () { return schicht_typen_js_1.DIFFERENCE_PART_TYPES; } });
|
|
182
193
|
var shift_sheet_js_1 = require("../receipt/shift-sheet.js");
|
|
183
194
|
Object.defineProperty(exports, "shiftReceiptLayout", { enumerable: true, get: function () { return shift_sheet_js_1.shiftReceiptLayout; } });
|
|
184
195
|
Object.defineProperty(exports, "cashMovementLayout", { enumerable: true, get: function () { return shift_sheet_js_1.cashMovementLayout; } });
|
|
@@ -213,3 +224,5 @@ Object.defineProperty(exports, "LABELS", { enumerable: true, get: function () {
|
|
|
213
224
|
Object.defineProperty(exports, "labelText", { enumerable: true, get: function () { return texte_js_1.labelText; } });
|
|
214
225
|
Object.defineProperty(exports, "RETURN_DISPOSITION_LABELS", { enumerable: true, get: function () { return texte_js_1.RETURN_DISPOSITION_LABELS; } });
|
|
215
226
|
Object.defineProperty(exports, "receiptOutputLabel", { enumerable: true, get: function () { return texte_js_1.receiptOutputLabel; } });
|
|
227
|
+
var aufrunden_js_1 = require("./aufrunden.js");
|
|
228
|
+
Object.defineProperty(exports, "roundUpSuggestions", { enumerable: true, get: function () { return aufrunden_js_1.roundUpSuggestions; } });
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* stehen im Modell genau dann, wenn der Server sie sendet.
|
|
13
13
|
*/
|
|
14
14
|
import { type ValidationScope } from '../client/errors.js';
|
|
15
|
-
import type { CashMovement, CashMovementReceipt, CashMovementResult, DrawerOpeningsResult, OpenShiftResult, ShiftReport, CloseShiftResult, DrawerState, Shift, ShiftSummaryReceipt } from './schicht-typen.js';
|
|
15
|
+
import type { CashMovement, CashMovementReceipt, CashMovementResult, DrawerOpeningsResult, OpenShiftResult, ShiftReport, CloseShiftResult, ShiftCountResult, DrawerState, Shift, ShiftSummaryReceipt } from './schicht-typen.js';
|
|
16
16
|
type Roh = Record<string, unknown>;
|
|
17
17
|
/** Wer liest (fuer die Meldung) und wo im Rumpf. */
|
|
18
18
|
export interface Ort {
|
|
@@ -33,6 +33,7 @@ export declare function schichtBon(ort: Ort, w: unknown): ShiftSummaryReceipt;
|
|
|
33
33
|
export declare function bewegungsBon(ort: Ort, w: unknown): CashMovementReceipt;
|
|
34
34
|
export declare function abschluss(ort: Ort, w: unknown): CloseShiftResult;
|
|
35
35
|
export declare function geoeffnet(ort: Ort, w: unknown): OpenShiftResult;
|
|
36
|
+
export declare function gezaehlt(ort: Ort, w: unknown): ShiftCountResult;
|
|
36
37
|
export declare function gebucht(ort: Ort, w: unknown): CashMovementResult;
|
|
37
38
|
export declare function gemeldet(ort: Ort, w: unknown): DrawerOpeningsResult;
|
|
38
39
|
export declare function bericht(ort: Ort, w: unknown): ShiftReport;
|