@kreiseck/kasseneck-api 1.29.0 → 1.31.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 (144) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +27 -0
  3. package/dist/cjs/client/list-receipts.d.ts +5 -0
  4. package/dist/cjs/client/list-receipts.js +5 -1
  5. package/dist/cjs/client/receipts.d.ts +6 -0
  6. package/dist/cjs/client/receipts.js +1 -0
  7. package/dist/cjs/enums/voucher-type.d.ts +5 -1
  8. package/dist/cjs/enums/voucher-type.js +5 -1
  9. package/dist/cjs/index.d.ts +1 -1
  10. package/dist/cjs/index.js +15 -5
  11. package/dist/cjs/inventory/index.d.ts +2 -2
  12. package/dist/cjs/inventory/index.js +3 -2
  13. package/dist/cjs/inventory/typen.d.ts +39 -1
  14. package/dist/cjs/inventory/vertrag.d.ts +13 -2
  15. package/dist/cjs/inventory/vertrag.js +16 -1
  16. package/dist/cjs/inventory/webhook.d.ts +3 -0
  17. package/dist/cjs/inventory/webhook.js +39 -0
  18. package/dist/cjs/models/index.d.ts +1 -1
  19. package/dist/cjs/models/index.js +12 -2
  20. package/dist/cjs/models/voucher.d.ts +96 -2
  21. package/dist/cjs/models/voucher.js +158 -5
  22. package/dist/cjs/pos/artikel.d.ts +12 -0
  23. package/dist/cjs/pos/artikel.js +2 -0
  24. package/dist/cjs/pos/client.js +11 -0
  25. package/dist/cjs/pos/errors.d.ts +1 -1
  26. package/dist/cjs/pos/errors.js +1 -0
  27. package/dist/cjs/pos/fremdgutschein-artikel.d.ts +66 -0
  28. package/dist/cjs/pos/fremdgutschein-artikel.js +74 -0
  29. package/dist/cjs/pos/gutschein.d.ts +13 -0
  30. package/dist/cjs/pos/gutschein.js +5 -1
  31. package/dist/cjs/pos/index.d.ts +7 -4
  32. package/dist/cjs/pos/index.js +43 -4
  33. package/dist/cjs/pos/rabatt-vorlagen.d.ts +79 -0
  34. package/dist/cjs/pos/rabatt-vorlagen.js +156 -0
  35. package/dist/cjs/pos/schicht-lesen.js +8 -0
  36. package/dist/cjs/pos/schicht-typen.d.ts +15 -0
  37. package/dist/cjs/pos/settings.d.ts +69 -3
  38. package/dist/cjs/pos/settings.js +72 -5
  39. package/dist/cjs/pos/texte.d.ts +235 -0
  40. package/dist/cjs/pos/texte.js +135 -1
  41. package/dist/cjs/pos/zusaetze.d.ts +3 -3
  42. package/dist/cjs/pos/zusaetze.js +4 -2
  43. package/dist/cjs/receipt/due.d.ts +8 -1
  44. package/dist/cjs/receipt/due.js +1 -0
  45. package/dist/cjs/receipt/gutschein-plan.d.ts +11 -1
  46. package/dist/cjs/receipt/gutschein-plan.js +116 -1
  47. package/dist/cjs/receipt/layout.js +39 -6
  48. package/dist/cjs/receipt/shift-sheet.js +8 -0
  49. package/dist/cjs/stored/draht.js +6 -0
  50. package/dist/cjs/stored/einstellungen.js +50 -2
  51. package/dist/cjs/stored/vokabular.d.ts +3 -1
  52. package/dist/cjs/stored/vokabular.js +52 -5
  53. package/dist/cjs/version.d.ts +1 -1
  54. package/dist/cjs/version.js +1 -1
  55. package/dist/esm/client/list-receipts.d.ts +5 -0
  56. package/dist/esm/client/list-receipts.js +5 -2
  57. package/dist/esm/client/receipts.d.ts +6 -0
  58. package/dist/esm/client/receipts.js +1 -0
  59. package/dist/esm/enums/voucher-type.d.ts +5 -1
  60. package/dist/esm/enums/voucher-type.js +5 -1
  61. package/dist/esm/index.d.ts +1 -1
  62. package/dist/esm/index.js +1 -1
  63. package/dist/esm/inventory/index.d.ts +2 -2
  64. package/dist/esm/inventory/index.js +1 -1
  65. package/dist/esm/inventory/typen.d.ts +39 -1
  66. package/dist/esm/inventory/vertrag.d.ts +13 -2
  67. package/dist/esm/inventory/vertrag.js +15 -0
  68. package/dist/esm/inventory/webhook.d.ts +3 -0
  69. package/dist/esm/inventory/webhook.js +39 -0
  70. package/dist/esm/models/index.d.ts +1 -1
  71. package/dist/esm/models/index.js +1 -1
  72. package/dist/esm/models/voucher.d.ts +96 -2
  73. package/dist/esm/models/voucher.js +152 -4
  74. package/dist/esm/pos/artikel.d.ts +12 -0
  75. package/dist/esm/pos/artikel.js +2 -0
  76. package/dist/esm/pos/client.js +12 -1
  77. package/dist/esm/pos/errors.d.ts +1 -1
  78. package/dist/esm/pos/errors.js +1 -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/gutschein.d.ts +13 -0
  82. package/dist/esm/pos/gutschein.js +4 -0
  83. package/dist/esm/pos/index.d.ts +7 -4
  84. package/dist/esm/pos/index.js +8 -4
  85. package/dist/esm/pos/rabatt-vorlagen.d.ts +79 -0
  86. package/dist/esm/pos/rabatt-vorlagen.js +148 -0
  87. package/dist/esm/pos/schicht-lesen.js +8 -0
  88. package/dist/esm/pos/schicht-typen.d.ts +15 -0
  89. package/dist/esm/pos/settings.d.ts +69 -3
  90. package/dist/esm/pos/settings.js +67 -4
  91. package/dist/esm/pos/texte.d.ts +235 -0
  92. package/dist/esm/pos/texte.js +133 -0
  93. package/dist/esm/pos/zusaetze.d.ts +3 -3
  94. package/dist/esm/pos/zusaetze.js +4 -2
  95. package/dist/esm/receipt/due.d.ts +8 -1
  96. package/dist/esm/receipt/due.js +1 -0
  97. package/dist/esm/receipt/gutschein-plan.d.ts +11 -1
  98. package/dist/esm/receipt/gutschein-plan.js +117 -2
  99. package/dist/esm/receipt/layout.js +40 -7
  100. package/dist/esm/receipt/shift-sheet.js +8 -0
  101. package/dist/esm/stored/draht.js +7 -1
  102. package/dist/esm/stored/einstellungen.js +52 -4
  103. package/dist/esm/stored/vokabular.d.ts +3 -1
  104. package/dist/esm/stored/vokabular.js +51 -4
  105. package/dist/esm/version.d.ts +1 -1
  106. package/dist/esm/version.js +1 -1
  107. package/fixtures/add-on-cases.json +6 -4
  108. package/fixtures/discount-preset-cases.json +1074 -0
  109. package/fixtures/expected/voucher-external-redeem.grid32.txt +30 -0
  110. package/fixtures/expected/voucher-external-redeem.grid48.txt +27 -0
  111. package/fixtures/expected/voucher-external-redeem.lines.json +280 -0
  112. package/fixtures/expected/voucher-external-redeem.sheet32.json +206 -0
  113. package/fixtures/expected/voucher-external-redeem.sheet48.json +188 -0
  114. package/fixtures/expected/voucher-external-sale.grid32.txt +27 -0
  115. package/fixtures/expected/voucher-external-sale.grid48.txt +26 -0
  116. package/fixtures/expected/voucher-external-sale.lines.json +256 -0
  117. package/fixtures/expected/voucher-external-sale.sheet32.json +188 -0
  118. package/fixtures/expected/voucher-external-sale.sheet48.json +182 -0
  119. package/fixtures/external-voucher-article-cases.json +311 -0
  120. package/fixtures/hobex-hps-codes.json +1 -1
  121. package/fixtures/invoice-api.schema.json +1 -1
  122. package/fixtures/invoice-texts.json +1 -1
  123. package/fixtures/manifest.json +16 -0
  124. package/fixtures/pos-texts.json +226 -2
  125. package/fixtures/receipt-due-voucher-generated.json +2 -2
  126. package/fixtures/receipts/voucher-external-redeem.json +85 -0
  127. package/fixtures/receipts/voucher-external-sale.json +80 -0
  128. package/fixtures/renames-1.0.json +18 -0
  129. package/fixtures/stored/voucher-cases.json +2800 -0
  130. package/fixtures/surface.json +62 -5
  131. package/fixtures/v3/antworten/belege.json +4 -3
  132. package/fixtures/v3/antworten/belegmail.json +2 -2
  133. package/fixtures/v3/antworten/berichte.json +2 -2
  134. package/fixtures/v3/antworten/kasse-belege.json +4 -3
  135. package/fixtures/v3/antworten/kasse.json +16 -10
  136. package/fixtures/v3/antworten/lager.json +6 -3
  137. package/fixtures/v3/antworten/rechnungen.json +2 -2
  138. package/fixtures/v3/antworten/storno.json +2 -2
  139. package/fixtures/v3/stored/belege.json +2 -2
  140. package/fixtures/v3/stored/kasse.json +3 -3
  141. package/fixtures/v3/stored/rechnungen.json +2 -2
  142. package/fixtures/v3/v3-vokabular.json +262 -15
  143. package/fixtures/v3/zahlbetrag-faelle.json +2 -2
  144. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { ReceiptType, type ReceiptTypeKey, KeckPaymentMethod } from '../enums/index.js';
