@kreiseck/kasseneck-api 1.32.0 → 1.33.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 +15 -0
- package/dist/cjs/client/receipts.js +14 -2
- package/dist/cjs/models/hobex-receipt.d.ts +20 -5
- package/dist/cjs/models/hobex-receipt.js +17 -6
- package/dist/cjs/payments/hobex-hps/connect-client.js +5 -3
- package/dist/cjs/payments/hobex-hps/errors.d.ts +32 -5
- package/dist/cjs/payments/hobex-hps/errors.js +35 -6
- package/dist/cjs/payments/hobex-hps/index.d.ts +1 -1
- package/dist/cjs/payments/hobex-hps/index.js +3 -2
- package/dist/cjs/payments/index.d.ts +1 -1
- package/dist/cjs/payments/index.js +3 -1
- package/dist/cjs/pos/fremdgutschein-artikel.d.ts +3 -2
- package/dist/cjs/pos/fremdgutschein-artikel.js +4 -2
- package/dist/cjs/pos/texte.d.ts +18 -0
- package/dist/cjs/pos/texte.js +9 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/receipts.js +15 -3
- package/dist/esm/models/hobex-receipt.d.ts +20 -5
- package/dist/esm/models/hobex-receipt.js +17 -6
- package/dist/esm/payments/hobex-hps/connect-client.js +6 -4
- package/dist/esm/payments/hobex-hps/errors.d.ts +32 -5
- package/dist/esm/payments/hobex-hps/errors.js +34 -5
- package/dist/esm/payments/hobex-hps/index.d.ts +1 -1
- package/dist/esm/payments/hobex-hps/index.js +1 -1
- package/dist/esm/payments/index.d.ts +1 -1
- package/dist/esm/payments/index.js +1 -1
- package/dist/esm/pos/fremdgutschein-artikel.d.ts +3 -2
- package/dist/esm/pos/fremdgutschein-artikel.js +4 -2
- package/dist/esm/pos/texte.d.ts +18 -0
- package/dist/esm/pos/texte.js +9 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/external-voucher-article-cases.json +20 -0
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/pos-texts.json +30 -1
- package/fixtures/surface.json +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ Was vor 0.7.0 geschah, steht in der Commit-Historie (`git log`); ab hier wird
|
|
|
4
4
|
es hier geführt. Ein Eintrag nennt die Änderung **und ihren Grund** —
|
|
5
5
|
nur der Grund überlebt den nächsten Umbau.
|
|
6
6
|
|
|
7
|
+
## 1.33.0 - unveröffentlicht
|
|
8
|
+
|
|
9
|
+
Card terminal and the browser till on a Mac (Chrome as an installed app, Hobex HPS and printer through Kasseneck Connect). Additive; receipts, bons and every existing call behave as before (all goldens unchanged).
|
|
10
|
+
|
|
11
|
+
- **`terminal_unreachable` is "nothing sent":** new list `TERMINAL_UNREACHABLE_CONNECT_CODES` (`./payments`) next to `PREFLIGHT_CONNECT_CODES`. Connect sends the code only when the TCP connection to the terminal never came up (refused, no route, timeout while connecting), before any byte; the HPS client now throws `HpsPreflightError` (`connectCode: 'terminal_unreachable'`) for it on payment, refund and cancel, without abort or status polling. Reason: the till can say "nothing charged, try again" instead of "unclear, check the terminal receipt" when the terminal is simply off or in another network. Older Connect versions never send it; their `terminal_offline` stays `HpsConnectTerminalError` (unclear: the connection may also have dropped after sending), and any unknown code stays unclear (positive list). During clarification (abort, status) the code says nothing about the payment and is treated like any other failed call.
|
|
12
|
+
- **HPS card data on the receipt:** `hobexReceiptFromHps` (terminal response -> `HobexReceipt` with provider `hobexHps`, `cvm` as number, `null` fields as empty text) is now exported from `./payments`; before it was only reachable inside the package, and the browser till used `fromHobexReceiptPayload`, whose fixed provider `hobexCloudApi` dropped `approvalCode`, `cardExpiry`, `cardIssuer`, `amount` and `currency` from `hobexReceiptToCardPaymentData` on every HPS receipt. `fromHobexReceiptPayload(payload, provider?)` takes the provider as an optional second argument (default `hobexCloudApi`, unchanged); its doc points HPS callers to `hobexReceiptFromHps`. The printed bon does not use these fields, so it stays byte for byte the same.
|
|
13
|
+
- **Texts (browser till only):** message `connect.local_network_blocked` (Chrome's "Local network access" denied for the till: the till finds no Connect, and installing does not help; the sentence gives the way to allow it), messages `terminal.several_found` (placeholder `hosts`) and `terminal.tid_not_found` (`hosts`, `tid`) for a terminal search with several hits where no single one confirms the TID of the device.
|
|
14
|
+
- `fixtures/surface.json`, `pos-texts.json`, `invoice-texts.json`, `hobex-hps-codes.json` and `invoice-api.schema.json` regenerated for the version.
|
|
15
|
+
|
|
16
|
+
## 1.32.1 - unveröffentlicht
|
|
17
|
+
|
|
18
|
+
Fix: a deposit payout (a receipt whose amount due is negative because of returned empties) is no longer refused before sending. `sellReceipt`/`createReceipt` accept one negative cash payment when the items contain a `deposit_return` line, with no `tenderedCents` and no `tipCents`, and at most the sum of the return lines. Reason: the server allows this payout (`istLeergutAuszahlung`) but the client check demanded `amountCents > 0` unless the receipt was a voucher payout. Without empties a negative payment is still refused; empties with a positive amount stay an ordinary sale.
|
|
19
|
+
|
|
20
|
+
Fix: an article marked as external voucher with a non-empty deposit list is refused (`article_external_voucher_invalid`, reason `deposit`), like the backend; an empty or missing list stays allowed. Reason: the client check did not know the deposit rule of `pruefeArtikel`.
|
|
21
|
+
|
|
7
22
|
## 1.32.0 - unveröffentlicht
|
|
8
23
|
|
|
9
24
|
Deposit and returnable empties at the till (backend November 2026): the server adds the deposit lines, the till previews them, takes empties back, and the bon prints them. Additive; articles, groups, settings and receipts without the new fields read, send and print exactly as before (all existing goldens unchanged).
|
|
@@ -190,7 +190,14 @@ function createReceiptParams(options) {
|
|
|
190
190
|
// Wie der Server erst nach dem Anhaengen des Trinkgelds: eine Trinkgeldzeile ist keine Gutscheinzeile.
|
|
191
191
|
const nurAuszahlung = (vouchers?.length ?? 0) > 0 && vouchers.every((v) => v.action === index_js_1.VoucherAction.payout)
|
|
192
192
|
&& (items?.length ?? 0) === 0 && options.tip == null;
|
|
193
|
-
|
|
193
|
+
// Leergut-Auszahlung (Server pfand-core istLeergutAuszahlung): Leergut auf dem Beleg und eine negative Zahlung.
|
|
194
|
+
const leergut = (items ?? []).filter(index_js_2.isDepositReturnItem);
|
|
195
|
+
const leergutAuszahlung = leergut.length > 0 && Array.isArray(options.payments)
|
|
196
|
+
&& options.payments.some((z) => typeof z?.amountCents === 'number' && z.amountCents < 0);
|
|
197
|
+
const leergutSummeCents = leergutAuszahlung
|
|
198
|
+
? leergut.reduce((summe, p) => summe + Math.abs((0, index_js_2.receiptItemTotalCents)(p)), 0)
|
|
199
|
+
: undefined;
|
|
200
|
+
params['payments'] = gepruefteZahlungen(options.payments, false, 'createReceipt', nurAuszahlung || leergutAuszahlung, false, leergutSummeCents);
|
|
194
201
|
}
|
|
195
202
|
else if (options.payments != null) {
|
|
196
203
|
throw eingabefehler(`payments sind bei receiptType "${typ.value}" nicht erlaubt.`);
|
|
@@ -881,7 +888,7 @@ const MAX_ZAHLUNGEN = 20;
|
|
|
881
888
|
* (Summe, Anbieter-Pflicht und Trinkgeld prueft der Server). Wirft, bevor
|
|
882
889
|
* etwas hinausgeht.
|
|
883
890
|
*/
|
|
884
|
-
function gepruefteZahlungen(roh, storno, functionName, auszahlung = false, stornoAuszahlung = false) {
|
|
891
|
+
function gepruefteZahlungen(roh, storno, functionName, auszahlung = false, stornoAuszahlung = false, leergutSummeCents) {
|
|
885
892
|
const fehler = (grund) => new errors_js_1.KasseneckValidationError(functionName, grund, 'request');
|
|
886
893
|
if (!Array.isArray(roh))
|
|
887
894
|
throw fehler('payments muss eine Liste sein.');
|
|
@@ -902,6 +909,11 @@ function gepruefteZahlungen(roh, storno, functionName, auszahlung = false, storn
|
|
|
902
909
|
throw fehler('Auszahlung: tenderedCents ist nicht moeglich.');
|
|
903
910
|
if (e['tipCents'] !== undefined)
|
|
904
911
|
throw fehler('Auszahlung: tipCents ist nicht moeglich.');
|
|
912
|
+
// Leergut-Auszahlung: Ware zahlt nie aus, hoechstens die Leergutsumme (der Server prueft ebenso).
|
|
913
|
+
const b = e['amountCents'];
|
|
914
|
+
if (leergutSummeCents !== undefined && typeof b === 'number' && -b > leergutSummeCents) {
|
|
915
|
+
throw fehler('Auszahlung: der Betrag ist hoeher als die Leergutsumme des Belegs.');
|
|
916
|
+
}
|
|
905
917
|
}
|
|
906
918
|
}
|
|
907
919
|
return roh.map((eintrag, i) => {
|
|
@@ -8,10 +8,15 @@ import { CreditCardProvider } from '../enums/index.js';
|
|
|
8
8
|
* bleibt deshalb bewusst Euro (siehe [toHobexReceiptPayload]/
|
|
9
9
|
* [fromHobexReceiptPayload]), intern wird ab hier exakt in Cent gefuehrt.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Zwei Wege hinein, je nach Weg der Zahlung:
|
|
12
|
+
*
|
|
13
|
+
* - **Cloud-API** (`fromJson` im Dart-Vorbild): [fromHobexReceiptPayload].
|
|
14
|
+
* - **HPS-Terminal ueber Kasseneck Connect** (`fromHps` im Dart-Vorbild):
|
|
15
|
+
* `hobexReceiptFromHps` aus `@kreiseck/kasseneck-api/payments` auf die
|
|
16
|
+
* Terminal-Antwort (`HpsPaymentResult.response`). Nur dieser Weg setzt den
|
|
17
|
+
* Anbieter `hobexHps` und damit die HPS-Zusatzfelder in
|
|
18
|
+
* [hobexReceiptToCardPaymentData]; er liest auch `cvm` als Zahl und
|
|
19
|
+
* nicht gefuehrte Felder (`null`) als leeren Text.
|
|
15
20
|
*/
|
|
16
21
|
export interface HobexReceipt {
|
|
17
22
|
transactionId: string;
|
|
@@ -52,7 +57,17 @@ export interface HobexReceiptPayload {
|
|
|
52
57
|
cvm: string | number;
|
|
53
58
|
}
|
|
54
59
|
export declare function toHobexReceiptPayload(receipt: HobexReceipt): HobexReceiptPayload;
|
|
55
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Liest eine Hobex-Nutzlast der **Cloud-API**.
|
|
62
|
+
*
|
|
63
|
+
* Der Anbieter ergibt sich aus dem Weg, nicht aus dem JSON; Vorgabe ist
|
|
64
|
+
* `hobexCloudApi`. Fuer eine Antwort des HPS-Terminals ist der richtige Weg
|
|
65
|
+
* `hobexReceiptFromHps` (`@kreiseck/kasseneck-api/payments`) — wer trotzdem
|
|
66
|
+
* hier hereinkommt, gibt [provider] `CreditCardProvider.hobexHps`
|
|
67
|
+
* mit, sonst fehlen am Beleg Genehmigungsnummer, Ablaufdatum, Kartenausgeber,
|
|
68
|
+
* Betrag und Waehrung (siehe [hobexReceiptToCardPaymentData]).
|
|
69
|
+
*/
|
|
70
|
+
export declare function fromHobexReceiptPayload(payload: HobexReceiptPayload, provider?: CreditCardProvider): HobexReceipt;
|
|
56
71
|
/**
|
|
57
72
|
* Wandelt den Beleg in die `cardPaymentData`-Map, die auf dem Kasseneck-Beleg
|
|
58
73
|
* landet (siehe [Receipt.cardPaymentData]). Bei HPS-Zahlungen kommen weitere
|
|
@@ -27,7 +27,17 @@ function toHobexReceiptPayload(receipt) {
|
|
|
27
27
|
cvm: receipt.cvm,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Liest eine Hobex-Nutzlast der **Cloud-API**.
|
|
32
|
+
*
|
|
33
|
+
* Der Anbieter ergibt sich aus dem Weg, nicht aus dem JSON; Vorgabe ist
|
|
34
|
+
* `hobexCloudApi`. Fuer eine Antwort des HPS-Terminals ist der richtige Weg
|
|
35
|
+
* `hobexReceiptFromHps` (`@kreiseck/kasseneck-api/payments`) — wer trotzdem
|
|
36
|
+
* hier hereinkommt, gibt [provider] `CreditCardProvider.hobexHps`
|
|
37
|
+
* mit, sonst fehlen am Beleg Genehmigungsnummer, Ablaufdatum, Kartenausgeber,
|
|
38
|
+
* Betrag und Waehrung (siehe [hobexReceiptToCardPaymentData]).
|
|
39
|
+
*/
|
|
40
|
+
function fromHobexReceiptPayload(payload, provider = index_js_1.CreditCardProvider.hobexCloudApi) {
|
|
31
41
|
return {
|
|
32
42
|
transactionId: payload.transactionId,
|
|
33
43
|
tid: payload.tid,
|
|
@@ -54,11 +64,12 @@ function fromHobexReceiptPayload(payload) {
|
|
|
54
64
|
amountCents: (0, money_js_1.euroToCents)(payload.amount),
|
|
55
65
|
tipCents: (0, money_js_1.euroToCents)(payload.tip),
|
|
56
66
|
cvm: String(payload.cvm),
|
|
57
|
-
// Die
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
67
|
+
// Die Nutzlast traegt keinen eigenen Provider-Schluessel — der Provider
|
|
68
|
+
// ergibt sich aus dem Transportweg (Cloud vs. HPS), nicht aus dem JSON.
|
|
69
|
+
// Das Dart-Vorbild setzt ihn in `fromJson` deshalb ebenfalls nicht,
|
|
70
|
+
// sondern belaesst den Konstruktor-Default (Cloud); den Weg kennt nur
|
|
71
|
+
// der Aufrufer.
|
|
72
|
+
creditCardProvider: provider,
|
|
62
73
|
};
|
|
63
74
|
}
|
|
64
75
|
/**
|
|
@@ -59,15 +59,17 @@ function createHpsConnectClient(options) {
|
|
|
59
59
|
const message = typeof h.error?.message === 'string' && h.error.message.trim() !== ''
|
|
60
60
|
? h.error.message
|
|
61
61
|
: `Kasseneck Connect meldet einen Fehler (HTTP ${antwort.status})`;
|
|
62
|
-
if (code !== undefined && errors_js_1.PREFLIGHT_CONNECT_CODES.has(code)) {
|
|
62
|
+
if (code !== undefined && (errors_js_1.PREFLIGHT_CONNECT_CODES.has(code) || errors_js_1.TERMINAL_UNREACHABLE_CONNECT_CODES.has(code))) {
|
|
63
63
|
// Siehe errors.ts: diese Codes entstehen laut `kasseneck-connect`
|
|
64
|
-
// ausnahmslos VOR jedem Terminal-Kontakt
|
|
64
|
+
// ausnahmslos VOR jedem Terminal-Kontakt bzw. vor jedem gesendeten Byte
|
|
65
|
+
// (`terminal_unreachable`: keine TCP-Verbindung) -- beweisbar nichts
|
|
66
|
+
// gesendet.
|
|
65
67
|
throw new errors_js_1.HpsPreflightError(message, code);
|
|
66
68
|
}
|
|
67
69
|
// terminal_error / timeout / terminal_offline -- oder ein Code, den
|
|
68
70
|
// dieses Paket nicht kennt. Bewusst dieselbe Klasse fuer beide: ein
|
|
69
71
|
// unbekannter Code ist keine bewiesene Nicht-Aussendung, siehe
|
|
70
|
-
// PREFLIGHT_CONNECT_CODES.
|
|
72
|
+
// PREFLIGHT_CONNECT_CODES und TERMINAL_UNREACHABLE_CONNECT_CODES.
|
|
71
73
|
//
|
|
72
74
|
// `error.detail.terminalHttpStatus` reist seit `kasseneck-connect`
|
|
73
75
|
// Commit `0fb6f66` mit, wenn das TERMINAL selbst einen HTTP-Status
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* - [HpsPreflightError] — es ist NACHWEISLICH nichts gesendet worden. Entweder
|
|
8
8
|
* die Kennung selbst war unbrauchbar (siehe `connect-client.ts`), oder
|
|
9
9
|
* Connect hat die Anfrage VOR dem Terminal-Kontakt abgelehnt (falscher
|
|
10
|
-
* Host, keine Kopplung, ...)
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Host, keine Kopplung, ...), oder die TCP-Verbindung zum Terminal kam gar
|
|
11
|
+
* nicht erst zustande ([TERMINAL_UNREACHABLE_CONNECT_CODES]). Wird von
|
|
12
|
+
* `payments.ts` unveraendert weitergeworfen, niemals in einen Ausgang
|
|
13
|
+
* uebersetzt — Zwilling von Dart's `ArgumentError`-Sonderfall in
|
|
14
|
+
* `HpsPayments.pay()`.
|
|
13
15
|
* - [HpsConnectTerminalError] — die Anfrage GING RAUS (oder der Versuch dazu
|
|
14
16
|
* scheiterte am Transport), aber es kam keine schluessige Antwort. Das
|
|
15
17
|
* umfasst ausdruecklich auch [isTerminalBusy]: HTTP `409` ist die einzige
|
|
@@ -27,7 +29,12 @@ export declare abstract class HpsConnectException extends Error {
|
|
|
27
29
|
/**
|
|
28
30
|
* Nichts ist gesendet worden. `reason` ist deutscher Klartext, `connectCode`
|
|
29
31
|
* gesetzt, wenn die Ablehnung von Connect kam (statt von der lokalen
|
|
30
|
-
* Kennungspruefung)
|
|
32
|
+
* Kennungspruefung) — ein Code aus [PREFLIGHT_CONNECT_CODES] oder aus
|
|
33
|
+
* [TERMINAL_UNREACHABLE_CONNECT_CODES].
|
|
34
|
+
*
|
|
35
|
+
* Fuer die Kasse heisst das: sicher nichts belastet, ein neuer Versuch ist
|
|
36
|
+
* gefahrlos. Bei `terminal_unreachable` liegt die Ursache am Terminal (aus,
|
|
37
|
+
* anderes Netz, falsche IP), bei den anderen Codes an Connect oder der Kopplung.
|
|
31
38
|
*/
|
|
32
39
|
export declare class HpsPreflightError extends HpsConnectException {
|
|
33
40
|
readonly name: string;
|
|
@@ -61,11 +68,31 @@ export declare class HpsTransactionIdError extends HpsPreflightError {
|
|
|
61
68
|
* einen Fehlercode erweitert wird, der doch am Terminal entsteht.
|
|
62
69
|
*/
|
|
63
70
|
export declare const PREFLIGHT_CONNECT_CODES: ReadonlySet<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Connect-Fehlercodes, die AM Weg zum Terminal entstehen, aber beweisbar vor
|
|
73
|
+
* jedem gesendeten Byte: Connect hat die TCP-Verbindung zum Terminal
|
|
74
|
+
* versucht, und sie kam nicht zustande (Verbindung abgelehnt, keine Route zum
|
|
75
|
+
* Host, Zeitablauf beim Verbindungsaufbau). Ohne Verbindung kein Request —
|
|
76
|
+
* am Terminal ist nichts angekommen, also auch nichts belastet.
|
|
77
|
+
*
|
|
78
|
+
* Getrennt von [PREFLIGHT_CONNECT_CODES], weil die Ursache eine andere ist:
|
|
79
|
+
* dort lehnt Connect die Anfrage ab, ohne das Terminal ueberhaupt zu
|
|
80
|
+
* versuchen; hier hat Connect es versucht, und das Terminal war nicht da. Fuer
|
|
81
|
+
* den Ausgang zaehlt beides gleich ([HpsPreflightError]).
|
|
82
|
+
*
|
|
83
|
+
* Nur Connect-Fassungen ab der Einfuehrung von `terminal_unreachable` senden
|
|
84
|
+
* den Code. Aeltere melden jeden Netzfehler zum Terminal als
|
|
85
|
+
* `terminal_offline` — und der bleibt unklar: dort kann die Verbindung auch
|
|
86
|
+
* NACH dem Senden gerissen sein. Wie bei [PREFLIGHT_CONNECT_CODES] gilt die
|
|
87
|
+
* Positivliste: was hier nicht steht, ist [HpsConnectTerminalError].
|
|
88
|
+
*/
|
|
89
|
+
export declare const TERMINAL_UNREACHABLE_CONNECT_CODES: ReadonlySet<string>;
|
|
64
90
|
/**
|
|
65
91
|
* Die Anfrage ging (oder der Versuch dazu) in Richtung Terminal, aber es kam
|
|
66
92
|
* keine schluessige Antwort — Connect meldete `terminal_error`, `timeout`
|
|
67
93
|
* oder `terminal_offline` (`kasseneck-connect/lib/src/terminal/hps.dart`),
|
|
68
|
-
* oder einen Fehlercode, den dieses Paket nicht kennt.
|
|
94
|
+
* oder einen Fehlercode, den dieses Paket nicht kennt. `terminal_unreachable`
|
|
95
|
+
* gehoert NICHT hierher (beweisbar nichts gesendet, [HpsPreflightError]).
|
|
69
96
|
*/
|
|
70
97
|
export declare class HpsConnectTerminalError extends HpsConnectException {
|
|
71
98
|
readonly name = "HpsConnectTerminalError";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HpsClarifyTimeoutError = exports.HpsConnectTransportError = exports.HpsConnectTerminalError = exports.PREFLIGHT_CONNECT_CODES = exports.HpsTransactionIdError = exports.HpsPreflightError = exports.HpsConnectException = void 0;
|
|
3
|
+
exports.HpsClarifyTimeoutError = exports.HpsConnectTransportError = exports.HpsConnectTerminalError = exports.TERMINAL_UNREACHABLE_CONNECT_CODES = exports.PREFLIGHT_CONNECT_CODES = exports.HpsTransactionIdError = exports.HpsPreflightError = exports.HpsConnectException = void 0;
|
|
4
4
|
const transaction_response_js_1 = require("./transaction-response.js");
|
|
5
5
|
/**
|
|
6
6
|
* Fehlerarten auf dem Weg ueber **Kasseneck Connect** zum hobex-HPS-Terminal.
|
|
@@ -11,9 +11,11 @@ const transaction_response_js_1 = require("./transaction-response.js");
|
|
|
11
11
|
* - [HpsPreflightError] — es ist NACHWEISLICH nichts gesendet worden. Entweder
|
|
12
12
|
* die Kennung selbst war unbrauchbar (siehe `connect-client.ts`), oder
|
|
13
13
|
* Connect hat die Anfrage VOR dem Terminal-Kontakt abgelehnt (falscher
|
|
14
|
-
* Host, keine Kopplung, ...)
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Host, keine Kopplung, ...), oder die TCP-Verbindung zum Terminal kam gar
|
|
15
|
+
* nicht erst zustande ([TERMINAL_UNREACHABLE_CONNECT_CODES]). Wird von
|
|
16
|
+
* `payments.ts` unveraendert weitergeworfen, niemals in einen Ausgang
|
|
17
|
+
* uebersetzt — Zwilling von Dart's `ArgumentError`-Sonderfall in
|
|
18
|
+
* `HpsPayments.pay()`.
|
|
17
19
|
* - [HpsConnectTerminalError] — die Anfrage GING RAUS (oder der Versuch dazu
|
|
18
20
|
* scheiterte am Transport), aber es kam keine schluessige Antwort. Das
|
|
19
21
|
* umfasst ausdruecklich auch [isTerminalBusy]: HTTP `409` ist die einzige
|
|
@@ -32,7 +34,12 @@ exports.HpsConnectException = HpsConnectException;
|
|
|
32
34
|
/**
|
|
33
35
|
* Nichts ist gesendet worden. `reason` ist deutscher Klartext, `connectCode`
|
|
34
36
|
* gesetzt, wenn die Ablehnung von Connect kam (statt von der lokalen
|
|
35
|
-
* Kennungspruefung)
|
|
37
|
+
* Kennungspruefung) — ein Code aus [PREFLIGHT_CONNECT_CODES] oder aus
|
|
38
|
+
* [TERMINAL_UNREACHABLE_CONNECT_CODES].
|
|
39
|
+
*
|
|
40
|
+
* Fuer die Kasse heisst das: sicher nichts belastet, ein neuer Versuch ist
|
|
41
|
+
* gefahrlos. Bei `terminal_unreachable` liegt die Ursache am Terminal (aus,
|
|
42
|
+
* anderes Netz, falsche IP), bei den anderen Codes an Connect oder der Kopplung.
|
|
36
43
|
*/
|
|
37
44
|
class HpsPreflightError extends HpsConnectException {
|
|
38
45
|
name = 'HpsPreflightError';
|
|
@@ -81,11 +88,33 @@ exports.PREFLIGHT_CONNECT_CODES = new Set([
|
|
|
81
88
|
'not_found',
|
|
82
89
|
'body_too_large',
|
|
83
90
|
]);
|
|
91
|
+
/**
|
|
92
|
+
* Connect-Fehlercodes, die AM Weg zum Terminal entstehen, aber beweisbar vor
|
|
93
|
+
* jedem gesendeten Byte: Connect hat die TCP-Verbindung zum Terminal
|
|
94
|
+
* versucht, und sie kam nicht zustande (Verbindung abgelehnt, keine Route zum
|
|
95
|
+
* Host, Zeitablauf beim Verbindungsaufbau). Ohne Verbindung kein Request —
|
|
96
|
+
* am Terminal ist nichts angekommen, also auch nichts belastet.
|
|
97
|
+
*
|
|
98
|
+
* Getrennt von [PREFLIGHT_CONNECT_CODES], weil die Ursache eine andere ist:
|
|
99
|
+
* dort lehnt Connect die Anfrage ab, ohne das Terminal ueberhaupt zu
|
|
100
|
+
* versuchen; hier hat Connect es versucht, und das Terminal war nicht da. Fuer
|
|
101
|
+
* den Ausgang zaehlt beides gleich ([HpsPreflightError]).
|
|
102
|
+
*
|
|
103
|
+
* Nur Connect-Fassungen ab der Einfuehrung von `terminal_unreachable` senden
|
|
104
|
+
* den Code. Aeltere melden jeden Netzfehler zum Terminal als
|
|
105
|
+
* `terminal_offline` — und der bleibt unklar: dort kann die Verbindung auch
|
|
106
|
+
* NACH dem Senden gerissen sein. Wie bei [PREFLIGHT_CONNECT_CODES] gilt die
|
|
107
|
+
* Positivliste: was hier nicht steht, ist [HpsConnectTerminalError].
|
|
108
|
+
*/
|
|
109
|
+
exports.TERMINAL_UNREACHABLE_CONNECT_CODES = new Set([
|
|
110
|
+
'terminal_unreachable',
|
|
111
|
+
]);
|
|
84
112
|
/**
|
|
85
113
|
* Die Anfrage ging (oder der Versuch dazu) in Richtung Terminal, aber es kam
|
|
86
114
|
* keine schluessige Antwort — Connect meldete `terminal_error`, `timeout`
|
|
87
115
|
* oder `terminal_offline` (`kasseneck-connect/lib/src/terminal/hps.dart`),
|
|
88
|
-
* oder einen Fehlercode, den dieses Paket nicht kennt.
|
|
116
|
+
* oder einen Fehlercode, den dieses Paket nicht kennt. `terminal_unreachable`
|
|
117
|
+
* gehoert NICHT hierher (beweisbar nichts gesendet, [HpsPreflightError]).
|
|
89
118
|
*/
|
|
90
119
|
class HpsConnectTerminalError extends HpsConnectException {
|
|
91
120
|
name = 'HpsConnectTerminalError';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* des Aufrufers.
|
|
19
19
|
*/
|
|
20
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';
|
|
21
|
-
export { HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, } from './errors.js';
|
|
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';
|
|
24
24
|
export { type HpsCancelOptions, type HpsPaymentOptions, type HpsPayments, type HpsPaymentsOptions, type HpsRefundOptions, createHpsPayments, } from './payments.js';
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* des Aufrufers.
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
23
|
-
exports.hobexReceiptFromHps = exports.parseHpsTransactionResponse = exports.isUnknownCode = exports.isTechnicalError = exports.normalizeHpsCode = exports.needsReversal = exports.isNotAbortable = exports.isNoStatement = exports.isInProgress = exports.isConclusiveAsStatus = exports.isConclusive = exports.isCanceled = exports.isApproved = exports.TRANSACTION_CANCELED_CODE = exports.TERMINAL_BUSY_HTTP_STATUS = exports.NOT_FOUND_HTTP_STATUS = exports.TECHNICAL_ERROR_CODE = exports.NO_STATEMENT_CODE = exports.WRONG_PIN_CODE = exports.INVALID_TID_CODE = exports.AMOUNT_OUT_OF_RANGE_CODE = exports.INVALID_AMOUNT_CODE = exports.NOT_ABORTABLE_CODE = exports.INVALID_TRANSACTION_CODE = exports.isHostUncertainReason = void 0;
|
|
22
|
+
exports.hpsCodeReason = exports.hpsCodeInfo = exports.UNSUPPORTED_USER_DATA_CODE = exports.TIP_SELECTION_FAILED_CODE = exports.TERMINAL_BUSY_CODE = exports.TERMINAL_BLOCKED_CODE = exports.SCEP_ENROLLMENT_FAILED_CODE = exports.REFUND_PASSWORD_INVALID_CODE = exports.REFUND_DISABLED_CODE = exports.PASSWORD_NOT_ENTERED_CODE = exports.NOT_FOUND_CODE = exports.MAX_RETRIES_EXCEEDED_CODE = exports.INVALID_TX_TYPE_CODE = exports.INVALID_TID_DOCUMENTED_CODE = exports.INVALID_MESSAGE_TYPE_CODE = exports.INTERNAL_ERROR_CODE = exports.HPS_REASON_HINTS = exports.HPS_MEASURED_CODES = exports.HPS_CODES = exports.HOST_TIMEOUT_REVERSED_CODE = exports.HOST_STEP_FAILED_CODE = exports.HOST_COMMUNICATION_FAILED_CODE = exports.DIAGNOSIS_FAILED_CODE = exports.COMPLETION_FAILED_CODE = exports.CHIP_DATA_MISMATCH_CODE = exports.CARD_READ_FAILED_CODE = exports.CARD_NOT_SUPPORTED_CODE = exports.CARD_NOT_PRESENT_CODE = exports.CARD_INFO_NOT_ENTERED_CODE = exports.CARD_DECLINED_CODE = exports.BAD_REQUEST_CODE = exports.APPROVED_CODE = exports.APP_SELECT_FAILED_CODE = exports.ABORTED_CODE = exports.newHpsTransactionId = exports.isValidHpsTransactionId = exports.createHpsTransactionIdGenerator = exports.MAX_TRANSACTION_ID_LENGTH = exports.createHpsPayments = exports.mayRetrySafely = exports.isHostUncertainResult = exports.TERMINAL_UNREACHABLE_CONNECT_CODES = exports.PREFLIGHT_CONNECT_CODES = exports.HpsTransactionIdError = exports.HpsPreflightError = exports.HpsConnectTransportError = exports.HpsConnectTerminalError = exports.HpsConnectException = exports.HpsClarifyTimeoutError = exports.createHpsConnectClient = void 0;
|
|
23
|
+
exports.hobexReceiptFromHps = exports.parseHpsTransactionResponse = exports.isUnknownCode = exports.isTechnicalError = exports.normalizeHpsCode = exports.needsReversal = exports.isNotAbortable = exports.isNoStatement = exports.isInProgress = exports.isConclusiveAsStatus = exports.isConclusive = exports.isCanceled = exports.isApproved = exports.TRANSACTION_CANCELED_CODE = exports.TERMINAL_BUSY_HTTP_STATUS = exports.NOT_FOUND_HTTP_STATUS = exports.TECHNICAL_ERROR_CODE = exports.NO_STATEMENT_CODE = exports.WRONG_PIN_CODE = exports.INVALID_TID_CODE = exports.AMOUNT_OUT_OF_RANGE_CODE = exports.INVALID_AMOUNT_CODE = exports.NOT_ABORTABLE_CODE = exports.INVALID_TRANSACTION_CODE = exports.isHostUncertainReason = exports.isHostUncertain = void 0;
|
|
24
24
|
var connect_client_js_1 = require("./connect-client.js");
|
|
25
25
|
Object.defineProperty(exports, "createHpsConnectClient", { enumerable: true, get: function () { return connect_client_js_1.createHpsConnectClient; } });
|
|
26
26
|
var errors_js_1 = require("./errors.js");
|
|
@@ -31,6 +31,7 @@ Object.defineProperty(exports, "HpsConnectTransportError", { enumerable: true, g
|
|
|
31
31
|
Object.defineProperty(exports, "HpsPreflightError", { enumerable: true, get: function () { return errors_js_1.HpsPreflightError; } });
|
|
32
32
|
Object.defineProperty(exports, "HpsTransactionIdError", { enumerable: true, get: function () { return errors_js_1.HpsTransactionIdError; } });
|
|
33
33
|
Object.defineProperty(exports, "PREFLIGHT_CONNECT_CODES", { enumerable: true, get: function () { return errors_js_1.PREFLIGHT_CONNECT_CODES; } });
|
|
34
|
+
Object.defineProperty(exports, "TERMINAL_UNREACHABLE_CONNECT_CODES", { enumerable: true, get: function () { return errors_js_1.TERMINAL_UNREACHABLE_CONNECT_CODES; } });
|
|
34
35
|
var outcome_js_1 = require("./outcome.js");
|
|
35
36
|
Object.defineProperty(exports, "isHostUncertainResult", { enumerable: true, get: function () { return outcome_js_1.isHostUncertainResult; } });
|
|
36
37
|
Object.defineProperty(exports, "mayRetrySafely", { enumerable: true, get: function () { return outcome_js_1.mayRetrySafely; } });
|
|
@@ -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 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, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, 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, 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 HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, type HpsCancelOptions, 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, 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';
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* nichts zu entscheiden.
|
|
43
43
|
*/
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.TRANSACTION_CANCELED_CODE = exports.TERMINAL_BUSY_HTTP_STATUS = exports.NOT_FOUND_HTTP_STATUS = exports.TECHNICAL_ERROR_CODE = exports.PREFLIGHT_CONNECT_CODES = exports.parseHpsTransactionResponse = exports.NO_STATEMENT_CODE = exports.NOT_ABORTABLE_CODE = exports.newHpsTransactionId = exports.MAX_TRANSACTION_ID_LENGTH = exports.mayRetrySafely = exports.isValidHpsTransactionId = exports.isUnknownCode = exports.isTechnicalError = exports.isNotAbortable = exports.isNoStatement = exports.isInProgress = exports.isHostUncertainResult = exports.isHostUncertain = exports.isConclusiveAsStatus = exports.isConclusive = exports.isApproved = exports.INVALID_TRANSACTION_CODE = exports.HpsTransactionIdError = exports.HpsPreflightError = exports.HpsConnectTransportError = exports.HpsConnectTerminalError = exports.HpsConnectException = exports.HpsClarifyTimeoutError = exports.hpsCodeReason = exports.hpsCodeInfo = exports.HPS_REASON_HINTS = exports.HPS_MEASURED_CODES = exports.HPS_CODES = exports.createHpsTransactionIdGenerator = exports.createHpsPayments = exports.createHpsConnectClient = exports.CARD_NOT_PRESENT_CODE = exports.APPROVED_CODE = exports.ABORTED_CODE = exports.newHobexTransactionId = exports.hobexRefund = exports.hobexPay = exports.stripeCaptureIntent = exports.createStripeLink = exports.StripeLinkMode = void 0;
|
|
45
|
+
exports.TRANSACTION_CANCELED_CODE = exports.TERMINAL_BUSY_HTTP_STATUS = exports.NOT_FOUND_HTTP_STATUS = exports.TECHNICAL_ERROR_CODE = exports.TERMINAL_UNREACHABLE_CONNECT_CODES = exports.PREFLIGHT_CONNECT_CODES = exports.parseHpsTransactionResponse = exports.NO_STATEMENT_CODE = exports.NOT_ABORTABLE_CODE = exports.newHpsTransactionId = exports.MAX_TRANSACTION_ID_LENGTH = exports.mayRetrySafely = exports.isValidHpsTransactionId = exports.isUnknownCode = exports.isTechnicalError = exports.isNotAbortable = exports.isNoStatement = exports.isInProgress = exports.isHostUncertainResult = exports.isHostUncertain = exports.isConclusiveAsStatus = exports.isConclusive = exports.isApproved = exports.INVALID_TRANSACTION_CODE = exports.HpsTransactionIdError = exports.HpsPreflightError = exports.HpsConnectTransportError = exports.HpsConnectTerminalError = exports.HpsConnectException = exports.HpsClarifyTimeoutError = exports.hobexReceiptFromHps = exports.hpsCodeReason = exports.hpsCodeInfo = exports.HPS_REASON_HINTS = exports.HPS_MEASURED_CODES = exports.HPS_CODES = exports.createHpsTransactionIdGenerator = exports.createHpsPayments = exports.createHpsConnectClient = exports.CARD_NOT_PRESENT_CODE = exports.APPROVED_CODE = exports.ABORTED_CODE = exports.newHobexTransactionId = exports.hobexRefund = exports.hobexPay = exports.stripeCaptureIntent = exports.createStripeLink = exports.StripeLinkMode = void 0;
|
|
46
46
|
var index_js_1 = require("../enums/index.js");
|
|
47
47
|
Object.defineProperty(exports, "StripeLinkMode", { enumerable: true, get: function () { return index_js_1.StripeLinkMode; } });
|
|
48
48
|
var stripe_js_1 = require("./stripe.js");
|
|
@@ -64,6 +64,7 @@ Object.defineProperty(exports, "HPS_MEASURED_CODES", { enumerable: true, get: fu
|
|
|
64
64
|
Object.defineProperty(exports, "HPS_REASON_HINTS", { enumerable: true, get: function () { return index_js_2.HPS_REASON_HINTS; } });
|
|
65
65
|
Object.defineProperty(exports, "hpsCodeInfo", { enumerable: true, get: function () { return index_js_2.hpsCodeInfo; } });
|
|
66
66
|
Object.defineProperty(exports, "hpsCodeReason", { enumerable: true, get: function () { return index_js_2.hpsCodeReason; } });
|
|
67
|
+
Object.defineProperty(exports, "hobexReceiptFromHps", { enumerable: true, get: function () { return index_js_2.hobexReceiptFromHps; } });
|
|
67
68
|
Object.defineProperty(exports, "HpsClarifyTimeoutError", { enumerable: true, get: function () { return index_js_2.HpsClarifyTimeoutError; } });
|
|
68
69
|
Object.defineProperty(exports, "HpsConnectException", { enumerable: true, get: function () { return index_js_2.HpsConnectException; } });
|
|
69
70
|
Object.defineProperty(exports, "HpsConnectTerminalError", { enumerable: true, get: function () { return index_js_2.HpsConnectTerminalError; } });
|
|
@@ -89,6 +90,7 @@ Object.defineProperty(exports, "NOT_ABORTABLE_CODE", { enumerable: true, get: fu
|
|
|
89
90
|
Object.defineProperty(exports, "NO_STATEMENT_CODE", { enumerable: true, get: function () { return index_js_2.NO_STATEMENT_CODE; } });
|
|
90
91
|
Object.defineProperty(exports, "parseHpsTransactionResponse", { enumerable: true, get: function () { return index_js_2.parseHpsTransactionResponse; } });
|
|
91
92
|
Object.defineProperty(exports, "PREFLIGHT_CONNECT_CODES", { enumerable: true, get: function () { return index_js_2.PREFLIGHT_CONNECT_CODES; } });
|
|
93
|
+
Object.defineProperty(exports, "TERMINAL_UNREACHABLE_CONNECT_CODES", { enumerable: true, get: function () { return index_js_2.TERMINAL_UNREACHABLE_CONNECT_CODES; } });
|
|
92
94
|
Object.defineProperty(exports, "TECHNICAL_ERROR_CODE", { enumerable: true, get: function () { return index_js_2.TECHNICAL_ERROR_CODE; } });
|
|
93
95
|
Object.defineProperty(exports, "NOT_FOUND_HTTP_STATUS", { enumerable: true, get: function () { return index_js_2.NOT_FOUND_HTTP_STATUS; } });
|
|
94
96
|
Object.defineProperty(exports, "TERMINAL_BUSY_HTTP_STATUS", { enumerable: true, get: function () { return index_js_2.TERMINAL_BUSY_HTTP_STATUS; } });
|
|
@@ -17,7 +17,7 @@ export declare const ARTICLE_EXTERNAL_VOUCHER_TYPES: readonly ArticleExternalVou
|
|
|
17
17
|
/** Fehlercode beim Speichern eines Artikels, intern und unter `/v3` gleich. */
|
|
18
18
|
export declare const ARTICLE_EXTERNAL_VOUCHER_INVALID = "article_external_voucher_invalid";
|
|
19
19
|
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
20
|
-
export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "rate_required", "invalid_rate", "price_required"];
|
|
20
|
+
export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "deposit", "rate_required", "invalid_rate", "price_required"];
|
|
21
21
|
export type ExternalVoucherArticleReason = typeof EXTERNAL_VOUCHER_ARTICLE_REASONS[number];
|
|
22
22
|
/**
|
|
23
23
|
* Ein Artikel im Editor (`/v3`-Form), soweit die Regeln ihn lesen. Bewusst
|
|
@@ -30,6 +30,7 @@ export interface ExternalVoucherArticleInput {
|
|
|
30
30
|
askPrice?: boolean | null;
|
|
31
31
|
serviceVoucher?: boolean | null;
|
|
32
32
|
addOns?: readonly unknown[] | null;
|
|
33
|
+
deposits?: readonly unknown[] | null;
|
|
33
34
|
stockTracked?: boolean | null;
|
|
34
35
|
reference?: unknown;
|
|
35
36
|
askQuantity?: boolean | null;
|
|
@@ -49,7 +50,7 @@ export declare function checkExternalVoucherValue(value: unknown): ExternalVouch
|
|
|
49
50
|
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
50
51
|
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
51
52
|
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
52
|
-
* Referenz oder
|
|
53
|
+
* Referenz, Mengenabfrage oder Pfand (die Kasse fragt die Nummer selbst und bucht
|
|
53
54
|
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
54
55
|
*/
|
|
55
56
|
export declare function checkExternalVoucherArticle(a: ExternalVoucherArticleInput): ExternalVoucherArticleReason | null;
|
|
@@ -10,7 +10,7 @@ exports.ARTICLE_EXTERNAL_VOUCHER_TYPES = Object.freeze(['multi_purpose', 'single
|
|
|
10
10
|
exports.ARTICLE_EXTERNAL_VOUCHER_INVALID = 'article_external_voucher_invalid';
|
|
11
11
|
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
12
12
|
exports.EXTERNAL_VOUCHER_ARTICLE_REASONS = Object.freeze([
|
|
13
|
-
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'rate_required', 'invalid_rate', 'price_required',
|
|
13
|
+
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'deposit', 'rate_required', 'invalid_rate', 'price_required',
|
|
14
14
|
]);
|
|
15
15
|
/**
|
|
16
16
|
* Saetze, mit denen ein Einzweckgutschein verkauft werden kann (Prozent wie
|
|
@@ -31,7 +31,7 @@ function checkExternalVoucherValue(value) {
|
|
|
31
31
|
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
32
32
|
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
33
33
|
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
34
|
-
* Referenz oder
|
|
34
|
+
* Referenz, Mengenabfrage oder Pfand (die Kasse fragt die Nummer selbst und bucht
|
|
35
35
|
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
36
36
|
*/
|
|
37
37
|
function checkExternalVoucherArticle(a) {
|
|
@@ -49,6 +49,8 @@ function checkExternalVoucherArticle(a) {
|
|
|
49
49
|
return 'reference';
|
|
50
50
|
if (a.askQuantity === true)
|
|
51
51
|
return 'asks_quantity';
|
|
52
|
+
if (Array.isArray(a.deposits) && a.deposits.length > 0)
|
|
53
|
+
return 'deposit';
|
|
52
54
|
if (a.externalVoucher === 'single_purpose' && !(typeof a.vatRate === 'number' && Number.isFinite(a.vatRate)))
|
|
53
55
|
return 'rate_required';
|
|
54
56
|
if (a.externalVoucher === 'single_purpose' && !exports.ARTICLE_EXTERNAL_VOUCHER_VAT_RATES.includes(a.vatRate))
|
package/dist/cjs/pos/texte.d.ts
CHANGED
|
@@ -250,6 +250,16 @@ declare const MELDUNGEN_ROH: {
|
|
|
250
250
|
readonly placeholders: readonly ["response"];
|
|
251
251
|
readonly only: readonly ["web"];
|
|
252
252
|
};
|
|
253
|
+
readonly 'terminal.several_found': {
|
|
254
|
+
readonly text: "Mehrere Terminals gefunden: {hosts}. Die IP-Adresse des richtigen von Hand eintragen.";
|
|
255
|
+
readonly placeholders: readonly ["hosts"];
|
|
256
|
+
readonly only: readonly ["web"];
|
|
257
|
+
};
|
|
258
|
+
readonly 'terminal.tid_not_found': {
|
|
259
|
+
readonly text: "Mehrere Terminals gefunden: {hosts}. Keines meldet die TID {tid} – TID prüfen oder die IP-Adresse von Hand eintragen.";
|
|
260
|
+
readonly placeholders: readonly ["hosts", "tid"];
|
|
261
|
+
readonly only: readonly ["web"];
|
|
262
|
+
};
|
|
253
263
|
readonly 'gptom.app_missing': {
|
|
254
264
|
readonly text: "Die GP-Tom-App ist auf diesem Gerät nicht da.";
|
|
255
265
|
readonly only: readonly ["app"];
|
|
@@ -495,6 +505,9 @@ declare const MELDUNGEN_ROH: {
|
|
|
495
505
|
readonly 'external_voucher_article.asks_quantity': {
|
|
496
506
|
readonly text: "Ein fremder Gutschein fragt keine Menge ab.";
|
|
497
507
|
};
|
|
508
|
+
readonly 'external_voucher_article.deposit': {
|
|
509
|
+
readonly text: "Ein fremder Gutschein hat kein Pfand.";
|
|
510
|
+
};
|
|
498
511
|
readonly 'external_voucher_article.rate_required': {
|
|
499
512
|
readonly text: "Ein Einzweckgutschein braucht den Steuersatz, mit dem er verkauft wird.";
|
|
500
513
|
};
|
|
@@ -780,6 +793,10 @@ declare const MELDUNGEN_ROH: {
|
|
|
780
793
|
readonly text: "Kasseneck Connect nicht gefunden – bitte installieren.";
|
|
781
794
|
readonly only: readonly ["web"];
|
|
782
795
|
};
|
|
796
|
+
readonly 'connect.local_network_blocked': {
|
|
797
|
+
readonly text: "Der Browser sperrt den Zugang zu Kasseneck Connect. Freigeben: Schloss neben der Adresse (installierte App: Menü ⋮ → App-Info) → Website-Einstellungen → „Lokales Netzwerk“ → „Zulassen“.";
|
|
798
|
+
readonly only: readonly ["web"];
|
|
799
|
+
};
|
|
783
800
|
readonly 'connect.unpair_question': {
|
|
784
801
|
readonly text: "Diesen Browser wirklich von Connect trennen? Der Bondruck geht dann nicht mehr.";
|
|
785
802
|
readonly only: readonly ["web"];
|
|
@@ -1318,6 +1335,7 @@ export declare const EXTERNAL_VOUCHER_ARTICLE_MESSAGES: {
|
|
|
1318
1335
|
readonly stock_tracked: "external_voucher_article.stock_tracked";
|
|
1319
1336
|
readonly reference: "external_voucher_article.reference";
|
|
1320
1337
|
readonly asks_quantity: "external_voucher_article.asks_quantity";
|
|
1338
|
+
readonly deposit: "external_voucher_article.deposit";
|
|
1321
1339
|
readonly rate_required: "external_voucher_article.rate_required";
|
|
1322
1340
|
readonly invalid_rate: "external_voucher_article.invalid_rate";
|
|
1323
1341
|
readonly price_required: "external_voucher_article.price_required";
|
package/dist/cjs/pos/texte.js
CHANGED
|
@@ -150,6 +150,10 @@ const MELDUNGEN_ROH = {
|
|
|
150
150
|
'card_payment.unpair_card_charged': { text: 'Auf diesem Gerät liegt noch eine gebuchte Kartenzahlung ohne Beleg – sie muss von Hand am Terminal zurückerstattet werden (Betrag siehe unten).' },
|
|
151
151
|
'terminal.none_found': { text: 'Kein Hobex-Terminal gefunden – ist es eingeschaltet und im selben Netz wie dieser Rechner?', only: ['web'] },
|
|
152
152
|
'terminal.not_ready': { text: 'Terminal antwortet, ist aber nicht betriebsbereit: {response} – TID prüfen.', placeholders: ['response'], only: ['web'] },
|
|
153
|
+
// Terminal-Suche mit mehreren Treffern (1.33.0): uebernommen wird nur ein Treffer, an dem die
|
|
154
|
+
// Diagnose die TID dieses Geraets bestaetigt -- sonst nennt die Kasse die Adressen und setzt keine.
|
|
155
|
+
'terminal.several_found': { text: 'Mehrere Terminals gefunden: {hosts}. Die IP-Adresse des richtigen von Hand eintragen.', placeholders: ['hosts'], only: ['web'] },
|
|
156
|
+
'terminal.tid_not_found': { text: 'Mehrere Terminals gefunden: {hosts}. Keines meldet die TID {tid} – TID prüfen oder die IP-Adresse von Hand eintragen.', placeholders: ['hosts', 'tid'], only: ['web'] },
|
|
153
157
|
'gptom.app_missing': { text: 'Die GP-Tom-App ist auf diesem Gerät nicht da.', only: ['app'] },
|
|
154
158
|
'gptom.search_failed': { text: 'GP Tom: Suche nach der App fehlgeschlagen: {reason}', placeholders: ['reason'], only: ['app'] },
|
|
155
159
|
'gptom.payment_failed': { text: 'GP Tom: Zahlung fehlgeschlagen: {reason}', placeholders: ['reason'], only: ['app'] },
|
|
@@ -266,6 +270,7 @@ const MELDUNGEN_ROH = {
|
|
|
266
270
|
'external_voucher_article.stock_tracked': { text: 'Ein fremder Gutschein führt keinen Lagerbestand.' },
|
|
267
271
|
'external_voucher_article.reference': { text: 'Ein fremder Gutschein fragt keine Referenz ab, die Kasse fragt die Gutscheinnummer.' },
|
|
268
272
|
'external_voucher_article.asks_quantity': { text: 'Ein fremder Gutschein fragt keine Menge ab.' },
|
|
273
|
+
'external_voucher_article.deposit': { text: 'Ein fremder Gutschein hat kein Pfand.' },
|
|
269
274
|
'external_voucher_article.rate_required': { text: 'Ein Einzweckgutschein braucht den Steuersatz, mit dem er verkauft wird.' },
|
|
270
275
|
'external_voucher_article.invalid_rate': { text: 'Ein Einzweckgutschein braucht einen Steuersatz der Kasse: 20, 13, 10, 4,9, 0 oder 19 %.' },
|
|
271
276
|
'external_voucher_article.price_required': { text: 'Ein fremder Gutschein braucht einen Preis oder „Betrag beim Antippen eingeben“.' },
|
|
@@ -395,6 +400,9 @@ const MELDUNGEN_ROH = {
|
|
|
395
400
|
'connect.printer_unknown': { text: 'Diesen Drucker kennt Kasseneck Connect nicht (mehr) – bitte neu suchen.', only: ['web'] },
|
|
396
401
|
'connect.origin_not_allowed': { text: 'Kasseneck Connect nimmt von dieser Adresse nichts an (Ursprung nicht freigegeben).', only: ['web'] },
|
|
397
402
|
'connect.not_installed': { text: 'Kasseneck Connect nicht gefunden – bitte installieren.', only: ['web'] },
|
|
403
|
+
// Chrome fragt ab 142 vor dem Zugriff einer https-Seite auf 127.0.0.1 nach („Lokales Netzwerk“).
|
|
404
|
+
// Ist das gesperrt, findet die Kasse Connect nicht -- installieren hilft dann nicht (1.33.0).
|
|
405
|
+
'connect.local_network_blocked': { text: 'Der Browser sperrt den Zugang zu Kasseneck Connect. Freigeben: Schloss neben der Adresse (installierte App: Menü ⋮ → App-Info) → Website-Einstellungen → „Lokales Netzwerk“ → „Zulassen“.', only: ['web'] },
|
|
398
406
|
'connect.unpair_question': { text: 'Diesen Browser wirklich von Connect trennen? Der Bondruck geht dann nicht mehr.', only: ['web'] },
|
|
399
407
|
// --- Einstellungen -------------------------------------------------------
|
|
400
408
|
'settings.load_failed': { text: 'Die Einstellungen konnten nicht geladen werden.' },
|
|
@@ -752,6 +760,7 @@ exports.EXTERNAL_VOUCHER_ARTICLE_MESSAGES = {
|
|
|
752
760
|
stock_tracked: 'external_voucher_article.stock_tracked',
|
|
753
761
|
reference: 'external_voucher_article.reference',
|
|
754
762
|
asks_quantity: 'external_voucher_article.asks_quantity',
|
|
763
|
+
deposit: 'external_voucher_article.deposit',
|
|
755
764
|
rate_required: 'external_voucher_article.rate_required',
|
|
756
765
|
invalid_rate: 'external_voucher_article.invalid_rate',
|
|
757
766
|
price_required: 'external_voucher_article.price_required',
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReceiptType, KeckPaymentMethod, CreditCardProvider, VoucherAction, VoucherType, } from '../enums/index.js';
|
|
2
2
|
import { istWertVerkauf } from '../models/voucher.js';
|
|
3
|
-
import { fromReceiptCompanyPayload, fromReceiptPayload, toReceiptItemPayload, toVoucherPayload, receiptItemIsValid, voucherIsValid, isNewFormVoucher, voucherServerFields, fromReceiptSummaryPayload, isCancellationReason, isReturnDisposition, RETURN_DISPOSITIONS, isTipRefundSource, TIP_REFUND_SOURCES, RECEIPT_EMAIL_VIAS, readRegistrationInfo, } from '../models/index.js';
|
|
3
|
+
import { fromReceiptCompanyPayload, fromReceiptPayload, toReceiptItemPayload, isDepositReturnItem, receiptItemTotalCents, toVoucherPayload, receiptItemIsValid, voucherIsValid, isNewFormVoucher, voucherServerFields, fromReceiptSummaryPayload, isCancellationReason, isReturnDisposition, RETURN_DISPOSITIONS, isTipRefundSource, TIP_REFUND_SOURCES, RECEIPT_EMAIL_VIAS, readRegistrationInfo, } from '../models/index.js';
|
|
4
4
|
import { RECEIPT_OUTPUT_ENTRIES_MAX, RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, receiptOutputsFromWire, } from '../models/receipt-output.js';
|
|
5
5
|
import { VoucherCode } from '@kreiseck/validator';
|
|
6
6
|
import { parseServerTimeStamp, toViennaWallClock } from '../vienna-time.js';
|
|
@@ -169,7 +169,14 @@ export function createReceiptParams(options) {
|
|
|
169
169
|
// Wie der Server erst nach dem Anhaengen des Trinkgelds: eine Trinkgeldzeile ist keine Gutscheinzeile.
|
|
170
170
|
const nurAuszahlung = (vouchers?.length ?? 0) > 0 && vouchers.every((v) => v.action === VoucherAction.payout)
|
|
171
171
|
&& (items?.length ?? 0) === 0 && options.tip == null;
|
|
172
|
-
|
|
172
|
+
// Leergut-Auszahlung (Server pfand-core istLeergutAuszahlung): Leergut auf dem Beleg und eine negative Zahlung.
|
|
173
|
+
const leergut = (items ?? []).filter(isDepositReturnItem);
|
|
174
|
+
const leergutAuszahlung = leergut.length > 0 && Array.isArray(options.payments)
|
|
175
|
+
&& options.payments.some((z) => typeof z?.amountCents === 'number' && z.amountCents < 0);
|
|
176
|
+
const leergutSummeCents = leergutAuszahlung
|
|
177
|
+
? leergut.reduce((summe, p) => summe + Math.abs(receiptItemTotalCents(p)), 0)
|
|
178
|
+
: undefined;
|
|
179
|
+
params['payments'] = gepruefteZahlungen(options.payments, false, 'createReceipt', nurAuszahlung || leergutAuszahlung, false, leergutSummeCents);
|
|
173
180
|
}
|
|
174
181
|
else if (options.payments != null) {
|
|
175
182
|
throw eingabefehler(`payments sind bei receiptType "${typ.value}" nicht erlaubt.`);
|
|
@@ -860,7 +867,7 @@ const MAX_ZAHLUNGEN = 20;
|
|
|
860
867
|
* (Summe, Anbieter-Pflicht und Trinkgeld prueft der Server). Wirft, bevor
|
|
861
868
|
* etwas hinausgeht.
|
|
862
869
|
*/
|
|
863
|
-
function gepruefteZahlungen(roh, storno, functionName, auszahlung = false, stornoAuszahlung = false) {
|
|
870
|
+
function gepruefteZahlungen(roh, storno, functionName, auszahlung = false, stornoAuszahlung = false, leergutSummeCents) {
|
|
864
871
|
const fehler = (grund) => new KasseneckValidationError(functionName, grund, 'request');
|
|
865
872
|
if (!Array.isArray(roh))
|
|
866
873
|
throw fehler('payments muss eine Liste sein.');
|
|
@@ -881,6 +888,11 @@ function gepruefteZahlungen(roh, storno, functionName, auszahlung = false, storn
|
|
|
881
888
|
throw fehler('Auszahlung: tenderedCents ist nicht moeglich.');
|
|
882
889
|
if (e['tipCents'] !== undefined)
|
|
883
890
|
throw fehler('Auszahlung: tipCents ist nicht moeglich.');
|
|
891
|
+
// Leergut-Auszahlung: Ware zahlt nie aus, hoechstens die Leergutsumme (der Server prueft ebenso).
|
|
892
|
+
const b = e['amountCents'];
|
|
893
|
+
if (leergutSummeCents !== undefined && typeof b === 'number' && -b > leergutSummeCents) {
|
|
894
|
+
throw fehler('Auszahlung: der Betrag ist hoeher als die Leergutsumme des Belegs.');
|
|
895
|
+
}
|
|
884
896
|
}
|
|
885
897
|
}
|
|
886
898
|
return roh.map((eintrag, i) => {
|
|
@@ -8,10 +8,15 @@ import { CreditCardProvider } from '../enums/index.js';
|
|
|
8
8
|
* bleibt deshalb bewusst Euro (siehe [toHobexReceiptPayload]/
|
|
9
9
|
* [fromHobexReceiptPayload]), intern wird ab hier exakt in Cent gefuehrt.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Zwei Wege hinein, je nach Weg der Zahlung:
|
|
12
|
+
*
|
|
13
|
+
* - **Cloud-API** (`fromJson` im Dart-Vorbild): [fromHobexReceiptPayload].
|
|
14
|
+
* - **HPS-Terminal ueber Kasseneck Connect** (`fromHps` im Dart-Vorbild):
|
|
15
|
+
* `hobexReceiptFromHps` aus `@kreiseck/kasseneck-api/payments` auf die
|
|
16
|
+
* Terminal-Antwort (`HpsPaymentResult.response`). Nur dieser Weg setzt den
|
|
17
|
+
* Anbieter `hobexHps` und damit die HPS-Zusatzfelder in
|
|
18
|
+
* [hobexReceiptToCardPaymentData]; er liest auch `cvm` als Zahl und
|
|
19
|
+
* nicht gefuehrte Felder (`null`) als leeren Text.
|
|
15
20
|
*/
|
|
16
21
|
export interface HobexReceipt {
|
|
17
22
|
transactionId: string;
|
|
@@ -52,7 +57,17 @@ export interface HobexReceiptPayload {
|
|
|
52
57
|
cvm: string | number;
|
|
53
58
|
}
|
|
54
59
|
export declare function toHobexReceiptPayload(receipt: HobexReceipt): HobexReceiptPayload;
|
|
55
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Liest eine Hobex-Nutzlast der **Cloud-API**.
|
|
62
|
+
*
|
|
63
|
+
* Der Anbieter ergibt sich aus dem Weg, nicht aus dem JSON; Vorgabe ist
|
|
64
|
+
* `hobexCloudApi`. Fuer eine Antwort des HPS-Terminals ist der richtige Weg
|
|
65
|
+
* `hobexReceiptFromHps` (`@kreiseck/kasseneck-api/payments`) — wer trotzdem
|
|
66
|
+
* hier hereinkommt, gibt [provider] `CreditCardProvider.hobexHps`
|
|
67
|
+
* mit, sonst fehlen am Beleg Genehmigungsnummer, Ablaufdatum, Kartenausgeber,
|
|
68
|
+
* Betrag und Waehrung (siehe [hobexReceiptToCardPaymentData]).
|
|
69
|
+
*/
|
|
70
|
+
export declare function fromHobexReceiptPayload(payload: HobexReceiptPayload, provider?: CreditCardProvider): HobexReceipt;
|
|
56
71
|
/**
|
|
57
72
|
* Wandelt den Beleg in die `cardPaymentData`-Map, die auf dem Kasseneck-Beleg
|
|
58
73
|
* landet (siehe [Receipt.cardPaymentData]). Bei HPS-Zahlungen kommen weitere
|
|
@@ -21,7 +21,17 @@ export function toHobexReceiptPayload(receipt) {
|
|
|
21
21
|
cvm: receipt.cvm,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Liest eine Hobex-Nutzlast der **Cloud-API**.
|
|
26
|
+
*
|
|
27
|
+
* Der Anbieter ergibt sich aus dem Weg, nicht aus dem JSON; Vorgabe ist
|
|
28
|
+
* `hobexCloudApi`. Fuer eine Antwort des HPS-Terminals ist der richtige Weg
|
|
29
|
+
* `hobexReceiptFromHps` (`@kreiseck/kasseneck-api/payments`) — wer trotzdem
|
|
30
|
+
* hier hereinkommt, gibt [provider] `CreditCardProvider.hobexHps`
|
|
31
|
+
* mit, sonst fehlen am Beleg Genehmigungsnummer, Ablaufdatum, Kartenausgeber,
|
|
32
|
+
* Betrag und Waehrung (siehe [hobexReceiptToCardPaymentData]).
|
|
33
|
+
*/
|
|
34
|
+
export function fromHobexReceiptPayload(payload, provider = CreditCardProvider.hobexCloudApi) {
|
|
25
35
|
return {
|
|
26
36
|
transactionId: payload.transactionId,
|
|
27
37
|
tid: payload.tid,
|
|
@@ -48,11 +58,12 @@ export function fromHobexReceiptPayload(payload) {
|
|
|
48
58
|
amountCents: euroToCents(payload.amount),
|
|
49
59
|
tipCents: euroToCents(payload.tip),
|
|
50
60
|
cvm: String(payload.cvm),
|
|
51
|
-
// Die
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
|
|
61
|
+
// Die Nutzlast traegt keinen eigenen Provider-Schluessel — der Provider
|
|
62
|
+
// ergibt sich aus dem Transportweg (Cloud vs. HPS), nicht aus dem JSON.
|
|
63
|
+
// Das Dart-Vorbild setzt ihn in `fromJson` deshalb ebenfalls nicht,
|
|
64
|
+
// sondern belaesst den Konstruktor-Default (Cloud); den Weg kennt nur
|
|
65
|
+
// der Aufrufer.
|
|
66
|
+
creditCardProvider: provider,
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, } from './errors.js';
|
|
1
|
+
import { HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, } from './errors.js';
|
|
2
2
|
import { isValidHpsTransactionId } from './transaction-id.js';
|
|
3
3
|
import { parseHpsTransactionResponse } from './transaction-response.js';
|
|
4
4
|
const DEFAULT_BASE_URL = 'http://127.0.0.1:27182';
|
|
@@ -56,15 +56,17 @@ export function createHpsConnectClient(options) {
|
|
|
56
56
|
const message = typeof h.error?.message === 'string' && h.error.message.trim() !== ''
|
|
57
57
|
? h.error.message
|
|
58
58
|
: `Kasseneck Connect meldet einen Fehler (HTTP ${antwort.status})`;
|
|
59
|
-
if (code !== undefined && PREFLIGHT_CONNECT_CODES.has(code)) {
|
|
59
|
+
if (code !== undefined && (PREFLIGHT_CONNECT_CODES.has(code) || TERMINAL_UNREACHABLE_CONNECT_CODES.has(code))) {
|
|
60
60
|
// Siehe errors.ts: diese Codes entstehen laut `kasseneck-connect`
|
|
61
|
-
// ausnahmslos VOR jedem Terminal-Kontakt
|
|
61
|
+
// ausnahmslos VOR jedem Terminal-Kontakt bzw. vor jedem gesendeten Byte
|
|
62
|
+
// (`terminal_unreachable`: keine TCP-Verbindung) -- beweisbar nichts
|
|
63
|
+
// gesendet.
|
|
62
64
|
throw new HpsPreflightError(message, code);
|
|
63
65
|
}
|
|
64
66
|
// terminal_error / timeout / terminal_offline -- oder ein Code, den
|
|
65
67
|
// dieses Paket nicht kennt. Bewusst dieselbe Klasse fuer beide: ein
|
|
66
68
|
// unbekannter Code ist keine bewiesene Nicht-Aussendung, siehe
|
|
67
|
-
// PREFLIGHT_CONNECT_CODES.
|
|
69
|
+
// PREFLIGHT_CONNECT_CODES und TERMINAL_UNREACHABLE_CONNECT_CODES.
|
|
68
70
|
//
|
|
69
71
|
// `error.detail.terminalHttpStatus` reist seit `kasseneck-connect`
|
|
70
72
|
// Commit `0fb6f66` mit, wenn das TERMINAL selbst einen HTTP-Status
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* - [HpsPreflightError] — es ist NACHWEISLICH nichts gesendet worden. Entweder
|
|
8
8
|
* die Kennung selbst war unbrauchbar (siehe `connect-client.ts`), oder
|
|
9
9
|
* Connect hat die Anfrage VOR dem Terminal-Kontakt abgelehnt (falscher
|
|
10
|
-
* Host, keine Kopplung, ...)
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Host, keine Kopplung, ...), oder die TCP-Verbindung zum Terminal kam gar
|
|
11
|
+
* nicht erst zustande ([TERMINAL_UNREACHABLE_CONNECT_CODES]). Wird von
|
|
12
|
+
* `payments.ts` unveraendert weitergeworfen, niemals in einen Ausgang
|
|
13
|
+
* uebersetzt — Zwilling von Dart's `ArgumentError`-Sonderfall in
|
|
14
|
+
* `HpsPayments.pay()`.
|
|
13
15
|
* - [HpsConnectTerminalError] — die Anfrage GING RAUS (oder der Versuch dazu
|
|
14
16
|
* scheiterte am Transport), aber es kam keine schluessige Antwort. Das
|
|
15
17
|
* umfasst ausdruecklich auch [isTerminalBusy]: HTTP `409` ist die einzige
|
|
@@ -27,7 +29,12 @@ export declare abstract class HpsConnectException extends Error {
|
|
|
27
29
|
/**
|
|
28
30
|
* Nichts ist gesendet worden. `reason` ist deutscher Klartext, `connectCode`
|
|
29
31
|
* gesetzt, wenn die Ablehnung von Connect kam (statt von der lokalen
|
|
30
|
-
* Kennungspruefung)
|
|
32
|
+
* Kennungspruefung) — ein Code aus [PREFLIGHT_CONNECT_CODES] oder aus
|
|
33
|
+
* [TERMINAL_UNREACHABLE_CONNECT_CODES].
|
|
34
|
+
*
|
|
35
|
+
* Fuer die Kasse heisst das: sicher nichts belastet, ein neuer Versuch ist
|
|
36
|
+
* gefahrlos. Bei `terminal_unreachable` liegt die Ursache am Terminal (aus,
|
|
37
|
+
* anderes Netz, falsche IP), bei den anderen Codes an Connect oder der Kopplung.
|
|
31
38
|
*/
|
|
32
39
|
export declare class HpsPreflightError extends HpsConnectException {
|
|
33
40
|
readonly name: string;
|
|
@@ -61,11 +68,31 @@ export declare class HpsTransactionIdError extends HpsPreflightError {
|
|
|
61
68
|
* einen Fehlercode erweitert wird, der doch am Terminal entsteht.
|
|
62
69
|
*/
|
|
63
70
|
export declare const PREFLIGHT_CONNECT_CODES: ReadonlySet<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Connect-Fehlercodes, die AM Weg zum Terminal entstehen, aber beweisbar vor
|
|
73
|
+
* jedem gesendeten Byte: Connect hat die TCP-Verbindung zum Terminal
|
|
74
|
+
* versucht, und sie kam nicht zustande (Verbindung abgelehnt, keine Route zum
|
|
75
|
+
* Host, Zeitablauf beim Verbindungsaufbau). Ohne Verbindung kein Request —
|
|
76
|
+
* am Terminal ist nichts angekommen, also auch nichts belastet.
|
|
77
|
+
*
|
|
78
|
+
* Getrennt von [PREFLIGHT_CONNECT_CODES], weil die Ursache eine andere ist:
|
|
79
|
+
* dort lehnt Connect die Anfrage ab, ohne das Terminal ueberhaupt zu
|
|
80
|
+
* versuchen; hier hat Connect es versucht, und das Terminal war nicht da. Fuer
|
|
81
|
+
* den Ausgang zaehlt beides gleich ([HpsPreflightError]).
|
|
82
|
+
*
|
|
83
|
+
* Nur Connect-Fassungen ab der Einfuehrung von `terminal_unreachable` senden
|
|
84
|
+
* den Code. Aeltere melden jeden Netzfehler zum Terminal als
|
|
85
|
+
* `terminal_offline` — und der bleibt unklar: dort kann die Verbindung auch
|
|
86
|
+
* NACH dem Senden gerissen sein. Wie bei [PREFLIGHT_CONNECT_CODES] gilt die
|
|
87
|
+
* Positivliste: was hier nicht steht, ist [HpsConnectTerminalError].
|
|
88
|
+
*/
|
|
89
|
+
export declare const TERMINAL_UNREACHABLE_CONNECT_CODES: ReadonlySet<string>;
|
|
64
90
|
/**
|
|
65
91
|
* Die Anfrage ging (oder der Versuch dazu) in Richtung Terminal, aber es kam
|
|
66
92
|
* keine schluessige Antwort — Connect meldete `terminal_error`, `timeout`
|
|
67
93
|
* oder `terminal_offline` (`kasseneck-connect/lib/src/terminal/hps.dart`),
|
|
68
|
-
* oder einen Fehlercode, den dieses Paket nicht kennt.
|
|
94
|
+
* oder einen Fehlercode, den dieses Paket nicht kennt. `terminal_unreachable`
|
|
95
|
+
* gehoert NICHT hierher (beweisbar nichts gesendet, [HpsPreflightError]).
|
|
69
96
|
*/
|
|
70
97
|
export declare class HpsConnectTerminalError extends HpsConnectException {
|
|
71
98
|
readonly name = "HpsConnectTerminalError";
|
|
@@ -8,9 +8,11 @@ import { NOT_FOUND_HTTP_STATUS, TERMINAL_BUSY_HTTP_STATUS } from './transaction-
|
|
|
8
8
|
* - [HpsPreflightError] — es ist NACHWEISLICH nichts gesendet worden. Entweder
|
|
9
9
|
* die Kennung selbst war unbrauchbar (siehe `connect-client.ts`), oder
|
|
10
10
|
* Connect hat die Anfrage VOR dem Terminal-Kontakt abgelehnt (falscher
|
|
11
|
-
* Host, keine Kopplung, ...)
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Host, keine Kopplung, ...), oder die TCP-Verbindung zum Terminal kam gar
|
|
12
|
+
* nicht erst zustande ([TERMINAL_UNREACHABLE_CONNECT_CODES]). Wird von
|
|
13
|
+
* `payments.ts` unveraendert weitergeworfen, niemals in einen Ausgang
|
|
14
|
+
* uebersetzt — Zwilling von Dart's `ArgumentError`-Sonderfall in
|
|
15
|
+
* `HpsPayments.pay()`.
|
|
14
16
|
* - [HpsConnectTerminalError] — die Anfrage GING RAUS (oder der Versuch dazu
|
|
15
17
|
* scheiterte am Transport), aber es kam keine schluessige Antwort. Das
|
|
16
18
|
* umfasst ausdruecklich auch [isTerminalBusy]: HTTP `409` ist die einzige
|
|
@@ -28,7 +30,12 @@ export class HpsConnectException extends Error {
|
|
|
28
30
|
/**
|
|
29
31
|
* Nichts ist gesendet worden. `reason` ist deutscher Klartext, `connectCode`
|
|
30
32
|
* gesetzt, wenn die Ablehnung von Connect kam (statt von der lokalen
|
|
31
|
-
* Kennungspruefung)
|
|
33
|
+
* Kennungspruefung) — ein Code aus [PREFLIGHT_CONNECT_CODES] oder aus
|
|
34
|
+
* [TERMINAL_UNREACHABLE_CONNECT_CODES].
|
|
35
|
+
*
|
|
36
|
+
* Fuer die Kasse heisst das: sicher nichts belastet, ein neuer Versuch ist
|
|
37
|
+
* gefahrlos. Bei `terminal_unreachable` liegt die Ursache am Terminal (aus,
|
|
38
|
+
* anderes Netz, falsche IP), bei den anderen Codes an Connect oder der Kopplung.
|
|
32
39
|
*/
|
|
33
40
|
export class HpsPreflightError extends HpsConnectException {
|
|
34
41
|
name = 'HpsPreflightError';
|
|
@@ -75,11 +82,33 @@ export const PREFLIGHT_CONNECT_CODES = new Set([
|
|
|
75
82
|
'not_found',
|
|
76
83
|
'body_too_large',
|
|
77
84
|
]);
|
|
85
|
+
/**
|
|
86
|
+
* Connect-Fehlercodes, die AM Weg zum Terminal entstehen, aber beweisbar vor
|
|
87
|
+
* jedem gesendeten Byte: Connect hat die TCP-Verbindung zum Terminal
|
|
88
|
+
* versucht, und sie kam nicht zustande (Verbindung abgelehnt, keine Route zum
|
|
89
|
+
* Host, Zeitablauf beim Verbindungsaufbau). Ohne Verbindung kein Request —
|
|
90
|
+
* am Terminal ist nichts angekommen, also auch nichts belastet.
|
|
91
|
+
*
|
|
92
|
+
* Getrennt von [PREFLIGHT_CONNECT_CODES], weil die Ursache eine andere ist:
|
|
93
|
+
* dort lehnt Connect die Anfrage ab, ohne das Terminal ueberhaupt zu
|
|
94
|
+
* versuchen; hier hat Connect es versucht, und das Terminal war nicht da. Fuer
|
|
95
|
+
* den Ausgang zaehlt beides gleich ([HpsPreflightError]).
|
|
96
|
+
*
|
|
97
|
+
* Nur Connect-Fassungen ab der Einfuehrung von `terminal_unreachable` senden
|
|
98
|
+
* den Code. Aeltere melden jeden Netzfehler zum Terminal als
|
|
99
|
+
* `terminal_offline` — und der bleibt unklar: dort kann die Verbindung auch
|
|
100
|
+
* NACH dem Senden gerissen sein. Wie bei [PREFLIGHT_CONNECT_CODES] gilt die
|
|
101
|
+
* Positivliste: was hier nicht steht, ist [HpsConnectTerminalError].
|
|
102
|
+
*/
|
|
103
|
+
export const TERMINAL_UNREACHABLE_CONNECT_CODES = new Set([
|
|
104
|
+
'terminal_unreachable',
|
|
105
|
+
]);
|
|
78
106
|
/**
|
|
79
107
|
* Die Anfrage ging (oder der Versuch dazu) in Richtung Terminal, aber es kam
|
|
80
108
|
* keine schluessige Antwort — Connect meldete `terminal_error`, `timeout`
|
|
81
109
|
* oder `terminal_offline` (`kasseneck-connect/lib/src/terminal/hps.dart`),
|
|
82
|
-
* oder einen Fehlercode, den dieses Paket nicht kennt.
|
|
110
|
+
* oder einen Fehlercode, den dieses Paket nicht kennt. `terminal_unreachable`
|
|
111
|
+
* gehoert NICHT hierher (beweisbar nichts gesendet, [HpsPreflightError]).
|
|
83
112
|
*/
|
|
84
113
|
export class HpsConnectTerminalError extends HpsConnectException {
|
|
85
114
|
name = 'HpsConnectTerminalError';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* des Aufrufers.
|
|
19
19
|
*/
|
|
20
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';
|
|
21
|
-
export { HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, } from './errors.js';
|
|
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';
|
|
24
24
|
export { type HpsCancelOptions, type HpsPaymentOptions, type HpsPayments, type HpsPaymentsOptions, type HpsRefundOptions, createHpsPayments, } from './payments.js';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* des Aufrufers.
|
|
19
19
|
*/
|
|
20
20
|
export { createHpsConnectClient, } from './connect-client.js';
|
|
21
|
-
export { HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, } from './errors.js';
|
|
21
|
+
export { HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, } from './errors.js';
|
|
22
22
|
export { isHostUncertainResult, mayRetrySafely, } from './outcome.js';
|
|
23
23
|
export { createHpsPayments, } from './payments.js';
|
|
24
24
|
export { MAX_TRANSACTION_ID_LENGTH, createHpsTransactionIdGenerator, isValidHpsTransactionId, newHpsTransactionId, } from './transaction-id.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 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, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, 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, 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 HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, type HpsCancelOptions, 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, 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';
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
export { StripeLinkMode } from '../enums/index.js';
|
|
44
44
|
export { createStripeLink, stripeCaptureIntent, } from './stripe.js';
|
|
45
45
|
export { hobexPay, hobexRefund, newHobexTransactionId, } from './hobex.js';
|
|
46
|
-
export { ABORTED_CODE, APPROVED_CODE, CARD_NOT_PRESENT_CODE, createHpsConnectClient, createHpsPayments, createHpsTransactionIdGenerator, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, 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, TECHNICAL_ERROR_CODE, NOT_FOUND_HTTP_STATUS, TERMINAL_BUSY_HTTP_STATUS, TRANSACTION_CANCELED_CODE, } from './hobex-hps/index.js';
|
|
46
|
+
export { ABORTED_CODE, APPROVED_CODE, CARD_NOT_PRESENT_CODE, createHpsConnectClient, createHpsPayments, createHpsTransactionIdGenerator, 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';
|
|
@@ -17,7 +17,7 @@ export declare const ARTICLE_EXTERNAL_VOUCHER_TYPES: readonly ArticleExternalVou
|
|
|
17
17
|
/** Fehlercode beim Speichern eines Artikels, intern und unter `/v3` gleich. */
|
|
18
18
|
export declare const ARTICLE_EXTERNAL_VOUCHER_INVALID = "article_external_voucher_invalid";
|
|
19
19
|
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
20
|
-
export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "rate_required", "invalid_rate", "price_required"];
|
|
20
|
+
export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "deposit", "rate_required", "invalid_rate", "price_required"];
|
|
21
21
|
export type ExternalVoucherArticleReason = typeof EXTERNAL_VOUCHER_ARTICLE_REASONS[number];
|
|
22
22
|
/**
|
|
23
23
|
* Ein Artikel im Editor (`/v3`-Form), soweit die Regeln ihn lesen. Bewusst
|
|
@@ -30,6 +30,7 @@ export interface ExternalVoucherArticleInput {
|
|
|
30
30
|
askPrice?: boolean | null;
|
|
31
31
|
serviceVoucher?: boolean | null;
|
|
32
32
|
addOns?: readonly unknown[] | null;
|
|
33
|
+
deposits?: readonly unknown[] | null;
|
|
33
34
|
stockTracked?: boolean | null;
|
|
34
35
|
reference?: unknown;
|
|
35
36
|
askQuantity?: boolean | null;
|
|
@@ -49,7 +50,7 @@ export declare function checkExternalVoucherValue(value: unknown): ExternalVouch
|
|
|
49
50
|
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
50
51
|
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
51
52
|
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
52
|
-
* Referenz oder
|
|
53
|
+
* Referenz, Mengenabfrage oder Pfand (die Kasse fragt die Nummer selbst und bucht
|
|
53
54
|
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
54
55
|
*/
|
|
55
56
|
export declare function checkExternalVoucherArticle(a: ExternalVoucherArticleInput): ExternalVoucherArticleReason | null;
|
|
@@ -3,7 +3,7 @@ export const ARTICLE_EXTERNAL_VOUCHER_TYPES = Object.freeze(['multi_purpose', 's
|
|
|
3
3
|
export const ARTICLE_EXTERNAL_VOUCHER_INVALID = 'article_external_voucher_invalid';
|
|
4
4
|
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
5
5
|
export const EXTERNAL_VOUCHER_ARTICLE_REASONS = Object.freeze([
|
|
6
|
-
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'rate_required', 'invalid_rate', 'price_required',
|
|
6
|
+
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'deposit', 'rate_required', 'invalid_rate', 'price_required',
|
|
7
7
|
]);
|
|
8
8
|
/**
|
|
9
9
|
* Saetze, mit denen ein Einzweckgutschein verkauft werden kann (Prozent wie
|
|
@@ -24,7 +24,7 @@ export function checkExternalVoucherValue(value) {
|
|
|
24
24
|
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
25
25
|
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
26
26
|
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
27
|
-
* Referenz oder
|
|
27
|
+
* Referenz, Mengenabfrage oder Pfand (die Kasse fragt die Nummer selbst und bucht
|
|
28
28
|
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
29
29
|
*/
|
|
30
30
|
export function checkExternalVoucherArticle(a) {
|
|
@@ -42,6 +42,8 @@ export function checkExternalVoucherArticle(a) {
|
|
|
42
42
|
return 'reference';
|
|
43
43
|
if (a.askQuantity === true)
|
|
44
44
|
return 'asks_quantity';
|
|
45
|
+
if (Array.isArray(a.deposits) && a.deposits.length > 0)
|
|
46
|
+
return 'deposit';
|
|
45
47
|
if (a.externalVoucher === 'single_purpose' && !(typeof a.vatRate === 'number' && Number.isFinite(a.vatRate)))
|
|
46
48
|
return 'rate_required';
|
|
47
49
|
if (a.externalVoucher === 'single_purpose' && !ARTICLE_EXTERNAL_VOUCHER_VAT_RATES.includes(a.vatRate))
|
package/dist/esm/pos/texte.d.ts
CHANGED
|
@@ -250,6 +250,16 @@ declare const MELDUNGEN_ROH: {
|
|
|
250
250
|
readonly placeholders: readonly ["response"];
|
|
251
251
|
readonly only: readonly ["web"];
|
|
252
252
|
};
|
|
253
|
+
readonly 'terminal.several_found': {
|
|
254
|
+
readonly text: "Mehrere Terminals gefunden: {hosts}. Die IP-Adresse des richtigen von Hand eintragen.";
|
|
255
|
+
readonly placeholders: readonly ["hosts"];
|
|
256
|
+
readonly only: readonly ["web"];
|
|
257
|
+
};
|
|
258
|
+
readonly 'terminal.tid_not_found': {
|
|
259
|
+
readonly text: "Mehrere Terminals gefunden: {hosts}. Keines meldet die TID {tid} – TID prüfen oder die IP-Adresse von Hand eintragen.";
|
|
260
|
+
readonly placeholders: readonly ["hosts", "tid"];
|
|
261
|
+
readonly only: readonly ["web"];
|
|
262
|
+
};
|
|
253
263
|
readonly 'gptom.app_missing': {
|
|
254
264
|
readonly text: "Die GP-Tom-App ist auf diesem Gerät nicht da.";
|
|
255
265
|
readonly only: readonly ["app"];
|
|
@@ -495,6 +505,9 @@ declare const MELDUNGEN_ROH: {
|
|
|
495
505
|
readonly 'external_voucher_article.asks_quantity': {
|
|
496
506
|
readonly text: "Ein fremder Gutschein fragt keine Menge ab.";
|
|
497
507
|
};
|
|
508
|
+
readonly 'external_voucher_article.deposit': {
|
|
509
|
+
readonly text: "Ein fremder Gutschein hat kein Pfand.";
|
|
510
|
+
};
|
|
498
511
|
readonly 'external_voucher_article.rate_required': {
|
|
499
512
|
readonly text: "Ein Einzweckgutschein braucht den Steuersatz, mit dem er verkauft wird.";
|
|
500
513
|
};
|
|
@@ -780,6 +793,10 @@ declare const MELDUNGEN_ROH: {
|
|
|
780
793
|
readonly text: "Kasseneck Connect nicht gefunden – bitte installieren.";
|
|
781
794
|
readonly only: readonly ["web"];
|
|
782
795
|
};
|
|
796
|
+
readonly 'connect.local_network_blocked': {
|
|
797
|
+
readonly text: "Der Browser sperrt den Zugang zu Kasseneck Connect. Freigeben: Schloss neben der Adresse (installierte App: Menü ⋮ → App-Info) → Website-Einstellungen → „Lokales Netzwerk“ → „Zulassen“.";
|
|
798
|
+
readonly only: readonly ["web"];
|
|
799
|
+
};
|
|
783
800
|
readonly 'connect.unpair_question': {
|
|
784
801
|
readonly text: "Diesen Browser wirklich von Connect trennen? Der Bondruck geht dann nicht mehr.";
|
|
785
802
|
readonly only: readonly ["web"];
|
|
@@ -1318,6 +1335,7 @@ export declare const EXTERNAL_VOUCHER_ARTICLE_MESSAGES: {
|
|
|
1318
1335
|
readonly stock_tracked: "external_voucher_article.stock_tracked";
|
|
1319
1336
|
readonly reference: "external_voucher_article.reference";
|
|
1320
1337
|
readonly asks_quantity: "external_voucher_article.asks_quantity";
|
|
1338
|
+
readonly deposit: "external_voucher_article.deposit";
|
|
1321
1339
|
readonly rate_required: "external_voucher_article.rate_required";
|
|
1322
1340
|
readonly invalid_rate: "external_voucher_article.invalid_rate";
|
|
1323
1341
|
readonly price_required: "external_voucher_article.price_required";
|
package/dist/esm/pos/texte.js
CHANGED
|
@@ -135,6 +135,10 @@ const MELDUNGEN_ROH = {
|
|
|
135
135
|
'card_payment.unpair_card_charged': { text: 'Auf diesem Gerät liegt noch eine gebuchte Kartenzahlung ohne Beleg – sie muss von Hand am Terminal zurückerstattet werden (Betrag siehe unten).' },
|
|
136
136
|
'terminal.none_found': { text: 'Kein Hobex-Terminal gefunden – ist es eingeschaltet und im selben Netz wie dieser Rechner?', only: ['web'] },
|
|
137
137
|
'terminal.not_ready': { text: 'Terminal antwortet, ist aber nicht betriebsbereit: {response} – TID prüfen.', placeholders: ['response'], only: ['web'] },
|
|
138
|
+
// Terminal-Suche mit mehreren Treffern (1.33.0): uebernommen wird nur ein Treffer, an dem die
|
|
139
|
+
// Diagnose die TID dieses Geraets bestaetigt -- sonst nennt die Kasse die Adressen und setzt keine.
|
|
140
|
+
'terminal.several_found': { text: 'Mehrere Terminals gefunden: {hosts}. Die IP-Adresse des richtigen von Hand eintragen.', placeholders: ['hosts'], only: ['web'] },
|
|
141
|
+
'terminal.tid_not_found': { text: 'Mehrere Terminals gefunden: {hosts}. Keines meldet die TID {tid} – TID prüfen oder die IP-Adresse von Hand eintragen.', placeholders: ['hosts', 'tid'], only: ['web'] },
|
|
138
142
|
'gptom.app_missing': { text: 'Die GP-Tom-App ist auf diesem Gerät nicht da.', only: ['app'] },
|
|
139
143
|
'gptom.search_failed': { text: 'GP Tom: Suche nach der App fehlgeschlagen: {reason}', placeholders: ['reason'], only: ['app'] },
|
|
140
144
|
'gptom.payment_failed': { text: 'GP Tom: Zahlung fehlgeschlagen: {reason}', placeholders: ['reason'], only: ['app'] },
|
|
@@ -251,6 +255,7 @@ const MELDUNGEN_ROH = {
|
|
|
251
255
|
'external_voucher_article.stock_tracked': { text: 'Ein fremder Gutschein führt keinen Lagerbestand.' },
|
|
252
256
|
'external_voucher_article.reference': { text: 'Ein fremder Gutschein fragt keine Referenz ab, die Kasse fragt die Gutscheinnummer.' },
|
|
253
257
|
'external_voucher_article.asks_quantity': { text: 'Ein fremder Gutschein fragt keine Menge ab.' },
|
|
258
|
+
'external_voucher_article.deposit': { text: 'Ein fremder Gutschein hat kein Pfand.' },
|
|
254
259
|
'external_voucher_article.rate_required': { text: 'Ein Einzweckgutschein braucht den Steuersatz, mit dem er verkauft wird.' },
|
|
255
260
|
'external_voucher_article.invalid_rate': { text: 'Ein Einzweckgutschein braucht einen Steuersatz der Kasse: 20, 13, 10, 4,9, 0 oder 19 %.' },
|
|
256
261
|
'external_voucher_article.price_required': { text: 'Ein fremder Gutschein braucht einen Preis oder „Betrag beim Antippen eingeben“.' },
|
|
@@ -380,6 +385,9 @@ const MELDUNGEN_ROH = {
|
|
|
380
385
|
'connect.printer_unknown': { text: 'Diesen Drucker kennt Kasseneck Connect nicht (mehr) – bitte neu suchen.', only: ['web'] },
|
|
381
386
|
'connect.origin_not_allowed': { text: 'Kasseneck Connect nimmt von dieser Adresse nichts an (Ursprung nicht freigegeben).', only: ['web'] },
|
|
382
387
|
'connect.not_installed': { text: 'Kasseneck Connect nicht gefunden – bitte installieren.', only: ['web'] },
|
|
388
|
+
// Chrome fragt ab 142 vor dem Zugriff einer https-Seite auf 127.0.0.1 nach („Lokales Netzwerk“).
|
|
389
|
+
// Ist das gesperrt, findet die Kasse Connect nicht -- installieren hilft dann nicht (1.33.0).
|
|
390
|
+
'connect.local_network_blocked': { text: 'Der Browser sperrt den Zugang zu Kasseneck Connect. Freigeben: Schloss neben der Adresse (installierte App: Menü ⋮ → App-Info) → Website-Einstellungen → „Lokales Netzwerk“ → „Zulassen“.', only: ['web'] },
|
|
383
391
|
'connect.unpair_question': { text: 'Diesen Browser wirklich von Connect trennen? Der Bondruck geht dann nicht mehr.', only: ['web'] },
|
|
384
392
|
// --- Einstellungen -------------------------------------------------------
|
|
385
393
|
'settings.load_failed': { text: 'Die Einstellungen konnten nicht geladen werden.' },
|
|
@@ -737,6 +745,7 @@ export const EXTERNAL_VOUCHER_ARTICLE_MESSAGES = {
|
|
|
737
745
|
stock_tracked: 'external_voucher_article.stock_tracked',
|
|
738
746
|
reference: 'external_voucher_article.reference',
|
|
739
747
|
asks_quantity: 'external_voucher_article.asks_quantity',
|
|
748
|
+
deposit: 'external_voucher_article.deposit',
|
|
740
749
|
rate_required: 'external_voucher_article.rate_required',
|
|
741
750
|
invalid_rate: 'external_voucher_article.invalid_rate',
|
|
742
751
|
price_required: 'external_voucher_article.price_required',
|
package/dist/esm/version.d.ts
CHANGED
package/dist/esm/version.js
CHANGED
|
@@ -288,6 +288,26 @@
|
|
|
288
288
|
"code": "article_external_voucher_invalid",
|
|
289
289
|
"reason": "asks_quantity"
|
|
290
290
|
},
|
|
291
|
+
{
|
|
292
|
+
"name": "Pfand an der Kachel",
|
|
293
|
+
"article": {
|
|
294
|
+
"externalVoucher": "multi_purpose",
|
|
295
|
+
"unitPriceCents": 2500,
|
|
296
|
+
"deposits": [{ "depositTypeId": "einweg", "quantity": 1 }]
|
|
297
|
+
},
|
|
298
|
+
"ok": false,
|
|
299
|
+
"code": "article_external_voucher_invalid",
|
|
300
|
+
"reason": "deposit"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "Pfand leer: kein Pfand ist erlaubt",
|
|
304
|
+
"article": {
|
|
305
|
+
"externalVoucher": "multi_purpose",
|
|
306
|
+
"unitPriceCents": 2500,
|
|
307
|
+
"deposits": []
|
|
308
|
+
},
|
|
309
|
+
"ok": true
|
|
310
|
+
},
|
|
291
311
|
{
|
|
292
312
|
"name": "Menge nicht abfragen",
|
|
293
313
|
"article": {
|
package/fixtures/pos-texts.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.33.0",
|
|
3
3
|
"messages": {
|
|
4
4
|
"network.no_connection": {
|
|
5
5
|
"text": "Keine Verbindung zum Server. Bitte die Internetverbindung prüfen und erneut versuchen."
|
|
@@ -252,6 +252,25 @@
|
|
|
252
252
|
"web"
|
|
253
253
|
]
|
|
254
254
|
},
|
|
255
|
+
"terminal.several_found": {
|
|
256
|
+
"text": "Mehrere Terminals gefunden: {hosts}. Die IP-Adresse des richtigen von Hand eintragen.",
|
|
257
|
+
"placeholders": [
|
|
258
|
+
"hosts"
|
|
259
|
+
],
|
|
260
|
+
"only": [
|
|
261
|
+
"web"
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
"terminal.tid_not_found": {
|
|
265
|
+
"text": "Mehrere Terminals gefunden: {hosts}. Keines meldet die TID {tid} – TID prüfen oder die IP-Adresse von Hand eintragen.",
|
|
266
|
+
"placeholders": [
|
|
267
|
+
"hosts",
|
|
268
|
+
"tid"
|
|
269
|
+
],
|
|
270
|
+
"only": [
|
|
271
|
+
"web"
|
|
272
|
+
]
|
|
273
|
+
},
|
|
255
274
|
"gptom.app_missing": {
|
|
256
275
|
"text": "Die GP-Tom-App ist auf diesem Gerät nicht da.",
|
|
257
276
|
"only": [
|
|
@@ -531,6 +550,9 @@
|
|
|
531
550
|
"external_voucher_article.asks_quantity": {
|
|
532
551
|
"text": "Ein fremder Gutschein fragt keine Menge ab."
|
|
533
552
|
},
|
|
553
|
+
"external_voucher_article.deposit": {
|
|
554
|
+
"text": "Ein fremder Gutschein hat kein Pfand."
|
|
555
|
+
},
|
|
534
556
|
"external_voucher_article.rate_required": {
|
|
535
557
|
"text": "Ein Einzweckgutschein braucht den Steuersatz, mit dem er verkauft wird."
|
|
536
558
|
},
|
|
@@ -900,6 +922,12 @@
|
|
|
900
922
|
"web"
|
|
901
923
|
]
|
|
902
924
|
},
|
|
925
|
+
"connect.local_network_blocked": {
|
|
926
|
+
"text": "Der Browser sperrt den Zugang zu Kasseneck Connect. Freigeben: Schloss neben der Adresse (installierte App: Menü ⋮ → App-Info) → Website-Einstellungen → „Lokales Netzwerk“ → „Zulassen“.",
|
|
927
|
+
"only": [
|
|
928
|
+
"web"
|
|
929
|
+
]
|
|
930
|
+
},
|
|
903
931
|
"connect.unpair_question": {
|
|
904
932
|
"text": "Diesen Browser wirklich von Connect trennen? Der Bondruck geht dann nicht mehr.",
|
|
905
933
|
"only": [
|
|
@@ -1451,6 +1479,7 @@
|
|
|
1451
1479
|
"stock_tracked": "external_voucher_article.stock_tracked",
|
|
1452
1480
|
"reference": "external_voucher_article.reference",
|
|
1453
1481
|
"asks_quantity": "external_voucher_article.asks_quantity",
|
|
1482
|
+
"deposit": "external_voucher_article.deposit",
|
|
1454
1483
|
"rate_required": "external_voucher_article.rate_required",
|
|
1455
1484
|
"invalid_rate": "external_voucher_article.invalid_rate",
|
|
1456
1485
|
"price_required": "external_voucher_article.price_required"
|
package/fixtures/surface.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.33.0",
|
|
3
3
|
"baseUrls": {
|
|
4
4
|
"public": "https://api.kasseneck.at/v3",
|
|
5
5
|
"pos": "https://kasse.kasseneck.at/api/v3"
|
|
@@ -792,6 +792,7 @@
|
|
|
792
792
|
"stock_tracked",
|
|
793
793
|
"reference",
|
|
794
794
|
"asks_quantity",
|
|
795
|
+
"deposit",
|
|
795
796
|
"rate_required",
|
|
796
797
|
"invalid_rate",
|
|
797
798
|
"price_required"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kreiseck/kasseneck-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"description": "Austrian fiscal cash register (RKSV) client for JavaScript and TypeScript: signed receipts, cancellations, card payments, receipt printing (ESC/POS), invoices, inventory. RKSV-Registrierkasse für JavaScript und TypeScript.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Kreiseck",
|