@kreiseck/kasseneck-api 1.30.0 → 1.32.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.
Files changed (150) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/cjs/client/aufrufe.d.ts +3 -3
  3. package/dist/cjs/client/aufrufe.js +8 -0
  4. package/dist/cjs/client/receipts.d.ts +11 -0
  5. package/dist/cjs/client/receipts.js +14 -0
  6. package/dist/cjs/index.d.ts +2 -2
  7. package/dist/cjs/index.js +10 -5
  8. package/dist/cjs/models/index.d.ts +2 -2
  9. package/dist/cjs/models/index.js +7 -2
  10. package/dist/cjs/models/receipt-errors.d.ts +1 -1
  11. package/dist/cjs/models/receipt-errors.js +9 -0
  12. package/dist/cjs/models/receipt-item.d.ts +44 -2
  13. package/dist/cjs/models/receipt-item.js +56 -1
  14. package/dist/cjs/models/receipt.d.ts +17 -0
  15. package/dist/cjs/models/receipt.js +9 -0
  16. package/dist/cjs/models/voucher.d.ts +18 -0
  17. package/dist/cjs/models/voucher.js +32 -1
  18. package/dist/cjs/pos/artikel.d.ts +26 -0
  19. package/dist/cjs/pos/artikel.js +5 -0
  20. package/dist/cjs/pos/client.d.ts +1 -0
  21. package/dist/cjs/pos/client.js +14 -0
  22. package/dist/cjs/pos/errors.d.ts +1 -1
  23. package/dist/cjs/pos/errors.js +13 -0
  24. package/dist/cjs/pos/fremdgutschein-artikel.d.ts +66 -0
  25. package/dist/cjs/pos/fremdgutschein-artikel.js +74 -0
  26. package/dist/cjs/pos/index.d.ts +9 -4
  27. package/dist/cjs/pos/index.js +62 -4
  28. package/dist/cjs/pos/leergut.d.ts +60 -0
  29. package/dist/cjs/pos/leergut.js +82 -0
  30. package/dist/cjs/pos/pfand.d.ts +144 -0
  31. package/dist/cjs/pos/pfand.js +382 -0
  32. package/dist/cjs/pos/rabatt-vorlagen.d.ts +79 -0
  33. package/dist/cjs/pos/rabatt-vorlagen.js +156 -0
  34. package/dist/cjs/pos/schicht-lesen.js +8 -0
  35. package/dist/cjs/pos/schicht-typen.d.ts +15 -0
  36. package/dist/cjs/pos/settings.d.ts +72 -10
  37. package/dist/cjs/pos/settings.js +79 -5
  38. package/dist/cjs/pos/texte.d.ts +283 -0
  39. package/dist/cjs/pos/texte.js +163 -1
  40. package/dist/cjs/pos/zusaetze.d.ts +3 -3
  41. package/dist/cjs/pos/zusaetze.js +4 -2
  42. package/dist/cjs/receipt/discount.js +3 -0
  43. package/dist/cjs/receipt/due.d.ts +6 -0
  44. package/dist/cjs/receipt/due.js +16 -5
  45. package/dist/cjs/receipt/gutschein-plan.d.ts +7 -1
  46. package/dist/cjs/receipt/gutschein-plan.js +16 -2
  47. package/dist/cjs/receipt/layout.js +108 -2
  48. package/dist/cjs/receipt/shift-sheet.js +8 -0
  49. package/dist/cjs/register/pairing.d.ts +15 -1
  50. package/dist/cjs/register/pairing.js +14 -1
  51. package/dist/cjs/stored/draht.js +1 -0
  52. package/dist/cjs/stored/einstellungen.js +50 -2
  53. package/dist/cjs/stored/vokabular.d.ts +1 -1
  54. package/dist/cjs/stored/vokabular.js +107 -5
  55. package/dist/cjs/version.d.ts +1 -1
  56. package/dist/cjs/version.js +1 -1
  57. package/dist/esm/client/aufrufe.d.ts +3 -3
  58. package/dist/esm/client/aufrufe.js +8 -0
  59. package/dist/esm/client/receipts.d.ts +11 -0
  60. package/dist/esm/client/receipts.js +14 -0
  61. package/dist/esm/index.d.ts +2 -2
  62. package/dist/esm/index.js +2 -2
  63. package/dist/esm/models/index.d.ts +2 -2
  64. package/dist/esm/models/index.js +2 -2
  65. package/dist/esm/models/receipt-errors.d.ts +1 -1
  66. package/dist/esm/models/receipt-errors.js +9 -0
  67. package/dist/esm/models/receipt-item.d.ts +44 -2
  68. package/dist/esm/models/receipt-item.js +54 -1
  69. package/dist/esm/models/receipt.d.ts +17 -0
  70. package/dist/esm/models/receipt.js +9 -0
  71. package/dist/esm/models/voucher.d.ts +18 -0
  72. package/dist/esm/models/voucher.js +30 -0
  73. package/dist/esm/pos/artikel.d.ts +26 -0
  74. package/dist/esm/pos/artikel.js +5 -0
  75. package/dist/esm/pos/client.d.ts +1 -0
  76. package/dist/esm/pos/client.js +15 -1
  77. package/dist/esm/pos/errors.d.ts +1 -1
  78. package/dist/esm/pos/errors.js +13 -0
  79. package/dist/esm/pos/fremdgutschein-artikel.d.ts +66 -0
  80. package/dist/esm/pos/fremdgutschein-artikel.js +67 -0
  81. package/dist/esm/pos/index.d.ts +9 -4
  82. package/dist/esm/pos/index.js +10 -4
  83. package/dist/esm/pos/leergut.d.ts +60 -0
  84. package/dist/esm/pos/leergut.js +77 -0
  85. package/dist/esm/pos/pfand.d.ts +144 -0
  86. package/dist/esm/pos/pfand.js +371 -0
  87. package/dist/esm/pos/rabatt-vorlagen.d.ts +79 -0
  88. package/dist/esm/pos/rabatt-vorlagen.js +148 -0
  89. package/dist/esm/pos/schicht-lesen.js +8 -0
  90. package/dist/esm/pos/schicht-typen.d.ts +15 -0
  91. package/dist/esm/pos/settings.d.ts +72 -10
  92. package/dist/esm/pos/settings.js +74 -4
  93. package/dist/esm/pos/texte.d.ts +283 -0
  94. package/dist/esm/pos/texte.js +160 -0
  95. package/dist/esm/pos/zusaetze.d.ts +3 -3
  96. package/dist/esm/pos/zusaetze.js +4 -2
  97. package/dist/esm/receipt/discount.js +4 -1
  98. package/dist/esm/receipt/due.d.ts +6 -0
  99. package/dist/esm/receipt/due.js +17 -6
  100. package/dist/esm/receipt/gutschein-plan.d.ts +7 -1
  101. package/dist/esm/receipt/gutschein-plan.js +14 -2
  102. package/dist/esm/receipt/layout.js +109 -3
  103. package/dist/esm/receipt/shift-sheet.js +8 -0
  104. package/dist/esm/register/pairing.d.ts +15 -1
  105. package/dist/esm/register/pairing.js +13 -1
  106. package/dist/esm/stored/draht.js +1 -0
  107. package/dist/esm/stored/einstellungen.js +52 -4
  108. package/dist/esm/stored/vokabular.d.ts +1 -1
  109. package/dist/esm/stored/vokabular.js +107 -5
  110. package/dist/esm/version.d.ts +1 -1
  111. package/dist/esm/version.js +1 -1
  112. package/fixtures/add-on-cases.json +6 -4
  113. package/fixtures/deposit-cases.json +4758 -0
  114. package/fixtures/discount-preset-cases.json +1074 -0
  115. package/fixtures/expected/deposit-return.grid32.txt +28 -0
  116. package/fixtures/expected/deposit-return.grid48.txt +28 -0
  117. package/fixtures/expected/deposit-return.lines.json +275 -0
  118. package/fixtures/expected/deposit-return.sheet32.json +194 -0
  119. package/fixtures/expected/deposit-return.sheet48.json +194 -0
  120. package/fixtures/expected/deposit.grid32.txt +34 -0
  121. package/fixtures/expected/deposit.grid48.txt +32 -0
  122. package/fixtures/expected/deposit.lines.json +316 -0
  123. package/fixtures/expected/deposit.sheet32.json +230 -0
  124. package/fixtures/expected/deposit.sheet48.json +218 -0
  125. package/fixtures/external-voucher-article-cases.json +311 -0
  126. package/fixtures/hobex-hps-codes.json +1 -1
  127. package/fixtures/invoice-api.schema.json +1 -1
  128. package/fixtures/invoice-texts.json +1 -1
  129. package/fixtures/manifest.json +16 -0
  130. package/fixtures/pos-texts.json +266 -1
  131. package/fixtures/receipt-due-voucher-generated.json +1 -1
  132. package/fixtures/receipts/deposit-return.json +63 -0
  133. package/fixtures/receipts/deposit.json +83 -0
  134. package/fixtures/renames-1.0.json +18 -0
  135. package/fixtures/return-code-cases.json +1338 -0
  136. package/fixtures/surface.json +92 -7
  137. package/fixtures/v3/antworten/belege.json +2 -2
  138. package/fixtures/v3/antworten/belegmail.json +2 -2
  139. package/fixtures/v3/antworten/berichte.json +2 -2
  140. package/fixtures/v3/antworten/kasse-belege.json +2 -2
  141. package/fixtures/v3/antworten/kasse.json +428 -13
  142. package/fixtures/v3/antworten/lager.json +1 -1
  143. package/fixtures/v3/antworten/rechnungen.json +2 -2
  144. package/fixtures/v3/antworten/storno.json +2 -2
  145. package/fixtures/v3/stored/belege.json +2 -2
  146. package/fixtures/v3/stored/kasse.json +42 -4
  147. package/fixtures/v3/stored/rechnungen.json +2 -2
  148. package/fixtures/v3/v3-vokabular.json +898 -31
  149. package/fixtures/v3/zahlbetrag-faelle.json +187 -3
  150. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { ReceiptType, VatRate, KeckPaymentMethod, CreditCardProvider, VoucherType, VoucherAction, StripeLinkMode, } from './enums/index.js';
