@kreiseck/kasseneck-api 1.18.0 → 1.19.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 +8 -0
- package/README.md +20 -8
- package/dist/cjs/client/index.d.ts +1 -1
- package/dist/cjs/client/index.js +3 -2
- package/dist/cjs/client/list-receipts.d.ts +45 -5
- package/dist/cjs/client/list-receipts.js +62 -3
- package/dist/cjs/client/receipts.js +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/models/receipt.d.ts +5 -3
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/index.d.ts +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/list-receipts.d.ts +45 -5
- package/dist/esm/client/list-receipts.js +61 -3
- package/dist/esm/client/receipts.js +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/models/receipt.d.ts +5 -3
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +1 -1
- 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-texts.json +1 -1
- package/fixtures/surface.json +1 -1
- package/fixtures/v3/antworten/belege.json +106 -8
- package/fixtures/v3/antworten/belegmail.json +1 -1
- package/fixtures/v3/antworten/berichte.json +1 -1
- package/fixtures/v3/antworten/kasse-belege.json +1 -1
- package/fixtures/v3/antworten/kasse.json +2 -2
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +1 -1
- package/fixtures/v3/antworten/storno.json +14 -2
- 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 +15 -4
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ 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.19.0 - 2026-10-30
|
|
8
|
+
|
|
9
|
+
The full view of `listReceipts` delivers what `getReceipt` delivers (backend 30.10.2026, spec `list-receipts-voll`). Additive for reading.
|
|
10
|
+
|
|
11
|
+
- **Page of the full view: `headers`, `testCashregister`, `logoScale`.** `headers` (`ListReceiptsHeader`: `headerVersionId`, `company`) has one entry per header version of the page; each receipt's `headerVersionId` names its entry, also for old receipts without a stored id. `metadata` stays (today's company data). Reason: reprinting an old receipt from `metadata` printed today's address and footer.
|
|
12
|
+
- **Receipts of the full view: `ListedFullReceipt`** (`Receipt` plus `testSignature`); `registrationInfo` on zero receipts. No server `layout` in the list: it is the main cost driver of a page (about 2.7 times the size) and only needed for the receipt someone opens or prints, so it stays with `getReceiptWithCompany`. New helper `listedReceiptWithCompany(page, receipt)` returns the `ReceiptWithCompany` of `getReceiptWithCompany` without `outputs` and with `layout: null`; `receiptLayoutFromResult` builds the layout from it. Reason: one way to print and show a receipt, single or from the list.
|
|
13
|
+
- **Provider data follow the caller, not the channel.** The backend now returns `payments[].providerPaymentId`/`providerData` (and `cardPaymentId`/`cardPaymentData` on old card receipts) to the business itself on both channels, in `getReceipt`, `createReceipt`, `cancelReceipt`, `getReportV2` and `listReceipts`; a partner access never. No API change here (the fields were already optional); `cardRefundReference` and the card-refund check now name that rule in their messages. Reason: the restriction to the register channel stopped nobody holding the API key and pushed integrations into the register channel.
|
|
14
|
+
- Contract re-fetched from the backend: provider data now in the `/v3` cases of `belege.json` and `storno.json`, schema of `listReceipts` with the new fields; other files change only `_quelle`.
|
|
7
15
|
## 1.18.0 - 2026-10-30
|
|
8
16
|
|
|
9
17
|
Recording handwritten receipts (Nacherfassung). After a register outage or a sale outside the premises the business
|
package/README.md
CHANGED
|
@@ -580,7 +580,7 @@ it whenever it is there. Only without it does the helper build the layout,
|
|
|
580
580
|
in `fallbackPaperSize` (default `mm58`, as in 0.x). The server layout is
|
|
581
581
|
always 80 mm: on 58 mm paper choose the width at the print path
|
|
582
582
|
(`escPosLayoutBytes(layout, { paperSize: 'mm58' })`, `charsPerLine: 32`); the VAT
|
|
583
|
-
table then keeps the columns of the 80 mm grid.
|
|
583
|
+
table then keeps the columns of the 80 mm grid. For a partner access only this layout carries the card block, because
|
|
584
584
|
the receipt itself comes without provider data. If you build the layout
|
|
585
585
|
yourself, pass the options from the same response:
|
|
586
586
|
|
|
@@ -641,10 +641,19 @@ for await (const receipt of api.listAllReceipts({ from: '2026-10-01', to: '2026-
|
|
|
641
641
|
`grossByRateCents`, `paymentMethod`, `payments`, `tipCents`, `operator`,
|
|
642
642
|
`cancellationOf`, `cancellationReason`, `cancellationStatus`, `signatureOk`,
|
|
643
643
|
`customProjectId`, `fullReceiptId`); amounts in cents, no items, no layout.
|
|
644
|
-
`full` returns `
|
|
645
|
-
with
|
|
646
|
-
`
|
|
647
|
-
`
|
|
644
|
+
`full` returns `ListedFullReceipt`: the receipt document as in `getReceipt`
|
|
645
|
+
with `headerVersionId` (the header version that applies, also for old
|
|
646
|
+
receipts), `testSignature` and `registrationInfo` on zero receipts, never the
|
|
647
|
+
server `layout` (that comes only with `getReceiptWithCompany`, for the receipt
|
|
648
|
+
someone opens or prints). The page carries `headers` (one entry per header
|
|
649
|
+
version of the page, oldest first), `testCashregister`, `logoScale` and, as
|
|
650
|
+
before, `metadata` (today's company data). For printing use the header of
|
|
651
|
+
the receipt's version, not `metadata`: `listedReceiptWithCompany(page,
|
|
652
|
+
receipt)` returns the `ReceiptWithCompany` of `getReceiptWithCompany` without
|
|
653
|
+
`outputs` and with `layout: null` (zero receipts carry no logo);
|
|
654
|
+
`receiptLayoutFromResult` then builds the layout from it. For the PDF use
|
|
655
|
+
`downloadReceipt` with `fullReceiptId`. `ListReceiptsSummary` is not the `ReceiptSummary` of
|
|
656
|
+
`listMyReceipts` (register path, other fields).
|
|
648
657
|
- **`daySummary`** is only there with `date` and only on the first page
|
|
649
658
|
(`null` when the day has no statistics): `receiptCount` counts every
|
|
650
659
|
receipt of the day, `revenueCents` only standard and cancellation receipts,
|
|
@@ -714,9 +723,12 @@ try {
|
|
|
714
723
|
```
|
|
715
724
|
|
|
716
725
|
**Card refunds.** The terminal refund needs the transaction id of the original
|
|
717
|
-
card payment: `payments[].providerPaymentId` of the original receipt.
|
|
718
|
-
|
|
719
|
-
|
|
726
|
+
card payment: `payments[].providerPaymentId` of the original receipt. The
|
|
727
|
+
business itself gets it on both channels (API key on `api.kasseneck.at/v3`,
|
|
728
|
+
`registerUserAuth` on `kasse.kasseneck.at/api/v3`), in `getReceipt`,
|
|
729
|
+
`listReceipts` (`view: 'full'`) and `getReportV2`; a partner access never does.
|
|
730
|
+
`providerData` is the provider's raw data without a promised shape; base logic
|
|
731
|
+
on `provider`, `providerPaymentId` and `id`. The refund payment then carries
|
|
720
732
|
the id of the refund itself. `cancellation_outcome_unknown` means the
|
|
721
733
|
cancellation may have been booked: read the original again, never retry.
|
|
722
734
|
|
|
@@ -4,7 +4,7 @@ export { ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS
|
|
|
4
4
|
export { 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, } from './errors.js';
|
|
5
5
|
export { type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, type CancelReceiptResult, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, } from './receipts.js';
|
|
6
6
|
export { listMyCashregisters } from './cashregisters.js';
|
|
7
|
-
export { listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, } from './list-receipts.js';
|
|
7
|
+
export { listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, type ListedFullReceipt, type ListReceiptsHeader, } from './list-receipts.js';
|
|
8
8
|
export { downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2, type CashregisterReportPeriod, type ReportV2, type ReportV2Metadata, type ReportV2Options } from './reports.js';
|
|
9
9
|
export { type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, } from './status.js';
|
|
10
10
|
export { type KasseneckApi, createKasseneckApi } from './api.js';
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = void 0;
|
|
3
|
+
exports.LIST_RECEIPTS_ERROR_CODES = exports.LIST_ALL_RECEIPTS_MAX_PAGES = exports.LIST_RECEIPTS_DAYS_MAX = exports.LIST_RECEIPTS_LIMIT_MAX = exports.LIST_RECEIPTS_ORDERS = exports.LIST_RECEIPTS_VIEWS = exports.listedReceiptWithCompany = exports.fromListReceiptsSummaryPayload = exports.listAllReceipts = exports.listReceipts = exports.listMyCashregisters = exports.logReceiptOutputs = exports.sendReceiptEmail = exports.checkVoucherCombinationError = 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.UNKNOWN_OUTCOME_CALLS = exports.POS_CALLS = exports.PUBLIC_CALLS = exports.ALL_CALLS = exports.createPdfOrDataTransport = exports.createBinaryTransport = exports.createTransport = exports.DEFAULT_TIMEOUT_MS = exports.POS_BASE_URL = exports.DEFAULT_BASE_URL = exports.registerUserAuth = exports.apiKeyAuth = void 0;
|
|
4
|
+
exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = void 0;
|
|
5
5
|
var auth_js_1 = require("./auth.js");
|
|
6
6
|
Object.defineProperty(exports, "apiKeyAuth", { enumerable: true, get: function () { return auth_js_1.apiKeyAuth; } });
|
|
7
7
|
Object.defineProperty(exports, "registerUserAuth", { enumerable: true, get: function () { return auth_js_1.registerUserAuth; } });
|
|
@@ -52,6 +52,7 @@ var list_receipts_js_1 = require("./list-receipts.js");
|
|
|
52
52
|
Object.defineProperty(exports, "listReceipts", { enumerable: true, get: function () { return list_receipts_js_1.listReceipts; } });
|
|
53
53
|
Object.defineProperty(exports, "listAllReceipts", { enumerable: true, get: function () { return list_receipts_js_1.listAllReceipts; } });
|
|
54
54
|
Object.defineProperty(exports, "fromListReceiptsSummaryPayload", { enumerable: true, get: function () { return list_receipts_js_1.fromListReceiptsSummaryPayload; } });
|
|
55
|
+
Object.defineProperty(exports, "listedReceiptWithCompany", { enumerable: true, get: function () { return list_receipts_js_1.listedReceiptWithCompany; } });
|
|
55
56
|
Object.defineProperty(exports, "LIST_RECEIPTS_VIEWS", { enumerable: true, get: function () { return list_receipts_js_1.LIST_RECEIPTS_VIEWS; } });
|
|
56
57
|
Object.defineProperty(exports, "LIST_RECEIPTS_ORDERS", { enumerable: true, get: function () { return list_receipts_js_1.LIST_RECEIPTS_ORDERS; } });
|
|
57
58
|
Object.defineProperty(exports, "LIST_RECEIPTS_LIMIT_MAX", { enumerable: true, get: function () { return list_receipts_js_1.LIST_RECEIPTS_LIMIT_MAX; } });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { KeckPaymentMethod, ReceiptType } from '../enums/index.js';
|
|
2
|
-
import { type CancellationReason, type CancellationStatus, type Receipt, type ReceiptPayment, type ZeroKind } from '../models/index.js';
|
|
2
|
+
import { type CancellationReason, type CancellationStatus, type Receipt, type ReceiptCompany, type ReceiptPayment, type ZeroKind } from '../models/index.js';
|
|
3
3
|
import type { ReportV2Metadata } from './reports.js';
|
|
4
|
+
import type { ReceiptWithCompany } from './receipts.js';
|
|
5
|
+
import type { SheetLogoSize } from '../receipt/blatt.js';
|
|
4
6
|
import { type ManualReceipt } from '../models/manual-receipt.js';
|
|
5
7
|
import type { InternerTransport } from './aufrufe.js';
|
|
6
8
|
/**
|
|
@@ -147,8 +149,26 @@ export interface ListReceiptsSummary {
|
|
|
147
149
|
/** Nur an nacherfassten Belegen: der Handbeleg. */
|
|
148
150
|
manualReceipt?: ManualReceipt;
|
|
149
151
|
}
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Ein Beleg der vollen Ansicht: das Belegdokument wie bei `getReceipt`, dazu was `getReceipt` in der Huelle
|
|
154
|
+
* traegt, ausser `outputs` und dem Zeilenmodell `layout` (die gibt es nur einzeln ueber `getReceipt`).
|
|
155
|
+
* `headerVersionId` ist die Kopf-Version, die fuer diesen Beleg gilt (auch bei Altbelegen ohne gespeicherte
|
|
156
|
+
* Kennung); ihr Kopf steht in [ListReceiptsPage.headers]. Anbieterdaten der Zahlungen bekommt nur der Betrieb
|
|
157
|
+
* selbst (API-Schluessel oder Kassen-Anmeldung), nie ein Partner-Zugang.
|
|
158
|
+
* Druck- und Anzeigedaten wie bei `getReceiptWithCompany`: [listedReceiptWithCompany].
|
|
159
|
+
*/
|
|
160
|
+
export interface ListedFullReceipt extends Receipt {
|
|
161
|
+
/** Produktionskonto mit Test-Signatureinheit (Aufdruck TESTSIGNATUR); fehlt bei einem Backend vor dem 30.10.2026. */
|
|
162
|
+
testSignature?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** Ein Eintrag in [ListReceiptsPage.headers]: Kopf und Fuss einer Kopf-Version (Felder wie die Huelle von `getReceipt`). */
|
|
165
|
+
export interface ListReceiptsHeader {
|
|
166
|
+
/** `null` nur, wenn das Konto noch keine Kopf-Version hat (dann der heutige Stand). */
|
|
167
|
+
headerVersionId: string | null;
|
|
168
|
+
company: ReceiptCompany;
|
|
169
|
+
}
|
|
170
|
+
/** Ein Beleg der Liste je Ansicht: `full` das Belegdokument wie bei `getReceipt`, sonst die Zeile. */
|
|
171
|
+
export type ListedReceipt<V extends ListReceiptsView = 'summary'> = V extends 'full' ? ListedFullReceipt : ListReceiptsSummary;
|
|
152
172
|
/**
|
|
153
173
|
* Tagessumme aus der Tagesstatistik der Kasse, nur bei `date` und nur auf
|
|
154
174
|
* der ersten Seite. **Nicht die Summe der Liste:** `receiptCount` zaehlt jeden
|
|
@@ -183,9 +203,28 @@ export interface ListReceiptsPage<V extends ListReceiptsView = 'summary'> {
|
|
|
183
203
|
* `getReportV2().metadata`. Bei der Kurzansicht fehlt das Feld.
|
|
184
204
|
*/
|
|
185
205
|
metadata?: V extends 'full' ? ReportV2Metadata : never;
|
|
206
|
+
/**
|
|
207
|
+
* Nur bei `view: 'full'`: die Kopf-Versionen der Belege dieser Seite, je Version einmal, aelteste zuerst.
|
|
208
|
+
* Fuer den Druck gilt der Eintrag mit der `headerVersionId` des Belegs, nicht `metadata` (heutiger Stand).
|
|
209
|
+
* Fehlt bei einem Backend vor dem 30.10.2026.
|
|
210
|
+
*/
|
|
211
|
+
headers?: V extends 'full' ? ListReceiptsHeader[] : never;
|
|
212
|
+
/** Nur bei `view: 'full'`: Belege einer Testumgebung (Aufdruck TESTKASSE), wie `getReceipt`. */
|
|
213
|
+
testCashregister?: V extends 'full' ? boolean : never;
|
|
214
|
+
/** Nur bei `view: 'full'`: Groesse des Firmenlogos (`logo_scale`), wie `getReceipt`. */
|
|
215
|
+
logoScale?: V extends 'full' ? SheetLogoSize : never;
|
|
186
216
|
}
|
|
187
217
|
/** Zeile `view: summary` vom Draht. */
|
|
188
218
|
export declare function fromListReceiptsSummaryPayload(payload: Record<string, unknown>): ListReceiptsSummary;
|
|
219
|
+
/**
|
|
220
|
+
* Ein Beleg der vollen Ansicht mit den Druck- und Anzeigedaten seiner Seite, in derselben Form wie
|
|
221
|
+
* `getReceiptWithCompany` (ohne `outputs`): der Kopf der Version des Belegs aus `headers` (Nullbelege ohne
|
|
222
|
+
* Logo, wie beim Server), Testkennzeichen, Logo-Stufe. `layout` ist immer `null` -- die Liste traegt kein
|
|
223
|
+
* Zeilenmodell; [receiptLayoutFromResult] baut es dann mit denselben Angaben, oder `getReceiptWithCompany`
|
|
224
|
+
* holt das des Servers. Von einem Backend vor dem 30.10.2026 (ohne `headers`) kommt der Kopf aus
|
|
225
|
+
* `metadata`, dem heutigen Stand.
|
|
226
|
+
*/
|
|
227
|
+
export declare function listedReceiptWithCompany(page: ListReceiptsPage<'full'>, receipt: ListedFullReceipt): ReceiptWithCompany;
|
|
189
228
|
/**
|
|
190
229
|
* Eine Seite Belege der angemeldeten Kasse (`listReceipts`). Die Eingabe wird
|
|
191
230
|
* vor dem Senden nach den Regeln des Servers geprueft (genau eine Form des
|
|
@@ -193,8 +232,9 @@ export declare function fromListReceiptsSummaryPayload(payload: Record<string, u
|
|
|
193
232
|
* `order`, `view`); ein Verstoss wirft [KasseneckValidationError] mit
|
|
194
233
|
* `scope: 'request'`, ohne dass etwas hinausgeht.
|
|
195
234
|
*
|
|
196
|
-
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument
|
|
197
|
-
*
|
|
235
|
+
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument mit den
|
|
236
|
+
* Angaben, die `getReceipt` liefert ([ListedFullReceipt]; Kopf je Version in
|
|
237
|
+
* `headers`, ohne Zeilenmodell), sonst [ListReceiptsSummary].
|
|
198
238
|
* Alle Seiten auf einmal: [listAllReceipts].
|
|
199
239
|
*/
|
|
200
240
|
export declare function listReceipts<V extends ListReceiptsView = 'summary'>(transport: InternerTransport, options: ListReceiptsOptions<V>): Promise<ListReceiptsPage<V>>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LIST_RECEIPTS_ERROR_CODES = exports.LIST_ALL_RECEIPTS_MAX_PAGES = exports.LIST_RECEIPTS_DAYS_MAX = exports.LIST_RECEIPTS_LIMIT_MAX = exports.LIST_RECEIPTS_ORDERS = exports.LIST_RECEIPTS_VIEWS = void 0;
|
|
4
4
|
exports.fromListReceiptsSummaryPayload = fromListReceiptsSummaryPayload;
|
|
5
|
+
exports.listedReceiptWithCompany = listedReceiptWithCompany;
|
|
5
6
|
exports.listReceipts = listReceipts;
|
|
6
7
|
exports.listAllReceipts = listAllReceipts;
|
|
7
8
|
const index_js_1 = require("../enums/index.js");
|
|
@@ -225,6 +226,57 @@ function kopfdaten(roh) {
|
|
|
225
226
|
const label = roh.label;
|
|
226
227
|
return { ...(0, index_js_2.fromReceiptCompanyPayload)(roh), label: typeof label === 'string' ? label : '' };
|
|
227
228
|
}
|
|
229
|
+
const LOGO_STUFEN = ['S', 'M', 'L', 'XL'];
|
|
230
|
+
/** Ein Beleg der vollen Ansicht vom Draht: das Belegdokument und die Zusaetze, die `getReceipt` in der Huelle traegt. */
|
|
231
|
+
function vollerBeleg(roh) {
|
|
232
|
+
const beleg = (0, index_js_2.fromReceiptPayload)(roh);
|
|
233
|
+
if (typeof roh['testSignature'] === 'boolean')
|
|
234
|
+
beleg.testSignature = roh['testSignature'];
|
|
235
|
+
return beleg;
|
|
236
|
+
}
|
|
237
|
+
/** `headers` der vollen Ansicht: je Kopf-Version Kennung und Kopf. */
|
|
238
|
+
function koepfe(roh) {
|
|
239
|
+
if (!Array.isArray(roh) || roh.some((h) => !istObjekt(h)))
|
|
240
|
+
throw antwortfehler('headers ist keine Liste von Kopf-Versionen');
|
|
241
|
+
return roh.map((h) => ({
|
|
242
|
+
headerVersionId: typeof h['headerVersionId'] === 'string' && h['headerVersionId'] !== '' ? h['headerVersionId'] : null,
|
|
243
|
+
company: (0, index_js_2.fromReceiptCompanyPayload)(h),
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Ein Beleg der vollen Ansicht mit den Druck- und Anzeigedaten seiner Seite, in derselben Form wie
|
|
248
|
+
* `getReceiptWithCompany` (ohne `outputs`): der Kopf der Version des Belegs aus `headers` (Nullbelege ohne
|
|
249
|
+
* Logo, wie beim Server), Testkennzeichen, Logo-Stufe. `layout` ist immer `null` -- die Liste traegt kein
|
|
250
|
+
* Zeilenmodell; [receiptLayoutFromResult] baut es dann mit denselben Angaben, oder `getReceiptWithCompany`
|
|
251
|
+
* holt das des Servers. Von einem Backend vor dem 30.10.2026 (ohne `headers`) kommt der Kopf aus
|
|
252
|
+
* `metadata`, dem heutigen Stand.
|
|
253
|
+
*/
|
|
254
|
+
function listedReceiptWithCompany(page, receipt) {
|
|
255
|
+
const kennung = receipt.headerVersionId ?? null;
|
|
256
|
+
const eintrag = page.headers?.find((h) => h.headerVersionId === kennung);
|
|
257
|
+
let company;
|
|
258
|
+
if (eintrag)
|
|
259
|
+
company = { ...eintrag.company };
|
|
260
|
+
else if (page.metadata) {
|
|
261
|
+
const { label: _label, ...kopf } = page.metadata;
|
|
262
|
+
company = kopf;
|
|
263
|
+
}
|
|
264
|
+
else
|
|
265
|
+
company = (0, index_js_2.fromReceiptCompanyPayload)({});
|
|
266
|
+
const art = typeof receipt.receiptType === 'object' ? receipt.receiptType.value : receipt.receiptType;
|
|
267
|
+
if (art === index_js_1.ReceiptType.zero.value)
|
|
268
|
+
delete company.logoUrl;
|
|
269
|
+
return {
|
|
270
|
+
receipt,
|
|
271
|
+
company,
|
|
272
|
+
testCashregister: page.testCashregister === true,
|
|
273
|
+
testSignature: receipt.testSignature === true,
|
|
274
|
+
headerVersionId: kennung,
|
|
275
|
+
layout: null,
|
|
276
|
+
registrationInfo: receipt.registrationInfo ?? null,
|
|
277
|
+
logoScale: page.logoScale ?? 'M',
|
|
278
|
+
};
|
|
279
|
+
}
|
|
228
280
|
/**
|
|
229
281
|
* Eine Seite Belege der angemeldeten Kasse (`listReceipts`). Die Eingabe wird
|
|
230
282
|
* vor dem Senden nach den Regeln des Servers geprueft (genau eine Form des
|
|
@@ -232,8 +284,9 @@ function kopfdaten(roh) {
|
|
|
232
284
|
* `order`, `view`); ein Verstoss wirft [KasseneckValidationError] mit
|
|
233
285
|
* `scope: 'request'`, ohne dass etwas hinausgeht.
|
|
234
286
|
*
|
|
235
|
-
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument
|
|
236
|
-
*
|
|
287
|
+
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument mit den
|
|
288
|
+
* Angaben, die `getReceipt` liefert ([ListedFullReceipt]; Kopf je Version in
|
|
289
|
+
* `headers`, ohne Zeilenmodell), sonst [ListReceiptsSummary].
|
|
237
290
|
* Alle Seiten auf einmal: [listAllReceipts].
|
|
238
291
|
*/
|
|
239
292
|
async function listReceipts(transport, options) {
|
|
@@ -254,14 +307,20 @@ async function listReceipts(transport, options) {
|
|
|
254
307
|
throw antwortfehler('nextCursor passt nicht zu hasMore (Text bei hasMore, sonst null)');
|
|
255
308
|
}
|
|
256
309
|
const receipts = (voll
|
|
257
|
-
? liste.map((b) => (
|
|
310
|
+
? liste.map((b) => vollerBeleg(b))
|
|
258
311
|
: liste.map((b) => fromListReceiptsSummaryPayload(b)));
|
|
312
|
+
const stufe = daten['logo_scale'];
|
|
259
313
|
return {
|
|
260
314
|
receipts,
|
|
261
315
|
hasMore: daten['hasMore'],
|
|
262
316
|
nextCursor: daten['hasMore'] ? weiter : null,
|
|
263
317
|
...('daySummary' in daten ? { daySummary: tagessumme(daten['daySummary']) } : {}),
|
|
264
318
|
...(voll && 'metadata' in daten ? { metadata: kopfdaten(daten['metadata']) } : {}),
|
|
319
|
+
...(voll && 'headers' in daten ? { headers: koepfe(daten['headers']) } : {}),
|
|
320
|
+
...(voll && 'testCashregister' in daten ? { testCashregister: (daten['testCashregister'] === true) } : {}),
|
|
321
|
+
...(voll && 'logo_scale' in daten
|
|
322
|
+
? { logoScale: (typeof stufe === 'string' && LOGO_STUFEN.includes(stufe) ? stufe : 'M') }
|
|
323
|
+
: {}),
|
|
265
324
|
};
|
|
266
325
|
}
|
|
267
326
|
/**
|
|
@@ -926,7 +926,7 @@ function cardRefundReference(receipt, paymentId) {
|
|
|
926
926
|
throw new errors_js_1.KasseneckValidationError('cancelReceipt', `Zahlung "${paymentId}" ist keine Kartenzahlung`, 'request');
|
|
927
927
|
}
|
|
928
928
|
if (typeof zahlung.providerPaymentId !== 'string' || zahlung.providerPaymentId === '') {
|
|
929
|
-
throw new errors_js_1.KasseneckValidationError('cancelReceipt', `Kennung der Kartenzahlung "${paymentId}" fehlt: sie
|
|
929
|
+
throw new errors_js_1.KasseneckValidationError('cancelReceipt', `Kennung der Kartenzahlung "${paymentId}" fehlt: der Beleg kam ohne Anbieterdaten (sie bekommt nur der Betrieb selbst, mit API-Schluessel oder Kassen-Anmeldung, nie ein Partner-Zugang)`, 'request');
|
|
930
930
|
}
|
|
931
931
|
return zahlung.providerPaymentId;
|
|
932
932
|
}
|
|
@@ -952,7 +952,7 @@ function pruefeKartenRueckbuchung(zahlungen, original) {
|
|
|
952
952
|
const orig = original != null && typeof z['refundOf'] === 'string' ? original.payments?.find((o) => o.id === z['refundOf']) : undefined;
|
|
953
953
|
if (typeof orig?.providerPaymentId === 'string' && orig.providerPaymentId !== '')
|
|
954
954
|
return;
|
|
955
|
-
throw new errors_js_1.KasseneckValidationError('cancelReceipt', `Zahlung ${i + 1}: Karten-Rueckbuchung ohne Bezug: providerPaymentId der Erstattung am Terminal angeben (oder das Original
|
|
955
|
+
throw new errors_js_1.KasseneckValidationError('cancelReceipt', `Zahlung ${i + 1}: Karten-Rueckbuchung ohne Bezug: providerPaymentId der Erstattung am Terminal angeben (oder das Original mit Anbieterdaten lesen: API-Schluessel des Betriebs oder Kassen-Anmeldung, dort traegt es die Kennung der Kartenzahlung)`, 'request');
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
958
|
/** Kartenanbieter pruefen — er stammt vom Aufrufer, nicht aus Serverdaten. */
|
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, isVoucherItem, isVoucherFloatItem, type Voucher, type VoucherArticle, type IssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, RECEIPT_OUTPUT_KINDS, type ReceiptOutputKind, RECEIPT_OUTPUT_LOG_KINDS, type ReceiptOutputLogKind, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputResult, RECEIPT_OUTPUT_ENTRIES_MAX, type ReceiptOutput, type ReceiptOutputActor, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, type ReceiptOutputEntryErrorCode, RECEIPT_OUTPUT_ERROR_CODES, type ReceiptOutputErrorCode, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, type ReceiptOutputFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
|
|
3
|
-
export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type TransportCallOptions, type KasseneckTransport, type KasseneckBinaryTransport, type KasseneckPdfOrDataTransport, type PdfOrData, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, createPdfOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
|
|
3
|
+
export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type TransportCallOptions, type KasseneckTransport, type KasseneckBinaryTransport, type KasseneckPdfOrDataTransport, type PdfOrData, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, createPdfOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, type ListedFullReceipt, type ListReceiptsHeader, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
|
|
4
4
|
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, type VoucherDueInfo, type VoucherDueArticle, type VoucherDueType, type VoucherRedeemContext, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './receipt/due.js';
|
|
5
5
|
export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
|
|
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, stockViewOf, voucherPermsOf, } from './pos/index.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RECEIPT_OUTPUT_LOG_KINDS = exports.RECEIPT_OUTPUT_KINDS = 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.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.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isVoucherFloatItem = exports.isVoucherItem = 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.createPdfOrDataTransport = exports.createBinaryTransport = exports.createTransport = exports.UNKNOWN_OUTCOME_CALLS = 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 = exports.fromReceiptCompanyPayload = exports.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = 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 = void 0;
|
|
5
|
-
exports.
|
|
6
|
-
exports.voucherPermsOf = exports.stockViewOf = 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.VOUCHER_ZERO_RATE_BUCKET_FROM = void 0;
|
|
5
|
+
exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.LIST_RECEIPTS_ERROR_CODES = exports.LIST_ALL_RECEIPTS_MAX_PAGES = exports.LIST_RECEIPTS_DAYS_MAX = exports.LIST_RECEIPTS_LIMIT_MAX = exports.LIST_RECEIPTS_ORDERS = exports.LIST_RECEIPTS_VIEWS = exports.listedReceiptWithCompany = exports.fromListReceiptsSummaryPayload = exports.listAllReceipts = exports.listReceipts = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = exports.logReceiptOutputs = exports.sendReceiptEmail = exports.checkVoucherCombinationError = exports.listMyCashregisters = 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 = void 0;
|
|
6
|
+
exports.voucherPermsOf = exports.stockViewOf = 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.VOUCHER_ZERO_RATE_BUCKET_FROM = exports.voucherRedeemMaxCents = void 0;
|
|
7
7
|
var index_js_1 = require("./enums/index.js");
|
|
8
8
|
Object.defineProperty(exports, "ReceiptType", { enumerable: true, get: function () { return index_js_1.ReceiptType; } });
|
|
9
9
|
Object.defineProperty(exports, "VatRate", { enumerable: true, get: function () { return index_js_1.VatRate; } });
|
|
@@ -142,6 +142,7 @@ Object.defineProperty(exports, "getReportV2", { enumerable: true, get: function
|
|
|
142
142
|
Object.defineProperty(exports, "listReceipts", { enumerable: true, get: function () { return index_js_3.listReceipts; } });
|
|
143
143
|
Object.defineProperty(exports, "listAllReceipts", { enumerable: true, get: function () { return index_js_3.listAllReceipts; } });
|
|
144
144
|
Object.defineProperty(exports, "fromListReceiptsSummaryPayload", { enumerable: true, get: function () { return index_js_3.fromListReceiptsSummaryPayload; } });
|
|
145
|
+
Object.defineProperty(exports, "listedReceiptWithCompany", { enumerable: true, get: function () { return index_js_3.listedReceiptWithCompany; } });
|
|
145
146
|
Object.defineProperty(exports, "LIST_RECEIPTS_VIEWS", { enumerable: true, get: function () { return index_js_3.LIST_RECEIPTS_VIEWS; } });
|
|
146
147
|
Object.defineProperty(exports, "LIST_RECEIPTS_ORDERS", { enumerable: true, get: function () { return index_js_3.LIST_RECEIPTS_ORDERS; } });
|
|
147
148
|
Object.defineProperty(exports, "LIST_RECEIPTS_LIMIT_MAX", { enumerable: true, get: function () { return index_js_3.LIST_RECEIPTS_LIMIT_MAX; } });
|
|
@@ -25,9 +25,11 @@ import { type ReceiptPayment, type ReceiptPaymentPayload } from './receipt-payme
|
|
|
25
25
|
* **Zahlungen stehen in `payments`.** `paymentMethod` vergibt der Server
|
|
26
26
|
* (`mixed` bei mehreren Zahlarten); gesendet wird es unter `/v3` nie. Die
|
|
27
27
|
* Anbieterdaten (`payments[].providerPaymentId`/`providerData`, bei
|
|
28
|
-
* Altbelegen `cardPaymentId`/`cardPaymentData`)
|
|
29
|
-
* (
|
|
30
|
-
*
|
|
28
|
+
* Altbelegen `cardPaymentId`/`cardPaymentData`) bekommt nur der Betrieb
|
|
29
|
+
* selbst (API-Schluessel oder Kassen-Anmeldung, in beiden Kanaelen); ein
|
|
30
|
+
* Partner-Zugang nie. Darum sind sie hier optional. `providerData` ist die
|
|
31
|
+
* Rohform des Zahlungsanbieters ohne zugesagte Form; fuer Logik `provider`,
|
|
32
|
+
* `providerPaymentId` und `id` nehmen.
|
|
31
33
|
*/
|
|
32
34
|
export interface Receipt {
|
|
33
35
|
receiptId: string;
|
|
@@ -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 = "f9d375a30bfb51addc8405dd6f5c24928ebc628166ae5ebf2b0c43d9f19701dd";
|
|
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 = "f9d375a30bfb51addc8405dd6f5c24928ebc628166ae5ebf2b0c43d9f19701dd";
|
|
8
8
|
/** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
|
|
9
9
|
exports.SCHEMAS = {
|
|
10
10
|
"getReceipt": {
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
|
@@ -4,7 +4,7 @@ export { ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS
|
|
|
4
4
|
export { 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, } from './errors.js';
|
|
5
5
|
export { type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, type CancelReceiptResult, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, } from './receipts.js';
|
|
6
6
|
export { listMyCashregisters } from './cashregisters.js';
|
|
7
|
-
export { listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, } from './list-receipts.js';
|
|
7
|
+
export { listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, type ListedFullReceipt, type ListReceiptsHeader, } from './list-receipts.js';
|
|
8
8
|
export { downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2, type CashregisterReportPeriod, type ReportV2, type ReportV2Metadata, type ReportV2Options } from './reports.js';
|
|
9
9
|
export { type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, } from './status.js';
|
|
10
10
|
export { type KasseneckApi, createKasseneckApi } from './api.js';
|
package/dist/esm/client/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { ALL_CALLS, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, } from './au
|
|
|
4
4
|
export { KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, CLIENT_ERROR_CODES, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, } from './errors.js';
|
|
5
5
|
export { sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, checkVoucherCombinationError, sendReceiptEmail, logReceiptOutputs, } from './receipts.js';
|
|
6
6
|
export { listMyCashregisters } from './cashregisters.js';
|
|
7
|
-
export { listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, } from './list-receipts.js';
|
|
7
|
+
export { listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, } from './list-receipts.js';
|
|
8
8
|
export { downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2 } from './reports.js';
|
|
9
9
|
export { getCashboxStatus, getSignatureStatus, } from './status.js';
|
|
10
10
|
export { createKasseneckApi } from './api.js';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { KeckPaymentMethod, ReceiptType } from '../enums/index.js';
|
|
2
|
-
import { type CancellationReason, type CancellationStatus, type Receipt, type ReceiptPayment, type ZeroKind } from '../models/index.js';
|
|
2
|
+
import { type CancellationReason, type CancellationStatus, type Receipt, type ReceiptCompany, type ReceiptPayment, type ZeroKind } from '../models/index.js';
|
|
3
3
|
import type { ReportV2Metadata } from './reports.js';
|
|
4
|
+
import type { ReceiptWithCompany } from './receipts.js';
|
|
5
|
+
import type { SheetLogoSize } from '../receipt/blatt.js';
|
|
4
6
|
import { type ManualReceipt } from '../models/manual-receipt.js';
|
|
5
7
|
import type { InternerTransport } from './aufrufe.js';
|
|
6
8
|
/**
|
|
@@ -147,8 +149,26 @@ export interface ListReceiptsSummary {
|
|
|
147
149
|
/** Nur an nacherfassten Belegen: der Handbeleg. */
|
|
148
150
|
manualReceipt?: ManualReceipt;
|
|
149
151
|
}
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Ein Beleg der vollen Ansicht: das Belegdokument wie bei `getReceipt`, dazu was `getReceipt` in der Huelle
|
|
154
|
+
* traegt, ausser `outputs` und dem Zeilenmodell `layout` (die gibt es nur einzeln ueber `getReceipt`).
|
|
155
|
+
* `headerVersionId` ist die Kopf-Version, die fuer diesen Beleg gilt (auch bei Altbelegen ohne gespeicherte
|
|
156
|
+
* Kennung); ihr Kopf steht in [ListReceiptsPage.headers]. Anbieterdaten der Zahlungen bekommt nur der Betrieb
|
|
157
|
+
* selbst (API-Schluessel oder Kassen-Anmeldung), nie ein Partner-Zugang.
|
|
158
|
+
* Druck- und Anzeigedaten wie bei `getReceiptWithCompany`: [listedReceiptWithCompany].
|
|
159
|
+
*/
|
|
160
|
+
export interface ListedFullReceipt extends Receipt {
|
|
161
|
+
/** Produktionskonto mit Test-Signatureinheit (Aufdruck TESTSIGNATUR); fehlt bei einem Backend vor dem 30.10.2026. */
|
|
162
|
+
testSignature?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** Ein Eintrag in [ListReceiptsPage.headers]: Kopf und Fuss einer Kopf-Version (Felder wie die Huelle von `getReceipt`). */
|
|
165
|
+
export interface ListReceiptsHeader {
|
|
166
|
+
/** `null` nur, wenn das Konto noch keine Kopf-Version hat (dann der heutige Stand). */
|
|
167
|
+
headerVersionId: string | null;
|
|
168
|
+
company: ReceiptCompany;
|
|
169
|
+
}
|
|
170
|
+
/** Ein Beleg der Liste je Ansicht: `full` das Belegdokument wie bei `getReceipt`, sonst die Zeile. */
|
|
171
|
+
export type ListedReceipt<V extends ListReceiptsView = 'summary'> = V extends 'full' ? ListedFullReceipt : ListReceiptsSummary;
|
|
152
172
|
/**
|
|
153
173
|
* Tagessumme aus der Tagesstatistik der Kasse, nur bei `date` und nur auf
|
|
154
174
|
* der ersten Seite. **Nicht die Summe der Liste:** `receiptCount` zaehlt jeden
|
|
@@ -183,9 +203,28 @@ export interface ListReceiptsPage<V extends ListReceiptsView = 'summary'> {
|
|
|
183
203
|
* `getReportV2().metadata`. Bei der Kurzansicht fehlt das Feld.
|
|
184
204
|
*/
|
|
185
205
|
metadata?: V extends 'full' ? ReportV2Metadata : never;
|
|
206
|
+
/**
|
|
207
|
+
* Nur bei `view: 'full'`: die Kopf-Versionen der Belege dieser Seite, je Version einmal, aelteste zuerst.
|
|
208
|
+
* Fuer den Druck gilt der Eintrag mit der `headerVersionId` des Belegs, nicht `metadata` (heutiger Stand).
|
|
209
|
+
* Fehlt bei einem Backend vor dem 30.10.2026.
|
|
210
|
+
*/
|
|
211
|
+
headers?: V extends 'full' ? ListReceiptsHeader[] : never;
|
|
212
|
+
/** Nur bei `view: 'full'`: Belege einer Testumgebung (Aufdruck TESTKASSE), wie `getReceipt`. */
|
|
213
|
+
testCashregister?: V extends 'full' ? boolean : never;
|
|
214
|
+
/** Nur bei `view: 'full'`: Groesse des Firmenlogos (`logo_scale`), wie `getReceipt`. */
|
|
215
|
+
logoScale?: V extends 'full' ? SheetLogoSize : never;
|
|
186
216
|
}
|
|
187
217
|
/** Zeile `view: summary` vom Draht. */
|
|
188
218
|
export declare function fromListReceiptsSummaryPayload(payload: Record<string, unknown>): ListReceiptsSummary;
|
|
219
|
+
/**
|
|
220
|
+
* Ein Beleg der vollen Ansicht mit den Druck- und Anzeigedaten seiner Seite, in derselben Form wie
|
|
221
|
+
* `getReceiptWithCompany` (ohne `outputs`): der Kopf der Version des Belegs aus `headers` (Nullbelege ohne
|
|
222
|
+
* Logo, wie beim Server), Testkennzeichen, Logo-Stufe. `layout` ist immer `null` -- die Liste traegt kein
|
|
223
|
+
* Zeilenmodell; [receiptLayoutFromResult] baut es dann mit denselben Angaben, oder `getReceiptWithCompany`
|
|
224
|
+
* holt das des Servers. Von einem Backend vor dem 30.10.2026 (ohne `headers`) kommt der Kopf aus
|
|
225
|
+
* `metadata`, dem heutigen Stand.
|
|
226
|
+
*/
|
|
227
|
+
export declare function listedReceiptWithCompany(page: ListReceiptsPage<'full'>, receipt: ListedFullReceipt): ReceiptWithCompany;
|
|
189
228
|
/**
|
|
190
229
|
* Eine Seite Belege der angemeldeten Kasse (`listReceipts`). Die Eingabe wird
|
|
191
230
|
* vor dem Senden nach den Regeln des Servers geprueft (genau eine Form des
|
|
@@ -193,8 +232,9 @@ export declare function fromListReceiptsSummaryPayload(payload: Record<string, u
|
|
|
193
232
|
* `order`, `view`); ein Verstoss wirft [KasseneckValidationError] mit
|
|
194
233
|
* `scope: 'request'`, ohne dass etwas hinausgeht.
|
|
195
234
|
*
|
|
196
|
-
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument
|
|
197
|
-
*
|
|
235
|
+
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument mit den
|
|
236
|
+
* Angaben, die `getReceipt` liefert ([ListedFullReceipt]; Kopf je Version in
|
|
237
|
+
* `headers`, ohne Zeilenmodell), sonst [ListReceiptsSummary].
|
|
198
238
|
* Alle Seiten auf einmal: [listAllReceipts].
|
|
199
239
|
*/
|
|
200
240
|
export declare function listReceipts<V extends ListReceiptsView = 'summary'>(transport: InternerTransport, options: ListReceiptsOptions<V>): Promise<ListReceiptsPage<V>>;
|
|
@@ -219,6 +219,57 @@ function kopfdaten(roh) {
|
|
|
219
219
|
const label = roh.label;
|
|
220
220
|
return { ...fromReceiptCompanyPayload(roh), label: typeof label === 'string' ? label : '' };
|
|
221
221
|
}
|
|
222
|
+
const LOGO_STUFEN = ['S', 'M', 'L', 'XL'];
|
|
223
|
+
/** Ein Beleg der vollen Ansicht vom Draht: das Belegdokument und die Zusaetze, die `getReceipt` in der Huelle traegt. */
|
|
224
|
+
function vollerBeleg(roh) {
|
|
225
|
+
const beleg = fromReceiptPayload(roh);
|
|
226
|
+
if (typeof roh['testSignature'] === 'boolean')
|
|
227
|
+
beleg.testSignature = roh['testSignature'];
|
|
228
|
+
return beleg;
|
|
229
|
+
}
|
|
230
|
+
/** `headers` der vollen Ansicht: je Kopf-Version Kennung und Kopf. */
|
|
231
|
+
function koepfe(roh) {
|
|
232
|
+
if (!Array.isArray(roh) || roh.some((h) => !istObjekt(h)))
|
|
233
|
+
throw antwortfehler('headers ist keine Liste von Kopf-Versionen');
|
|
234
|
+
return roh.map((h) => ({
|
|
235
|
+
headerVersionId: typeof h['headerVersionId'] === 'string' && h['headerVersionId'] !== '' ? h['headerVersionId'] : null,
|
|
236
|
+
company: fromReceiptCompanyPayload(h),
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Ein Beleg der vollen Ansicht mit den Druck- und Anzeigedaten seiner Seite, in derselben Form wie
|
|
241
|
+
* `getReceiptWithCompany` (ohne `outputs`): der Kopf der Version des Belegs aus `headers` (Nullbelege ohne
|
|
242
|
+
* Logo, wie beim Server), Testkennzeichen, Logo-Stufe. `layout` ist immer `null` -- die Liste traegt kein
|
|
243
|
+
* Zeilenmodell; [receiptLayoutFromResult] baut es dann mit denselben Angaben, oder `getReceiptWithCompany`
|
|
244
|
+
* holt das des Servers. Von einem Backend vor dem 30.10.2026 (ohne `headers`) kommt der Kopf aus
|
|
245
|
+
* `metadata`, dem heutigen Stand.
|
|
246
|
+
*/
|
|
247
|
+
export function listedReceiptWithCompany(page, receipt) {
|
|
248
|
+
const kennung = receipt.headerVersionId ?? null;
|
|
249
|
+
const eintrag = page.headers?.find((h) => h.headerVersionId === kennung);
|
|
250
|
+
let company;
|
|
251
|
+
if (eintrag)
|
|
252
|
+
company = { ...eintrag.company };
|
|
253
|
+
else if (page.metadata) {
|
|
254
|
+
const { label: _label, ...kopf } = page.metadata;
|
|
255
|
+
company = kopf;
|
|
256
|
+
}
|
|
257
|
+
else
|
|
258
|
+
company = fromReceiptCompanyPayload({});
|
|
259
|
+
const art = typeof receipt.receiptType === 'object' ? receipt.receiptType.value : receipt.receiptType;
|
|
260
|
+
if (art === ReceiptType.zero.value)
|
|
261
|
+
delete company.logoUrl;
|
|
262
|
+
return {
|
|
263
|
+
receipt,
|
|
264
|
+
company,
|
|
265
|
+
testCashregister: page.testCashregister === true,
|
|
266
|
+
testSignature: receipt.testSignature === true,
|
|
267
|
+
headerVersionId: kennung,
|
|
268
|
+
layout: null,
|
|
269
|
+
registrationInfo: receipt.registrationInfo ?? null,
|
|
270
|
+
logoScale: page.logoScale ?? 'M',
|
|
271
|
+
};
|
|
272
|
+
}
|
|
222
273
|
/**
|
|
223
274
|
* Eine Seite Belege der angemeldeten Kasse (`listReceipts`). Die Eingabe wird
|
|
224
275
|
* vor dem Senden nach den Regeln des Servers geprueft (genau eine Form des
|
|
@@ -226,8 +277,9 @@ function kopfdaten(roh) {
|
|
|
226
277
|
* `order`, `view`); ein Verstoss wirft [KasseneckValidationError] mit
|
|
227
278
|
* `scope: 'request'`, ohne dass etwas hinausgeht.
|
|
228
279
|
*
|
|
229
|
-
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument
|
|
230
|
-
*
|
|
280
|
+
* Mit `view: 'full'` sind die Belege das gespeicherte Belegdokument mit den
|
|
281
|
+
* Angaben, die `getReceipt` liefert ([ListedFullReceipt]; Kopf je Version in
|
|
282
|
+
* `headers`, ohne Zeilenmodell), sonst [ListReceiptsSummary].
|
|
231
283
|
* Alle Seiten auf einmal: [listAllReceipts].
|
|
232
284
|
*/
|
|
233
285
|
export async function listReceipts(transport, options) {
|
|
@@ -248,14 +300,20 @@ export async function listReceipts(transport, options) {
|
|
|
248
300
|
throw antwortfehler('nextCursor passt nicht zu hasMore (Text bei hasMore, sonst null)');
|
|
249
301
|
}
|
|
250
302
|
const receipts = (voll
|
|
251
|
-
? liste.map((b) =>
|
|
303
|
+
? liste.map((b) => vollerBeleg(b))
|
|
252
304
|
: liste.map((b) => fromListReceiptsSummaryPayload(b)));
|
|
305
|
+
const stufe = daten['logo_scale'];
|
|
253
306
|
return {
|
|
254
307
|
receipts,
|
|
255
308
|
hasMore: daten['hasMore'],
|
|
256
309
|
nextCursor: daten['hasMore'] ? weiter : null,
|
|
257
310
|
...('daySummary' in daten ? { daySummary: tagessumme(daten['daySummary']) } : {}),
|
|
258
311
|
...(voll && 'metadata' in daten ? { metadata: kopfdaten(daten['metadata']) } : {}),
|
|
312
|
+
...(voll && 'headers' in daten ? { headers: koepfe(daten['headers']) } : {}),
|
|
313
|
+
...(voll && 'testCashregister' in daten ? { testCashregister: (daten['testCashregister'] === true) } : {}),
|
|
314
|
+
...(voll && 'logo_scale' in daten
|
|
315
|
+
? { logoScale: (typeof stufe === 'string' && LOGO_STUFEN.includes(stufe) ? stufe : 'M') }
|
|
316
|
+
: {}),
|
|
259
317
|
};
|
|
260
318
|
}
|
|
261
319
|
/**
|