@kreiseck/kasseneck-api 1.24.0 → 1.25.1

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 (71) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/client/receipts.d.ts +19 -0
  3. package/dist/cjs/client/receipts.js +28 -0
  4. package/dist/cjs/index.d.ts +1 -1
  5. package/dist/cjs/models/cancellation.d.ts +1 -1
  6. package/dist/cjs/models/cancellation.js +9 -0
  7. package/dist/cjs/models/index.d.ts +1 -1
  8. package/dist/cjs/models/voucher.d.ts +19 -1
  9. package/dist/cjs/models/voucher.js +2 -2
  10. package/dist/cjs/pos/gutschein.d.ts +10 -0
  11. package/dist/cjs/pos/gutschein.js +7 -0
  12. package/dist/cjs/pos/index.d.ts +2 -2
  13. package/dist/cjs/pos/index.js +3 -1
  14. package/dist/cjs/pos/texte.d.ts +72 -0
  15. package/dist/cjs/pos/texte.js +48 -1
  16. package/dist/cjs/receipt/layout.js +29 -3
  17. package/dist/cjs/stored/vokabular.d.ts +1 -1
  18. package/dist/cjs/stored/vokabular.js +9 -3
  19. package/dist/cjs/version.d.ts +1 -1
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/esm/client/receipts.d.ts +19 -0
  22. package/dist/esm/client/receipts.js +28 -0
  23. package/dist/esm/index.d.ts +1 -1
  24. package/dist/esm/models/cancellation.d.ts +1 -1
  25. package/dist/esm/models/cancellation.js +9 -0
  26. package/dist/esm/models/index.d.ts +1 -1
  27. package/dist/esm/models/voucher.d.ts +19 -1
  28. package/dist/esm/models/voucher.js +2 -2
  29. package/dist/esm/pos/gutschein.d.ts +10 -0
  30. package/dist/esm/pos/gutschein.js +7 -0
  31. package/dist/esm/pos/index.d.ts +2 -2
  32. package/dist/esm/pos/index.js +1 -1
  33. package/dist/esm/pos/texte.d.ts +72 -0
  34. package/dist/esm/pos/texte.js +46 -0
  35. package/dist/esm/receipt/layout.js +29 -3
  36. package/dist/esm/stored/vokabular.d.ts +1 -1
  37. package/dist/esm/stored/vokabular.js +9 -3
  38. package/dist/esm/version.d.ts +1 -1
  39. package/dist/esm/version.js +1 -1
  40. package/fixtures/expected/voucher-return-tip.grid32.txt +32 -0
  41. package/fixtures/expected/voucher-return-tip.grid48.txt +31 -0
  42. package/fixtures/expected/voucher-return-tip.lines.json +292 -0
  43. package/fixtures/expected/voucher-return-tip.sheet32.json +218 -0
  44. package/fixtures/expected/voucher-return-tip.sheet48.json +212 -0
  45. package/fixtures/expected/voucher-return.grid32.txt +29 -0
  46. package/fixtures/expected/voucher-return.grid48.txt +28 -0
  47. package/fixtures/expected/voucher-return.lines.json +237 -0
  48. package/fixtures/expected/voucher-return.sheet32.json +200 -0
  49. package/fixtures/expected/voucher-return.sheet48.json +194 -0
  50. package/fixtures/hobex-hps-codes.json +1 -1
  51. package/fixtures/invoice-api.schema.json +1 -1
  52. package/fixtures/invoice-texts.json +1 -1
  53. package/fixtures/manifest.json +16 -0
  54. package/fixtures/pos-texts.json +78 -1
  55. package/fixtures/receipts/voucher-return-tip.json +83 -0
  56. package/fixtures/receipts/voucher-return.json +65 -0
  57. package/fixtures/surface.json +1 -1
  58. package/fixtures/v3/antworten/belege.json +1 -1
  59. package/fixtures/v3/antworten/belegmail.json +1 -1
  60. package/fixtures/v3/antworten/berichte.json +1 -1
  61. package/fixtures/v3/antworten/kasse-belege.json +1 -1
  62. package/fixtures/v3/antworten/kasse.json +46 -46
  63. package/fixtures/v3/antworten/lager.json +1 -1
  64. package/fixtures/v3/antworten/rechnungen.json +1 -1
  65. package/fixtures/v3/antworten/storno.json +1 -1
  66. package/fixtures/v3/stored/belege.json +1 -1
  67. package/fixtures/v3/stored/kasse.json +18 -18
  68. package/fixtures/v3/stored/rechnungen.json +1 -1
  69. package/fixtures/v3/v3-vokabular.json +115 -22
  70. package/fixtures/v3/zahlbetrag-faelle.json +1 -1
  71. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.KATALOGE = exports.ARTIKEL_FELDER = exports.SCHEMAS = exports.VOKABULAR_QUELLE = void 0;
6
6
  /** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
7
- exports.VOKABULAR_QUELLE = "d0d80190bd87c82b9a1037f6898059a51d56bb89a3fef6747c503b0b028cedce";
7
+ exports.VOKABULAR_QUELLE = "44d12486b6108ca8c040230f317438b21c7761477fa1a9a7d6a65b28a5444e32";
8
8
  /** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
9
9
  exports.SCHEMAS = {
10
10
  "getReceipt": {
@@ -73,7 +73,8 @@ exports.SCHEMAS = {
73
73
  "redeemableUntil": "einloesbarBis",
74
74
  "refundableUntil": "rueckzahlbarBis",
75
75
  "validUntil": "gueltigBis"
76
- }
76
+ },
77
+ "fromReturn": "rueckgabe"
77
78
  }
78
79
  ],
79
80
  "outputs": [
@@ -285,7 +286,12 @@ exports.SCHEMAS = {
285
286
  "soldCount": "verkauft"
286
287
  }
287
288
  ],
288
- "serviceArticles": "leistungsArtikel"
289
+ "serviceArticles": "leistungsArtikel",
290
+ "returnType": {
291
+ "__": "rueckgabe",
292
+ "typeId": "sorteId",
293
+ "typeName": "sorteName"
294
+ }
289
295
  },
290
296
  "connect": {
291
297
  "__": "connect",
@@ -4,4 +4,4 @@
4
4
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
5
5
  * beim Anheben der Version beide Stellen aendern.
6
6
  */
7
- export declare const PACKAGE_VERSION = "1.24.0";
7
+ export declare const PACKAGE_VERSION = "1.25.1";
@@ -7,4 +7,4 @@ exports.PACKAGE_VERSION = void 0;
7
7
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
8
8
  * beim Anheben der Version beide Stellen aendern.
9
9
  */