2
- export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, isVoucherItem, isVoucherFloatItem, toVoucherPayload, fromVoucherPayload, voucherIsValid, VOUCHER_SOURCES, isExternalVoucher, externalVoucherIsValid, normalizeExternalVoucherNumber, checkExternalVoucherNumber, EXTERNAL_VOUCHER_NUMBER_MAX, EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, fromReceiptPaymentPayload, toReceiptPaymentPayload, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_LOG_KINDS, RECEIPT_OUTPUT_RESULTS, RECEIPT_OUTPUT_ENTRIES_MAX, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, RECEIPT_OUTPUT_ERROR_CODES, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, fromReceiptCompanyPayload, receiptCompanyTaxInfo, fromCashregisterPayload, fromReceiptSummaryPayload, ZERO_KINDS, isZeroKind, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
2
+ export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, isVoucherItem, isVoucherFloatItem, isDepositItem, isDepositReturnItem, toVoucherPayload, fromVoucherPayload, voucherIsValid, VOUCHER_SOURCES, isExternalVoucher, externalVoucherIsValid, normalizeExternalVoucherNumber, checkExternalVoucherNumber, ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES, EXTERNAL_VOUCHER_NUMBER_MAX, EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, fromReceiptPaymentPayload, toReceiptPaymentPayload, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_LOG_KINDS, RECEIPT_OUTPUT_RESULTS, RECEIPT_OUTPUT_ENTRIES_MAX, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, RECEIPT_OUTPUT_ERROR_CODES, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, fromReceiptCompanyPayload, receiptCompanyTaxInfo, fromCashregisterPayload, fromReceiptSummaryPayload, ZERO_KINDS, isZeroKind, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
3
3
  export { apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, ALL_CALLS, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, createTransport, createBinaryTransport, createPdfOrDataTransport, createFileOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, CLIENT_ERROR_CODES, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, listMyCashregisters, checkVoucherCombinationError, sendReceiptEmail, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2, 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, createDepExport, getDepExport, waitForDepExport, getDepExportFile, createDepHandoverLink, revokeDepHandoverLink, DepExportTimeoutError, DepExportChecksumError, DEP_EXPORT_STATUSES, DEP_EXPORT_FILES, DEP_EXPORT_ERROR_CODES, DEP_EXPORT_FAILURES, DEP_EXPORT_POLL_START_MS, DEP_EXPORT_POLL_FACTOR, DEP_EXPORT_POLL_MAX_MS, DEP_EXPORT_WAIT_TIMEOUT_MS, DEP_EXPORT_DOWNLOAD_TIMEOUT_MS, registerTerminalDevice, getTerminalAccess, claimTerminal, requestTerminalCode, getTerminalCode, reportTerminalLogin, reportTerminalReady, TERMINAL_PLATFORMS, TERMINAL_SETUP_STATES, TERMINAL_CODE_STATUSES, TERMINAL_CODE_SOURCES, TERMINAL_ERROR_CODES, TERMINAL_LABEL_MAX, TERMINAL_APP_MAX, TERMINAL_REQUESTED_BY_MAX, getCashboxStatus, getSignatureStatus, createKasseneckApi, } from './client/index.js';
