@kreiseck/kasseneck-api 1.23.0 → 1.25.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 +20 -0
- package/dist/cjs/client/aufrufe.d.ts +3 -3
- package/dist/cjs/client/aufrufe.js +5 -0
- package/dist/cjs/client/receipts.d.ts +19 -0
- package/dist/cjs/client/receipts.js +28 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/models/cancellation.d.ts +1 -1
- package/dist/cjs/models/cancellation.js +9 -0
- package/dist/cjs/models/index.d.ts +1 -1
- package/dist/cjs/models/voucher.d.ts +19 -1
- package/dist/cjs/models/voucher.js +2 -2
- package/dist/cjs/pos/connect-bestand.d.ts +27 -0
- package/dist/cjs/pos/connect-bestand.js +40 -0
- package/dist/cjs/pos/gutschein.d.ts +10 -0
- package/dist/cjs/pos/gutschein.js +7 -0
- package/dist/cjs/pos/index.d.ts +3 -2
- package/dist/cjs/pos/index.js +7 -2
- package/dist/cjs/pos/texte.d.ts +48 -0
- package/dist/cjs/pos/texte.js +39 -1
- package/dist/cjs/receipt/layout.js +29 -3
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +14 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +3 -3
- package/dist/esm/client/aufrufe.js +5 -0
- package/dist/esm/client/receipts.d.ts +19 -0
- package/dist/esm/client/receipts.js +28 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/models/cancellation.d.ts +1 -1
- package/dist/esm/models/cancellation.js +9 -0
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/voucher.d.ts +19 -1
- package/dist/esm/models/voucher.js +2 -2
- package/dist/esm/pos/connect-bestand.d.ts +27 -0
- package/dist/esm/pos/connect-bestand.js +37 -0
- package/dist/esm/pos/gutschein.d.ts +10 -0
- package/dist/esm/pos/gutschein.js +7 -0
- package/dist/esm/pos/index.d.ts +3 -2
- package/dist/esm/pos/index.js +3 -1
- package/dist/esm/pos/texte.d.ts +48 -0
- package/dist/esm/pos/texte.js +37 -0
- package/dist/esm/receipt/layout.js +29 -3
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +14 -3
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/expected/voucher-return-tip.grid32.txt +32 -0
- package/fixtures/expected/voucher-return-tip.grid48.txt +31 -0
- package/fixtures/expected/voucher-return-tip.lines.json +292 -0
- package/fixtures/expected/voucher-return-tip.sheet32.json +218 -0
- package/fixtures/expected/voucher-return-tip.sheet48.json +212 -0
- package/fixtures/expected/voucher-return.grid32.txt +29 -0
- package/fixtures/expected/voucher-return.grid48.txt +28 -0
- package/fixtures/expected/voucher-return.lines.json +237 -0
- package/fixtures/expected/voucher-return.sheet32.json +200 -0
- package/fixtures/expected/voucher-return.sheet48.json +194 -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/manifest.json +16 -0
- package/fixtures/pos-texts.json +41 -1
- package/fixtures/receipts/voucher-return-tip.json +83 -0
- package/fixtures/receipts/voucher-return.json +65 -0
- package/fixtures/surface.json +6 -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 +315 -51
- 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 +59 -18
- package/fixtures/v3/stored/rechnungen.json +1 -1
- package/fixtures/v3/v3-vokabular.json +143 -24
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
package/dist/cjs/pos/texte.js
CHANGED
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
* `placeholders` und `structure`).
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.RETURN_DISPOSITION_LABELS = exports.LABELS = exports.VOUCHER_ERROR_MESSAGES = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = void 0;
|
|
25
|
+
exports.RETURN_DISPOSITION_LABELS = exports.LABELS = exports.VOUCHER_ERROR_MESSAGES = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = void 0;
|
|
26
26
|
exports.findErrorRule = findErrorRule;
|
|
27
27
|
exports.messageOutcome = messageOutcome;
|
|
28
28
|
exports.receiptEmailErrorMessage = receiptEmailErrorMessage;
|
|
29
29
|
exports.cancellationPaymentErrorMessage = cancellationPaymentErrorMessage;
|
|
30
|
+
exports.cancellationErrorMessage = cancellationErrorMessage;
|
|
30
31
|
exports.voucherErrorMessage = voucherErrorMessage;
|
|
31
32
|
exports.receiptOutputLabel = receiptOutputLabel;
|
|
32
33
|
exports.labelText = labelText;
|
|
@@ -189,6 +190,14 @@ const MELDUNGEN_ROH = {
|
|
|
189
190
|
'cancellation.tip_source_missing': { text: 'Bitte wählen: Woher kommt das Trinkgeld zurück?' },
|
|
190
191
|
// Beleg mit Wertgutschein: keine Frage, das Trinkgeld geht mit (Ruling R59, asksRefundTip).
|
|
191
192
|
'cancellation.tip_refunded_with_voucher': { text: 'Beleg mit Gutschein: Das Trinkgeld wird mitstorniert.' },
|
|
193
|
+
// Rueckgabe als Gutschein (refundAs voucher): die Kasse zeigt „Als Gutschein“ nur, wenn es geht; diese
|
|
194
|
+
// Saetze sind fuer den seltenen Fall, dass der Server trotzdem ablehnt.
|
|
195
|
+
'cancellation.voucher_not_available': { text: 'Als Gutschein geht hier nicht – bitte wie bezahlt zurückgeben.' },
|
|
196
|
+
'cancellation.voucher_reason': { text: 'Als Gutschein nur bei „Kunde hat storniert“ oder „Sonstiges“.' },
|
|
197
|
+
'cancellation.voucher_with_voucher': { text: 'Dieser Beleg hat einen Gutschein – bitte wie bezahlt zurückgeben.' },
|
|
198
|
+
'cancellation.voucher_no_type': { text: 'Keine Gutschein-Sorte für Rückgaben eingestellt – bitte wie bezahlt zurückgeben.' },
|
|
199
|
+
'cancellation.voucher_amount': { text: 'Dieser Betrag geht nicht als Gutschein – bitte wie bezahlt zurückgeben.' },
|
|
200
|
+
'cancellation.voucher_type_changed': { text: 'Die Gutschein-Sorte für Rückgaben hat sich geändert – bitte erneut versuchen.' },
|
|
192
201
|
// --- Gutscheine: Fehlersätze (Zuordnung in VOUCHER_ERROR_MESSAGES) ---------
|
|
193
202
|
'voucher_error.not_found': { text: 'Diesen Gutschein gibt es in diesem Betrieb nicht.' },
|
|
194
203
|
'voucher_error.invalid': { text: 'Dieser Gutschein ist nicht gültig.' },
|
|
@@ -633,6 +642,32 @@ function cancellationPaymentErrorMessage(code) {
|
|
|
633
642
|
const fehler = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES;
|
|
634
643
|
return (code !== undefined && code !== null && fehler[code]) || 'cancellation.failed';
|
|
635
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Storno mit Rueckgabe als Gutschein (`refundAs: 'voucher'`, 1.25.0): welcher `code` welchen Satz bekommt.
|
|
647
|
+
* Eigene Tabelle neben CANCELLATION_PAYMENT_ERROR_MESSAGES (die bleibt der Stand der 0.x-Linie); die Codes
|
|
648
|
+
* fuer abgelehnte Eingaben und `idempotency_conflict` teilen sich `cancellation.input_rejected`.
|
|
649
|
+
*/
|
|
650
|
+
exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = {
|
|
651
|
+
refund_as_voucher_not_available: 'cancellation.voucher_not_available',
|
|
652
|
+
refund_as_voucher_reason: 'cancellation.voucher_reason',
|
|
653
|
+
refund_as_voucher_with_voucher: 'cancellation.voucher_with_voucher',
|
|
654
|
+
refund_as_voucher_no_type: 'cancellation.voucher_no_type',
|
|
655
|
+
refund_as_voucher_amount: 'cancellation.voucher_amount',
|
|
656
|
+
voucher_type_not_found: 'cancellation.voucher_type_changed',
|
|
657
|
+
voucher_amount_mismatch: 'cancellation.voucher_type_changed',
|
|
658
|
+
refund_as_invalid: 'cancellation.input_rejected',
|
|
659
|
+
refund_as_conflict: 'cancellation.input_rejected',
|
|
660
|
+
idempotency_key_required: 'cancellation.input_rejected',
|
|
661
|
+
idempotency_conflict: 'cancellation.input_rejected',
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* Der Satz zu einem `code` eines Stornos: zuerst die Rueckgabe als Gutschein, dann die Storno-Zahlungen,
|
|
665
|
+
* sonst `cancellation.failed`. Fuer die Kassen der eine Weg beim Storno.
|
|
666
|
+
*/
|
|
667
|
+
function cancellationErrorMessage(code) {
|
|
668
|
+
const gutschein = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES;
|
|
669
|
+
return (code !== undefined && code !== null && gutschein[code]) || cancellationPaymentErrorMessage(code);
|
|
670
|
+
}
|
|
636
671
|
/**
|
|
637
672
|
* Gutschein-Fehler (`/v3`): welcher `code` des Backends welchen Satz bekommt.
|
|
638
673
|
* Wie RECEIPT_EMAIL_ERROR_MESSAGES: beide Kassen entscheiden am Code. Ein
|
|
@@ -778,6 +813,9 @@ const BESCHRIFTUNGEN_ROH = {
|
|
|
778
813
|
'cancellation.as_paid': { text: 'wie bezahlt' },
|
|
779
814
|
'cancellation.cash': { text: 'bar' },
|
|
780
815
|
'cancellation.all_cash': { text: 'Alles bar' },
|
|
816
|
+
// Rueckgabe als Gutschein: dritte Wahl in „Wie zurückgeben?“ und die Bestaetigung.
|
|
817
|
+
'cancellation.as_voucher': { text: 'Als Gutschein' },
|
|
818
|
+
'cancellation.voucher_confirm': { text: '{amount} als Gutschein zurückgeben', placeholders: ['amount'] },
|
|
781
819
|
'cancellation.payment_remainder': { text: 'Rest {amount}', placeholders: ['amount'] },
|
|
782
820
|
'cancellation.difference': { text: 'Differenz' },
|
|
783
821
|
// --- Storno mit oder ohne Trinkgeld (Schichten-Spec, Nachtrag 5) -----------
|
|
@@ -480,6 +480,27 @@ function zahlungsZeilen(receipt) {
|
|
|
480
480
|
}
|
|
481
481
|
return zeilen;
|
|
482
482
|
}
|
|
483
|
+
/** Eintrag einer Rueckgabe als Gutschein: nur am Storno-Beleg, Mehrzweck (`value`), `redeem` mit `fromReturn`. */
|
|
484
|
+
function istRueckgabeGutschein(voucher) {
|
|
485
|
+
return voucher.fromReturn === true && voucher.action === index_js_1.VoucherAction.redeem && voucher.type === index_js_1.VoucherType.value;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Zahlwege einer Rueckgabe als Gutschein, je mit Betrag (8:4): zuerst jeder neue Gutschein
|
|
489
|
+
* „Gutschein ····-XXXX“ | „-24,90 €“, dann jede Zahlung ausser 0 Cent (Mitarbeiter-Trinkgeld bar zurueck)
|
|
490
|
+
* „Barzahlung“ | „-2,00 €“.
|
|
491
|
+
*/
|
|
492
|
+
function rueckgabeZahlungsZeilen(receipt, rueckgaben) {
|
|
493
|
+
const zeilen = rueckgaben.map((v) => {
|
|
494
|
+
const endung = gutscheinEndung(v);
|
|
495
|
+
return paarZeile(endung != null ? `Gutschein ····-${endung}` : 'Gutschein', `${formatCents(-(v.valueCents ?? 0))} €`, 8, 4);
|
|
496
|
+
});
|
|
497
|
+
for (const zahlung of receipt.payments ?? []) {
|
|
498
|
+
if (zahlung.amountCents === 0)
|
|
499
|
+
continue;
|
|
500
|
+
zeilen.push(paarZeile(zahlungsartText(zahlung.method), `${formatCents(zahlung.amountCents)} €`, 8, 4));
|
|
501
|
+
}
|
|
502
|
+
return zeilen;
|
|
503
|
+
}
|
|
483
504
|
// -------------------------------------------------------- Kleinunternehmer
|
|
484
505
|
/**
|
|
485
506
|
* Hinweis auf die Steuerbefreiung, den ein Kleinunternehmerbeleg tragen muss —
|
|
@@ -1266,12 +1287,17 @@ function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1266
1287
|
}
|
|
1267
1288
|
lines.push({ kind: 'rule', char: '-' });
|
|
1268
1289
|
// --- Summen
|
|
1269
|
-
|
|
1290
|
+
// Rueckgabe als Gutschein (Storno, `fromReturn`): der neue Gutschein ist der Zahlweg der Rueckgabe, keine
|
|
1291
|
+
// Einloesung. „Gesamt“ zeigt wie beim Bar-Storno den Betrag der Waren, darunter „Gutschein ····-XXXX“ mit
|
|
1292
|
+
// dem Minus statt „Barzahlung“ (Spec 2026-11-02, A.5).
|
|
1293
|
+
const rueckgaben = receipt.vouchers.filter(istRueckgabeGutschein);
|
|
1294
|
+
const rueckgabeCents = rueckgaben.reduce((summe, v) => summe + (v.valueCents ?? 0), 0);
|
|
1295
|
+
const summeCents = (0, index_js_2.receiptSumCents)(receipt) - rueckgabeCents;
|
|
1270
1296
|
const zwischensummeCents = (0, index_js_2.receiptSubSumCents)(receipt);
|
|
1271
1297
|
if (summeCents !== zwischensummeCents) {
|
|
1272
1298
|
lines.push(paarZeile('Zwischensumme', `${formatCents(zwischensummeCents)} €`));
|
|
1273
1299
|
for (const voucher of receipt.vouchers) {
|
|
1274
|
-
if (voucher.type !== index_js_1.VoucherType.value || voucher.zeroRateBucket === true)
|
|
1300
|
+
if (voucher.type !== index_js_1.VoucherType.value || voucher.zeroRateBucket === true || istRueckgabeGutschein(voucher))
|
|
1275
1301
|
continue;
|
|
1276
1302
|
if (voucher.action !== index_js_1.VoucherAction.redeem && voucher.action !== index_js_1.VoucherAction.payout)
|
|
1277
1303
|
continue;
|
|
@@ -1292,7 +1318,7 @@ function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1292
1318
|
lines.push({ kind: 'rule', char: '-' });
|
|
1293
1319
|
}
|
|
1294
1320
|
lines.push(paarZeile('Gesamt:', `${formatCents(summeCents)} €`));
|
|
1295
|
-
lines.push(...zahlungsZeilen(receipt));
|
|
1321
|
+
lines.push(...(rueckgaben.length > 0 ? rueckgabeZahlungsZeilen(receipt, rueckgaben) : zahlungsZeilen(receipt)));
|
|
1296
1322
|
lines.push({ kind: 'space', lines: 1 });
|
|
1297
1323
|
// --- Rechtshinweise und Ausfallhinweis
|
|
1298
1324
|
const hinweise = company.isSmallBusiness
|
|
@@ -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 = "44d12486b6108ca8c040230f317438b21c7761477fa1a9a7d6a65b28a5444e32";
|
|
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.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 = "44d12486b6108ca8c040230f317438b21c7761477fa1a9a7d6a65b28a5444e32";
|
|
8
8
|
/** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
|
|
9
9
|
exports.SCHEMAS = {
|
|
10
10
|
"getReceipt": {
|
|
@@ -73,7 +73,8 @@ exports.SCHEMAS = {
|
|
|
73
73
|
"redeemableUntil": "einloesbarBis",
|
|
74
74
|
"refundableUntil": "rueckzahlbarBis",
|
|
75
75
|
"validUntil": "gueltigBis"
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
"fromReturn": "rueckgabe"
|
|
77
78
|
}
|
|
78
79
|
],
|
|
79
80
|
"outputs": [
|
|
@@ -285,7 +286,17 @@ exports.SCHEMAS = {
|
|
|
285
286
|
"soldCount": "verkauft"
|
|
286
287
|
}
|
|
287
288
|
],
|
|
288
|
-
"serviceArticles": "leistungsArtikel"
|
|
289
|
+
"serviceArticles": "leistungsArtikel",
|
|
290
|
+
"returnType": {
|
|
291
|
+
"__": "rueckgabe",
|
|
292
|
+
"typeId": "sorteId",
|
|
293
|
+
"typeName": "sorteName"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"connect": {
|
|
297
|
+
"__": "connect",
|
|
298
|
+
"minimumVersion": "mindestversion",
|
|
299
|
+
"deadline": "frist"
|
|
289
300
|
}
|
|
290
301
|
},
|
|
291
302
|
"werte": {
|
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", "logReceiptOutputs", "getRegisterInspectionInfo"];
|
|
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", "logReceiptOutputs", "getRegisterInspectionInfo", "reportConnectState"];
|
|
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", "logReceiptOutputs", "createDepExport", "getDepExport", "getDepExportFile", "createDepHandoverLink", "revokeDepHandoverLink", "getRegisterInspectionInfo"];
|
|
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", "logReceiptOutputs", "createDepExport", "getDepExport", "getDepExportFile", "createDepHandoverLink", "revokeDepHandoverLink", "getRegisterInspectionInfo", "reportConnectState"];
|
|
33
33
|
export type PublicCall = typeof PUBLIC_CALLS[number];
|
|
34
34
|
export type PosCall = typeof POS_CALLS[number];
|
|
35
35
|
/**
|
|
@@ -50,7 +50,7 @@ export type PosCall = typeof POS_CALLS[number];
|
|
|
50
50
|
* [ALL_CALLS], [PUBLIC_CALLS] und [POS_CALLS] steht entweder hier oder in
|
|
51
51
|
* [CALLS_WITHOUT_EFFECT] (Waechter `test/ausgang-einordnung.test.ts`).
|
|
52
52
|
*/
|
|
53
|
-
export declare const UNKNOWN_OUTCOME_CALLS: readonly ["activateCashregister", "addVariant", "cancelInvoice", "cancelReceipt", "cancelStocktake", "changeStockCondition", "closeMyShift", "closeStocktake", "createArticle", "createCreditNote", "createCustomer", "createCustomerCashregister", "createInvoiceItem", "createPartnerCustomer", "createPartnerWebhook", "createPrintJob", "createReceipt", "createReservation", "createStocktake", "createVariantGroup", "createWebhook", "deactivateArticle", "deletePartnerWebhook", "deleteWebhook", "extendReservation", "financeWebService", "hobexPayApi", "hobexRefundApi", "issueInvoice", "logMyDrawerOpenings", "logReceiptOutputs", "openMyShift", "orderSignatureCard", "pairRegisterDevice", "receiveGoods", "recordInvoicePayment", "recordMyCashMovement", "recordMyStocktakeCount", "recordStockLoss", "recordStocktakeCount", "recountStocktake", "releaseReservation", "reportCustomerContract", "requestCustomerSignature", "reverseStockMovement", "reviewStocktake", "revokeCustomerMandate", "rotatePartnerWebhookSecret", "rotateWebhookSecret", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "sendWebhookTest", "setCustomerMandate", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "transferStock", "unpairRegisterDevice", "updateArticle", "updateCustomer", "updateInvoiceItem", "updatePartnerWebhook", "updateVariantGroup", "updateWebhook", "voidMyStocktakeCount", "voidStocktakeCount", "withdrawInvoiceItem"];
|
|
53
|
+
export declare const UNKNOWN_OUTCOME_CALLS: readonly ["activateCashregister", "addVariant", "cancelInvoice", "cancelReceipt", "cancelStocktake", "changeStockCondition", "closeMyShift", "closeStocktake", "createArticle", "createCreditNote", "createCustomer", "createCustomerCashregister", "createInvoiceItem", "createPartnerCustomer", "createPartnerWebhook", "createPrintJob", "createReceipt", "createReservation", "createStocktake", "createVariantGroup", "createWebhook", "deactivateArticle", "deletePartnerWebhook", "deleteWebhook", "extendReservation", "financeWebService", "hobexPayApi", "hobexRefundApi", "issueInvoice", "logMyDrawerOpenings", "logReceiptOutputs", "openMyShift", "orderSignatureCard", "pairRegisterDevice", "receiveGoods", "recordInvoicePayment", "recordMyCashMovement", "recordMyStocktakeCount", "recordStockLoss", "recordStocktakeCount", "recountStocktake", "releaseReservation", "reportConnectState", "reportCustomerContract", "requestCustomerSignature", "reverseStockMovement", "reviewStocktake", "revokeCustomerMandate", "rotatePartnerWebhookSecret", "rotateWebhookSecret", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "sendWebhookTest", "setCustomerMandate", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "transferStock", "unpairRegisterDevice", "updateArticle", "updateCustomer", "updateInvoiceItem", "updatePartnerWebhook", "updateVariantGroup", "updateWebhook", "voidMyStocktakeCount", "voidStocktakeCount", "withdrawInvoiceItem"];
|
|
54
54
|
/** Warum ein Aufruf keine Wirkung hat, die ein Zeitlimit offen lassen koennte. */
|
|
55
55
|
export type CallWithoutEffectReason = 'read' | 'repeatable';
|
|
56
56
|
/**
|
|
@@ -148,6 +148,8 @@ export const ALL_CALLS = [
|
|
|
148
148
|
'logReceiptOutputs',
|
|
149
149
|
// Kasseninfo fuer die Pruefung (Kassennachschau, Stufe 2b, ./pos): nur ueber den Kassenweg.
|
|
150
150
|
'getRegisterInspectionInfo',
|
|
151
|
+
// Connect-Bestand (./pos): welche Connect-Version an welchem Kassengeraet laeuft; nur ueber den Kassenweg.
|
|
152
|
+
'reportConnectState',
|
|
151
153
|
];
|
|
152
154
|
/**
|
|
153
155
|
* Die oeffentlichen Endpunkte unter `/v3` (`https://api.kasseneck.at/v3/<name>`),
|
|
@@ -342,6 +344,8 @@ export const POS_CALLS = [
|
|
|
342
344
|
'revokeDepHandoverLink',
|
|
343
345
|
// Kasseninfo fuer die Pruefung (Stufe 2b): nur ueber den Kassenweg, jeder Kassen-Benutzer.
|
|
344
346
|
'getRegisterInspectionInfo',
|
|
347
|
+
// Connect-Bestand: nur ueber den Kassenweg, jeder Kassen-Benutzer.
|
|
348
|
+
'reportConnectState',
|
|
345
349
|
];
|
|
346
350
|
/**
|
|
347
351
|
* Die Aufrufe **mit Wirkung**, alphabetisch: sie legen etwas an, aendern oder
|
|
@@ -404,6 +408,7 @@ export const UNKNOWN_OUTCOME_CALLS = [
|
|
|
404
408
|
'recordStocktakeCount',
|
|
405
409
|
'recountStocktake',
|
|
406
410
|
'releaseReservation',
|
|
411
|
+
'reportConnectState',
|
|
407
412
|
'reportCustomerContract',
|
|
408
413
|
'requestCustomerSignature',
|
|
409
414
|
'reverseStockMovement',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReceiptType, type ReceiptTypeKey, KeckPaymentMethod, type KeckPaymentMethodKey } from '../enums/index.js';
|
|
2
|
+
import { type ReturnIssuedVoucher } from '../models/voucher.js';
|
|
2
3
|
import type { ManualReceipt } from '../models/manual-receipt.js';
|
|
3
4
|
import { type Receipt, type ReceiptCompany, type ReceiptItem, type Voucher, type ReceiptSummary, type ReportMonth, type CancellationItem, type CancellationOf, type CancellationReason, type TipRefundSource, type ReturnDisposition, type ReceiptPaymentInput, type RegistrationInfo, type ReceiptEmailVia } from '../models/index.js';
|
|
4
5
|
import { type ReceiptOutput, type ReceiptOutputEntryErrorCode, type ReceiptOutputLogKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
@@ -200,6 +201,20 @@ export type CancelReceiptOptions = {
|
|
|
200
201
|
* aus der Lade (kein „gibt die Mitarbeiterin direkt“).
|
|
201
202
|
*/
|
|
202
203
|
tipRefundSource?: TipRefundSource;
|
|
204
|
+
/**
|
|
205
|
+
* Rueckgabe als Gutschein (Server 2026-11): `voucher` -- statt Geld bekommt der Kunde einen neuen
|
|
206
|
+
* Mehrzweck-Gutschein der Rueckgabe-Sorte (`getKasseSettings` `vouchers.returnType`). Nur ueber den
|
|
207
|
+
* Kassenweg mit Kassen-Benutzer, nur ohne `payments` (der Server baut die Rueckzahlung selbst; ein
|
|
208
|
+
* Mitarbeiter-Trinkgeld geht bar zurueck). Braucht [idempotencyKey]. Den Klartext-Code liefert
|
|
209
|
+
* [CancelReceiptResult.issuedVouchers] genau einmal.
|
|
210
|
+
*/
|
|
211
|
+
refundAs?: 'voucher';
|
|
212
|
+
/**
|
|
213
|
+
* Schluessel der Wiederholung (1 bis 120 Zeichen), Pflicht mit [refundAs]: die Kasse erzeugt ihn beim
|
|
214
|
+
* Oeffnen der Bestaetigung und schickt ihn bei jedem erneuten Senden mit. Gleicher Schluessel, gleicher
|
|
215
|
+
* Inhalt = derselbe Beleg (`replayed`), nie ein zweiter Gutschein; anderer Inhalt = `idempotency_conflict`.
|
|
216
|
+
*/
|
|
217
|
+
idempotencyKey?: string;
|
|
203
218
|
} & ({
|
|
204
219
|
receipt: Receipt;
|
|
205
220
|
cashregisterId?: string;
|
|
@@ -214,6 +229,10 @@ export interface CancelReceiptResult {
|
|
|
214
229
|
receipt: Receipt;
|
|
215
230
|
cancellationOf: CancellationOf;
|
|
216
231
|
remaining: number[];
|
|
232
|
+
/** Nur mit `refundAs: 'voucher'`: der ausgegebene Gutschein (Klartext-Code nur beim ersten Mal). */
|
|
233
|
+
issuedVouchers?: ReturnIssuedVoucher[];
|
|
234
|
+
/** Nur bei einer Wiederholung mit demselben `idempotencyKey`: `true`, es entstand kein neuer Beleg. */
|
|
235
|
+
replayed?: true;
|
|
217
236
|
}
|
|
218
237
|
/**
|
|
219
238
|
* Beleg **und** die Firmen-/Druckdaten derselben Antwort — das Ergebnis der
|
|
@@ -294,6 +294,18 @@ export async function cancelReceipt(transport, options) {
|
|
|
294
294
|
if (options.tipRefundSource !== undefined && options.refundTip === false) {
|
|
295
295
|
throw new KasseneckValidationError('cancelReceipt', 'tipRefundSource nur, wenn das Trinkgeld zurueckgeht (refundTip nicht false)', 'request');
|
|
296
296
|
}
|
|
297
|
+
if (options.refundAs !== undefined) {
|
|
298
|
+
if (options.refundAs !== 'voucher')
|
|
299
|
+
throw new KasseneckValidationError('cancelReceipt', 'refundAs: erlaubt ist nur voucher (oder weglassen)', 'request');
|
|
300
|
+
if (options.payments != null)
|
|
301
|
+
throw new KasseneckValidationError('cancelReceipt', 'refundAs und payments gehen nicht zusammen: die Rueckzahlung baut der Server', 'request');
|
|
302
|
+
}
|
|
303
|
+
if (options.refundAs !== undefined || options.idempotencyKey !== undefined) {
|
|
304
|
+
const k = options.idempotencyKey;
|
|
305
|
+
if (typeof k !== 'string' || k.trim() === '' || k.length > BELEG_SCHLUESSEL_MAX) {
|
|
306
|
+
throw new KasseneckValidationError('cancelReceipt', `idempotencyKey muss ein Text mit 1 bis ${BELEG_SCHLUESSEL_MAX} Zeichen sein (Pflicht mit refundAs)`, 'request');
|
|
307
|
+
}
|
|
308
|
+
}
|
|
297
309
|
const altfeld = ALTE_ZAHLFELDER.find((feld) => options[feld] != null);
|
|
298
310
|
if (altfeld != null) {
|
|
299
311
|
throw new KasseneckValidationError('cancelReceipt', `${altfeld} gibt es unter /v3 nicht mehr: Rueckzahlungen gehen als payments hinaus.`, 'request');
|
|
@@ -322,6 +334,10 @@ export async function cancelReceipt(transport, options) {
|
|
|
322
334
|
params.refundTip = options.refundTip;
|
|
323
335
|
if (options.tipRefundSource !== undefined)
|
|
324
336
|
params.tipRefundSource = options.tipRefundSource;
|
|
337
|
+
if (options.refundAs !== undefined)
|
|
338
|
+
params.refundAs = options.refundAs;
|
|
339
|
+
if (options.idempotencyKey !== undefined)
|
|
340
|
+
params.idempotencyKey = options.idempotencyKey;
|
|
325
341
|
const daten = await transport('cancelReceipt', params);
|
|
326
342
|
return signiertGelesen('cancelReceipt', () => stornoAusHuelle(daten));
|
|
327
343
|
}
|
|
@@ -344,6 +360,7 @@ function stornoAusHuelle(daten) {
|
|
|
344
360
|
...(typeof bezug.timeStamp === 'string' && bezug.timeStamp !== '' ? { timeStamp: bezug.timeStamp } : {}),
|
|
345
361
|
},
|
|
346
362
|
remaining: huelle.remaining,
|
|
363
|
+
...rueckgabeGutscheine(daten),
|
|
347
364
|
};
|
|
348
365
|
}
|
|
349
366
|
/** Nullbeleg (RKSV-Pruefbeleg) — ohne Positionen und ohne Zahlungsart. */
|
|
@@ -1040,3 +1057,14 @@ export function paymentsExpectedCents(error) {
|
|
|
1040
1057
|
const wert = error.details['expectedCents'];
|
|
1041
1058
|
return Number.isSafeInteger(wert) ? wert : undefined;
|
|
1042
1059
|
}
|
|
1060
|
+
/** `issuedVouchers` und `replayed` einer Storno-Antwort; nur was dasteht (ohne refundAs: nichts). */
|
|
1061
|
+
function rueckgabeGutscheine(daten) {
|
|
1062
|
+
const d = daten;
|
|
1063
|
+
const liste = Array.isArray(d.issuedVouchers)
|
|
1064
|
+
? d.issuedVouchers.filter((v) => v !== null && typeof v === 'object' && typeof v.id === 'string')
|
|
1065
|
+
: null;
|
|
1066
|
+
return {
|
|
1067
|
+
...(liste !== null ? { issuedVouchers: liste } : {}),
|
|
1068
|
+
...(d.replayed === true ? { replayed: true } : {}),
|
|
1069
|
+
};
|
|
1070
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isVoucherItem, isVoucherFloatItem, type Voucher, type VoucherArticle, type IssuedVoucher, 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';
|
|
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
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';
|
|
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';
|
|
@@ -54,7 +54,7 @@ export declare function isReturnDisposition(value: unknown): value is ReturnDisp
|
|
|
54
54
|
* [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
|
|
55
55
|
* `KasseneckApiError.code` lesbar.
|
|
56
56
|
*/
|
|
57
|
-
export declare const CANCELLATION_ERROR_CODES: readonly ["receipt_not_found", "receipt_type_not_cancellable", "training_receipt", "already_cancelled", "invalid_line", "quantity_exceeds_remaining", "unknown_reason", "note_too_long", "invalid_items", "cashregister_not_assigned", "not_permitted", "own_receipts_only", "cashregister_incomplete", "cancellation_failed", "cancellation_payments_required", "cancellation_refund_exceeds_payment", "cancellation_refund_reference_required", "cancellation_refund_reference_unknown", "cancellation_outcome_unknown", "invalid_return_disposition", "tip_refund_conflict", "invalid_tip_refund_source", "tip_refund_source_requires_cash", "tip_keep_not_possible_with_voucher", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "password_change_required", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing", "response_unreadable"];
|
|
57
|
+
export declare const CANCELLATION_ERROR_CODES: readonly ["receipt_not_found", "receipt_type_not_cancellable", "training_receipt", "already_cancelled", "invalid_line", "quantity_exceeds_remaining", "unknown_reason", "note_too_long", "invalid_items", "cashregister_not_assigned", "not_permitted", "own_receipts_only", "cashregister_incomplete", "cancellation_failed", "cancellation_payments_required", "cancellation_refund_exceeds_payment", "cancellation_refund_reference_required", "cancellation_refund_reference_unknown", "cancellation_outcome_unknown", "invalid_return_disposition", "tip_refund_conflict", "invalid_tip_refund_source", "tip_refund_source_requires_cash", "tip_keep_not_possible_with_voucher", "refund_as_invalid", "refund_as_conflict", "refund_as_voucher_not_available", "refund_as_voucher_reason", "refund_as_voucher_with_voucher", "refund_as_voucher_no_type", "refund_as_voucher_amount", "idempotency_key_required", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "password_change_required", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing", "response_unreadable"];
|
|
58
58
|
export type CancellationErrorCode = (typeof CANCELLATION_ERROR_CODES)[number];
|
|
59
59
|
export declare function isCancellationErrorCode(value: unknown): value is CancellationErrorCode;
|
|
60
60
|
/** Der Code eines geworfenen Fehlers, wenn er in [CANCELLATION_ERROR_CODES] steht; sonst `undefined`. */
|
|
@@ -81,6 +81,15 @@ export const CANCELLATION_ERROR_CODES = Object.freeze([
|
|
|
81
81
|
'invalid_tip_refund_source', // tipRefundSource nicht drawer oder employee
|
|
82
82
|
'tip_refund_source_requires_cash', // eine Quelle nur, wenn das Bargeld des Stornos das Trinkgeld deckt
|
|
83
83
|
'tip_keep_not_possible_with_voucher', // refundTip false an einem Beleg mit Wertgutschein (das Trinkgeld geht mit)
|
|
84
|
+
// Rueckgabe als Gutschein (refundAs voucher, Server 2026-11)
|
|
85
|
+
'refund_as_invalid', // refundAs ist nicht voucher
|
|
86
|
+
'refund_as_conflict', // refundAs zusammen mit payments
|
|
87
|
+
'refund_as_voucher_not_available', // ohne Kassen-Benutzer oder Gutscheinverkauf an der Kasse aus
|
|
88
|
+
'refund_as_voucher_reason', // Grund passt nicht (nur customer_cancelled, other)
|
|
89
|
+
'refund_as_voucher_with_voucher', // am Original haengt ein Gutschein mit Code
|
|
90
|
+
'refund_as_voucher_no_type', // keine passende Rueckgabe-Sorte eingestellt
|
|
91
|
+
'refund_as_voucher_amount', // Betrag ohne Trinkgeld ausserhalb 1,00 bis 10.000,00 Euro
|
|
92
|
+
'idempotency_key_required', // refundAs ohne idempotencyKey
|
|
84
93
|
// Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
|
|
85
94
|
'account_not_found',
|
|
86
95
|
'action_confirmation_required',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, isVoucherItem, isVoucherFloatItem, } from './receipt-item.js';
|
|
2
|
-
export { type Voucher, type VoucherArticle, type IssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields } from './voucher.js';
|
|
2
|
+
export { type Voucher, type VoucherArticle, type IssuedVoucher, type ReturnIssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields } from './voucher.js';
|
|
3
3
|
export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, } from './receipt.js';
|
|
4
4
|
export { 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, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, } from './cancellation.js';
|
|
5
5
|
export { type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
|
|
@@ -52,6 +52,11 @@ export interface Voucher {
|
|
|
52
52
|
article?: VoucherArticle;
|
|
53
53
|
balanceAfterCents?: number;
|
|
54
54
|
remainingQuantityAfter?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Rueckgabe als Gutschein: der Eintrag am Storno-Beleg ist die Ausgabe eines neuen Mehrzweck-
|
|
57
|
+
* Gutscheins statt einer Rueckzahlung (`action: redeem`). Am Bon Zahlweg statt Einloesung.
|
|
58
|
+
*/
|
|
59
|
+
fromReturn?: boolean;
|
|
55
60
|
taxedWith?: string;
|
|
56
61
|
exempt?: boolean;
|
|
57
62
|
zeroRateBucket?: boolean;
|
|
@@ -74,6 +79,8 @@ export interface IssuedVoucher {
|
|
|
74
79
|
/** Verkauf ueber eine Sorte: ihre Kennung und ihr Name; sonst fehlen die Felder. */
|
|
75
80
|
typeId?: string;
|
|
76
81
|
typeName?: string;
|
|
82
|
+
/** Rueckgabe als Gutschein (`cancelReceipt` mit `refundAs: 'voucher'`): `true`; fehlt beim Verkauf. */
|
|
83
|
+
fromReturn?: true;
|
|
77
84
|
validity?: {
|
|
78
85
|
pattern: string;
|
|
79
86
|
/** Sorte „N Jahre“: die Zahl N (Muster `1+3` fuer jedes N, die Daten gelten); fehlt sonst. */
|
|
@@ -83,6 +90,17 @@ export interface IssuedVoucher {
|
|
|
83
90
|
validUntil: string | null;
|
|
84
91
|
};
|
|
85
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Gutschein aus einer Rueckgabe in der Antwort von `cancelReceipt` (`data.issuedVouchers[]`). Beim ersten
|
|
95
|
+
* Mal wie [IssuedVoucher] mit Klartext-Code; bei einer Wiederholung mit demselben `idempotencyKey` ohne
|
|
96
|
+
* `code`, dafuer `reprintRequired: true` (der Zettel kommt dann ueber den Nachdruck).
|
|
97
|
+
*/
|
|
98
|
+
export type ReturnIssuedVoucher = Omit<IssuedVoucher, 'code' | 'type' | 'index'> & {
|
|
99
|
+
code?: string;
|
|
100
|
+
type?: string;
|
|
101
|
+
index?: number;
|
|
102
|
+
reprintRequired?: true;
|
|
103
|
+
};
|
|
86
104
|
/** Artikel eines Leistungsgutscheins, wie der Server ihn am Beleg festhaelt. */
|
|
87
105
|
export interface VoucherArticle {
|
|
88
106
|
id: string;
|
|
@@ -138,7 +156,7 @@ export declare function istWertVerkauf(voucher: Pick<Voucher, 'type' | 'action'
|
|
|
138
156
|
* Felder, die nur der Server setzt; an einem Wunsch sind sie `voucher_invalid`.
|
|
139
157
|
* Sortenname und Auszahlung friert der Server beim Verkauf ein (Stufe 4b).
|
|
140
158
|
*/
|
|
141
|
-
export declare const GUTSCHEIN_SERVERFELDER: readonly ["voucherId", "codeSuffix", "zeroRateBucket", "voucherType", "typeName", "payout"];
|
|
159
|
+
export declare const GUTSCHEIN_SERVERFELDER: readonly ["voucherId", "codeSuffix", "zeroRateBucket", "voucherType", "typeName", "payout", "fromReturn"];
|
|
142
160
|
/** Welche Serverfelder tragt der Gutschein (leere Liste = keines)? */
|
|
143
161
|
export declare function voucherServerFields(voucher: Voucher): string[];
|
|
144
162
|
export declare function toVoucherPayload(voucher: Voucher): VoucherPayload;
|
|
@@ -32,14 +32,14 @@ export function istWertVerkauf(voucher) {
|
|
|
32
32
|
* Felder, die nur der Server setzt; an einem Wunsch sind sie `voucher_invalid`.
|
|
33
33
|
* Sortenname und Auszahlung friert der Server beim Verkauf ein (Stufe 4b).
|
|
34
34
|
*/
|
|
35
|
-
export const GUTSCHEIN_SERVERFELDER = ['voucherId', 'codeSuffix', 'zeroRateBucket', 'voucherType', 'typeName', 'payout'];
|
|
35
|
+
export const GUTSCHEIN_SERVERFELDER = ['voucherId', 'codeSuffix', 'zeroRateBucket', 'voucherType', 'typeName', 'payout', 'fromReturn'];
|
|
36
36
|
/** Welche Serverfelder tragt der Gutschein (leere Liste = keines)? */
|
|
37
37
|
export function voucherServerFields(voucher) {
|
|
38
38
|
return GUTSCHEIN_SERVERFELDER.filter((feld) => voucher[feld] != null);
|
|
39
39
|
}
|
|
40
40
|
const NEUE_FELDER = [
|
|
41
41
|
'amountCents', 'articleId', 'quantity', 'positions', 'reason', 'typeId', 'typeName', 'payout', 'voucherType', 'voucherId', 'codeSuffix',
|
|
42
|
-
'vatRateBp', 'article', 'balanceAfterCents', 'remainingQuantityAfter', 'taxedWith', 'exempt', 'zeroRateBucket',
|
|
42
|
+
'vatRateBp', 'article', 'balanceAfterCents', 'remainingQuantityAfter', 'taxedWith', 'exempt', 'zeroRateBucket', 'fromReturn',
|
|
43
43
|
];
|
|
44
44
|
export function toVoucherPayload(voucher) {
|
|
45
45
|
const action = requireEnumKey(VoucherAction, voucher.action, 'Gutschein-Aktion');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InternerTransport } from '../client/aufrufe.js';
|
|
2
|
+
/**
|
|
3
|
+
* Was die Kasse ueber Kasseneck Connect an Kasseneck meldet (Bestand: welche Connect-Version an welchem
|
|
4
|
+
* Kassengeraet laeuft). Nur Angaben, die die Kasse von Connect liest – nie IP, Rechner- oder Benutzername.
|
|
5
|
+
* Aeltere Connect-Versionen kennen `osVersion`, `arch` und `features` nicht: dann `null` bzw. `[]`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConnectStateReport {
|
|
8
|
+
/** Kassengeraet, an dem Connect laeuft. */
|
|
9
|
+
deviceId: string;
|
|
10
|
+
/** Connect-Version, z. B. `1.4.0`. */
|
|
11
|
+
version: string;
|
|
12
|
+
/** `macos`, `windows` oder `linux`. */
|
|
13
|
+
os: string;
|
|
14
|
+
osVersion: string | null;
|
|
15
|
+
arch: string | null;
|
|
16
|
+
/** Faehigkeiten aus `GET /v1/status` (`bluetooth`, `https`, `update` …). */
|
|
17
|
+
features: string[];
|
|
18
|
+
/** Ob HTTPS vertraut ist (`tls.trusted`), `null` ohne HTTPS. */
|
|
19
|
+
httpsTrusted: boolean | null;
|
|
20
|
+
/** Bluetooth-Stand (`poweredOn`, `poweredOff`, `unauthorized` …), `null` ohne Bluetooth. */
|
|
21
|
+
bluetooth: string | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Meldet den Stand von Kasseneck Connect an diesem Kassengeraet (`reportConnectState`, nur Kassenweg).
|
|
25
|
+
* Geprueft wird nur die Form; was der Server nicht annimmt, lehnt er mit `invalid_connect_report` ab.
|
|
26
|
+
*/
|
|
27
|
+
export declare function reportConnectState(transport: InternerTransport, report: ConnectStateReport): Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { KasseneckValidationError } from '../client/errors.js';
|
|
2
|
+
const FELDER = ['deviceId', 'version', 'os', 'osVersion', 'arch', 'features', 'httpsTrusted', 'bluetooth'];
|
|
3
|
+
/**
|
|
4
|
+
* Meldet den Stand von Kasseneck Connect an diesem Kassengeraet (`reportConnectState`, nur Kassenweg).
|
|
5
|
+
* Geprueft wird nur die Form; was der Server nicht annimmt, lehnt er mit `invalid_connect_report` ab.
|
|
6
|
+
*/
|
|
7
|
+
export async function reportConnectState(transport, report) {
|
|
8
|
+
const name = 'reportConnectState';
|
|
9
|
+
const anfrage = (grund) => new KasseneckValidationError(name, grund, 'request');
|
|
10
|
+
if (report === null || typeof report !== 'object' || Array.isArray(report))
|
|
11
|
+
throw anfrage('Anfrage muss ein Objekt sein');
|
|
12
|
+
const fremd = Object.keys(report).find((k) => !FELDER.includes(k));
|
|
13
|
+
if (fremd != null)
|
|
14
|
+
throw anfrage(`unbekanntes Feld "${fremd}"`);
|
|
15
|
+
const text = (v) => typeof v === 'string' && v.length > 0;
|
|
16
|
+
const textOderNull = (v) => v === null || typeof v === 'string';
|
|
17
|
+
if (!text(report.deviceId))
|
|
18
|
+
throw anfrage('deviceId fehlt');
|
|
19
|
+
if (!text(report.version))
|
|
20
|
+
throw anfrage('version fehlt');
|
|
21
|
+
if (!text(report.os))
|
|
22
|
+
throw anfrage('os fehlt');
|
|
23
|
+
if (!textOderNull(report.osVersion))
|
|
24
|
+
throw anfrage('osVersion muss Text oder null sein');
|
|
25
|
+
if (!textOderNull(report.arch))
|
|
26
|
+
throw anfrage('arch muss Text oder null sein');
|
|
27
|
+
if (!Array.isArray(report.features) || !report.features.every((f) => typeof f === 'string'))
|
|
28
|
+
throw anfrage('features muss eine Liste von Texten sein');
|
|
29
|
+
if (!(report.httpsTrusted === null || typeof report.httpsTrusted === 'boolean'))
|
|
30
|
+
throw anfrage('httpsTrusted muss true, false oder null sein');
|
|
31
|
+
if (!textOderNull(report.bluetooth))
|
|
32
|
+
throw anfrage('bluetooth muss Text oder null sein');
|
|
33
|
+
await transport(name, {
|
|
34
|
+
deviceId: report.deviceId, version: report.version, os: report.os, osVersion: report.osVersion, arch: report.arch,
|
|
35
|
+
features: [...report.features], httpsTrusted: report.httpsTrusted, bluetooth: report.bluetooth,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -153,6 +153,16 @@ export interface PosVoucherSettings {
|
|
|
153
153
|
serviceArticles?: boolean;
|
|
154
154
|
/** Standardvorlage des Etiketts (Leistungsgutschein, Notausgang); `null` ohne brauchbare Vorlage. */
|
|
155
155
|
labelDefault?: VoucherLabelTemplate | null;
|
|
156
|
+
/**
|
|
157
|
+
* Sorte fuer Rueckgaben (Server 2026-11): nur gesetzt, wenn die Rueckgabe als Gutschein geht (Schalter,
|
|
158
|
+
* passende Sorte). Fehlt sie, zeigt die Kasse „Als Gutschein“ nicht.
|
|
159
|
+
*/
|
|
160
|
+
returnType?: PosVoucherReturnType;
|
|
161
|
+
}
|
|
162
|
+
/** Sorte fuer Rueckgaben (`vouchers.returnType`): Kennung und Name. */
|
|
163
|
+
export interface PosVoucherReturnType {
|
|
164
|
+
typeId: string;
|
|
165
|
+
typeName: string;
|
|
156
166
|
}
|
|
157
167
|
/** Ohne Block `vouchers` (alter Server, Konto ohne Schalter): Verkaufen ist aus. */
|
|
158
168
|
export declare const VOUCHER_SETTINGS_DEFAULTS: Readonly<PosVoucherSettings>;
|
|
@@ -76,8 +76,15 @@ export function posVoucherSettingsFromWire(block) {
|
|
|
76
76
|
types,
|
|
77
77
|
serviceArticles: leistung,
|
|
78
78
|
labelDefault: vorlageVomDraht(b['labelDefault']),
|
|
79
|
+
...rueckgabeSorteVomDraht(b['returnType']),
|
|
79
80
|
};
|
|
80
81
|
}
|
|
82
|
+
/** `vouchers.returnType`, nur stimmig (Kennung wie eine Sorte, Name als Text); sonst fehlt es. */
|
|
83
|
+
function rueckgabeSorteVomDraht(roh) {
|
|
84
|
+
if (!istObjekt(roh) || typeof roh['typeId'] !== 'string' || !SORTE_ID.test(roh['typeId']) || typeof roh['typeName'] !== 'string')
|
|
85
|
+
return {};
|
|
86
|
+
return { returnType: { typeId: roh['typeId'], typeName: roh['typeName'] } };
|
|
87
|
+
}
|
|
81
88
|
/** Kennung wie am Server (gutschein-core.ID_MUSTER): reservierte `__…__` gibt es nie als Sorte. */
|
|
82
89
|
const SORTE_ID = /^(?!__.*__$)[A-Za-z0-9_-]{1,128}$/;
|
|
83
90
|
/** Grenzen des Servers (gutschein-core.pruefeSorte): Fixbetrag 1,00 bis 10.000,00 €, Gueltigkeit 1 bis 30 Jahre. */
|