10
- exports.PACKAGE_VERSION = '1.24.0';
10
+ exports.PACKAGE_VERSION = '1.25.1';
@@ -1,4 +1,5 @@
1
1
  import { ReceiptType, type ReceiptTypeKey, KeckPaymentMethod, type KeckPaymentMethodKey } from '../enums/index.js';
2
+ import { type ReturnIssuedVoucher } from '../models/voucher.js';
2
3
  import type { ManualReceipt } from '../models/manual-receipt.js';
3
4
  import { type Receipt, type ReceiptCompany, type ReceiptItem, type Voucher, type ReceiptSummary, type ReportMonth, type CancellationItem, type CancellationOf, type CancellationReason, type TipRefundSource, type ReturnDisposition, type ReceiptPaymentInput, type RegistrationInfo, type ReceiptEmailVia } from '../models/index.js';
4
5
  import { type ReceiptOutput, type ReceiptOutputEntryErrorCode, type ReceiptOutputLogKind, type ReceiptOutputResult } from '../models/receipt-output.js';
@@ -200,6 +201,20 @@ export type CancelReceiptOptions = {
200
201
  * aus der Lade (kein „gibt die Mitarbeiterin direkt“).
201
202
  */
202
203
  tipRefundSource?: TipRefundSource;
204
+ /**
205
+ * Rueckgabe als Gutschein (Server 2026-11): `voucher` -- statt Geld bekommt der Kunde einen neuen
206
+ * Mehrzweck-Gutschein der Rueckgabe-Sorte (`getKasseSettings` `vouchers.returnType`). Nur ueber den
207
+ * Kassenweg mit Kassen-Benutzer, nur ohne `payments` (der Server baut die Rueckzahlung selbst; ein
208
+ * Mitarbeiter-Trinkgeld geht bar zurueck). Braucht [idempotencyKey]. Den Klartext-Code liefert
209
+ * [CancelReceiptResult.issuedVouchers] genau einmal.
210
+ */
211
+ refundAs?: 'voucher';
212
+ /**
213
+ * Schluessel der Wiederholung (1 bis 120 Zeichen), Pflicht mit [refundAs]: die Kasse erzeugt ihn beim
214
+ * Oeffnen der Bestaetigung und schickt ihn bei jedem erneuten Senden mit. Gleicher Schluessel, gleicher
215
+ * Inhalt = derselbe Beleg (`replayed`), nie ein zweiter Gutschein; anderer Inhalt = `idempotency_conflict`.
216
+ */
217
+ idempotencyKey?: string;
203
218
  } & ({
204
219
  receipt: Receipt;
205
220
  cashregisterId?: string;
@@ -214,6 +229,10 @@ export interface CancelReceiptResult {
214
229
  receipt: Receipt;
215
230
  cancellationOf: CancellationOf;
216
231
  remaining: number[];
232
+ /** Nur mit `refundAs: 'voucher'`: der ausgegebene Gutschein (Klartext-Code nur beim ersten Mal). */
233
+ issuedVouchers?: ReturnIssuedVoucher[];
234
+ /** Nur bei einer Wiederholung mit demselben `idempotencyKey`: `true`, es entstand kein neuer Beleg. */
235
+ replayed?: true;
217
236
  }
218
237
  /**
219
238
  * Beleg **und** die Firmen-/Druckdaten derselben Antwort — das Ergebnis der
@@ -294,6 +294,18 @@ export async function cancelReceipt(transport, options) {
294
294
  if (options.tipRefundSource !== undefined && options.refundTip === false) {
295
295
  throw new KasseneckValidationError('cancelReceipt', 'tipRefundSource nur, wenn das Trinkgeld zurueckgeht (refundTip nicht false)', 'request');
296
296
  }
297
+ if (options.refundAs !== undefined) {
298
+ if (options.refundAs !== 'voucher')
299
+ throw new KasseneckValidationError('cancelReceipt', 'refundAs: erlaubt ist nur voucher (oder weglassen)', 'request');
300
+ if (options.payments != null)
301
+ throw new KasseneckValidationError('cancelReceipt', 'refundAs und payments gehen nicht zusammen: die Rueckzahlung baut der Server', 'request');
302
+ }
303
+ if (options.refundAs !== undefined || options.idempotencyKey !== undefined) {
304
+ const k = options.idempotencyKey;
305
+ if (typeof k !== 'string' || k.trim() === '' || k.length > BELEG_SCHLUESSEL_MAX) {
306
+ throw new KasseneckValidationError('cancelReceipt', `idempotencyKey muss ein Text mit 1 bis ${BELEG_SCHLUESSEL_MAX} Zeichen sein (Pflicht mit refundAs)`, 'request');
307
+ }
308
+ }
297
309
  const altfeld = ALTE_ZAHLFELDER.find((feld) => options[feld] != null);
298
310
  if (altfeld != null) {
299
311
  throw new KasseneckValidationError('cancelReceipt', `${altfeld} gibt es unter /v3 nicht mehr: Rueckzahlungen gehen als payments hinaus.`, 'request');
@@ -322,6 +334,10 @@ export async function cancelReceipt(transport, options) {
322
334
  params.refundTip = options.refundTip;
323
335
  if (options.tipRefundSource !== undefined)
324
336
  params.tipRefundSource = options.tipRefundSource;
337
+ if (options.refundAs !== undefined)
338
+ params.refundAs = options.refundAs;
339
+ if (options.idempotencyKey !== undefined)
340
+ params.idempotencyKey = options.idempotencyKey;
325
341
  const daten = await transport('cancelReceipt', params);
326
342
  return signiertGelesen('cancelReceipt', () => stornoAusHuelle(daten));
327
343
  }
@@ -344,6 +360,7 @@ function stornoAusHuelle(daten) {
344
360
  ...(typeof bezug.timeStamp === 'string' && bezug.timeStamp !== '' ? { timeStamp: bezug.timeStamp } : {}),
345
361
  },
346
362
  remaining: huelle.remaining,
363
+ ...rueckgabeGutscheine(daten),
347
364
  };
348
365
  }
349
366
  /** Nullbeleg (RKSV-Pruefbeleg) — ohne Positionen und ohne Zahlungsart. */
@@ -1040,3 +1057,14 @@ export function paymentsExpectedCents(error) {
1040
1057
  const wert = error.details['expectedCents'];
1041
1058
  return Number.isSafeInteger(wert) ? wert : undefined;
1042
1059
  }
1060
+ /** `issuedVouchers` und `replayed` einer Storno-Antwort; nur was dasteht (ohne refundAs: nichts). */
1061
+ function rueckgabeGutscheine(daten) {
1062
+ const d = daten;
1063
+ const liste = Array.isArray(d.issuedVouchers)
1064
+ ? d.issuedVouchers.filter((v) => v !== null && typeof v === 'object' && typeof v.id === 'string')
1065
+ : null;
1066
+ return {
1067
+ ...(liste !== null ? { issuedVouchers: liste } : {}),
1068
+ ...(d.replayed === true ? { replayed: true } : {}),
1069
+ };
1070
+ }
@@ -1,5 +1,5 @@
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, isVoucherItem, isVoucherFloatItem, type Voucher, type VoucherArticle, type IssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, RECEIPT_OUTPUT_KINDS, type ReceiptOutputKind, RECEIPT_OUTPUT_LOG_KINDS, type ReceiptOutputLogKind, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputResult, RECEIPT_OUTPUT_ENTRIES_MAX, type ReceiptOutput, type ReceiptOutputActor, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, type ReceiptOutputEntryErrorCode, RECEIPT_OUTPUT_ERROR_CODES, type ReceiptOutputErrorCode, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, type ReceiptOutputFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
2
+ export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isVoucherItem, isVoucherFloatItem, type Voucher, type VoucherArticle, type IssuedVoucher, type ReturnIssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, RECEIPT_OUTPUT_KINDS, type ReceiptOutputKind, RECEIPT_OUTPUT_LOG_KINDS, type ReceiptOutputLogKind, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputResult, RECEIPT_OUTPUT_ENTRIES_MAX, type ReceiptOutput, type ReceiptOutputActor, RECEIPT_OUTPUT_ENTRY_ERROR_CODES, type ReceiptOutputEntryErrorCode, RECEIPT_OUTPUT_ERROR_CODES, type ReceiptOutputErrorCode, isReceiptOutputErrorCode, receiptOutputErrorCode, isReceiptOutputError, receiptOutputFieldErrors, type ReceiptOutputFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
3
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, createFileOrDataTransport, type FileOrData, type FileOrDataCallOptions, type KasseneckFileOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, type ReceiptOutputEntry, type LogReceiptOutputsOptions, type LogReceiptOutputsResult, type RejectedReceiptOutput, logReceiptOutputs, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, listReceipts, listAllReceipts, fromListReceiptsSummaryPayload, listedReceiptWithCompany, LIST_RECEIPTS_VIEWS, LIST_RECEIPTS_ORDERS, LIST_RECEIPTS_LIMIT_MAX, LIST_RECEIPTS_DAYS_MAX, LIST_ALL_RECEIPTS_MAX_PAGES, LIST_RECEIPTS_ERROR_CODES, type ListReceiptsErrorCode, type ListReceiptsView, type ListReceiptsOrder, type ListReceiptsOptions, type ListReceiptsWindow, type ListReceiptsGrossByRate, type ListReceiptsSummary, type ListReceiptsDaySummary, type ListReceiptsPage, type ListedReceipt, 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, type DepExportStatus, type DepExportFileKind, type DepExportErrorCode, type DepExportFailure, type CreateDepExportOptions, type CreateDepExportResult, type DepExportGap, type DepExportChainBreak, type DepExportFindings, type DepExportItems, type DepHandoverLinkInfo, type DepExport, type WaitForDepExportOptions, type GetDepExportFileOptions, type DepExportFile, type DepHandoverLink, type RevokedDepHandoverLink, type ListedFullReceipt, type ListReceiptsHeader, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
4
4
  export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, type VoucherDueInfo, type VoucherDueArticle, type VoucherDueType, type VoucherRedeemContext, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './receipt/due.js';
5
5
  export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
@@ -54,7 +54,7 @@ export declare function isReturnDisposition(value: unknown): value is ReturnDisp
54
54
  * [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
55
55
  * `KasseneckApiError.code` lesbar.
56
56
  */
57
- export declare const CANCELLATION_ERROR_CODES: readonly ["receipt_not_found", "receipt_type_not_cancellable", "training_receipt", "already_cancelled", "invalid_line", "quantity_exceeds_remaining", "unknown_reason", "note_too_long", "invalid_items", "cashregister_not_assigned", "not_permitted", "own_receipts_only", "cashregister_incomplete", "cancellation_failed", "cancellation_payments_required", "cancellation_refund_exceeds_payment", "cancellation_refund_reference_required", "cancellation_refund_reference_unknown", "cancellation_outcome_unknown", "invalid_return_disposition", "tip_refund_conflict", "invalid_tip_refund_source", "tip_refund_source_requires_cash", "tip_keep_not_possible_with_voucher", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "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", "validation", "route_missing", "response_unreadable"];
57
+ export declare const CANCELLATION_ERROR_CODES: readonly ["receipt_not_found", "receipt_type_not_cancellable", "training_receipt", "already_cancelled", "invalid_line", "quantity_exceeds_remaining", "unknown_reason", "note_too_long", "invalid_items", "cashregister_not_assigned", "not_permitted", "own_receipts_only", "cashregister_incomplete", "cancellation_failed", "cancellation_payments_required", "cancellation_refund_exceeds_payment", "cancellation_refund_reference_required", "cancellation_refund_reference_unknown", "cancellation_outcome_unknown", "invalid_return_disposition", "tip_refund_conflict", "invalid_tip_refund_source", "tip_refund_source_requires_cash", "tip_keep_not_possible_with_voucher", "refund_as_invalid", "refund_as_conflict", "refund_as_voucher_not_available", "refund_as_voucher_reason", "refund_as_voucher_with_voucher", "refund_as_voucher_no_type", "refund_as_voucher_amount", "idempotency_key_required", "account_not_found", "action_confirmation_required", "admin_required", "api_not_approved", "app_check_invalid", "app_check_missing", "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", "validation", "route_missing", "response_unreadable"];
58
58
  export type CancellationErrorCode = (typeof CANCELLATION_ERROR_CODES)[number];
59
59
  export declare function isCancellationErrorCode(value: unknown): value is CancellationErrorCode;
60
60
  /** Der Code eines geworfenen Fehlers, wenn er in [CANCELLATION_ERROR_CODES] steht; sonst `undefined`. */
@@ -81,6 +81,15 @@ export const CANCELLATION_ERROR_CODES = Object.freeze([
81
81
  'invalid_tip_refund_source', // tipRefundSource nicht drawer oder employee
82
82
  'tip_refund_source_requires_cash', // eine Quelle nur, wenn das Bargeld des Stornos das Trinkgeld deckt
83
83
  'tip_keep_not_possible_with_voucher', // refundTip false an einem Beleg mit Wertgutschein (das Trinkgeld geht mit)
84
+ // Rueckgabe als Gutschein (refundAs voucher, Server 2026-11)
85
+ 'refund_as_invalid', // refundAs ist nicht voucher
86
+ 'refund_as_conflict', // refundAs zusammen mit payments
87
+ 'refund_as_voucher_not_available', // ohne Kassen-Benutzer oder Gutscheinverkauf an der Kasse aus
88
+ 'refund_as_voucher_reason', // Grund passt nicht (nur customer_cancelled, other)
89
+ 'refund_as_voucher_with_voucher', // am Original haengt ein Gutschein mit Code
90
+ 'refund_as_voucher_no_type', // keine passende Rueckgabe-Sorte eingestellt
91
+ 'refund_as_voucher_amount', // Betrag ohne Trinkgeld ausserhalb 1,00 bis 10.000,00 Euro
92
+ 'idempotency_key_required', // refundAs ohne idempotencyKey
84
93
  // Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
85
94
  'account_not_found',
86
95
  'action_confirmation_required',
@@ -1,5 +1,5 @@
1
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 VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields } from './voucher.js';
2
+ export { type Voucher, type VoucherArticle, type IssuedVoucher, type ReturnIssuedVoucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, isNewFormVoucher, voucherServerFields } 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';
@@ -52,6 +52,11 @@ export interface Voucher {
52
52
  article?: VoucherArticle;
53
53
  balanceAfterCents?: number;
54
54
  remainingQuantityAfter?: number;
55
+ /**
56
+ * Rueckgabe als Gutschein: der Eintrag am Storno-Beleg ist die Ausgabe eines neuen Mehrzweck-
57
+ * Gutscheins statt einer Rueckzahlung (`action: redeem`). Am Bon Zahlweg statt Einloesung.
58
+ */
59
+ fromReturn?: boolean;
55
60
  taxedWith?: string;
56
61
  exempt?: boolean;
57
62
  zeroRateBucket?: boolean;
@@ -74,6 +79,8 @@ export interface IssuedVoucher {
74
79
  /** Verkauf ueber eine Sorte: ihre Kennung und ihr Name; sonst fehlen die Felder. */
75
80
  typeId?: string;
76
81
  typeName?: string;
82
+ /** Rueckgabe als Gutschein (`cancelReceipt` mit `refundAs: 'voucher'`): `true`; fehlt beim Verkauf. */
83
+ fromReturn?: true;
77
84
  validity?: {
78
85
  pattern: string;
79
86
  /** Sorte „N Jahre“: die Zahl N (Muster `1+3` fuer jedes N, die Daten gelten); fehlt sonst. */
@@ -83,6 +90,17 @@ export interface IssuedVoucher {
83
90
  validUntil: string | null;
84
91
  };
85
92
  }
93
+ /**
94
+ * Gutschein aus einer Rueckgabe in der Antwort von `cancelReceipt` (`data.issuedVouchers[]`). Beim ersten
95
+ * Mal wie [IssuedVoucher] mit Klartext-Code; bei einer Wiederholung mit demselben `idempotencyKey` ohne
96
+ * `code`, dafuer `reprintRequired: true` (der Zettel kommt dann ueber den Nachdruck).
97
+ */
98
+ export type ReturnIssuedVoucher = Omit<IssuedVoucher, 'code' | 'type' | 'index'> & {
99
+ code?: string;
100
+ type?: string;
101
+ index?: number;
102
+ reprintRequired?: true;
103
+ };
86
104
  /** Artikel eines Leistungsgutscheins, wie der Server ihn am Beleg festhaelt. */
87
105
  export interface VoucherArticle {
88
106
  id: string;
@@ -138,7 +156,7 @@ export declare function istWertVerkauf(voucher: Pick<Voucher, 'type' | 'action'
138
156
  * Felder, die nur der Server setzt; an einem Wunsch sind sie `voucher_invalid`.
139
157
  * Sortenname und Auszahlung friert der Server beim Verkauf ein (Stufe 4b).
140
158
  */
141
- export declare const GUTSCHEIN_SERVERFELDER: readonly ["voucherId", "codeSuffix", "zeroRateBucket", "voucherType", "typeName", "payout"];
159
+ export declare const GUTSCHEIN_SERVERFELDER: readonly ["voucherId", "codeSuffix", "zeroRateBucket", "voucherType", "typeName", "payout", "fromReturn"];
142
160
  /** Welche Serverfelder tragt der Gutschein (leere Liste = keines)? */
143
161
  export declare function voucherServerFields(voucher: Voucher): string[];
144
162
  export declare function toVoucherPayload(voucher: Voucher): VoucherPayload;
@@ -32,14 +32,14 @@ export function istWertVerkauf(voucher) {
32
32
  * Felder, die nur der Server setzt; an einem Wunsch sind sie `voucher_invalid`.
33
33
  * Sortenname und Auszahlung friert der Server beim Verkauf ein (Stufe 4b).
34
34
  */
35
- export const GUTSCHEIN_SERVERFELDER = ['voucherId', 'codeSuffix', 'zeroRateBucket', 'voucherType', 'typeName', 'payout'];
35
+ export const GUTSCHEIN_SERVERFELDER = ['voucherId', 'codeSuffix', 'zeroRateBucket', 'voucherType', 'typeName', 'payout', 'fromReturn'];
36
36
  /** Welche Serverfelder tragt der Gutschein (leere Liste = keines)? */
37
37
  export function voucherServerFields(voucher) {
38
38
  return GUTSCHEIN_SERVERFELDER.filter((feld) => voucher[feld] != null);
39
39
  }
40
40
  const NEUE_FELDER = [
41
41
  'amountCents', 'articleId', 'quantity', 'positions', 'reason', 'typeId', 'typeName', 'payout', 'voucherType', 'voucherId', 'codeSuffix',
42
- 'vatRateBp', 'article', 'balanceAfterCents', 'remainingQuantityAfter', 'taxedWith', 'exempt', 'zeroRateBucket',
42
+ 'vatRateBp', 'article', 'balanceAfterCents', 'remainingQuantityAfter', 'taxedWith', 'exempt', 'zeroRateBucket', 'fromReturn',
43
43
  ];
44
44
  export function toVoucherPayload(voucher) {
45
45
  const action = requireEnumKey(VoucherAction, voucher.action, 'Gutschein-Aktion');
@@ -153,6 +153,16 @@ export interface PosVoucherSettings {
153
153
  serviceArticles?: boolean;
154
154
  /** Standardvorlage des Etiketts (Leistungsgutschein, Notausgang); `null` ohne brauchbare Vorlage. */
155
155
  labelDefault?: VoucherLabelTemplate | null;
156
+ /**
157
+ * Sorte fuer Rueckgaben (Server 2026-11): nur gesetzt, wenn die Rueckgabe als Gutschein geht (Schalter,
158
+ * passende Sorte). Fehlt sie, zeigt die Kasse „Als Gutschein“ nicht.
159
+ */
160
+ returnType?: PosVoucherReturnType;
161
+ }
162
+ /** Sorte fuer Rueckgaben (`vouchers.returnType`): Kennung und Name. */
163
+ export interface PosVoucherReturnType {
164
+ typeId: string;
165
+ typeName: string;
156
166
  }
157
167
  /** Ohne Block `vouchers` (alter Server, Konto ohne Schalter): Verkaufen ist aus. */
158
168
  export declare const VOUCHER_SETTINGS_DEFAULTS: Readonly<PosVoucherSettings>;
@@ -76,8 +76,15 @@ export function posVoucherSettingsFromWire(block) {
76
76
  types,
77
77
  serviceArticles: leistung,
78
78
  labelDefault: vorlageVomDraht(b['labelDefault']),
79
+ ...rueckgabeSorteVomDraht(b['returnType']),
79
80
  };
80
81
  }
82
+ /** `vouchers.returnType`, nur stimmig (Kennung wie eine Sorte, Name als Text); sonst fehlt es. */
83
+ function rueckgabeSorteVomDraht(roh) {
84
+ if (!istObjekt(roh) || typeof roh['typeId'] !== 'string' || !SORTE_ID.test(roh['typeId']) || typeof roh['typeName'] !== 'string')
85
+ return {};
86
+ return { returnType: { typeId: roh['typeId'], typeName: roh['typeName'] } };
87
+ }
81
88
  /** Kennung wie am Server (gutschein-core.ID_MUSTER): reservierte `__…__` gibt es nie als Sorte. */
82
89
  const SORTE_ID = /^(?!__.*__$)[A-Za-z0-9_-]{1,128}$/;
83
90
  /** Grenzen des Servers (gutschein-core.pruefeSorte): Fixbetrag 1,00 bis 10.000,00 €, Gueltigkeit 1 bis 30 Jahre. */
@@ -21,10 +21,10 @@ export { STOCK_LOCATION_TYPES, type StockLocationType, type StockLocation, type
21
21
  export { type ListMyStocktakesOptions, type ListMyStocktakeItemsOptions, type ListMyStocktakeCountsOptions, type RecordMyStocktakeCountOptions, type VoidMyStocktakeCountOptions, listMyStocktakes, listMyStocktakeItems, listMyStocktakeCounts, recordMyStocktakeCount, voidMyStocktakeCount, parseQuantityMilli, } from './inventur.js';
22
22
  export type { Stocktake, StocktakeItem, StocktakeCount, StocktakeCountResult, StocktakeItemPage, StocktakeCountPage, StocktakeActor, StocktakeProgress, StocktakeReview, StocktakeRecount, StocktakeScope, } from '../inventory/typen.js';
23
23
  export type { StocktakeStatus } from '../inventory/vertrag.js';
24
- export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, type VoucherKind, type VoucherStatus, type VoucherValidity, type VoucherArticle, type VoucherCheck, type PosVoucherSettings, type VoucherPayout, type VoucherTypeKind, type PosVoucherType, type VoucherLabelTemplate, } from './gutschein.js';
24
+ export { VOUCHER_KINDS, VOUCHER_STATUSES, checkVoucher, reprintVoucherLabel, VOUCHER_SETTINGS_DEFAULTS, posVoucherSettingsFromWire, VOUCHER_PAYOUTS, VOUCHER_TYPE_KINDS, VOUCHER_AMOUNT_MODES, VOUCHER_TYPE_VALIDITY_PATTERNS, type VoucherKind, type VoucherStatus, type VoucherValidity, type VoucherArticle, type VoucherCheck, type PosVoucherSettings, type PosVoucherReturnType, type VoucherPayout, type VoucherTypeKind, type PosVoucherType, type VoucherLabelTemplate, } from './gutschein.js';
25
25
  export { type GetMyDrawerStateOptions, type OpenMyShiftOptions, type RecordMyCashMovementOptions, type DrawerOpeningEntry, type LogMyDrawerOpeningsOptions, type GetMyShiftReportOptions, type TipPayout, type CloseMyShiftOptions, type AfterCountOption, getMyDrawerState, openMyShift, recordMyCashMovement, logMyDrawerOpenings, getMyShiftReport, closeMyShift, sumDenominations, parseCentsAllowZero, newIdempotencyKey, shiftTipLines, durationText, type ShiftTipLine, type ShiftTipLineKey, } from './schicht.js';
26
26
  export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATIONS, OPENING_REASONS, MANUAL_OPENING_REASONS, SHIFT_RECEIPT_KINDS, AFTER_COUNT_TYPES, type AfterCountType, type AfterCount, type EurDenomination, type MovementType, type ManualMovementType, type CashLocation, type OpeningReason, type ManualOpeningReason, type ShiftReceiptKind, type ShiftStatus, type ShiftActorRole, type Denominations, type ShiftActor, type DrawerInfo, type DrawerRights, type NonCashAmount, type ShiftTipTotals, type ShiftTip, type ShiftRunningTotals, type ShiftReconciliation, type Shift, type TipClaim, type DrawerOpening, type DrawerState, type CashMovement, type ShiftReceiptHeader, type ShiftReceiptMovement, type ShiftReceiptTip, type ShiftSummaryReceipt, type CashMovementReceipt, type ShiftReceipt, type OpenShiftResult, type CashMovementResult, type DrawerOpeningsResult, type ShiftReport, type CloseShiftResult, } from './schicht-typen.js';
27
27
  export { type ShiftReceiptLayoutOptions, shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
28
28
  export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputKind, type ReceiptOutputResult } from '../models/receipt-output.js';
29
29
  export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
30
- export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
30
+ export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
@@ -37,4 +37,4 @@ export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS } from '../models/receipt-
37
37
  // Rueckgabe-Wahl beim Storno (Kassen-Dialog); dieselbe Liste wie an der Wurzel.
38
38
  export { RETURN_DISPOSITIONS, isReturnDisposition } from '../models/cancellation.js';
39
39
  // Was die Kasse selbst sagt: ein Katalog fuer Browser-Kasse und App.
40
- export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, } from './texte.js';
40
+ export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, } from './texte.js';
@@ -319,6 +319,24 @@ declare const MELDUNGEN_ROH: {
319
319
  readonly 'cancellation.tip_refunded_with_voucher': {
320
320
  readonly text: "Beleg mit Gutschein: Das Trinkgeld wird mitstorniert.";
321
321
  };
322
+ readonly 'cancellation.voucher_not_available': {
323
+ readonly text: "Als Gutschein geht hier nicht – bitte wie bezahlt zurückgeben.";
324
+ };
325
+ readonly 'cancellation.voucher_reason': {
326
+ readonly text: "Als Gutschein nur bei „Kunde hat storniert“ oder „Sonstiges“.";
327
+ };
328
+ readonly 'cancellation.voucher_with_voucher': {
329
+ readonly text: "Dieser Beleg hat einen Gutschein – bitte wie bezahlt zurückgeben.";
330
+ };
331
+ readonly 'cancellation.voucher_no_type': {
332
+ readonly text: "Keine Gutschein-Sorte für Rückgaben eingestellt – bitte wie bezahlt zurückgeben.";
333
+ };
334
+ readonly 'cancellation.voucher_amount': {
335
+ readonly text: "Dieser Betrag geht nicht als Gutschein – bitte wie bezahlt zurückgeben.";
336
+ };
337
+ readonly 'cancellation.voucher_type_changed': {
338
+ readonly text: "Die Gutschein-Sorte für Rückgaben hat sich geändert – bitte erneut versuchen.";
339
+ };
322
340
  readonly 'voucher_error.not_found': {
323
341
  readonly text: "Diesen Gutschein gibt es in diesem Betrieb nicht.";
324
342
  };
@@ -1109,6 +1127,29 @@ export type CancellationPaymentMessageCode = keyof typeof CANCELLATION_PAYMENT_E
1109
1127
  * `cancellation.failed` auf – wie bei `receiptEmailErrorMessage`.
1110
1128
  */
1111
1129
  export declare function cancellationPaymentErrorMessage(code: string | undefined | null): MessageKey;
1130
+ /**
1131
+ * Storno mit Rueckgabe als Gutschein (`refundAs: 'voucher'`, 1.25.0): welcher `code` welchen Satz bekommt.
1132
+ * Eigene Tabelle neben CANCELLATION_PAYMENT_ERROR_MESSAGES (die bleibt der Stand der 0.x-Linie); die Codes
1133
+ * fuer abgelehnte Eingaben und `idempotency_conflict` teilen sich `cancellation.input_rejected`.
1134
+ */
1135
+ export declare const CANCELLATION_VOUCHER_ERROR_MESSAGES: {
1136
+ readonly refund_as_voucher_not_available: "cancellation.voucher_not_available";
1137
+ readonly refund_as_voucher_reason: "cancellation.voucher_reason";
1138
+ readonly refund_as_voucher_with_voucher: "cancellation.voucher_with_voucher";
1139
+ readonly refund_as_voucher_no_type: "cancellation.voucher_no_type";
1140
+ readonly refund_as_voucher_amount: "cancellation.voucher_amount";
1141
+ readonly voucher_type_not_found: "cancellation.voucher_type_changed";
1142
+ readonly voucher_amount_mismatch: "cancellation.voucher_type_changed";
1143
+ readonly refund_as_invalid: "cancellation.input_rejected";
1144
+ readonly refund_as_conflict: "cancellation.input_rejected";
1145
+ readonly idempotency_key_required: "cancellation.input_rejected";
1146
+ readonly idempotency_conflict: "cancellation.input_rejected";
1147
+ };
1148
+ /**
1149
+ * Der Satz zu einem `code` eines Stornos: zuerst die Rueckgabe als Gutschein, dann die Storno-Zahlungen,
1150
+ * sonst `cancellation.failed`. Fuer die Kassen der eine Weg beim Storno.
1151
+ */
1152
+ export declare function cancellationErrorMessage(code: string | undefined | null): MessageKey;
1112
1153
  /**
1113
1154
  * Gutschein-Fehler (`/v3`): welcher `code` des Backends welchen Satz bekommt.
1114
1155
  * Wie RECEIPT_EMAIL_ERROR_MESSAGES: beide Kassen entscheiden am Code. Ein
@@ -1387,10 +1428,41 @@ declare const BESCHRIFTUNGEN_ROH: {
1387
1428
  readonly 'cancellation.all_cash': {
1388
1429
  readonly text: "Alles bar";
1389
1430
  };
1431
+ readonly 'cancellation.as_voucher': {
1432
+ readonly text: "Als Gutschein";
1433
+ };
1434
+ readonly 'cancellation.voucher_confirm': {
1435
+ readonly text: "{amount} als Gutschein zurückgeben";
1436
+ readonly placeholders: readonly ["amount"];
1437
+ };
1390
1438
  readonly 'cancellation.payment_remainder': {
1391
1439
  readonly text: "Rest {amount}";
1392
1440
  readonly placeholders: readonly ["amount"];
1393
1441
  };
1442
+ readonly 'cancellation.refund_cash': {
1443
+ readonly text: "{amount} bar";
1444
+ readonly placeholders: readonly ["amount"];
1445
+ };
1446
+ readonly 'cancellation.refund_card': {
1447
+ readonly text: "{amount} auf die Karte";
1448
+ readonly placeholders: readonly ["amount"];
1449
+ };
1450
+ readonly 'cancellation.refund_other': {
1451
+ readonly text: "{amount} per {method}";
1452
+ readonly placeholders: readonly ["amount", "method"];
1453
+ };
1454
+ readonly 'cancellation.refund_line': {
1455
+ readonly text: "{refunds} zurückgeben";
1456
+ readonly placeholders: readonly ["refunds"];
1457
+ };
1458
+ readonly 'cancellation.refund_line_estimated': {
1459
+ readonly text: "voraussichtlich {refunds} zurückgeben";
1460
+ readonly placeholders: readonly ["refunds"];
1461
+ };
1462
+ readonly 'cancellation.voucher_tip_cash': {
1463
+ readonly text: "{amount} Trinkgeld bar zurückgeben";
1464
+ readonly placeholders: readonly ["amount"];
1465
+ };
1394
1466
  readonly 'cancellation.difference': {
1395
1467
  readonly text: "Differenz";
1396
1468
  };
@@ -177,6 +177,14 @@ const MELDUNGEN_ROH = {
177
177
  'cancellation.tip_source_missing': { text: 'Bitte wählen: Woher kommt das Trinkgeld zurück?' },
178
178
  // Beleg mit Wertgutschein: keine Frage, das Trinkgeld geht mit (Ruling R59, asksRefundTip).
179
179
  'cancellation.tip_refunded_with_voucher': { text: 'Beleg mit Gutschein: Das Trinkgeld wird mitstorniert.' },
180
+ // Rueckgabe als Gutschein (refundAs voucher): die Kasse zeigt „Als Gutschein“ nur, wenn es geht; diese
181
+ // Saetze sind fuer den seltenen Fall, dass der Server trotzdem ablehnt.
182
+ 'cancellation.voucher_not_available': { text: 'Als Gutschein geht hier nicht – bitte wie bezahlt zurückgeben.' },
183
+ 'cancellation.voucher_reason': { text: 'Als Gutschein nur bei „Kunde hat storniert“ oder „Sonstiges“.' },
184
+ 'cancellation.voucher_with_voucher': { text: 'Dieser Beleg hat einen Gutschein – bitte wie bezahlt zurückgeben.' },
185
+ 'cancellation.voucher_no_type': { text: 'Keine Gutschein-Sorte für Rückgaben eingestellt – bitte wie bezahlt zurückgeben.' },
186
+ 'cancellation.voucher_amount': { text: 'Dieser Betrag geht nicht als Gutschein – bitte wie bezahlt zurückgeben.' },
187
+ 'cancellation.voucher_type_changed': { text: 'Die Gutschein-Sorte für Rückgaben hat sich geändert – bitte erneut versuchen.' },
180
188
  // --- Gutscheine: Fehlersätze (Zuordnung in VOUCHER_ERROR_MESSAGES) ---------
181
189
  'voucher_error.not_found': { text: 'Diesen Gutschein gibt es in diesem Betrieb nicht.' },
182
190
  'voucher_error.invalid': { text: 'Dieser Gutschein ist nicht gültig.' },
@@ -621,6 +629,32 @@ export function cancellationPaymentErrorMessage(code) {
621
629
  const fehler = CANCELLATION_PAYMENT_ERROR_MESSAGES;
622
630
  return (code !== undefined && code !== null && fehler[code]) || 'cancellation.failed';
623
631
  }
632
+ /**
633
+ * Storno mit Rueckgabe als Gutschein (`refundAs: 'voucher'`, 1.25.0): welcher `code` welchen Satz bekommt.
634
+ * Eigene Tabelle neben CANCELLATION_PAYMENT_ERROR_MESSAGES (die bleibt der Stand der 0.x-Linie); die Codes
635
+ * fuer abgelehnte Eingaben und `idempotency_conflict` teilen sich `cancellation.input_rejected`.
636
+ */
637
+ export const CANCELLATION_VOUCHER_ERROR_MESSAGES = {
638
+ refund_as_voucher_not_available: 'cancellation.voucher_not_available',
639
+ refund_as_voucher_reason: 'cancellation.voucher_reason',
640
+ refund_as_voucher_with_voucher: 'cancellation.voucher_with_voucher',
641
+ refund_as_voucher_no_type: 'cancellation.voucher_no_type',
642
+ refund_as_voucher_amount: 'cancellation.voucher_amount',
643
+ voucher_type_not_found: 'cancellation.voucher_type_changed',
644
+ voucher_amount_mismatch: 'cancellation.voucher_type_changed',
645
+ refund_as_invalid: 'cancellation.input_rejected',
646
+ refund_as_conflict: 'cancellation.input_rejected',
647
+ idempotency_key_required: 'cancellation.input_rejected',
648
+ idempotency_conflict: 'cancellation.input_rejected',
649
+ };
650
+ /**
651
+ * Der Satz zu einem `code` eines Stornos: zuerst die Rueckgabe als Gutschein, dann die Storno-Zahlungen,
652
+ * sonst `cancellation.failed`. Fuer die Kassen der eine Weg beim Storno.
653
+ */
654
+ export function cancellationErrorMessage(code) {
655
+ const gutschein = CANCELLATION_VOUCHER_ERROR_MESSAGES;
656
+ return (code !== undefined && code !== null && gutschein[code]) || cancellationPaymentErrorMessage(code);
657
+ }
624
658
  /**
625
659
  * Gutschein-Fehler (`/v3`): welcher `code` des Backends welchen Satz bekommt.
626
660
  * Wie RECEIPT_EMAIL_ERROR_MESSAGES: beide Kassen entscheiden am Code. Ein
@@ -766,7 +800,19 @@ const BESCHRIFTUNGEN_ROH = {
766
800
  'cancellation.as_paid': { text: 'wie bezahlt' },
767
801
  'cancellation.cash': { text: 'bar' },
768
802
  'cancellation.all_cash': { text: 'Alles bar' },
803
+ // Rueckgabe als Gutschein: dritte Wahl in „Wie zurückgeben?“ und die Bestaetigung.
804
+ 'cancellation.as_voucher': { text: 'Als Gutschein' },
805
+ 'cancellation.voucher_confirm': { text: '{amount} als Gutschein zurückgeben', placeholders: ['amount'] },
769
806
  'cancellation.payment_remainder': { text: 'Rest {amount}', placeholders: ['amount'] },
807
+ // Die Zeile unter „wie bezahlt“: wohin das Geld zurückgeht, Teile mit „ · “ verbunden
808
+ // („20,00 € auf die Karte · 4,90 € bar zurückgeben“). Karte = jede Zahlart mit Karte.
809
+ 'cancellation.refund_cash': { text: '{amount} bar', placeholders: ['amount'] },
810
+ 'cancellation.refund_card': { text: '{amount} auf die Karte', placeholders: ['amount'] },
811
+ 'cancellation.refund_other': { text: '{amount} per {method}', placeholders: ['amount', 'method'] },
812
+ 'cancellation.refund_line': { text: '{refunds} zurückgeben', placeholders: ['refunds'] },
813
+ 'cancellation.refund_line_estimated': { text: 'voraussichtlich {refunds} zurückgeben', placeholders: ['refunds'] },
814
+ // Als Gutschein: das Mitarbeiter-Trinkgeld geht bar zurück, nie auf den Gutschein.
815
+ 'cancellation.voucher_tip_cash': { text: '{amount} Trinkgeld bar zurückgeben', placeholders: ['amount'] },
770
816
  'cancellation.difference': { text: 'Differenz' },
771
817
  // --- Storno mit oder ohne Trinkgeld (Schichten-Spec, Nachtrag 5) -----------
772
818
  // Erste Frage bei offenem Mitarbeiter-Trinkgeld, zweite nur bei Ja und Barrueckgabe.
@@ -468,6 +468,27 @@ function zahlungsZeilen(receipt) {
468
468
  }
469
469
  return zeilen;
470
470
  }
471
+ /** Eintrag einer Rueckgabe als Gutschein: nur am Storno-Beleg, Mehrzweck (`value`), `redeem` mit `fromReturn`. */
472
+ function istRueckgabeGutschein(voucher) {
473
+ return voucher.fromReturn === true && voucher.action === VoucherAction.redeem && voucher.type === VoucherType.value;
474
+ }
475
+ /**
476
+ * Zahlwege einer Rueckgabe als Gutschein, je mit Betrag (8:4): zuerst jeder neue Gutschein
477
+ * „Gutschein ····-XXXX“ | „-24,90 €“, dann jede Zahlung ausser 0 Cent (Mitarbeiter-Trinkgeld bar zurueck)
478
+ * „Barzahlung“ | „-2,00 €“.
479
+ */
480
+ function rueckgabeZahlungsZeilen(receipt, rueckgaben) {
481
+ const zeilen = rueckgaben.map((v) => {
482
+ const endung = gutscheinEndung(v);
483
+ return paarZeile(endung != null ? `Gutschein ····-${endung}` : 'Gutschein', `${formatCents(-(v.valueCents ?? 0))} €`, 8, 4);
484
+ });
485
+ for (const zahlung of receipt.payments ?? []) {
486
+ if (zahlung.amountCents === 0)
487
+ continue;
488
+ zeilen.push(paarZeile(zahlungsartText(zahlung.method), `${formatCents(zahlung.amountCents)} €`, 8, 4));
489
+ }
490
+ return zeilen;
491
+ }
471
492
  // -------------------------------------------------------- Kleinunternehmer
472
493
  /**
473
494
  * Hinweis auf die Steuerbefreiung, den ein Kleinunternehmerbeleg tragen muss —
@@ -1254,12 +1275,17 @@ export function buildReceiptLayout(receipt, company, options = {}) {
1254
1275
  }
1255
1276
  lines.push({ kind: 'rule', char: '-' });
1256
1277
  // --- Summen
1257
- const summeCents = receiptSumCents(receipt);
1278
+ // Rueckgabe als Gutschein (Storno, `fromReturn`): der neue Gutschein ist der Zahlweg der Rueckgabe, keine
1279
+ // Einloesung. „Gesamt“ zeigt wie beim Bar-Storno den Betrag der Waren, darunter „Gutschein ····-XXXX“ mit
1280
+ // dem Minus statt „Barzahlung“ (Spec 2026-11-02, A.5).
1281
+ const rueckgaben = receipt.vouchers.filter(istRueckgabeGutschein);
1282
+ const rueckgabeCents = rueckgaben.reduce((summe, v) => summe + (v.valueCents ?? 0), 0);
1283
+ const summeCents = receiptSumCents(receipt) - rueckgabeCents;
1258
1284
  const zwischensummeCents = receiptSubSumCents(receipt);
1259
1285
  if (summeCents !== zwischensummeCents) {
1260
1286
  lines.push(paarZeile('Zwischensumme', `${formatCents(zwischensummeCents)} €`));
1261
1287
  for (const voucher of receipt.vouchers) {
1262
- if (voucher.type !== VoucherType.value || voucher.zeroRateBucket === true)
1288
+ if (voucher.type !== VoucherType.value || voucher.zeroRateBucket === true || istRueckgabeGutschein(voucher))
1263
1289
  continue;
1264
1290
  if (voucher.action !== VoucherAction.redeem && voucher.action !== VoucherAction.payout)
1265
1291
  continue;
@@ -1280,7 +1306,7 @@ export function buildReceiptLayout(receipt, company, options = {}) {
1280
1306
  lines.push({ kind: 'rule', char: '-' });
1281
1307
  }
1282
1308
  lines.push(paarZeile('Gesamt:', `${formatCents(summeCents)} €`));
1283
- lines.push(...zahlungsZeilen(receipt));
1309
+ lines.push(...(rueckgaben.length > 0 ? rueckgabeZahlungsZeilen(receipt, rueckgaben) : zahlungsZeilen(receipt)));
1284
1310
  lines.push({ kind: 'space', lines: 1 });
1285
1311
  // --- Rechtshinweise und Ausfallhinweis
1286
1312
  const hinweise = company.isSmallBusiness
@@ -1,5 +1,5 @@
1
1
  /** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
2
- export declare const VOKABULAR_QUELLE = "d0d80190bd87c82b9a1037f6898059a51d56bb89a3fef6747c503b0b028cedce";
2
+ export declare const VOKABULAR_QUELLE = "44d12486b6108ca8c040230f317438b21c7761477fa1a9a7d6a65b28a5444e32";
3
3
  /** Schema-Notation des Vertrags: Blatt 'aussen': 'innen', Objekt { __: 'innen', ... }, Liste [ { __: 'innen', ... } ]. */
4
4
  export type SchemaEintrag = string | SchemaObjekt | readonly [SchemaObjekt];
5
5
  export interface SchemaObjekt {
@@ -1,7 +1,7 @@
1
1
  // Erzeugt von scripts/stored-vokabular.mjs aus fixtures/v3/v3-vokabular.json.
2
2
  // Nicht von Hand aendern: test/stored.test.ts vergleicht mit dem Vertrag.
3
3
  /** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
4
- export const VOKABULAR_QUELLE = "d0d80190bd87c82b9a1037f6898059a51d56bb89a3fef6747c503b0b028cedce";
4
+ export const VOKABULAR_QUELLE = "44d12486b6108ca8c040230f317438b21c7761477fa1a9a7d6a65b28a5444e32";
5
5
  /** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
6
6
  export const SCHEMAS = {
7
7
  "getReceipt": {
@@ -70,7 +70,8 @@ export const SCHEMAS = {
70
70
  "redeemableUntil": "einloesbarBis",
71
71
  "refundableUntil": "rueckzahlbarBis",
72
72
  "validUntil": "gueltigBis"
73
- }
73
+ },
74
+ "fromReturn": "rueckgabe"
74
75
  }
75
76
  ],
76
77
  "outputs": [
@@ -282,7 +283,12 @@ export const SCHEMAS = {
282
283
  "soldCount": "verkauft"
283
284
  }
284
285
  ],
285
- "serviceArticles": "leistungsArtikel"
286
+ "serviceArticles": "leistungsArtikel",
287
+ "returnType": {
288
+ "__": "rueckgabe",
289
+ "typeId": "sorteId",
290
+ "typeName": "sorteName"
291
+ }
286
292
  },
287
293
  "connect": {
288
294
  "__": "connect",
@@ -4,4 +4,4 @@
4
4
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
5
5
  * beim Anheben der Version beide Stellen aendern.
6
6
  */
7
- export declare const PACKAGE_VERSION = "1.24.0";
7
+ export declare const PACKAGE_VERSION = "1.25.1";
@@ -4,4 +4,4 @@
4
4
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
5
5
  * beim Anheben der Version beide Stellen aendern.
6
6
  */
7
- export const PACKAGE_VERSION = '1.24.0';
7
+ export const PACKAGE_VERSION = '1.25.1';