@kreiseck/kasseneck-api 1.38.0 → 1.39.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 +19 -2
- package/README.md +3 -1
- package/dist/cjs/client/aufrufe.d.ts +2 -2
- package/dist/cjs/client/aufrufe.js +12 -0
- package/dist/cjs/payments/hobex-hps/connect-client.d.ts +17 -0
- package/dist/cjs/payments/hobex-hps/connect-client.js +17 -0
- package/dist/cjs/payments/hobex-hps/index.d.ts +1 -1
- package/dist/cjs/payments/index.d.ts +1 -1
- package/dist/cjs/pos/client.js +2 -1
- package/dist/cjs/pos/index.d.ts +1 -1
- package/dist/cjs/pos/index.js +7 -5
- package/dist/cjs/pos/settings.d.ts +14 -1
- package/dist/cjs/pos/settings.js +16 -2
- package/dist/cjs/pos/texte.d.ts +387 -0
- package/dist/cjs/pos/texte.js +134 -0
- package/dist/cjs/register/errors.d.ts +1 -1
- package/dist/cjs/register/errors.js +4 -0
- package/dist/cjs/register/index.d.ts +1 -1
- package/dist/cjs/register/index.js +3 -1
- package/dist/cjs/register/pairing.d.ts +51 -0
- package/dist/cjs/register/pairing.js +59 -0
- package/dist/cjs/stored/einstellungen.js +5 -2
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +2 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +2 -2
- package/dist/esm/client/aufrufe.js +12 -0
- package/dist/esm/payments/hobex-hps/connect-client.d.ts +17 -0
- package/dist/esm/payments/hobex-hps/connect-client.js +17 -0
- package/dist/esm/payments/hobex-hps/index.d.ts +1 -1
- package/dist/esm/payments/index.d.ts +1 -1
- package/dist/esm/pos/client.js +3 -2
- package/dist/esm/pos/index.d.ts +1 -1
- package/dist/esm/pos/index.js +1 -1
- package/dist/esm/pos/settings.d.ts +14 -1
- package/dist/esm/pos/settings.js +14 -1
- package/dist/esm/pos/texte.d.ts +387 -0
- package/dist/esm/pos/texte.js +134 -0
- package/dist/esm/register/errors.d.ts +1 -1
- package/dist/esm/register/errors.js +4 -0
- package/dist/esm/register/index.d.ts +1 -1
- package/dist/esm/register/index.js +1 -1
- package/dist/esm/register/pairing.d.ts +51 -0
- package/dist/esm/register/pairing.js +57 -0
- package/dist/esm/stored/einstellungen.js +6 -3
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +2 -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 +445 -1
- package/fixtures/receipt-due-generated.json +1 -1
- package/fixtures/receipt-due-voucher-generated.json +1 -1
- package/fixtures/surface.json +14 -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 +695 -3
- 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 +209 -3
- package/fixtures/v3/stored/rechnungen.json +1 -1
- package/fixtures/v3/v3-vokabular.json +67 -4
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
|
@@ -354,6 +354,57 @@ export declare function pairRegisterDevice(options: PairRegisterDeviceOptions):
|
|
|
354
354
|
* Geraet meldet Erfolg. Danach das Geraet lokal vergessen.
|
|
355
355
|
*/
|
|
356
356
|
export declare function unpairRegisterDevice(options: ListRegisterUsersForDeviceOptions): Promise<void>;
|
|
357
|
+
/** Eingabe von [reportMyTerminalAddress]: Ausweis des Geraets plus die Adresse, unter der das Terminal geantwortet hat. */
|
|
358
|
+
export interface ReportMyTerminalAddressOptions extends RegisterDeviceConnection, RegisterDeviceCredentials {
|
|
359
|
+
/** Terminal-ID (TID) der Kasse; der Server schreibt nur, wenn sie zur Einrichtung dieses Geraets passt. */
|
|
360
|
+
tid: string;
|
|
361
|
+
/** IPv4-Adresse, unter der das Terminal antwortet. */
|
|
362
|
+
host: string;
|
|
363
|
+
/** Port, 1 bis 65535. */
|
|
364
|
+
port: number;
|
|
365
|
+
}
|
|
366
|
+
/** Antwort von [reportMyTerminalAddress]: ob der Server die Adresse geaendert hat (`false` = war schon so). */
|
|
367
|
+
export interface ReportedTerminalAddress {
|
|
368
|
+
changed: boolean;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Meldet still, dass das Kartenterminal der Kasse unter einer neuen Adresse
|
|
372
|
+
* antwortet (nur Kassenweg `/api/v3`, Ausweis des Geraets wie bei
|
|
373
|
+
* [listRegisterUsersForDevice]; keine Sitzung einer Person noetig).
|
|
374
|
+
*
|
|
375
|
+
* Der Server schreibt genau zwei Felder (IP und Port des Terminals) und nur,
|
|
376
|
+
* wenn die TID zur Einrichtung dieses Geraets passt; jede Aenderung steht im
|
|
377
|
+
* Kassen-Protokoll. Antwort `{ changed }`. Wiederholen ist gefahrlos: dieselbe
|
|
378
|
+
* Adresse noch einmal meldet `changed: false`. Die Kasse zeigt dazu nichts an.
|
|
379
|
+
*
|
|
380
|
+
* Fehlercodes: `terminal_id_mismatch`, `invalid_terminal_address`,
|
|
381
|
+
* `too_many_changes` (heute zu oft geaendert), dazu `device_not_paired`.
|
|
382
|
+
* Geprueft wird hier nur die Form; die Adresse beurteilt der Server.
|
|
383
|
+
*/
|
|
384
|
+
export declare function reportMyTerminalAddress(options: ReportMyTerminalAddressOptions): Promise<ReportedTerminalAddress>;
|
|
385
|
+
/** Eingabe von [reportMyRegisterClient]: Ausweis des Geraets plus die Bau-Kennung der laufenden Kasse. */
|
|
386
|
+
export interface ReportMyRegisterClientOptions extends RegisterDeviceConnection, RegisterDeviceCredentials {
|
|
387
|
+
/** Bau-Kennung der Kasse, z. B. `1.39.0/2026-11-13T18:20Z` (Browser) oder `kasse-app/1.0.3+34` (App). */
|
|
388
|
+
app: string;
|
|
389
|
+
}
|
|
390
|
+
/** Antwort von [reportMyRegisterClient]: ob der Server die Kennung geschrieben hat (`false` = unveraendert und jung genug). */
|
|
391
|
+
export interface ReportedRegisterClient {
|
|
392
|
+
written: boolean;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Meldet still, welche Fassung der Kasse auf diesem Geraet laeuft (nur
|
|
396
|
+
* Kassenweg `/api/v3`, Ausweis des Geraets wie bei [listRegisterUsersForDevice];
|
|
397
|
+
* keine Sitzung einer Person noetig). Gedacht fuer den Start, nach der
|
|
398
|
+
* Anmeldung und einen Takt von etwa 15 Minuten.
|
|
399
|
+
*
|
|
400
|
+
* Der Server schreibt die kuerzbare Kennung nur, wenn sie sich geaendert hat
|
|
401
|
+
* oder die letzte Meldung mindestens 10 Minuten alt ist; sonst `written: false`.
|
|
402
|
+
* Wiederholen ist gefahrlos. Die Kasse zeigt dazu nichts an.
|
|
403
|
+
*
|
|
404
|
+
* Fehlercodes: `device_not_paired` (falsches Geheimnis, unbekanntes oder
|
|
405
|
+
* gesperrtes Geraet), `server_error`. Geprueft wird hier nur die Form.
|
|
406
|
+
*/
|
|
407
|
+
export declare function reportMyRegisterClient(options: ReportMyRegisterClientOptions): Promise<ReportedRegisterClient>;
|
|
357
408
|
/** Eine laufende Sitzung an einer Kasse -- Zeile in der Auswahl. */
|
|
358
409
|
export interface RegisterSession {
|
|
359
410
|
id: string;
|
|
@@ -8,6 +8,8 @@ exports.depositReturnOf = depositReturnOf;
|
|
|
8
8
|
exports.voucherPermsOf = voucherPermsOf;
|
|
9
9
|
exports.pairRegisterDevice = pairRegisterDevice;
|
|
10
10
|
exports.unpairRegisterDevice = unpairRegisterDevice;
|
|
11
|
+
exports.reportMyTerminalAddress = reportMyTerminalAddress;
|
|
12
|
+
exports.reportMyRegisterClient = reportMyRegisterClient;
|
|
11
13
|
exports.listRegisterSessionsForDevice = listRegisterSessionsForDevice;
|
|
12
14
|
exports.listRegisterUsersForDevice = listRegisterUsersForDevice;
|
|
13
15
|
exports.registerUserLogin = registerUserLogin;
|
|
@@ -162,6 +164,63 @@ async function unpairRegisterDevice(options) {
|
|
|
162
164
|
pflicht(name, 'deviceSecret', deviceSecret);
|
|
163
165
|
await transportFuer(verbindung)(name, { ownerUid, deviceId, deviceSecret }, undefined, [deviceSecret]);
|
|
164
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Meldet still, dass das Kartenterminal der Kasse unter einer neuen Adresse
|
|
169
|
+
* antwortet (nur Kassenweg `/api/v3`, Ausweis des Geraets wie bei
|
|
170
|
+
* [listRegisterUsersForDevice]; keine Sitzung einer Person noetig).
|
|
171
|
+
*
|
|
172
|
+
* Der Server schreibt genau zwei Felder (IP und Port des Terminals) und nur,
|
|
173
|
+
* wenn die TID zur Einrichtung dieses Geraets passt; jede Aenderung steht im
|
|
174
|
+
* Kassen-Protokoll. Antwort `{ changed }`. Wiederholen ist gefahrlos: dieselbe
|
|
175
|
+
* Adresse noch einmal meldet `changed: false`. Die Kasse zeigt dazu nichts an.
|
|
176
|
+
*
|
|
177
|
+
* Fehlercodes: `terminal_id_mismatch`, `invalid_terminal_address`,
|
|
178
|
+
* `too_many_changes` (heute zu oft geaendert), dazu `device_not_paired`.
|
|
179
|
+
* Geprueft wird hier nur die Form; die Adresse beurteilt der Server.
|
|
180
|
+
*/
|
|
181
|
+
async function reportMyTerminalAddress(options) {
|
|
182
|
+
const { ownerUid, deviceId, deviceSecret, tid, host, port, ...verbindung } = options;
|
|
183
|
+
const name = 'reportMyTerminalAddress';
|
|
184
|
+
pflicht(name, 'ownerUid', ownerUid);
|
|
185
|
+
pflicht(name, 'deviceId', deviceId);
|
|
186
|
+
pflicht(name, 'deviceSecret', deviceSecret);
|
|
187
|
+
pflicht(name, 'tid', tid);
|
|
188
|
+
pflicht(name, 'host', host);
|
|
189
|
+
if (typeof port !== 'number' || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
190
|
+
throw new errors_js_1.KasseneckValidationError(name, 'port muss eine ganze Zahl von 1 bis 65535 sein', 'request');
|
|
191
|
+
}
|
|
192
|
+
const daten = await transportFuer(verbindung)(name, { ownerUid, deviceId, deviceSecret, tid, host, port }, undefined, [deviceSecret]);
|
|
193
|
+
if (typeof daten?.changed !== 'boolean') {
|
|
194
|
+
throw antwortfehler(name, 'Antwort enthaelt kein changed');
|
|
195
|
+
}
|
|
196
|
+
return { changed: daten.changed };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Meldet still, welche Fassung der Kasse auf diesem Geraet laeuft (nur
|
|
200
|
+
* Kassenweg `/api/v3`, Ausweis des Geraets wie bei [listRegisterUsersForDevice];
|
|
201
|
+
* keine Sitzung einer Person noetig). Gedacht fuer den Start, nach der
|
|
202
|
+
* Anmeldung und einen Takt von etwa 15 Minuten.
|
|
203
|
+
*
|
|
204
|
+
* Der Server schreibt die kuerzbare Kennung nur, wenn sie sich geaendert hat
|
|
205
|
+
* oder die letzte Meldung mindestens 10 Minuten alt ist; sonst `written: false`.
|
|
206
|
+
* Wiederholen ist gefahrlos. Die Kasse zeigt dazu nichts an.
|
|
207
|
+
*
|
|
208
|
+
* Fehlercodes: `device_not_paired` (falsches Geheimnis, unbekanntes oder
|
|
209
|
+
* gesperrtes Geraet), `server_error`. Geprueft wird hier nur die Form.
|
|
210
|
+
*/
|
|
211
|
+
async function reportMyRegisterClient(options) {
|
|
212
|
+
const { ownerUid, deviceId, deviceSecret, app, ...verbindung } = options;
|
|
213
|
+
const name = 'reportMyRegisterClient';
|
|
214
|
+
pflicht(name, 'ownerUid', ownerUid);
|
|
215
|
+
pflicht(name, 'deviceId', deviceId);
|
|
216
|
+
pflicht(name, 'deviceSecret', deviceSecret);
|
|
217
|
+
pflicht(name, 'app', app);
|
|
218
|
+
const daten = await transportFuer(verbindung)(name, { ownerUid, deviceId, deviceSecret, app }, undefined, [deviceSecret]);
|
|
219
|
+
if (typeof daten?.written !== 'boolean') {
|
|
220
|
+
throw antwortfehler(name, 'Antwort enthaelt kein written');
|
|
221
|
+
}
|
|
222
|
+
return { written: daten.written };
|
|
223
|
+
}
|
|
165
224
|
/**
|
|
166
225
|
* Welche Sitzungen haelt diese Kasse gerade?
|
|
167
226
|
*
|
|
@@ -53,7 +53,10 @@ const PRUEFER = {
|
|
|
53
53
|
* gueltiger Text gespeichert sind; sonst fehlen sie still, ohne Eintrag in
|
|
54
54
|
* `weggelassen` (der Server meldet sie dann auch nicht).
|
|
55
55
|
*/
|
|
56
|
-
const GERAET_OPTIONAL = Object.fromEntries(
|
|
56
|
+
const GERAET_OPTIONAL = Object.fromEntries([
|
|
57
|
+
...settings_js_1.POS_DEVICE_OPTIONAL_FIELDS.map((feld) => [feld, (v) => (0, settings_js_1._optionalerWert)(v, false)]),
|
|
58
|
+
...settings_js_1.POS_DEVICE_OPTIONAL_SWITCHES.map((feld) => [feld, (v) => typeof v === 'boolean']),
|
|
59
|
+
]);
|
|
57
60
|
/**
|
|
58
61
|
* Optionale Betriebs-Schalter (Zwilling von `BETRIEB_OPTIONAL` und
|
|
59
62
|
* `mischeBetrieb`): sie gehen nur hinaus, wenn sie als Wahrheitswert
|
|
@@ -294,6 +297,6 @@ exports._PRUEFER_FELDER = Object.freeze({
|
|
|
294
297
|
device: [...new Set([...Object.keys(PRUEFER.device), ...Object.keys(settings_js_1.POS_DEVICE_VALUES), ...Object.keys(GERAET_OPTIONAL), 'shortcuts'])],
|
|
295
298
|
standard: {
|
|
296
299
|
business: [...Object.keys(settings_js_1.POS_BUSINESS_DEFAULTS), ...settings_js_1.POS_BUSINESS_OPTIONAL_FIELDS, ...settings_js_1.POS_BUSINESS_OPTIONAL_CHOICES, ...settings_js_1.POS_BUSINESS_OPTIONAL_LISTS],
|
|
297
|
-
device: [...Object.keys(settings_js_1.POS_DEVICE_DEFAULTS), ...settings_js_1.POS_DEVICE_OPTIONAL_FIELDS, ...settings_js_1.POS_DEVICE_OPTIONAL_CHOICES],
|
|
300
|
+
device: [...Object.keys(settings_js_1.POS_DEVICE_DEFAULTS), ...settings_js_1.POS_DEVICE_OPTIONAL_FIELDS, ...settings_js_1.POS_DEVICE_OPTIONAL_SWITCHES, ...settings_js_1.POS_DEVICE_OPTIONAL_CHOICES],
|
|
298
301
|
},
|
|
299
302
|
});
|
|
@@ -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 = "ab188a33a1f0d07b187347e0293b935e41435fa61dc1078cd164b10cc2be5f46";
|
|
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 {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.ZUSATZ_KATALOGE = exports.KATALOGE = exports.ARTIKEL_FELDER = exports.SCHEMAS = exports.VOKABULAR_QUELLE = void 0;
|
|
6
6
|
/** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
|
|
7
|
-
exports.VOKABULAR_QUELLE = "
|
|
7
|
+
exports.VOKABULAR_QUELLE = "ab188a33a1f0d07b187347e0293b935e41435fa61dc1078cd164b10cc2be5f46";
|
|
8
8
|
/** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
|
|
9
9
|
exports.SCHEMAS = {
|
|
10
10
|
"getReceipt": {
|
|
@@ -264,6 +264,7 @@ exports.SCHEMAS = {
|
|
|
264
264
|
"terminalVia": "terminalVia",
|
|
265
265
|
"terminalType": "terminalArt",
|
|
266
266
|
"shortcutHints": "tastenMarken",
|
|
267
|
+
"printerHint": "druckerHinweis",
|
|
267
268
|
"cartWidth": "korbBreite"
|
|
268
269
|
},
|
|
269
270
|
"vouchers": {
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* umhuellt, muss ihn weiterhin absetzen koennen.
|
|
14
14
|
*/
|
|
15
15
|
import type { FileOrData, FileOrDataCallOptions, PdfOrData, TransportBodyFields, TransportCallOptions } from './transport.js';
|
|
16
|
-
export declare const ALL_CALLS: readonly ["activateCashregister", "cancelInvoice", "cancelReceipt", "createCreditNote", "createCustomer", "createCustomerCashregister", "createDepExport", "createDepHandoverLink", "createPartnerCustomer", "checkPartnerCustomerEmail", "createPartnerWebhook", "createPaymentLinkStripe", "createPrintJob", "createReceipt", "deletePartnerWebhook", "downloadDailyReport", "downloadReport", "endRegisterSession", "financeWebService", "generateFullReceiptId", "getCashregisterReport", "getCustomer", "getCustomerCredentials", "getCustomerSignatureStatus", "getDepExport", "getDepExportFile", "getFirstReceiptDate", "getInvoice", "getInvoicePdf", "getInvoiceSetupStatus", "getInvoiceXml", "getKasseSettings", "getPartnerCustomer", "getPartnerInfo", "getPrintJob", "getReceipt", "getReportV2", "hobexPayApi", "hobexRefundApi", "issueInvoice", "listCustomerCashregisters", "listInvoices", "listBrands", "listMyArticleGroups", "listMyArticles", "listMyCashregisters", "listMyPrinters", "listMyReceipts", "listMyStock", "listMyStockLocations", "listMyTipRecipients", "listPartnerCustomers", "listPartnerWebhookDeliveries", "listPartnerWebhooks", "listReceipts", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "pairRegisterDevice", "recordInvoicePayment", "registerPinLogin", "registerUserLogin", "renewRegisterSession", "reportCustomerContract", "requestCustomerSignature", "revokeDepHandoverLink", "searchCustomers", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "unpairRegisterDevice", "rotatePartnerWebhookSecret", "updateCustomer", "updatePartnerWebhook", "getArticle", "listArticles", "lookupArticleByCode", "listLocations", "getStock", "listStock", "listStockMovements", "createWebhook", "updateWebhook", "deleteWebhook", "listWebhooks", "sendWebhookTest", "rotateWebhookSecret", "listWebhookDeliveries", "createArticle", "updateArticle", "deactivateArticle", "receiveGoods", "transferStock", "recordStockLoss", "changeStockCondition", "reverseStockMovement", "createReservation", "extendReservation", "releaseReservation", "getReservation", "listReservations", "createVariantGroup", "updateVariantGroup", "getVariantGroup", "listVariantGroups", "addVariant", "createStocktake", "listStocktakes", "getStocktake", "listStocktakeItems", "recordStocktakeCount", "voidStocktakeCount", "listStocktakeCounts", "reviewStocktake", "recountStocktake", "closeStocktake", "cancelStocktake", "getStocktakePdf", "orderSignatureCard", "getSignatureCardOrder", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "checkVoucher", "reprintVoucherLabel", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift", "recordMyShiftCount", "logReceiptOutputs", "getRegisterInspectionInfo", "reportConnectState", "learnMyLeergutCode", "listMyLeergutCodes", "getMyTipBalance", "registerTerminalDevice", "getTerminalAccess", "claimTerminal", "requestTerminalCode", "getTerminalCode", "reportTerminalLogin", "reportTerminalReady", "unfixTerminal", "listDepositTypes", "getEwpReport", "setEwpExtraQuantities"];
|
|
16
|
+
export declare const ALL_CALLS: readonly ["activateCashregister", "cancelInvoice", "cancelReceipt", "createCreditNote", "createCustomer", "createCustomerCashregister", "createDepExport", "createDepHandoverLink", "createPartnerCustomer", "checkPartnerCustomerEmail", "createPartnerWebhook", "createPaymentLinkStripe", "createPrintJob", "createReceipt", "deletePartnerWebhook", "downloadDailyReport", "downloadReport", "endRegisterSession", "financeWebService", "generateFullReceiptId", "getCashregisterReport", "getCustomer", "getCustomerCredentials", "getCustomerSignatureStatus", "getDepExport", "getDepExportFile", "getFirstReceiptDate", "getInvoice", "getInvoicePdf", "getInvoiceSetupStatus", "getInvoiceXml", "getKasseSettings", "getPartnerCustomer", "getPartnerInfo", "getPrintJob", "getReceipt", "getReportV2", "hobexPayApi", "hobexRefundApi", "issueInvoice", "listCustomerCashregisters", "listInvoices", "listBrands", "listMyArticleGroups", "listMyArticles", "listMyCashregisters", "listMyPrinters", "listMyReceipts", "listMyStock", "listMyStockLocations", "listMyTipRecipients", "listPartnerCustomers", "listPartnerWebhookDeliveries", "listPartnerWebhooks", "listReceipts", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "pairRegisterDevice", "recordInvoicePayment", "registerPinLogin", "registerUserLogin", "renewRegisterSession", "reportCustomerContract", "requestCustomerSignature", "revokeDepHandoverLink", "searchCustomers", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "unpairRegisterDevice", "rotatePartnerWebhookSecret", "updateCustomer", "updatePartnerWebhook", "getArticle", "listArticles", "lookupArticleByCode", "listLocations", "getStock", "listStock", "listStockMovements", "createWebhook", "updateWebhook", "deleteWebhook", "listWebhooks", "sendWebhookTest", "rotateWebhookSecret", "listWebhookDeliveries", "createArticle", "updateArticle", "deactivateArticle", "receiveGoods", "transferStock", "recordStockLoss", "changeStockCondition", "reverseStockMovement", "createReservation", "extendReservation", "releaseReservation", "getReservation", "listReservations", "createVariantGroup", "updateVariantGroup", "getVariantGroup", "listVariantGroups", "addVariant", "createStocktake", "listStocktakes", "getStocktake", "listStocktakeItems", "recordStocktakeCount", "voidStocktakeCount", "listStocktakeCounts", "reviewStocktake", "recountStocktake", "closeStocktake", "cancelStocktake", "getStocktakePdf", "orderSignatureCard", "getSignatureCardOrder", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "checkVoucher", "reprintVoucherLabel", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift", "recordMyShiftCount", "logReceiptOutputs", "getRegisterInspectionInfo", "reportConnectState", "learnMyLeergutCode", "listMyLeergutCodes", "getMyTipBalance", "reportMyTerminalAddress", "reportMyRegisterClient", "registerTerminalDevice", "getTerminalAccess", "claimTerminal", "requestTerminalCode", "getTerminalCode", "reportTerminalLogin", "reportTerminalReady", "unfixTerminal", "listDepositTypes", "getEwpReport", "setEwpExtraQuantities"];
|
|
17
17
|
export type ApiCall = typeof ALL_CALLS[number];
|
|
18
18
|
/**
|
|
19
19
|
* Die oeffentlichen Endpunkte unter `/v3` (`https://api.kasseneck.at/v3/<name>`),
|
|
@@ -29,7 +29,7 @@ export declare const PUBLIC_CALLS: readonly ["createReceipt", "getReceipt", "can
|
|
|
29
29
|
* die fuenf DEP-Aufrufe); die Kasse ruft sie trotzdem ueber diesen Weg (ein Dialekt
|
|
30
30
|
* je Client, Nachtrag §5.2).
|
|
31
31
|
*/
|
|
32
|
-
export declare const POS_CALLS: readonly ["pairRegisterDevice", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "registerUserLogin", "registerPinLogin", "renewRegisterSession", "endRegisterSession", "unpairRegisterDevice", "listMyCashregisters", "listMyReceipts", "getReceipt", "createReceipt", "generateFullReceiptId", "cancelReceipt", "sendReceiptEmail", "listMyArticleGroups", "listMyArticles", "getKasseSettings", "setMyKasseSettings", "setMyKasseLogo", "setMyRegisterDeviceSettings", "listMyPrinters", "createPrintJob", "getPrintJob", "listMyTipRecipients", "listMyStockLocations", "listMyStock", "setMyCashregisterStockLocation", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "checkVoucher", "reprintVoucherLabel", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift", "recordMyShiftCount", "logReceiptOutputs", "createDepExport", "getDepExport", "getDepExportFile", "createDepHandoverLink", "revokeDepHandoverLink", "getRegisterInspectionInfo", "reportConnectState", "learnMyLeergutCode", "listMyLeergutCodes", "getMyTipBalance"];
|
|
32
|
+
export declare const POS_CALLS: readonly ["pairRegisterDevice", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "registerUserLogin", "registerPinLogin", "renewRegisterSession", "endRegisterSession", "unpairRegisterDevice", "listMyCashregisters", "listMyReceipts", "getReceipt", "createReceipt", "generateFullReceiptId", "cancelReceipt", "sendReceiptEmail", "listMyArticleGroups", "listMyArticles", "getKasseSettings", "setMyKasseSettings", "setMyKasseLogo", "setMyRegisterDeviceSettings", "listMyPrinters", "createPrintJob", "getPrintJob", "listMyTipRecipients", "listMyStockLocations", "listMyStock", "setMyCashregisterStockLocation", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "checkVoucher", "reprintVoucherLabel", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift", "recordMyShiftCount", "logReceiptOutputs", "createDepExport", "getDepExport", "getDepExportFile", "createDepHandoverLink", "revokeDepHandoverLink", "getRegisterInspectionInfo", "reportConnectState", "learnMyLeergutCode", "listMyLeergutCodes", "getMyTipBalance", "reportMyTerminalAddress", "reportMyRegisterClient"];
|
|
33
33
|
export type PublicCall = typeof PUBLIC_CALLS[number];
|
|
34
34
|
export type PosCall = typeof POS_CALLS[number];
|
|
35
35
|
/**
|
|
@@ -156,6 +156,10 @@ export const ALL_CALLS = [
|
|
|
156
156
|
'listMyLeergutCodes',
|
|
157
157
|
// „Mein Trinkgeld“ (./pos): Stand der angemeldeten Person; nur ueber den Kassenweg.
|
|
158
158
|
'getMyTipBalance',
|
|
159
|
+
// Neue Adresse des Kartenterminals still melden (./register, Ausweis des Geraets); nur ueber den Kassenweg.
|
|
160
|
+
'reportMyTerminalAddress',
|
|
161
|
+
// Laufende Fassung der Kasse still melden (./register, Ausweis des Geraets); nur ueber den Kassenweg.
|
|
162
|
+
'reportMyRegisterClient',
|
|
159
163
|
// Kartenterminal am Handy: Geraet, Zugang, TID und Code (nur /v3).
|
|
160
164
|
'registerTerminalDevice',
|
|
161
165
|
'getTerminalAccess',
|
|
@@ -388,6 +392,10 @@ export const POS_CALLS = [
|
|
|
388
392
|
'listMyLeergutCodes',
|
|
389
393
|
// „Mein Trinkgeld“: nur ueber den Kassenweg, nur persoenliche Anmeldung.
|
|
390
394
|
'getMyTipBalance',
|
|
395
|
+
// Neue Adresse des Kartenterminals melden: nur ueber den Kassenweg, Ausweis des Geraets (keine Sitzung).
|
|
396
|
+
'reportMyTerminalAddress',
|
|
397
|
+
// Laufende Fassung melden: nur ueber den Kassenweg, Ausweis des Geraets (keine Sitzung).
|
|
398
|
+
'reportMyRegisterClient',
|
|
391
399
|
];
|
|
392
400
|
/**
|
|
393
401
|
* Die Aufrufe **mit Wirkung**, alphabetisch: sie legen etwas an, aendern oder
|
|
@@ -604,6 +612,10 @@ export const CALLS_WITHOUT_EFFECT = Object.freeze({
|
|
|
604
612
|
registerUserLogin: 'repeatable',
|
|
605
613
|
renewRegisterSession: 'repeatable',
|
|
606
614
|
// Kartenterminal: Anmeldung und Einrichtung melden schreiben denselben Stand noch einmal.
|
|
615
|
+
// Dieselbe Adresse noch einmal gemeldet aendert nichts (`changed: false`); der Tageszaehler zaehlt nur echte Aenderungen.
|
|
616
|
+
reportMyTerminalAddress: 'repeatable',
|
|
617
|
+
// Dieselbe Kennung noch einmal gemeldet schreibt nichts (`written: false`).
|
|
618
|
+
reportMyRegisterClient: 'repeatable',
|
|
607
619
|
reportTerminalLogin: 'repeatable',
|
|
608
620
|
reportTerminalReady: 'repeatable',
|
|
609
621
|
// Kartenterminal: die feste Bindung noch einmal loesen aendert nichts am Server.
|
|
@@ -105,6 +105,16 @@ export type HpsConnectFetch = (url: string, init: {
|
|
|
105
105
|
body: string;
|
|
106
106
|
signal: AbortSignal;
|
|
107
107
|
}) => Promise<HpsConnectFetchResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Die Adresse, unter der Connect das Terminal tatsaechlich erreicht hat
|
|
110
|
+
* (Feld `endpoint` der Antwort ab Connect 1.5.0). `relocated: true` heisst:
|
|
111
|
+
* nicht die mitgegebene, sondern eine wiedergefundene Adresse.
|
|
112
|
+
*/
|
|
113
|
+
export interface HpsConnectEndpoint {
|
|
114
|
+
host: string;
|
|
115
|
+
port: number;
|
|
116
|
+
relocated: boolean;
|
|
117
|
+
}
|
|
108
118
|
export interface HpsConnectClientOptions {
|
|
109
119
|
/** Basisadresse des Agenten. Vorgabe `http://127.0.0.1:27182` (README `kasseneck-connect`). */
|
|
110
120
|
baseUrl?: string;
|
|
@@ -124,6 +134,13 @@ export interface HpsConnectClientOptions {
|
|
|
124
134
|
paymentTimeoutMs?: number;
|
|
125
135
|
/** Eigene `fetch`-Umsetzung (Tests). Vorgabe: globales `fetch`. */
|
|
126
136
|
fetch?: HpsConnectFetch;
|
|
137
|
+
/**
|
|
138
|
+
* Wird mit der benutzten Adresse des Terminals aufgerufen, wenn Connect sie
|
|
139
|
+
* in einer ERFOLGREICHEN Antwort (`ok: true`) mitschickt (ab Connect 1.5.0).
|
|
140
|
+
* Bei einer Fehlerhuelle und bei Antworten ohne `endpoint` (Connect 1.4.2)
|
|
141
|
+
* nie. Ein Wurf des Aufrufers bleibt ohne Wirkung auf die Zahlung.
|
|
142
|
+
*/
|
|
143
|
+
onEndpoint?: (endpoint: HpsConnectEndpoint) => void;
|
|
127
144
|
}
|
|
128
145
|
export interface HpsConnectClient {
|
|
129
146
|
payment(options: HpsConnectPaymentOptions): Promise<HpsTransactionResponse>;
|
|
@@ -59,6 +59,22 @@ export function createHpsConnectClient(options) {
|
|
|
59
59
|
const shortTimeoutMs = options.shortTimeoutMs ?? DEFAULT_SHORT_TIMEOUT_MS;
|
|
60
60
|
const paymentTimeoutMs = options.paymentTimeoutMs ?? DEFAULT_PAYMENT_TIMEOUT_MS;
|
|
61
61
|
const holen = options.fetch ?? globalHpsConnectFetch();
|
|
62
|
+
// Nur aus einer Antwort mit `ok: true` und einer vollstaendigen Adresse;
|
|
63
|
+
// alles andere bleibt unbeachtet. Die Zahlung haengt nie am Aufrufer.
|
|
64
|
+
function meldeAdresse(huelle) {
|
|
65
|
+
const e = huelle['endpoint'];
|
|
66
|
+
if (options.onEndpoint === undefined || e === null || typeof e !== 'object')
|
|
67
|
+
return;
|
|
68
|
+
const { host, port, relocated } = e;
|
|
69
|
+
if (typeof host !== 'string' || host === '' || typeof port !== 'number' || !Number.isInteger(port))
|
|
70
|
+
return;
|
|
71
|
+
try {
|
|
72
|
+
options.onEndpoint({ host, port, relocated: relocated === true });
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Der Aufrufer darf die Antwort nicht kippen.
|
|
76
|
+
}
|
|
77
|
+
}
|
|
62
78
|
async function rufen(path, body, timeoutMs) {
|
|
63
79
|
const abbruch = new AbortController();
|
|
64
80
|
const wecker = setTimeout(() => abbruch.abort(), timeoutMs);
|
|
@@ -99,6 +115,7 @@ export function createHpsConnectClient(options) {
|
|
|
99
115
|
}
|
|
100
116
|
const h = huelle;
|
|
101
117
|
if (h.ok === true) {
|
|
118
|
+
meldeAdresse(h);
|
|
102
119
|
return h;
|
|
103
120
|
}
|
|
104
121
|
const code = typeof h.error?.code === 'string' ? h.error.code : undefined;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* tatsaechlichen Adresse (z. B. ueber `GET /v1/status` je Port) bleibt Sache
|
|
18
18
|
* des Aufrufers.
|
|
19
19
|
*/
|
|
20
|
-
export { type HpsConnectCancelOptions, type HpsConnectClient, type HpsConnectClientOptions, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, createHpsConnectClient, } from './connect-client.js';
|
|
20
|
+
export { type HpsConnectCancelOptions, type HpsConnectClient, type HpsConnectClientOptions, type HpsConnectEndpoint, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, createHpsConnectClient, } from './connect-client.js';
|
|
21
21
|
export { HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, } from './errors.js';
|
|
22
22
|
export { type HpsPaymentEvent, type HpsPaymentEventKind, type HpsPaymentObserver, } from './events.js';
|
|
23
23
|
export { type CardPaymentOutcome, type HpsPaymentResult, isHostUncertainResult, mayRetrySafely, } from './outcome.js';
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
export { StripeLinkMode, type StripeLinkModeKey } from '../enums/index.js';
|
|
44
44
|
export { type CreateStripeLinkOptions, type StripeCaptureResult, createStripeLink, stripeCaptureIntent, } from './stripe.js';
|
|
45
45
|
export { type HobexPayOptions, type HobexRefundOptions, type HobexTransactionIdOptions, hobexPay, hobexRefund, newHobexTransactionId, } from './hobex.js';
|
|
46
|
-
export { type CardPaymentOutcome, type HpsConnectClient, type HpsConnectCancelOptions, type HpsConnectClientOptions, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, type HpsCancelOptions, type HpsClarifyOptions, type HpsCode, type HpsCodeEffect, type HpsCodeReason, type HpsCodeSource, type HpsMeasuredCode, type HpsPaymentEvent, type HpsPaymentEventKind, type HpsPaymentObserver, type HpsPaymentOptions, type HpsPayments, type HpsPaymentResult, type HpsPaymentsOptions, type HpsRefundOptions, type HpsTransactionIdGeneratorOptions, type HpsTransactionResponse, ABORTED_CODE, APPROVED_CODE, CARD_NOT_PRESENT_CODE, createHpsConnectClient, createHpsPayments, createHpsTransactionIdGenerator, HOBEX_SUPPORT, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, hobexReceiptFromHps, HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, INVALID_TRANSACTION_CODE, isApproved, isConclusive, isConclusiveAsStatus, isHostUncertain, isHostUncertainResult, isInProgress, isNoStatement, isNotAbortable, isTechnicalError, isUnknownCode, isValidHpsTransactionId, mayRetrySafely, MAX_TRANSACTION_ID_LENGTH, newHpsTransactionId, NOT_ABORTABLE_CODE, NO_STATEMENT_CODE, parseHpsTransactionResponse, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, TECHNICAL_ERROR_CODE, NOT_FOUND_HTTP_STATUS, TERMINAL_BUSY_HTTP_STATUS, TRANSACTION_CANCELED_CODE, } from './hobex-hps/index.js';
|
|
46
|
+
export { type CardPaymentOutcome, type HpsConnectClient, type HpsConnectCancelOptions, type HpsConnectClientOptions, type HpsConnectEndpoint, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, type HpsCancelOptions, type HpsClarifyOptions, type HpsCode, type HpsCodeEffect, type HpsCodeReason, type HpsCodeSource, type HpsMeasuredCode, type HpsPaymentEvent, type HpsPaymentEventKind, type HpsPaymentObserver, type HpsPaymentOptions, type HpsPayments, type HpsPaymentResult, type HpsPaymentsOptions, type HpsRefundOptions, type HpsTransactionIdGeneratorOptions, type HpsTransactionResponse, ABORTED_CODE, APPROVED_CODE, CARD_NOT_PRESENT_CODE, createHpsConnectClient, createHpsPayments, createHpsTransactionIdGenerator, HOBEX_SUPPORT, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, hobexReceiptFromHps, HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, INVALID_TRANSACTION_CODE, isApproved, isConclusive, isConclusiveAsStatus, isHostUncertain, isHostUncertainResult, isInProgress, isNoStatement, isNotAbortable, isTechnicalError, isUnknownCode, isValidHpsTransactionId, mayRetrySafely, MAX_TRANSACTION_ID_LENGTH, newHpsTransactionId, NOT_ABORTABLE_CODE, NO_STATEMENT_CODE, parseHpsTransactionResponse, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, TECHNICAL_ERROR_CODE, NOT_FOUND_HTTP_STATUS, TERMINAL_BUSY_HTTP_STATUS, TRANSACTION_CANCELED_CODE, } from './hobex-hps/index.js';
|
package/dist/esm/pos/client.js
CHANGED
|
@@ -2,7 +2,7 @@ import { KasseneckValidationError } from '../client/errors.js';
|
|
|
2
2
|
import { posVoucherSettingsFromWire } from './gutschein.js';
|
|
3
3
|
import { posDepositSettingsFromWire } from './pfand.js';
|
|
4
4
|
import { checkDiscountPresets, INVALID_DISCOUNT_PRESET } from './rabatt-vorlagen.js';
|
|
5
|
-
import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_BUSINESS_OPTIONAL_LISTS, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
|
|
5
|
+
import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_OPTIONAL_SWITCHES, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_BUSINESS_OPTIONAL_LISTS, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
|
|
6
6
|
/*
|
|
7
7
|
* Die Einstellungs-Aufrufe am Draht `/api/v3`: Parameter und Antwort heissen
|
|
8
8
|
* `business`/`device`, Schluessel und Werte englisch (Nachtrag §11.7.2).
|
|
@@ -143,7 +143,8 @@ function pruefeTeil(name, teil, block, standard, werte) {
|
|
|
143
143
|
throw new KasseneckValidationError(name, `${teil}.${schluessel}: Kennung oder null erwartet`, 'request');
|
|
144
144
|
continue;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
const schalter = teil === 'business' ? POS_BUSINESS_OPTIONAL_FIELDS : POS_DEVICE_OPTIONAL_SWITCHES;
|
|
147
|
+
if (schalter.includes(schluessel)) {
|
|
147
148
|
if (typeof wert !== 'boolean')
|
|
148
149
|
throw new KasseneckValidationError(name, `${teil}.${schluessel}: true oder false erwartet`, 'request');
|
|
149
150
|
continue;
|
package/dist/esm/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, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, type TipKeptDecision, type TipPaymentKind, DISCOUNT_PRESET_KIND, type PosDiscountPreset, type PosDiscountPresetKind, POS_BUSINESS_OPTIONAL_LISTS, 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, TIP_KEPT_MODE, TIP_CARD_KEPT_MODE, type PosTipKeptMode, 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';
|
|
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_DEVICE_OPTIONAL_SWITCHES, posPrinterHint, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, type TipKeptDecision, type TipPaymentKind, DISCOUNT_PRESET_KIND, type PosDiscountPreset, type PosDiscountPresetKind, POS_BUSINESS_OPTIONAL_LISTS, 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, TIP_KEPT_MODE, TIP_CARD_KEPT_MODE, type PosTipKeptMode, 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';
|
package/dist/esm/pos/index.js
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 { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, DISCOUNT_PRESET_KIND, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
|
|
9
|
+
export { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_OPTIONAL_SWITCHES, posPrinterHint, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, DISCOUNT_PRESET_KIND, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
|
|
10
10
|
// Die Enums als Laufzeitlisten, benannt nach ihrem Feld.
|
|
11
11
|
THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, TIP_CARD_KEPT_MODE, CART_WIDTH, 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';
|
|
12
12
|
export { fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
@@ -340,6 +340,11 @@ export interface PosDeviceSettings {
|
|
|
340
340
|
drawerId?: string | null;
|
|
341
341
|
/** Breite der rechten Spalte; optional, fehlt sie, gilt `narrow`. Lesen ueber [posCartWidth]. */
|
|
342
342
|
cartWidth?: PosOpen<PosCartWidth>;
|
|
343
|
+
/**
|
|
344
|
+
* Hinweis an den Druckknoepfen, wenn der Drucker auf die Statusabfrage nicht antwortet. Optional: der Server sendet
|
|
345
|
+
* das Feld nur, wenn es gespeichert ist; fehlt es, gilt an. Lesen ueber [posPrinterHint]. Siehe [POS_DEVICE_OPTIONAL_SWITCHES].
|
|
346
|
+
*/
|
|
347
|
+
printerHint?: boolean;
|
|
343
348
|
terminalIp: string;
|
|
344
349
|
terminalPort: number;
|
|
345
350
|
terminalVia: PosOpen<PosTerminalVia>;
|
|
@@ -370,6 +375,12 @@ export declare const POS_DEVICE_DEFAULTS: Readonly<PosDeviceSettings>;
|
|
|
370
375
|
export declare const POS_DEVICE_OPTIONAL_FIELDS: readonly ["drawerId"];
|
|
371
376
|
/** Gilt dieser Wert fuer ein optionales Feld? Lesen: nur eine Kennung; Schreiben: auch `null`. */
|
|
372
377
|
export declare function _optionalerWert(wert: unknown, schreiben: boolean): boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Optionale Geraete-Schalter: ohne Standardwert, der Server sendet sie nur, wenn sie gespeichert sind (Backend
|
|
380
|
+
* `GERAET_OPTIONAL`, Wahrheitswert). [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg nimmt nur
|
|
381
|
+
* `true`/`false`.
|
|
382
|
+
*/
|
|
383
|
+
export declare const POS_DEVICE_OPTIONAL_SWITCHES: readonly ["printerHint"];
|
|
373
384
|
/**
|
|
374
385
|
* Optionale Betriebs-Einstellungen (Schalter): ohne Standardwert, der Server
|
|
375
386
|
* sendet sie nur, wenn sie gespeichert sind (Backend `BETRIEB_OPTIONAL`).
|
|
@@ -402,6 +413,8 @@ export declare function posTipKinds(business: Readonly<Partial<PosBusinessSettin
|
|
|
402
413
|
export declare function posTipStart(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): PosOpen<PosTipKind>;
|
|
403
414
|
/** Wirksame Breite der rechten Spalte; ohne Angabe `narrow`. */
|
|
404
415
|
export declare function posCartWidth(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): PosOpen<PosCartWidth>;
|
|
416
|
+
/** Hinweis „Drucker antwortet nicht“ an den Druckknoepfen an? Fehlt die Einstellung, gilt ja. */
|
|
417
|
+
export declare function posPrinterHint(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): boolean;
|
|
405
418
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
406
419
|
export declare function posTipKeptByDefault(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
|
|
407
420
|
/** Darf an der Kasse ein eigener Rabatt (Betrag oder Prozent) eingetippt werden? Fehlt die Einstellung, gilt ja. */
|
|
@@ -451,7 +464,7 @@ export declare const _ALTFORM_0X: Readonly<{
|
|
|
451
464
|
* Schluessel, die der Standard nicht fuehrt, bleiben draussen, ausser einer
|
|
452
465
|
* optionalen Geraete-Einstellung ([POS_DEVICE_OPTIONAL_FIELDS]) mit gueltiger
|
|
453
466
|
* Kennung und einem optionalen Betriebs-Schalter
|
|
454
|
-
* ([POS_BUSINESS_OPTIONAL_FIELDS]) als Wahrheitswert.
|
|
467
|
+
* ([POS_BUSINESS_OPTIONAL_FIELDS]) oder Geraete-Schalter ([POS_DEVICE_OPTIONAL_SWITCHES]) als Wahrheitswert.
|
|
455
468
|
*
|
|
456
469
|
* **Immer** (unabhaengig davon, welches Standard-Objekt uebergeben wird, auch
|
|
457
470
|
* eine Kopie oder das einer zweiten Paketkopie) faellt ein Wert der inneren
|
package/dist/esm/pos/settings.js
CHANGED
|
@@ -217,6 +217,13 @@ export function _optionalerWert(wert, schreiben) {
|
|
|
217
217
|
return (schreiben && wert === null) || (typeof wert === 'string' && OPTIONALE_KENNUNG.test(wert));
|
|
218
218
|
}
|
|
219
219
|
const OPTIONALE = new Set(POS_DEVICE_OPTIONAL_FIELDS);
|
|
220
|
+
/**
|
|
221
|
+
* Optionale Geraete-Schalter: ohne Standardwert, der Server sendet sie nur, wenn sie gespeichert sind (Backend
|
|
222
|
+
* `GERAET_OPTIONAL`, Wahrheitswert). [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg nimmt nur
|
|
223
|
+
* `true`/`false`.
|
|
224
|
+
*/
|
|
225
|
+
export const POS_DEVICE_OPTIONAL_SWITCHES = Object.freeze(['printerHint']);
|
|
226
|
+
const OPTIONALE_GERAETE_SCHALTER = new Set(POS_DEVICE_OPTIONAL_SWITCHES);
|
|
220
227
|
/**
|
|
221
228
|
* Optionale Betriebs-Einstellungen (Schalter): ohne Standardwert, der Server
|
|
222
229
|
* sendet sie nur, wenn sie gespeichert sind (Backend `BETRIEB_OPTIONAL`).
|
|
@@ -284,6 +291,10 @@ export function posCartWidth(device) {
|
|
|
284
291
|
const w = device?.cartWidth;
|
|
285
292
|
return typeof w === 'string' && w !== '' ? w : 'narrow';
|
|
286
293
|
}
|
|
294
|
+
/** Hinweis „Drucker antwortet nicht“ an den Druckknoepfen an? Fehlt die Einstellung, gilt ja. */
|
|
295
|
+
export function posPrinterHint(device) {
|
|
296
|
+
return device?.printerHint !== false;
|
|
297
|
+
}
|
|
287
298
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
288
299
|
export function posTipKeptByDefault(business) {
|
|
289
300
|
return !!business && business.tipKeptByDefault === true;
|
|
@@ -398,7 +409,7 @@ export const _ALTFORM_0X = Object.freeze({ werte: ALTWERTE_0X, aktionen: [...ALT
|
|
|
398
409
|
* Schluessel, die der Standard nicht fuehrt, bleiben draussen, ausser einer
|
|
399
410
|
* optionalen Geraete-Einstellung ([POS_DEVICE_OPTIONAL_FIELDS]) mit gueltiger
|
|
400
411
|
* Kennung und einem optionalen Betriebs-Schalter
|
|
401
|
-
* ([POS_BUSINESS_OPTIONAL_FIELDS]) als Wahrheitswert.
|
|
412
|
+
* ([POS_BUSINESS_OPTIONAL_FIELDS]) oder Geraete-Schalter ([POS_DEVICE_OPTIONAL_SWITCHES]) als Wahrheitswert.
|
|
402
413
|
*
|
|
403
414
|
* **Immer** (unabhaengig davon, welches Standard-Objekt uebergeben wird, auch
|
|
404
415
|
* eine Kopie oder das einer zweiten Paketkopie) faellt ein Wert der inneren
|
|
@@ -419,6 +430,8 @@ export function mergePosSettings(standard, stored) {
|
|
|
419
430
|
out[key] = wert;
|
|
420
431
|
if (OPTIONALE_SCHALTER.has(key) && typeof wert === 'boolean')
|
|
421
432
|
out[key] = wert;
|
|
433
|
+
if (OPTIONALE_GERAETE_SCHALTER.has(key) && typeof wert === 'boolean')
|
|
434
|
+
out[key] = wert;
|
|
422
435
|
if (OPTIONALE_WAHL.has(key) && _optionalerWahlwert(key, wert))
|
|
423
436
|
out[key] = Array.isArray(wert) ? [...wert] : wert;
|
|
424
437
|
if (key === 'discountPresets') {
|