4
4
  export { receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './receipt/due.js';
5
5
  export { parseServerTimeStamp, toViennaWallClock } from './vienna-time.js';
6
- export { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, mergePosSettings, fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, distributeDiscount, cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, } from './pos/index.js';
6
+ export { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, mergePosSettings, fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, distributeDiscount, cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, depositReturnOf, } from './pos/index.js';
@@ -1,5 +1,5 @@
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 IssuedVoucher, type ReturnIssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields, type VoucherSource, type LegacyValueVoucherWish, VOUCHER_SOURCES, isExternalVoucher, externalVoucherIsValid, normalizeExternalVoucherNumber, checkExternalVoucherNumber, type ExternalVoucherNumberCheck, EXTERNAL_VOUCHER_NUMBER_MAX, EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, } from './voucher.js';
1
+ export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, isVoucherItem, isVoucherFloatItem, isDepositItem, isDepositReturnItem, } from './receipt-item.js';
2
+ export { type Voucher, type VoucherArticle, type IssuedVoucher, type ReturnIssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields, type VoucherSource, type LegacyValueVoucherWish, VOUCHER_SOURCES, isExternalVoucher, externalVoucherIsValid, normalizeExternalVoucherNumber, checkExternalVoucherNumber, type ExternalVoucherNumberCheck, ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES, type OwnVoucherCodeShape, EXTERNAL_VOUCHER_NUMBER_MAX, EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, } from './voucher.js';
3
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';
@@ -1,5 +1,5 @@
1
- export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, isDiscountItem, isVoucherItem, isVoucherFloatItem, } from './receipt-item.js';
2
- export { toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields, VOUCHER_SOURCES, isExternalVoucher, externalVoucherIsValid, normalizeExternalVoucherNumber, checkExternalVoucherNumber, EXTERNAL_VOUCHER_NUMBER_MAX, EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, } from './voucher.js';
1
+ export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, isDiscountItem, isVoucherItem, isVoucherFloatItem, isDepositItem, isDepositReturnItem, } from './receipt-item.js';
2
+ export { toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields, VOUCHER_SOURCES, isExternalVoucher, externalVoucherIsValid, normalizeExternalVoucherNumber, checkExternalVoucherNumber, ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES, EXTERNAL_VOUCHER_NUMBER_MAX, EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, } from './voucher.js';
3
3
  export { toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, } from './receipt.js';
4
4
  export { RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, } from './cancellation.js';
5
5
  export { fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
@@ -18,7 +18,7 @@ import { KasseneckApiError } from '../client/errors.js';
18
18
  * ...) stehen in [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
19
19
  * `KasseneckApiError.code` lesbar.
20
20
  */
21
- export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "idempotency_conflict", "invalid_add_on_reference", "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"];
21
+ export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "deposit_not_enabled", "deposit_return_not_offered", "deposit_set_by_server", "deposit_type_not_found", "deposit_type_not_issued", "final_receipt_expired", "final_receipt_not_allowed", "idempotency_conflict", "invalid_add_on_reference", "invalid_deposit", "invalid_deposit_quantity", "invalid_item_kind", "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"];
22
22
  export type ReceiptErrorCode = (typeof RECEIPT_ERROR_CODES)[number];
23
23
  export declare function isReceiptErrorCode(value: unknown): value is ReceiptErrorCode;
24
24
  /** Der Code eines geworfenen Fehlers, wenn er in [RECEIPT_ERROR_CODES] steht; sonst `undefined`. */
