@kreiseck/kasseneck-api 1.38.0 → 1.40.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 (87) hide show
  1. package/CHANGELOG.md +29 -2
  2. package/README.md +3 -1
  3. package/dist/cjs/client/aufrufe.d.ts +2 -2
  4. package/dist/cjs/client/aufrufe.js +12 -0
  5. package/dist/cjs/payments/hobex-hps/connect-client.d.ts +17 -0
  6. package/dist/cjs/payments/hobex-hps/connect-client.js +17 -0
  7. package/dist/cjs/payments/hobex-hps/index.d.ts +1 -1
  8. package/dist/cjs/payments/index.d.ts +1 -1
  9. package/dist/cjs/pos/client.d.ts +1 -0
  10. package/dist/cjs/pos/client.js +9 -1
  11. package/dist/cjs/pos/errors.d.ts +1 -1
  12. package/dist/cjs/pos/errors.js +1 -0
  13. package/dist/cjs/pos/index.d.ts +1 -1
  14. package/dist/cjs/pos/index.js +9 -5
  15. package/dist/cjs/pos/settings.d.ts +46 -3
  16. package/dist/cjs/pos/settings.js +51 -4
  17. package/dist/cjs/pos/texte.d.ts +534 -0
  18. package/dist/cjs/pos/texte.js +178 -0
  19. package/dist/cjs/receipt/layout.js +11 -3
  20. package/dist/cjs/register/errors.d.ts +1 -1
  21. package/dist/cjs/register/errors.js +4 -0
  22. package/dist/cjs/register/index.d.ts +1 -1
  23. package/dist/cjs/register/index.js +3 -1
  24. package/dist/cjs/register/pairing.d.ts +51 -0
  25. package/dist/cjs/register/pairing.js +59 -0
  26. package/dist/cjs/stored/einstellungen.js +5 -2
  27. package/dist/cjs/stored/vokabular.d.ts +1 -1
  28. package/dist/cjs/stored/vokabular.js +12 -2
  29. package/dist/cjs/version.d.ts +1 -1
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/esm/client/aufrufe.d.ts +2 -2
  32. package/dist/esm/client/aufrufe.js +12 -0
  33. package/dist/esm/payments/hobex-hps/connect-client.d.ts +17 -0
  34. package/dist/esm/payments/hobex-hps/connect-client.js +17 -0
  35. package/dist/esm/payments/hobex-hps/index.d.ts +1 -1
  36. package/dist/esm/payments/index.d.ts +1 -1
  37. package/dist/esm/pos/client.d.ts +1 -0
  38. package/dist/esm/pos/client.js +10 -2
  39. package/dist/esm/pos/errors.d.ts +1 -1
  40. package/dist/esm/pos/errors.js +1 -0
  41. package/dist/esm/pos/index.d.ts +1 -1
  42. package/dist/esm/pos/index.js +1 -1
  43. package/dist/esm/pos/settings.d.ts +46 -3
  44. package/dist/esm/pos/settings.js +47 -3
  45. package/dist/esm/pos/texte.d.ts +534 -0
  46. package/dist/esm/pos/texte.js +178 -0
  47. package/dist/esm/receipt/layout.js +11 -3
  48. package/dist/esm/register/errors.d.ts +1 -1
  49. package/dist/esm/register/errors.js +4 -0
  50. package/dist/esm/register/index.d.ts +1 -1
  51. package/dist/esm/register/index.js +1 -1
  52. package/dist/esm/register/pairing.d.ts +51 -0
  53. package/dist/esm/register/pairing.js +57 -0
  54. package/dist/esm/stored/einstellungen.js +6 -3
  55. package/dist/esm/stored/vokabular.d.ts +1 -1
  56. package/dist/esm/stored/vokabular.js +12 -2
  57. package/dist/esm/version.d.ts +1 -1
  58. package/dist/esm/version.js +1 -1
  59. package/fixtures/hobex-hps-codes.json +1 -1
  60. package/fixtures/invoice-api.schema.json +1 -1
  61. package/fixtures/invoice-texts.json +1 -1
  62. package/fixtures/manifest.json +6 -6
  63. package/fixtures/pos-texts.json +679 -1
  64. package/fixtures/receipt-due-generated.json +1 -1
  65. package/fixtures/receipt-due-voucher-generated.json +1 -1
  66. package/fixtures/receipts/card-sumup.json +1 -1
  67. package/fixtures/receipts/split-card-card-cash.json +1 -1
  68. package/fixtures/receipts/split-one-card-tip.json +1 -1
  69. package/fixtures/receipts/split-table-round-tip.json +2 -2
  70. package/fixtures/receipts/split-tip-card.json +1 -1
  71. package/fixtures/receipts/split-two-cards-same-provider.json +2 -2
  72. package/fixtures/renames-1.0.json +4 -2
  73. package/fixtures/surface.json +20 -4
  74. package/fixtures/v3/antworten/belege.json +2 -2
  75. package/fixtures/v3/antworten/belegmail.json +2 -2
  76. package/fixtures/v3/antworten/berichte.json +2 -2
  77. package/fixtures/v3/antworten/kasse-belege.json +2 -2
  78. package/fixtures/v3/antworten/kasse.json +696 -4
  79. package/fixtures/v3/antworten/lager.json +1 -1
  80. package/fixtures/v3/antworten/rechnungen.json +2 -2
  81. package/fixtures/v3/antworten/storno.json +2 -2
  82. package/fixtures/v3/stored/belege.json +2 -2
  83. package/fixtures/v3/stored/kasse.json +210 -4
  84. package/fixtures/v3/stored/rechnungen.json +2 -2
  85. package/fixtures/v3/v3-vokabular.json +107 -6
  86. package/fixtures/v3/zahlbetrag-faelle.json +2 -2
  87. package/package.json +1 -1
