@kreiseck/kasseneck-api 1.0.0-rc.3 → 1.0.0-rc.5
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 +88 -0
- package/README.md +73 -12
- package/dist/cjs/client/errors.d.ts +32 -1
- package/dist/cjs/client/errors.js +77 -4
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/payments/hobex.d.ts +7 -4
- package/dist/cjs/payments/hobex.js +7 -4
- package/dist/cjs/payments/stripe.d.ts +3 -1
- package/dist/cjs/payments/stripe.js +3 -1
- package/dist/cjs/pos/index.d.ts +1 -1
- package/dist/cjs/pos/index.js +6 -1
- package/dist/cjs/pos/texte.d.ts +95 -2
- package/dist/cjs/pos/texte.js +111 -3
- package/dist/cjs/receipt/due.d.ts +33 -0
- package/dist/cjs/receipt/due.js +61 -15
- package/dist/cjs/receipt/index.d.ts +1 -1
- package/dist/cjs/receipt/index.js +4 -1
- package/dist/cjs/stored/index.d.ts +1 -0
- package/dist/cjs/stored/index.js +7 -0
- package/dist/cjs/stored/layout.d.ts +55 -0
- package/dist/cjs/stored/layout.js +119 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/errors.d.ts +32 -1
- package/dist/esm/client/errors.js +76 -3
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/payments/hobex.d.ts +7 -4
- package/dist/esm/payments/hobex.js +7 -4
- package/dist/esm/payments/stripe.d.ts +3 -1
- package/dist/esm/payments/stripe.js +3 -1
- package/dist/esm/pos/index.d.ts +1 -1
- package/dist/esm/pos/index.js +1 -1
- package/dist/esm/pos/texte.d.ts +95 -2
- package/dist/esm/pos/texte.js +108 -2
- package/dist/esm/receipt/due.d.ts +33 -0
- package/dist/esm/receipt/due.js +58 -15
- package/dist/esm/receipt/index.d.ts +1 -1
- package/dist/esm/receipt/index.js +1 -1
- package/dist/esm/stored/index.d.ts +1 -0
- package/dist/esm/stored/index.js +2 -0
- package/dist/esm/stored/layout.d.ts +55 -0
- package/dist/esm/stored/layout.js +113 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/pos-message-cases.json +31 -1
- package/fixtures/pos-texts.json +68 -1
- package/fixtures/receipt-due-errors.json +56 -0
- package/fixtures/surface.json +11 -1
- package/fixtures/v3/antworten/belege.json +1 -1
- package/fixtures/v3/antworten/belegmail.json +1 -1
- package/fixtures/v3/antworten/kasse-belege.json +1 -1
- package/fixtures/v3/antworten/kasse.json +2 -2
- package/fixtures/v3/antworten/rechnungen.json +1 -1
- package/fixtures/v3/antworten/storno.json +1 -1
- package/fixtures/v3/stored/belege.json +1 -1
- package/fixtures/v3/stored/kasse.json +2 -2
- package/fixtures/v3/stored/rechnungen.json +1 -1
- package/fixtures/v3/v3-vokabular.json +1 -1
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,79 @@ bytes of every golden receipt.
|
|
|
19
19
|
This entry is written in English, like the developer documentation from here
|
|
20
20
|
on.
|
|
21
21
|
|
|
22
|
+
### 1.0.0-rc.5
|
|
23
|
+
|
|
24
|
+
Findings from moving the web register onto 1.0.
|
|
25
|
+
|
|
26
|
+
- **Plain text for edge codes on the register screen.** `ERROR_RULES` is
|
|
27
|
+
unchanged (one rule per kind, as in rc.4), so a register that looks a rule
|
|
28
|
+
up by `kind` alone keeps showing the same sentence. New
|
|
29
|
+
`ERROR_CODE_RULES` refine it per code. `route_missing`, `not_found` and
|
|
30
|
+
`internal_translation_error` (nothing happened on the server) show
|
|
31
|
+
`server.connection_disturbed` ("Die Verbindung zum Kassenserver ist
|
|
32
|
+
gestört. Bitte kurz warten und erneut versuchen."). `dialect_mismatch`,
|
|
33
|
+
`response_translation_failed` and `response_unreadable` (outcome unknown)
|
|
34
|
+
show `server.response_unreadable` ("Die Antwort des Kassenservers war nicht
|
|
35
|
+
lesbar. Bitte die Kasse neu öffnen und vor einem neuen Versuch prüfen, ob
|
|
36
|
+
der letzte Vorgang schon gebucht ist."), which never invites a retry; a
|
|
37
|
+
test holds every code the package treats as outcome-unknown to that. Both
|
|
38
|
+
sentences fit both registers (no page, no browser). The technical
|
|
39
|
+
sentence of the package or the edge stays in `error.message`.
|
|
40
|
+
`findErrorRule(kind, { code, outcome })` applies the code rules, then the
|
|
41
|
+
outcome rules, then `ERROR_RULES`. `pos-texts.json` carries
|
|
42
|
+
`errorCodeRules`, `errorOutcomeRules` and `callsWithEffect` next to
|
|
43
|
+
`errorRules`. `pos-message-cases.json` is at version 2: a case may carry
|
|
44
|
+
`error.code` (`api`) or `error.outcome` (`timeout`, `network`); the cases
|
|
45
|
+
without them are byte for byte those of rc.4. Reason: until 0.31 an HTML
|
|
46
|
+
answer was an HTTP error and showed `server.unexpected`; under 1.0 it is an
|
|
47
|
+
API error, and the register showed "Route fehlt: …" to the cashier.
|
|
48
|
+
- **Timeout and network error on a call with an effect never invite a
|
|
49
|
+
retry.** New `ERROR_OUTCOME_RULES`: with outcome `unknown`, `timeout` and
|
|
50
|
+
`network` show `network.outcome_unknown` ("Der Server hat nicht
|
|
51
|
+
geantwortet, der Vorgang kann trotzdem gebucht sein. Bitte vor einem neuen
|
|
52
|
+
Versuch prüfen, ob der letzte Vorgang schon gebucht ist."). New
|
|
53
|
+
`messageOutcome(error)` gives the outcome for the sentence: `unknown` when
|
|
54
|
+
`isOutcomeUnknown` says so, and after a timeout or network error on any
|
|
55
|
+
call in `CALLS_WITH_EFFECT` (the six with an unknown outcome, plus
|
|
56
|
+
`createPrintJob` and `sendReceiptEmail`); fetch fails the same way before
|
|
57
|
+
and after the request left, so the package cannot tell. Every other call
|
|
58
|
+
keeps the rc.4 sentence ("… und erneut versuchen."). Reason: after a
|
|
59
|
+
timeout the receipt, the card payment or the print job may already exist;
|
|
60
|
+
a retry could book or print it twice.
|
|
61
|
+
- **New labels:** `register.device_unnamed` ("Kasse", a device without a
|
|
62
|
+
name, `deviceLabel: null`), `login.locked_seconds` (`{seconds}` left of the
|
|
63
|
+
PIN lock), `split.remaining_with_rounding` (`{amount}`, `{cents}` with its
|
|
64
|
+
sign: the last round of a split payment takes the rounding cent). Reason:
|
|
65
|
+
the web register had to write these words itself.
|
|
66
|
+
- **`receiptDueCents` throws `ReceiptDueError`, not `RangeError`.** Code
|
|
67
|
+
`receipt_due_unavailable`, the cause in `reason` (`RECEIPT_DUE_ERROR_REASONS`,
|
|
68
|
+
e.g. `tip_without_goods` for a tip with an amount but no goods, also for a
|
|
69
|
+
staff tip), `outcome: 'rejected'`, guard `isReceiptDueError`. The cases are
|
|
70
|
+
in `fixtures/receipt-due-errors.json`. Every computed amount is unchanged
|
|
71
|
+
(the 1206 generated cases). Reason: a `RangeError` without a code could not
|
|
72
|
+
be told apart from a bug, and the register must say "not sent" before it
|
|
73
|
+
starts the card terminal.
|
|
74
|
+
- **`./stored`: `fromStoredLayout`, `toStoredLayout`, `fromStoredPrintLogo`,
|
|
75
|
+
`toStoredPrintLogo`.** The internal form of the receipt layout (`regelwerk`,
|
|
76
|
+
banner `ton` `belegart`/`warnung`) and of the print logo (`stufe`,
|
|
77
|
+
`pxBreite`, `pxHoehe`, `breite`, `hoehe`, `zeilen`) to 1.0 and back, checked
|
|
78
|
+
against all 40 golden layouts as 0.31.0 wrote them, byte for byte including
|
|
79
|
+
the key order. `fromStoredLayout` returns `null` for anything short of a
|
|
80
|
+
whole layout (no or empty `lines`, a line that is not an object, no
|
|
81
|
+
`paperSize`), so the caller rebuilds it with the `TESTKASSE` banner.
|
|
82
|
+
Reason: the web register
|
|
83
|
+
cache, the panel and the lab each carried their own copy.
|
|
84
|
+
- **`fromStoredReceipt` leaves English 1.0 values as they are** (a fixture
|
|
85
|
+
receipt with `cancellationReason: 'customer_cancelled'`). It did so
|
|
86
|
+
already; now it is promised and tested.
|
|
87
|
+
- **`fixtures/v3` refreshed** from the backend (71af3bf). Only the input
|
|
88
|
+
fingerprints in `_quelle` change (the client-version check of 29.09);
|
|
89
|
+
no name, value or code.
|
|
90
|
+
- **Contract versions:** a test holds the version in `surface.json`,
|
|
91
|
+
`pos-texts.json`, `invoice-texts.json`, `hobex-hps-codes.json` and
|
|
92
|
+
`invoice-api.schema.json` (and `PACKAGE_VERSION`, `package-lock.json`, this
|
|
93
|
+
file) to `package.json`.
|
|
94
|
+
|
|
22
95
|
### Migrating from 0.x
|
|
23
96
|
|
|
24
97
|
#### The 0.x line
|
|
@@ -147,6 +220,21 @@ an upgrade as long as `/v1` is served.
|
|
|
147
220
|
again. `setMyRegisterDeviceSettings` takes `shortcuts` only as the whole map
|
|
148
221
|
of known actions (as `posSettingsChanges` produces it): the server checks
|
|
149
222
|
keys bound twice only within the map it receives.
|
|
223
|
+
- **Money calls: an error envelope is not a rejection (1.0.0-rc.4).** On
|
|
224
|
+
`hobexPayApi`, `hobexRefundApi` and `stripeCaptureIntent` an error envelope
|
|
225
|
+
without a code is `outcome: 'unknown'`, and so is every code outside the
|
|
226
|
+
23 rejection codes, all raised before the provider is called: the
|
|
227
|
+
sign-in codes (`errorCodes.auth` without the seven of the partner
|
|
228
|
+
access), the edge codes `validation`, `not_found` and
|
|
229
|
+
`internal_translation_error`, the gates `module_inactive` and
|
|
230
|
+
`not_permitted`, and `route_missing`. `dialect_mismatch` and `response_translation_failed` (also
|
|
231
|
+
with `handled: false`) stay `'unknown'` there. rc.2 and rc.3 read an
|
|
232
|
+
envelope without a code as `'rejected'`, and the README called a retry
|
|
233
|
+
after `'rejected'` safe. Reason: the Hobex and Stripe handlers also answer
|
|
234
|
+
with a plain error message after the provider was called ("Error hobex
|
|
235
|
+
details", "Fehler beim Capturing"), so the card may be charged, the refund
|
|
236
|
+
paid or the payment captured. Same list as in the Dart twin
|
|
237
|
+
`kasseneck_api`.
|
|
150
238
|
- **Strict validation before sending.** The 0.x payment fields
|
|
151
239
|
(`paymentMethod`, `paymentMethodFromServer`, `creditCardProvider`,
|
|
152
240
|
`cardPaymentId`, `cardPaymentData`) throw, also from plain JavaScript.
|
package/README.md
CHANGED
|
@@ -133,6 +133,12 @@ is turnover, spread over the VAT rates of the goods and discounted with them,
|
|
|
133
133
|
while a staff tip goes untouched into the 0 % bucket. Only the register knows
|
|
134
134
|
which one applies, so the helper never guesses.
|
|
135
135
|
|
|
136
|
+
Input the amount cannot be computed from (a tip with an amount but no goods,
|
|
137
|
+
a tip on a null receipt, a missing `tipRecipient` …) throws a
|
|
138
|
+
`ReceiptDueError` with `code: 'receipt_due_unavailable'`, the cause in
|
|
139
|
+
`reason` (`RECEIPT_DUE_ERROR_REASONS`) and `outcome: 'rejected'`: nothing has
|
|
140
|
+
been sent. Tell the cashier before the card terminal is started.
|
|
141
|
+
|
|
136
142
|
## What a fiscal cash register in Austria must do
|
|
137
143
|
|
|
138
144
|
The obligation to use a fiscal cash register and to issue receipts is set out
|
|
@@ -427,10 +433,9 @@ silently. For a layout option of 0.x the message names its English successor.
|
|
|
427
433
|
### `outcome: 'unknown'`: never retry, look it up
|
|
428
434
|
|
|
429
435
|
`KasseneckApiError`, `KasseneckHttpError` and `KasseneckNetworkError` carry
|
|
430
|
-
`outcome`. `'rejected'` means
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
it helps depends on the code). `'unknown'` means the operation **may have been carried out**, for
|
|
436
|
+
`outcome`. `'rejected'` means the server turned the request down; whether
|
|
437
|
+
anything else is safe to do depends on the code, and on the money calls it
|
|
438
|
+
is only set for the codes listed below. `'unknown'` means the operation **may have been carried out**, for
|
|
434
439
|
`createReceipt` a signed receipt in the chain. Then never send it again: read
|
|
435
440
|
the result back (`getReceipt`, `listMyReceipts`, the original of a
|
|
436
441
|
cancellation) and continue from there. `isOutcomeUnknown(error)` covers all
|
|
@@ -448,13 +453,39 @@ three classes. The outcome is unknown for:
|
|
|
448
453
|
5xx, and HTTP 200 with the `Kasseneck-Api-Version: v3` marker but an empty,
|
|
449
454
|
non-JSON (also `text/html`) or status-less body (`KasseneckHttpError`,
|
|
450
455
|
`reason` `empty-body`, `not-json` or `missing-status`). HTML without the
|
|
451
|
-
marker stays `route_missing` with `'rejected'`: no function saw the call
|
|
456
|
+
marker stays `route_missing` with `'rejected'`: no function saw the call;
|
|
457
|
+
- on the money calls: every error envelope **without a code**, and every
|
|
458
|
+
code that is not one of the rejection codes below. The Hobex and Stripe
|
|
459
|
+
handlers also answer with a plain error message after the provider was
|
|
460
|
+
called, so an envelope alone does not prove that nothing happened.
|
|
461
|
+
|
|
462
|
+
On the money calls (`hobexPayApi`, `hobexRefundApi`, `stripeCaptureIntent`)
|
|
463
|
+
`outcome` is `'rejected'` only for codes that are produced before the
|
|
464
|
+
provider is called, taken from the `/v3` contract (`errorCodes`):
|
|
465
|
+
|
|
466
|
+
- the sign-in codes (`errorCodes.auth` without the seven of the partner
|
|
467
|
+
access, which never applies to these calls), raised before the handler
|
|
468
|
+
goes on: `method_not_allowed`, `validation` (a required field is missing
|
|
469
|
+
or has the wrong type), `cashregister_token_missing`,
|
|
470
|
+
`cashregister_token_invalid`, `cashregister_not_found`,
|
|
471
|
+
`account_not_found`, `live_not_enabled`, `unauthorized`, `mfa_required`,
|
|
472
|
+
`user_verification_failed`, `admin_required`, `register_user_not_allowed`,
|
|
473
|
+
`register_user_no_business`, `register_user_not_found`, `user_disabled`,
|
|
474
|
+
`session_expired`, `cashregister_not_assigned`,
|
|
475
|
+
`session_other_cashregister`;
|
|
476
|
+
- the edge codes that stop the call before the handler (`errorCodes.edge`):
|
|
477
|
+
`validation` (unknown fields), `not_found`, `internal_translation_error`;
|
|
478
|
+
- the module and permission gates: `module_inactive`, `not_permitted`;
|
|
479
|
+
- `route_missing` (set by the package: no function saw the call).
|
|
480
|
+
|
|
481
|
+
`dialect_mismatch` and `response_translation_failed` (also with
|
|
482
|
+
`handled: false`) stay `'unknown'` there: the handler may have run.
|
|
452
483
|
|
|
453
484
|
On the money calls an unknown outcome means the card may have been charged,
|
|
454
485
|
the refund may have gone through, the payment may have been captured. A
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
486
|
+
failed `hobexRefund` throws a `KasseneckApiError`; it never returns `false`,
|
|
487
|
+
because a `false` on an unclear outcome invites a second refund. Even a
|
|
488
|
+
`'rejected'` is no invitation to resend blindly: fix the cause first.
|
|
458
489
|
|
|
459
490
|
**Never retry these six calls, and never put a retrying layer under the
|
|
460
491
|
package.** A `fetch` passed in `options.fetch` (or a proxy or service worker in
|
|
@@ -778,6 +809,21 @@ the register's text catalogue (`MESSAGES`, `LABELS`, `messageText`,
|
|
|
778
809
|
`messageText('checkout.locked', { reason })`. The rendered German texts are
|
|
779
810
|
the same as in 0.x.
|
|
780
811
|
|
|
812
|
+
`ERROR_RULES` says which text a failed call shows, one rule per kind, the
|
|
813
|
+
same in both registers. `ERROR_CODE_RULES` (per `error.code`) and
|
|
814
|
+
`ERROR_OUTCOME_RULES` (per outcome) refine it; `findErrorRule(kind, { code,
|
|
815
|
+
outcome: messageOutcome(error) })` applies all three in that order. A timeout
|
|
816
|
+
or network error on a call with an effect (`CALLS_WITH_EFFECT`) shows
|
|
817
|
+
`network.outcome_unknown`, which never suggests a retry. The edge codes
|
|
818
|
+
show a plain German sentence instead of the package's technical sentence,
|
|
819
|
+
which stays in `error.message` for the log: `route_missing`, `not_found` and
|
|
820
|
+
`internal_translation_error` (nothing happened on the server)
|
|
821
|
+
`server.connection_disturbed`, which suggests trying again;
|
|
822
|
+
`dialect_mismatch`, `response_translation_failed` and `response_unreadable`
|
|
823
|
+
(outcome unknown) `server.response_unreadable`, which asks to reopen the
|
|
824
|
+
register and check whether the last operation was booked, and never
|
|
825
|
+
suggests a retry.
|
|
826
|
+
|
|
781
827
|
## Stored documents (`./stored`)
|
|
782
828
|
|
|
783
829
|
For clients that read Firestore directly, such as the admin panel. Stored
|
|
@@ -800,7 +846,20 @@ invalidStoredPosSettings({ betrieb, geraet }); // paths the server
|
|
|
800
846
|
```
|
|
801
847
|
|
|
802
848
|
`fromStoredReceipt`, `fromStoredCompany` and `fromStoredArticle` complete the
|
|
803
|
-
set. A broken document throws a `KasseneckValidationError`.
|
|
849
|
+
set. A broken document throws a `KasseneckValidationError`. `fromStoredReceipt`
|
|
850
|
+
also takes a receipt that already carries the English 1.0 values (for example
|
|
851
|
+
a fixture with `cancellationReason: 'customer_cancelled'`) and leaves them
|
|
852
|
+
as they are; the package keeps it that way.
|
|
853
|
+
|
|
854
|
+
The receipt layout and the print logo have an internal form as well: the
|
|
855
|
+
backend under `/api` and the 0.x browser cache use `regelwerk` for `ruleset`,
|
|
856
|
+
banner lines with `ton` (`belegart`, `warnung`) for `tone` (`receipt_type`,
|
|
857
|
+
`warning`), and a print logo with `stufe`, `pxBreite`, `pxHoehe`, `breite`,
|
|
858
|
+
`hoehe`, `zeilen`. `fromStoredLayout` reads either form and keeps the key
|
|
859
|
+
order (`null` for anything short of a whole layout: no or empty `lines`, a
|
|
860
|
+
line that is not an object, no `paperSize`; `receiptLayoutFromResult` then
|
|
861
|
+
rebuilds it), `toStoredLayout` writes the internal one, and
|
|
862
|
+
`fromStoredPrintLogo`/`toStoredPrintLogo` do the same for a `PrintLogo`. There is no
|
|
804
863
|
reader for stored invoices: the server computes the invoice view, so read it
|
|
805
864
|
with `getInvoice` and `listInvoices`.
|
|
806
865
|
|
|
@@ -1365,6 +1424,7 @@ in machine form what both sides agreed on, among them:
|
|
|
1365
1424
|
| `invoice-api.schema.json` | JSON Schema of the invoice API | `npm run fixtures:rechnung` |
|
|
1366
1425
|
| `pos-message-cases.json` | error cases and the message each one must show in both registers | by hand |
|
|
1367
1426
|
| `receipt-due-generated.json` | 1206 amounts due computed by the backend's own code, the reference for `receiptDueCents` | `node scripts/v3-zahlbetrag-generieren.mjs` |
|
|
1427
|
+
| `receipt-due-errors.json` | input the amount due cannot be computed from, with the `reason` of the `ReceiptDueError` each one throws | by hand |
|
|
1368
1428
|
| `v3/` | the backend's `/v3` contract (vocabulary, response cases, stored cases, amounts due), copied byte for byte | `node scripts/v3-vertrag-holen.mjs` |
|
|
1369
1429
|
| `renames-1.0.json` | everything in these files that changed from 0.x to 1.0: paths (`files`), text catalogue keys (`texts`), placeholders, structural keys (`structure`), machine values (`values`), shape changes (`shapes`); rendered texts are unchanged | `npm run fixtures:umbenennung` |
|
|
1370
1430
|
|
|
@@ -1372,9 +1432,10 @@ They are generated and never edited by hand. CI regenerates the register
|
|
|
1372
1432
|
settings and `surface.json` and fails if they differ from the committed
|
|
1373
1433
|
files; the test suite checks the others against the code.
|
|
1374
1434
|
|
|
1375
|
-
`surface.json`, `hobex-hps-codes.json`, `pos-texts.json
|
|
1376
|
-
`invoice-texts.json` carry the package version.
|
|
1377
|
-
regenerate them and commit them along**,
|
|
1435
|
+
`surface.json`, `hobex-hps-codes.json`, `pos-texts.json`,
|
|
1436
|
+
`invoice-texts.json` and `invoice-api.schema.json` carry the package version.
|
|
1437
|
+
**After every `npm version`, regenerate them and commit them along**,
|
|
1438
|
+
otherwise the tests fail (`test/versionen.test.ts`).
|
|
1378
1439
|
|
|
1379
1440
|
### And the other direction
|
|
1380
1441
|
|
|
@@ -110,6 +110,34 @@ export declare function fehlerDetails(daten: unknown, geheimnisse: readonly stri
|
|
|
110
110
|
* das Ergebnis nachlesen.
|
|
111
111
|
*/
|
|
112
112
|
export type ErrorOutcome = 'unknown' | 'rejected';
|
|
113
|
+
/**
|
|
114
|
+
* Codes, die auf einem Geldweg `outcome: 'rejected'` ergeben; jeder andere
|
|
115
|
+
* Code und eine Huelle ohne Code sind dort `'unknown'`. Aufgenommen ist nur,
|
|
116
|
+
* was entsteht, bevor das Backend den Zahlungsanbieter anspricht (Vertrag
|
|
117
|
+
* v3, `errorCodes`; dieselbe Liste wie `paymentCallRejectedCodes` im
|
|
118
|
+
* Dart-Zwilling):
|
|
119
|
+
*
|
|
120
|
+
* - `errorCodes.auth` ohne die sieben des Partner-Zugangs (18 Codes):
|
|
121
|
+
* Anmeldung und Pruefung in `checkRequest` laufen vor jeder Zeile des
|
|
122
|
+
* Handlers; `validation` heisst dort Pflichtfeld fehlt oder falscher Typ.
|
|
123
|
+
* Der Partner-Zugang trifft diese `api_key`-Aufrufe mit Kassen-Token nie.
|
|
124
|
+
* - aus `errorCodes.edge`: `not_found` (unbekannter Endpunkt, HTTP 404) und
|
|
125
|
+
* `internal_translation_error` (die Anfrage liess sich nicht uebersetzen,
|
|
126
|
+
* es wurde nichts ausgefuehrt); `validation` des Rands (unbekannte Felder,
|
|
127
|
+
* Rumpf ohne Objekt) steht schon oben.
|
|
128
|
+
* - `module_inactive` und `not_permitted`: das Modul- bzw. Rechte-Tor steht
|
|
129
|
+
* ebenfalls vor dem Anbieter.
|
|
130
|
+
* - `route_missing` (vergibt das Paket): HTML ohne `/v3`-Kennzeichen, keine
|
|
131
|
+
* Function hat den Aufruf gesehen.
|
|
132
|
+
*
|
|
133
|
+
* Nicht darin: `dialect_mismatch` (das Paket vergibt ihn auch, wenn ein Rand
|
|
134
|
+
* ohne `/v3` geantwortet hat, dessen Handler gelaufen sein kann) und
|
|
135
|
+
* `response_translation_failed` (der Handler lief; auch `handled: false`
|
|
136
|
+
* heisst nur, dass seine Antwort ein Fehler war, und der kann hinter dem
|
|
137
|
+
* Anbieteraufruf entstanden sein). Der Sammelfang der Handler ("Error hobex
|
|
138
|
+
* details", "Fehler beim Capturing") antwortet ohne Code.
|
|
139
|
+
*/
|
|
140
|
+
export declare const PAYMENT_CALL_REJECTED_CODES: readonly string[];
|
|
113
141
|
/**
|
|
114
142
|
* Codes, die das Paket selbst vergibt, nicht der Server: `route_missing`
|
|
115
143
|
* (HTML statt Backend, der Aufruf kam nie an) und `response_unreadable`
|
|
@@ -146,7 +174,10 @@ export declare class KasseneckApiError extends Error {
|
|
|
146
174
|
* `cancellation_outcome_unknown`, `response_unreadable` (Erfolg gemeldet,
|
|
147
175
|
* Antwort eines Aufrufs mit Wirkung aber unlesbar) und
|
|
148
176
|
* `response_translation_failed` (ausser mit `details.handled === false`);
|
|
149
|
-
* sonst `'rejected'`.
|
|
177
|
+
* sonst `'rejected'`. Auf den Geldwegen (`hobexPayApi`, `hobexRefundApi`,
|
|
178
|
+
* `stripeCaptureIntent`) umgekehrt: `'rejected'` nur mit einem Code aus
|
|
179
|
+
* [PAYMENT_CALL_REJECTED_CODES], ohne Code und mit jedem anderen Code
|
|
180
|
+
* `'unknown'`. Bei `'unknown'` nie wiederholen, sondern nachlesen.
|
|
150
181
|
*/
|
|
151
182
|
readonly outcome: ErrorOutcome;
|
|
152
183
|
constructor(functionName: string, serverMessage: string, details?: Record<string, unknown>, code?: string);
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
* als die Zusage.
|
|
74
74
|
*/
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
-
exports.KasseneckValidationError = exports.KasseneckAuthError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckApiError = exports.CLIENT_ERROR_CODES = void 0;
|
|
76
|
+
exports.KasseneckValidationError = exports.KasseneckAuthError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckApiError = exports.CLIENT_ERROR_CODES = exports.PAYMENT_CALL_REJECTED_CODES = void 0;
|
|
77
77
|
exports.causeDigest = causeDigest;
|
|
78
78
|
exports.fehlerDetails = fehlerDetails;
|
|
79
79
|
exports.isOutcomeUnknown = isOutcomeUnknown;
|
|
@@ -227,7 +227,77 @@ const AUSGANG_UNKLAR_CODES = new Set([
|
|
|
227
227
|
'cancellation_outcome_unknown',
|
|
228
228
|
'response_unreadable',
|
|
229
229
|
]);
|
|
230
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Aufrufe, die Geld bewegen: `hobexPayApi` belastet eine Karte,
|
|
232
|
+
* `hobexRefundApi` erstattet, `stripeCaptureIntent` zieht eine vorgemerkte
|
|
233
|
+
* Zahlung ein. Ihre Handler antworten auch NACH dem Anbieteraufruf mit einer
|
|
234
|
+
* Fehlerhuelle ohne Code ("Error hobex details", "Fehler beim Capturing");
|
|
235
|
+
* dort gilt darum umgekehrt: Ausgang unklar, ausser der Code belegt, dass der
|
|
236
|
+
* Anbieter nie gerufen wurde.
|
|
237
|
+
*/
|
|
238
|
+
const GELDWEGE = new Set(['hobexPayApi', 'hobexRefundApi', 'stripeCaptureIntent']);
|
|
239
|
+
/**
|
|
240
|
+
* Codes, die auf einem Geldweg `outcome: 'rejected'` ergeben; jeder andere
|
|
241
|
+
* Code und eine Huelle ohne Code sind dort `'unknown'`. Aufgenommen ist nur,
|
|
242
|
+
* was entsteht, bevor das Backend den Zahlungsanbieter anspricht (Vertrag
|
|
243
|
+
* v3, `errorCodes`; dieselbe Liste wie `paymentCallRejectedCodes` im
|
|
244
|
+
* Dart-Zwilling):
|
|
245
|
+
*
|
|
246
|
+
* - `errorCodes.auth` ohne die sieben des Partner-Zugangs (18 Codes):
|
|
247
|
+
* Anmeldung und Pruefung in `checkRequest` laufen vor jeder Zeile des
|
|
248
|
+
* Handlers; `validation` heisst dort Pflichtfeld fehlt oder falscher Typ.
|
|
249
|
+
* Der Partner-Zugang trifft diese `api_key`-Aufrufe mit Kassen-Token nie.
|
|
250
|
+
* - aus `errorCodes.edge`: `not_found` (unbekannter Endpunkt, HTTP 404) und
|
|
251
|
+
* `internal_translation_error` (die Anfrage liess sich nicht uebersetzen,
|
|
252
|
+
* es wurde nichts ausgefuehrt); `validation` des Rands (unbekannte Felder,
|
|
253
|
+
* Rumpf ohne Objekt) steht schon oben.
|
|
254
|
+
* - `module_inactive` und `not_permitted`: das Modul- bzw. Rechte-Tor steht
|
|
255
|
+
* ebenfalls vor dem Anbieter.
|
|
256
|
+
* - `route_missing` (vergibt das Paket): HTML ohne `/v3`-Kennzeichen, keine
|
|
257
|
+
* Function hat den Aufruf gesehen.
|
|
258
|
+
*
|
|
259
|
+
* Nicht darin: `dialect_mismatch` (das Paket vergibt ihn auch, wenn ein Rand
|
|
260
|
+
* ohne `/v3` geantwortet hat, dessen Handler gelaufen sein kann) und
|
|
261
|
+
* `response_translation_failed` (der Handler lief; auch `handled: false`
|
|
262
|
+
* heisst nur, dass seine Antwort ein Fehler war, und der kann hinter dem
|
|
263
|
+
* Anbieteraufruf entstanden sein). Der Sammelfang der Handler ("Error hobex
|
|
264
|
+
* details", "Fehler beim Capturing") antwortet ohne Code.
|
|
265
|
+
*/
|
|
266
|
+
exports.PAYMENT_CALL_REJECTED_CODES = Object.freeze([
|
|
267
|
+
// errorCodes.auth ohne Partner-Zugang
|
|
268
|
+
'method_not_allowed',
|
|
269
|
+
'validation',
|
|
270
|
+
'cashregister_token_missing',
|
|
271
|
+
'cashregister_token_invalid',
|
|
272
|
+
'cashregister_not_found',
|
|
273
|
+
'account_not_found',
|
|
274
|
+
'live_not_enabled',
|
|
275
|
+
'unauthorized',
|
|
276
|
+
'mfa_required',
|
|
277
|
+
'user_verification_failed',
|
|
278
|
+
'admin_required',
|
|
279
|
+
'register_user_not_allowed',
|
|
280
|
+
'register_user_no_business',
|
|
281
|
+
'register_user_not_found',
|
|
282
|
+
'user_disabled',
|
|
283
|
+
'session_expired',
|
|
284
|
+
'cashregister_not_assigned',
|
|
285
|
+
'session_other_cashregister',
|
|
286
|
+
// errorCodes.edge vor dem Handler (validation steht oben)
|
|
287
|
+
'not_found',
|
|
288
|
+
'internal_translation_error',
|
|
289
|
+
// Modul- und Rechte-Tor
|
|
290
|
+
'module_inactive',
|
|
291
|
+
'not_permitted',
|
|
292
|
+
// vom Paket vergeben
|
|
293
|
+
'route_missing',
|
|
294
|
+
]);
|
|
295
|
+
const GELDWEG_ABGELEHNT = new Set(exports.PAYMENT_CALL_REJECTED_CODES);
|
|
296
|
+
function ausgangAusCode(functionName, code, details) {
|
|
297
|
+
// `functionName` kann den Vorgang tragen (`financeWebService/<method>`).
|
|
298
|
+
if (GELDWEGE.has(functionName.split('/')[0])) {
|
|
299
|
+
return code !== undefined && GELDWEG_ABGELEHNT.has(code) ? 'rejected' : 'unknown';
|
|
300
|
+
}
|
|
231
301
|
if (code === undefined)
|
|
232
302
|
return 'rejected';
|
|
233
303
|
if (AUSGANG_UNKLAR_CODES.has(code))
|
|
@@ -271,7 +341,10 @@ class KasseneckApiError extends Error {
|
|
|
271
341
|
* `cancellation_outcome_unknown`, `response_unreadable` (Erfolg gemeldet,
|
|
272
342
|
* Antwort eines Aufrufs mit Wirkung aber unlesbar) und
|
|
273
343
|
* `response_translation_failed` (ausser mit `details.handled === false`);
|
|
274
|
-
* sonst `'rejected'`.
|
|
344
|
+
* sonst `'rejected'`. Auf den Geldwegen (`hobexPayApi`, `hobexRefundApi`,
|
|
345
|
+
* `stripeCaptureIntent`) umgekehrt: `'rejected'` nur mit einem Code aus
|
|
346
|
+
* [PAYMENT_CALL_REJECTED_CODES], ohne Code und mit jedem anderen Code
|
|
347
|
+
* `'unknown'`. Bei `'unknown'` nie wiederholen, sondern nachlesen.
|
|
275
348
|
*/
|
|
276
349
|
outcome;
|
|
277
350
|
constructor(functionName, serverMessage, details = {}, code) {
|
|
@@ -283,7 +356,7 @@ class KasseneckApiError extends Error {
|
|
|
283
356
|
// den Details. So bleibt die Klasse fuer beide Ablageorte dieselbe.
|
|
284
357
|
const kandidat = code !== undefined ? code : details['code'];
|
|
285
358
|
this.code = typeof kandidat === 'string' && BEZEICHNER.test(kandidat) ? kandidat : undefined;
|
|
286
|
-
this.outcome = ausgangAusCode(this.code, details);
|
|
359
|
+
this.outcome = ausgangAusCode(functionName, this.code, details);
|
|
287
360
|
}
|
|
288
361
|
}
|
|
289
362
|
exports.KasseneckApiError = KasseneckApiError;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ReceiptType, type ReceiptTypeKey, VatRate, type VatRateKey, KeckPaymentMethod, type KeckPaymentMethodKey, CreditCardProvider, type CreditCardProviderKey, VoucherType, type VoucherTypeKey, VoucherAction, type VoucherActionKey, StripeLinkMode, type StripeLinkModeKey, } from './enums/index.js';
|
|
2
2
|
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
|
|
3
3
|
export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type KasseneckTransport, type KasseneckBinaryTransport, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, downloadDailyReport, downloadMonthlyReport, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
|
|
4
|
-
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, receiptDueCents, receiptDueBreakdown, } from './receipt/due.js';
|
|
4
|
+
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, } from './receipt/due.js';
|
|
5
5
|
export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
|
|
6
6
|
export { type PosBusinessSettings, type PosDeviceSettings, type PosSettings, type ArticleGroup, type PosArticle, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, mergePosSettings, fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, distributeDiscount, cancelScopeOf, receiptsScopeOf, } from './pos/index.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromReceiptCompanyPayload = exports.remainingQuantities = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.receiptSumCents = exports.receiptSubSumCents = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = exports.StripeLinkMode = exports.VoucherAction = exports.VoucherType = exports.CreditCardProvider = exports.KeckPaymentMethod = exports.VatRate = exports.ReceiptType = void 0;
|
|
4
4
|
exports.listMyReceipts = exports.getFirstReceiptDate = exports.generateFullReceiptId = exports.getReceiptWithCompany = exports.getReceipt = exports.zeroReceipt = exports.cancelReceipt = exports.receiptLayoutFromResult = exports.cardRefundReference = exports.paymentsExpectedCents = exports.sellReceiptWithCompany = exports.sellReceipt = exports.isOutcomeUnknown = exports.isKasseneckValidationError = exports.isKasseneckNetworkError = exports.isKasseneckHttpError = exports.isKasseneckAuthError = exports.isKasseneckApiError = exports.CLIENT_ERROR_CODES = exports.KasseneckValidationError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckAuthError = exports.KasseneckApiError = exports.createBinaryTransport = exports.createTransport = exports.POS_CALLS = exports.PUBLIC_CALLS = exports.ALL_CALLS = exports.DEFAULT_TIMEOUT_MS = exports.POS_BASE_URL = exports.DEFAULT_BASE_URL = exports.registerUserAuth = exports.apiKeyAuth = exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = void 0;
|
|
5
|
-
exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.mergePosSettings = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.toViennaWallClock = exports.parseServerTimeStamp = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.downloadMonthlyReport = exports.downloadDailyReport = exports.sendReceiptEmail = exports.checkVoucherCombinationError = exports.listMyCashregisters = void 0;
|
|
5
|
+
exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.mergePosSettings = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.toViennaWallClock = exports.parseServerTimeStamp = exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.downloadMonthlyReport = exports.downloadDailyReport = exports.sendReceiptEmail = exports.checkVoucherCombinationError = exports.listMyCashregisters = void 0;
|
|
6
6
|
var index_js_1 = require("./enums/index.js");
|
|
7
7
|
Object.defineProperty(exports, "ReceiptType", { enumerable: true, get: function () { return index_js_1.ReceiptType; } });
|
|
8
8
|
Object.defineProperty(exports, "VatRate", { enumerable: true, get: function () { return index_js_1.VatRate; } });
|
|
@@ -118,6 +118,9 @@ Object.defineProperty(exports, "createKasseneckApi", { enumerable: true, get: fu
|
|
|
118
118
|
var due_js_1 = require("./receipt/due.js");
|
|
119
119
|
Object.defineProperty(exports, "receiptDueCents", { enumerable: true, get: function () { return due_js_1.receiptDueCents; } });
|
|
120
120
|
Object.defineProperty(exports, "receiptDueBreakdown", { enumerable: true, get: function () { return due_js_1.receiptDueBreakdown; } });
|
|
121
|
+
Object.defineProperty(exports, "ReceiptDueError", { enumerable: true, get: function () { return due_js_1.ReceiptDueError; } });
|
|
122
|
+
Object.defineProperty(exports, "RECEIPT_DUE_ERROR_REASONS", { enumerable: true, get: function () { return due_js_1.RECEIPT_DUE_ERROR_REASONS; } });
|
|
123
|
+
Object.defineProperty(exports, "isReceiptDueError", { enumerable: true, get: function () { return due_js_1.isReceiptDueError; } });
|
|
121
124
|
var vienna_time_js_1 = require("./vienna-time.js");
|
|
122
125
|
Object.defineProperty(exports, "parseServerTimeStamp", { enumerable: true, get: function () { return vienna_time_js_1.parseServerTimeStamp; } });
|
|
123
126
|
Object.defineProperty(exports, "toViennaWallClock", { enumerable: true, get: function () { return vienna_time_js_1.toViennaWallClock; } });
|
|
@@ -47,8 +47,9 @@ export interface HobexTransactionIdOptions {
|
|
|
47
47
|
* nicht.
|
|
48
48
|
*
|
|
49
49
|
* **Nie wiederholen.** Bei `isOutcomeUnknown(e)` (Netz, Zeitlimit, HTTP 5xx,
|
|
50
|
-
* unlesbare Antwort
|
|
51
|
-
*
|
|
50
|
+
* unlesbare Antwort, Fehlerhuelle ohne Code oder mit einem Code ausserhalb
|
|
51
|
+
* der Ablehnungscodes, README `outcome`) kann die Karte belastet sein: den Stand
|
|
52
|
+
* ueber die Transaktionskennung nachlesen, nicht ein zweites Mal belasten.
|
|
52
53
|
*/
|
|
53
54
|
export declare function hobexPay(transport: InternerTransport, options: HobexPayOptions): Promise<HobexReceipt>;
|
|
54
55
|
/**
|
|
@@ -62,8 +63,10 @@ export declare function hobexPay(transport: InternerTransport, options: HobexPay
|
|
|
62
63
|
* Wahrheitswert waere hier also immer `true` — eine Luege ueber den
|
|
63
64
|
* Informationsgehalt, an der ein Aufrufer ein `if` aufhaengt, das nie greift.
|
|
64
65
|
* Misserfolg kommt als geworfener Fehler: eine Fehlerhuelle als
|
|
65
|
-
* [KasseneckApiError]
|
|
66
|
-
*
|
|
66
|
+
* [KasseneckApiError], `'rejected'` nur mit einem der Ablehnungscodes
|
|
67
|
+
* (README `outcome`); ohne Code oder mit anderem Code, bei Netz,
|
|
68
|
+
* Zeitlimit, HTTP 5xx und unlesbarer Erfolgsantwort `outcome: 'unknown'`
|
|
69
|
+
* (die Erstattung kann gelaufen sein).
|
|
67
70
|
* Ein `false` an dieser Stelle luede zum zweiten Versuch ein, also zur
|
|
68
71
|
* doppelten Erstattung. **Nie wiederholen**, sondern den Stand nachlesen.
|
|
69
72
|
*
|
|
@@ -43,8 +43,9 @@ const ENDPUNKT_REFUND = 'hobexRefundApi';
|
|
|
43
43
|
* nicht.
|
|
44
44
|
*
|
|
45
45
|
* **Nie wiederholen.** Bei `isOutcomeUnknown(e)` (Netz, Zeitlimit, HTTP 5xx,
|
|
46
|
-
* unlesbare Antwort
|
|
47
|
-
*
|
|
46
|
+
* unlesbare Antwort, Fehlerhuelle ohne Code oder mit einem Code ausserhalb
|
|
47
|
+
* der Ablehnungscodes, README `outcome`) kann die Karte belastet sein: den Stand
|
|
48
|
+
* ueber die Transaktionskennung nachlesen, nicht ein zweites Mal belasten.
|
|
48
49
|
*/
|
|
49
50
|
async function hobexPay(transport, options) {
|
|
50
51
|
const params = zahlungsNutzlast(ENDPUNKT_PAY, options);
|
|
@@ -69,8 +70,10 @@ async function hobexPay(transport, options) {
|
|
|
69
70
|
* Wahrheitswert waere hier also immer `true` — eine Luege ueber den
|
|
70
71
|
* Informationsgehalt, an der ein Aufrufer ein `if` aufhaengt, das nie greift.
|
|
71
72
|
* Misserfolg kommt als geworfener Fehler: eine Fehlerhuelle als
|
|
72
|
-
* [KasseneckApiError]
|
|
73
|
-
*
|
|
73
|
+
* [KasseneckApiError], `'rejected'` nur mit einem der Ablehnungscodes
|
|
74
|
+
* (README `outcome`); ohne Code oder mit anderem Code, bei Netz,
|
|
75
|
+
* Zeitlimit, HTTP 5xx und unlesbarer Erfolgsantwort `outcome: 'unknown'`
|
|
76
|
+
* (die Erstattung kann gelaufen sein).
|
|
74
77
|
* Ein `false` an dieser Stelle luede zum zweiten Versuch ein, also zur
|
|
75
78
|
* doppelten Erstattung. **Nie wiederholen**, sondern den Stand nachlesen.
|
|
76
79
|
*
|
|
@@ -59,6 +59,8 @@ export declare function createStripeLink(transport: InternerTransport, options:
|
|
|
59
59
|
* Pflichtparameter.
|
|
60
60
|
*
|
|
61
61
|
* **Nie wiederholen.** Bei `isOutcomeUnknown(e)` (Netz, Zeitlimit, HTTP 5xx,
|
|
62
|
-
* unlesbare Antwort
|
|
62
|
+
* unlesbare Antwort, Fehlerhuelle ohne Code oder mit einem Code ausserhalb
|
|
63
|
+
* der Ablehnungscodes, README `outcome`) kann der Einzug gelaufen sein: den Stand
|
|
64
|
+
* nachlesen.
|
|
63
65
|
*/
|
|
64
66
|
export declare function stripeCaptureIntent(transport: InternerTransport, stripeSessionId: string): Promise<StripeCaptureResult>;
|
|
@@ -74,7 +74,9 @@ async function createStripeLink(transport, options) {
|
|
|
74
74
|
* Pflichtparameter.
|
|
75
75
|
*
|
|
76
76
|
* **Nie wiederholen.** Bei `isOutcomeUnknown(e)` (Netz, Zeitlimit, HTTP 5xx,
|
|
77
|
-
* unlesbare Antwort
|
|
77
|
+
* unlesbare Antwort, Fehlerhuelle ohne Code oder mit einem Code ausserhalb
|
|
78
|
+
* der Ablehnungscodes, README `outcome`) kann der Einzug gelaufen sein: den Stand
|
|
79
|
+
* nachlesen.
|
|
78
80
|
*/
|
|
79
81
|
async function stripeCaptureIntent(transport, stripeSessionId) {
|
|
80
82
|
if (typeof stripeSessionId !== 'string' || !stripeSessionId.trim()) {
|
package/dist/cjs/pos/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export { distributeDiscount } from '../receipt/discount.js';
|
|
|
12
12
|
export { cancelScopeOf, receiptsScopeOf, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
13
13
|
export { type NetworkPrinter, type PrintJob, type PrintJobStatus, PRINT_JOB_STATUSES, type PrintJobSource, PRINT_JOB_SOURCES, isPrintJobFinished, type CreatePrintJobOptions, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
14
14
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
15
|
-
export { MESSAGES, ERROR_RULES, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, LABELS, labelText, type TextEntry, type MessageKey, type ErrorKind, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
15
|
+
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, LABELS, labelText, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
package/dist/cjs/pos/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPosSettings = 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 = 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.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.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = void 0;
|
|
4
|
-
exports.labelText = exports.LABELS = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.ERROR_RULES = exports.MESSAGES = exports.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = 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 = void 0;
|
|
4
|
+
exports.labelText = exports.LABELS = 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.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = 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 = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
|
|
7
7
|
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger. Die Aufrufe heissen 1:1 wie
|
|
@@ -92,6 +92,11 @@ Object.defineProperty(exports, "listMyTipRecipients", { enumerable: true, get: f
|
|
|
92
92
|
var texte_js_1 = require("./texte.js");
|
|
93
93
|
Object.defineProperty(exports, "MESSAGES", { enumerable: true, get: function () { return texte_js_1.MESSAGES; } });
|
|
94
94
|
Object.defineProperty(exports, "ERROR_RULES", { enumerable: true, get: function () { return texte_js_1.ERROR_RULES; } });
|
|
95
|
+
Object.defineProperty(exports, "ERROR_CODE_RULES", { enumerable: true, get: function () { return texte_js_1.ERROR_CODE_RULES; } });
|
|
96
|
+
Object.defineProperty(exports, "ERROR_OUTCOME_RULES", { enumerable: true, get: function () { return texte_js_1.ERROR_OUTCOME_RULES; } });
|
|
97
|
+
Object.defineProperty(exports, "CALLS_WITH_EFFECT", { enumerable: true, get: function () { return texte_js_1.CALLS_WITH_EFFECT; } });
|
|
98
|
+
Object.defineProperty(exports, "findErrorRule", { enumerable: true, get: function () { return texte_js_1.findErrorRule; } });
|
|
99
|
+
Object.defineProperty(exports, "messageOutcome", { enumerable: true, get: function () { return texte_js_1.messageOutcome; } });
|
|
95
100
|
Object.defineProperty(exports, "messageText", { enumerable: true, get: function () { return texte_js_1.messageText; } });
|
|
96
101
|
Object.defineProperty(exports, "messageAppliesTo", { enumerable: true, get: function () { return texte_js_1.messageAppliesTo; } });
|
|
97
102
|
Object.defineProperty(exports, "RECEIPT_EMAIL_ERROR_MESSAGES", { enumerable: true, get: function () { return texte_js_1.RECEIPT_EMAIL_ERROR_MESSAGES; } });
|