@@ -22,6 +22,12 @@ export const RECEIPT_ERROR_CODES = Object.freeze([
22
22
  'cancellation_reference_unavailable',
23
23
  'cashregister_closed',
24
24
  'cashregister_decommissioned',
25
+ // Seit Pfand & Leergut Teil 2: Pfandzeilen an createReceipt (Antworten des Servers, errorCodes.registerHandlersByEndpoint).
26
+ 'deposit_not_enabled',
27
+ 'deposit_return_not_offered',
28
+ 'deposit_set_by_server',
29
+ 'deposit_type_not_found',
30
+ 'deposit_type_not_issued',
25
31
  'final_receipt_expired',
26
32
  'final_receipt_not_allowed',
27
33
  // Seit 1.15.0 (Vertrag): derselbe idempotencyKey mit anderem Inhalt, nichts geschrieben. Seit 1.22.0 sendet
@@ -29,6 +35,9 @@ export const RECEIPT_ERROR_CODES = Object.freeze([
29
35
  'idempotency_conflict',
30
36
  // Seit 1.27.0 (Zusatz-Kacheln): addOnOf zeigt nicht nach vorne auf eine Warenposition, die selbst kein Zusatz ist.
31
37
  'invalid_add_on_reference',
38
+ 'invalid_deposit',
39
+ 'invalid_deposit_quantity',
40
+ 'invalid_item_kind',
32
41
  'module_inactive',
33
42
  'not_permitted',
34
43
  'receipt_limit_exceeded',
@@ -36,7 +36,7 @@ export interface ReceiptItem {
36
36
  * negative Entgeltminderungen je Steuersatz; die Kennzeichnung steuert nur
37
37
  * die Bon-Darstellung (Summenzeile mit Aufteilung), nie die Beträge.
38
38
  */
39
- kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float';
39
+ kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float' | 'deposit' | 'deposit_return';
40
40
  /** Empfaenger der Trinkgeld-Position; `null` = nicht zugeordnet. */
41
41
  recipient?: TipRecipient | null;
42
42
  /** Zahlart der Trinkgeld-Position (kann von der des Belegs abweichen). */
@@ -67,7 +67,31 @@ export interface ReceiptItem {
67
67
  * Warenposition, die selbst kein Zusatz ist (`invalid_add_on_reference`).
68
68
  */
69
69
  addOnOf?: number;
70
+ /**
71
+ * Pfand & Leergut: Pfandart (Kennung aus `getKasseSettings` `deposit.depositTypes[].id`); nur an
72
+ * `deposit`- und `deposit_return`-Zeilen. Der Server setzt Pfandzeilen aus den Artikeln und rechnet
73
+ * den Betrag selbst; bei einer ausdruecklichen Zeile des Aufrufers (ohne `articleId`) prueft er sie.
74
+ */
75
+ depositTypeId?: string;
76
+ /** Index der Warenposition im selben Beleg, zu der die Pfandzeile gehoert (nur `deposit`). */
77
+ depositFor?: number;
78
+ /** Art der Pfandart zum Belegzeitpunkt: Einweg oder Mehrweg. */
79
+ depositKind?: 'single_use' | 'reusable';
80
+ /** Pfand je Stueck in Cent bei einer Pfandzeile; der Zeilenpreis ist Menge mal dieser Betrag. */
81
+ perUnit?: number;
82
+ /** Strichcode des Gebindes (GTIN), falls bekannt. */
83
+ gtin?: string;
84
+ /** Strichcode des Artikels (EAN), falls bekannt. */
85
+ ean?: string;
86
+ /** Das Gebinde wurde im Betrieb selbst befuellt (eigene Abfuellung). */
87
+ ownFilling?: boolean;
88
+ /** Gelernte Leergut-Codes der Zeile (Code -> Menge); nur an `deposit_return`. */
89
+ codes?: Record<string, number>;
70
90
  }
91
+ /** Pfandzeile (Pfand zum Verkauf)? Die eine Erkennungsstelle — niemand prueft `kind` selbst. */
92
+ export declare function isDepositItem(item: ReceiptItem | ReceiptItemPayloadRead): boolean;
93
+ /** Leergutzeile (Ruecknahme, negativer Betrag)? */
94
+ export declare function isDepositReturnItem(item: ReceiptItem | ReceiptItemPayloadRead): boolean;
71
95
  /** Empfaenger einer Trinkgeld-Position (Kassen-Benutzer, Snapshot des Namens). */
72
96
  export interface TipRecipient {
73
97
  registerUserId: string;
@@ -97,7 +121,7 @@ export interface ReceiptItemPayload {
97
121
  unitPriceCents: number;
98
122
  vatRate: number;
99
123
  /** Trinkgeld-/Rabatt-/Gutschein-Kennzeichnung, siehe [ReceiptItem.kind]. */
100
- kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float';
124
+ kind?: 'tip' | 'discount' | 'voucher' | 'voucher_float' | 'deposit' | 'deposit_return';
101
125
  recipient?: TipRecipient | null;
102
126
  paymentMethod?: string;
103
127
  receivedImmediately?: boolean;
@@ -107,6 +131,15 @@ export interface ReceiptItemPayload {
107
131
  articleId?: string;
108
132
  /** Hauptposition eines Zusatzes, siehe [ReceiptItem.addOnOf]. */
109
133
  addOnOf?: number;
134
+ /** Pfandzeile, siehe [ReceiptItem.depositTypeId] und die folgenden Felder. */
135
+ depositTypeId?: string;
136
+ depositFor?: number;
137
+ depositKind?: 'single_use' | 'reusable';
138
+ perUnit?: number;
139
+ gtin?: string;
140
+ ean?: string;
141
+ ownFilling?: boolean;
142
+ codes?: Record<string, number>;
110
143
  }
111
144
  /**
112
145
  * Nutzlast-Form, die dieses Paket **liest** — v2 und v1 nebeneinander, alles
@@ -154,6 +187,15 @@ export interface ReceiptItemPayloadRead {
154
187
  returnDisposition?: string | null;
155
188
  /** Hauptposition eines Zusatzes, siehe [ReceiptItem.addOnOf]. */
156
189
  addOnOf?: number | null;
190
+ /** Pfandzeile, siehe [ReceiptItem.depositTypeId] und die folgenden Felder. */
191
+ depositTypeId?: string | null;
192
+ depositFor?: number | null;
193
+ depositKind?: string | null;
194
+ perUnit?: number | null;
195
+ gtin?: string | null;
196
+ ean?: string | null;
197
+ ownFilling?: boolean | null;
198
+ codes?: Record<string, number> | null;
157
199
  }
158
200
  export declare function toReceiptItemPayload(item: ReceiptItem): ReceiptItemPayload;
159
201
  /**
@@ -1,6 +1,14 @@
1
1
  import { VatRate } from '../enums/index.js';
2
2
  import { readVatRateByRate, requireVatRateByRate } from './enum-payload.js';
3
3
  import { isReturnDisposition } from './cancellation.js';
4
+ /** Pfandzeile (Pfand zum Verkauf)? Die eine Erkennungsstelle — niemand prueft `kind` selbst. */
5
+ export function isDepositItem(item) {
6
+ return item != null && item.kind === 'deposit';
7
+ }
8
+ /** Leergutzeile (Ruecknahme, negativer Betrag)? */
9
+ export function isDepositReturnItem(item) {
10
+ return item != null && item.kind === 'deposit_return';
11
+ }
4
12
  /** Trinkgeld-Position? Die eine Erkennungsstelle — niemand prueft `kind` selbst. */
5
13
  export function isTipItem(item) {
6
14
  return item != null && item.kind === 'tip';
@@ -54,6 +62,28 @@ export function toReceiptItemPayload(item) {
54
62
  // (createReceipt weist sie als voucher_invalid ab).
55
63
  if (item.kind === 'voucher' || item.kind === 'voucher_float')
56
64
  nutzlast.kind = item.kind;
65
+ // Pfand & Leergut: Kennzeichen und Felder reisen mit (Cache schreibt gelesene Belege wieder; ein Wunsch an
66
+ // den Server traegt `deposit` nie mit `articleId`, siehe createReceiptParams).
67
+ if (item.kind === 'deposit' || item.kind === 'deposit_return') {
68
+ nutzlast.kind = item.kind;
69
+ if (typeof item.depositTypeId === 'string' && item.depositTypeId !== '')
70
+ nutzlast.depositTypeId = item.depositTypeId;
71
+ if (istIndex(item.depositFor))
72
+ nutzlast.depositFor = item.depositFor;
73
+ if (item.depositKind === 'single_use' || item.depositKind === 'reusable')
74
+ nutzlast.depositKind = item.depositKind;
75
+ if (typeof item.perUnit === 'number' && Number.isFinite(item.perUnit))
76
+ nutzlast.perUnit = item.perUnit;
77
+ if (typeof item.gtin === 'string' && item.gtin !== '')
78
+ nutzlast.gtin = item.gtin;
79
+ if (typeof item.ean === 'string' && item.ean !== '')
80
+ nutzlast.ean = item.ean;
81
+ if (typeof item.ownFilling === 'boolean')
82
+ nutzlast.ownFilling = item.ownFilling;
83
+ const codes = leergutCodes(item.codes);
84
+ if (codes != null)
85
+ nutzlast.codes = codes;
86
+ }
57
87
  // Artikel-Verweis reist mit (Erloesgruppen im Bericht); leere Werte nicht.
58
88
  if (item.articleId != null && item.articleId !== '')
59
89
  nutzlast.articleId = item.articleId;
@@ -103,7 +133,19 @@ export function fromReceiptItemPayload(payload) {
103
133
  ? { kind: 'discount' }
104
134
  : payload.kind === 'voucher' || payload.kind === 'voucher_float'
105
135
  ? { kind: payload.kind }
106
- : {}),
136
+ : payload.kind === 'deposit' || payload.kind === 'deposit_return'
137
+ ? {
138
+ kind: payload.kind,
139
+ ...(typeof payload.depositTypeId === 'string' && payload.depositTypeId !== '' ? { depositTypeId: payload.depositTypeId } : {}),
140
+ ...(istIndex(payload.depositFor) ? { depositFor: payload.depositFor } : {}),
141
+ ...(payload.depositKind === 'single_use' || payload.depositKind === 'reusable' ? { depositKind: payload.depositKind } : {}),
142
+ ...(typeof payload.perUnit === 'number' && Number.isFinite(payload.perUnit) ? { perUnit: payload.perUnit } : {}),
143
+ ...(typeof payload.gtin === 'string' && payload.gtin !== '' ? { gtin: payload.gtin } : {}),
144
+ ...(typeof payload.ean === 'string' && payload.ean !== '' ? { ean: payload.ean } : {}),
145
+ ...(typeof payload.ownFilling === 'boolean' ? { ownFilling: payload.ownFilling } : {}),
146
+ ...(leergutCodes(payload.codes) != null ? { codes: leergutCodes(payload.codes) } : {}),
147
+ }
148
+ : {}),
107
149
  // Artikel-Verweis erhalten (Storno-Spiegelung schreibt ihn wieder mit).
108
150
  ...(typeof payload.articleId === 'string' && payload.articleId !== '' ? { articleId: payload.articleId } : {}),
109
151
  // Lager: Bezug und Rueckgabe-Wahl einer Storno-Zeile (nur gelesen; ein
@@ -114,6 +156,17 @@ export function fromReceiptItemPayload(payload) {
114
156
  ...(istIndex(payload.addOnOf) ? { addOnOf: payload.addOnOf } : {}),
115
157
  };
116
158
  }
159
+ /** Gelernte Codes (Code -> ganze Menge >= 1); ohne brauchbaren Eintrag `undefined`. */
160
+ function leergutCodes(wert) {
161
+ if (wert === null || typeof wert !== 'object' || Array.isArray(wert))
162
+ return undefined;
163
+ const raus = {};
164
+ for (const [code, menge] of Object.entries(wert)) {
165
+ if (code !== '' && Number.isInteger(menge) && menge >= 1)
166
+ raus[code] = menge;
167
+ }
168
+ return Object.keys(raus).length > 0 ? raus : undefined;
169
+ }
117
170
  function istIndex(wert) {
118
171
  return Number.isInteger(wert) && wert >= 0;
119
172
  }
@@ -79,6 +79,18 @@ export interface Receipt {
79
79
  registrationInfo?: RegistrationInfo;
80
80
  /** Nur an nacherfassten Belegen: der Handbeleg (siehe [ManualReceipt]). */
81
81
  manualReceipt?: ManualReceipt;
82
+ /** Pfand & Leergut: der Kunde trinkt/verzehrt vor Ort (gespeichert `vorOrt`); nur ein Wahrheitswert. */
83
+ onPremises?: boolean;
84
+ /**
85
+ * Gemeinsame Ruecknahmestelle fuer Leergut (gespeichert `pfandStelle`); der Server stempelt sie nur, wenn die
86
+ * Kasse `returns: 'shared'` hat und der Beleg Pfand traegt. Der Bon druckt daraus die Fusszeile.
87
+ */
88
+ sharedReturnPoint?: SharedReturnPoint;
89
+ }
90
+ /** Gemeinsame Ruecknahmestelle fuer Leergut (Name und Anschrift, wie der Server sie am Beleg stempelt). */
91
+ export interface SharedReturnPoint {
92
+ name: string;
93
+ address: string;
82
94
  }
83
95
  /** Registrierdaten von Signaturkarte und Kasse (Zeitstempel oder `null`, wenn unbekannt). */
84
96
  export interface RegistrationInfo {
@@ -131,6 +143,11 @@ export interface ReceiptPayloadRead extends Omit<ReceiptPayload, 'items' | 'vouc
131
143
  cashregisterRegisteredAt?: string | null;
132
144
  } | null;
133
145
  manualReceipt?: unknown;
146
+ onPremises?: boolean | null;
147
+ sharedReturnPoint?: {
148
+ name?: string | null;
149
+ address?: string | null;
150
+ } | null;
134
151
  }
135
152
  /**
136
153
  * Schreibt die Nutzlast in der **neuen** Form — sie **normalisiert, statt zu
@@ -89,8 +89,17 @@ export function fromReceiptPayload(payload) {
89
89
  ? { registrationInfo: readRegistrationInfo(payload.registrationInfo) }
90
90
  : {}),
91
91
  ...handbelegFeld(payload.manualReceipt),
92
+ ...(typeof payload.onPremises === 'boolean' ? { onPremises: payload.onPremises } : {}),
93
+ ...pfandStelleFeld(payload.sharedReturnPoint),
92
94
  };
93
95
  }
96
+ function pfandStelleFeld(roh) {
97
+ if (roh == null || typeof roh !== 'object')
98
+ return {};
99
+ const name = typeof roh.name === 'string' ? roh.name : '';
100
+ const address = typeof roh.address === 'string' ? roh.address : '';
101
+ return name !== '' || address !== '' ? { sharedReturnPoint: { name, address } } : {};
102
+ }
94
103
  function handbelegFeld(roh) {
95
104
  const manualReceipt = readManualReceipt(roh);
96
105
  return manualReceipt ? { manualReceipt } : {};
@@ -242,6 +242,24 @@ export type ExternalVoucherNumberCheck = {
242
242
  * `external_voucher_number_is_own_code`, der Gutschein gehoert als eigener eingeloest –, danach die Form.
243
243
  */
244
244
  export declare function checkExternalVoucherNumber(text: unknown): ExternalVoucherNumberCheck;
245
+ /**
246
+ * Wie sehr eine Eingabe einem eigenen Gutscheincode gleicht ([ownVoucherCodeShape]): `valid` = gueltiger eigener
247
+ * Code; `checksum` = 12 Zeichen des Code-Alphabets mit falschem Pruefzeichen (z. B. eine zwoelfstellige
248
+ * Webshop-Nummer); `length` = Muster `4-4-x` mit echten Bindestrichen `-` (nie `.`, `_`, `/`), aber nicht 12 Zeichen;
249
+ * `none` = keine Aehnlichkeit.
250
+ */
251
+ export type OwnVoucherCodeShape = 'valid' | 'checksum' | 'length' | 'none';
252
+ export declare const OWN_VOUCHER_CODE_SHAPES: readonly OwnVoucherCodeShape[];
253
+ /**
254
+ * Form-Erkennung eigener Codes fuer das Feld „Code eingeben oder scannen“ (Web-Kasse und Kassen-App gleich):
255
+ * `valid` laeuft als eigener Gutschein, `checksum`/`length` fragt die Kasse nach („Sieht aus wie ein
256
+ * Kasseneck-Code, ist aber keiner. Als fremden Gutschein verwenden?“, `external_voucher.looks_like_own_code`),
257
+ * `none` geht bei Freigabe direkt in das Blatt „Fremder Gutschein“. Gelesen wie [checkExternalVoucherNumber]:
258
+ * Rand weg, `.`, `_`, `/` wie `-`, dann die Normalisierung von `VoucherCode` (gross, ohne Leerraum und `-`,
259
+ * O → 0, I/L → 1); `length` nur mit echten Bindestrichen. Eine Nachfrage weist nichts ab: der Server prueft die Fremdnummer selbst
260
+ * (`external_voucher_number_is_own_code` nur bei `valid`).
261
+ */
262
+ export declare function ownVoucherCodeShape(text: unknown): OwnVoucherCodeShape;
245
263
  /**
246
264
  * Ist der Fremdgutschein sendbar? Die Form wie `gutschein-beleg.pruefeFremd` (ohne die Freigabe des Kontos, die
247
265
  * kennt nur der Server bzw. `PosVoucherSettings.externalVouchers`): Aktion `sell`/`redeem`/`payout`, Art
@@ -271,6 +271,36 @@ export function checkExternalVoucherNumber(text) {
271
271
  const number = normalizeExternalVoucherNumber(text);
272
272
  return number === null ? { ok: false, code: 'external_voucher_number_invalid' } : { ok: true, number };
273
273
  }
274
+ export const OWN_VOUCHER_CODE_SHAPES = Object.freeze(['valid', 'checksum', 'length', 'none']);
275
+ /** Alphabet der eigenen Codes (Crockford-Base32 ohne U), nach der Normalisierung von `VoucherCode`. */
276
+ const CODE_ALPHABET = /^[0-9A-HJKMNP-TV-Z]+$/;
277
+ const CODE_GRUPPEN = /^[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]+$/;
278
+ /**
279
+ * Form-Erkennung eigener Codes fuer das Feld „Code eingeben oder scannen“ (Web-Kasse und Kassen-App gleich):
280
+ * `valid` laeuft als eigener Gutschein, `checksum`/`length` fragt die Kasse nach („Sieht aus wie ein
281
+ * Kasseneck-Code, ist aber keiner. Als fremden Gutschein verwenden?“, `external_voucher.looks_like_own_code`),
282
+ * `none` geht bei Freigabe direkt in das Blatt „Fremder Gutschein“. Gelesen wie [checkExternalVoucherNumber]:
283
+ * Rand weg, `.`, `_`, `/` wie `-`, dann die Normalisierung von `VoucherCode` (gross, ohne Leerraum und `-`,
284
+ * O → 0, I/L → 1); `length` nur mit echten Bindestrichen. Eine Nachfrage weist nichts ab: der Server prueft die Fremdnummer selbst
285
+ * (`external_voucher_number_is_own_code` nur bei `valid`).
286
+ */
287
+ export function ownVoucherCodeShape(text) {
288
+ if (typeof text !== 'string')
289
+ return 'none';
290
+ const roh = text.replace(FREMD_RAND_MUSTER, '');
291
+ const t = roh.replace(/[._/]/g, '-');
292
+ if (t === '')
293
+ return 'none';
294
+ if (VoucherCode.validate(t).ok)
295
+ return 'valid';
296
+ const s = t.toUpperCase().replace(/[\s-]/g, '').replace(/O/g, '0').replace(/[IL]/g, '1');
297
+ if (!CODE_ALPHABET.test(s))
298
+ return 'none';
299
+ if (s.length === 12)
300
+ return 'checksum';
301
+ // Falsche Laenge nur mit echten Bindestrichen: eigene Codes stehen immer so da, `WEIN.2026/7` ist keiner.
302
+ return CODE_GRUPPEN.test(roh) ? 'length' : 'none';
303
+ }
274
304
  /** Steuer- und Formatzeichen (`gutschein-core.STEUERZEICHEN`): nie in `taxedWith`. */
275
305
  const STEUERZEICHEN = /[\p{Cc}\p{Cf}]/u;
276
306
  /**
@@ -1,5 +1,7 @@
1
1
  import type { InternerTransport } from '../client/aufrufe.js';
2
2
  import { type PosReference } from './kachel-referenz.js';
3
+ import { type DepositEntry } from './pfand.js';
4
+ import { type ArticleExternalVoucher } from './fremdgutschein-artikel.js';
3
5
  /**
4
6
  * Artikelgruppen (Kategorien der Kachel-Kasse) und Artikel in der Form, die
5
7
  * die Kacheln brauchen, Backend: `article-endpoints.js`
@@ -21,6 +23,11 @@ export interface ArticleGroup {
21
23
  * erst ueber [addOnsFor].
22
24
  */
23
25
  addOns?: string[] | null;
26
+ /**
27
+ * Pfand der Gruppe (Pfand & Leergut): gilt fuer Artikel ohne eigene Liste; null = keines.
28
+ * Optional wie `addOns`, der Leser setzt es immer.
29
+ */
30
+ deposits?: DepositEntry[] | null;
24
31
  }
25
32
  export interface ArticleGroupPayload {
26
33
  id?: string | null;
@@ -30,6 +37,7 @@ export interface ArticleGroupPayload {
30
37
  sort?: number | null;
31
38
  vatRate?: number | null;
32
39
  addOns?: unknown;
40
+ deposits?: unknown;
33
41
  }
34
42
  /** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
35
43
  export declare function addOnListe(wert: unknown): string[] | null;
@@ -121,6 +129,22 @@ export interface PosArticle {
121
129
  * immer; wirksam wird es ueber [addOnsFor].
122
130
  */
123
131
  addOns?: string[] | null;
132
+ /**
133
+ * Kachel verkauft einen fremden Gutschein (1.31.0): `multi_purpose` =
134
+ * Wertgutschein, `single_purpose` = Leistungsgutschein mit dem Satz des
135
+ * Artikels; null = normaler Artikel. Die Kasse fragt die Gutscheinnummer ab
136
+ * und sendet einen `vouchers[]`-Eintrag statt einer Position; sperren ueber
137
+ * [externalVoucherTileBlock]. Vor `stockTracked` werten (ein Fremdgutschein
138
+ * fuehrt nie Bestand). Optional wie `addOns`, der Leser setzt es immer; ein
139
+ * unbekannter Wert wird null.
140
+ */
141
+ externalVoucher?: ArticleExternalVoucher | null;
142
+ /**
143
+ * Pfand des Artikels (Pfand & Leergut): `null` = keine eigene Angabe (die Gruppe gilt), `[]` = ausdruecklich
144
+ * ohne Pfand, sonst die Eintraege. Der Server setzt die Pfandzeilen am Beleg daraus (`autoDeposits`). Optional wie
145
+ * `addOns`, der Leser setzt es immer.
146
+ */
147
+ deposits?: DepositEntry[] | null;
124
148
  }
125
149
  /**
126
150
  * Kann die Kachel gebucht werden? Mit festem Preis immer, ohne Preis nur mit
@@ -161,6 +185,8 @@ export interface PosArticlePayload {
161
185
  askPrice?: boolean | null;
162
186
  reference?: unknown;
163
187
  addOns?: unknown;
188
+ externalVoucher?: unknown;
189
+ deposits?: unknown;
164
190
  }
165
191
  export declare function fromPosArticlePayload(p: PosArticlePayload): PosArticle;
166
192
  /**
@@ -1,5 +1,7 @@
1
1
  import { KasseneckValidationError } from '../client/errors.js';
2
2
  import { fromReferencePayload } from './kachel-referenz.js';
3
+ import { depositEntriesFromWire } from './pfand.js';
4
+ import { isArticleExternalVoucher } from './fremdgutschein-artikel.js';
3
5
  /** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
4
6
  export function addOnListe(wert) {
5
7
  return Array.isArray(wert) ? wert.filter((s) => typeof s === 'string' && s !== '') : null;
@@ -13,6 +15,7 @@ export function fromArticleGroupPayload(p) {
13
15
  sort: typeof p.sort === 'number' ? p.sort : 0,
14
16
  vatRate: typeof p.vatRate === 'number' ? p.vatRate : null,
15
17
  addOns: addOnListe(p.addOns),
18
+ deposits: depositEntriesFromWire(p.deposits),
16
19
  };
17
20
  }
18
21
  /**
@@ -92,6 +95,8 @@ export function fromPosArticlePayload(p) {
92
95
  askPrice: p.askPrice === true,
93
96
  reference: fromReferencePayload(p.reference),
94
97
  addOns: addOnListe(p.addOns),
98
+ externalVoucher: isArticleExternalVoucher(p.externalVoucher) ? p.externalVoucher : null,
99
+ deposits: depositEntriesFromWire(p.deposits),
95
100
  };
96
101
  }
97
102
  /**
@@ -9,6 +9,7 @@ export declare function posSettingsFromWire(data: {
9
9
  business?: unknown;
10
10
  device?: unknown;
11
11
  vouchers?: unknown;
12
+ deposit?: unknown;
12
13
  } | null | undefined): PosSettings;
13
14
  /** Betriebsweite Einstellungen schreiben (Recht `layout`); liefert den gemischten Stand. */
14
15
  export declare function setMyPosSettings(transport: InternerTransport, business: Partial<PosBusinessSettings>): Promise<PosBusinessSettings>;
@@ -1,6 +1,8 @@
1
1
  import { KasseneckValidationError } from '../client/errors.js';
2
2
  import { posVoucherSettingsFromWire } from './gutschein.js';
3
- import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
3
+ import { posDepositSettingsFromWire } from './pfand.js';
4
+ import { checkDiscountPresets, INVALID_DISCOUNT_PRESET } from './rabatt-vorlagen.js';
5
+ import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_BUSINESS_OPTIONAL_LISTS, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
4
6
  /*
5
7
  * Die Einstellungs-Aufrufe am Draht `/api/v3`: Parameter und Antwort heissen
6
8
  * `business`/`device`, Schluessel und Werte englisch (Nachtrag §11.7.2).
@@ -30,10 +32,12 @@ export async function getPosSettings(transport, options = {}) {
30
32
  }
31
33
  /** `{business, device, vouchers}` einer Antwort, gemischt mit den Standardwerten. */
32
34
  export function posSettingsFromWire(data) {
35
+ const deposit = posDepositSettingsFromWire(data?.deposit);
33
36
  return {
34
37
  vouchers: posVoucherSettingsFromWire(data?.vouchers),
35
38
  business: mergePosSettings(POS_BUSINESS_DEFAULTS, objekt(data?.business)),
36
39
  device: mergePosSettings(POS_DEVICE_DEFAULTS, objekt(data?.device)),
40
+ ...(deposit ? { deposit } : {}),
37
41
  };
38
42
  }
39
43
  /** Betriebsweite Einstellungen schreiben (Recht `layout`); liefert den gemischten Stand. */
@@ -144,6 +148,16 @@ function pruefeTeil(name, teil, block, standard, werte) {
144
148
  throw new KasseneckValidationError(name, `${teil}.${schluessel}: true oder false erwartet`, 'request');
145
149
  continue;
146
150
  }
151
+ // Rabatt-Vorlagen: dieselbe Pruefung wie am Server, der erste Fehler mit Vorlage, Feld und Satz.
152
+ if (teil === 'business' && POS_BUSINESS_OPTIONAL_LISTS.includes(schluessel)) {
153
+ const geprueft = checkDiscountPresets(wert);
154
+ if (!geprueft.ok) {
155
+ const f = geprueft.errors[0];
156
+ const ort = `${teil}.${schluessel}${f.index === null ? '' : `[${f.index}]`}${f.field === null ? '' : `.${f.field}`}`;
157
+ throw new KasseneckValidationError(name, `${ort}: ${f.message} (${INVALID_DISCOUNT_PRESET})`, 'request');
158
+ }
159
+ continue;
160
+ }
147
161
  const wahl = teil === 'business' ? POS_BUSINESS_OPTIONAL_CHOICES : POS_DEVICE_OPTIONAL_CHOICES;
148
162
  if (!Object.prototype.hasOwnProperty.call(standard, schluessel) && !wahl.includes(schluessel)) {
149
163
  throw new KasseneckValidationError(name, `${teil}.${schluessel}: unbekanntes Feld`, 'request');
@@ -21,7 +21,7 @@ import { KasseneckApiError } from '../client/errors.js';
21
21
  * ueber `KasseneckApiError.code` lesbar; die Kasse braucht dafuer einen
22
22
  * Rueckfallzweig.
23
23
  */
24
- export declare const POS_ERROR_CODES: readonly ["account_not_found", "action_confirmation_required", "admin_required", "after_count_not_permitted", "api_not_approved", "app_check_invalid", "app_check_missing", "article_not_found", "article_not_in_scope", "article_not_tracked", "cash_movement_exceeds_balance", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "comment_required", "count_already_voided", "count_not_found", "device_not_found", "dialect_mismatch", "drawer_inactive", "drawer_not_found", "idempotency_conflict", "idempotency_key_required", "internal_translation_error", "invalid_amount", "invalid_cursor", "invalid_denominations", "invalid_movement_type", "invalid_quantity", "invalid_serial", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_found", "not_permitted", "note_required", "password_change_required", "print_job_not_found", "print_layout_failed", "printer_not_found", "recount_exhausted", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "serial_already_counted", "serial_not_allowed", "serial_required", "server_error", "session_expired", "session_other_cashregister", "shift_already_open", "shift_closed", "shift_mode_off", "shift_not_open", "stocktake_closed", "stocktake_closing", "stocktake_not_found", "stocktake_not_open", "tip_payout_exceeds_claim", "too_many_counts", "transfer_same_drawer", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
24
+ export declare const POS_ERROR_CODES: readonly ["account_not_found", "action_confirmation_required", "admin_required", "after_count_not_permitted", "api_not_approved", "app_check_invalid", "app_check_missing", "article_not_found", "article_not_in_scope", "article_not_tracked", "cash_movement_exceeds_balance", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "comment_required", "count_already_voided", "count_not_found", "deposit_follows_item", "deposit_not_enabled", "deposit_return_not_offered", "deposit_set_by_server", "deposit_type_in_use", "deposit_type_not_found", "deposit_type_not_issued", "device_not_found", "dialect_mismatch", "drawer_inactive", "drawer_not_found", "filler_role_required", "idempotency_conflict", "idempotency_key_required", "internal_translation_error", "invalid_amount", "invalid_cursor", "invalid_denominations", "invalid_deposit", "invalid_deposit_quantity", "invalid_discount_preset", "invalid_item_kind", "invalid_movement_type", "invalid_quantity", "invalid_serial", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_found", "not_permitted", "note_required", "password_change_required", "print_job_not_found", "print_layout_failed", "printer_not_found", "recount_exhausted", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "serial_already_counted", "serial_not_allowed", "serial_required", "server_error", "session_expired", "session_other_cashregister", "shift_already_open", "shift_closed", "shift_mode_off", "shift_not_open", "stocktake_closed", "stocktake_closing", "stocktake_not_found", "stocktake_not_open", "tip_payout_exceeds_claim", "too_many_counts", "too_many_deposit_types", "transfer_same_drawer", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
25
25
  export type PosErrorCode = typeof POS_ERROR_CODES[number];
26
26
  export declare function isPosErrorCode(value: unknown): value is PosErrorCode;
27
27
  /** Der Code eines geworfenen Fehlers, wenn er in [POS_ERROR_CODES] steht; sonst `undefined`. */
@@ -40,16 +40,28 @@ export const POS_ERROR_CODES = Object.freeze([
40
40
  'comment_required',
41
41
  'count_already_voided',
42
42
  'count_not_found',
43
+ 'deposit_follows_item',
44
+ 'deposit_not_enabled',
45
+ 'deposit_return_not_offered',
46
+ 'deposit_set_by_server',
47
+ 'deposit_type_in_use',
48
+ 'deposit_type_not_found',
49
+ 'deposit_type_not_issued',
43
50
  'device_not_found',
44
51
  'dialect_mismatch',
45
52
  'drawer_inactive',
46
53
  'drawer_not_found',
54
+ 'filler_role_required',
47
55
  'idempotency_conflict',
48
56
  'idempotency_key_required',
49
57
  'internal_translation_error',
50
58
  'invalid_amount',
51
59
  'invalid_cursor',
52
60
  'invalid_denominations',
61
+ 'invalid_deposit',
62
+ 'invalid_deposit_quantity',
63
+ 'invalid_discount_preset',
64
+ 'invalid_item_kind',
53
65
  'invalid_movement_type',
54
66
  'invalid_quantity',
55
67
  'invalid_serial',
@@ -91,6 +103,7 @@ export const POS_ERROR_CODES = Object.freeze([
91
103
  'stocktake_not_open',
92
104
  'tip_payout_exceeds_claim',
93
105
  'too_many_counts',
106
+ 'too_many_deposit_types',
94
107
  'transfer_same_drawer',
95
108
  'unauthorized',
96
109
  'user_disabled',
@@ -0,0 +1,66 @@
1
+ import type { PosExternalVouchers } from './gutschein.js';
2
+ /**
3
+ * Artikel als fremder Gutschein (Fremdgutscheine an der Kasse, 1.31.0): der
4
+ * Chef legt einen Artikel als Kachel „fremder Gutschein“ an. Die Kasse fragt
5
+ * beim Antippen die Gutscheinnummer (und ohne Preis den Betrag) ab und sendet
6
+ * statt einer Position einen `vouchers[]`-Eintrag
7
+ * `{ source: 'external', action: 'sell', type: externalVoucher, number, amountCents, vatRateBp? }`.
8
+ *
9
+ * Die Regeln am Artikel rechnet das Backend (`functions-kasse/fremdgutschein-artikel-core.js`)
10
+ * beim Speichern (`createMyArticle`/`updateMyArticle`, Code `article_external_voucher_invalid`
11
+ * mit `data.grund`); der Artikel-Editor des Kundenbereichs prueft vorher gleich. Vertrag sind
12
+ * die Pruefaelle `fixtures/external-voucher-article-cases.json` (byte-gleich mit dem Backend).
13
+ */
14
+ /** Art des fremden Gutscheins am Artikel (`/v3` `externalVoucher`, gespeichert `fremdgutschein`). */
15
+ export type ArticleExternalVoucher = 'multi_purpose' | 'single_purpose';
16
+ export declare const ARTICLE_EXTERNAL_VOUCHER_TYPES: readonly ArticleExternalVoucher[];
17
+ /** Fehlercode beim Speichern eines Artikels, intern und unter `/v3` gleich. */
18
+ export declare const ARTICLE_EXTERNAL_VOUCHER_INVALID = "article_external_voucher_invalid";
19
+ /** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
20
+ export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "rate_required", "invalid_rate", "price_required"];
21
+ export type ExternalVoucherArticleReason = typeof EXTERNAL_VOUCHER_ARTICLE_REASONS[number];
22
+ /**
23
+ * Ein Artikel im Editor (`/v3`-Form), soweit die Regeln ihn lesen. Bewusst
24
+ * `unknown` beim Wert: der Editor prueft auch, was nicht in den Typ passt.
25
+ */
26
+ export interface ExternalVoucherArticleInput {
27
+ externalVoucher?: unknown;
28
+ unitPriceCents?: number | null;
29
+ vatRate?: number | null;
30
+ askPrice?: boolean | null;
31
+ serviceVoucher?: boolean | null;
32
+ addOns?: readonly unknown[] | null;
33
+ stockTracked?: boolean | null;
34
+ reference?: unknown;
35
+ askQuantity?: boolean | null;
36
+ }
37
+ /**
38
+ * Saetze, mit denen ein Einzweckgutschein verkauft werden kann (Prozent wie
39
+ * `PosArticle.vatRate`; 0 = befreit verkauft): die Saetze der Kasse, Backend
40
+ * `article-groups-core.STEUERSAETZE`, dieselben wie [EXTERNAL_VOUCHER_VAT_RATES_BP] / 100.
41
+ */
42
+ export declare const ARTICLE_EXTERNAL_VOUCHER_VAT_RATES: readonly number[];
43
+ /** Ist der Wert eine Art fremder Gutschein? */
44
+ export declare function isArticleExternalVoucher(value: unknown): value is ArticleExternalVoucher;
45
+ /** Form des Werts beim Speichern: `null` heisst entfernen und ist gueltig. Zwilling von `pruefeWert`. */
46
+ export declare function checkExternalVoucherValue(value: unknown): ExternalVoucherArticleReason | null;
47
+ /**
48
+ * Regeln am wirksamen Artikelstand (Bestand + Aenderung), Zwilling von
49
+ * `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
50
+ * Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
51
+ * nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
52
+ * Referenz oder Mengenabfrage (die Kasse fragt die Nummer selbst und bucht
53
+ * genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
54
+ */
55
+ export declare function checkExternalVoucherArticle(a: ExternalVoucherArticleInput): ExternalVoucherArticleReason | null;
56
+ /** Warum die Kachel eines fremden Gutscheins gesperrt ist. */
57
+ export type ExternalVoucherTileBlock = 'not_enabled' | 'type_not_enabled';
58
+ /**
59
+ * Darf die Kachel verkaufen? `null` = ja (auch fuer jeden Artikel ohne
60
+ * `externalVoucher`). Gesperrt bei Freigabe `off` (oder ohne Angabe) und bei
61
+ * Einzweck ohne `all` -- dieselbe Regel, mit der der Server den Beleg abweist
62
+ * (`external_voucher_not_enabled`, `external_voucher_type_not_enabled`).
63
+ */
64
+ export declare function externalVoucherTileBlock(article: {
65
+ externalVoucher?: ArticleExternalVoucher | null;
66
+ }, externalVouchers: PosExternalVouchers | null | undefined): ExternalVoucherTileBlock | null;