2
2
  import type { ReceiptItem } from '../models/receipt-item.js';
3
3
  import type { Voucher } from '../models/voucher.js';
4
- import type { PosVoucherSettings, VoucherCheck } from '../pos/gutschein.js';
4
+ import type { PosExternalVouchers, PosVoucherSettings, VoucherCheck } from '../pos/gutschein.js';
5
5
  import { type VoucherDueArticle, type VoucherDueInfo, type VoucherDueType } from './gutschein-plan.js';
6
6
  export { VOUCHER_ZERO_RATE_BUCKET_FROM, type VoucherDueArticle, type VoucherDueInfo, type VoucherDueType } from './gutschein-plan.js';
7
7
  /**
@@ -104,6 +104,13 @@ export interface ReceiptDueOptions {
104
104
  * einen Wert-Verkauf ohne `typeId` nicht mehr.
105
105
  */
106
106
  voucherSettings?: PosVoucherSettings;
107
+ /**
108
+ * Freigabe fuer Fremdgutscheine (`getKasseSettings` `vouchers.externalVouchers`). Bei `off` rechnet ein
109
+ * Fremdgutschein nicht (`external_voucher_not_enabled`), ein fremder Einzweck nur bei `all`
110
+ * (`external_voucher_type_not_enabled`). Ohne Angabe gilt die aus `voucherSettings`; fehlen beide, prueft
111
+ * nur der Server die Freigabe.
112
+ */
113
+ externalVouchers?: PosExternalVouchers;
107
114
  /**
108
115
  * Artikel fuer den Verkauf von Dienstleistungsgutscheinen (Preis und Satz,
109
116
  * wie im Artikelstamm). Fehlt der verkaufte Artikel hier:
@@ -83,6 +83,7 @@ function rechne(items, vouchers, receiptType, options) {
83
83
  const plan = planeGutscheine(positionen, vouchers, art, {
84
84
  voucherInfo: options.voucherInfo,
85
85
  voucherSettings: options.voucherSettings,
86
+ ...(options.externalVouchers !== undefined ? { externalVouchers: options.externalVouchers } : {}),
86
87
  voucherTypes: options.voucherTypes,
87
88
  voucherArticles: options.voucherArticles,
88
89
  smallBusiness: options.smallBusiness,
@@ -1,5 +1,5 @@
1
1
  import type { Voucher } from '../models/voucher.js';
2
- import type { PosVoucherSettings, PosVoucherType, VoucherArticle, VoucherCheck } from '../pos/gutschein.js';
2
+ import type { PosExternalVouchers, PosVoucherSettings, PosVoucherType, VoucherArticle, VoucherCheck } from '../pos/gutschein.js';
3
3
  /**
4
4
  * Gutscheine der neuen Form im Zahlbetrag: Zwilling von
5
5
  * `gutschein-beleg.plane` im Backend, soweit er den Zahlbetrag bestimmt.
@@ -27,6 +27,11 @@ import type { PosVoucherSettings, PosVoucherType, VoucherArticle, VoucherCheck }
27
27
  * - Leistung verkaufen: Stueck mal Artikelpreis im Artikelsatz; einloesen: je
28
28
  * Satz eine Minuszeile ueber die gewaehlten Positionen.
29
29
  * - Aktion: Rabatt wie `promo`, Betrag aus der Pruefung, hoechstens die Summe.
30
+ * - Fremdgutschein (`source: 'external'`, Server 2026-11): dieselbe Strecke
31
+ * wie ein eigener Mehrzweck- bzw. Einzweckgutschein, nur ohne Pruefung und
32
+ * Saldo (verfuegbar ist genau der Betrag des Wunschs); Satz und Vermerk
33
+ * sagt der Wunsch, Satz 0 heisst befreit verkauft. Freigabe aus
34
+ * `externalVouchers` (sonst `voucherSettings.externalVouchers`).
30
35
  *
31
36
  * Kein Fehler wird still geschluckt: was der Server mit einem Gutschein-Code
32
37
  * abwiese, liefert `fehler` mit genau diesem Code (`voucher_*`). Der
@@ -77,6 +82,11 @@ export declare const VOUCHER_ZERO_RATE_BUCKET_FROM = "2099-12-31";
77
82
  export interface PlanOptionen {
78
83
  voucherInfo?: readonly VoucherDueInfo[];
79
84
  voucherSettings?: PosVoucherSettings;
85
+ /**
86
+ * Freigabe fuer Fremdgutscheine des Kontos; ohne Angabe die aus `voucherSettings`. Fehlen beide, prueft nur
87
+ * der Server die Freigabe.
88
+ */
89
+ externalVouchers?: PosExternalVouchers;
80
90
  voucherTypes?: readonly VoucherDueType[];
