@kreiseck/kasseneck-api 1.17.1 → 1.18.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 +24 -0
- package/dist/cjs/client/list-receipts.d.ts +3 -0
- package/dist/cjs/client/list-receipts.js +6 -0
- package/dist/cjs/client/receipts.d.ts +6 -0
- package/dist/cjs/client/receipts.js +6 -0
- package/dist/cjs/models/index.d.ts +1 -0
- package/dist/cjs/models/index.js +6 -1
- package/dist/cjs/models/manual-receipt.d.ts +45 -0
- package/dist/cjs/models/manual-receipt.js +58 -0
- package/dist/cjs/models/receipt-summary.d.ts +4 -0
- package/dist/cjs/models/receipt-summary.js +6 -0
- package/dist/cjs/models/receipt.d.ts +4 -0
- package/dist/cjs/models/receipt.js +6 -0
- package/dist/cjs/receipt/layout.js +57 -0
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +23 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/list-receipts.d.ts +3 -0
- package/dist/esm/client/list-receipts.js +6 -0
- package/dist/esm/client/receipts.d.ts +6 -0
- package/dist/esm/client/receipts.js +6 -0
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/manual-receipt.d.ts +45 -0
- package/dist/esm/models/manual-receipt.js +53 -0
- package/dist/esm/models/receipt-summary.d.ts +4 -0
- package/dist/esm/models/receipt-summary.js +6 -0
- package/dist/esm/models/receipt.d.ts +4 -0
- package/dist/esm/models/receipt.js +6 -0
- package/dist/esm/receipt/layout.js +57 -0
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +23 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/expected/manual-receipt-range-device-failure-count.grid32.txt +36 -0
- package/fixtures/expected/manual-receipt-range-device-failure-count.grid48.txt +36 -0
- package/fixtures/expected/manual-receipt-range-device-failure-count.lines.json +299 -0
- package/fixtures/expected/manual-receipt-range-device-failure-count.sheet32.json +242 -0
- package/fixtures/expected/manual-receipt-range-device-failure-count.sheet48.json +242 -0
- package/fixtures/expected/manual-receipt-range-device-failure-no-count.grid32.txt +36 -0
- package/fixtures/expected/manual-receipt-range-device-failure-no-count.grid48.txt +36 -0
- package/fixtures/expected/manual-receipt-range-device-failure-no-count.lines.json +299 -0
- package/fixtures/expected/manual-receipt-range-device-failure-no-count.sheet32.json +242 -0
- package/fixtures/expected/manual-receipt-range-device-failure-no-count.sheet48.json +242 -0
- package/fixtures/expected/manual-receipt-range-network-outage-count.grid32.txt +33 -0
- package/fixtures/expected/manual-receipt-range-network-outage-count.grid48.txt +33 -0
- package/fixtures/expected/manual-receipt-range-network-outage-count.lines.json +259 -0
- package/fixtures/expected/manual-receipt-range-network-outage-count.sheet32.json +224 -0
- package/fixtures/expected/manual-receipt-range-network-outage-count.sheet48.json +224 -0
- package/fixtures/expected/manual-receipt-range-network-outage-no-count.grid32.txt +33 -0
- package/fixtures/expected/manual-receipt-range-network-outage-no-count.grid48.txt +33 -0
- package/fixtures/expected/manual-receipt-range-network-outage-no-count.lines.json +259 -0
- package/fixtures/expected/manual-receipt-range-network-outage-no-count.sheet32.json +224 -0
- package/fixtures/expected/manual-receipt-range-network-outage-no-count.sheet48.json +224 -0
- package/fixtures/expected/manual-receipt-range-other-count.grid32.txt +36 -0
- package/fixtures/expected/manual-receipt-range-other-count.grid48.txt +36 -0
- package/fixtures/expected/manual-receipt-range-other-count.lines.json +299 -0
- package/fixtures/expected/manual-receipt-range-other-count.sheet32.json +242 -0
- package/fixtures/expected/manual-receipt-range-other-count.sheet48.json +242 -0
- package/fixtures/expected/manual-receipt-range-other-no-count.grid32.txt +36 -0
- package/fixtures/expected/manual-receipt-range-other-no-count.grid48.txt +36 -0
- package/fixtures/expected/manual-receipt-range-other-no-count.lines.json +299 -0
- package/fixtures/expected/manual-receipt-range-other-no-count.sheet32.json +242 -0
- package/fixtures/expected/manual-receipt-range-other-no-count.sheet48.json +242 -0
- package/fixtures/expected/manual-receipt-range-power-outage-count.grid32.txt +37 -0
- package/fixtures/expected/manual-receipt-range-power-outage-count.grid48.txt +37 -0
- package/fixtures/expected/manual-receipt-range-power-outage-count.lines.json +305 -0
- package/fixtures/expected/manual-receipt-range-power-outage-count.sheet32.json +248 -0
- package/fixtures/expected/manual-receipt-range-power-outage-count.sheet48.json +248 -0
- package/fixtures/expected/manual-receipt-range-power-outage-no-count.grid32.txt +37 -0
- package/fixtures/expected/manual-receipt-range-power-outage-no-count.grid48.txt +37 -0
- package/fixtures/expected/manual-receipt-range-power-outage-no-count.lines.json +305 -0
- package/fixtures/expected/manual-receipt-range-power-outage-no-count.sheet32.json +248 -0
- package/fixtures/expected/manual-receipt-range-power-outage-no-count.sheet48.json +248 -0
- package/fixtures/expected/manual-receipt-range-system-outage-count.grid32.txt +33 -0
- package/fixtures/expected/manual-receipt-range-system-outage-count.grid48.txt +33 -0
- package/fixtures/expected/manual-receipt-range-system-outage-count.lines.json +259 -0
- package/fixtures/expected/manual-receipt-range-system-outage-count.sheet32.json +224 -0
- package/fixtures/expected/manual-receipt-range-system-outage-count.sheet48.json +224 -0
- package/fixtures/expected/manual-receipt-range-system-outage-no-count.grid32.txt +33 -0
- package/fixtures/expected/manual-receipt-range-system-outage-no-count.grid48.txt +33 -0
- package/fixtures/expected/manual-receipt-range-system-outage-no-count.lines.json +259 -0
- package/fixtures/expected/manual-receipt-range-system-outage-no-count.sheet32.json +224 -0
- package/fixtures/expected/manual-receipt-range-system-outage-no-count.sheet48.json +224 -0
- package/fixtures/expected/manual-receipt-single-device-failure-no-time.grid32.txt +31 -0
- package/fixtures/expected/manual-receipt-single-device-failure-no-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-device-failure-no-time.lines.json +253 -0
- package/fixtures/expected/manual-receipt-single-device-failure-no-time.sheet32.json +212 -0
- package/fixtures/expected/manual-receipt-single-device-failure-no-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-device-failure-time.grid32.txt +31 -0
- package/fixtures/expected/manual-receipt-single-device-failure-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-device-failure-time.lines.json +253 -0
- package/fixtures/expected/manual-receipt-single-device-failure-time.sheet32.json +212 -0
- package/fixtures/expected/manual-receipt-single-device-failure-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-network-outage-no-time.grid32.txt +32 -0
- package/fixtures/expected/manual-receipt-single-network-outage-no-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-network-outage-no-time.lines.json +253 -0
- package/fixtures/expected/manual-receipt-single-network-outage-no-time.sheet32.json +218 -0
- package/fixtures/expected/manual-receipt-single-network-outage-no-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-network-outage-time.grid32.txt +32 -0
- package/fixtures/expected/manual-receipt-single-network-outage-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-network-outage-time.lines.json +253 -0
- package/fixtures/expected/manual-receipt-single-network-outage-time.sheet32.json +218 -0
- package/fixtures/expected/manual-receipt-single-network-outage-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-other-no-time.grid32.txt +35 -0
- package/fixtures/expected/manual-receipt-single-other-no-time.grid48.txt +34 -0
- package/fixtures/expected/manual-receipt-single-other-no-time.lines.json +299 -0
- package/fixtures/expected/manual-receipt-single-other-no-time.sheet32.json +236 -0
- package/fixtures/expected/manual-receipt-single-other-no-time.sheet48.json +230 -0
- package/fixtures/expected/manual-receipt-single-other-time.grid32.txt +35 -0
- package/fixtures/expected/manual-receipt-single-other-time.grid48.txt +34 -0
- package/fixtures/expected/manual-receipt-single-other-time.lines.json +299 -0
- package/fixtures/expected/manual-receipt-single-other-time.sheet32.json +236 -0
- package/fixtures/expected/manual-receipt-single-other-time.sheet48.json +230 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-no-time.grid32.txt +31 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-no-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-no-time.lines.json +247 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-no-time.sheet32.json +212 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-no-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-time.grid32.txt +31 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-time.lines.json +247 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-time.sheet32.json +212 -0
- package/fixtures/expected/manual-receipt-single-outside-premises-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-power-outage-no-time.grid32.txt +35 -0
- package/fixtures/expected/manual-receipt-single-power-outage-no-time.grid48.txt +34 -0
- package/fixtures/expected/manual-receipt-single-power-outage-no-time.lines.json +299 -0
- package/fixtures/expected/manual-receipt-single-power-outage-no-time.sheet32.json +236 -0
- package/fixtures/expected/manual-receipt-single-power-outage-no-time.sheet48.json +230 -0
- package/fixtures/expected/manual-receipt-single-power-outage-time.grid32.txt +35 -0
- package/fixtures/expected/manual-receipt-single-power-outage-time.grid48.txt +34 -0
- package/fixtures/expected/manual-receipt-single-power-outage-time.lines.json +299 -0
- package/fixtures/expected/manual-receipt-single-power-outage-time.sheet32.json +236 -0
- package/fixtures/expected/manual-receipt-single-power-outage-time.sheet48.json +230 -0
- package/fixtures/expected/manual-receipt-single-small-business.grid32.txt +34 -0
- package/fixtures/expected/manual-receipt-single-small-business.grid48.txt +33 -0
- package/fixtures/expected/manual-receipt-single-small-business.lines.json +257 -0
- package/fixtures/expected/manual-receipt-single-small-business.sheet32.json +230 -0
- package/fixtures/expected/manual-receipt-single-small-business.sheet48.json +224 -0
- package/fixtures/expected/manual-receipt-single-system-outage-no-time.grid32.txt +32 -0
- package/fixtures/expected/manual-receipt-single-system-outage-no-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-system-outage-no-time.lines.json +253 -0
- package/fixtures/expected/manual-receipt-single-system-outage-no-time.sheet32.json +218 -0
- package/fixtures/expected/manual-receipt-single-system-outage-no-time.sheet48.json +212 -0
- package/fixtures/expected/manual-receipt-single-system-outage-time.grid32.txt +32 -0
- package/fixtures/expected/manual-receipt-single-system-outage-time.grid48.txt +31 -0
- package/fixtures/expected/manual-receipt-single-system-outage-time.lines.json +253 -0
- package/fixtures/expected/manual-receipt-single-system-outage-time.sheet32.json +218 -0
- package/fixtures/expected/manual-receipt-single-system-outage-time.sheet48.json +212 -0
- package/fixtures/expected/zero-outage-end-period.grid32.txt +35 -0
- package/fixtures/expected/zero-outage-end-period.grid48.txt +31 -0
- package/fixtures/expected/zero-outage-end-period.lines.json +230 -0
- package/fixtures/expected/zero-outage-end-period.sheet32.json +236 -0
- package/fixtures/expected/zero-outage-end-period.sheet48.json +212 -0
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/manifest.json +192 -0
- package/fixtures/pos-texts.json +1 -1
- package/fixtures/receipts/manual-receipt-range-device-failure-count.json +56 -0
- package/fixtures/receipts/manual-receipt-range-device-failure-no-count.json +55 -0
- package/fixtures/receipts/manual-receipt-range-network-outage-count.json +50 -0
- package/fixtures/receipts/manual-receipt-range-network-outage-no-count.json +49 -0
- package/fixtures/receipts/manual-receipt-range-other-count.json +57 -0
- package/fixtures/receipts/manual-receipt-range-other-no-count.json +56 -0
- package/fixtures/receipts/manual-receipt-range-power-outage-count.json +56 -0
- package/fixtures/receipts/manual-receipt-range-power-outage-no-count.json +55 -0
- package/fixtures/receipts/manual-receipt-range-system-outage-count.json +50 -0
- package/fixtures/receipts/manual-receipt-range-system-outage-no-count.json +49 -0
- package/fixtures/receipts/manual-receipt-single-device-failure-no-time.json +48 -0
- package/fixtures/receipts/manual-receipt-single-device-failure-time.json +49 -0
- package/fixtures/receipts/manual-receipt-single-network-outage-no-time.json +49 -0
- package/fixtures/receipts/manual-receipt-single-network-outage-time.json +50 -0
- package/fixtures/receipts/manual-receipt-single-other-no-time.json +55 -0
- package/fixtures/receipts/manual-receipt-single-other-time.json +56 -0
- package/fixtures/receipts/manual-receipt-single-outside-premises-no-time.json +48 -0
- package/fixtures/receipts/manual-receipt-single-outside-premises-time.json +49 -0
- package/fixtures/receipts/manual-receipt-single-power-outage-no-time.json +54 -0
- package/fixtures/receipts/manual-receipt-single-power-outage-time.json +55 -0
- package/fixtures/receipts/manual-receipt-single-small-business.json +48 -0
- package/fixtures/receipts/manual-receipt-single-system-outage-no-time.json +49 -0
- package/fixtures/receipts/manual-receipt-single-system-outage-time.json +50 -0
- package/fixtures/receipts/zero-outage-end-period.json +43 -0
- package/fixtures/surface.json +1 -1
- package/fixtures/v3/antworten/belege.json +481 -3
- package/fixtures/v3/antworten/belegmail.json +2 -2
- package/fixtures/v3/antworten/berichte.json +2 -2
- package/fixtures/v3/antworten/kasse-belege.json +433 -3
- package/fixtures/v3/antworten/kasse.json +3 -3
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +2 -2
- package/fixtures/v3/antworten/storno.json +2 -2
- package/fixtures/v3/stored/belege.json +57 -3
- package/fixtures/v3/stored/kasse.json +3 -3
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +175 -9
- package/fixtures/v3/zahlbetrag-faelle.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ 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.18.0 - 2026-10-30
|
|
8
|
+
|
|
9
|
+
Recording handwritten receipts (Nacherfassung). After a register outage or a sale outside the premises the business
|
|
10
|
+
writes paper receipts and records them in the register later; the receipt now carries the reference. Additive.
|
|
11
|
+
|
|
12
|
+
- **`manualReceipt` on `createReceipt`/`sellReceipt` and on `Receipt`, `ReceiptSummary` and the `listReceipts` summary:**
|
|
13
|
+
`number` (the paper pad's own number range, never the next register number), optional `numberTo` and `count` (daily
|
|
14
|
+
summary receipt, only after an outage), `date` (`YYYY-MM-DD`, Vienna day), optional `time` (`HH:MM`), `reason`
|
|
15
|
+
(`MANUAL_RECEIPT_REASONS`: `network_outage`, `power_outage`, `device_failure`, `system_outage`, `other` with `note`,
|
|
16
|
+
`outside_premises`). Only on `standard`; the package throws before sending otherwise. The server checks everything
|
|
17
|
+
else. The receipt's own `timeStamp` stays the time of recording (no backdating). `readManualReceipt` reads the field.
|
|
18
|
+
- **Error codes `MANUAL_RECEIPT_ERROR_CODES`** (contract `errorCodes.manualReceipt`): `invalid_manual_receipt`,
|
|
19
|
+
`manual_receipt_not_allowed`, `manual_receipt_date_in_future`, `manual_receipt_range_not_allowed`,
|
|
20
|
+
`manual_receipt_duplicate` (same number or overlapping range on the same day and register; `details.receiptId`
|
|
21
|
+
names the receipt that already recorded it), with `isManualReceiptErrorCode`.
|
|
22
|
+
- **Receipt block „NACHERFASSUNG“** below the business header: kind (after a register outage / sale outside the
|
|
23
|
+
premises), reason, number and day of the paper receipt or range and count of the daily summary, and
|
|
24
|
+
„USt: Duplikat …“ (BMF cash register decree, 3.3 and 2.4.11; not for small businesses). 23 new golden receipts `manual-receipt-*`.
|
|
25
|
+
- **Zero receipt after a signature outage** (`zeroKind: outage_end`) prints start and end of the outage from
|
|
26
|
+
`legalMessage` before the QR code; the decree (3.6.1) requires them on the receipt. New golden `zero-outage-end-period`,
|
|
27
|
+
all existing goldens unchanged.
|
|
28
|
+
- Contract re-fetched from the backend (vendored package 0.36.0): new cases `sale_manual_receipt` and
|
|
29
|
+
`error_manual_receipt_duplicate`, catalog `HANDBELEG_GRUND`; print digests of the two new server layouts recorded.
|
|
30
|
+
|
|
7
31
|
## 1.17.1 - 2026-10-29
|
|
8
32
|
|
|
9
33
|
- **Contract `v3` gains `fixtures/v3/antworten/berichte.json`** (backend keck#798): `getCashregisterReport` as a binary path, generated from the real handler. A case with `file` is the PDF (HTTP 200, `Content-Type: application/pdf`, the bytes start with `file.startsWith`); every rejection also comes with HTTP 200, as an envelope with a code (`period_not_closed` for the current month and today, `period_in_future`, `invalid_period`). New test `test/v3-berichte-vertrag.test.ts` replays the file through `createBinaryTransport`: the PDF arrives byte for byte, each rejection is a `KasseneckApiError` with the code of the contract and outcome `rejected`. No behaviour change: the binary path always decided on the first bytes. Reason: the Dart twin returned such an envelope as PDF bytes up to 11.8.0 (fixed in 11.8.1); with the case in the contract both packages and the backend are pinned to the same answer, and the Dart twin replays this file too.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeckPaymentMethod, ReceiptType } from '../enums/index.js';
|
|
2
2
|
import { type CancellationReason, type CancellationStatus, type Receipt, type ReceiptPayment, type ZeroKind } from '../models/index.js';
|
|
3
3
|
import type { ReportV2Metadata } from './reports.js';
|
|
4
|
+
import { type ManualReceipt } from '../models/manual-receipt.js';
|
|
4
5
|
import type { InternerTransport } from './aufrufe.js';
|
|
5
6
|
/**
|
|
6
7
|
* Belege einer Kasse auflisten (`listReceipts`, nur unter `/v3`): ein Tag oder
|
|
@@ -143,6 +144,8 @@ export interface ListReceiptsSummary {
|
|
|
143
144
|
customProjectId: string | null;
|
|
144
145
|
/** Schluessel fuer `downloadReceipt` und den Beleg-Link, oder `null`. */
|
|
145
146
|
fullReceiptId: string | null;
|
|
147
|
+
/** Nur an nacherfassten Belegen: der Handbeleg. */
|
|
148
|
+
manualReceipt?: ManualReceipt;
|
|
146
149
|
}
|
|
147
150
|
/** Ein Beleg der Liste je Ansicht: `full` das Belegdokument wie bei `getReportV2`, sonst die Zeile. */
|
|
148
151
|
export type ListedReceipt<V extends ListReceiptsView = 'summary'> = V extends 'full' ? Receipt : ListReceiptsSummary;
|
|
@@ -7,6 +7,7 @@ exports.listAllReceipts = listAllReceipts;
|
|
|
7
7
|
const index_js_1 = require("../enums/index.js");
|
|
8
8
|
const index_js_2 = require("../models/index.js");
|
|
9
9
|
const enum_payload_js_1 = require("../models/enum-payload.js");
|
|
10
|
+
const manual_receipt_js_1 = require("../models/manual-receipt.js");
|
|
10
11
|
const errors_js_1 = require("./errors.js");
|
|
11
12
|
/**
|
|
12
13
|
* Belege einer Kasse auflisten (`listReceipts`, nur unter `/v3`): ein Tag oder
|
|
@@ -163,6 +164,10 @@ const istObjekt = (w) => w != null && typeof w === 'object' && !Array.isArray(w)
|
|
|
163
164
|
const text = (w) => (typeof w === 'string' ? w : null);
|
|
164
165
|
// Ganze Cent; ein einzelner unbrauchbarer Betrag laesst die Liste nicht scheitern.
|
|
165
166
|
const cent = (w) => (typeof w === 'number' && Number.isInteger(w) ? w : 0);
|
|
167
|
+
function handbelegFeld(roh) {
|
|
168
|
+
const manualReceipt = (0, manual_receipt_js_1.readManualReceipt)(roh);
|
|
169
|
+
return manualReceipt ? { manualReceipt } : {};
|
|
170
|
+
}
|
|
166
171
|
function istStornoStand(w) {
|
|
167
172
|
return typeof w === 'string' && index_js_2.CANCELLATION_STATUSES.includes(w);
|
|
168
173
|
}
|
|
@@ -197,6 +202,7 @@ function fromListReceiptsSummaryPayload(payload) {
|
|
|
197
202
|
signatureOk: payload['signatureOk'] !== false,
|
|
198
203
|
customProjectId: text(payload['customProjectId']),
|
|
199
204
|
fullReceiptId: text(payload['fullReceiptId']),
|
|
205
|
+
...handbelegFeld(payload['manualReceipt']),
|
|
200
206
|
};
|
|
201
207
|
}
|
|
202
208
|
function tagessumme(roh) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReceiptType, type ReceiptTypeKey, KeckPaymentMethod, type KeckPaymentMethodKey } from '../enums/index.js';
|
|
2
|
+
import type { ManualReceipt } from '../models/manual-receipt.js';
|
|
2
3
|
import { type Receipt, type ReceiptCompany, type ReceiptItem, type Voucher, type ReceiptSummary, type ReportMonth, type CancellationItem, type CancellationOf, type CancellationReason, type TipRefundSource, type ReturnDisposition, type ReceiptPaymentInput, type RegistrationInfo, type ReceiptEmailVia } from '../models/index.js';
|
|
3
4
|
import { type ReceiptOutput, type ReceiptOutputEntryErrorCode, type ReceiptOutputLogKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
4
5
|
import type { InternerTransport } from './aufrufe.js';
|
|
@@ -43,6 +44,11 @@ export interface ReceiptCommonOptions {
|
|
|
43
44
|
legalMessage?: string[];
|
|
44
45
|
/** Freier Bezeichner des Aufrufers (Projekt, Auftrag, Schicht). */
|
|
45
46
|
customProjectId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Nacherfassung eines Handbelegs (siehe [ManualReceipt]); nur bei
|
|
49
|
+
* `standard`. Geprueft wird am Server, die Eingabe geht unveraendert hinaus.
|
|
50
|
+
*/
|
|
51
|
+
manualReceipt?: ManualReceipt;
|
|
46
52
|
/**
|
|
47
53
|
* Trinkgeld in Cent — als Zahl (an den angemeldeten Kassen-Benutzer, Zahlart
|
|
48
54
|
* des Belegs) oder als [TipOptions]. Das Backend bucht daraus signierte
|
|
@@ -194,6 +194,12 @@ function createReceiptParams(options) {
|
|
|
194
194
|
if (options.customProjectId != null) {
|
|
195
195
|
params['customProjectId'] = options.customProjectId;
|
|
196
196
|
}
|
|
197
|
+
if (options.manualReceipt != null) {
|
|
198
|
+
if (typ !== index_js_1.ReceiptType.standard) {
|
|
199
|
+
throw eingabefehler(`manualReceipt ist nur bei receiptType standard moeglich, nicht bei "${typ.value}".`);
|
|
200
|
+
}
|
|
201
|
+
params['manualReceipt'] = options.manualReceipt;
|
|
202
|
+
}
|
|
197
203
|
if (options.customerDetails != null) {
|
|
198
204
|
params['customerDetails'] = options.customerDetails.join('\n');
|
|
199
205
|
}
|
|
@@ -10,6 +10,7 @@ export { RECEIPT_OUTPUT_KINDS, type ReceiptOutputKind, RECEIPT_OUTPUT_LOG_KINDS,
|
|
|
10
10
|
export { type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, } from './receipt-company.js';
|
|
11
11
|
export { type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, } from './cashregister.js';
|
|
12
12
|
export { type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind } from './receipt-summary.js';
|
|
13
|
+
export { type ManualReceipt, type ManualReceiptReason, MANUAL_RECEIPT_REASONS, readManualReceipt, type ManualReceiptErrorCode, MANUAL_RECEIPT_ERROR_CODES, isManualReceiptErrorCode, } from './manual-receipt.js';
|
|
13
14
|
export { type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, } from './report-month.js';
|
|
14
15
|
export { type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, } from './stripe-url-session.js';
|
|
15
16
|
export { type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './hobex-receipt.js';
|
package/dist/cjs/models/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
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.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptValueVoucherSign = exports.receiptSumCents = exports.receiptSubSumCents = exports.readRegistrationInfo = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherServerFields = exports.isNewFormVoucher = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isVoucherFloatItem = exports.isVoucherItem = exports.isDiscountItem = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = void 0;
|
|
4
|
-
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 = exports.fromReceiptCompanyPayload = exports.receiptOutputFieldErrors = exports.isReceiptOutputError = exports.receiptOutputErrorCode = exports.isReceiptOutputErrorCode = exports.RECEIPT_OUTPUT_ERROR_CODES = exports.RECEIPT_OUTPUT_ENTRY_ERROR_CODES = exports.RECEIPT_OUTPUT_ENTRIES_MAX = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_LOG_KINDS = exports.RECEIPT_OUTPUT_KINDS = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = void 0;
|
|
4
|
+
exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isManualReceiptErrorCode = exports.MANUAL_RECEIPT_ERROR_CODES = exports.readManualReceipt = exports.MANUAL_RECEIPT_REASONS = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.receiptOutputFieldErrors = exports.isReceiptOutputError = exports.receiptOutputErrorCode = exports.isReceiptOutputErrorCode = exports.RECEIPT_OUTPUT_ERROR_CODES = exports.RECEIPT_OUTPUT_ENTRY_ERROR_CODES = exports.RECEIPT_OUTPUT_ENTRIES_MAX = exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_LOG_KINDS = exports.RECEIPT_OUTPUT_KINDS = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = void 0;
|
|
5
5
|
var receipt_item_js_1 = require("./receipt-item.js");
|
|
6
6
|
Object.defineProperty(exports, "toReceiptItemPayload", { enumerable: true, get: function () { return receipt_item_js_1.toReceiptItemPayload; } });
|
|
7
7
|
Object.defineProperty(exports, "fromReceiptItemPayload", { enumerable: true, get: function () { return receipt_item_js_1.fromReceiptItemPayload; } });
|
|
@@ -88,6 +88,11 @@ var receipt_summary_js_1 = require("./receipt-summary.js");
|
|
|
88
88
|
Object.defineProperty(exports, "fromReceiptSummaryPayload", { enumerable: true, get: function () { return receipt_summary_js_1.fromReceiptSummaryPayload; } });
|
|
89
89
|
Object.defineProperty(exports, "ZERO_KINDS", { enumerable: true, get: function () { return receipt_summary_js_1.ZERO_KINDS; } });
|
|
90
90
|
Object.defineProperty(exports, "isZeroKind", { enumerable: true, get: function () { return receipt_summary_js_1.isZeroKind; } });
|
|
91
|
+
var manual_receipt_js_1 = require("./manual-receipt.js");
|
|
92
|
+
Object.defineProperty(exports, "MANUAL_RECEIPT_REASONS", { enumerable: true, get: function () { return manual_receipt_js_1.MANUAL_RECEIPT_REASONS; } });
|
|
93
|
+
Object.defineProperty(exports, "readManualReceipt", { enumerable: true, get: function () { return manual_receipt_js_1.readManualReceipt; } });
|
|
94
|
+
Object.defineProperty(exports, "MANUAL_RECEIPT_ERROR_CODES", { enumerable: true, get: function () { return manual_receipt_js_1.MANUAL_RECEIPT_ERROR_CODES; } });
|
|
95
|
+
Object.defineProperty(exports, "isManualReceiptErrorCode", { enumerable: true, get: function () { return manual_receipt_js_1.isManualReceiptErrorCode; } });
|
|
91
96
|
var report_month_js_1 = require("./report-month.js");
|
|
92
97
|
Object.defineProperty(exports, "reportMonthFromDate", { enumerable: true, get: function () { return report_month_js_1.reportMonthFromDate; } });
|
|
93
98
|
Object.defineProperty(exports, "previousReportMonth", { enumerable: true, get: function () { return report_month_js_1.previousReportMonth; } });
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nacherfassung eines Handbelegs (`manualReceipt` am Beleg, Backend
|
|
3
|
+
* `handbeleg`): Nach einem Ausfall der Kasse oder einer Leistung ausser Haus
|
|
4
|
+
* wird der handschriftliche Beleg (Paragon) in der Kasse nacherfasst. Der
|
|
5
|
+
* Beleg traegt dann Nummer, Datum und Grund des Handbelegs; sein eigener
|
|
6
|
+
* Zeitstempel bleibt der Zeitpunkt der Nacherfassung (kein Rueckdatieren).
|
|
7
|
+
*
|
|
8
|
+
* Rechtsgrundlage: § 17 Abs 5 RKSV, Registrierkassenerlass Abschnitt 3.6.1
|
|
9
|
+
* (Ausfall, Tagessammelbeleg erlaubt) und 6.7 (ausser Haus, jeder Beleg
|
|
10
|
+
* einzeln; nicht fuer Taxi und Mietwagen, § 7 Abs 2 BarUV).
|
|
11
|
+
* Geprueft wird am Server; dieses Paket liest nur und reicht die Eingabe weiter.
|
|
12
|
+
*/
|
|
13
|
+
/** Gruende einer Nacherfassung: fuenf Ausfall-Gruende und die Leistung ausser Haus. */
|
|
14
|
+
export declare const MANUAL_RECEIPT_REASONS: readonly ["network_outage", "power_outage", "device_failure", "system_outage", "other", "outside_premises"];
|
|
15
|
+
export type ManualReceiptReason = (typeof MANUAL_RECEIPT_REASONS)[number];
|
|
16
|
+
export interface ManualReceipt {
|
|
17
|
+
/** Nummer des Handbelegs (eigene Nummernreihe des Paragons, nie die Kassennummer). */
|
|
18
|
+
number: string;
|
|
19
|
+
/** Letzte Nummer: macht den Beleg zum Tagessammelbeleg (nur nach einem Ausfall). */
|
|
20
|
+
numberTo?: string;
|
|
21
|
+
/** Zahl der Handbelege im Tagessammelbeleg. */
|
|
22
|
+
count?: number;
|
|
23
|
+
/** Tag des Handbelegs, `YYYY-MM-DD` (Wiener Tag). */
|
|
24
|
+
date: string;
|
|
25
|
+
/** Uhrzeit des Handbelegs, `HH:MM`. */
|
|
26
|
+
time?: string;
|
|
27
|
+
/** Grund; ein Wert, den dieses Paket nicht kennt, bleibt als roher Text lesbar. */
|
|
28
|
+
reason: ManualReceiptReason | string;
|
|
29
|
+
/** Eigener Text, nur beim Grund `other`. */
|
|
30
|
+
note?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Liest `manualReceipt` vom Draht. Ohne Nummer, Datum oder Grund gibt es
|
|
34
|
+
* keinen Handbeleg (`undefined`); ein einzelnes Zusatzfeld in falscher Form
|
|
35
|
+
* faellt weg, statt den Beleg scheitern zu lassen.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readManualReceipt(roh: unknown): ManualReceipt | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Fehlercodes von `createReceipt` zur Nacherfassung (Vertrag `errorCodes.manualReceipt`).
|
|
40
|
+
* `manual_receipt_duplicate` traegt in `details.receiptId` den Beleg, der den Handbeleg
|
|
41
|
+
* schon nacherfasst hat: nicht erneut senden, sondern diesen Beleg nehmen.
|
|
42
|
+
*/
|
|
43
|
+
export declare const MANUAL_RECEIPT_ERROR_CODES: readonly ["invalid_manual_receipt", "manual_receipt_not_allowed", "manual_receipt_date_in_future", "manual_receipt_range_not_allowed", "manual_receipt_duplicate"];
|
|
44
|
+
export type ManualReceiptErrorCode = (typeof MANUAL_RECEIPT_ERROR_CODES)[number];
|
|
45
|
+
export declare function isManualReceiptErrorCode(value: unknown): value is ManualReceiptErrorCode;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Nacherfassung eines Handbelegs (`manualReceipt` am Beleg, Backend
|
|
4
|
+
* `handbeleg`): Nach einem Ausfall der Kasse oder einer Leistung ausser Haus
|
|
5
|
+
* wird der handschriftliche Beleg (Paragon) in der Kasse nacherfasst. Der
|
|
6
|
+
* Beleg traegt dann Nummer, Datum und Grund des Handbelegs; sein eigener
|
|
7
|
+
* Zeitstempel bleibt der Zeitpunkt der Nacherfassung (kein Rueckdatieren).
|
|
8
|
+
*
|
|
9
|
+
* Rechtsgrundlage: § 17 Abs 5 RKSV, Registrierkassenerlass Abschnitt 3.6.1
|
|
10
|
+
* (Ausfall, Tagessammelbeleg erlaubt) und 6.7 (ausser Haus, jeder Beleg
|
|
11
|
+
* einzeln; nicht fuer Taxi und Mietwagen, § 7 Abs 2 BarUV).
|
|
12
|
+
* Geprueft wird am Server; dieses Paket liest nur und reicht die Eingabe weiter.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.MANUAL_RECEIPT_ERROR_CODES = exports.MANUAL_RECEIPT_REASONS = void 0;
|
|
16
|
+
exports.readManualReceipt = readManualReceipt;
|
|
17
|
+
exports.isManualReceiptErrorCode = isManualReceiptErrorCode;
|
|
18
|
+
/** Gruende einer Nacherfassung: fuenf Ausfall-Gruende und die Leistung ausser Haus. */
|
|
19
|
+
exports.MANUAL_RECEIPT_REASONS = [
|
|
20
|
+
'network_outage', 'power_outage', 'device_failure', 'system_outage', 'other', 'outside_premises',
|
|
21
|
+
];
|
|
22
|
+
const istText = (w) => typeof w === 'string' && w !== '';
|
|
23
|
+
/**
|
|
24
|
+
* Liest `manualReceipt` vom Draht. Ohne Nummer, Datum oder Grund gibt es
|
|
25
|
+
* keinen Handbeleg (`undefined`); ein einzelnes Zusatzfeld in falscher Form
|
|
26
|
+
* faellt weg, statt den Beleg scheitern zu lassen.
|
|
27
|
+
*/
|
|
28
|
+
function readManualReceipt(roh) {
|
|
29
|
+
if (roh === null || typeof roh !== 'object' || Array.isArray(roh))
|
|
30
|
+
return undefined;
|
|
31
|
+
const o = roh;
|
|
32
|
+
if (!istText(o['number']) || !istText(o['date']) || !istText(o['reason']))
|
|
33
|
+
return undefined;
|
|
34
|
+
return {
|
|
35
|
+
number: o['number'],
|
|
36
|
+
...(istText(o['numberTo']) ? { numberTo: o['numberTo'] } : {}),
|
|
37
|
+
...(typeof o['count'] === 'number' && Number.isInteger(o['count']) ? { count: o['count'] } : {}),
|
|
38
|
+
date: o['date'],
|
|
39
|
+
...(istText(o['time']) ? { time: o['time'] } : {}),
|
|
40
|
+
reason: o['reason'],
|
|
41
|
+
...(istText(o['note']) ? { note: o['note'] } : {}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fehlercodes von `createReceipt` zur Nacherfassung (Vertrag `errorCodes.manualReceipt`).
|
|
46
|
+
* `manual_receipt_duplicate` traegt in `details.receiptId` den Beleg, der den Handbeleg
|
|
47
|
+
* schon nacherfasst hat: nicht erneut senden, sondern diesen Beleg nehmen.
|
|
48
|
+
*/
|
|
49
|
+
exports.MANUAL_RECEIPT_ERROR_CODES = Object.freeze([
|
|
50
|
+
'invalid_manual_receipt',
|
|
51
|
+
'manual_receipt_not_allowed',
|
|
52
|
+
'manual_receipt_date_in_future',
|
|
53
|
+
'manual_receipt_range_not_allowed',
|
|
54
|
+
'manual_receipt_duplicate',
|
|
55
|
+
]);
|
|
56
|
+
function isManualReceiptErrorCode(value) {
|
|
57
|
+
return typeof value === 'string' && exports.MANUAL_RECEIPT_ERROR_CODES.includes(value);
|
|
58
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeckPaymentMethod, ReceiptType } from '../enums/index.js';
|
|
2
2
|
import { type CancellationStatus } from './cancellation.js';
|
|
3
3
|
import { type ReceiptPayment, type ReceiptPaymentPayload } from './receipt-payment.js';
|
|
4
|
+
import { type ManualReceipt } from './manual-receipt.js';
|
|
4
5
|
/**
|
|
5
6
|
* Belegzeile einer Liste — die Form, die `listMyReceipts` liefert
|
|
6
7
|
* (`projectReceiptForCustomer` in functions/index.js).
|
|
@@ -77,6 +78,8 @@ export interface ReceiptSummary {
|
|
|
77
78
|
* (`providerPaymentId`, `providerData`) bleiben im Backend.
|
|
78
79
|
*/
|
|
79
80
|
payments?: ReceiptPayment[];
|
|
81
|
+
/** Nur an nacherfassten Belegen: der Handbeleg. */
|
|
82
|
+
manualReceipt?: ManualReceipt;
|
|
80
83
|
}
|
|
81
84
|
export interface ReceiptSummaryPayload {
|
|
82
85
|
receiptId?: string | null;
|
|
@@ -105,5 +108,6 @@ export interface ReceiptSummaryPayload {
|
|
|
105
108
|
cancellationStatus?: string | null;
|
|
106
109
|
zeroKind?: string | null;
|
|
107
110
|
payments?: ReceiptPaymentPayload[] | null;
|
|
111
|
+
manualReceipt?: unknown;
|
|
108
112
|
}
|
|
109
113
|
export declare function fromReceiptSummaryPayload(payload: ReceiptSummaryPayload): ReceiptSummary;
|
|
@@ -8,6 +8,7 @@ const money_js_1 = require("../money.js");
|
|
|
8
8
|
const enum_payload_js_1 = require("./enum-payload.js");
|
|
9
9
|
const cancellation_js_1 = require("./cancellation.js");
|
|
10
10
|
const receipt_payment_js_1 = require("./receipt-payment.js");
|
|
11
|
+
const manual_receipt_js_1 = require("./manual-receipt.js");
|
|
11
12
|
/**
|
|
12
13
|
* Belegzeile einer Liste — die Form, die `listMyReceipts` liefert
|
|
13
14
|
* (`projectReceiptForCustomer` in functions/index.js).
|
|
@@ -58,8 +59,13 @@ function fromReceiptSummaryPayload(payload) {
|
|
|
58
59
|
: { cancellationStatus: isCancellationStatus(payload.cancellationStatus) ? payload.cancellationStatus : 'unknown' }),
|
|
59
60
|
...(isZeroKind(payload.zeroKind) ? { zeroKind: payload.zeroKind } : {}),
|
|
60
61
|
...(Array.isArray(payload.payments) ? { payments: payload.payments.map(receipt_payment_js_1.fromReceiptPaymentPayload) } : {}),
|
|
62
|
+
...handbelegFeld(payload.manualReceipt),
|
|
61
63
|
};
|
|
62
64
|
}
|
|
65
|
+
function handbelegFeld(roh) {
|
|
66
|
+
const manualReceipt = (0, manual_receipt_js_1.readManualReceipt)(roh);
|
|
67
|
+
return manualReceipt ? { manualReceipt } : {};
|
|
68
|
+
}
|
|
63
69
|
function isCancellationStatus(wert) {
|
|
64
70
|
return typeof wert === 'string' && cancellation_js_1.CANCELLATION_STATUSES.includes(wert);
|
|
65
71
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReceiptType, KeckPaymentMethod, CreditCardProvider } from '../enums/index.js';
|
|
2
|
+
import { type ManualReceipt } from './manual-receipt.js';
|
|
2
3
|
import { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead } from './receipt-item.js';
|
|
3
4
|
import { type Voucher, type VoucherPayload } from './voucher.js';
|
|
4
5
|
import { type Cancellation, type CancellationOf, type CancellationReason } from './cancellation.js';
|
|
@@ -74,6 +75,8 @@ export interface Receipt {
|
|
|
74
75
|
layoutRuleset?: number;
|
|
75
76
|
/** Nur an Nullbelegen: Registrierdaten fuer den Block „Prüfangaben“. */
|
|
76
77
|
registrationInfo?: RegistrationInfo;
|
|
78
|
+
/** Nur an nacherfassten Belegen: der Handbeleg (siehe [ManualReceipt]). */
|
|
79
|
+
manualReceipt?: ManualReceipt;
|
|
77
80
|
}
|
|
78
81
|
/** Registrierdaten von Signaturkarte und Kasse (Zeitstempel oder `null`, wenn unbekannt). */
|
|
79
82
|
export interface RegistrationInfo {
|
|
@@ -125,6 +128,7 @@ export interface ReceiptPayloadRead extends Omit<ReceiptPayload, 'items' | 'vouc
|
|
|
125
128
|
cardRegisteredAt?: string | null;
|
|
126
129
|
cashregisterRegisteredAt?: string | null;
|
|
127
130
|
} | null;
|
|
131
|
+
manualReceipt?: unknown;
|
|
128
132
|
}
|
|
129
133
|
/**
|
|
130
134
|
* Schreibt die Nutzlast in der **neuen** Form — sie **normalisiert, statt zu
|
|
@@ -8,6 +8,7 @@ exports.receiptSubSumCents = receiptSubSumCents;
|
|
|
8
8
|
exports.receiptSumCents = receiptSumCents;
|
|
9
9
|
const index_js_1 = require("../enums/index.js");
|
|
10
10
|
const enum_payload_js_1 = require("./enum-payload.js");
|
|
11
|
+
const manual_receipt_js_1 = require("./manual-receipt.js");
|
|
11
12
|
const receipt_item_js_1 = require("./receipt-item.js");
|
|
12
13
|
const voucher_js_1 = require("./voucher.js");
|
|
13
14
|
const cancellation_js_1 = require("./cancellation.js");
|
|
@@ -95,8 +96,13 @@ function fromReceiptPayload(payload) {
|
|
|
95
96
|
...(payload.registrationInfo != null && typeof payload.registrationInfo === 'object'
|
|
96
97
|
? { registrationInfo: readRegistrationInfo(payload.registrationInfo) }
|
|
97
98
|
: {}),
|
|
99
|
+
...handbelegFeld(payload.manualReceipt),
|
|
98
100
|
};
|
|
99
101
|
}
|
|
102
|
+
function handbelegFeld(roh) {
|
|
103
|
+
const manualReceipt = (0, manual_receipt_js_1.readManualReceipt)(roh);
|
|
104
|
+
return manualReceipt ? { manualReceipt } : {};
|
|
105
|
+
}
|
|
100
106
|
/** Registrierdaten lesen; ein fehlender oder leerer Zeitstempel wird `null`. */
|
|
101
107
|
function readRegistrationInfo(roh) {
|
|
102
108
|
const zeit = (v) => (typeof v === 'string' && v !== '' ? v : null);
|
|
@@ -936,6 +936,49 @@ function stornoGrundText(code) {
|
|
|
936
936
|
function receiptIsSmallBusinessConsistent(receipt) {
|
|
937
937
|
return receipt.items.every((it) => Number(steuersatz(it.vat).rate) === 0);
|
|
938
938
|
}
|
|
939
|
+
/** Grund-Zeile nach einem Ausfall der Kasse; `other` druckt den eigenen Text. */
|
|
940
|
+
const NACHERFASSUNG_GRUND = {
|
|
941
|
+
network_outage: 'Internet', power_outage: 'Strom', device_failure: 'Gerät defekt', system_outage: 'Störung',
|
|
942
|
+
};
|
|
943
|
+
/** `YYYY-MM-DD` als `TT.MM.JJJJ`; anderes bleibt, wie es kam. */
|
|
944
|
+
function handbelegDatum(tag) {
|
|
945
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(tag);
|
|
946
|
+
return m ? `${m[3]}.${m[2]}.${m[1]}` : tag;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Block „NACHERFASSUNG“ (manualReceipt) unter dem Kopf: Art, Grund, Nummer
|
|
950
|
+
* und Tag des Handbelegs bzw. der Handbelege eines Tagessammelbelegs, dazu
|
|
951
|
+
* der Hinweis, dass der Beleg fuer die USt ein Duplikat ist
|
|
952
|
+
* (Registrierkassenerlass 3.3 Faelle 5 und 6, 2.4.11). Der Zeitstempel des Belegs bleibt der der
|
|
953
|
+
* Nacherfassung und steht wie immer unter „Datum:“. Kleinunternehmer
|
|
954
|
+
* (keine USt am Beleg) bekommen den USt-Hinweis nicht.
|
|
955
|
+
*/
|
|
956
|
+
function nacherfassungBlock(receipt, company) {
|
|
957
|
+
const m = receipt.manualReceipt;
|
|
958
|
+
if (!m)
|
|
959
|
+
return [];
|
|
960
|
+
const aus = [bannerZeile('NACHERFASSUNG')];
|
|
961
|
+
aus.push(textZeile(m.reason === 'outside_premises' ? 'Leistung außer Haus' : 'nach Ausfall der Kasse', 'center'));
|
|
962
|
+
const grund = m.reason === 'other' ? m.note : NACHERFASSUNG_GRUND[m.reason];
|
|
963
|
+
if (grund)
|
|
964
|
+
aus.push(textZeile(`Grund: ${grund}`, 'center'));
|
|
965
|
+
aus.push({ kind: 'space', lines: 1 });
|
|
966
|
+
const tag = handbelegDatum(m.date);
|
|
967
|
+
if (m.numberTo) {
|
|
968
|
+
aus.push(textZeile('Tagessammelbeleg', 'center'));
|
|
969
|
+
aus.push(textZeile(`Handbelege Nr. ${m.number} bis ${m.numberTo}`, 'center'));
|
|
970
|
+
aus.push(textZeile(`${m.count ? `${m.count} Belege ` : ''}vom ${tag}`, 'center'));
|
|
971
|
+
if (!company.isSmallBusiness)
|
|
972
|
+
aus.push(textZeile('USt: Duplikat der Handbelege', 'center'));
|
|
973
|
+
}
|
|
974
|
+
else {
|
|
975
|
+
aus.push(textZeile(`Handbeleg Nr. ${m.number}`, 'center'));
|
|
976
|
+
aus.push(textZeile(`vom ${tag}${m.time ? `, ${m.time} Uhr` : ''}`, 'center'));
|
|
977
|
+
if (!company.isSmallBusiness)
|
|
978
|
+
aus.push(textZeile('USt: Duplikat des Handbelegs', 'center'));
|
|
979
|
+
}
|
|
980
|
+
return aus;
|
|
981
|
+
}
|
|
939
982
|
/**
|
|
940
983
|
* Belegart-Block unter dem Betriebskopf: Titel als Banner, Untertitel als
|
|
941
984
|
* zentrierte Textzeilen. Verkaufsbelege bekommen keinen Block.
|
|
@@ -1023,6 +1066,12 @@ function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1023
1066
|
lines.push({ kind: 'space', lines: 1 });
|
|
1024
1067
|
lines.push(...belegart);
|
|
1025
1068
|
}
|
|
1069
|
+
// --- Nacherfassung eines Handbelegs unter dem Kopf, vor den Pflichtangaben
|
|
1070
|
+
const nacherfassung = nullbeleg ? [] : nacherfassungBlock(receipt, company);
|
|
1071
|
+
if (nacherfassung.length > 0) {
|
|
1072
|
+
lines.push({ kind: 'space', lines: 1 });
|
|
1073
|
+
lines.push(...nacherfassung);
|
|
1074
|
+
}
|
|
1026
1075
|
// --- Nullbeleg: reduziert (§ 132a Abs. 3 BAO / RKSV § 11 Abs. 1 -- Pflichtangaben
|
|
1027
1076
|
// ja, Positionen/MwSt-Tabelle/Zahlungsart/Fusszeilen nein).
|
|
1028
1077
|
if (nullbeleg) {
|
|
@@ -1038,6 +1087,14 @@ function buildReceiptLayout(receipt, company, options = {}) {
|
|
|
1038
1087
|
lines.push(...pruefangabenBlock(receipt, options.registrationInfo ?? null));
|
|
1039
1088
|
}
|
|
1040
1089
|
lines.push({ kind: 'space', lines: 1 });
|
|
1090
|
+
// Sammelbeleg nach Signaturausfall: Beginn und Ende des Ausfalls muessen aus
|
|
1091
|
+
// dem Beleg hervorgehen (Registrierkassenerlass 3.6.1); der Server legt sie als
|
|
1092
|
+
// legalMessage ab. Andere Nullbelege nennen ihren Anlass schon im Titel.
|
|
1093
|
+
if (receipt.zeroKind === 'outage_end' && receipt.legalMessage.length > 0) {
|
|
1094
|
+
for (const zeile of receipt.legalMessage)
|
|
1095
|
+
lines.push(textZeile(zeile, 'center'));
|
|
1096
|
+
lines.push({ kind: 'space', lines: 1 });
|
|
1097
|
+
}
|
|
1041
1098
|
if (receiptSignatureFailed(receipt)) {
|
|
1042
1099
|
lines.push(textZeile(SIGNATUR_AUSGEFALLEN, 'center'));
|
|
1043
1100
|
lines.push({ kind: 'space', lines: 1 });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
|
|
2
|
-
export declare const VOKABULAR_QUELLE = "
|
|
2
|
+
export declare const VOKABULAR_QUELLE = "c14617ec83a2eac2bdffc6794cc2c7f72ae04504259a55313f01fe83747fa565";
|
|
3
3
|
/** Schema-Notation des Vertrags: Blatt 'aussen': 'innen', Objekt { __: 'innen', ... }, Liste [ { __: 'innen', ... } ]. */
|
|
4
4
|
export type SchemaEintrag = string | SchemaObjekt | readonly [SchemaObjekt];
|
|
5
5
|
export interface SchemaObjekt {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.KATALOGE = exports.ARTIKEL_FELDER = exports.SCHEMAS = exports.VOKABULAR_QUELLE = void 0;
|
|
6
6
|
/** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
|
|
7
|
-
exports.VOKABULAR_QUELLE = "
|
|
7
|
+
exports.VOKABULAR_QUELLE = "c14617ec83a2eac2bdffc6794cc2c7f72ae04504259a55313f01fe83747fa565";
|
|
8
8
|
/** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
|
|
9
9
|
exports.SCHEMAS = {
|
|
10
10
|
"getReceipt": {
|
|
@@ -24,7 +24,17 @@ exports.SCHEMAS = {
|
|
|
24
24
|
"receivedImmediately": "sofortErhalten",
|
|
25
25
|
"keptByEmployee": "direkt"
|
|
26
26
|
}
|
|
27
|
-
]
|
|
27
|
+
],
|
|
28
|
+
"manualReceipt": {
|
|
29
|
+
"__": "handbeleg",
|
|
30
|
+
"number": "nummer",
|
|
31
|
+
"numberTo": "nummerBis",
|
|
32
|
+
"count": "anzahl",
|
|
33
|
+
"date": "datum",
|
|
34
|
+
"time": "uhrzeit",
|
|
35
|
+
"reason": "grund",
|
|
36
|
+
"note": "grundText"
|
|
37
|
+
}
|
|
28
38
|
},
|
|
29
39
|
"taxNumber": "taxnr",
|
|
30
40
|
"vatId": "uid",
|
|
@@ -80,6 +90,9 @@ exports.SCHEMAS = {
|
|
|
80
90
|
"receipt.cancellationReason": {
|
|
81
91
|
"$catalog": "STORNO_GRUND"
|
|
82
92
|
},
|
|
93
|
+
"receipt.manualReceipt.reason": {
|
|
94
|
+
"$catalog": "HANDBELEG_GRUND"
|
|
95
|
+
},
|
|
83
96
|
"layout.lines[].tone": {
|
|
84
97
|
"$catalog": "LAYOUT_TON"
|
|
85
98
|
},
|
|
@@ -570,6 +583,14 @@ exports.KATALOGE = {
|
|
|
570
583
|
"unbefristet": "unlimited",
|
|
571
584
|
"jahre": "years"
|
|
572
585
|
},
|
|
586
|
+
"HANDBELEG_GRUND": {
|
|
587
|
+
"internet": "network_outage",
|
|
588
|
+
"strom": "power_outage",
|
|
589
|
+
"geraet": "device_failure",
|
|
590
|
+
"stoerung": "system_outage",
|
|
591
|
+
"sonstiges": "other",
|
|
592
|
+
"ausser_haus": "outside_premises"
|
|
593
|
+
},
|
|
573
594
|
"KASSE_BETRIEB_WERTE.cardProvider": {
|
|
574
595
|
"keiner": "none",
|
|
575
596
|
"extern": "external",
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeckPaymentMethod, ReceiptType } from '../enums/index.js';
|
|
2
2
|
import { type CancellationReason, type CancellationStatus, type Receipt, type ReceiptPayment, type ZeroKind } from '../models/index.js';
|
|
3
3
|
import type { ReportV2Metadata } from './reports.js';
|
|
4
|
+
import { type ManualReceipt } from '../models/manual-receipt.js';
|
|
4
5
|
import type { InternerTransport } from './aufrufe.js';
|
|
5
6
|
/**
|
|
6
7
|
* Belege einer Kasse auflisten (`listReceipts`, nur unter `/v3`): ein Tag oder
|
|
@@ -143,6 +144,8 @@ export interface ListReceiptsSummary {
|
|
|
143
144
|
customProjectId: string | null;
|
|
144
145
|
/** Schluessel fuer `downloadReceipt` und den Beleg-Link, oder `null`. */
|
|
145
146
|
fullReceiptId: string | null;
|
|
147
|
+
/** Nur an nacherfassten Belegen: der Handbeleg. */
|
|
148
|
+
manualReceipt?: ManualReceipt;
|
|
146
149
|
}
|
|
147
150
|
/** Ein Beleg der Liste je Ansicht: `full` das Belegdokument wie bei `getReportV2`, sonst die Zeile. */
|
|
148
151
|
export type ListedReceipt<V extends ListReceiptsView = 'summary'> = V extends 'full' ? Receipt : ListReceiptsSummary;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeckPaymentMethod, ReceiptType } from '../enums/index.js';
|
|
2
2
|
import { CANCELLATION_STATUSES, fromReceiptCompanyPayload, fromReceiptPayload, fromReceiptPaymentPayload, } from '../models/index.js';
|
|
3
3
|
import { readEnumKey } from '../models/enum-payload.js';
|
|
4
|
+
import { readManualReceipt } from '../models/manual-receipt.js';
|
|
4
5
|
import { KasseneckValidationError } from './errors.js';
|
|
5
6
|
/**
|
|
6
7
|
* Belege einer Kasse auflisten (`listReceipts`, nur unter `/v3`): ein Tag oder
|
|
@@ -157,6 +158,10 @@ const istObjekt = (w) => w != null && typeof w === 'object' && !Array.isArray(w)
|
|
|
157
158
|
const text = (w) => (typeof w === 'string' ? w : null);
|
|
158
159
|
// Ganze Cent; ein einzelner unbrauchbarer Betrag laesst die Liste nicht scheitern.
|
|
159
160
|
const cent = (w) => (typeof w === 'number' && Number.isInteger(w) ? w : 0);
|
|
161
|
+
function handbelegFeld(roh) {
|
|
162
|
+
const manualReceipt = readManualReceipt(roh);
|
|
163
|
+
return manualReceipt ? { manualReceipt } : {};
|
|
164
|
+
}
|
|
160
165
|
function istStornoStand(w) {
|
|
161
166
|
return typeof w === 'string' && CANCELLATION_STATUSES.includes(w);
|
|
162
167
|
}
|
|
@@ -191,6 +196,7 @@ export function fromListReceiptsSummaryPayload(payload) {
|
|
|
191
196
|
signatureOk: payload['signatureOk'] !== false,
|
|
192
197
|
customProjectId: text(payload['customProjectId']),
|
|
193
198
|
fullReceiptId: text(payload['fullReceiptId']),
|
|
199
|
+
...handbelegFeld(payload['manualReceipt']),
|
|
194
200
|
};
|
|
195
201
|
}
|
|
196
202
|
function tagessumme(roh) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReceiptType, type ReceiptTypeKey, KeckPaymentMethod, type KeckPaymentMethodKey } from '../enums/index.js';
|
|
2
|
+
import type { ManualReceipt } from '../models/manual-receipt.js';
|
|
2
3
|
import { type Receipt, type ReceiptCompany, type ReceiptItem, type Voucher, type ReceiptSummary, type ReportMonth, type CancellationItem, type CancellationOf, type CancellationReason, type TipRefundSource, type ReturnDisposition, type ReceiptPaymentInput, type RegistrationInfo, type ReceiptEmailVia } from '../models/index.js';
|
|
3
4
|
import { type ReceiptOutput, type ReceiptOutputEntryErrorCode, type ReceiptOutputLogKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
4
5
|
import type { InternerTransport } from './aufrufe.js';
|
|
@@ -43,6 +44,11 @@ export interface ReceiptCommonOptions {
|
|
|
43
44
|
legalMessage?: string[];
|
|
44
45
|
/** Freier Bezeichner des Aufrufers (Projekt, Auftrag, Schicht). */
|
|
45
46
|
customProjectId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Nacherfassung eines Handbelegs (siehe [ManualReceipt]); nur bei
|
|
49
|
+
* `standard`. Geprueft wird am Server, die Eingabe geht unveraendert hinaus.
|
|
50
|
+
*/
|
|
51
|
+
manualReceipt?: ManualReceipt;
|
|
46
52
|
/**
|
|
47
53
|
* Trinkgeld in Cent — als Zahl (an den angemeldeten Kassen-Benutzer, Zahlart
|
|
48
54
|
* des Belegs) oder als [TipOptions]. Das Backend bucht daraus signierte
|
|
@@ -173,6 +173,12 @@ export function createReceiptParams(options) {
|
|
|
173
173
|
if (options.customProjectId != null) {
|
|
174
174
|
params['customProjectId'] = options.customProjectId;
|
|
175
175
|
}
|
|
176
|
+
if (options.manualReceipt != null) {
|
|
177
|
+
if (typ !== ReceiptType.standard) {
|
|
178
|
+
throw eingabefehler(`manualReceipt ist nur bei receiptType standard moeglich, nicht bei "${typ.value}".`);
|
|
179
|
+
}
|
|
180
|
+
params['manualReceipt'] = options.manualReceipt;
|
|
181
|
+
}
|
|
176
182
|
if (options.customerDetails != null) {
|
|
177
183
|
params['customerDetails'] = options.customerDetails.join('\n');
|
|
178
184
|
}
|
|
@@ -10,6 +10,7 @@ export { RECEIPT_OUTPUT_KINDS, type ReceiptOutputKind, RECEIPT_OUTPUT_LOG_KINDS,
|
|
|
10
10
|
export { type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, } from './receipt-company.js';
|
|
11
11
|
export { type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, } from './cashregister.js';
|
|
12
12
|
export { type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind } from './receipt-summary.js';
|
|
13
|
+
export { type ManualReceipt, type ManualReceiptReason, MANUAL_RECEIPT_REASONS, readManualReceipt, type ManualReceiptErrorCode, MANUAL_RECEIPT_ERROR_CODES, isManualReceiptErrorCode, } from './manual-receipt.js';
|
|
13
14
|
export { type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, } from './report-month.js';
|
|
14
15
|
export { type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, } from './stripe-url-session.js';
|
|
15
16
|
export { type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './hobex-receipt.js';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_LOG_KINDS, RECEIPT_OUTPUT_RESULTS,
|
|
|
10
10
|
export { fromReceiptCompanyPayload, receiptCompanyTaxInfo, } from './receipt-company.js';
|
|
11
11
|
export { fromCashregisterPayload, } from './cashregister.js';
|
|
12
12
|
export { fromReceiptSummaryPayload, ZERO_KINDS, isZeroKind } from './receipt-summary.js';
|
|
13
|
+
export { MANUAL_RECEIPT_REASONS, readManualReceipt, MANUAL_RECEIPT_ERROR_CODES, isManualReceiptErrorCode, } from './manual-receipt.js';
|
|
13
14
|
export { reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, } from './report-month.js';
|
|
14
15
|
export { toStripeUrlSessionPayload, fromStripeUrlSessionPayload, } from './stripe-url-session.js';
|
|
15
16
|
export { toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './hobex-receipt.js';
|