@kreiseck/kasseneck-api 1.37.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 +39 -1
- package/README.md +19 -1
- package/dist/cjs/client/aufrufe.d.ts +2 -2
- package/dist/cjs/client/aufrufe.js +12 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +6 -5
- package/dist/cjs/invoice/texte.d.ts +18 -1
- package/dist/cjs/invoice/texte.js +43 -2
- package/dist/cjs/invoice/vertrag.d.ts +1 -1
- package/dist/cjs/invoice/vertrag.js +1 -0
- package/dist/cjs/models/cancellation.d.ts +1 -1
- package/dist/cjs/models/cancellation.js +2 -0
- package/dist/cjs/models/index.d.ts +2 -1
- package/dist/cjs/models/index.js +6 -3
- package/dist/cjs/models/invoice-payment-ref.d.ts +42 -0
- package/dist/cjs/models/invoice-payment-ref.js +38 -0
- package/dist/cjs/models/receipt-item.d.ts +10 -2
- package/dist/cjs/models/receipt-item.js +14 -1
- package/dist/cjs/models/receipt.d.ts +7 -0
- package/dist/cjs/models/receipt.js +6 -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/schicht-lesen.js +5 -0
- package/dist/cjs/pos/schicht-typen.d.ts +11 -0
- package/dist/cjs/pos/settings.d.ts +14 -1
- package/dist/cjs/pos/settings.js +16 -2
- package/dist/cjs/pos/texte.d.ts +400 -2
- package/dist/cjs/pos/texte.js +152 -3
- package/dist/cjs/receipt/index.d.ts +1 -0
- package/dist/cjs/receipt/index.js +4 -2
- package/dist/cjs/receipt/layout.d.ts +2 -2
- package/dist/cjs/receipt/layout.js +106 -117
- package/dist/cjs/receipt/shift-sheet.js +6 -1
- package/dist/cjs/receipt/vermerke.d.ts +80 -0
- package/dist/cjs/receipt/vermerke.js +167 -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/draht.js +25 -1
- package/dist/cjs/stored/einstellungen.js +5 -2
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +22 -2
- 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/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/invoice/texte.d.ts +18 -1
- package/dist/esm/invoice/texte.js +43 -2
- package/dist/esm/invoice/vertrag.d.ts +1 -1
- package/dist/esm/invoice/vertrag.js +1 -0
- package/dist/esm/models/cancellation.d.ts +1 -1
- package/dist/esm/models/cancellation.js +2 -0
- package/dist/esm/models/index.d.ts +2 -1
- package/dist/esm/models/index.js +2 -1
- package/dist/esm/models/invoice-payment-ref.d.ts +42 -0
- package/dist/esm/models/invoice-payment-ref.js +35 -0
- package/dist/esm/models/receipt-item.d.ts +10 -2
- package/dist/esm/models/receipt-item.js +13 -1
- package/dist/esm/models/receipt.d.ts +7 -0
- package/dist/esm/models/receipt.js +6 -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/schicht-lesen.js +5 -0
- package/dist/esm/pos/schicht-typen.d.ts +11 -0
- package/dist/esm/pos/settings.d.ts +14 -1
- package/dist/esm/pos/settings.js +14 -1
- package/dist/esm/pos/texte.d.ts +400 -2
- package/dist/esm/pos/texte.js +152 -3
- package/dist/esm/receipt/index.d.ts +1 -0
- package/dist/esm/receipt/index.js +1 -0
- package/dist/esm/receipt/layout.d.ts +2 -2
- package/dist/esm/receipt/layout.js +103 -113
- package/dist/esm/receipt/shift-sheet.js +6 -1
- package/dist/esm/receipt/vermerke.d.ts +80 -0
- package/dist/esm/receipt/vermerke.js +155 -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/draht.js +25 -1
- package/dist/esm/stored/einstellungen.js +6 -3
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +22 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/expected/invoice-payment-cancellation.grid32.txt +28 -0
- package/fixtures/expected/invoice-payment-cancellation.grid48.txt +26 -0
- package/fixtures/expected/invoice-payment-cancellation.lines.json +189 -0
- package/fixtures/expected/invoice-payment-cancellation.sheet32.json +194 -0
- package/fixtures/expected/invoice-payment-cancellation.sheet48.json +182 -0
- package/fixtures/expected/invoice-payment-manual-receipt.grid32.txt +30 -0
- package/fixtures/expected/invoice-payment-manual-receipt.grid48.txt +29 -0
- package/fixtures/expected/invoice-payment-manual-receipt.lines.json +199 -0
- package/fixtures/expected/invoice-payment-manual-receipt.sheet32.json +206 -0
- package/fixtures/expected/invoice-payment-manual-receipt.sheet48.json +200 -0
- package/fixtures/expected/invoice-payment-normal.grid32.txt +22 -0
- package/fixtures/expected/invoice-payment-normal.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-normal.lines.json +192 -0
- package/fixtures/expected/invoice-payment-normal.sheet32.json +158 -0
- package/fixtures/expected/invoice-payment-normal.sheet48.json +152 -0
- package/fixtures/expected/invoice-payment-outage.grid32.txt +23 -0
- package/fixtures/expected/invoice-payment-outage.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-outage.lines.json +172 -0
- package/fixtures/expected/invoice-payment-outage.sheet32.json +164 -0
- package/fixtures/expected/invoice-payment-outage.sheet48.json +152 -0
- package/fixtures/expected/invoice-payment-partial.grid32.txt +20 -0
- package/fixtures/expected/invoice-payment-partial.grid48.txt +20 -0
- package/fixtures/expected/invoice-payment-partial.lines.json +162 -0
- package/fixtures/expected/invoice-payment-partial.sheet32.json +146 -0
- package/fixtures/expected/invoice-payment-partial.sheet48.json +146 -0
- package/fixtures/expected/invoice-payment-refund.grid32.txt +20 -0
- package/fixtures/expected/invoice-payment-refund.grid48.txt +20 -0
- package/fixtures/expected/invoice-payment-refund.lines.json +162 -0
- package/fixtures/expected/invoice-payment-refund.sheet32.json +146 -0
- package/fixtures/expected/invoice-payment-refund.sheet48.json +146 -0
- package/fixtures/expected/invoice-payment-see-invoice.grid32.txt +22 -0
- package/fixtures/expected/invoice-payment-see-invoice.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-see-invoice.lines.json +192 -0
- package/fixtures/expected/invoice-payment-see-invoice.sheet32.json +158 -0
- package/fixtures/expected/invoice-payment-see-invoice.sheet48.json +152 -0
- package/fixtures/expected/invoice-payment-training.grid32.txt +30 -0
- package/fixtures/expected/invoice-payment-training.grid48.txt +27 -0
- package/fixtures/expected/invoice-payment-training.lines.json +183 -0
- package/fixtures/expected/invoice-payment-training.sheet32.json +206 -0
- package/fixtures/expected/invoice-payment-training.sheet48.json +188 -0
- package/fixtures/expected/invoice-payment-without-vat.grid32.txt +20 -0
- package/fixtures/expected/invoice-payment-without-vat.grid48.txt +19 -0
- package/fixtures/expected/invoice-payment-without-vat.lines.json +162 -0
- package/fixtures/expected/invoice-payment-without-vat.sheet32.json +146 -0
- package/fixtures/expected/invoice-payment-without-vat.sheet48.json +140 -0
- package/fixtures/expected/invoice-payment-zero-percent.grid32.txt +22 -0
- package/fixtures/expected/invoice-payment-zero-percent.grid48.txt +21 -0
- package/fixtures/expected/invoice-payment-zero-percent.lines.json +192 -0
- package/fixtures/expected/invoice-payment-zero-percent.sheet32.json +158 -0
- package/fixtures/expected/invoice-payment-zero-percent.sheet48.json +152 -0
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +3 -2
- package/fixtures/invoice-texts.json +37 -3
- package/fixtures/manifest.json +80 -0
- package/fixtures/pos-message-cases.json +3 -0
- package/fixtures/pos-texts.json +458 -1
- package/fixtures/receipt-due-generated.json +3 -3
- package/fixtures/receipt-due-voucher-generated.json +5 -5
- package/fixtures/receipts/invoice-payment-cancellation.json +70 -0
- package/fixtures/receipts/invoice-payment-manual-receipt.json +69 -0
- package/fixtures/receipts/invoice-payment-normal.json +65 -0
- package/fixtures/receipts/invoice-payment-outage.json +63 -0
- package/fixtures/receipts/invoice-payment-partial.json +63 -0
- package/fixtures/receipts/invoice-payment-refund.json +63 -0
- package/fixtures/receipts/invoice-payment-see-invoice.json +65 -0
- package/fixtures/receipts/invoice-payment-training.json +63 -0
- package/fixtures/receipts/invoice-payment-without-vat.json +63 -0
- package/fixtures/receipts/invoice-payment-zero-percent.json +65 -0
- package/fixtures/surface.json +16 -4
- package/fixtures/v3/antworten/belege.json +2 -2
- package/fixtures/v3/antworten/belegmail.json +2 -2
- package/fixtures/v3/antworten/berichte.json +2 -2
- package/fixtures/v3/antworten/kasse-belege.json +2 -2
- package/fixtures/v3/antworten/kasse.json +702 -127
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +2 -2
- package/fixtures/v3/antworten/storno.json +2 -2
- package/fixtures/v3/stored/belege.json +2 -2
- package/fixtures/v3/stored/kasse.json +210 -4
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +237 -20
- package/fixtures/v3/zahlbetrag-faelle.json +2 -2
- package/package.json +1 -1
|
@@ -35,8 +35,10 @@ export interface ReceiptItem {
|
|
|
35
35
|
* Inhaber-Trinkgeld (`recipient.owner`) Umsatz. Rabatt-Positionen sind
|
|
36
36
|
* negative Entgeltminderungen je Steuersatz; die Kennzeichnung steuert nur
|
|
37
37
|
* die Bon-Darstellung (Summenzeile mit Aufteilung), nie die Beträge.
|
|
38
|
+
* `invoice_payment`: Zahlung auf Rechnung (Zahlungsbeleg, nur vom Server; Bezug in
|
|
39
|
+
* `Receipt.invoicePayments`), siehe [isInvoicePaymentItem].
|
|
38
40
|
*/
|
|
39
|
-
kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float' | 'deposit' | 'deposit_return';
|
|
41
|
+
kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float' | 'deposit' | 'deposit_return' | 'invoice_payment';
|
|
40
42
|
/** Empfaenger der Trinkgeld-Position; `null` = nicht zugeordnet. */
|
|
41
43
|
recipient?: TipRecipient | null;
|
|
42
44
|
/** Zahlart der Trinkgeld-Position (kann von der des Belegs abweichen). */
|
|
@@ -92,6 +94,12 @@ export interface ReceiptItem {
|
|
|
92
94
|
export declare function isDepositItem(item: ReceiptItem | ReceiptItemPayloadRead): boolean;
|
|
93
95
|
/** Leergutzeile (Ruecknahme, negativer Betrag)? */
|
|
94
96
|
export declare function isDepositReturnItem(item: ReceiptItem | ReceiptItemPayloadRead): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Zahlung auf Rechnung (Zahlungsbeleg)? Die Position zaehlt im RKSV-Feld „Null“, ist aber kein
|
|
99
|
+
* steuerfreier Umsatz: die Umsatzsteuer steht auf der Rechnung. Am Bon steht sie ohne Satzkennzeichen
|
|
100
|
+
* und nicht in der Steuertabelle. Ein Beleg mit einer solchen Position besteht nur aus solchen.
|
|
101
|
+
*/
|
|
102
|
+
export declare function isInvoicePaymentItem(item: ReceiptItem | ReceiptItemPayloadRead): boolean;
|
|
95
103
|
/** Empfaenger einer Trinkgeld-Position (Kassen-Benutzer, Snapshot des Namens). */
|
|
96
104
|
export interface TipRecipient {
|
|
97
105
|
registerUserId: string;
|
|
@@ -121,7 +129,7 @@ export interface ReceiptItemPayload {
|
|
|
121
129
|
unitPriceCents: number;
|
|
122
130
|
vatRate: number;
|
|
123
131
|
/** Trinkgeld-/Rabatt-/Gutschein-Kennzeichnung, siehe [ReceiptItem.kind]. */
|
|
124
|
-
kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float' | 'deposit' | 'deposit_return';
|
|
132
|
+
kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float' | 'deposit' | 'deposit_return' | 'invoice_payment';
|
|
125
133
|
recipient?: TipRecipient | null;
|
|
126
134
|
paymentMethod?: string;
|
|
127
135
|
receivedImmediately?: boolean;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isDepositItem = isDepositItem;
|
|
4
4
|
exports.isDepositReturnItem = isDepositReturnItem;
|
|
5
|
+
exports.isInvoicePaymentItem = isInvoicePaymentItem;
|
|
5
6
|
exports.isTipItem = isTipItem;
|
|
6
7
|
exports.isDiscountItem = isDiscountItem;
|
|
7
8
|
exports.isVoucherItem = isVoucherItem;
|
|
@@ -22,6 +23,14 @@ function isDepositItem(item) {
|
|
|
22
23
|
function isDepositReturnItem(item) {
|
|
23
24
|
return item != null && item.kind === 'deposit_return';
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Zahlung auf Rechnung (Zahlungsbeleg)? Die Position zaehlt im RKSV-Feld „Null“, ist aber kein
|
|
28
|
+
* steuerfreier Umsatz: die Umsatzsteuer steht auf der Rechnung. Am Bon steht sie ohne Satzkennzeichen
|
|
29
|
+
* und nicht in der Steuertabelle. Ein Beleg mit einer solchen Position besteht nur aus solchen.
|
|
30
|
+
*/
|
|
31
|
+
function isInvoicePaymentItem(item) {
|
|
32
|
+
return item != null && item.kind === 'invoice_payment';
|
|
33
|
+
}
|
|
25
34
|
/** Trinkgeld-Position? Die eine Erkennungsstelle — niemand prueft `kind` selbst. */
|
|
26
35
|
function isTipItem(item) {
|
|
27
36
|
return item != null && item.kind === 'tip';
|
|
@@ -75,6 +84,10 @@ function toReceiptItemPayload(item) {
|
|
|
75
84
|
// (createReceipt weist sie als voucher_invalid ab).
|
|
76
85
|
if (item.kind === 'voucher' || item.kind === 'voucher_float')
|
|
77
86
|
nutzlast.kind = item.kind;
|
|
87
|
+
// Zahlung auf Rechnung (vom Server): reist mit wie die Gutschein-Positionen; ein Wunsch an den Server
|
|
88
|
+
// traegt sie nie (createReceipt weist sie ausser beim Selbstaufruf ab).
|
|
89
|
+
if (item.kind === 'invoice_payment')
|
|
90
|
+
nutzlast.kind = 'invoice_payment';
|
|
78
91
|
// Pfand & Leergut: Kennzeichen und Felder reisen mit (Cache schreibt gelesene Belege wieder; ein Wunsch an
|
|
79
92
|
// den Server traegt `deposit` nie mit `articleId`, siehe createReceiptParams).
|
|
80
93
|
if (item.kind === 'deposit' || item.kind === 'deposit_return') {
|
|
@@ -144,7 +157,7 @@ function fromReceiptItemPayload(payload) {
|
|
|
144
157
|
}
|
|
145
158
|
: payload.kind === 'discount'
|
|
146
159
|
? { kind: 'discount' }
|
|
147
|
-
: payload.kind === 'voucher' || payload.kind === 'voucher_float'
|
|
160
|
+
: payload.kind === 'voucher' || payload.kind === 'voucher_float' || payload.kind === 'invoice_payment'
|
|
148
161
|
? { kind: payload.kind }
|
|
149
162
|
: payload.kind === 'deposit' || payload.kind === 'deposit_return'
|
|
150
163
|
? {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReceiptType, KeckPaymentMethod, CreditCardProvider } from '../enums/index.js';
|
|
2
2
|
import { type ManualReceipt } from './manual-receipt.js';
|
|
3
|
+
import { type InvoicePaymentRef } from './invoice-payment-ref.js';
|
|
3
4
|
import { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead } from './receipt-item.js';
|
|
4
5
|
import { type Voucher, type VoucherPayload } from './voucher.js';
|
|
5
6
|
import { type Cancellation, type CancellationOf, type CancellationReason } from './cancellation.js';
|
|
@@ -86,6 +87,11 @@ export interface Receipt {
|
|
|
86
87
|
* Kasse `returns: 'shared'` hat und der Beleg Pfand traegt. Der Bon druckt daraus die Fusszeile.
|
|
87
88
|
*/
|
|
88
89
|
sharedReturnPoint?: SharedReturnPoint;
|
|
90
|
+
/**
|
|
91
|
+
* Nur am Zahlungsbeleg (Zahlung auf Rechnung, Positionen `kind: 'invoice_payment'`): je Rechnung ein
|
|
92
|
+
* Bezug, in der Reihenfolge der Positionen (gespeichert `rechnungszahlung`). Siehe [InvoicePaymentRef].
|
|
93
|
+
*/
|
|
94
|
+
invoicePayments?: InvoicePaymentRef[];
|
|
89
95
|
}
|
|
90
96
|
/** Gemeinsame Ruecknahmestelle fuer Leergut (Name und Anschrift, wie der Server sie am Beleg stempelt). */
|
|
91
97
|
export interface SharedReturnPoint {
|
|
@@ -148,6 +154,7 @@ export interface ReceiptPayloadRead extends Omit<ReceiptPayload, 'items' | 'vouc
|
|
|
148
154
|
name?: string | null;
|
|
149
155
|
address?: string | null;
|
|
150
156
|
} | null;
|
|
157
|
+
invoicePayments?: unknown;
|
|
151
158
|
}
|
|
152
159
|
/**
|
|
153
160
|
* Schreibt die Nutzlast in der **neuen** Form — sie **normalisiert, statt zu
|
|
@@ -9,6 +9,7 @@ exports.receiptSumCents = receiptSumCents;
|
|
|
9
9
|
const index_js_1 = require("../enums/index.js");
|
|
10
10
|
const enum_payload_js_1 = require("./enum-payload.js");
|
|
11
11
|
const manual_receipt_js_1 = require("./manual-receipt.js");
|
|
12
|
+
const invoice_payment_ref_js_1 = require("./invoice-payment-ref.js");
|
|
12
13
|
const receipt_item_js_1 = require("./receipt-item.js");
|
|
13
14
|
const voucher_js_1 = require("./voucher.js");
|
|
14
15
|
const cancellation_js_1 = require("./cancellation.js");
|
|
@@ -99,8 +100,13 @@ function fromReceiptPayload(payload) {
|
|
|
99
100
|
...handbelegFeld(payload.manualReceipt),
|
|
100
101
|
...(typeof payload.onPremises === 'boolean' ? { onPremises: payload.onPremises } : {}),
|
|
101
102
|
...pfandStelleFeld(payload.sharedReturnPoint),
|
|
103
|
+
...rechnungszahlungFeld(payload.invoicePayments),
|
|
102
104
|
};
|
|
103
105
|
}
|
|
106
|
+
function rechnungszahlungFeld(roh) {
|
|
107
|
+
const invoicePayments = (0, invoice_payment_ref_js_1.readInvoicePaymentRefs)(roh);
|
|
108
|
+
return invoicePayments ? { invoicePayments } : {};
|
|
109
|
+
}
|
|
104
110
|
function pfandStelleFeld(roh) {
|
|
105
111
|
if (roh == null || typeof roh !== 'object')
|
|
106
112
|
return {};
|
|
@@ -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>;
|
|
@@ -63,6 +63,22 @@ function createHpsConnectClient(options) {
|
|
|
63
63
|
const shortTimeoutMs = options.shortTimeoutMs ?? DEFAULT_SHORT_TIMEOUT_MS;
|
|
64
64
|
const paymentTimeoutMs = options.paymentTimeoutMs ?? DEFAULT_PAYMENT_TIMEOUT_MS;
|
|
65
65
|
const holen = options.fetch ?? globalHpsConnectFetch();
|
|
66
|
+
// Nur aus einer Antwort mit `ok: true` und einer vollstaendigen Adresse;
|
|
67
|
+
// alles andere bleibt unbeachtet. Die Zahlung haengt nie am Aufrufer.
|
|
68
|
+
function meldeAdresse(huelle) {
|
|
69
|
+
const e = huelle['endpoint'];
|
|
70
|
+
if (options.onEndpoint === undefined || e === null || typeof e !== 'object')
|
|
71
|
+
return;
|
|
72
|
+
const { host, port, relocated } = e;
|
|
73
|
+
if (typeof host !== 'string' || host === '' || typeof port !== 'number' || !Number.isInteger(port))
|
|
74
|
+
return;
|
|
75
|
+
try {
|
|
76
|
+
options.onEndpoint({ host, port, relocated: relocated === true });
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Der Aufrufer darf die Antwort nicht kippen.
|
|
80
|
+
}
|
|
81
|
+
}
|
|
66
82
|
async function rufen(path, body, timeoutMs) {
|
|
67
83
|
const abbruch = new AbortController();
|
|
68
84
|
const wecker = setTimeout(() => abbruch.abort(), timeoutMs);
|
|
@@ -103,6 +119,7 @@ function createHpsConnectClient(options) {
|
|
|
103
119
|
}
|
|
104
120
|
const h = huelle;
|
|
105
121
|
if (h.ok === true) {
|
|
122
|
+
meldeAdresse(h);
|
|
106
123
|
return h;
|
|
107
124
|
}
|
|
108
125
|
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/cjs/pos/client.js
CHANGED
|
@@ -150,7 +150,8 @@ function pruefeTeil(name, teil, block, standard, werte) {
|
|
|
150
150
|
throw new errors_js_1.KasseneckValidationError(name, `${teil}.${schluessel}: Kennung oder null erwartet`, 'request');
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
const schalter = teil === 'business' ? settings_js_1.POS_BUSINESS_OPTIONAL_FIELDS : settings_js_1.POS_DEVICE_OPTIONAL_SWITCHES;
|
|
154
|
+
if (schalter.includes(schluessel)) {
|
|
154
155
|
if (typeof wert !== 'boolean')
|
|
155
156
|
throw new errors_js_1.KasseneckValidationError(name, `${teil}.${schluessel}: true oder false erwartet`, 'request');
|
|
156
157
|
continue;
|
package/dist/cjs/pos/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
|
|
7
7
|
* und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
|
|
8
8
|
*/
|
|
9
|
-
export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, 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/cjs/pos/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.roundUpSuggestions = exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.TIP_CLAIM_SCOPE_LABELS = exports.TIP_KEPT_MODE_LABELS = exports.EXTERNAL_VOUCHER_KIND_LABELS = exports.EXTERNAL_VOUCHERS_LABELS = exports.externalVoucherArticleErrorMessage = exports.EXTERNAL_VOUCHER_ARTICLE_MESSAGES = exports.EXTERNAL_VOUCHER_TILE_MESSAGES = exports.depositErrorMessage = exports.DEPOSIT_ERROR_MESSAGES = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.TIP_CLAIM_SCOPES = exports.DIFFERENCE_PART_TYPES = exports.EXPECTED_PART_KEYS = exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = void 0;
|
|
3
|
+
exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.TIP_CARD_KEPT_MODE = exports.TIP_KEPT_MODE = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = exports.posShortcutConflict = exports.POS_SHORTCUT_SHARED_PAIRS = exports.posSettingsChanges = exports.unknownPosSettingValues = exports.sanitizePosSettings = exports.mergePosSettings = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.posCartWidth = exports.posTipStart = exports.posTipKinds = exports.POS_BUSINESS_OPTIONAL_LISTS = exports.DISCOUNT_PRESET_KIND = exports.tipKeptFor = exports.posTipSelfPayout = exports.posTipCardKeptMode = exports.posTipCardKeptByDefault = exports.posTipKeptMode = exports.posCustomDiscountAllowed = exports.posTipKeptByDefault = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.posPrinterHint = exports.POS_DEVICE_OPTIONAL_SWITCHES = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = void 0;
|
|
4
|
+
exports.posDepositSettingsFromWire = exports.DEPOSIT_ON_PREMISES_DEFAULTS = exports.DEPOSIT_RETURN_MODES = exports.DEPOSIT_TYPES = exports.DEPOSIT_KINDS = exports.orderAddOnLines = exports.addOnDisplayOrder = exports.addOnRemap = exports.addOnsOfItem = exports.addOnReferencesValid = exports.addOnsFor = exports.isSelectableAddOn = exports.ADD_ON_BLOCK_REASONS = exports.ADD_ONS_MAX = exports.fromReferencePayload = exports.referenceLineName = exports.checkReference = exports.isDigitsOnlyPattern = exports.isValidReferencePattern = exports.cleanReferenceText = exports.REFERENCE_PATTERN_TEMPLATES = exports.REFERENCE_PATTERN_MAX = exports.REFERENCE_HINT_MAX = exports.REFERENCE_LABEL_MAX = exports.REFERENCE_INPUT_MAX = exports.REFERENCE_MODES = exports.tilePrompts = exports.isBookableArticle = exports.allowedQuantity = exports.quantityDefaults = exports.quantityRuleForUnit = exports.QUANTITY_RULES = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = void 0;
|
|
5
|
+
exports.INVALID_DISCOUNT_PRESET = exports.discountBlockLines = exports.checkDiscountPresets = exports.discountChipsFromPresets = exports.discountPresetChipText = exports.posDiscountPresets = exports.tipStatus = exports.getMyTipBalance = exports.listMyTipRecipients = exports.printerCatalogSettings = exports.printerCatalogEntry = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = exports.depositReturnOf = exports.voucherPermsOf = exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.posFieldErrors = exports.isPosError = exports.posErrorCode = exports.isPosErrorCode = exports.POS_ERROR_CODES = exports.posSettingsFromWire = exports.setMyPosLogo = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.OWN_VOUCHER_CODE_SHAPES = exports.ownVoucherCodeShape = exports.externalVoucherTileBlock = exports.checkExternalVoucherArticle = exports.checkExternalVoucherValue = exports.isArticleExternalVoucher = exports.EXTERNAL_VOUCHER_ARTICLE_REASONS = exports.ARTICLE_EXTERNAL_VOUCHER_VAT_RATES = exports.ARTICLE_EXTERNAL_VOUCHER_INVALID = exports.ARTICLE_EXTERNAL_VOUCHER_TYPES = exports.depositReturnLine = exports.withDepositLines = exports.viennaDay = exports.depositAmountOn = exports.depositsFor = exports.cashRegisterDepositFromWire = exports.depositEntriesFromWire = void 0;
|
|
6
|
+
exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = exports.durationText = exports.shiftTipLines = exports.newIdempotencyKey = exports.parseCentsAllowZero = exports.sumDenominations = exports.recordMyShiftCount = exports.closeMyShift = exports.getMyShiftReport = exports.logMyDrawerOpenings = exports.recordMyCashMovement = exports.openMyShift = exports.getMyDrawerState = exports.EXTERNAL_VOUCHERS = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.posVoucherSettingsFromWire = exports.VOUCHER_SETTINGS_DEFAULTS = exports.reprintVoucherLabel = exports.checkVoucher = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = exports.parseQuantityMilli = exports.voidMyStocktakeCount = exports.recordMyStocktakeCount = exports.listMyStocktakeCounts = exports.listMyStocktakeItems = exports.listMyStocktakes = exports.setMyCashregisterStockLocation = exports.listMyStock = exports.listMyStockLocations = exports.STOCK_LOCATION_TYPES = exports.matchReturnCode = exports.listReturnCodes = exports.learnReturnCode = exports.reportConnectState = exports.inspectionInfoLines = exports.inspectionInfoRows = exports.getRegisterInspectionInfo = exports.depFolderName = exports.DISCOUNT_PRESET_MESSAGES = exports.DISCOUNT_PRESET_AMOUNT_CENTS = exports.DISCOUNT_PRESET_PERCENT_BP = exports.DISCOUNT_PRESET_NAME_MAX = exports.DISCOUNT_PRESETS_MAX = void 0;
|
|
7
|
+
exports.roundUpSuggestions = exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.TIP_CLAIM_SCOPE_LABELS = exports.TIP_KEPT_MODE_LABELS = exports.EXTERNAL_VOUCHER_KIND_LABELS = exports.EXTERNAL_VOUCHERS_LABELS = exports.externalVoucherArticleErrorMessage = exports.EXTERNAL_VOUCHER_ARTICLE_MESSAGES = exports.EXTERNAL_VOUCHER_TILE_MESSAGES = exports.depositErrorMessage = exports.DEPOSIT_ERROR_MESSAGES = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.TIP_CLAIM_SCOPES = exports.DIFFERENCE_PART_TYPES = exports.EXPECTED_PART_KEYS = exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
|
|
10
10
|
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger, Lager (Standorte, Bestand,
|
|
@@ -19,6 +19,8 @@ Object.defineProperty(exports, "POS_SHORTCUT_DEFAULTS", { enumerable: true, get:
|
|
|
19
19
|
Object.defineProperty(exports, "POS_BUSINESS_DEFAULTS", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_DEFAULTS; } });
|
|
20
20
|
Object.defineProperty(exports, "POS_DEVICE_DEFAULTS", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_DEFAULTS; } });
|
|
21
21
|
Object.defineProperty(exports, "POS_DEVICE_OPTIONAL_FIELDS", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_OPTIONAL_FIELDS; } });
|
|
22
|
+
Object.defineProperty(exports, "POS_DEVICE_OPTIONAL_SWITCHES", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_OPTIONAL_SWITCHES; } });
|
|
23
|
+
Object.defineProperty(exports, "posPrinterHint", { enumerable: true, get: function () { return settings_js_1.posPrinterHint; } });
|
|
22
24
|
Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_FIELDS", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_OPTIONAL_FIELDS; } });
|
|
23
25
|
Object.defineProperty(exports, "POS_BUSINESS_OPTIONAL_CHOICES", { enumerable: true, get: function () { return settings_js_1.POS_BUSINESS_OPTIONAL_CHOICES; } });
|
|
24
26
|
Object.defineProperty(exports, "POS_DEVICE_OPTIONAL_CHOICES", { enumerable: true, get: function () { return settings_js_1.POS_DEVICE_OPTIONAL_CHOICES; } });
|
|
@@ -156,6 +156,9 @@ function laufstand(ort, w) {
|
|
|
156
156
|
raus.unassignedTipCents = ganzzahl(ort, o, 'unassignedTipCents');
|
|
157
157
|
if (o.discounts !== undefined && o.discounts !== null)
|
|
158
158
|
raus.discounts = liste(ort, o, 'discounts', rabatt);
|
|
159
|
+
// Zahlungen auf Rechnungen (1.38.0, nur Information): gelesen wie gesendet.
|
|
160
|
+
if (o.invoicePaymentCents !== undefined && o.invoicePaymentCents !== null)
|
|
161
|
+
raus.invoicePaymentCents = ganzzahl(ort, o, 'invoicePaymentCents');
|
|
159
162
|
return raus;
|
|
160
163
|
}
|
|
161
164
|
function rabatt(ort, w) {
|
|
@@ -403,6 +406,8 @@ function schichtBon(ort, w) {
|
|
|
403
406
|
wennWert(r, o, 'discounts', () => liste(ort, o, 'discounts', rabatt));
|
|
404
407
|
// Kartentrinkgeld bar aus der Lade genommen (Summe); nur mit Karten-direkt.
|
|
405
408
|
wennWert(r, o, 'cardTipsTakenCents', () => ganzzahl(ort, o, 'cardTipsTakenCents'));
|
|
409
|
+
// Nur Information: Zahlungen auf Rechnungen (1.38.0); der Server sendet sie erst mit dem ersten Zahlungsbeleg.
|
|
410
|
+
wennWert(r, o, 'invoicePaymentCents', () => ganzzahl(ort, o, 'invoicePaymentCents'));
|
|
406
411
|
wennWert(r, o, 'differenceParts', () => liste(ort, o, 'differenceParts', differenzTeil));
|
|
407
412
|
wennDa(r, o, 'countedBeforePayoutCents', () => ganzzahlOderNull(ort, o, 'countedBeforePayoutCents'));
|
|
408
413
|
wennDa(r, o, 'countedBeforePayoutDenominations', () => stueckelung(ort, o, 'countedBeforePayoutDenominations'));
|
|
@@ -170,6 +170,12 @@ export interface ShiftRunningTotals {
|
|
|
170
170
|
* auf dem Z-Bon steht es als Block ([discountBlockLines]).
|
|
171
171
|
*/
|
|
172
172
|
discounts?: ShiftDiscount[];
|
|
173
|
+
/**
|
|
174
|
+
* Zahlungen auf Rechnungen in Cent (1.38.0): Summe der Positionen „Zahlung auf Rechnung“ der Schicht,
|
|
175
|
+
* bar und unbar, ein Storno negativ. Nur Information, nie zusaetzlich im Soll: das Geld steckt schon im
|
|
176
|
+
* Barumsatz bzw. in `nonCashByMethod`. Der Server sendet es nur, wenn es etwas gibt (fehlt = keine).
|
|
177
|
+
*/
|
|
178
|
+
invoicePaymentCents?: number;
|
|
173
179
|
}
|
|
174
180
|
/** Ein Eintrag von [ShiftRunningTotals.discounts] bzw. [ShiftSummaryReceipt.discounts]. */
|
|
175
181
|
export interface ShiftDiscount {
|
|
@@ -440,6 +446,11 @@ export interface ShiftSummaryReceipt extends ShiftReceiptHeader {
|
|
|
440
446
|
discounts?: ShiftDiscount[];
|
|
441
447
|
/** Kartentrinkgeld bar aus der Lade genommen, Summe (Soll − Betrag); fehlt ohne Karten-direkt. */
|
|
442
448
|
cardTipsTakenCents?: number;
|
|
449
|
+
/**
|
|
450
|
+
* Zahlungen auf Rechnungen in Cent, wie [ShiftRunningTotals.invoicePaymentCents]; fehlt ohne solche
|
|
451
|
+
* (der Bon bleibt dann wie bisher).
|
|
452
|
+
*/
|
|
453
|
+
invoicePaymentCents?: number;
|
|
443
454
|
/** Entnommen bzw. eingelegt nach dem Zaehlen; fehlt, wenn kein Geld bewegt wurde. */
|
|
444
455
|
afterCount?: AfterCount;
|
|
445
456
|
/**
|
|
@@ -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/cjs/pos/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._ALTFORM_0X = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_LISTS = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_SHARED_PAIRS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.DISCOUNT_PRESET_KIND = exports.TIP_CARD_KEPT_MODE = exports.TIP_KEPT_MODE = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = void 0;
|
|
3
|
+
exports._ALTFORM_0X = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_LISTS = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_SWITCHES = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_SHARED_PAIRS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.DISCOUNT_PRESET_KIND = exports.TIP_CARD_KEPT_MODE = exports.TIP_KEPT_MODE = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = void 0;
|
|
4
4
|
exports.posShortcutConflict = posShortcutConflict;
|
|
5
5
|
exports._optionalerWert = _optionalerWert;
|
|
6
6
|
exports._vorlagenLesen = _vorlagenLesen;
|
|
@@ -8,6 +8,7 @@ exports._optionalerWahlwert = _optionalerWahlwert;
|
|
|
8
8
|
exports.posTipKinds = posTipKinds;
|
|
9
9
|
exports.posTipStart = posTipStart;
|
|
10
10
|
exports.posCartWidth = posCartWidth;
|
|
11
|
+
exports.posPrinterHint = posPrinterHint;
|
|
11
12
|
exports.posTipKeptByDefault = posTipKeptByDefault;
|
|
12
13
|
exports.posCustomDiscountAllowed = posCustomDiscountAllowed;
|
|
13
14
|
exports.posTipKeptMode = posTipKeptMode;
|
|
@@ -239,6 +240,13 @@ function _optionalerWert(wert, schreiben) {
|
|
|
239
240
|
return (schreiben && wert === null) || (typeof wert === 'string' && OPTIONALE_KENNUNG.test(wert));
|
|
240
241
|
}
|
|
241
242
|
const OPTIONALE = new Set(exports.POS_DEVICE_OPTIONAL_FIELDS);
|
|
243
|
+
/**
|
|
244
|
+
* Optionale Geraete-Schalter: ohne Standardwert, der Server sendet sie nur, wenn sie gespeichert sind (Backend
|
|
245
|
+
* `GERAET_OPTIONAL`, Wahrheitswert). [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg nimmt nur
|
|
246
|
+
* `true`/`false`.
|
|
247
|
+
*/
|
|
248
|
+
exports.POS_DEVICE_OPTIONAL_SWITCHES = Object.freeze(['printerHint']);
|
|
249
|
+
const OPTIONALE_GERAETE_SCHALTER = new Set(exports.POS_DEVICE_OPTIONAL_SWITCHES);
|
|
242
250
|
/**
|
|
243
251
|
* Optionale Betriebs-Einstellungen (Schalter): ohne Standardwert, der Server
|
|
244
252
|
* sendet sie nur, wenn sie gespeichert sind (Backend `BETRIEB_OPTIONAL`).
|
|
@@ -306,6 +314,10 @@ function posCartWidth(device) {
|
|
|
306
314
|
const w = device?.cartWidth;
|
|
307
315
|
return typeof w === 'string' && w !== '' ? w : 'narrow';
|
|
308
316
|
}
|
|
317
|
+
/** Hinweis „Drucker antwortet nicht“ an den Druckknoepfen an? Fehlt die Einstellung, gilt ja. */
|
|
318
|
+
function posPrinterHint(device) {
|
|
319
|
+
return device?.printerHint !== false;
|
|
320
|
+
}
|
|
309
321
|
/** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
|
|
310
322
|
function posTipKeptByDefault(business) {
|
|
311
323
|
return !!business && business.tipKeptByDefault === true;
|
|
@@ -420,7 +432,7 @@ exports._ALTFORM_0X = Object.freeze({ werte: ALTWERTE_0X, aktionen: [...ALTAKTIO
|
|
|
420
432
|
* Schluessel, die der Standard nicht fuehrt, bleiben draussen, ausser einer
|
|
421
433
|
* optionalen Geraete-Einstellung ([POS_DEVICE_OPTIONAL_FIELDS]) mit gueltiger
|
|
422
434
|
* Kennung und einem optionalen Betriebs-Schalter
|
|
423
|
-
* ([POS_BUSINESS_OPTIONAL_FIELDS]) als Wahrheitswert.
|
|
435
|
+
* ([POS_BUSINESS_OPTIONAL_FIELDS]) oder Geraete-Schalter ([POS_DEVICE_OPTIONAL_SWITCHES]) als Wahrheitswert.
|
|
424
436
|
*
|
|
425
437
|
* **Immer** (unabhaengig davon, welches Standard-Objekt uebergeben wird, auch
|
|
426
438
|
* eine Kopie oder das einer zweiten Paketkopie) faellt ein Wert der inneren
|
|
@@ -441,6 +453,8 @@ function mergePosSettings(standard, stored) {
|
|
|
441
453
|
out[key] = wert;
|
|
442
454
|
if (OPTIONALE_SCHALTER.has(key) && typeof wert === 'boolean')
|
|
443
455
|
out[key] = wert;
|
|
456
|
+
if (OPTIONALE_GERAETE_SCHALTER.has(key) && typeof wert === 'boolean')
|
|
457
|
+
out[key] = wert;
|
|
444
458
|
if (OPTIONALE_WAHL.has(key) && _optionalerWahlwert(key, wert))
|
|
445
459
|
out[key] = Array.isArray(wert) ? [...wert] : wert;
|
|
446
460
|
if (key === 'discountPresets') {
|