81
91
  voucherArticles?: readonly VoucherDueArticle[];
82
92
  smallBusiness?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { VoucherCode } from '@kreiseck/validator';
2
- import { isNewFormVoucher, istWertVerkauf, voucherIsValid, voucherServerFields, wunschFormGueltig } from '../models/voucher.js';
2
+ import { EXTERNAL_VOUCHER_TAXED_WITH_MAX, EXTERNAL_VOUCHER_VAT_RATES_BP, checkExternalVoucherNumber, isExternalVoucher, isNewFormVoucher, istWertVerkauf, voucherIsValid, voucherServerFields, wunschFormGueltig, } from '../models/voucher.js';
3
3
  /**
4
4
  * Stichtag des 0-%-Topfs fuer Mehrzweck-Verkaeufe (Backend
5
5
  * `gutschein-core.NULLTOPF_AB`). Solange er in der Zukunft liegt, zaehlt ein
@@ -121,6 +121,63 @@ function kuTeile(kunde, betragCents) {
121
121
  nachRest[k].s.cents += 1;
122
122
  return saetze.filter((s) => s.cents > 0).map((s) => ({ satzBp: s.satzBp, cents: s.cents }));
123
123
  }
124
+ /** Steuer- und Formatzeichen (`gutschein-core.STEUERZEICHEN`). */
125
+ const STEUERZEICHEN = /[\p{Cc}\p{Cf}]/u;
126
+ /**
127
+ * Form eines Fremdgutschein-Wunschs in der Reihenfolge von `gutschein-beleg.pruefeFremd`: Freigabe, Aktion, Art,
128
+ * Freigabe der Art, Felder eigener Gutscheine, eigener Code, Nummer, Dublette, Betrag, Satz, Vermerk, Grund.
129
+ * `freigabe` undefined: die Freigabe prueft nur der Server.
130
+ */
131
+ function pruefeFremd(v, i, freigabe, gesehen) {
132
+ const nein = (fehler, text) => ({ fehler, text });
133
+ const falsch = (feld) => nein('voucher_invalid', `Gutschein ${i + 1}: ${feld} passt nicht zum Fremdgutschein.`);
134
+ if (freigabe === 'off')
135
+ return nein('external_voucher_not_enabled', `Gutschein ${i + 1}: Fremdgutscheine sind nicht freigegeben.`);
136
+ if (v.action !== 'sell' && v.action !== 'redeem' && v.action !== 'payout')
137
+ return falsch('action');
138
+ if (v.type !== 'multi_purpose' && v.type !== 'single_purpose')
139
+ return falsch('type');
140
+ if (v.type === 'single_purpose' && freigabe !== undefined && freigabe !== 'all') {
141
+ return nein('external_voucher_type_not_enabled', `Gutschein ${i + 1}: fremde Einzweckgutscheine sind nicht freigegeben.`);
142
+ }
143
+ const r = v;
144
+ for (const feld of ['code', 'typeId', 'articleId', 'article', 'quantity', 'positions']) {
145
+ if (r[feld] !== undefined)
146
+ return falsch(feld);
147
+ }
148
+ if (v.valueCents != null)
149
+ return falsch('valueCents');
150
+ const nummer = checkExternalVoucherNumber(v.number);
151
+ if (!nummer.ok)
152
+ return nein(nummer.code, `Gutschein ${i + 1}: die Nummer ist ${nummer.code === 'external_voucher_number_is_own_code' ? 'ein eigener Gutscheincode' : 'ungueltig'}.`);
153
+ if (gesehen.has(nummer.number))
154
+ return nein('external_voucher_duplicate', `Gutschein ${i + 1}: dieselbe Nummer steht zweimal am Beleg.`);
155
+ gesehen.add(nummer.number);
156
+ const c = v.amountCents;
157
+ if (!(typeof c === 'number' && Number.isInteger(c) && c >= 1 && c <= 1_000_000))
158
+ return falsch('amountCents');
159
+ if (v.type === 'single_purpose') {
160
+ if (!(typeof v.vatRateBp === 'number' && EXTERNAL_VOUCHER_VAT_RATES_BP.includes(v.vatRateBp)))
161
+ return falsch('vatRateBp');
162
+ }
163
+ else if (v.vatRateBp != null) {
164
+ return falsch('vatRateBp');
165
+ }
166
+ if (v.taxedWith != null) {
167
+ if (v.type !== 'single_purpose' || v.action === 'sell')
168
+ return falsch('taxedWith');
169
+ const t = typeof v.taxedWith === 'string' ? v.taxedWith.trim() : '';
170
+ if (t.length < 1 || t.length > EXTERNAL_VOUCHER_TAXED_WITH_MAX || STEUERZEICHEN.test(t))
171
+ return falsch('taxedWith');
172
+ }
173
+ if (v.action === 'payout') {
174
+ const g = typeof v.reason === 'string' ? v.reason.trim() : '';
175
+ if (g.length < 1 || g.length > 200)
176
+ return falsch('reason');
177
+ }
178
+ // Uebrige Serverfelder am Wunsch: wie bei eigenen Gutscheinen nie sendbar.
179
+ return voucherIsValid(v) ? null : falsch('Angaben');
180
+ }
124
181
  /**
125
182
  * Wuensche und gelesene Eintraege in Positionen und Belegeintraege, wie
126
183
  * `plane` sie baut. `kunde` sind Ware und Trinkgeld in innerer Form.
@@ -166,11 +223,19 @@ export function planeGutscheine(kunde, vouchers, art, o) {
166
223
  return nein('voucher_invalid', 'Gutscheine der neuen Form gibt es nicht auf Schulungsbelegen.');
167
224
  if (kunde.some(istGutscheinZeile))
168
225
  return nein('voucher_invalid', 'Gutschein-Positionen setzt nur der Server.');
226
+ const freigabe = o.externalVouchers ?? o.voucherSettings?.externalVouchers;
227
+ const nummern = new Set();
169
228
  for (const [i, v] of vouchers.entries()) {
170
229
  if (istGelesen(v))
171
230
  return nein('voucher_invalid', `Gutschein ${i + 1}: Serverfelder an einem Wunsch.`);
172
231
  if (!isNewFormVoucher(v))
173
232
  continue;
233
+ if (isExternalVoucher(v)) {
234
+ const f = pruefeFremd(v, i, freigabe, nummern);
235
+ if (f)
236
+ return f;
237
+ continue;
238
+ }
174
239
  if (istWertVerkauf(v) && v.typeId == null) {
175
240
  // Wie gutschein-beleg.pruefeWuensche: ein Wert-Verkauf ohne Sorte ist voucher_type_required.
176
241
  // Nur eine alte Gutschein-Einstellung MIT Art (Aufrufer bis 1.16) rechnet wie bisher; ein Server ab
@@ -197,7 +262,8 @@ export function planeGutscheine(kunde, vouchers, art, o) {
197
262
  if (wuensche.some((v) => v.action === 'payout') && vouchers.some((v) => !isNewFormVoucher(v) && v.type === 'promo')) {
198
263
  return nein('voucher_invalid', 'Rabatt und Auszahlung gehen nicht am selben Beleg.');
199
264
  }
200
- const codes = wuensche.filter((v) => v.action !== 'sell').map((v) => normalerCode(v.code));
265
+ // Die Nummer eines Fremdgutscheins prueft pruefeFremd (external_voucher_duplicate).
266
+ const codes = wuensche.filter((v) => v.action !== 'sell' && !isExternalVoucher(v)).map((v) => normalerCode(v.code));
201
267
  if (codes.some((c) => c == null))
202
268
  return nein('voucher_invalid', 'Ein Gutscheincode ist ungueltig.');
203
269
  if (new Set(codes).size !== codes.length)
@@ -243,6 +309,55 @@ export function planeGutscheine(kunde, vouchers, art, o) {
243
309
  gutscheine.push(g);
244
310
  continue;
245
311
  }
312
+ if (isExternalVoucher(v)) {
313
+ // gutschein-beleg.plane mit sichtExtern: kein Dokument, kein Saldo, keine Statuspruefung.
314
+ const c = v.amountCents;
315
+ const satz = v.type === 'single_purpose' ? v.vatRateBp : 0;
316
+ if (v.action === 'sell') {
317
+ if (v.type === 'multi_purpose') {
318
+ if (nulltopf) {
319
+ zusatz.push(position(0, c, 'voucher_float'));
320
+ gutscheine.push({ action: 'sell', type: 'value', value: c / 100, imNullTopf: true });
321
+ }
322
+ else {
323
+ gutscheine.push({ action: 'sell', type: 'value', value: c / 100 });
324
+ }
325
+ }
326
+ else {
327
+ // Kleinunternehmer verkauft befreit: Satz 0, egal was gesendet wird.
328
+ zusatz.push(position(ku ? 0 : satz, c, 'voucher'));
329
+ }
330
+ }
331
+ else if (v.action === 'payout') {
332
+ if (v.type === 'multi_purpose') {
333
+ zusatz.push(position(0, -c, 'voucher_float'));
334
+ gutscheine.push({ action: 'payout', type: 'value', value: c / 100, imNullTopf: true });
335
+ }
336
+ else {
337
+ // Ohne Dokument berichtigt ein Kleinunternehmer-Konto im 0-%-Topf (nie USt, die es nie geschuldet hat).
338
+ zusatz.push(position(ku ? 0 : satz, -c, 'voucher'));
339
+ }
340
+ auszahlungCents += c;
341
+ }
342
+ else if (v.type === 'multi_purpose') {
343
+ gutscheine.push({ action: 'redeem', type: 'value', value: c / 100 });
344
+ }
345
+ else if (satz === 0 || ku) {
346
+ // Befreit verkauft (Satz 0) oder Kleinunternehmer-Konto: anteilig auf alle Toepfe des Korbs.
347
+ const teile = kuTeile(kunde, c);
348
+ if (!teile)
349
+ return nein('voucher_rate_mismatch', `Gutschein ${i + 1}: der Korb deckt den Betrag nicht.`);
350
+ for (const t of teile) {
351
+ zusatz.push(position(t.satzBp, -t.cents, 'voucher'));
352
+ minus(t.satzBp, t.cents);
353
+ }
354
+ }
355
+ else {
356
+ zusatz.push(position(satz, -c, 'voucher'));
357
+ minus(satz, c);
358
+ }
359
+ continue;
360
+ }
246
361
  if (istWertVerkauf(v) && v.typeId != null) {
247
362
  // Verkauf ueber eine Sorte (gutschein-beleg.plane): unbekannt, andere Art, falscher Fixbetrag. Eine andere Art
248
363
  // heisst: die Kasse hat eine alte Sicht (Sorte umgestellt) – wie ein anderer Fixbetrag voucher_amount_mismatch,
@@ -1,5 +1,5 @@
1
1
  import { VatRate, VoucherAction, VoucherType } from '../enums/index.js';
2
- import { CANCELLATION_REASONS, isCancellationReason, receiptCompanyTaxInfo, receiptItemTotalCents, isDiscountItem, isTipItem, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, voucherIsValid, } from '../models/index.js';
2
+ import { CANCELLATION_REASONS, isCancellationReason, receiptCompanyTaxInfo, receiptItemTotalCents, isDiscountItem, isTipItem, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, voucherIsValid, isExternalVoucher, } from '../models/index.js';
3
3
  import { parseServerTimeStamp, toViennaWallClock } from '../vienna-time.js';
4
4
  import { KasseneckValidationError } from '../client/errors.js';
5
5
  import { addOnDisplayOrder, istGueltigerZusatz } from '../pos/zusaetze.js';
@@ -571,6 +571,10 @@ function nettoAusBrutto(bruttoCents, rate) {
571
571
  * nennt, allein stehen bleibt.
572
572
  */