@@ -105,6 +105,16 @@ export type HpsConnectFetch = (url: string, init: {
105
105
  body: string;
106
106
  signal: AbortSignal;
107
107
  }) => Promise<HpsConnectFetchResponse>;
108
+ /**
109
+ * Die Adresse, unter der Connect das Terminal tatsaechlich erreicht hat
110
+ * (Feld `endpoint` der Antwort ab Connect 1.5.0). `relocated: true` heisst:
111
+ * nicht die mitgegebene, sondern eine wiedergefundene Adresse.
112
+ */
113
+ export interface HpsConnectEndpoint {
114
+ host: string;
115
+ port: number;
116
+ relocated: boolean;
117
+ }
108
118
  export interface HpsConnectClientOptions {
109
119
  /** Basisadresse des Agenten. Vorgabe `http://127.0.0.1:27182` (README `kasseneck-connect`). */
110
120
  baseUrl?: string;
@@ -124,6 +134,13 @@ export interface HpsConnectClientOptions {
124
134
  paymentTimeoutMs?: number;
125
135
  /** Eigene `fetch`-Umsetzung (Tests). Vorgabe: globales `fetch`. */
126
136
  fetch?: HpsConnectFetch;
137
+ /**
138
+ * Wird mit der benutzten Adresse des Terminals aufgerufen, wenn Connect sie
139
+ * in einer ERFOLGREICHEN Antwort (`ok: true`) mitschickt (ab Connect 1.5.0).
140
+ * Bei einer Fehlerhuelle und bei Antworten ohne `endpoint` (Connect 1.4.2)
141
+ * nie. Ein Wurf des Aufrufers bleibt ohne Wirkung auf die Zahlung.
142
+ */
143
+ onEndpoint?: (endpoint: HpsConnectEndpoint) => void;
127
144
  }
128
145
  export interface HpsConnectClient {
129
146
  payment(options: HpsConnectPaymentOptions): Promise<HpsTransactionResponse>;
@@ -59,6 +59,22 @@ export function createHpsConnectClient(options) {
59
59
  const shortTimeoutMs = options.shortTimeoutMs ?? DEFAULT_SHORT_TIMEOUT_MS;
60
60
  const paymentTimeoutMs = options.paymentTimeoutMs ?? DEFAULT_PAYMENT_TIMEOUT_MS;
61
61
  const holen = options.fetch ?? globalHpsConnectFetch();
62
+ // Nur aus einer Antwort mit `ok: true` und einer vollstaendigen Adresse;
63
+ // alles andere bleibt unbeachtet. Die Zahlung haengt nie am Aufrufer.
64
+ function meldeAdresse(huelle) {
65
+ const e = huelle['endpoint'];
66
+ if (options.onEndpoint === undefined || e === null || typeof e !== 'object')
67
+ return;
68
+ const { host, port, relocated } = e;
69
+ if (typeof host !== 'string' || host === '' || typeof port !== 'number' || !Number.isInteger(port))
70
+ return;
71
+ try {
72
+ options.onEndpoint({ host, port, relocated: relocated === true });
73
+ }
74
+ catch {
75
+ // Der Aufrufer darf die Antwort nicht kippen.
76
+ }
77
+ }
62
78
  async function rufen(path, body, timeoutMs) {
63
79
  const abbruch = new AbortController();
64
80
  const wecker = setTimeout(() => abbruch.abort(), timeoutMs);
@@ -99,6 +115,7 @@ export function createHpsConnectClient(options) {
99
115
  }
100
116
  const h = huelle;
101
117
  if (h.ok === true) {
118
+ meldeAdresse(h);
102
119
  return h;
103
120
  }
104
121
  const code = typeof h.error?.code === 'string' ? h.error.code : undefined;
@@ -17,7 +17,7 @@
17
17
  * tatsaechlichen Adresse (z. B. ueber `GET /v1/status` je Port) bleibt Sache
18
18
  * des Aufrufers.
19
19
  */
20
- export { type HpsConnectCancelOptions, type HpsConnectClient, type HpsConnectClientOptions, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, createHpsConnectClient, } from './connect-client.js';
20
+ export { type HpsConnectCancelOptions, type HpsConnectClient, type HpsConnectClientOptions, type HpsConnectEndpoint, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, createHpsConnectClient, } from './connect-client.js';
21
21
  export { HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, } from './errors.js';
22
22
  export { type HpsPaymentEvent, type HpsPaymentEventKind, type HpsPaymentObserver, } from './events.js';
23
23
  export { type CardPaymentOutcome, type HpsPaymentResult, isHostUncertainResult, mayRetrySafely, } from './outcome.js';
@@ -43,4 +43,4 @@
43
43
  export { StripeLinkMode, type StripeLinkModeKey } from '../enums/index.js';
44
44
  export { type CreateStripeLinkOptions, type StripeCaptureResult, createStripeLink, stripeCaptureIntent, } from './stripe.js';
45
45
  export { type HobexPayOptions, type HobexRefundOptions, type HobexTransactionIdOptions, hobexPay, hobexRefund, newHobexTransactionId, } from './hobex.js';
46
- export { type CardPaymentOutcome, type HpsConnectClient, type HpsConnectCancelOptions, type HpsConnectClientOptions, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, type HpsCancelOptions, type HpsClarifyOptions, type HpsCode, type HpsCodeEffect, type HpsCodeReason, type HpsCodeSource, type HpsMeasuredCode, type HpsPaymentEvent, type HpsPaymentEventKind, type HpsPaymentObserver, type HpsPaymentOptions, type HpsPayments, type HpsPaymentResult, type HpsPaymentsOptions, type HpsRefundOptions, type HpsTransactionIdGeneratorOptions, type HpsTransactionResponse, ABORTED_CODE, APPROVED_CODE, CARD_NOT_PRESENT_CODE, createHpsConnectClient, createHpsPayments, createHpsTransactionIdGenerator, HOBEX_SUPPORT, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, hobexReceiptFromHps, HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, INVALID_TRANSACTION_CODE, isApproved, isConclusive, isConclusiveAsStatus, isHostUncertain, isHostUncertainResult, isInProgress, isNoStatement, isNotAbortable, isTechnicalError, isUnknownCode, isValidHpsTransactionId, mayRetrySafely, MAX_TRANSACTION_ID_LENGTH, newHpsTransactionId, NOT_ABORTABLE_CODE, NO_STATEMENT_CODE, parseHpsTransactionResponse, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, TECHNICAL_ERROR_CODE, NOT_FOUND_HTTP_STATUS, TERMINAL_BUSY_HTTP_STATUS, TRANSACTION_CANCELED_CODE, } from './hobex-hps/index.js';
46
+ export { type CardPaymentOutcome, type HpsConnectClient, type HpsConnectCancelOptions, type HpsConnectClientOptions, type HpsConnectEndpoint, type HpsConnectFetch, type HpsConnectFetchResponse, type HpsConnectPaymentOptions, type HpsConnectRefundOptions, type HpsConnectTarget, type HpsConnectTransactionOptions, type HpsCancelOptions, type HpsClarifyOptions, type HpsCode, type HpsCodeEffect, type HpsCodeReason, type HpsCodeSource, type HpsMeasuredCode, type HpsPaymentEvent, type HpsPaymentEventKind, type HpsPaymentObserver, type HpsPaymentOptions, type HpsPayments, type HpsPaymentResult, type HpsPaymentsOptions, type HpsRefundOptions, type HpsTransactionIdGeneratorOptions, type HpsTransactionResponse, ABORTED_CODE, APPROVED_CODE, CARD_NOT_PRESENT_CODE, createHpsConnectClient, createHpsPayments, createHpsTransactionIdGenerator, HOBEX_SUPPORT, HPS_CODES, HPS_MEASURED_CODES, HPS_REASON_HINTS, hpsCodeInfo, hpsCodeReason, hobexReceiptFromHps, HpsClarifyTimeoutError, HpsConnectException, HpsConnectTerminalError, HpsConnectTransportError, HpsPreflightError, HpsTransactionIdError, INVALID_TRANSACTION_CODE, isApproved, isConclusive, isConclusiveAsStatus, isHostUncertain, isHostUncertainResult, isInProgress, isNoStatement, isNotAbortable, isTechnicalError, isUnknownCode, isValidHpsTransactionId, mayRetrySafely, MAX_TRANSACTION_ID_LENGTH, newHpsTransactionId, NOT_ABORTABLE_CODE, NO_STATEMENT_CODE, parseHpsTransactionResponse, PREFLIGHT_CONNECT_CODES, TERMINAL_UNREACHABLE_CONNECT_CODES, TECHNICAL_ERROR_CODE, NOT_FOUND_HTTP_STATUS, TERMINAL_BUSY_HTTP_STATUS, TRANSACTION_CANCELED_CODE, } from './hobex-hps/index.js';
@@ -10,6 +10,7 @@ export declare function posSettingsFromWire(data: {
10
10
  device?: unknown;
11
11
  vouchers?: unknown;
12
12
  deposit?: unknown;
13
+ cardTerminal?: unknown;
13
14
  } | null | undefined): PosSettings;
14
15
  /** Betriebsweite Einstellungen schreiben (Recht `layout`); liefert den gemischten Stand. */
15
16
  export declare function setMyPosSettings(transport: InternerTransport, business: Partial<PosBusinessSettings>): Promise<PosBusinessSettings>;
@@ -2,7 +2,7 @@ import { KasseneckValidationError } from '../client/errors.js';
2
2
  import { posVoucherSettingsFromWire } from './gutschein.js';
3
3
  import { posDepositSettingsFromWire } from './pfand.js';
4
4
  import { checkDiscountPresets, INVALID_DISCOUNT_PRESET } from './rabatt-vorlagen.js';
5
- import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_BUSINESS_OPTIONAL_LISTS, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, } from './settings.js';
5
+ import { POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, POS_SHORTCUT_ACTIONS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_OPTIONAL_SWITCHES, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_BUSINESS_OPTIONAL_LISTS, POS_DEVICE_OPTIONAL_CHOICES, mergePosSettings, posShortcutConflict, _istAltwert0x, _optionalerWert, POS_BUSINESS_OPTIONAL_IDS, _optionaleBetriebsKennung, posCardTerminalFromWire, } from './settings.js';
6
6
  /*
7
7
  * Die Einstellungs-Aufrufe am Draht `/api/v3`: Parameter und Antwort heissen
8
8
  * `business`/`device`, Schluessel und Werte englisch (Nachtrag §11.7.2).
@@ -33,11 +33,13 @@ export async function getPosSettings(transport, options = {}) {
33
33
  /** `{business, device, vouchers}` einer Antwort, gemischt mit den Standardwerten. */
34
34
  export function posSettingsFromWire(data) {
35
35
  const deposit = posDepositSettingsFromWire(data?.deposit);
36
+ const cardTerminal = posCardTerminalFromWire(data?.cardTerminal);
36
37
  return {
37
38
  vouchers: posVoucherSettingsFromWire(data?.vouchers),
38
39
  business: mergePosSettings(POS_BUSINESS_DEFAULTS, objekt(data?.business)),
39
40
  device: mergePosSettings(POS_DEVICE_DEFAULTS, objekt(data?.device)),
40
41
  ...(deposit ? { deposit } : {}),
42
+ ...(cardTerminal ? { cardTerminal } : {}),
41
43
  };
42
44
  }
43
45
  /** Betriebsweite Einstellungen schreiben (Recht `layout`); liefert den gemischten Stand. */
@@ -143,7 +145,13 @@ function pruefeTeil(name, teil, block, standard, werte) {
143
145
  throw new KasseneckValidationError(name, `${teil}.${schluessel}: Kennung oder null erwartet`, 'request');
144
146
  continue;
145
147
  }
146
- if (teil === 'business' && POS_BUSINESS_OPTIONAL_FIELDS.includes(schluessel)) {
148
+ if (teil === 'business' && POS_BUSINESS_OPTIONAL_IDS.includes(schluessel)) {
149
+ if (!_optionaleBetriebsKennung(wert, true))
150
+ throw new KasseneckValidationError(name, `${teil}.${schluessel}: Nummer (4 bis 20 Buchstaben oder Ziffern) oder null erwartet`, 'request');
151
+ continue;
152
+ }
153
+ const schalter = teil === 'business' ? POS_BUSINESS_OPTIONAL_FIELDS : POS_DEVICE_OPTIONAL_SWITCHES;
154
+ if (schalter.includes(schluessel)) {
147
155
  if (typeof wert !== 'boolean')
148
156
  throw new KasseneckValidationError(name, `${teil}.${schluessel}: true oder false erwartet`, 'request');
149
157
  continue;
@@ -21,7 +21,7 @@ import { KasseneckApiError } from '../client/errors.js';
21
21
  * ueber `KasseneckApiError.code` lesbar; die Kasse braucht dafuer einen
22
22
  * Rueckfallzweig.
23
23
  */
24
- export declare const POS_ERROR_CODES: readonly ["account_not_found", "action_confirmation_required", "admin_required", "after_count_not_permitted", "api_not_approved", "app_check_invalid", "app_check_missing", "article_not_found", "article_not_in_scope", "article_not_tracked", "cash_movement_exceeds_balance", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "comment_required", "count_already_voided", "count_not_found", "deposit_follows_item", "deposit_not_enabled", "deposit_return_not_offered", "deposit_set_by_server", "deposit_type_in_use", "deposit_type_not_found", "deposit_type_not_issued", "device_not_found", "dialect_mismatch", "drawer_inactive", "drawer_not_found", "filler_role_required", "idempotency_conflict", "idempotency_key_required", "internal_translation_error", "invalid_amount", "invalid_cursor", "invalid_denominations", "invalid_deposit", "invalid_deposit_quantity", "invalid_discount_preset", "invalid_item_kind", "invalid_movement_type", "invalid_quantity", "invalid_serial", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_a_person_login", "not_found", "not_permitted", "note_required", "password_change_required", "print_job_not_found", "print_layout_failed", "printer_not_found", "recount_exhausted", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "serial_already_counted", "serial_not_allowed", "serial_required", "server_error", "session_expired", "session_other_cashregister", "shift_already_open", "shift_closed", "shift_mode_off", "shift_not_open", "stocktake_closed", "stocktake_closing", "stocktake_not_found", "stocktake_not_open", "tip_payout_exceeds_claim", "too_many_counts", "too_many_deposit_types", "transfer_same_drawer", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
24
+ export declare const POS_ERROR_CODES: readonly ["account_not_found", "action_confirmation_required", "admin_required", "after_count_not_permitted", "api_not_approved", "app_check_invalid", "app_check_missing", "article_not_found", "article_not_in_scope", "article_not_tracked", "cash_movement_exceeds_balance", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "comment_required", "count_already_voided", "count_not_found", "deposit_follows_item", "deposit_not_enabled", "deposit_return_not_offered", "deposit_set_by_server", "deposit_type_in_use", "deposit_type_not_found", "deposit_type_not_issued", "device_not_found", "dialect_mismatch", "drawer_inactive", "drawer_not_found", "filler_role_required", "idempotency_conflict", "idempotency_key_required", "internal_translation_error", "invalid_amount", "invalid_cursor", "invalid_denominations", "invalid_deposit", "invalid_deposit_quantity", "invalid_discount_preset", "invalid_item_kind", "invalid_movement_type", "invalid_quantity", "invalid_serial", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_a_person_login", "not_found", "not_permitted", "note_required", "password_change_required", "print_job_not_found", "print_layout_failed", "printer_not_found", "recount_exhausted", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "serial_already_counted", "serial_not_allowed", "serial_required", "server_error", "session_expired", "session_other_cashregister", "shift_already_open", "shift_closed", "shift_mode_off", "shift_not_open", "stocktake_closed", "stocktake_closing", "stocktake_not_found", "stocktake_not_open", "sumup_merchant_already_bound", "tip_payout_exceeds_claim", "too_many_counts", "too_many_deposit_types", "transfer_same_drawer", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
25
25
  export type PosErrorCode = typeof POS_ERROR_CODES[number];
26
26
  export declare function isPosErrorCode(value: unknown): value is PosErrorCode;
27
27
  /** Der Code eines geworfenen Fehlers, wenn er in [POS_ERROR_CODES] steht; sonst `undefined`. */
@@ -102,6 +102,7 @@ export const POS_ERROR_CODES = Object.freeze([
102
102
  'stocktake_closing',
103
103
  'stocktake_not_found',
104
104
  'stocktake_not_open',
105
+ 'sumup_merchant_already_bound',
105
106
  'tip_payout_exceeds_claim',
106
107
  'too_many_counts',
107
108
  'too_many_deposit_types',
@@ -6,7 +6,7 @@
6
6
  * die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
7
7
  * und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
8
8
  */
9
- export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, type TipKeptDecision, type TipPaymentKind, DISCOUNT_PRESET_KIND, type PosDiscountPreset, type PosDiscountPresetKind, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, TIP_CARD_KEPT_MODE, type PosTipKeptMode, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
9
+ export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, type PosTipMode, type PosCheckoutMode, type PosCardProvider, type PosReceiptOutput, type PosShortcutAction, type PosShortcutMap, POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, type PosLayout, type PosCategoryPosition, type PosTileHeight, type PosPrinterType, type PosTerminalVia, type PosTerminalType, type PosPaperSize, type PosCodePage, type PosCut, type PosDrawerAutoOpen, type PosQrMode, type PosLogoSize, type PosSettingsFontSize, type PosTileStyle, type PosAutoLogoutMinutes, type PosDiscount, type PosWatermarkSide, type PosWatermarkStrength, type PosLogoScale, type PosWatermarkScale, type PosDoneScreenSeconds, type PosToggleMap, type PosBusinessSettings, type PosDeviceSettings, type PosSettings, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_OPTIONAL_SWITCHES, posPrinterHint, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_IDS, posCardTerminalFromWire, type PosCardTerminal, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, type TipKeptDecision, type TipPaymentKind, DISCOUNT_PRESET_KIND, type PosDiscountPreset, type PosDiscountPresetKind, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, type PosOpen, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict, THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, TIP_CARD_KEPT_MODE, type PosTipKeptMode, CART_WIDTH, type PosTipKind, type PosCartWidth, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
10
10
  export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
11
11
  export { REFERENCE_MODES, type ReferenceMode, type PosReference, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, type ReferenceCheckResult, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
12
12
  export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
@@ -6,7 +6,7 @@
6
6
  * die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
7
7
  * und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
8
8
  */
9
- export { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, DISCOUNT_PRESET_KIND, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
9
+ export { POS_SHORTCUT_ACTIONS, POS_SHORTCUT_DEFAULTS, POS_BUSINESS_DEFAULTS, POS_DEVICE_DEFAULTS, POS_DEVICE_OPTIONAL_FIELDS, POS_DEVICE_OPTIONAL_SWITCHES, posPrinterHint, POS_BUSINESS_OPTIONAL_FIELDS, POS_BUSINESS_OPTIONAL_IDS, posCardTerminalFromWire, POS_BUSINESS_OPTIONAL_CHOICES, POS_DEVICE_OPTIONAL_CHOICES, posTipKeptByDefault, posCustomDiscountAllowed, posTipKeptMode, posTipCardKeptByDefault, posTipCardKeptMode, posTipSelfPayout, tipKeptFor, DISCOUNT_PRESET_KIND, POS_BUSINESS_OPTIONAL_LISTS, posTipKinds, posTipStart, posCartWidth, POS_BUSINESS_VALUES, POS_DEVICE_VALUES, mergePosSettings, sanitizePosSettings, unknownPosSettingValues, posSettingsChanges, POS_SHORTCUT_SHARED_PAIRS, posShortcutConflict,
10
10
  // Die Enums als Laufzeitlisten, benannt nach ihrem Feld.
11
11
  THEME, FONT_SIZE, WATERMARK, QUANTITY, TIP_MODE, TIP_KINDS, TIP_START, TIP_KEPT_MODE, TIP_CARD_KEPT_MODE, CART_WIDTH, CHECKOUT_MODE, CARD_PROVIDER, RECEIPT_OUTPUT, LAYOUT, CATEGORY_POSITION, TILE_HEIGHT, PRINTER_TYPE, TERMINAL_VIA, TERMINAL_TYPE, PAPER_SIZE, CODE_PAGE, CUT, DRAWER_AUTO_OPEN, QR_MODE, LOGO_SIZE, SETTINGS_FONT_SIZE, TILE_STYLE, AUTO_LOGOUT_MINUTES, DISCOUNT, WATERMARK_SIDE, WATERMARK_STRENGTH, LOGO_SCALE, WATERMARK_SCALE, DONE_SCREEN_SECONDS, } from './settings.js';
12
12
  export { fromArticleGroupPayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
@@ -62,8 +62,11 @@ export declare const CART_WIDTH: readonly ["narrow", "medium", "wide"];
62
62
  export type PosCartWidth = typeof CART_WIDTH[number];
63
63
  export declare const CHECKOUT_MODE: readonly ["page", "panel"];
64
64
  export type PosCheckoutMode = typeof CHECKOUT_MODE[number];
65
- /** Kartenanbieter: Karte gibt es erst mit eingerichtetem Anbieter; 'external' = eigenes Terminal ohne Anbindung. */
66
- export declare const CARD_PROVIDER: readonly ["none", "external", "gptom", "hobex", "mypos", "stripe"];
65
+ /**
66
+ * Kartenanbieter: Karte gibt es erst mit eingerichtetem Anbieter; 'external' = eigenes Terminal ohne Anbindung.
67
+ * 'sumup' bindet nur die Kassen-App auf Android an (SumUp-SDK); Browser-Kasse und iOS kassieren damit wie 'external'.
68
+ */
69
+ export declare const CARD_PROVIDER: readonly ["none", "external", "gptom", "hobex", "mypos", "stripe", "sumup"];
67
70
  export type PosCardProvider = typeof CARD_PROVIDER[number];
68
71
  export declare const RECEIPT_OUTPUT: readonly ["qr", "print", "email", "sms", "ask"];
69
72
  export type PosReceiptOutput = typeof RECEIPT_OUTPUT[number];
@@ -258,6 +261,12 @@ export interface PosBusinessSettings {
258
261
  * `false` = eigenes Trinkgeld nur mit dem Recht `shift` auszahlbar (R49). Lesen ueber [posTipSelfPayout].
259
262
  */
260
263
  tipSelfPayout?: boolean;
264
+ /**
265
+ * SumUp-Haendlernummer, an die der Betrieb gebunden ist (Spec 2026-11-14-sumup-kasse). Optional: fehlt, solange keine
266
+ * gebunden ist. Schreiben nimmt die Nummer oder `null` (Bindung loesen); eine andere Nummer bei bestehender Bindung
267
+ * weist der Server mit `sumup_merchant_already_bound` ab. Siehe [POS_BUSINESS_OPTIONAL_IDS].
268
+ */
269
+ sumupMerchantCode?: string;
261
270
  /**
262
271
  * Benannte Rabatt-Chips (Prozent oder Betrag, hoechstens 5). Optional: der Server sendet das Feld nur, wenn es
263
272
  * gespeichert ist; dann sind die Vorlagen die Quelle der Chips und `discountChips` spiegelt ihre Prozentwerte fuer
@@ -340,6 +349,11 @@ export interface PosDeviceSettings {
340
349
  drawerId?: string | null;
341
350
  /** Breite der rechten Spalte; optional, fehlt sie, gilt `narrow`. Lesen ueber [posCartWidth]. */
342
351
  cartWidth?: PosOpen<PosCartWidth>;
352
+ /**
353
+ * Hinweis an den Druckknoepfen, wenn der Drucker auf die Statusabfrage nicht antwortet. Optional: der Server sendet
354
+ * das Feld nur, wenn es gespeichert ist; fehlt es, gilt an. Lesen ueber [posPrinterHint]. Siehe [POS_DEVICE_OPTIONAL_SWITCHES].
355
+ */
356
+ printerHint?: boolean;
343
357
  terminalIp: string;
344
358
  terminalPort: number;
345
359
  terminalVia: PosOpen<PosTerminalVia>;
@@ -357,7 +371,20 @@ export interface PosSettings {
357
371
  vouchers: PosVoucherSettings;
358
372
  /** Pfand & Leergut (Block `deposit`); fehlt, solange der Betrieb kein Pfand eingeschaltet hat. */
359
373
  deposit?: DepositSettings;
374
+ /** Kartenterminal-Zugang (Block `cardTerminal`); fehlt, solange an diesem Geraet kein angebundenes Terminal gilt. */
375
+ cardTerminal?: PosCardTerminal;
360
376
  }
377
+ /**
378
+ * Zugang zu einem angebundenen Kartenterminal (Spec 2026-11-14-sumup-kasse). Der Server liefert den SumUp-Affiliate-Key
379
+ * nur an ein Geraet, an dem der Kartenanbieter `sumup` gilt.
380
+ */
381
+ export interface PosCardTerminal {
382
+ sumup?: {
383
+ affiliateKey: string;
384
+ };
385
+ }
386
+ /** `cardTerminal` aus einer Antwort lesen; unbrauchbar oder ohne Inhalt → `null`. */
387
+ export declare function posCardTerminalFromWire(value: unknown): PosCardTerminal | null;
361
388
  export declare const POS_BUSINESS_DEFAULTS: Readonly<PosBusinessSettings>;
362
389
  export declare const POS_DEVICE_DEFAULTS: Readonly<PosDeviceSettings>;
363
390
  /**
@@ -370,6 +397,12 @@ export declare const POS_DEVICE_DEFAULTS: Readonly<PosDeviceSettings>;
370
397
  export declare const POS_DEVICE_OPTIONAL_FIELDS: readonly ["drawerId"];
371
398
  /** Gilt dieser Wert fuer ein optionales Feld? Lesen: nur eine Kennung; Schreiben: auch `null`. */
372
399
  export declare function _optionalerWert(wert: unknown, schreiben: boolean): boolean;
400
+ /**
401
+ * Optionale Geraete-Schalter: ohne Standardwert, der Server sendet sie nur, wenn sie gespeichert sind (Backend
402
+ * `GERAET_OPTIONAL`, Wahrheitswert). [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg nimmt nur
403
+ * `true`/`false`.
404
+ */
405
+ export declare const POS_DEVICE_OPTIONAL_SWITCHES: readonly ["printerHint"];
373
406
  /**
374
407
  * Optionale Betriebs-Einstellungen (Schalter): ohne Standardwert, der Server
375
408
  * sendet sie nur, wenn sie gespeichert sind (Backend `BETRIEB_OPTIONAL`).
@@ -377,6 +410,14 @@ export declare function _optionalerWert(wert: unknown, schreiben: boolean): bool
377
410
  * nimmt nur `true`/`false`.
378
411
  */
379
412
  export declare const POS_BUSINESS_OPTIONAL_FIELDS: readonly ["tipKeptByDefault", "customDiscountAllowed", "tipCardKeptByDefault", "tipSelfPayout"];
413
+ /**
414
+ * Optionale Betriebs-Kennungen (Backend `BETRIEB_OPTIONAL`, z. B. `sumupHaendler`): ohne Standardwert, der Server sendet
415
+ * sie nur, wenn sie gesetzt sind. [mergePosSettings] uebernimmt eine gueltige Nummer; der Schreibweg nimmt sie oder
416
+ * `null` (loesen).
417
+ */
418
+ export declare const POS_BUSINESS_OPTIONAL_IDS: readonly ["sumupMerchantCode"];
419
+ /** Gilt dieser Wert fuer eine optionale Betriebs-Kennung? Lesen: nur eine Nummer; Schreiben: auch `null`. */
420
+ export declare function _optionaleBetriebsKennung(wert: unknown, schreiben: boolean): boolean;
380
421
  /**
381
422
  * Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
382
423
  * `KASSE_BETRIEB_WERTE.tipKinds[]`, `.tipStart` und `.tipKeptMode`): ohne Standardwert, der Server sendet sie nur,
@@ -402,6 +443,8 @@ export declare function posTipKinds(business: Readonly<Partial<PosBusinessSettin
402
443
  export declare function posTipStart(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): PosOpen<PosTipKind>;
403
444
  /** Wirksame Breite der rechten Spalte; ohne Angabe `narrow`. */
404
445
  export declare function posCartWidth(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): PosOpen<PosCartWidth>;
446
+ /** Hinweis „Drucker antwortet nicht“ an den Druckknoepfen an? Fehlt die Einstellung, gilt ja. */
447
+ export declare function posPrinterHint(device: Readonly<Partial<PosDeviceSettings>> | null | undefined): boolean;
405
448
  /** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
406
449
  export declare function posTipKeptByDefault(business: Readonly<Partial<PosBusinessSettings>> | null | undefined): boolean;
407
450
  /** Darf an der Kasse ein eigener Rabatt (Betrag oder Prozent) eingetippt werden? Fehlt die Einstellung, gilt ja. */
@@ -451,7 +494,7 @@ export declare const _ALTFORM_0X: Readonly<{
451
494
  * Schluessel, die der Standard nicht fuehrt, bleiben draussen, ausser einer
452
495
  * optionalen Geraete-Einstellung ([POS_DEVICE_OPTIONAL_FIELDS]) mit gueltiger
453
496
  * Kennung und einem optionalen Betriebs-Schalter
454
- * ([POS_BUSINESS_OPTIONAL_FIELDS]) als Wahrheitswert.
497
+ * ([POS_BUSINESS_OPTIONAL_FIELDS]) oder Geraete-Schalter ([POS_DEVICE_OPTIONAL_SWITCHES]) als Wahrheitswert.
455
498
  *
456
499
  * **Immer** (unabhaengig davon, welches Standard-Objekt uebergeben wird, auch
457
500
  * eine Kopie oder das einer zweiten Paketkopie) faellt ein Wert der inneren
@@ -49,8 +49,11 @@ export const DISCOUNT_PRESET_KIND = ['percent', 'amount'];
49
49
  /** Breite der rechten Spalte (Korb) an diesem Geraet (`device.cartWidth`); in der schmalen Ansicht ohne Wirkung. */
50
50
  export const CART_WIDTH = ['narrow', 'medium', 'wide'];
51
51
  export const CHECKOUT_MODE = ['page', 'panel'];
52
- /** Kartenanbieter: Karte gibt es erst mit eingerichtetem Anbieter; 'external' = eigenes Terminal ohne Anbindung. */
53
- export const CARD_PROVIDER = ['none', 'external', 'gptom', 'hobex', 'mypos', 'stripe'];
52
+ /**
53
+ * Kartenanbieter: Karte gibt es erst mit eingerichtetem Anbieter; 'external' = eigenes Terminal ohne Anbindung.
54
+ * 'sumup' bindet nur die Kassen-App auf Android an (SumUp-SDK); Browser-Kasse und iOS kassieren damit wie 'external'.
55
+ */
56
+ export const CARD_PROVIDER = ['none', 'external', 'gptom', 'hobex', 'mypos', 'stripe', 'sumup'];
54
57
  export const RECEIPT_OUTPUT = ['qr', 'print', 'email', 'sms', 'ask'];
55
58
  export const LAYOUT = ['right', 'left', 'fullscreen'];
56
59
  export const CATEGORY_POSITION = ['top', 'left'];
@@ -175,6 +178,13 @@ export function posShortcutConflict(shortcuts) {
175
178
  }
176
179
  return null;
177
180
  }
181
+ /** `cardTerminal` aus einer Antwort lesen; unbrauchbar oder ohne Inhalt → `null`. */
182
+ export function posCardTerminalFromWire(value) {
183
+ const block = value !== null && typeof value === 'object' && !Array.isArray(value) ? value : null;
184
+ const sumup = block && block.sumup !== null && typeof block.sumup === 'object' ? block.sumup : null;
185
+ const key = sumup && typeof sumup.affiliateKey === 'string' ? sumup.affiliateKey : '';
186
+ return key ? { sumup: { affiliateKey: key } } : null;
187
+ }
178
188
  export const POS_BUSINESS_DEFAULTS = Object.freeze({
179
189
  // Das Petrol der Marke: die Aktionsfarbe des Design-Systems (Rolle `brand`).
180
190
  logoText: 'K', logoEnabled: true, logoSize: 'M', watermark: 'login', color: '#136B6B',
@@ -217,6 +227,13 @@ export function _optionalerWert(wert, schreiben) {
217
227
  return (schreiben && wert === null) || (typeof wert === 'string' && OPTIONALE_KENNUNG.test(wert));
218
228
  }
219
229
  const OPTIONALE = new Set(POS_DEVICE_OPTIONAL_FIELDS);
230
+ /**
231
+ * Optionale Geraete-Schalter: ohne Standardwert, der Server sendet sie nur, wenn sie gespeichert sind (Backend
232
+ * `GERAET_OPTIONAL`, Wahrheitswert). [mergePosSettings] uebernimmt sie nur als Wahrheitswert; der Schreibweg nimmt nur
233
+ * `true`/`false`.
234
+ */
235
+ export const POS_DEVICE_OPTIONAL_SWITCHES = Object.freeze(['printerHint']);
236
+ const OPTIONALE_GERAETE_SCHALTER = new Set(POS_DEVICE_OPTIONAL_SWITCHES);
220
237
  /**
221
238
  * Optionale Betriebs-Einstellungen (Schalter): ohne Standardwert, der Server
222
239
  * sendet sie nur, wenn sie gespeichert sind (Backend `BETRIEB_OPTIONAL`).
@@ -225,6 +242,19 @@ const OPTIONALE = new Set(POS_DEVICE_OPTIONAL_FIELDS);
225
242
  */
226
243
  export const POS_BUSINESS_OPTIONAL_FIELDS = Object.freeze(['tipKeptByDefault', 'customDiscountAllowed', 'tipCardKeptByDefault', 'tipSelfPayout']);
227
244
  const OPTIONALE_SCHALTER = new Set(POS_BUSINESS_OPTIONAL_FIELDS);
245
+ /**
246
+ * Optionale Betriebs-Kennungen (Backend `BETRIEB_OPTIONAL`, z. B. `sumupHaendler`): ohne Standardwert, der Server sendet
247
+ * sie nur, wenn sie gesetzt sind. [mergePosSettings] uebernimmt eine gueltige Nummer; der Schreibweg nimmt sie oder
248
+ * `null` (loesen).
249
+ */
250
+ export const POS_BUSINESS_OPTIONAL_IDS = Object.freeze(['sumupMerchantCode']);
251
+ /** Form der SumUp-Haendlernummer (Backend `sumup-kasse-core.HAENDLER_MUSTER`, dort gross geschrieben). */
252
+ const SUMUP_HAENDLER = /^[A-Za-z0-9]{4,20}$/;
253
+ /** Gilt dieser Wert fuer eine optionale Betriebs-Kennung? Lesen: nur eine Nummer; Schreiben: auch `null`. */
254
+ export function _optionaleBetriebsKennung(wert, schreiben) {
255
+ return (schreiben && wert === null) || (typeof wert === 'string' && SUMUP_HAENDLER.test(wert));
256
+ }
257
+ const OPTIONALE_BETRIEBS_KENNUNGEN = new Set(POS_BUSINESS_OPTIONAL_IDS);
228
258
  /**
229
259
  * Optionale Betriebs-Einstellungen mit Wertemenge (Backend `BETRIEB_OPTIONAL`, Katalog
230
260
  * `KASSE_BETRIEB_WERTE.tipKinds[]`, `.tipStart` und `.tipKeptMode`): ohne Standardwert, der Server sendet sie nur,
@@ -284,6 +314,10 @@ export function posCartWidth(device) {
284
314
  const w = device?.cartWidth;
285
315
  return typeof w === 'string' && w !== '' ? w : 'narrow';
286
316
  }
317
+ /** Hinweis „Drucker antwortet nicht“ an den Druckknoepfen an? Fehlt die Einstellung, gilt ja. */
318
+ export function posPrinterHint(device) {
319
+ return device?.printerHint !== false;
320
+ }
287
321
  /** Bar-Trinkgeld „gleich behalten“ vorbelegt? Fehlt die Einstellung, gilt aus. */
288
322
  export function posTipKeptByDefault(business) {
289
323
  return !!business && business.tipKeptByDefault === true;
@@ -398,7 +432,7 @@ export const _ALTFORM_0X = Object.freeze({ werte: ALTWERTE_0X, aktionen: [...ALT
398
432
  * Schluessel, die der Standard nicht fuehrt, bleiben draussen, ausser einer
399
433
  * optionalen Geraete-Einstellung ([POS_DEVICE_OPTIONAL_FIELDS]) mit gueltiger
400
434
  * Kennung und einem optionalen Betriebs-Schalter
401
- * ([POS_BUSINESS_OPTIONAL_FIELDS]) als Wahrheitswert.
435
+ * ([POS_BUSINESS_OPTIONAL_FIELDS]) oder Geraete-Schalter ([POS_DEVICE_OPTIONAL_SWITCHES]) als Wahrheitswert.
402
436
  *
403
437
  * **Immer** (unabhaengig davon, welches Standard-Objekt uebergeben wird, auch
404
438
  * eine Kopie oder das einer zweiten Paketkopie) faellt ein Wert der inneren
@@ -419,6 +453,10 @@ export function mergePosSettings(standard, stored) {
419
453
  out[key] = wert;
420
454
  if (OPTIONALE_SCHALTER.has(key) && typeof wert === 'boolean')
421
455
  out[key] = wert;
456
+ if (OPTIONALE_BETRIEBS_KENNUNGEN.has(key) && _optionaleBetriebsKennung(wert, false))
457
+ out[key] = wert;
458
+ if (OPTIONALE_GERAETE_SCHALTER.has(key) && typeof wert === 'boolean')
459
+ out[key] = wert;
422
460
  if (OPTIONALE_WAHL.has(key) && _optionalerWahlwert(key, wert))
423
461
  out[key] = Array.isArray(wert) ? [...wert] : wert;
424
462
  if (key === 'discountPresets') {
@@ -474,8 +512,14 @@ export function sanitizePosSettings(stored) {
474
512
  device: mergePosSettings(POS_DEVICE_DEFAULTS, teil('device')),
475
513
  vouchers: posVoucherSettingsFromWire(eigen(roh, 'vouchers') ? roh['vouchers'] : undefined),
476
514
  ...pfandBlock(eigen(roh, 'deposit') ? roh['deposit'] : undefined),
515
+ ...kartenterminalBlock(eigen(roh, 'cardTerminal') ? roh['cardTerminal'] : undefined),
477
516
  };
478
517
  }
518
+ /** `{ cardTerminal }`, wenn der Block lesbar ist, sonst nichts. */
519
+ function kartenterminalBlock(wert) {
520
+ const cardTerminal = posCardTerminalFromWire(wert);
521
+ return cardTerminal ? { cardTerminal } : {};
522
+ }
479
523
  /**
480
524
  * Die Felder, deren Wert dieses Paket nicht kennt (neuer Wert des Servers),
481
525
  * als Pfade (`business.theme`, `device.printerType`). Die Oberflaeche kann sie