@kreiseck/kasseneck-api 1.11.0 → 1.12.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 +21 -0
- package/README.md +2 -1
- package/dist/cjs/client/aufrufe.d.ts +4 -4
- package/dist/cjs/client/aufrufe.js +15 -0
- package/dist/cjs/client/receipts.d.ts +5 -0
- package/dist/cjs/client/receipts.js +65 -6
- package/dist/cjs/enums/voucher-action.d.ts +2 -0
- package/dist/cjs/enums/voucher-action.js +2 -0
- package/dist/cjs/enums/voucher-type.d.ts +10 -0
- package/dist/cjs/enums/voucher-type.js +10 -0
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +9 -3
- package/dist/cjs/models/index.d.ts +3 -3
- package/dist/cjs/models/index.js +7 -2
- package/dist/cjs/models/receipt-errors.d.ts +1 -1
- package/dist/cjs/models/receipt-errors.js +2 -0
- package/dist/cjs/models/receipt-item.d.ts +11 -3
- package/dist/cjs/models/receipt-item.js +22 -1
- package/dist/cjs/models/receipt.d.ts +31 -1
- package/dist/cjs/models/receipt.js +45 -5
- package/dist/cjs/models/voucher.d.ts +57 -4
- package/dist/cjs/models/voucher.js +111 -3
- package/dist/cjs/partner/fehler.d.ts +1 -1
- package/dist/cjs/partner/fehler.js +2 -0
- package/dist/cjs/partner/index.d.ts +1 -1
- package/dist/cjs/partner/typen.d.ts +7 -1
- package/dist/cjs/partner/typen.js +3 -0
- package/dist/cjs/pos/client.d.ts +2 -1
- package/dist/cjs/pos/client.js +3 -1
- package/dist/cjs/pos/gutschein.d.ts +90 -0
- package/dist/cjs/pos/gutschein.js +164 -0
- package/dist/cjs/pos/index.d.ts +3 -2
- package/dist/cjs/pos/index.js +13 -2
- package/dist/cjs/pos/settings.d.ts +3 -0
- package/dist/cjs/pos/settings.js +12 -10
- package/dist/cjs/pos/texte.d.ts +156 -0
- package/dist/cjs/pos/texte.js +72 -1
- package/dist/cjs/react/index.js +8 -2
- package/dist/cjs/receipt/due.d.ts +83 -2
- package/dist/cjs/receipt/due.js +202 -36
- package/dist/cjs/receipt/grid.js +13 -1
- package/dist/cjs/receipt/gutschein-plan.d.ts +104 -0
- package/dist/cjs/receipt/gutschein-plan.js +360 -0
- package/dist/cjs/receipt/index.d.ts +1 -1
- package/dist/cjs/receipt/index.js +3 -0
- package/dist/cjs/receipt/layout.js +186 -10
- package/dist/cjs/register/pairing.d.ts +21 -1
- package/dist/cjs/register/pairing.js +17 -0
- package/dist/cjs/stored/bon-layout.d.ts +8 -0
- package/dist/cjs/stored/bon-layout.js +23 -0
- package/dist/cjs/stored/draht.d.ts +3 -1
- package/dist/cjs/stored/draht.js +53 -6
- package/dist/cjs/stored/einstellungen.js +2 -1
- package/dist/cjs/stored/gutscheine.d.ts +3 -0
- package/dist/cjs/stored/gutscheine.js +60 -0
- package/dist/cjs/stored/index.js +2 -17
- package/dist/cjs/stored/vokabular.d.ts +6 -4
- package/dist/cjs/stored/vokabular.js +48 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +4 -4
- package/dist/esm/client/aufrufe.js +15 -0
- package/dist/esm/client/receipts.d.ts +5 -0
- package/dist/esm/client/receipts.js +66 -8
- package/dist/esm/enums/voucher-action.d.ts +2 -0
- package/dist/esm/enums/voucher-action.js +2 -0
- package/dist/esm/enums/voucher-type.d.ts +10 -0
- package/dist/esm/enums/voucher-type.js +10 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/models/index.d.ts +3 -3
- package/dist/esm/models/index.js +3 -3
- package/dist/esm/models/receipt-errors.d.ts +1 -1
- package/dist/esm/models/receipt-errors.js +2 -0
- package/dist/esm/models/receipt-item.d.ts +11 -3
- package/dist/esm/models/receipt-item.js +20 -1
- package/dist/esm/models/receipt.d.ts +31 -1
- package/dist/esm/models/receipt.js +44 -5
- package/dist/esm/models/voucher.d.ts +57 -4
- package/dist/esm/models/voucher.js +108 -3
- package/dist/esm/partner/fehler.d.ts +1 -1
- package/dist/esm/partner/fehler.js +2 -0
- package/dist/esm/partner/index.d.ts +1 -1
- package/dist/esm/partner/typen.d.ts +7 -1
- package/dist/esm/partner/typen.js +3 -0
- package/dist/esm/pos/client.d.ts +2 -1
- package/dist/esm/pos/client.js +3 -1
- package/dist/esm/pos/gutschein.d.ts +90 -0
- package/dist/esm/pos/gutschein.js +158 -0
- package/dist/esm/pos/index.d.ts +3 -2
- package/dist/esm/pos/index.js +4 -2
- package/dist/esm/pos/settings.d.ts +3 -0
- package/dist/esm/pos/settings.js +2 -0
- package/dist/esm/pos/texte.d.ts +156 -0
- package/dist/esm/pos/texte.js +70 -0
- package/dist/esm/react/index.js +8 -2
- package/dist/esm/receipt/due.d.ts +83 -2
- package/dist/esm/receipt/due.js +198 -34
- package/dist/esm/receipt/grid.js +13 -1
- package/dist/esm/receipt/gutschein-plan.d.ts +104 -0
- package/dist/esm/receipt/gutschein-plan.js +352 -0
- package/dist/esm/receipt/index.d.ts +1 -1
- package/dist/esm/receipt/index.js +1 -1
- package/dist/esm/receipt/layout.js +187 -11
- package/dist/esm/register/pairing.d.ts +21 -1
- package/dist/esm/register/pairing.js +16 -0
- package/dist/esm/stored/bon-layout.d.ts +8 -0
- package/dist/esm/stored/bon-layout.js +20 -0
- package/dist/esm/stored/draht.d.ts +3 -1
- package/dist/esm/stored/draht.js +52 -6
- package/dist/esm/stored/einstellungen.js +3 -2
- package/dist/esm/stored/gutscheine.d.ts +3 -0
- package/dist/esm/stored/gutscheine.js +56 -0
- package/dist/esm/stored/index.js +2 -17
- package/dist/esm/stored/vokabular.d.ts +6 -4
- package/dist/esm/stored/vokabular.js +48 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/expected/voucher-cancellation.grid32.txt +30 -0
- package/fixtures/expected/voucher-cancellation.grid48.txt +29 -0
- package/fixtures/expected/voucher-cancellation.lines.json +252 -0
- package/fixtures/expected/voucher-cancellation.sheet32.json +206 -0
- package/fixtures/expected/voucher-cancellation.sheet48.json +200 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.grid32.txt +25 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.grid48.txt +25 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.lines.json +259 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.sheet32.json +176 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.sheet48.json +176 -0
- package/fixtures/expected/voucher-multi-purpose-sale.grid32.txt +24 -0
- package/fixtures/expected/voucher-multi-purpose-sale.grid48.txt +23 -0
- package/fixtures/expected/voucher-multi-purpose-sale.lines.json +216 -0
- package/fixtures/expected/voucher-multi-purpose-sale.sheet32.json +170 -0
- package/fixtures/expected/voucher-multi-purpose-sale.sheet48.json +164 -0
- package/fixtures/expected/voucher-payout.grid32.txt +23 -0
- package/fixtures/expected/voucher-payout.grid48.txt +22 -0
- package/fixtures/expected/voucher-payout.lines.json +216 -0
- package/fixtures/expected/voucher-payout.sheet32.json +164 -0
- package/fixtures/expected/voucher-payout.sheet48.json +158 -0
- package/fixtures/expected/voucher-service-redeem.grid32.txt +26 -0
- package/fixtures/expected/voucher-service-redeem.grid48.txt +25 -0
- package/fixtures/expected/voucher-service-redeem.lines.json +261 -0
- package/fixtures/expected/voucher-service-redeem.sheet32.json +182 -0
- package/fixtures/expected/voucher-service-redeem.sheet48.json +176 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.grid32.txt +30 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.grid48.txt +29 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.lines.json +331 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.sheet32.json +206 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.sheet48.json +200 -0
- package/fixtures/expected/voucher-single-purpose-redeem.grid32.txt +25 -0
- package/fixtures/expected/voucher-single-purpose-redeem.grid48.txt +24 -0
- package/fixtures/expected/voucher-single-purpose-redeem.lines.json +246 -0
- package/fixtures/expected/voucher-single-purpose-redeem.sheet32.json +176 -0
- package/fixtures/expected/voucher-single-purpose-redeem.sheet48.json +170 -0
- package/fixtures/expected/voucher-single-purpose-sale.grid32.txt +26 -0
- package/fixtures/expected/voucher-single-purpose-sale.grid48.txt +24 -0
- package/fixtures/expected/voucher-single-purpose-sale.lines.json +225 -0
- package/fixtures/expected/voucher-single-purpose-sale.sheet32.json +182 -0
- package/fixtures/expected/voucher-single-purpose-sale.sheet48.json +170 -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 +64 -0
- package/fixtures/pos-texts.json +170 -1
- package/fixtures/receipt-due-generated.json +1 -1
- package/fixtures/receipt-due-voucher-generated.json +494 -0
- package/fixtures/receipts/voucher-cancellation.json +76 -0
- package/fixtures/receipts/voucher-multi-purpose-redeem.json +62 -0
- package/fixtures/receipts/voucher-multi-purpose-sale.json +63 -0
- package/fixtures/receipts/voucher-payout.json +65 -0
- package/fixtures/receipts/voucher-service-redeem.json +82 -0
- package/fixtures/receipts/voucher-single-purpose-redeem-exempt.json +86 -0
- package/fixtures/receipts/voucher-single-purpose-redeem.json +71 -0
- package/fixtures/receipts/voucher-single-purpose-sale.json +88 -0
- package/fixtures/surface.json +35 -5
- package/fixtures/v3/antworten/belege.json +3405 -3
- package/fixtures/v3/antworten/belegmail.json +5 -2
- package/fixtures/v3/antworten/kasse-belege.json +3423 -3
- package/fixtures/v3/antworten/kasse.json +621 -14
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +5 -2
- package/fixtures/v3/antworten/storno.json +214 -3
- package/fixtures/v3/stored/belege.json +5 -2
- package/fixtures/v3/stored/kasse.json +225 -4
- package/fixtures/v3/stored/rechnungen.json +5 -2
- package/fixtures/v3/v3-vokabular.json +1375 -23
- package/fixtures/v3/zahlbetrag-faelle.json +293 -3
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,27 @@ 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.12.0
|
|
8
|
+
|
|
9
|
+
Vouchers in the new form at the register (multi-purpose, single-purpose, service, promotional; code shown once). Additive for existing calls, with three notes for callers:
|
|
10
|
+
`PosSettings.vouchers` is a required field (fail-closed block of the register settings); a sale with a multi- or single-purpose voucher requires `voucherSettings` in the due options and throws `voucher_settings_missing` without it; new runtime dependency `@kreiseck/validator ^0.14.1`.
|
|
11
|
+
|
|
12
|
+
- **Model, reading, writing and request checks for new-form vouchers.** Reason: the backend moves vouchers from a plain value to a typed record (type, balance, validity, rate); the register must read them exactly and reject a request the server would reject before anything is sent, so no receipt number is wasted.
|
|
13
|
+
- **`checkVoucher` and `reprintVoucherLabel` at the register** (`./pos`, register path). The code goes over the wire as a secret, never into a log, cache or receipt. Reason: the cashier checks a code before selling or redeeming it; the label reprint needs the clear code once.
|
|
14
|
+
- **Voucher rights and `voucherPermsOf`.** Reason: redeem, sell and pay out are separate rights per role; both registers decide on the same function.
|
|
15
|
+
- **Settings block `vouchers` (fail-closed).** Reason: a missing or unreadable block must switch vouchers off, not on.
|
|
16
|
+
- **Due amount with new-form vouchers and `voucherRedeemMaxCents`.** Reason: a single-purpose voucher covers at most the items of its rate and at most its balance; the register pre-fills exactly that, so the server never answers `voucher_exceeds_total`/`voucher_rate_mismatch` for an honest input. The pre-filled maximum is checked with the same computation as the due amount, including half-cent rounding and the proportional split of exempt or small-business vouchers (also next to vouchers already chosen on the receipt), so it is never above what the server accepts and never 0 when it accepts at least one cent. A voucher that covers everything yields a due amount of 0 (no payment line, no card terminal).
|
|
17
|
+
- **Receipt layout and sums for the new form: each amount appears once.** Reason: incident of 16.10., where an amount was printed twice; the receipt shows `····-XXXX` for the position and `····-····-XXXX` for the entry, never the clear code.
|
|
18
|
+
- **`./stored` mirrors the server's voucher handling** (including `exempt`). Reason: the stored-document twin has to produce the same wire form as the server, or a receipt with the new form reads differently in the list than in the detail.
|
|
19
|
+
- **Contract catch-up** (signature card order, `activation_in_progress`; `RECEIPT_ERROR_CODES` now equals the `/v3` vocabulary, adding `server_error` and `voucher_balance_changed`). Reason: the re-fetched export contains them, and a test keeps the list equal to the vocabulary.
|
|
20
|
+
- **Texts and error sentences:** 22 labels (`voucher.*`, `cancellation.voucher_back`) and 17 sentences (`voucher_error.*`); `VOUCHER_ERROR_MESSAGES`/`voucherErrorMessage` map each voucher error code (`voucher_not_found` ... `too_many_voucher_checks`) to a sentence, also in `fixtures/pos-texts.json` (`voucherErrors`). Reason: both registers say the same words for the same error and decide on the code, never on the server's text.
|
|
21
|
+
|
|
22
|
+
## 1.11.1
|
|
23
|
+
|
|
24
|
+
- `receiptSumCents`, `receiptSubSumCents` and the receipt layout count value vouchers with the opposite sign on a cancellation receipt; new helper `receiptValueVoucherSign`. Reason: the backend mirrors value vouchers onto a full cancellation with the same `action` and a positive value, and reverses the flow there (`receiptDueCents` already did). The cancellation of a sale paid partly with a value voucher (22.40, 17.50 by voucher, 4.90 cash) showed "Total -39.90" instead of the -4.90 actually refunded; the cancelled sale of a value voucher showed +30.00 instead of -30.00.
|
|
25
|
+
- On a cancellation receipt a mirrored promotional voucher no longer reduces `receiptSubSumCents`/`receiptSumCents`; the layout shows it as a reference without an amount. Reason: the backend takes the discount back through compensation items (`kind: 'discount'`, "Gutschein-Ausgleich") and applies a promo entry only to a positive bucket total, which a cancellation never has. The cancellation of a 34.30 sale with a 10.00 promotional voucher showed "Total -34.30" instead of the -24.30 refunded.
|
|
26
|
+
- Receipts other than cancellations print the same bytes as in 1.11.0.
|
|
27
|
+
|
|
7
28
|
## 1.11.0
|
|
8
29
|
|
|
9
30
|
Shifts, cash position and drawer log at the register: `./pos` gains the six
|
package/README.md
CHANGED
|
@@ -194,7 +194,8 @@ to take payments, there is nothing to program:
|
|
|
194
194
|
|
|
195
195
|
**Runs in the browser and in Node.js.** ESM is the main format, CommonJS ships
|
|
196
196
|
alongside it, both with their own type declarations. Node 20.18 or later
|
|
197
|
-
(`fetch` must be available).
|
|
197
|
+
(`fetch` must be available). The only runtime dependency is `@kreiseck/validator`
|
|
198
|
+
(check digit of voucher codes). React 18 or
|
|
198
199
|
later is an optional peer dependency, needed only for `./react`.
|
|
199
200
|
|
|
200
201
|
Import only the subpath you need, so a Node program never pulls in the React
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* umhuellt, muss ihn weiterhin absetzen koennen.
|
|
14
14
|
*/
|
|
15
15
|
import type { PdfOrData, TransportBodyFields, TransportCallOptions } from './transport.js';
|
|
16
|
-
export declare const ALL_CALLS: readonly ["activateCashregister", "cancelInvoice", "cancelReceipt", "createCreditNote", "createCustomer", "createCustomerCashregister", "createPartnerCustomer", "checkPartnerCustomerEmail", "createPartnerWebhook", "createPaymentLinkStripe", "createPrintJob", "createReceipt", "deletePartnerWebhook", "downloadDailyReport", "downloadReport", "endRegisterSession", "financeWebService", "generateFullReceiptId", "getCashregisterReport", "getCustomer", "getCustomerCredentials", "getCustomerSignatureStatus", "getFirstReceiptDate", "getInvoice", "getInvoicePdf", "getInvoiceSetupStatus", "getInvoiceXml", "getKasseSettings", "getPartnerCustomer", "getPartnerInfo", "getPrintJob", "getReceipt", "getReportV2", "hobexPayApi", "hobexRefundApi", "issueInvoice", "listCustomerCashregisters", "listInvoices", "listBrands", "listMyArticleGroups", "listMyArticles", "listMyCashregisters", "listMyPrinters", "listMyReceipts", "listMyStock", "listMyStockLocations", "listMyTipRecipients", "listPartnerCustomers", "listPartnerWebhookDeliveries", "listPartnerWebhooks", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "pairRegisterDevice", "recordInvoicePayment", "registerPinLogin", "registerUserLogin", "renewRegisterSession", "reportCustomerContract", "requestCustomerSignature", "searchCustomers", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "unpairRegisterDevice", "rotatePartnerWebhookSecret", "updateCustomer", "updatePartnerWebhook", "getArticle", "listArticles", "lookupArticleByCode", "listLocations", "getStock", "listStock", "listStockMovements", "createWebhook", "updateWebhook", "deleteWebhook", "listWebhooks", "sendWebhookTest", "rotateWebhookSecret", "listWebhookDeliveries", "createArticle", "updateArticle", "deactivateArticle", "receiveGoods", "transferStock", "recordStockLoss", "changeStockCondition", "reverseStockMovement", "createReservation", "extendReservation", "releaseReservation", "getReservation", "listReservations", "createVariantGroup", "updateVariantGroup", "getVariantGroup", "listVariantGroups", "addVariant", "createStocktake", "listStocktakes", "getStocktake", "listStocktakeItems", "recordStocktakeCount", "voidStocktakeCount", "listStocktakeCounts", "reviewStocktake", "recountStocktake", "closeStocktake", "cancelStocktake", "getStocktakePdf", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift"];
|
|
16
|
+
export declare const ALL_CALLS: readonly ["activateCashregister", "cancelInvoice", "cancelReceipt", "createCreditNote", "createCustomer", "createCustomerCashregister", "createPartnerCustomer", "checkPartnerCustomerEmail", "createPartnerWebhook", "createPaymentLinkStripe", "createPrintJob", "createReceipt", "deletePartnerWebhook", "downloadDailyReport", "downloadReport", "endRegisterSession", "financeWebService", "generateFullReceiptId", "getCashregisterReport", "getCustomer", "getCustomerCredentials", "getCustomerSignatureStatus", "getFirstReceiptDate", "getInvoice", "getInvoicePdf", "getInvoiceSetupStatus", "getInvoiceXml", "getKasseSettings", "getPartnerCustomer", "getPartnerInfo", "getPrintJob", "getReceipt", "getReportV2", "hobexPayApi", "hobexRefundApi", "issueInvoice", "listCustomerCashregisters", "listInvoices", "listBrands", "listMyArticleGroups", "listMyArticles", "listMyCashregisters", "listMyPrinters", "listMyReceipts", "listMyStock", "listMyStockLocations", "listMyTipRecipients", "listPartnerCustomers", "listPartnerWebhookDeliveries", "listPartnerWebhooks", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "pairRegisterDevice", "recordInvoicePayment", "registerPinLogin", "registerUserLogin", "renewRegisterSession", "reportCustomerContract", "requestCustomerSignature", "searchCustomers", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "unpairRegisterDevice", "rotatePartnerWebhookSecret", "updateCustomer", "updatePartnerWebhook", "getArticle", "listArticles", "lookupArticleByCode", "listLocations", "getStock", "listStock", "listStockMovements", "createWebhook", "updateWebhook", "deleteWebhook", "listWebhooks", "sendWebhookTest", "rotateWebhookSecret", "listWebhookDeliveries", "createArticle", "updateArticle", "deactivateArticle", "receiveGoods", "transferStock", "recordStockLoss", "changeStockCondition", "reverseStockMovement", "createReservation", "extendReservation", "releaseReservation", "getReservation", "listReservations", "createVariantGroup", "updateVariantGroup", "getVariantGroup", "listVariantGroups", "addVariant", "createStocktake", "listStocktakes", "getStocktake", "listStocktakeItems", "recordStocktakeCount", "voidStocktakeCount", "listStocktakeCounts", "reviewStocktake", "recountStocktake", "closeStocktake", "cancelStocktake", "getStocktakePdf", "orderSignatureCard", "getSignatureCardOrder", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "checkVoucher", "reprintVoucherLabel", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift"];
|
|
17
17
|
export type ApiCall = typeof ALL_CALLS[number];
|
|
18
18
|
/**
|
|
19
19
|
* Die oeffentlichen Endpunkte unter `/v3` (`https://api.kasseneck.at/v3/<name>`),
|
|
@@ -21,14 +21,14 @@ export type ApiCall = typeof ALL_CALLS[number];
|
|
|
21
21
|
* (`fixtures/v3/v3-vokabular.json`, `endpoints.public`, umbenannt nach
|
|
22
22
|
* `names`). Ein Test haelt beide Listen deckungsgleich.
|
|
23
23
|
*/
|
|
24
|
-
export declare const PUBLIC_CALLS: readonly ["createReceipt", "getReceipt", "cancelReceipt", "sendReceiptEmail", "generateFullReceiptId", "downloadReceipt", "getFirstReceiptDate", "getReportV2", "downloadReport", "downloadDailyReport", "getCashregisterReport", "createPaymentLinkStripe", "stripeCaptureIntent", "hobexPayApi", "hobexRefundApi", "hobexGetStatus", "financeWebService", "listMyTipRecipients", "getPartnerInfo", "createPartnerCustomer", "checkPartnerCustomerEmail", "listPartnerCustomers", "getPartnerCustomer", "sendPartnerCustomerFonLink", "createPartnerWebhook", "updatePartnerWebhook", "deletePartnerWebhook", "listPartnerWebhooks", "sendPartnerWebhookTest", "rotatePartnerWebhookSecret", "listPartnerWebhookDeliveries", "requestCustomerSignature", "getCustomerSignatureStatus", "createCustomerCashregister", "activateCashregister", "listCustomerCashregisters", "getCustomerCredentials", "reportCustomerContract", "getPartnerBilling", "getPartnerBillingMonth", "createCustomer", "getCustomer", "updateCustomer", "searchCustomers", "issueInvoice", "cancelInvoice", "createCreditNote", "getInvoice", "listInvoices", "getInvoicePdf", "getInvoiceXml", "getInvoiceSetupStatus", "listBrands", "recordInvoicePayment", "createInvoiceItem", "updateInvoiceItem", "withdrawInvoiceItem", "getInvoiceItem", "listInvoiceItems", "setCustomerMandate", "revokeCustomerMandate", "getArticle", "listArticles", "lookupArticleByCode", "listLocations", "getStock", "listStock", "listStockMovements", "createWebhook", "updateWebhook", "deleteWebhook", "listWebhooks", "sendWebhookTest", "rotateWebhookSecret", "listWebhookDeliveries", "createArticle", "updateArticle", "deactivateArticle", "receiveGoods", "transferStock", "recordStockLoss", "changeStockCondition", "reverseStockMovement", "createReservation", "extendReservation", "releaseReservation", "getReservation", "listReservations", "createVariantGroup", "updateVariantGroup", "getVariantGroup", "listVariantGroups", "addVariant", "createStocktake", "listStocktakes", "getStocktake", "listStocktakeItems", "recordStocktakeCount", "voidStocktakeCount", "listStocktakeCounts", "reviewStocktake", "recountStocktake", "closeStocktake", "cancelStocktake", "getStocktakePdf"];
|
|
24
|
+
export declare const PUBLIC_CALLS: readonly ["createReceipt", "getReceipt", "cancelReceipt", "sendReceiptEmail", "generateFullReceiptId", "downloadReceipt", "getFirstReceiptDate", "getReportV2", "downloadReport", "downloadDailyReport", "getCashregisterReport", "createPaymentLinkStripe", "stripeCaptureIntent", "hobexPayApi", "hobexRefundApi", "hobexGetStatus", "financeWebService", "listMyTipRecipients", "getPartnerInfo", "createPartnerCustomer", "checkPartnerCustomerEmail", "listPartnerCustomers", "getPartnerCustomer", "sendPartnerCustomerFonLink", "createPartnerWebhook", "updatePartnerWebhook", "deletePartnerWebhook", "listPartnerWebhooks", "sendPartnerWebhookTest", "rotatePartnerWebhookSecret", "listPartnerWebhookDeliveries", "requestCustomerSignature", "getCustomerSignatureStatus", "createCustomerCashregister", "activateCashregister", "listCustomerCashregisters", "getCustomerCredentials", "reportCustomerContract", "getPartnerBilling", "getPartnerBillingMonth", "createCustomer", "getCustomer", "updateCustomer", "searchCustomers", "issueInvoice", "cancelInvoice", "createCreditNote", "getInvoice", "listInvoices", "getInvoicePdf", "getInvoiceXml", "getInvoiceSetupStatus", "listBrands", "recordInvoicePayment", "createInvoiceItem", "updateInvoiceItem", "withdrawInvoiceItem", "getInvoiceItem", "listInvoiceItems", "setCustomerMandate", "revokeCustomerMandate", "getArticle", "listArticles", "lookupArticleByCode", "listLocations", "getStock", "listStock", "listStockMovements", "createWebhook", "updateWebhook", "deleteWebhook", "listWebhooks", "sendWebhookTest", "rotateWebhookSecret", "listWebhookDeliveries", "createArticle", "updateArticle", "deactivateArticle", "receiveGoods", "transferStock", "recordStockLoss", "changeStockCondition", "reverseStockMovement", "createReservation", "extendReservation", "releaseReservation", "getReservation", "listReservations", "createVariantGroup", "updateVariantGroup", "getVariantGroup", "listVariantGroups", "addVariant", "createStocktake", "listStocktakes", "getStocktake", "listStocktakeItems", "recordStocktakeCount", "voidStocktakeCount", "listStocktakeCounts", "reviewStocktake", "recountStocktake", "closeStocktake", "cancelStocktake", "getStocktakePdf", "orderSignatureCard", "getSignatureCardOrder"];
|
|
25
25
|
/**
|
|
26
26
|
* Die Endpunkte des Kassenwegs (`https://kasse.kasseneck.at/api/v3/<name>`,
|
|
27
27
|
* Web-Kasse: gleicher Ursprung `/api/v3`), in der Reihenfolge von
|
|
28
28
|
* `endpoints.register`. Sechs davon sind zugleich oeffentlich; die Kasse ruft
|
|
29
29
|
* sie trotzdem ueber diesen Weg (ein Dialekt je Client, Nachtrag §5.2).
|
|
30
30
|
*/
|
|
31
|
-
export declare const POS_CALLS: readonly ["pairRegisterDevice", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "registerUserLogin", "registerPinLogin", "renewRegisterSession", "endRegisterSession", "unpairRegisterDevice", "listMyCashregisters", "listMyReceipts", "getReceipt", "createReceipt", "generateFullReceiptId", "cancelReceipt", "sendReceiptEmail", "listMyArticleGroups", "listMyArticles", "getKasseSettings", "setMyKasseSettings", "setMyKasseLogo", "setMyRegisterDeviceSettings", "listMyPrinters", "createPrintJob", "getPrintJob", "listMyTipRecipients", "listMyStockLocations", "listMyStock", "setMyCashregisterStockLocation", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift"];
|
|
31
|
+
export declare const POS_CALLS: readonly ["pairRegisterDevice", "listRegisterUsersForDevice", "listRegisterSessionsForDevice", "registerUserLogin", "registerPinLogin", "renewRegisterSession", "endRegisterSession", "unpairRegisterDevice", "listMyCashregisters", "listMyReceipts", "getReceipt", "createReceipt", "generateFullReceiptId", "cancelReceipt", "sendReceiptEmail", "listMyArticleGroups", "listMyArticles", "getKasseSettings", "setMyKasseSettings", "setMyKasseLogo", "setMyRegisterDeviceSettings", "listMyPrinters", "createPrintJob", "getPrintJob", "listMyTipRecipients", "listMyStockLocations", "listMyStock", "setMyCashregisterStockLocation", "listMyStocktakes", "listMyStocktakeItems", "listMyStocktakeCounts", "recordMyStocktakeCount", "voidMyStocktakeCount", "checkVoucher", "reprintVoucherLabel", "getMyDrawerState", "openMyShift", "recordMyCashMovement", "logMyDrawerOpenings", "getMyShiftReport", "closeMyShift"];
|
|
32
32
|
export type PublicCall = typeof PUBLIC_CALLS[number];
|
|
33
33
|
export type PosCall = typeof POS_CALLS[number];
|
|
34
34
|
/**
|
|
@@ -49,7 +49,7 @@ export type PosCall = typeof POS_CALLS[number];
|
|
|
49
49
|
* [ALL_CALLS], [PUBLIC_CALLS] und [POS_CALLS] steht entweder hier oder in
|
|
50
50
|
* [CALLS_WITHOUT_EFFECT] (Waechter `test/ausgang-einordnung.test.ts`).
|
|
51
51
|
*/
|
|
52
|
-
export declare const UNKNOWN_OUTCOME_CALLS: readonly ["activateCashregister", "addVariant", "cancelInvoice", "cancelReceipt", "cancelStocktake", "changeStockCondition", "closeMyShift", "closeStocktake", "createArticle", "createCreditNote", "createCustomer", "createCustomerCashregister", "createInvoiceItem", "createPartnerCustomer", "createPartnerWebhook", "createPrintJob", "createReceipt", "createReservation", "createStocktake", "createVariantGroup", "createWebhook", "deactivateArticle", "deletePartnerWebhook", "deleteWebhook", "extendReservation", "financeWebService", "hobexPayApi", "hobexRefundApi", "issueInvoice", "logMyDrawerOpenings", "openMyShift", "pairRegisterDevice", "receiveGoods", "recordInvoicePayment", "recordMyCashMovement", "recordMyStocktakeCount", "recordStockLoss", "recordStocktakeCount", "recountStocktake", "releaseReservation", "reportCustomerContract", "requestCustomerSignature", "reverseStockMovement", "reviewStocktake", "revokeCustomerMandate", "rotatePartnerWebhookSecret", "rotateWebhookSecret", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "sendWebhookTest", "setCustomerMandate", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "transferStock", "unpairRegisterDevice", "updateArticle", "updateCustomer", "updateInvoiceItem", "updatePartnerWebhook", "updateVariantGroup", "updateWebhook", "voidMyStocktakeCount", "voidStocktakeCount", "withdrawInvoiceItem"];
|
|
52
|
+
export declare const UNKNOWN_OUTCOME_CALLS: readonly ["activateCashregister", "addVariant", "cancelInvoice", "cancelReceipt", "cancelStocktake", "changeStockCondition", "closeMyShift", "closeStocktake", "createArticle", "createCreditNote", "createCustomer", "createCustomerCashregister", "createInvoiceItem", "createPartnerCustomer", "createPartnerWebhook", "createPrintJob", "createReceipt", "createReservation", "createStocktake", "createVariantGroup", "createWebhook", "deactivateArticle", "deletePartnerWebhook", "deleteWebhook", "extendReservation", "financeWebService", "hobexPayApi", "hobexRefundApi", "issueInvoice", "logMyDrawerOpenings", "openMyShift", "orderSignatureCard", "pairRegisterDevice", "receiveGoods", "recordInvoicePayment", "recordMyCashMovement", "recordMyStocktakeCount", "recordStockLoss", "recordStocktakeCount", "recountStocktake", "releaseReservation", "reportCustomerContract", "requestCustomerSignature", "reverseStockMovement", "reviewStocktake", "revokeCustomerMandate", "rotatePartnerWebhookSecret", "rotateWebhookSecret", "sendPartnerCustomerFonLink", "sendPartnerWebhookTest", "sendReceiptEmail", "sendWebhookTest", "setCustomerMandate", "setMyCashregisterStockLocation", "setMyKasseLogo", "setMyKasseSettings", "setMyRegisterDeviceSettings", "stripeCaptureIntent", "transferStock", "unpairRegisterDevice", "updateArticle", "updateCustomer", "updateInvoiceItem", "updatePartnerWebhook", "updateVariantGroup", "updateWebhook", "voidMyStocktakeCount", "voidStocktakeCount", "withdrawInvoiceItem"];
|
|
53
53
|
/** Warum ein Aufruf keine Wirkung hat, die ein Zeitlimit offen lassen koennte. */
|
|
54
54
|
export type CallWithoutEffectReason = 'read' | 'repeatable';
|
|
55
55
|
/**
|
|
@@ -125,12 +125,18 @@ exports.ALL_CALLS = [
|
|
|
125
125
|
'closeStocktake',
|
|
126
126
|
'cancelStocktake',
|
|
127
127
|
'getStocktakePdf',
|
|
128
|
+
// Signaturkarte bestellen und Bestellung lesen
|
|
129
|
+
'orderSignatureCard',
|
|
130
|
+
'getSignatureCardOrder',
|
|
128
131
|
// Inventur zaehlen an der Kasse (Lager-Kern Stufe 3, ./pos)
|
|
129
132
|
'listMyStocktakes',
|
|
130
133
|
'listMyStocktakeItems',
|
|
131
134
|
'listMyStocktakeCounts',
|
|
132
135
|
'recordMyStocktakeCount',
|
|
133
136
|
'voidMyStocktakeCount',
|
|
137
|
+
// Gutschein pruefen und Etikett nachdrucken (./pos)
|
|
138
|
+
'checkVoucher',
|
|
139
|
+
'reprintVoucherLabel',
|
|
134
140
|
// Schicht, Kassenstand und Lade-Protokoll an der Kasse (./pos)
|
|
135
141
|
'getMyDrawerState',
|
|
136
142
|
'openMyShift',
|
|
@@ -258,6 +264,8 @@ exports.PUBLIC_CALLS = [
|
|
|
258
264
|
'closeStocktake',
|
|
259
265
|
'cancelStocktake',
|
|
260
266
|
'getStocktakePdf',
|
|
267
|
+
'orderSignatureCard',
|
|
268
|
+
'getSignatureCardOrder',
|
|
261
269
|
];
|
|
262
270
|
/**
|
|
263
271
|
* Die Endpunkte des Kassenwegs (`https://kasse.kasseneck.at/api/v3/<name>`,
|
|
@@ -301,6 +309,9 @@ exports.POS_CALLS = [
|
|
|
301
309
|
'listMyStocktakeCounts',
|
|
302
310
|
'recordMyStocktakeCount',
|
|
303
311
|
'voidMyStocktakeCount',
|
|
312
|
+
// Gutschein pruefen und Etikett nachdrucken: nur ueber den Kassenweg.
|
|
313
|
+
'checkVoucher',
|
|
314
|
+
'reprintVoucherLabel',
|
|
304
315
|
// Schicht, Kassenstand und Lade-Protokoll: nur ueber den Kassenweg.
|
|
305
316
|
'getMyDrawerState',
|
|
306
317
|
'openMyShift',
|
|
@@ -359,6 +370,7 @@ exports.UNKNOWN_OUTCOME_CALLS = [
|
|
|
359
370
|
'issueInvoice',
|
|
360
371
|
'logMyDrawerOpenings',
|
|
361
372
|
'openMyShift',
|
|
373
|
+
'orderSignatureCard',
|
|
362
374
|
'pairRegisterDevice',
|
|
363
375
|
'receiveGoods',
|
|
364
376
|
'recordInvoicePayment',
|
|
@@ -423,6 +435,7 @@ exports.UNKNOWN_OUTCOME_CALLS = [
|
|
|
423
435
|
*/
|
|
424
436
|
exports.CALLS_WITHOUT_EFFECT = Object.freeze({
|
|
425
437
|
checkPartnerCustomerEmail: 'read',
|
|
438
|
+
checkVoucher: 'read',
|
|
426
439
|
downloadDailyReport: 'read',
|
|
427
440
|
downloadReceipt: 'read',
|
|
428
441
|
downloadReport: 'read',
|
|
@@ -453,6 +466,7 @@ exports.CALLS_WITHOUT_EFFECT = Object.freeze({
|
|
|
453
466
|
getReservation: 'read',
|
|
454
467
|
getStock: 'read',
|
|
455
468
|
getStocktake: 'read',
|
|
469
|
+
getSignatureCardOrder: 'read',
|
|
456
470
|
getStocktakePdf: 'read',
|
|
457
471
|
getVariantGroup: 'read',
|
|
458
472
|
hobexGetStatus: 'read',
|
|
@@ -491,6 +505,7 @@ exports.CALLS_WITHOUT_EFFECT = Object.freeze({
|
|
|
491
505
|
registerPinLogin: 'repeatable',
|
|
492
506
|
registerUserLogin: 'repeatable',
|
|
493
507
|
renewRegisterSession: 'repeatable',
|
|
508
|
+
reprintVoucherLabel: 'repeatable',
|
|
494
509
|
searchCustomers: 'read',
|
|
495
510
|
});
|
|
496
511
|
const MIT_WIRKUNG = new Set(exports.UNKNOWN_OUTCOME_CALLS);
|
|
@@ -239,6 +239,11 @@ export declare function receiptLayoutFromResult(result: ReceiptWithCompany, opti
|
|
|
239
239
|
* die Hand des Aufrufers, sondern zu einem der benannten Aufrufe darunter.
|
|
240
240
|
*/
|
|
241
241
|
export declare function createReceipt(rufen: InternerTransport, options: CreateReceiptOptions): Promise<Receipt>;
|
|
242
|
+
/**
|
|
243
|
+
* Baut die Nutzlast von `createReceipt` und prueft die Eingabe. Wirft, bevor
|
|
244
|
+
* irgendetwas rausgeht — ein Beleg ist nicht folgenlos wiederholbar.
|
|
245
|
+
*/
|
|
246
|
+
export declare function createReceiptParams(options: CreateReceiptOptions): Record<string, unknown>;
|
|
242
247
|
/** Normalbeleg (Verkauf) nach RKSV. */
|
|
243
248
|
export declare function sellReceipt(transport: InternerTransport, options: SellReceiptOptions): Promise<Receipt>;
|
|
244
249
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.receiptLayoutFromResult = receiptLayoutFromResult;
|
|
4
4
|
exports.createReceipt = createReceipt;
|
|
5
|
+
exports.createReceiptParams = createReceiptParams;
|
|
5
6
|
exports.sellReceipt = sellReceipt;
|
|
6
7
|
exports.sellReceiptWithCompany = sellReceiptWithCompany;
|
|
7
8
|
exports.cancelReceipt = cancelReceipt;
|
|
@@ -81,10 +82,15 @@ function createReceiptParams(options) {
|
|
|
81
82
|
if (typ.value === index_js_1.ReceiptType.cancellation.value) {
|
|
82
83
|
throw eingabefehler('Ein Storno geht nur ueber cancelReceipt (Bezug, Grund, Restmengen).');
|
|
83
84
|
}
|
|
85
|
+
// Gutschein-Positionen setzt nur der Server; vor jeder anderen Positionspruefung.
|
|
86
|
+
if (items?.some((item) => item.kind === 'voucher' || item.kind === 'voucher_float') ?? false) {
|
|
87
|
+
throw eingabefehler('voucher_invalid: Gutschein-Positionen (kind voucher, voucher_float) setzt nur der Server.');
|
|
88
|
+
}
|
|
84
89
|
if (typ.needsItems) {
|
|
85
90
|
// Ein reiner Gutscheinverkauf ist ein Umsatz ohne Positionen, deshalb
|
|
86
91
|
// zaehlt er hier wie eine Position (wie im Flutter-Vorbild).
|
|
87
|
-
|
|
92
|
+
// (Eine Auszahlung der neuen Form braucht ebenfalls keine Positionen.)
|
|
93
|
+
const hatVerkaufsgutschein = vouchers?.some((v) => v.action === index_js_1.VoucherAction.sell || v.action === index_js_1.VoucherAction.payout) ?? false;
|
|
88
94
|
if ((items == null || items.length === 0) && !hatVerkaufsgutschein) {
|
|
89
95
|
throw eingabefehler(`Positionen sind Pflicht bei receiptType "${typ.value}" und duerfen nicht leer sein.`);
|
|
90
96
|
}
|
|
@@ -97,6 +103,13 @@ function createReceiptParams(options) {
|
|
|
97
103
|
if (!typ.allowsVouchers) {
|
|
98
104
|
throw eingabefehler(`Gutscheine sind nicht erlaubt bei receiptType "${typ.value}".`);
|
|
99
105
|
}
|
|
106
|
+
const serverfeld = vouchers.flatMap(index_js_2.voucherServerFields)[0];
|
|
107
|
+
if (serverfeld != null) {
|
|
108
|
+
throw eingabefehler(`voucher_invalid: Das Feld ${serverfeld} setzt nur der Server.`);
|
|
109
|
+
}
|
|
110
|
+
if (typ.value === index_js_1.ReceiptType.training.value && vouchers.some(index_js_2.isNewFormVoucher)) {
|
|
111
|
+
throw eingabefehler('Gutscheine der neuen Form gibt es nicht auf Schulungsbelegen (receiptType training).');
|
|
112
|
+
}
|
|
100
113
|
if (vouchers.some((voucher) => !(0, index_js_2.voucherIsValid)(voucher))) {
|
|
101
114
|
throw eingabefehler('Ungueltiger Gutschein uebergeben.');
|
|
102
115
|
}
|
|
@@ -109,6 +122,11 @@ function createReceiptParams(options) {
|
|
|
109
122
|
if (items != null && items.length > 0) {
|
|
110
123
|
params['items'] = alsNutzlast(items, index_js_2.toReceiptItemPayload);
|
|
111
124
|
}
|
|
125
|
+
else if (items != null && (vouchers?.some(index_js_2.isNewFormVoucher) ?? false)) {
|
|
126
|
+
// Verkauf/Auszahlung der neuen Form ohne Positionen: die leere Liste geht
|
|
127
|
+
// mit, wie der Vertrag es zeigt (Altform ohne Positionen bleibt byte-gleich).
|
|
128
|
+
params['items'] = [];
|
|
129
|
+
}
|
|
112
130
|
const umsatz = typ.value === index_js_1.ReceiptType.standard.value || typ.value === index_js_1.ReceiptType.training.value;
|
|
113
131
|
if (umsatz) {
|
|
114
132
|
// Pflicht unter /v3 (payments_required); eine leere Liste ist erlaubt,
|
|
@@ -116,7 +134,12 @@ function createReceiptParams(options) {
|
|
|
116
134
|
if (options.payments == null) {
|
|
117
135
|
throw eingabefehler('payments fehlt: unter /v3 ist die Zahlungsliste Pflicht (Summe = receiptDueCents).');
|
|
118
136
|
}
|
|
119
|
-
|
|
137
|
+
// Beleg nur aus Gutschein-Auszahlungen (Server gutschein-beleg.istNurAuszahlung):
|
|
138
|
+
// genau eine Barzahlung ueber den negativen Zahlbetrag.
|
|
139
|
+
// Wie der Server erst nach dem Anhaengen des Trinkgelds: eine Trinkgeldzeile ist keine Gutscheinzeile.
|
|
140
|
+
const nurAuszahlung = (vouchers?.length ?? 0) > 0 && vouchers.every((v) => v.action === index_js_1.VoucherAction.payout)
|
|
141
|
+
&& (items?.length ?? 0) === 0 && options.tip == null;
|
|
142
|
+
params['payments'] = gepruefteZahlungen(options.payments, false, 'createReceipt', nurAuszahlung);
|
|
120
143
|
}
|
|
121
144
|
else if (options.payments != null) {
|
|
122
145
|
throw eingabefehler(`payments sind bei receiptType "${typ.value}" nicht erlaubt.`);
|
|
@@ -472,6 +495,26 @@ function checkVoucherCombinationError(vouchers, items) {
|
|
|
472
495
|
verkaufenPromo++;
|
|
473
496
|
}
|
|
474
497
|
}
|
|
498
|
+
// Neue Form, Regeln wie gutschein-beleg.plane des Servers:
|
|
499
|
+
// - Verkauf und Einloesung nie zusammen, sobald einer davon die neue Form
|
|
500
|
+
// hat (auch gegen die Altform); eine Auszahlung zaehlt hier nicht.
|
|
501
|
+
// - der Aktionsgutschein (promotion) steht allein.
|
|
502
|
+
// - eine Auszahlung nie mit einem Altform-Rabatt (promo).
|
|
503
|
+
// Die Altform-Zaehler unten zaehlen die neue Form bewusst nicht mit.
|
|
504
|
+
const neu = vouchers.filter((v) => (0, index_js_2.isNewFormVoucher)(v));
|
|
505
|
+
const verkaufEinloesung = vouchers.filter((v) => v.action === index_js_1.VoucherAction.sell || v.action === index_js_1.VoucherAction.redeem);
|
|
506
|
+
if (verkaufEinloesung.some((v) => v.action === index_js_1.VoucherAction.sell)
|
|
507
|
+
&& verkaufEinloesung.some((v) => v.action === index_js_1.VoucherAction.redeem)
|
|
508
|
+
&& verkaufEinloesung.some((v) => (0, index_js_2.isNewFormVoucher)(v))) {
|
|
509
|
+
return 'Ungueltige Daten: Ein Beleg kann Gutscheine der neuen Form nicht zugleich verkaufen und einloesen';
|
|
510
|
+
}
|
|
511
|
+
if (neu.some((v) => v.type === index_js_1.VoucherType.promotion) && vouchers.length > 1) {
|
|
512
|
+
return 'Ungueltige Daten: Ein Aktionsgutschein (type promotion) darf nicht mit anderen Gutscheinen kombiniert werden';
|
|
513
|
+
}
|
|
514
|
+
if (neu.some((v) => v.action === index_js_1.VoucherAction.payout) && vouchers.some((v) => !(0, index_js_2.isNewFormVoucher)(v) && v.type === index_js_1.VoucherType.promo)) {
|
|
515
|
+
return 'Ungueltige Daten: Eine Auszahlung (action payout) darf nicht mit einem Gutschein mit type promo kombiniert werden';
|
|
516
|
+
}
|
|
517
|
+
const einloesenNeu = neu.filter((v) => v.action === index_js_1.VoucherAction.redeem).length;
|
|
475
518
|
const einloesenGesamt = einloesenWert + einloesenPromo;
|
|
476
519
|
const verkaufenGesamt = verkaufenWert + verkaufenPromo;
|
|
477
520
|
if (verkaufenPromo > 0) {
|
|
@@ -486,7 +529,7 @@ function checkVoucherCombinationError(vouchers, items) {
|
|
|
486
529
|
if (einloesenPromo > 0 && verkaufenGesamt > 0) {
|
|
487
530
|
return 'Ungueltige Daten: Mit einem Gutschein mit type promo duerfen nicht andere Gutscheine verkauft werden';
|
|
488
531
|
}
|
|
489
|
-
if (einloesenGesamt > 0 && items.length === 0) {
|
|
532
|
+
if ((einloesenGesamt > 0 || einloesenNeu > 0) && items.length === 0) {
|
|
490
533
|
return 'Ungueltige Daten: Gutscheine mit action redeem benoetigen mindestens ein item';
|
|
491
534
|
}
|
|
492
535
|
return null;
|
|
@@ -620,12 +663,28 @@ const MAX_ZAHLUNGEN = 20;
|
|
|
620
663
|
* (Summe, Anbieter-Pflicht und Trinkgeld prueft der Server). Wirft, bevor
|
|
621
664
|
* etwas hinausgeht.
|
|
622
665
|
*/
|
|
623
|
-
function gepruefteZahlungen(roh, storno, functionName) {
|
|
666
|
+
function gepruefteZahlungen(roh, storno, functionName, auszahlung = false) {
|
|
624
667
|
const fehler = (grund) => new errors_js_1.KasseneckValidationError(functionName, grund, 'request');
|
|
625
668
|
if (!Array.isArray(roh))
|
|
626
669
|
throw fehler('payments muss eine Liste sein.');
|
|
627
670
|
if (roh.length > MAX_ZAHLUNGEN)
|
|
628
671
|
throw fehler(`payments: es sind hoechstens ${MAX_ZAHLUNGEN} Eintraege erlaubt.`);
|
|
672
|
+
// Auszahlung eines Gutscheins: der Betrag geht bar hinaus, ohne gegeben und ohne Trinkgeld (Server pruefeZahlungen).
|
|
673
|
+
const negativ = storno || auszahlung;
|
|
674
|
+
if (auszahlung) {
|
|
675
|
+
const e = roh[0];
|
|
676
|
+
if (roh.length !== 1)
|
|
677
|
+
throw fehler('Auszahlung: genau eine Barzahlung angeben.');
|
|
678
|
+
if (e != null && typeof e === 'object') {
|
|
679
|
+
const m = e['method'];
|
|
680
|
+
if ((typeof m === 'object' && m !== null ? m.value : m) !== 'cash')
|
|
681
|
+
throw fehler('Auszahlung: nur in bar moeglich.');
|
|
682
|
+
if (e['tenderedCents'] !== undefined)
|
|
683
|
+
throw fehler('Auszahlung: tenderedCents ist nicht moeglich.');
|
|
684
|
+
if (e['tipCents'] !== undefined)
|
|
685
|
+
throw fehler('Auszahlung: tipCents ist nicht moeglich.');
|
|
686
|
+
}
|
|
687
|
+
}
|
|
629
688
|
return roh.map((eintrag, i) => {
|
|
630
689
|
const nr = i + 1;
|
|
631
690
|
if (eintrag == null || typeof eintrag !== 'object' || Array.isArray(eintrag)) {
|
|
@@ -634,8 +693,8 @@ function gepruefteZahlungen(roh, storno, functionName) {
|
|
|
634
693
|
const z = eintrag;
|
|
635
694
|
const method = gepruefteZahlungsart(z['method']);
|
|
636
695
|
const betrag = z['amountCents'];
|
|
637
|
-
if (typeof betrag !== 'number' || !Number.isInteger(betrag) || (
|
|
638
|
-
throw fehler(`Zahlung ${nr}: amountCents muss eine ganze Zahl ${
|
|
696
|
+
if (typeof betrag !== 'number' || !Number.isInteger(betrag) || (negativ ? betrag >= 0 : betrag <= 0)) {
|
|
697
|
+
throw fehler(`Zahlung ${nr}: amountCents muss eine ganze Zahl ${negativ ? 'kleiner' : 'groesser'} als 0 sein.`);
|
|
639
698
|
}
|
|
640
699
|
const aus = { method, amountCents: betrag };
|
|
641
700
|
if (z['tenderedCents'] !== undefined) {
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export declare const VoucherAction: {
|
|
6
6
|
readonly sell: "sell";
|
|
7
7
|
readonly redeem: "redeem";
|
|
8
|
+
/** Neue Form: Restwert auszahlen (Mehrzweck/Einzweck). */
|
|
9
|
+
readonly payout: "payout";
|
|
8
10
|
};
|
|
9
11
|
export type VoucherActionKey = keyof typeof VoucherAction;
|
|
10
12
|
export type VoucherAction = (typeof VoucherAction)[VoucherActionKey];
|
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
* Gutscheinart — Zwilling von `VoucherType` in kasseneck_api/lib/enums/voucher_type.dart.
|
|
3
3
|
*/
|
|
4
4
|
export declare const VoucherType: {
|
|
5
|
+
/** Altform: Wertgutschein (Wert im Cent, Code frei). */
|
|
5
6
|
readonly value: "value";
|
|
7
|
+
/** Altform: Rabatt-/Promotionsgutschein. */
|
|
6
8
|
readonly promo: "promo";
|
|
9
|
+
/** Neue Form: Mehrzweckgutschein (Zahlungsmittel, Steuer erst bei der Einloesung). */
|
|
10
|
+
readonly multi_purpose: "multi_purpose";
|
|
11
|
+
/** Neue Form: Einzweckgutschein (Steuer schon beim Verkauf, ein Satz). */
|
|
12
|
+
readonly single_purpose: "single_purpose";
|
|
13
|
+
/** Neue Form: Leistungsgutschein (Artikel mal Menge). */
|
|
14
|
+
readonly service: "service";
|
|
15
|
+
/** Neue Form: Aktionsgutschein (Rabatt laut Aktion, nur einloesbar). */
|
|
16
|
+
readonly promotion: "promotion";
|
|
7
17
|
};
|
|
8
18
|
export type VoucherTypeKey = keyof typeof VoucherType;
|
|
9
19
|
export type VoucherType = (typeof VoucherType)[VoucherTypeKey];
|
|
@@ -5,6 +5,16 @@ exports.VoucherType = void 0;
|
|
|
5
5
|
* Gutscheinart — Zwilling von `VoucherType` in kasseneck_api/lib/enums/voucher_type.dart.
|
|
6
6
|
*/
|
|
7
7
|
exports.VoucherType = {
|
|
8
|
+
/** Altform: Wertgutschein (Wert im Cent, Code frei). */
|
|
8
9
|
value: 'value',
|
|
10
|
+
/** Altform: Rabatt-/Promotionsgutschein. */
|
|
9
11
|
promo: 'promo',
|
|
12
|
+
/** Neue Form: Mehrzweckgutschein (Zahlungsmittel, Steuer erst bei der Einloesung). */
|
|
13
|
+
multi_purpose: 'multi_purpose',
|
|
14
|
+
/** Neue Form: Einzweckgutschein (Steuer schon beim Verkauf, ein Satz). */
|
|
15
|
+
single_purpose: 'single_purpose',
|
|
16
|
+
/** Neue Form: Leistungsgutschein (Artikel mal Menge). */
|
|
17
|
+
service: 'service',
|
|
18
|
+
/** Neue Form: Aktionsgutschein (Rabatt laut Aktion, nur einloesbar). */
|
|
19
|
+
promotion: 'promotion',
|
|
10
20
|
};
|
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
|
-
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, 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, 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';
|
|
2
|
+
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isVoucherItem, isVoucherFloatItem, type Voucher, type VoucherArticle, 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, 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
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, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
|
|
4
|
-
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, } from './receipt/due.js';
|
|
4
|
+
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, type VoucherDueInfo, type VoucherDueArticle, type VoucherRedeemContext, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './receipt/due.js';
|
|
5
5
|
export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
|
|
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, } from './pos/index.js';
|
|
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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
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.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = 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 = void 0;
|
|
3
|
+
exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.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
|
+
exports.isKasseneckNetworkError = exports.isKasseneckHttpError = exports.isKasseneckAuthError = exports.isKasseneckApiError = exports.CLIENT_ERROR_CODES = exports.KasseneckValidationError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckAuthError = exports.KasseneckApiError = 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 = void 0;
|
|
5
|
+
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 = exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = 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 = void 0;
|
|
6
6
|
var index_js_1 = require("./enums/index.js");
|
|
7
7
|
Object.defineProperty(exports, "ReceiptType", { enumerable: true, get: function () { return index_js_1.ReceiptType; } });
|
|
8
8
|
Object.defineProperty(exports, "VatRate", { enumerable: true, get: function () { return index_js_1.VatRate; } });
|
|
@@ -18,6 +18,8 @@ Object.defineProperty(exports, "receiptItemTotalCents", { enumerable: true, get:
|
|
|
18
18
|
Object.defineProperty(exports, "receiptItemIsValid", { enumerable: true, get: function () { return index_js_2.receiptItemIsValid; } });
|
|
19
19
|
Object.defineProperty(exports, "negateReceiptItem", { enumerable: true, get: function () { return index_js_2.negateReceiptItem; } });
|
|
20
20
|
Object.defineProperty(exports, "isTipItem", { enumerable: true, get: function () { return index_js_2.isTipItem; } });
|
|
21
|
+
Object.defineProperty(exports, "isVoucherItem", { enumerable: true, get: function () { return index_js_2.isVoucherItem; } });
|
|
22
|
+
Object.defineProperty(exports, "isVoucherFloatItem", { enumerable: true, get: function () { return index_js_2.isVoucherFloatItem; } });
|
|
21
23
|
Object.defineProperty(exports, "toVoucherPayload", { enumerable: true, get: function () { return index_js_2.toVoucherPayload; } });
|
|
22
24
|
Object.defineProperty(exports, "fromVoucherPayload", { enumerable: true, get: function () { return index_js_2.fromVoucherPayload; } });
|
|
23
25
|
Object.defineProperty(exports, "voucherIsValid", { enumerable: true, get: function () { return index_js_2.voucherIsValid; } });
|
|
@@ -25,6 +27,7 @@ Object.defineProperty(exports, "toReceiptPayload", { enumerable: true, get: func
|
|
|
25
27
|
Object.defineProperty(exports, "fromReceiptPayload", { enumerable: true, get: function () { return index_js_2.fromReceiptPayload; } });
|
|
26
28
|
Object.defineProperty(exports, "receiptSubSumCents", { enumerable: true, get: function () { return index_js_2.receiptSubSumCents; } });
|
|
27
29
|
Object.defineProperty(exports, "receiptSumCents", { enumerable: true, get: function () { return index_js_2.receiptSumCents; } });
|
|
30
|
+
Object.defineProperty(exports, "receiptValueVoucherSign", { enumerable: true, get: function () { return index_js_2.receiptValueVoucherSign; } });
|
|
28
31
|
Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return index_js_2.RETURN_DISPOSITIONS; } });
|
|
29
32
|
Object.defineProperty(exports, "CANCELLATION_REASONS", { enumerable: true, get: function () { return index_js_2.CANCELLATION_REASONS; } });
|
|
30
33
|
Object.defineProperty(exports, "CANCELLATION_STATUSES", { enumerable: true, get: function () { return index_js_2.CANCELLATION_STATUSES; } });
|
|
@@ -133,6 +136,8 @@ Object.defineProperty(exports, "receiptDueBreakdown", { enumerable: true, get: f
|
|
|
133
136
|
Object.defineProperty(exports, "ReceiptDueError", { enumerable: true, get: function () { return due_js_1.ReceiptDueError; } });
|
|
134
137
|
Object.defineProperty(exports, "RECEIPT_DUE_ERROR_REASONS", { enumerable: true, get: function () { return due_js_1.RECEIPT_DUE_ERROR_REASONS; } });
|
|
135
138
|
Object.defineProperty(exports, "isReceiptDueError", { enumerable: true, get: function () { return due_js_1.isReceiptDueError; } });
|
|
139
|
+
Object.defineProperty(exports, "voucherRedeemMaxCents", { enumerable: true, get: function () { return due_js_1.voucherRedeemMaxCents; } });
|
|
140
|
+
Object.defineProperty(exports, "VOUCHER_ZERO_RATE_BUCKET_FROM", { enumerable: true, get: function () { return due_js_1.VOUCHER_ZERO_RATE_BUCKET_FROM; } });
|
|
136
141
|
var vienna_time_js_1 = require("./vienna-time.js");
|
|
137
142
|
Object.defineProperty(exports, "parseServerTimeStamp", { enumerable: true, get: function () { return vienna_time_js_1.parseServerTimeStamp; } });
|
|
138
143
|
Object.defineProperty(exports, "toViennaWallClock", { enumerable: true, get: function () { return vienna_time_js_1.toViennaWallClock; } });
|
|
@@ -151,3 +156,4 @@ Object.defineProperty(exports, "distributeDiscount", { enumerable: true, get: fu
|
|
|
151
156
|
Object.defineProperty(exports, "cancelScopeOf", { enumerable: true, get: function () { return index_js_4.cancelScopeOf; } });
|
|
152
157
|
Object.defineProperty(exports, "receiptsScopeOf", { enumerable: true, get: function () { return index_js_4.receiptsScopeOf; } });
|
|
153
158
|
Object.defineProperty(exports, "stockViewOf", { enumerable: true, get: function () { return index_js_4.stockViewOf; } });
|
|
159
|
+
Object.defineProperty(exports, "voucherPermsOf", { enumerable: true, get: function () { return index_js_4.voucherPermsOf; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, } from './receipt-item.js';
|
|
2
|
-
export { type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid } from './voucher.js';
|
|
3
|
-
export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, } from './receipt.js';
|
|
1
|
+
export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, isVoucherItem, isVoucherFloatItem, } from './receipt-item.js';
|
|
2
|
+
export { type Voucher, type VoucherArticle, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields } from './voucher.js';
|
|
3
|
+
export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, } from './receipt.js';
|
|
4
4
|
export { 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, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, } from './cancellation.js';
|
|
5
5
|
export { type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
|
|
6
6
|
export { type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError } from './payment-errors.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
|
-
exports.
|
|
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.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = void 0;
|
|
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.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; } });
|
|
@@ -10,16 +10,21 @@ Object.defineProperty(exports, "receiptItemIsValid", { enumerable: true, get: fu
|
|
|
10
10
|
Object.defineProperty(exports, "negateReceiptItem", { enumerable: true, get: function () { return receipt_item_js_1.negateReceiptItem; } });
|
|
11
11
|
Object.defineProperty(exports, "isTipItem", { enumerable: true, get: function () { return receipt_item_js_1.isTipItem; } });
|
|
12
12
|
Object.defineProperty(exports, "isDiscountItem", { enumerable: true, get: function () { return receipt_item_js_1.isDiscountItem; } });
|
|
13
|
+
Object.defineProperty(exports, "isVoucherItem", { enumerable: true, get: function () { return receipt_item_js_1.isVoucherItem; } });
|
|
14
|
+
Object.defineProperty(exports, "isVoucherFloatItem", { enumerable: true, get: function () { return receipt_item_js_1.isVoucherFloatItem; } });
|
|
13
15
|
var voucher_js_1 = require("./voucher.js");
|
|
14
16
|
Object.defineProperty(exports, "toVoucherPayload", { enumerable: true, get: function () { return voucher_js_1.toVoucherPayload; } });
|
|
15
17
|
Object.defineProperty(exports, "fromVoucherPayload", { enumerable: true, get: function () { return voucher_js_1.fromVoucherPayload; } });
|
|
16
18
|
Object.defineProperty(exports, "voucherIsValid", { enumerable: true, get: function () { return voucher_js_1.voucherIsValid; } });
|
|
19
|
+
Object.defineProperty(exports, "isNewFormVoucher", { enumerable: true, get: function () { return voucher_js_1.isNewFormVoucher; } });
|
|
20
|
+
Object.defineProperty(exports, "voucherServerFields", { enumerable: true, get: function () { return voucher_js_1.voucherServerFields; } });
|
|
17
21
|
var receipt_js_1 = require("./receipt.js");
|
|
18
22
|
Object.defineProperty(exports, "toReceiptPayload", { enumerable: true, get: function () { return receipt_js_1.toReceiptPayload; } });
|
|
19
23
|
Object.defineProperty(exports, "fromReceiptPayload", { enumerable: true, get: function () { return receipt_js_1.fromReceiptPayload; } });
|
|
20
24
|
Object.defineProperty(exports, "readRegistrationInfo", { enumerable: true, get: function () { return receipt_js_1.readRegistrationInfo; } });
|
|
21
25
|
Object.defineProperty(exports, "receiptSubSumCents", { enumerable: true, get: function () { return receipt_js_1.receiptSubSumCents; } });
|
|
22
26
|
Object.defineProperty(exports, "receiptSumCents", { enumerable: true, get: function () { return receipt_js_1.receiptSumCents; } });
|
|
27
|
+
Object.defineProperty(exports, "receiptValueVoucherSign", { enumerable: true, get: function () { return receipt_js_1.receiptValueVoucherSign; } });
|
|
23
28
|
var cancellation_js_1 = require("./cancellation.js");
|
|
24
29
|
Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return cancellation_js_1.RETURN_DISPOSITIONS; } });
|
|
25
30
|
Object.defineProperty(exports, "CANCELLATION_REASONS", { enumerable: true, get: function () { return cancellation_js_1.CANCELLATION_REASONS; } });
|
|
@@ -16,7 +16,7 @@ import { KasseneckApiError } from '../client/errors.js';
|
|
|
16
16
|
* ...) stehen in [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
|
|
17
17
|
* `KasseneckApiError.code` lesbar.
|
|
18
18
|
*/
|
|
19
|
-
export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "module_inactive", "not_permitted", "receipt_limit_exceeded", "receipt_not_found", "receipt_outcome_unknown", "receipt_type_invalid", "signature_incomplete", "signature_missing", "signing_failed", "small_business_vat_not_allowed", "tip_invalid", "tip_not_allowed", "tip_recipient_unknown", "validation", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "password_change_required", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing", "response_unreadable"];
|
|
19
|
+
export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "module_inactive", "not_permitted", "receipt_limit_exceeded", "receipt_not_found", "receipt_outcome_unknown", "receipt_type_invalid", "server_error", "signature_incomplete", "signature_missing", "signing_failed", "small_business_vat_not_allowed", "tip_invalid", "tip_not_allowed", "tip_recipient_unknown", "validation", "voucher_balance_changed", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "password_change_required", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing", "response_unreadable"];
|
|
20
20
|
export type ReceiptErrorCode = (typeof RECEIPT_ERROR_CODES)[number];
|
|
21
21
|
export declare function isReceiptErrorCode(value: unknown): value is ReceiptErrorCode;
|
|
22
22
|
/** Der Code eines geworfenen Fehlers, wenn er in [RECEIPT_ERROR_CODES] steht; sonst `undefined`. */
|
|
@@ -35,6 +35,7 @@ exports.RECEIPT_ERROR_CODES = Object.freeze([
|
|
|
35
35
|
'receipt_not_found',
|
|
36
36
|
'receipt_outcome_unknown',
|
|
37
37
|
'receipt_type_invalid',
|
|
38
|
+
'server_error',
|
|
38
39
|
'signature_incomplete',
|
|
39
40
|
'signature_missing',
|
|
40
41
|
'signing_failed',
|
|
@@ -43,6 +44,7 @@ exports.RECEIPT_ERROR_CODES = Object.freeze([
|
|
|
43
44
|
'tip_not_allowed',
|
|
44
45
|
'tip_recipient_unknown',
|
|
45
46
|
'validation',
|
|
47
|
+
'voucher_balance_changed',
|
|
46
48
|
// Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
|
|
47
49
|
'account_not_found',
|
|
48
50
|
'action_confirmation_required',
|