573
573
  function gutscheinText(voucher) {
574
+ // Fremdgutschein: die Nummer des fremden Systems voll, ohne Gutscheinart (die steht beim Verkauf in der Position).
575
+ const fremd = fremdZeile(voucher);
576
+ if (fremd != null)
577
+ return fremd;
574
578
  let text = '';
575
579
  if (voucher.type === VoucherType.value) {
576
580
  text += 'Wertgutschein';
@@ -616,6 +620,15 @@ function gutscheinText(voucher) {
616
620
  * Text „ Grund: <Grund>“
617
621
  * Aktion Rabattzeile wie bisher (Aktionsgutschein)
618
622
  *
623
+ * Fremdgutschein wie der eigene, nur mit „Gutschein Nr. <Nummer>“ statt der
624
+ * (`source: 'external'`) Maske: Verkauf „Gutschein Nr. W-77 (Mehrzweckgutschein)“ bzw.
625
+ * „(Einzweckgutschein 20 %)“ (Name der Position vom Server),
626
+ * Einloesung Einzweck 8:4 „Gutschein Nr. FG-1234“ | „-20,00 A“ und
627
+ * Text „ Einzweck, versteuert mit FG-1234-V“ (nur mit
628
+ * `taxedWith`), Mehrzweck nach „Zwischensumme“ „Gutschein Nr.
629
+ * W-77“ | „-3,00 €“, Auszahlung „Auszahlung Gutschein Nr. …“;
630
+ * nie „Rest am Gutschein“ (den Saldo kennt nur das fremde System)
631
+ *
619
632
  * Vermerke sind Textzeilen mit zwei fuehrenden Leerzeichen; das Raster bricht
620
633
  * sie mit demselben Einzug um (grid.ts, haengender Einzug), auf 58 mm etwa
621
634
  * „ Einzweck, versteuert mit“ / „ Beleg K1-ID-4711“.
@@ -658,6 +671,16 @@ function gutscheinEndung(voucher) {
658
671
  return typeof voucher.code === 'string' && voucher.code.length >= 4 && voucher.code !== 'no-code' ? voucher.code.slice(-4) : null;
659
672
  }
660
673
  const MEHRZWECK_UST_TEXT = ' USt bei Einlösung';
674
+ /** Zeile eines Fremdgutscheins `Gutschein Nr. <Nummer>`; null bei einem eigenen Gutschein oder ohne Nummer. */
675
+ function fremdZeile(voucher) {
676
+ return isExternalVoucher(voucher) && typeof voucher.number === 'string' && voucher.number !== '' ? `Gutschein Nr. ${voucher.number}` : null;
677
+ }
678
+ /** Ein gelesener Eintrag mit Wert: beim Fremdgutschein ganze positive Cent, sonst wie [voucherIsValid]. */
679
+ function eintragGueltig(voucher) {
680
+ if (!isExternalVoucher(voucher))
681
+ return voucherIsValid(voucher);
682
+ return Number.isSafeInteger(voucher.valueCents) && voucher.valueCents > 0;
683
+ }
661
684
  /**
662
685
  * Welche Gutscheinposition (`voucher`/`voucher_float`) gehoert zu welchem
663
686
  * Eintrag? Jede Position hoechstens einem Eintrag, Eintraege in ihrer
@@ -686,10 +709,11 @@ function gutscheinPositionen(receipt) {
686
709
  zuordnung.set(i, { voucher, letzte: true });
687
710
  continue;
688
711
  }
712
+ const fremd = fremdZeile(voucher);
689
713
  const endung = gutscheinEndung(voucher);
690
- if (endung == null || (voucher.action !== VoucherAction.redeem && voucher.action !== VoucherAction.payout))
714
+ if ((fremd == null && endung == null) || (voucher.action !== VoucherAction.redeem && voucher.action !== VoucherAction.payout))
691
715
  continue;
692
- const name = `${voucher.action === VoucherAction.payout ? 'Auszahlung ' : ''}Gutschein ····-${endung}`;
716
+ const name = `${voucher.action === VoucherAction.payout ? 'Auszahlung ' : ''}${fremd ?? `Gutschein ····-${endung}`}`;
693
717
  const ziel = Number.isInteger(voucher.amountCents) ? Math.abs(voucher.amountCents) : Math.abs(voucher.valueCents ?? 0);
694
718
  const genommen = [];
695
719
  let summe = 0;
@@ -735,6 +759,12 @@ function gutscheinPositionsZeilen(item, satz, zu) {
735
759
  return zeilen;
736
760
  }
737
761
  const art = v.type === VoucherType.service ? 'Leistung' : 'Einzweck';
762
+ if (isExternalVoucher(v)) {
763
+ // Fremdgutschein: Vermerk nur mit `taxedWith` (Beleg im fremden System, wie gesendet), kein Rest.
764
+ if (typeof v.taxedWith === 'string' && v.taxedWith !== '')
765
+ zeilen.push(textZeile(` ${art}, versteuert mit ${v.taxedWith}`));
766
+ return zeilen;
767
+ }
738
768
  if (typeof v.taxedWith === 'string' && v.taxedWith !== '') {
739
769
  zeilen.push(textZeile(` ${art}, versteuert mit Beleg ${v.taxedWith}`));
740
770
  }
@@ -1213,17 +1243,18 @@ export function buildReceiptLayout(receipt, company, options = {}) {
1213
1243
  continue;
1214
1244
  const wert = voucher.valueCents ?? 0;
1215
1245
  const vz = voucher.type === VoucherType.value ? wgVz : 1;
1216
- if (voucherIsValid(voucher) && voucher.action === VoucherAction.sell) {
1246
+ if (eintragGueltig(voucher) && voucher.action === VoucherAction.sell) {
1217
1247
  gruppeVon(steuersatz(VatRate.vat0)).bruttoCents += vz * wert;
1218
1248
  }
1219
1249
  if (voucher.action === VoucherAction.sell && voucher.type === VoucherType.value) {
1220
1250
  // Mehrzweck mit Code (vor dem Stichtag nur als Eintrag): wie die Position im 0-%-Topf.
1221
1251
  const mehrzweck = istMehrzweckMitCode(voucher);
1222
1252
  const code = gutscheinCodeZusatz(voucher);
1253
+ const fremd = fremdZeile(voucher);
1223
1254
  lines.push({
1224
1255
  kind: 'columns',
1225
1256
  columns: [
1226
- { text: `1 x ${mehrzweck ? `Mehrzweckgutschein${code}` : gutscheinText(voucher)}`, width: 7, align: 'left' },
1257
+ { text: `1 x ${fremd != null ? `${fremd} (Mehrzweckgutschein)` : mehrzweck ? `Mehrzweckgutschein${code}` : gutscheinText(voucher)}`, width: 7, align: 'left' },
1227
1258
  { text: `${formatCents(vz * wert)} ${VatRate.vat0.category}`, width: 5, align: 'right' },
1228
1259
  ],
1229
1260
  });
@@ -1303,8 +1334,10 @@ export function buildReceiptLayout(receipt, company, options = {}) {
1303
1334
  // (Zahlungszeile laut Spec); eine Auszahlung ohne `zeroRateBucket`
1304
1335
  // (schreibt der Server nicht) zaehlt wie in receiptSumCents.
1305
1336
  const wert = voucher.valueCents ?? 0;
1306
- const endung = istMehrzweckMitCode(voucher) ? gutscheinEndung(voucher) : null;
1307
- const text = endung != null ? `Gutschein ····-${endung}` : gutscheinText(voucher);
1337
+ // Fremdgutschein: „Gutschein Nr. <Nummer>“, nie ein Rest (den Saldo kennt nur das fremde System).
1338
+ const fremd = fremdZeile(voucher);
1339
+ const endung = fremd == null && istMehrzweckMitCode(voucher) ? gutscheinEndung(voucher) : null;
1340
+ const text = fremd ?? (endung != null ? `Gutschein ····-${endung}` : gutscheinText(voucher));
1308
1341
  lines.push(paarZeile(voucher.action === VoucherAction.payout ? `Auszahlung ${text}` : text, wgVz === 1 ? `-${formatCents(wert)} €` : `${formatCents(wert)} €`, 8, 4));
1309
1342
  if (endung != null && wgVz === 1 && Number.isInteger(voucher.balanceAfterCents)) {
1310
1343
  lines.push(paarZeile(' Rest am Gutschein', `${formatCents(voucher.balanceAfterCents)} €`, 8, 4));
@@ -2,6 +2,7 @@ import { KasseneckValidationError } from '../client/errors.js';
2
2
  import { labelText, LABELS } from '../pos/texte.js';
3
3
  import { bewegungsBon, schichtBon } from '../pos/schicht-lesen.js';
4
4
  import { shiftTipLines } from '../pos/schicht.js';
5
+ import { discountBlockLines } from '../pos/rabatt-vorlagen.js';
5
6
  import { parseServerTimeStamp, toViennaWallClock } from '../vienna-time.js';
6
7
  import { CURRENT_LAYOUT_RULESET, formatCents } from './layout.js';
7
8
  const PAPIER = ['mm58', 'mm80'];
@@ -187,6 +188,13 @@ export function shiftReceiptLayout(receipt, options = {}) {
187
188
  for (const u of bon.nonCashByMethod)
188
189
  zeilen.push(betrag(zahlartText(u.method), u.cents));
189
190
  }
191
+ // Gewaehrte Rabatte je Name: nur wenn es welche gab, sonst bleibt der Bon wie bisher.
192
+ const rabatte = discountBlockLines(bon.discounts);
193
+ if (rabatte.length > 0) {
194
+ zeilen.push(text(labelText('shift_receipt.discounts'), 'left', true));
195
+ for (const r of rabatte)
196
+ zeilen.push(betrag(r.label, r.cents));
197
+ }
190
198
  zeilen.push(anzahl(labelText('shift_receipt.receipts'), bon.receiptCount));
191
199
  zeilen.push(anzahl(labelText('shift_receipt.cancellations'), bon.cancellationCount));
192
200
  zeilen.push(anzahl(labelText('shift_receipt.openings_without_sale'), bon.openingsWithoutSale));
@@ -1,5 +1,5 @@
1
1
  import { KasseneckValidationError } from '../client/errors.js';
2
- import { ARTIKEL_FELDER, KATALOGE, SCHEMAS } from './vokabular.js';
2
+ import { ARTIKEL_FELDER, KATALOGE, SCHEMAS, ZUSATZ_KATALOGE } from './vokabular.js';
3
3
  export const hat = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
4
4
  export const istObjekt = (w) => w !== null && typeof w === 'object' && !Array.isArray(w);
5
5
  /** Schema-Eintrag zerlegt: innerer Name, Unterschema (ohne `__`) und ob es eine Liste ist. */
@@ -148,6 +148,8 @@ const BELEG_GUTSCHEIN = {
148
148
  article: 'artikel', articleId: 'artikelId', quantity: 'stueck', positions: 'positionen',
149
149
  balanceAfterCents: 'saldoNachCents', remainingQuantityAfter: 'stueckOffenNach', taxedWith: 'versteuertMit', exempt: 'befreit',
150
150
  reason: 'grund', zeroRateBucket: 'imNullTopf', typeId: 'sorteId', typeName: 'sorteName', payout: 'auszahlung',
151
+ // Fremdgutschein: source external (GUTSCHEIN_QUELLE) und die Nummer des fremden Systems.
152
+ source: 'quelle', number: 'nummer',
151
153
  };
152
154
  const BELEG_GUTSCHEIN_AUSSEN = Object.fromEntries(Object.entries(BELEG_GUTSCHEIN).map(([aussen, innen]) => [innen, aussen]));
153
155
  const GUTSCHEIN_ARTIKEL_AUSSEN = { satzBp: 'vatRateBp', preisCents: 'priceCents' };
@@ -160,6 +162,7 @@ function gutscheinEintragNachAussen(v) {
160
162
  return v;
161
163
  const art = KATALOGE.GUTSCHEIN_ART ?? {};
162
164
  const auszahlung = KATALOGE.GUTSCHEIN_AUSZAHLUNG ?? {};
165
+ const quelle = ZUSATZ_KATALOGE.GUTSCHEIN_QUELLE ?? {};
163
166
  const typNeu = typeof v.type === 'string' && hat(art, v.type);
164
167
  if (!typNeu && !Object.keys(v).some((k) => hat(BELEG_GUTSCHEIN_AUSSEN, k)))
165
168
  return v;
@@ -171,6 +174,8 @@ function gutscheinEintragNachAussen(v) {
171
174
  raus.voucherType = typeof w === 'string' && hat(art, w) ? art[w] : w;
172
175
  else if (k === 'artikel')
173
176
  raus.article = istObjekt(w) ? umbenannt(w, GUTSCHEIN_ARTIKEL_AUSSEN) : w;
177
+ else if (k === 'quelle')
178
+ raus.source = typeof w === 'string' && hat(quelle, w) ? quelle[w] : w;
174
179
  else if (k === 'auszahlung')
175
180
  raus.payout = typeof w === 'string' && hat(auszahlung, w) ? auszahlung[w] : w;
176
181
  else
@@ -295,6 +300,7 @@ export function _storedArticleToWire(id, doc, functionName = 'fromStoredArticle'
295
300
  const katalog = (pfad) => aeussereWerte(schema.werte[pfad]);
296
301
  const raus = nurBekannte(artikel, new Set(ARTIKEL_FELDER), {
297
302
  quantityRule: katalog('articles[].quantityRule'), e1aGroup: katalog('articles[].e1aGroup'),
303
+ externalVoucher: katalog('articles[].externalVoucher'),
298
304
  });
299
305
  if (istObjekt(raus.tile)) {
300
306
  const kachel = regel(regel(schema.data.articles).unter.tile).unter;
@@ -1,7 +1,8 @@
1
- import { POS_BUSINESS_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_VALUES, POS_SHORTCUT_DEFAULTS, POS_SHORTCUT_SHARED_PAIRS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, _optionalerWert, } from '../pos/settings.js';
1
+ import { POS_BUSINESS_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_VALUES, POS_SHORTCUT_DEFAULTS, POS_SHORTCUT_SHARED_PAIRS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_BUSINESS_OPTIONAL_LISTS, POS_DEVICE_OPTIONAL_CHOICES, _optionalerWert, } from '../pos/settings.js';
2
2
  import { hat, innereNamen, istObjekt, regel } from './draht.js';
3
3
  import { katalogVon } from './draht.js';
4
- import { SCHEMAS } from './vokabular.js';
4
+ import { checkDiscountPresets, discountChipsFromPresets } from '../pos/rabatt-vorlagen.js';
5
+ import { KATALOGE, SCHEMAS } from './vokabular.js';
5
6
  const bool = (v) => typeof v === 'boolean';
6
7
  const hex = (v) => typeof v === 'string' && /^#[0-9a-fA-F]{6}$/.test(v);
7
8
  const kuerzel = (v) => typeof v === 'string' && /^[A-Za-z0-9]{1,3}$/.test(v);
@@ -134,6 +135,38 @@ function aufzaehlung(liste, katalog, w) {
134
135
  return 'ungueltig';
135
136
  return 'unbekannt';
136
137
  }
138
+ /**
139
+ * Rabatt-Vorlagen (Zwilling von `rabatt-vorlagen-core.liste` und dem Schema `discountPresets`): die gespeicherte Liste
140
+ * `[{ name, art, prozentBp | betragCents }]` geht nur hinaus, wenn die Pruefung sie annimmt (sonst faellt sie ganz);
141
+ * ausgegeben wird sie wie gespeichert (nicht getrimmt), eine ungueltige fehlt still, uebersetzt in `kind`/`percentBp`/`amountCents`. Ein englischer
142
+ * Wert in `art` oder ein englischer Feldname ist innen unbekannt und macht die Liste ungueltig.
143
+ */
144
+ function vorlagenNachAussen(w) {
145
+ const schema = teilSchema('business').discountPresets;
146
+ const aussenName = innereNamen(regel(schema).unter); // innen -> aussen
147
+ const art = KATALOGE['KASSE_BETRIEB_WERTE.discountPresets[].kind'] ?? {};
148
+ if (!Array.isArray(w))
149
+ return undefined;
150
+ const draht = w.map((e) => {
151
+ if (!istObjekt(e))
152
+ return e;
153
+ const raus = {};
154
+ for (const [k, v] of Object.entries(e)) {
155
+ if (k === 'art')
156
+ raus[aussenName.get('art') ?? 'kind'] = typeof v === 'string' && hat(art, v) ? art[v] : undefined;
157
+ else if (k === 'name')
158
+ raus[k] = v;
159
+ else if (k === 'prozentBp' || k === 'betragCents')
160
+ raus[aussenName.get(k) ?? k] = v;
161
+ // Jeder andere Schluessel (auch ein englischer wie `percentBp`) ist innen unbekannt.
162
+ else
163
+ raus[`innen_${k}`] = v;
164
+ }
165
+ return raus;
166
+ });
167
+ const geprueft = checkDiscountPresets(draht);
168
+ return geprueft.ok ? draht : undefined;
169
+ }
137
170
  function teilNachAussen(teil, gespeichert, weg) {
138
171
  if (!istObjekt(gespeichert))
139
172
  return {};
@@ -146,6 +179,13 @@ function teilNachAussen(teil, gespeichert, weg) {
146
179
  if (aussen === undefined || w === undefined)
147
180
  continue;
148
181
  const pfad = `${teil}.${aussen}`;
182
+ if (teil === 'business' && aussen === 'discountPresets') {
183
+ const liste = vorlagenNachAussen(w);
184
+ // Wie jede optionale Einstellung: ungueltig fehlt still (mischeBetrieb nimmt sie gar nicht erst), ohne Eintrag in `weg`.
185
+ if (liste !== undefined)
186
+ raus[aussen] = liste;
187
+ continue;
188
+ }
149
189
  if (hat(WAHLFELDER, teil) && WAHLFELDER[teil].includes(aussen)) {
150
190
  const katalog = katalogFuer(teil, aussen);
151
191
  const einzeln = (e) => (typeof e === 'string' && katalog !== null && hat(katalog, e) ? katalog[e] : undefined);
@@ -222,6 +262,14 @@ function teilNachAussen(teil, gespeichert, weg) {
222
262
  else
223
263
  weg.push(pfad);
224
264
  }
265
+ // Mit gueltigen Vorlagen folgen die Chips immer den Vorlagen (mischeBetrieb), auch ein ungueltiges gespeichertes
266
+ // `rabattChips` faellt dann nicht erst am Validator.
267
+ if (teil === 'business' && hat(raus, 'discountPresets')) {
268
+ raus.discountChips = discountChipsFromPresets(raus.discountPresets);
269
+ const i = weg.indexOf('business.discountChips');
270
+ if (i >= 0)
271
+ weg.splice(i, 1);
272
+ }
225
273
  return raus;
226
274
  }
227
275
  /**
@@ -238,10 +286,10 @@ export function _storedPosSettingsToWire(stored) {
238
286
  }
239
287
  /** Nur fuer den Test: die Feldliste der Pruefer (muss mit der Vorgabe deckungsgleich sein). */
240
288
  export const _PRUEFER_FELDER = Object.freeze({
241
- business: [...new Set([...Object.keys(PRUEFER.business), ...Object.keys(POS_BUSINESS_VALUES), ...Object.keys(BETRIEB_OPTIONAL), ...Object.keys(KARTEN)])],
289
+ business: [...new Set([...Object.keys(PRUEFER.business), ...Object.keys(POS_BUSINESS_VALUES), ...Object.keys(BETRIEB_OPTIONAL), ...Object.keys(KARTEN), ...POS_BUSINESS_OPTIONAL_LISTS])],
242
290
  device: [...new Set([...Object.keys(PRUEFER.device), ...Object.keys(POS_DEVICE_VALUES), ...Object.keys(GERAET_OPTIONAL), 'shortcuts'])],
243
291
  standard: {
244
- business: [...Object.keys(POS_BUSINESS_DEFAULTS), ...POS_BUSINESS_OPTIONAL_FIELDS, ...POS_BUSINESS_OPTIONAL_CHOICES],
292
+ business: [...Object.keys(POS_BUSINESS_DEFAULTS), ...POS_BUSINESS_OPTIONAL_FIELDS, ...POS_BUSINESS_OPTIONAL_CHOICES, ...POS_BUSINESS_OPTIONAL_LISTS],
245
293
  device: [...Object.keys(POS_DEVICE_DEFAULTS), ...POS_DEVICE_OPTIONAL_FIELDS, ...POS_DEVICE_OPTIONAL_CHOICES],
246
294
  },
247
295
  });
@@ -1,5 +1,5 @@
1
1
  /** Fingerabdruck des Vertrags-Exports, aus dem diese Datei stammt (`_quelle.sha256`). */
2
- export declare const VOKABULAR_QUELLE = "c137b0f64dd1a06c8cddd9d9164bd2360ecbc3133cc04ca2b82d0e37f9d4fe5d";
2
+ export declare const VOKABULAR_QUELLE = "04ab5e1d031979a4f0aa31ea000f4cbe1d6e557e2411e439899ac19a1bba0325";
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 {
@@ -18,3 +18,5 @@ export declare const SCHEMAS: Readonly<Record<'getReceipt' | 'getKasseSettings'
18
18
  export declare const ARTIKEL_FELDER: readonly string[];
19
19
  /** Wertkataloge innen (deutsch) -> aussen (englisch). */
20
20
  export declare const KATALOGE: Readonly<Record<string, Readonly<Record<string, string>>>>;
21
+ /** Kataloge der Gutschein-Eintraege am Beleg ohne Schemaverweis (`quelle` eines Fremdgutscheins), innen -> aussen. */
22
+ export declare const ZUSATZ_KATALOGE: Readonly<Record<string, Readonly<Record<string, string>>>>;
@@ -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 = "c137b0f64dd1a06c8cddd9d9164bd2360ecbc3133cc04ca2b82d0e37f9d4fe5d";
4
+ export const VOKABULAR_QUELLE = "04ab5e1d031979a4f0aa31ea000f4cbe1d6e557e2411e439899ac19a1bba0325";
5
5
  /** Schema je Endpunkt (aussen -> innen) und Wertverweise auf die Kataloge. */
6
6
  export const SCHEMAS = {
7
7
  "getReceipt": {
@@ -44,6 +44,7 @@ export const SCHEMAS = {
44
44
  },
45
45
  "testCashregister": "testKasse",
46
46
  "testSignature": "testSignatur",
47
+ "deprecation": "deprecation",
47
48
  "logo_scale": "logo_skala",
48
49
  "layout": {
49
50
  "__": "layout",
@@ -150,6 +151,7 @@ export const SCHEMAS = {
150
151
  "tipChips": "tgChips",
151
152
  "exactCash": "schnellbar",
152
153
  "tipKeptByDefault": "tgDirekt",
154
+ "tipKeptMode": "tgDirektModus",
153
155
  "tipKinds": "tgArten",
154
156
  "tipStart": "tgStart",
155
157
  "checkoutMode": "kassierenModus",
@@ -164,7 +166,16 @@ export const SCHEMAS = {
164
166
  "watermarkScale": "wzSkala",
165
167
  "glass": "glas",
166
168
  "hints": "hinweise",
167
- "discountChips": "rabattChips"
169
+ "discountChips": "rabattChips",
170
+ "discountPresets": [
171
+ {
172
+ "__": "rabattVorlagen",
173
+ "kind": "art",
174
+ "percentBp": "prozentBp",
175
+ "amountCents": "betragCents"
176
+ }
177
+ ],
178
+ "customDiscountAllowed": "rabattFrei"
168
179
  },
169
180
  "device": {
170
181
  "__": "geraet",
@@ -288,6 +299,7 @@ export const SCHEMAS = {
288
299
  }
289
300
  ],
290
301
  "serviceArticles": "leistungsArtikel",
302
+ "externalVouchers": "fremd",
291
303
  "returnType": {
292
304
  "__": "rueckgabe",
293
305
  "typeId": "sorteId",
@@ -328,6 +340,12 @@ export const SCHEMAS = {
328
340
  "business.tipStart": {
329
341
  "$catalog": "KASSE_BETRIEB_WERTE.tipStart"
330
342
  },
343
+ "business.tipKeptMode": {
344
+ "$catalog": "KASSE_BETRIEB_WERTE.tipKeptMode"
345
+ },
346
+ "business.discountPresets[].kind": {
347
+ "$catalog": "KASSE_BETRIEB_WERTE.discountPresets[].kind"
348
+ },
331
349
  "business.checkoutMode": {
332
350
  "$catalog": "KASSE_BETRIEB_WERTE.checkoutMode"
333
351
  },
@@ -373,6 +391,11 @@ export const SCHEMAS = {
373
391
  },
374
392
  "vouchers.types[].payout": {
375
393
  "$catalog": "GUTSCHEIN_AUSZAHLUNG"
394
+ },
395
+ "vouchers.externalVouchers": {
396
+ "aus": "off",
397
+ "wert": "multi_purpose",
398
+ "beide": "all"
376
399
  }
377
400
  }
378
401
  },
@@ -401,7 +424,8 @@ export const SCHEMAS = {
401
424
  "pattern": "muster",
402
425
  "patternStrict": "musterStreng"
403
426
  },
404
- "addOns": "zusaetze"
427
+ "addOns": "zusaetze",
428
+ "externalVoucher": "fremdgutschein"
405
429
  }
406
430
  ]
407
431
  },
@@ -414,6 +438,9 @@ export const SCHEMAS = {
414
438
  },
415
439
  "articles[].reference.mode": {
416
440
  "$catalog": "REFERENZ_STUFE"
441
+ },
442
+ "articles[].externalVoucher": {
443
+ "$catalog": "ARTIKEL_FREMDGUTSCHEIN"
417
444
  }
418
445
  }
419
446
  }
@@ -447,10 +474,15 @@ export const ARTIKEL_FELDER = [
447
474
  "minStockByLocation",
448
475
  "askPrice",
449
476
  "reference",
450
- "addOns"
477
+ "addOns",
478
+ "externalVoucher"
451
479
  ];
452
480
  /** Wertkataloge innen (deutsch) -> aussen (englisch). */
453
481
  export const KATALOGE = {
482
+ "ARTIKEL_FREMDGUTSCHEIN": {
483
+ "mehrzweck": "multi_purpose",
484
+ "einzweck": "single_purpose"
485
+ },
454
486
  "AUSGABE_ART": {
455
487
  "erstdruck": "print",
456
488
  "duplikat": "reprint",
@@ -644,6 +676,10 @@ export const KATALOGE = {
644
676
  "aus": "off",
645
677
  "an": "on"
646
678
  },
679
+ "KASSE_BETRIEB_WERTE.discountPresets[].kind": {
680
+ "prozent": "percent",
681
+ "betrag": "amount"
682
+ },
647
683
  "KASSE_BETRIEB_WERTE.quantity": {
648
684
  "aus": "off",
649
685
  "x": "x",
@@ -666,6 +702,11 @@ export const KATALOGE = {
666
702
  "streifen": "stripe",
667
703
  "voll": "full"
668
704
  },
705
+ "KASSE_BETRIEB_WERTE.tipKeptMode": {
706
+ "fragen": "ask",
707
+ "immer": "always",
708
+ "nie": "never"
709
+ },
669
710
  "KASSE_BETRIEB_WERTE.tipKinds[]": {
670
711
  "prozent": "percent",
671
712
  "aufrunden": "round_up",
@@ -745,3 +786,9 @@ export const KATALOGE = {
745
786
  "sonstiges": "other"
746
787
  }
747
788
  };
789
+ /** Kataloge der Gutschein-Eintraege am Beleg ohne Schemaverweis (`quelle` eines Fremdgutscheins), innen -> aussen. */
790
+ export const ZUSATZ_KATALOGE = {
791
+ "GUTSCHEIN_QUELLE": {
792
+ "extern": "external"
793
+ }
794
+ };
@@ -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.29.0";
7
+ export declare const PACKAGE_VERSION = "1.31.0";