@kreiseck/kasseneck-api 1.1.1 → 1.2.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 (127) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +70 -0
  3. package/dist/cjs/client/aufrufe.d.ts +5 -5
  4. package/dist/cjs/client/aufrufe.js +21 -2
  5. package/dist/cjs/client/errors.d.ts +1 -1
  6. package/dist/cjs/client/errors.js +2 -1
  7. package/dist/cjs/client/receipts.d.ts +9 -1
  8. package/dist/cjs/client/receipts.js +18 -3
  9. package/dist/cjs/client/transport.d.ts +3 -3
  10. package/dist/cjs/client/transport.js +2 -2
  11. package/dist/cjs/index.d.ts +2 -2
  12. package/dist/cjs/index.js +6 -3
  13. package/dist/cjs/invoice/index.d.ts +2 -2
  14. package/dist/cjs/invoice/index.js +3 -1
  15. package/dist/cjs/invoice/texte.d.ts +5 -5
  16. package/dist/cjs/invoice/texte.js +10 -10
  17. package/dist/cjs/invoice/typen.d.ts +13 -2
  18. package/dist/cjs/invoice/vertrag.d.ts +10 -1
  19. package/dist/cjs/invoice/vertrag.js +39 -2
  20. package/dist/cjs/models/cancellation.d.ts +14 -2
  21. package/dist/cjs/models/cancellation.js +15 -1
  22. package/dist/cjs/models/cashregister.d.ts +3 -0
  23. package/dist/cjs/models/cashregister.js +1 -0
  24. package/dist/cjs/models/index.d.ts +1 -1
  25. package/dist/cjs/models/index.js +4 -2
  26. package/dist/cjs/models/payment-errors.d.ts +1 -1
  27. package/dist/cjs/models/payment-errors.js +1 -0
  28. package/dist/cjs/models/receipt-email.d.ts +1 -1
  29. package/dist/cjs/models/receipt-email.js +1 -0
  30. package/dist/cjs/models/receipt-errors.d.ts +1 -1
  31. package/dist/cjs/models/receipt-errors.js +1 -0
  32. package/dist/cjs/models/receipt-item.d.ts +9 -0
  33. package/dist/cjs/models/receipt-item.js +5 -0
  34. package/dist/cjs/models/receipt.d.ts +1 -1
  35. package/dist/cjs/models/receipt.js +6 -1
  36. package/dist/cjs/pos/artikel.d.ts +14 -0
  37. package/dist/cjs/pos/artikel.js +13 -2
  38. package/dist/cjs/pos/errors.d.ts +3 -3
  39. package/dist/cjs/pos/errors.js +6 -2
  40. package/dist/cjs/pos/index.d.ts +5 -2
  41. package/dist/cjs/pos/index.js +13 -2
  42. package/dist/cjs/pos/lager.d.ts +95 -0
  43. package/dist/cjs/pos/lager.js +160 -0
  44. package/dist/cjs/register/errors.d.ts +1 -1
  45. package/dist/cjs/register/errors.js +1 -0
  46. package/dist/cjs/register/pairing.d.ts +27 -1
  47. package/dist/cjs/register/pairing.js +18 -1
  48. package/dist/cjs/stored/draht.d.ts +4 -2
  49. package/dist/cjs/stored/draht.js +46 -5
  50. package/dist/cjs/stored/vokabular.d.ts +1 -1
  51. package/dist/cjs/stored/vokabular.js +5 -3
  52. package/dist/cjs/version.d.ts +1 -1
  53. package/dist/cjs/version.js +1 -1
  54. package/dist/esm/client/aufrufe.d.ts +5 -5
  55. package/dist/esm/client/aufrufe.js +21 -2
  56. package/dist/esm/client/errors.d.ts +1 -1
  57. package/dist/esm/client/errors.js +2 -1
  58. package/dist/esm/client/receipts.d.ts +9 -1
  59. package/dist/esm/client/receipts.js +19 -4
  60. package/dist/esm/client/transport.d.ts +3 -3
  61. package/dist/esm/client/transport.js +2 -2
  62. package/dist/esm/index.d.ts +2 -2
  63. package/dist/esm/index.js +2 -2
  64. package/dist/esm/invoice/index.d.ts +2 -2
  65. package/dist/esm/invoice/index.js +1 -1
  66. package/dist/esm/invoice/texte.d.ts +5 -5
  67. package/dist/esm/invoice/texte.js +10 -10
  68. package/dist/esm/invoice/typen.d.ts +13 -2
  69. package/dist/esm/invoice/vertrag.d.ts +10 -1
  70. package/dist/esm/invoice/vertrag.js +38 -1
  71. package/dist/esm/models/cancellation.d.ts +14 -2
  72. package/dist/esm/models/cancellation.js +13 -0
  73. package/dist/esm/models/cashregister.d.ts +3 -0
  74. package/dist/esm/models/cashregister.js +1 -0
  75. package/dist/esm/models/index.d.ts +1 -1
  76. package/dist/esm/models/index.js +1 -1
  77. package/dist/esm/models/payment-errors.d.ts +1 -1
  78. package/dist/esm/models/payment-errors.js +1 -0
  79. package/dist/esm/models/receipt-email.d.ts +1 -1
  80. package/dist/esm/models/receipt-email.js +1 -0
  81. package/dist/esm/models/receipt-errors.d.ts +1 -1
  82. package/dist/esm/models/receipt-errors.js +1 -0
  83. package/dist/esm/models/receipt-item.d.ts +9 -0
  84. package/dist/esm/models/receipt-item.js +5 -0
  85. package/dist/esm/models/receipt.d.ts +1 -1
  86. package/dist/esm/models/receipt.js +6 -1
  87. package/dist/esm/pos/artikel.d.ts +14 -0
  88. package/dist/esm/pos/artikel.js +13 -3
  89. package/dist/esm/pos/errors.d.ts +3 -3
  90. package/dist/esm/pos/errors.js +6 -2
  91. package/dist/esm/pos/index.d.ts +5 -2
  92. package/dist/esm/pos/index.js +6 -2
  93. package/dist/esm/pos/lager.d.ts +95 -0
  94. package/dist/esm/pos/lager.js +154 -0
  95. package/dist/esm/register/errors.d.ts +1 -1
  96. package/dist/esm/register/errors.js +1 -0
  97. package/dist/esm/register/pairing.d.ts +27 -1
  98. package/dist/esm/register/pairing.js +17 -1
  99. package/dist/esm/stored/draht.d.ts +4 -2
  100. package/dist/esm/stored/draht.js +45 -4
  101. package/dist/esm/stored/vokabular.d.ts +1 -1
  102. package/dist/esm/stored/vokabular.js +5 -3
  103. package/dist/esm/version.d.ts +1 -1
  104. package/dist/esm/version.js +1 -1
  105. package/fixtures/hobex-hps-codes.json +1 -1
  106. package/fixtures/invoice-api-examples/cancel-error-return-disposition.json +17 -0
  107. package/fixtures/invoice-api-examples/credit-error-return-disposition.json +26 -0
  108. package/fixtures/invoice-api-examples/credit-return-disposition.json +23 -0
  109. package/fixtures/invoice-api-examples/issue-error-return-disposition.json +25 -0
  110. package/fixtures/invoice-api-examples/issue-error-stock-id.json +27 -0
  111. package/fixtures/invoice-api-examples/issue-stock.json +22 -0
  112. package/fixtures/invoice-api.schema.json +37 -1
  113. package/fixtures/invoice-texts.json +11 -11
  114. package/fixtures/pos-texts.json +1 -1
  115. package/fixtures/surface.json +48 -4
  116. package/fixtures/v3/antworten/belege.json +1 -1
  117. package/fixtures/v3/antworten/belegmail.json +1 -1
  118. package/fixtures/v3/antworten/kasse-belege.json +1 -1
  119. package/fixtures/v3/antworten/kasse.json +662 -3
  120. package/fixtures/v3/antworten/rechnungen.json +1 -1
  121. package/fixtures/v3/antworten/storno.json +1 -1
  122. package/fixtures/v3/stored/belege.json +1 -1
  123. package/fixtures/v3/stored/kasse.json +58 -3
  124. package/fixtures/v3/stored/rechnungen.json +1 -1
  125. package/fixtures/v3/v3-vokabular.json +249 -16
  126. package/fixtures/v3/zahlbetrag-faelle.json +1 -1
  127. package/package.json +1 -1
@@ -41,7 +41,7 @@ const DE = {
41
41
  // wortgleich in Art. 226 Nr. 11a MwSt-RL). „Steuerfrei" waere sachlich falsch
42
42
  // und erbraechte den vorgeschriebenen Hinweis nicht.
43
43
  'tax.reverse_charge.title': 'Steuerschuldnerschaft des Leistungsempfängers. ',
44
- 'tax.reverse_charge.text': 'Übergang der Steuerschuld gem. Art. 196 MwSt-RL 2006/112/EG (innergemeinschaftliche Leistung). Die Leistung ist nicht steuerfrei — die Umsatzsteuer schuldet und entrichtet der Leistungsempfänger in seinem Land.',
44
+ 'tax.reverse_charge.text': 'Übergang der Steuerschuld gem. Art. 196 MwSt-RL 2006/112/EG (innergemeinschaftliche Leistung). Die Leistung ist nicht steuerfrei – die Umsatzsteuer schuldet und entrichtet der Leistungsempfänger in seinem Land.',
45
45
  // Beide UID-Nummern: bei Reverse Charge § 11 Abs. 1a, bei der ig. Lieferung
46
46
  // Art. 11 Abs. 2 UStG.
47
47
  'tax.vat_id_line': 'UID Leistungserbringer: {seller} · UID Leistungsempfänger: {buyer}',
@@ -81,7 +81,7 @@ const DE = {
81
81
  'pdf.direct_debit.account': 'Konto',
82
82
  'pdf.direct_debit.mandate_reference': 'Mandatsreferenz',
83
83
  'pdf.direct_debit.mandate_date': 'Mandat vom',
84
- 'pdf.direct_debit.warning': 'Bitte für Deckung sorgen — die Kosten einer Rücklastschrift werden weiterverrechnet.',
84
+ 'pdf.direct_debit.warning': 'Bitte für Deckung sorgen – die Kosten einer Rücklastschrift werden weiterverrechnet.',
85
85
  'pdf.refund.text': 'Der Betrag wird auf dem ursprünglichen Zahlungsweg erstattet. Sie müssen nichts veranlassen.',
86
86
  'pdf.refund.reference': 'Bezug',
87
87
  'pdf.refund.amount': 'Erstattungsbetrag',
@@ -92,7 +92,7 @@ const DE = {
92
92
  'pdf.footer.contact': 'Kontakt',
93
93
  'pdf.footer.register': 'Register & Steuer',
94
94
  'pdf.footer.registered_office': 'Sitz: {place}',
95
- 'pdf.footer.note': 'Erstellt mit Kasseneck — ein Produkt der Kreiseck',
95
+ 'pdf.footer.note': 'Erstellt mit Kasseneck – ein Produkt der Kreiseck',
96
96
  'pdf.page': 'Seite {number} / {total}',
97
97
  'country.AT': 'Österreich',
98
98
  'country.DE': 'Deutschland',
@@ -108,9 +108,9 @@ const DE = {
108
108
  'credit_note.reason.incorrect_invoice': 'Fehlerhafte Rechnung',
109
109
  'credit_note.reason.other': 'Sonstiges',
110
110
  'einvoice.exemption.reverse_charge': 'Steuerschuldnerschaft des Leistungsempfängers (Reverse Charge)',
111
- 'einvoice.exemption.small_business': 'Steuerbefreit — Kleinunternehmer gemäß §6 Abs. 1 Z 27 UStG',
111
+ 'einvoice.exemption.small_business': 'Steuerbefreit – Kleinunternehmer gemäß §6 Abs. 1 Z 27 UStG',
112
112
  'einvoice.exemption.intra_community_supply': 'Steuerfreie innergemeinschaftliche Lieferung gemäß Art. 6 Abs. 1 UStG',
113
- 'einvoice.exemption.outside_scope': 'Nicht steuerbarer Umsatz — Leistungsort im Ausland (§ 3a Abs. 6 UStG)',
113
+ 'einvoice.exemption.outside_scope': 'Nicht steuerbarer Umsatz – Leistungsort im Ausland (§ 3a Abs. 6 UStG)',
114
114
  'einvoice.exemption.export_third_country': 'Steuerfreie Ausfuhrlieferung gemäß §6 Abs. 1 Z 1 UStG',
115
115
  'einvoice.payable_until': 'Zahlbar bis {date}',
116
116
  'unit_symbol.piece': 'Stk',
@@ -247,7 +247,7 @@ const EN = {
247
247
  'tax.intra_community_supply.text': 'Pursuant to Art. 6 (1) UStG (Art. 138 of VAT Directive 2006/112/EC). The acquisition is taxed by the customer in the country of destination.',
248
248
  'tax.export_third_country': 'VAT-exempt export delivery (§ 6 (1) no. 1 UStG).',
249
249
  'tax.reverse_charge.title': 'Reverse charge – VAT liability of the recipient. ',
250
- 'tax.reverse_charge.text': 'VAT liability transferred pursuant to Art. 196 of VAT Directive 2006/112/EC (intra-Community service). The service is not VAT-exempt — the recipient owes and accounts for the VAT in their country.',
250
+ 'tax.reverse_charge.text': 'VAT liability transferred pursuant to Art. 196 of VAT Directive 2006/112/EC (intra-Community service). The service is not VAT-exempt – the recipient owes and accounts for the VAT in their country.',
251
251
  'tax.vat_id_line': 'VAT ID supplier: {seller} · VAT ID recipient: {buyer}',
252
252
  'tax.reverse_charge_reason.construction': 'Construction work pursuant to § 19 (1a) UStG.',
253
253
  'tax.reverse_charge_reason.scrap': 'Scrap and waste materials pursuant to the Austrian scrap VAT regulation (BGBl. II No. 129/2007).',
@@ -283,7 +283,7 @@ const EN = {
283
283
  'pdf.direct_debit.account': 'Account',
284
284
  'pdf.direct_debit.mandate_reference': 'Mandate reference',
285
285
  'pdf.direct_debit.mandate_date': 'Mandate date',
286
- 'pdf.direct_debit.warning': 'Please ensure sufficient funds — the costs of a returned direct debit will be charged to you.',
286
+ 'pdf.direct_debit.warning': 'Please ensure sufficient funds – the costs of a returned direct debit will be charged to you.',
287
287
  'pdf.refund.text': 'The amount will be refunded via the original payment method. No action is required on your part.',
288
288
  'pdf.refund.reference': 'Reference',
289
289
  'pdf.refund.amount': 'Refund amount',
@@ -294,7 +294,7 @@ const EN = {
294
294
  'pdf.footer.contact': 'Contact',
295
295
  'pdf.footer.register': 'Registration & tax',
296
296
  'pdf.footer.registered_office': 'Registered office: {place}',
297
- 'pdf.footer.note': 'Created with Kasseneck — a Kreiseck product',
297
+ 'pdf.footer.note': 'Created with Kasseneck – a Kreiseck product',
298
298
  'pdf.page': 'Page {number} / {total}',
299
299
  'country.AT': 'Austria',
300
300
  'country.DE': 'Germany',
@@ -310,9 +310,9 @@ const EN = {
310
310
  'credit_note.reason.incorrect_invoice': 'Incorrect invoice',
311
311
  'credit_note.reason.other': 'Other',
312
312
  'einvoice.exemption.reverse_charge': 'Reverse charge – VAT liability of the recipient',
313
- 'einvoice.exemption.small_business': 'VAT exempt — small business pursuant to § 6 (1) no. 27 UStG',
313
+ 'einvoice.exemption.small_business': 'VAT exempt – small business pursuant to § 6 (1) no. 27 UStG',
314
314
  'einvoice.exemption.intra_community_supply': 'VAT-exempt intra-Community supply pursuant to Art. 6 (1) UStG',
315
- 'einvoice.exemption.outside_scope': 'Outside the scope of VAT — place of supply abroad (§ 3a (6) UStG)',
315
+ 'einvoice.exemption.outside_scope': 'Outside the scope of VAT – place of supply abroad (§ 3a (6) UStG)',
316
316
  'einvoice.exemption.export_third_country': 'VAT-exempt export delivery pursuant to § 6 (1) no. 1 UStG',
317
317
  'einvoice.payable_until': 'Payable by {date}',
318
318
  'unit_symbol.piece': 'pcs',
@@ -5,7 +5,7 @@
5
5
  * Betraege sind ueberall ganze Cent. Datumsangaben sind `YYYY-MM-DD` nach
6
6
  * Wiener Kalender.
7
7
  */
8
- import type { CreditNoteReason, CustomerType, DocType, EInvoiceFormat, EInvoiceMissingCode, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent, WriteOffReasonCode } from './vertrag.js';
8
+ import type { CreditNoteReason, CustomerType, DocType, EInvoiceFormat, EInvoiceMissingCode, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, ReturnDisposition, TaxScheme, VatRatePercent, WriteOffReasonCode } from './vertrag.js';
9
9
  export interface CustomerInput {
10
10
  type: CustomerType;
11
11
  name: string;
@@ -86,6 +86,13 @@ export interface InvoiceItemInput {
86
86
  vatRate: VatRatePercent;
87
87
  /** Zeilenrabatt in Prozent, hoechstens zwei Nachkommastellen. */
88
88
  discountPct?: number;
89
+ /** Artikel aus dem Artikelstamm; bestandsgefuehrt bucht das Ausstellen ihn vom Lager ab. */
90
+ articleId?: string;
91
+ }
92
+ /** Eine Gutschriftsposition: wie eine Rechnungsposition, dazu die Rueckgabe-Wahl. */
93
+ export interface CreditNoteItemInput extends InvoiceItemInput {
94
+ /** Wohin die Ware dieser Position geht; fehlt = Vorgabe des Aufrufs bzw. `restock`. */
95
+ returnDisposition?: ReturnDisposition;
89
96
  }
90
97
  export interface IssueInvoiceRequest {
91
98
  /** Pflicht: dieselbe Anfrage mit demselben Schluessel erzeugt nie eine zweite Rechnung. */
@@ -115,6 +122,8 @@ export interface IssueInvoiceRequest {
115
122
  language?: InvoiceLanguage;
116
123
  /** Marke (Kennung aus `listBrands`); sonst die Standardmarke. Unbekannt = `brand_not_found`. */
117
124
  brandId?: string;
125
+ /** Lager-Standort fuer bestandsgefuehrte Positionen; sonst der Standard-Standort. */
126
+ stockLocationId?: string;
118
127
  /**
119
128
  * Schon bezahlt (Shop kassiert online, Rechnung folgt). Die Zahlung entsteht
120
129
  * in derselben Transaktion wie das Festschreiben: das PDF traegt dann keine
@@ -175,9 +184,11 @@ export interface CancelInvoiceRequest {
175
184
  invoiceId: string;
176
185
  reason: CreditNoteReason;
177
186
  note?: string;
187
+ /** Wohin die Ware bestandsgefuehrter Positionen geht; fehlt = `restock`. */
188
+ returnDisposition?: ReturnDisposition;
178
189
  }
179
190
  export interface CreditNoteRequest extends CancelInvoiceRequest {
180
- items: InvoiceItemInput[];
191
+ items: CreditNoteItemInput[];
181
192
  }
182
193
  /**
183
194
  * Summen einer Rechnung in Cent, **immer positiv** — auch bei einer Gutschrift
@@ -17,6 +17,9 @@
17
17
  * Beschrieben wird die Anfrage. Was der Server daraus macht — Rechnungsdatum,
18
18
  * Nummer, Summen — ist bewusst **nicht** setzbar.
19
19
  */
20
+ import { RETURN_DISPOSITIONS } from '../models/cancellation.js';
21
+ export { RETURN_DISPOSITIONS };
22
+ export type { ReturnDisposition } from '../models/cancellation.js';
20
23
  export declare const INVOICE_CONTRACT_VERSION = 2;
21
24
  export declare const INVOICE_ENDPOINTS: readonly ["createCustomer", "getCustomer", "updateCustomer", "searchCustomers", "issueInvoice", "cancelInvoice", "createCreditNote", "getInvoice", "listInvoices", "getInvoicePdf", "getInvoiceXml", "getInvoiceSetupStatus", "listBrands", "recordInvoicePayment"];
22
25
  export type InvoiceEndpoint = (typeof INVOICE_ENDPOINTS)[number];
@@ -34,7 +37,7 @@ export type InvoiceErrorCode = (typeof INVOICE_ERROR_CODES)[number];
34
37
  * genau der Katalog des Servers (das Backend vergleicht ihn mit dem Schema);
35
38
  * die Helfer in `./invoice` erkennen beide Listen.
36
39
  */
37
- export declare const INVOICE_REQUEST_ERROR_CODES: readonly ["account_not_found", "admin_required", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing"];
40
+ export declare const INVOICE_REQUEST_ERROR_CODES: readonly ["account_not_found", "admin_required", "api_not_approved", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing"];
38
41
  export type InvoiceRequestErrorCode = (typeof INVOICE_REQUEST_ERROR_CODES)[number];
39
42
  /** Gruende einer Gutschrift. Der Server druckt den deutschen Anzeigetext. */
40
43
  export declare const CREDIT_NOTE_REASONS: readonly ["cancellation", "price_reduction", "return", "incorrect_invoice", "other"];
@@ -269,6 +272,12 @@ export declare const CUSTOMER_FIELDS: Readonly<Record<string, Field>>;
269
272
  export declare const ITEM_FIELDS: Readonly<Record<string, Field>>;
270
273
  /** Genau einer der beiden Preise je Position (§ 9.1). */
271
274
  export declare const ITEM_PRICE_EXACTLY_ONE: readonly (readonly string[])[];
275
+ /**
276
+ * Eine Gutschriftsposition: die Rechnungsposition plus `returnDisposition`
277
+ * (wohin die zurueckgenommene Ware geht). An einer Rechnungsposition weist der
278
+ * Server das Feld als unbekannt ab.
279
+ */
280
+ export declare const CREDIT_NOTE_ITEM_FIELDS: Readonly<Record<string, Field>>;
272
281
  /**
273
282
  * Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
274
283
  * Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
@@ -19,7 +19,9 @@
19
19
  * Nummer, Summen — ist bewusst **nicht** setzbar.
20
20
  */
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.INVOICE_AT_LEAST_ONE = exports.INVOICE_EXACTLY_ONE = exports.INVOICE_REQUESTS = exports.PAYMENT_FIELDS = exports.ITEM_PRICE_EXACTLY_ONE = exports.ITEM_FIELDS = exports.CUSTOMER_FIELDS = exports.INVOICE_SETUP_REQUIREMENTS = exports.INVOICE_UNIT_CODES = exports.INVOICE_UNITS = exports.INVOICE_NOTICE_CODES = exports.INVOICE_PAYMENT_METHODS = exports.INVOICE_LANGUAGES = exports.WRITE_OFF_REASON_CODES = exports.EINVOICE_MISSING_CODES = exports.EINVOICE_FORMATS = exports.DOC_TYPES = exports.INVOICE_LIST_STATUS = exports.CUSTOMER_TYPES = exports.VAT_RATES = exports.PRICE_MODES = exports.ITEM_KINDS = exports.REVERSE_CHARGE_REASONS = exports.TAX_SCHEMES = exports.CREDIT_NOTE_REASONS = exports.INVOICE_REQUEST_ERROR_CODES = exports.INVOICE_ERROR_CODES = exports.INVOICE_ENDPOINTS = exports.INVOICE_CONTRACT_VERSION = void 0;
22
+ exports.INVOICE_AT_LEAST_ONE = exports.INVOICE_EXACTLY_ONE = exports.INVOICE_REQUESTS = exports.PAYMENT_FIELDS = exports.CREDIT_NOTE_ITEM_FIELDS = exports.ITEM_PRICE_EXACTLY_ONE = exports.ITEM_FIELDS = exports.CUSTOMER_FIELDS = exports.INVOICE_SETUP_REQUIREMENTS = exports.INVOICE_UNIT_CODES = exports.INVOICE_UNITS = exports.INVOICE_NOTICE_CODES = exports.INVOICE_PAYMENT_METHODS = exports.INVOICE_LANGUAGES = exports.WRITE_OFF_REASON_CODES = exports.EINVOICE_MISSING_CODES = exports.EINVOICE_FORMATS = exports.DOC_TYPES = exports.INVOICE_LIST_STATUS = exports.CUSTOMER_TYPES = exports.VAT_RATES = exports.PRICE_MODES = exports.ITEM_KINDS = exports.REVERSE_CHARGE_REASONS = exports.TAX_SCHEMES = exports.CREDIT_NOTE_REASONS = exports.INVOICE_REQUEST_ERROR_CODES = exports.INVOICE_ERROR_CODES = exports.INVOICE_ENDPOINTS = exports.INVOICE_CONTRACT_VERSION = exports.RETURN_DISPOSITIONS = void 0;
23
+ const cancellation_js_1 = require("../models/cancellation.js");
24
+ Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return cancellation_js_1.RETURN_DISPOSITIONS; } });
23
25
  exports.INVOICE_CONTRACT_VERSION = 2;
24
26
  exports.INVOICE_ENDPOINTS = [
25
27
  'createCustomer',
@@ -83,6 +85,7 @@ exports.INVOICE_ERROR_CODES = [
83
85
  exports.INVOICE_REQUEST_ERROR_CODES = [
84
86
  'account_not_found',
85
87
  'admin_required',
88
+ 'api_not_approved',
86
89
  'cashregister_not_assigned',
87
90
  'cashregister_not_found',
88
91
  'cashregister_token_invalid',
@@ -421,6 +424,13 @@ exports.ITEM_FIELDS = Object.freeze({
421
424
  unitPriceMicros: { type: 'integer', required: false, min: 0, max: 1_000_000_000_000 },
422
425
  vatRate: { type: 'enum', required: true, values: exports.VAT_RATES },
423
426
  discountPct: { type: 'number', required: false, min: 0, max: 100, decimals: 2 },
427
+ /**
428
+ * Artikel aus dem Artikelstamm (Lager-Kern Stufe 2): ist er bestandsgefuehrt
429
+ * und das Modul Lager aktiv, bucht das Ausstellen ihn ab -- danach, die
430
+ * Rechnung scheitert nie am Lager. Kein „/“, nicht „.“, „..“ oder „__…__“
431
+ * (prueft der Server, `validation`).
432
+ */
433
+ articleId: id,
424
434
  });
425
435
  /** Genau einer der beiden Preise je Position (§ 9.1). */
426
436
  exports.ITEM_PRICE_EXACTLY_ONE = Object.freeze([
@@ -436,6 +446,23 @@ const positionen = {
436
446
  type: 'object', required: true, fields: exports.ITEM_FIELDS, exactlyOne: exports.ITEM_PRICE_EXACTLY_ONE,
437
447
  },
438
448
  };
449
+ /** Rueckgabe-Wahl einer Gutschrift: Vorgabe des Aufrufs oder je Position. */
450
+ const returnDisposition = { type: 'enum', required: false, values: cancellation_js_1.RETURN_DISPOSITIONS };
451
+ /**
452
+ * Eine Gutschriftsposition: die Rechnungsposition plus `returnDisposition`
453
+ * (wohin die zurueckgenommene Ware geht). An einer Rechnungsposition weist der
454
+ * Server das Feld als unbekannt ab.
455
+ */
456
+ exports.CREDIT_NOTE_ITEM_FIELDS = Object.freeze({ ...exports.ITEM_FIELDS, returnDisposition });
457
+ const gutschriftPositionen = {
458
+ type: 'list',
459
+ required: true,
460
+ min: 1,
461
+ max: 500,
462
+ item: {
463
+ type: 'object', required: true, fields: exports.CREDIT_NOTE_ITEM_FIELDS, exactlyOne: exports.ITEM_PRICE_EXACTLY_ONE,
464
+ },
465
+ };
439
466
  /**
440
467
  * Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
441
468
  * Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
@@ -503,6 +530,12 @@ exports.INVOICE_REQUESTS = Object.freeze({
503
530
  language: { type: 'enum', required: false, values: exports.INVOICE_LANGUAGES },
504
531
  /** Marke (Kennung aus `listBrands`); sonst die Standardmarke. */
505
532
  brandId: id,
533
+ /**
534
+ * Lager-Standort, von dem bestandsgefuehrte Positionen abgebucht werden;
535
+ * sonst der Standard-Standort. Ein unbekannter oder aufgeloester Standort
536
+ * bucht am Standard-Standort und meldet ein Ereignis im Lager.
537
+ */
538
+ stockLocationId: id,
506
539
  /**
507
540
  * Schon bezahlt: die Zahlung entsteht in **derselben** Transaktion wie das
508
541
  * Festschreiben. Sonst gaebe es einen Moment, in dem die Rechnung offen ist
@@ -521,13 +554,17 @@ exports.INVOICE_REQUESTS = Object.freeze({
521
554
  invoiceId: idPflicht,
522
555
  reason: { type: 'enum', required: true, values: exports.CREDIT_NOTE_REASONS },
523
556
  note: text(2000),
557
+ /** Fuer alle bestandsgefuehrten Positionen; fehlt = `restock`. */
558
+ returnDisposition,
524
559
  },
525
560
  createCreditNote: {
526
561
  idempotencyKey: idempotencyKey(true),
527
562
  invoiceId: idPflicht,
528
563
  reason: { type: 'enum', required: true, values: exports.CREDIT_NOTE_REASONS },
529
564
  note: text(2000),
530
- items: positionen,
565
+ items: gutschriftPositionen,
566
+ /** Vorgabe fuer alle Positionen; je Position abweichend ueber `items[].returnDisposition`. */
567
+ returnDisposition,
531
568
  },
532
569
  getInvoice: {
533
570
  invoiceId: id,
@@ -23,6 +23,16 @@ export declare const CANCELLATION_REASONS: Readonly<{
23
23
  }>;
24
24
  export type CancellationReason = keyof typeof CANCELLATION_REASONS;
25
25
  export declare function isCancellationReason(value: unknown): value is CancellationReason;
26
+ /**
27
+ * Rueckgabe-Wahl beim Storno und bei der Gutschrift (Lager-Kern Stufe 2,
28
+ * Katalog `RUECKGABE` des Backends): `restock` zurueck ins Lager (Vorgabe des
29
+ * Servers), `defective` als defekt ins Lager, `disposed` entsorgt. Wirkt nur
30
+ * an Positionen mit `articleId`; alle anderen bucht der Server nie und meldet
31
+ * dafuer auch keinen Fehler.
32
+ */
33
+ export declare const RETURN_DISPOSITIONS: readonly ["restock", "defective", "disposed"];
34
+ export type ReturnDisposition = (typeof RETURN_DISPOSITIONS)[number];
35
+ export declare function isReturnDisposition(value: unknown): value is ReturnDisposition;
26
36
  /**
27
37
  * Stabile Fehlercodes von `cancelReceipt` unter `/v3` (Vokabular
28
38
  * `errorCodes.cancellation`, gleiche Reihenfolge). Das Backend legt sie bei
@@ -43,7 +53,7 @@ export declare function isCancellationReason(value: unknown): value is Cancellat
43
53
  * [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
44
54
  * `KasseneckApiError.code` lesbar.
45
55
  */
46
- 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", "account_not_found", "admin_required", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing", "response_unreadable"];
56
+ 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", "account_not_found", "admin_required", "api_not_approved", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing", "response_unreadable"];
47
57
  export type CancellationErrorCode = (typeof CANCELLATION_ERROR_CODES)[number];
48
58
  export declare function isCancellationErrorCode(value: unknown): value is CancellationErrorCode;
49
59
  /** Der Code eines geworfenen Fehlers, wenn er in [CANCELLATION_ERROR_CODES] steht; sonst `undefined`. */
@@ -67,10 +77,12 @@ export interface CancellationOf {
67
77
  */
68
78
  timeStamp?: string;
69
79
  }
70
- /** Eine stornierte Position: Index im Original und Menge. */
80
+ /** Eine stornierte Position: Index im Original und Menge, an Artikelzeilen die Rueckgabe-Wahl. */
71
81
  export interface CancellationItem {
72
82
  index: number;
73
83
  quantity: number;
84
+ /** Wohin die Ware dieser Position geht; fehlt = Vorgabe des Aufrufs bzw. `restock`. */
85
+ returnDisposition?: ReturnDisposition;
74
86
  }
75
87
  /**
76
88
  * Eintrag in `cancellations[]` am Original. `pending` = Reservierung, die
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_STATUSES = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_REASONS = void 0;
3
+ exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_STATUSES = exports.CANCELLATION_ERROR_CODES = exports.RETURN_DISPOSITIONS = exports.CANCELLATION_REASONS = void 0;
4
4
  exports.isCancellationReason = isCancellationReason;
5
+ exports.isReturnDisposition = isReturnDisposition;
5
6
  exports.isCancellationErrorCode = isCancellationErrorCode;
6
7
  exports.cancellationErrorCode = cancellationErrorCode;
7
8
  exports.isCancellationError = isCancellationError;
@@ -32,6 +33,17 @@ exports.CANCELLATION_REASONS = Object.freeze({
32
33
  function isCancellationReason(value) {
33
34
  return typeof value === 'string' && Object.prototype.hasOwnProperty.call(exports.CANCELLATION_REASONS, value);
34
35
  }
36
+ /**
37
+ * Rueckgabe-Wahl beim Storno und bei der Gutschrift (Lager-Kern Stufe 2,
38
+ * Katalog `RUECKGABE` des Backends): `restock` zurueck ins Lager (Vorgabe des
39
+ * Servers), `defective` als defekt ins Lager, `disposed` entsorgt. Wirkt nur
40
+ * an Positionen mit `articleId`; alle anderen bucht der Server nie und meldet
41
+ * dafuer auch keinen Fehler.
42
+ */
43
+ exports.RETURN_DISPOSITIONS = Object.freeze(['restock', 'defective', 'disposed']);
44
+ function isReturnDisposition(value) {
45
+ return typeof value === 'string' && exports.RETURN_DISPOSITIONS.includes(value);
46
+ }
35
47
  /**
36
48
  * Stabile Fehlercodes von `cancelReceipt` unter `/v3` (Vokabular
37
49
  * `errorCodes.cancellation`, gleiche Reihenfolge). Das Backend legt sie bei
@@ -72,9 +84,11 @@ exports.CANCELLATION_ERROR_CODES = Object.freeze([
72
84
  'cancellation_refund_reference_required', // Karten-Rueckzahlung ohne refundOf einer Kartenzahlung
73
85
  'cancellation_refund_reference_unknown', // refundOf nennt keine Zahlung des Originals
74
86
  'cancellation_outcome_unknown', // Ausgang unklar: nachlesen, nie wiederholen
87
+ 'invalid_return_disposition', // Rueckgabe-Wahl nicht restock, defective oder disposed (Lager)
75
88
  // Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
76
89
  'account_not_found',
77
90
  'admin_required',
91
+ 'api_not_approved',
78
92
  'cashregister_not_found',
79
93
  'cashregister_token_invalid',
80
94
  'cashregister_token_missing',
@@ -36,6 +36,8 @@ export interface Cashregister {
36
36
  token?: string;
37
37
  /** Zugeordnete Signatureinheit. */
38
38
  signatureId?: string;
39
+ /** Lager-Standort der Kasse (Lager-Kern Stufe 2); fehlt = Standard-Standort des Betriebs. */
40
+ stockLocationId?: string;
39
41
  onboarding: CashregisterOnboarding;
40
42
  }
41
43
  /**
@@ -58,6 +60,7 @@ export interface CashregisterPayload {
58
60
  description?: string | null;
59
61
  create_time?: string | null;
60
62
  signature_id?: string | null;
63
+ stockLocationId?: string | null;
61
64
  token?: string | null;
62
65
  onboarding?: CashregisterOnboardingPayload | null;
63
66
  }
@@ -16,6 +16,7 @@ function fromCashregisterPayload(payload, id) {
16
16
  ...zeitfeld('createTime', payload.create_time),
17
17
  ...(payload.token ? { token: payload.token } : {}),
18
18
  ...(payload.signature_id ? { signatureId: payload.signature_id } : {}),
19
+ ...(payload.stockLocationId ? { stockLocationId: payload.stockLocationId } : {}),
19
20
  onboarding: {
20
21
  cashboxRegistered: ob.cashbox_registered === true,
21
22
  startReceiptCreated: ob.start_receipt_created === true,
@@ -1,7 +1,7 @@
1
1
  export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, } from './receipt-item.js';
2
2
  export { type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid } from './voucher.js';
3
3
  export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, } from './receipt.js';
4
- export { type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, remainingQuantities, } from './cancellation.js';
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, } from './cancellation.js';
5
5
  export { type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
6
6
  export { type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError } from './payment-errors.js';
7
7
  export { type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, } from './receipt-email.js';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.remainingQuantities = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.receiptSumCents = exports.receiptSubSumCents = exports.readRegistrationInfo = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isDiscountItem = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = void 0;
4
- exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = void 0;
3
+ exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.remainingQuantities = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptSumCents = exports.receiptSubSumCents = exports.readRegistrationInfo = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isDiscountItem = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = void 0;
4
+ exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = void 0;
5
5
  var receipt_item_js_1 = require("./receipt-item.js");
6
6
  Object.defineProperty(exports, "toReceiptItemPayload", { enumerable: true, get: function () { return receipt_item_js_1.toReceiptItemPayload; } });
7
7
  Object.defineProperty(exports, "fromReceiptItemPayload", { enumerable: true, get: function () { return receipt_item_js_1.fromReceiptItemPayload; } });
@@ -21,11 +21,13 @@ Object.defineProperty(exports, "readRegistrationInfo", { enumerable: true, get:
21
21
  Object.defineProperty(exports, "receiptSubSumCents", { enumerable: true, get: function () { return receipt_js_1.receiptSubSumCents; } });
22
22
  Object.defineProperty(exports, "receiptSumCents", { enumerable: true, get: function () { return receipt_js_1.receiptSumCents; } });
23
23
  var cancellation_js_1 = require("./cancellation.js");
24
+ Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return cancellation_js_1.RETURN_DISPOSITIONS; } });
24
25
  Object.defineProperty(exports, "CANCELLATION_REASONS", { enumerable: true, get: function () { return cancellation_js_1.CANCELLATION_REASONS; } });
25
26
  Object.defineProperty(exports, "CANCELLATION_STATUSES", { enumerable: true, get: function () { return cancellation_js_1.CANCELLATION_STATUSES; } });
26
27
  Object.defineProperty(exports, "CANCELLATION_ERROR_CODES", { enumerable: true, get: function () { return cancellation_js_1.CANCELLATION_ERROR_CODES; } });
27
28
  Object.defineProperty(exports, "CANCELLATION_RESERVATION_MS", { enumerable: true, get: function () { return cancellation_js_1.CANCELLATION_RESERVATION_MS; } });
28
29
  Object.defineProperty(exports, "isCancellationReason", { enumerable: true, get: function () { return cancellation_js_1.isCancellationReason; } });
30
+ Object.defineProperty(exports, "isReturnDisposition", { enumerable: true, get: function () { return cancellation_js_1.isReturnDisposition; } });
29
31
  Object.defineProperty(exports, "isCancellationErrorCode", { enumerable: true, get: function () { return cancellation_js_1.isCancellationErrorCode; } });
30
32
  Object.defineProperty(exports, "cancellationErrorCode", { enumerable: true, get: function () { return cancellation_js_1.cancellationErrorCode; } });
31
33
  Object.defineProperty(exports, "isCancellationError", { enumerable: true, get: function () { return cancellation_js_1.isCancellationError; } });
@@ -19,7 +19,7 @@ import { KasseneckApiError } from '../client/errors.js';
19
19
  * ...) und zuletzt `route_missing` (Code des Pakets). Ein Code ausserhalb
20
20
  * bleibt ueber `KasseneckApiError.code` lesbar.
21
21
  */
22
- export declare const PAYMENT_ERROR_CODES: readonly ["payments_invalid", "payment_method_invalid", "payment_amount_invalid", "payment_tendered_invalid", "payment_provider_invalid", "payment_provider_not_allowed", "payments_sum_mismatch", "payments_due_negative", "payments_not_allowed", "payments_conflict", "payments_required", "payment_method_not_supported", "tip_payment_method_invalid", "tip_payment_method_required", "tip_exceeds_payment", "payment_refund_not_allowed", "payment_tip_invalid", "tip_conflict", "account_not_found", "admin_required", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
22
+ export declare const PAYMENT_ERROR_CODES: readonly ["payments_invalid", "payment_method_invalid", "payment_amount_invalid", "payment_tendered_invalid", "payment_provider_invalid", "payment_provider_not_allowed", "payments_sum_mismatch", "payments_due_negative", "payments_not_allowed", "payments_conflict", "payments_required", "payment_method_not_supported", "tip_payment_method_invalid", "tip_payment_method_required", "tip_exceeds_payment", "payment_refund_not_allowed", "payment_tip_invalid", "tip_conflict", "account_not_found", "admin_required", "api_not_approved", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
23
23
  export type PaymentErrorCode = (typeof PAYMENT_ERROR_CODES)[number];
24
24
  /** Erkennt einen Code aus [PAYMENT_ERROR_CODES], exakt (klein, wie unter `/v3`). */
25
25
  export declare function isPaymentErrorCode(value: unknown): value is PaymentErrorCode;
@@ -48,6 +48,7 @@ exports.PAYMENT_ERROR_CODES = Object.freeze([
48
48
  // Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
49
49
  'account_not_found',
50
50
  'admin_required',
51
+ 'api_not_approved',
51
52
  'cashregister_not_assigned',
52
53
  'cashregister_not_found',
53
54
  'cashregister_token_invalid',
@@ -11,7 +11,7 @@ export type ReceiptEmailSendErrorCode = (typeof RECEIPT_EMAIL_SEND_ERROR_CODES)[
11
11
  * als [KasseneckApiError.code] durch; ein Code ausserhalb bleibt dort lesbar.
12
12
  * Zuletzt `route_missing` (Code des Pakets).
13
13
  */
14
- export declare const RECEIPT_EMAIL_ERROR_CODES: readonly ["invalid_address", "receipt_not_found", "too_many_requests", "send_failed", "account_not_found", "admin_required", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
14
+ export declare const RECEIPT_EMAIL_ERROR_CODES: readonly ["invalid_address", "receipt_not_found", "too_many_requests", "send_failed", "account_not_found", "admin_required", "api_not_approved", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
15
15
  export type ReceiptEmailErrorCode = (typeof RECEIPT_EMAIL_ERROR_CODES)[number];
16
16
  export declare function isReceiptEmailErrorCode(value: unknown): value is ReceiptEmailErrorCode;
17
17
  /** Der Code eines geworfenen Fehlers, wenn er in [RECEIPT_EMAIL_ERROR_CODES] steht; sonst `undefined`. */
@@ -27,6 +27,7 @@ exports.RECEIPT_EMAIL_ERROR_CODES = Object.freeze([
27
27
  // Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
28
28
  'account_not_found',
29
29
  'admin_required',
30
+ 'api_not_approved',
30
31
  'cashregister_not_assigned',
31
32
  'cashregister_not_found',
32
33
  'cashregister_token_invalid',
@@ -16,7 +16,7 @@ import { KasseneckApiError } from '../client/errors.js';
16
16
  * ...) stehen in [PAYMENT_ERROR_CODES]. Ein Code ausserhalb bleibt ueber
17
17
  * `KasseneckApiError.code` lesbar.
18
18
  */
19
- export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "module_inactive", "not_permitted", "receipt_limit_exceeded", "receipt_not_found", "receipt_outcome_unknown", "receipt_type_invalid", "signature_incomplete", "signature_missing", "signing_failed", "small_business_vat_not_allowed", "tip_invalid", "tip_not_allowed", "tip_recipient_unknown", "validation", "account_not_found", "admin_required", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing", "response_unreadable"];
19
+ export declare const RECEIPT_ERROR_CODES: readonly ["cancellation_reference_unavailable", "cashregister_closed", "cashregister_decommissioned", "final_receipt_expired", "final_receipt_not_allowed", "module_inactive", "not_permitted", "receipt_limit_exceeded", "receipt_not_found", "receipt_outcome_unknown", "receipt_type_invalid", "signature_incomplete", "signature_missing", "signing_failed", "small_business_vat_not_allowed", "tip_invalid", "tip_not_allowed", "tip_recipient_unknown", "validation", "account_not_found", "admin_required", "api_not_approved", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "method_not_allowed", "mfa_required", "not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "route_missing", "response_unreadable"];
20
20
  export type ReceiptErrorCode = (typeof RECEIPT_ERROR_CODES)[number];
21
21
  export declare function isReceiptErrorCode(value: unknown): value is ReceiptErrorCode;
22
22
  /** Der Code eines geworfenen Fehlers, wenn er in [RECEIPT_ERROR_CODES] steht; sonst `undefined`. */
@@ -46,6 +46,7 @@ exports.RECEIPT_ERROR_CODES = Object.freeze([
46
46
  // Anmeldung und Rand (errorCodes.auth ohne Partner-Zugang, errorCodes.edge)
47
47
  'account_not_found',
48
48
  'admin_required',
49
+ 'api_not_approved',
49
50
  'cashregister_not_assigned',
50
51
  'cashregister_not_found',
51
52
  'cashregister_token_invalid',
@@ -1,4 +1,5 @@
1
1
  import { VatRate } from '../enums/index.js';
2
+ import { type ReturnDisposition } from './cancellation.js';
2
3
  /**
3
4
  * Belegposition — Zwilling von `KasseneckItem` in
4
5
  * kasseneck_api/lib/models/kasseneck_item.dart.
@@ -50,6 +51,10 @@ export interface ReceiptItem {
50
51
  * im Bericht. Optional; Handeingaben haben keinen.
51
52
  */
52
53
  articleId?: string;
54
+ /** Nur an Storno-Zeilen mit `articleId`: Index der Position im Original. */
55
+ originalIndex?: number;
56
+ /** Nur an Storno-Zeilen mit `articleId`: wohin die Ware ging (Lager-Kern Stufe 2). */
57
+ returnDisposition?: ReturnDisposition;
53
58
  }
54
59
  /** Empfaenger einer Trinkgeld-Position (Kassen-Benutzer, Snapshot des Namens). */
55
60
  export interface TipRecipient {
@@ -117,6 +122,10 @@ export interface ReceiptItemPayloadRead {
117
122
  vat?: number | null;
118
123
  /** Artikel-Verweis, siehe [ReceiptItem.articleId]. */
119
124
  articleId?: string | null;
125
+ /** Storno-Zeile mit `articleId`: Index im Original, siehe [ReceiptItem.originalIndex]. */
126
+ originalIndex?: number | null;
127
+ /** Storno-Zeile mit `articleId`: Rueckgabe-Wahl, siehe [ReceiptItem.returnDisposition]. */
128
+ returnDisposition?: string | null;
120
129
  }
121
130
  export declare function toReceiptItemPayload(item: ReceiptItem): ReceiptItemPayload;
122
131
  /**
@@ -9,6 +9,7 @@ exports.receiptItemIsValid = receiptItemIsValid;
9
9
  exports.negateReceiptItem = negateReceiptItem;
10
10
  const index_js_1 = require("../enums/index.js");
11
11
  const enum_payload_js_1 = require("./enum-payload.js");
12
+ const cancellation_js_1 = require("./cancellation.js");
12
13
  /** Trinkgeld-Position? Die eine Erkennungsstelle — niemand prueft `kind` selbst. */
13
14
  function isTipItem(item) {
14
15
  return item != null && item.kind === 'tip';
@@ -89,6 +90,10 @@ function fromReceiptItemPayload(payload) {
89
90
  : {}),
90
91
  // Artikel-Verweis erhalten (Storno-Spiegelung schreibt ihn wieder mit).
91
92
  ...(typeof payload.articleId === 'string' && payload.articleId !== '' ? { articleId: payload.articleId } : {}),
93
+ // Lager: Bezug und Rueckgabe-Wahl einer Storno-Zeile (nur gelesen; ein
94
+ // unbekannter Wert faellt weg wie am Rand des Servers).
95
+ ...(Number.isInteger(payload.originalIndex) && payload.originalIndex >= 0 ? { originalIndex: payload.originalIndex } : {}),
96
+ ...((0, cancellation_js_1.isReturnDisposition)(payload.returnDisposition) ? { returnDisposition: payload.returnDisposition } : {}),
92
97
  };
93
98
  }
94
99
  /** Erster brauchbarer Zahlenwert der Reihe; `null`/`undefined`/NaN zaehlen nicht. */
@@ -1,7 +1,7 @@
1
1
  import { ReceiptType, KeckPaymentMethod, CreditCardProvider } from '../enums/index.js';
2
2
  import { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead } from './receipt-item.js';
3
3
  import { type Voucher, type VoucherPayload } from './voucher.js';
4
- import type { Cancellation, CancellationOf, CancellationReason } from './cancellation.js';
4
+ import { type Cancellation, type CancellationOf, type CancellationReason } from './cancellation.js';
5
5
  import { type ZeroKind } from './receipt-summary.js';
6
6
  import { type ReceiptPayment, type ReceiptPaymentPayload } from './receipt-payment.js';
7
7
  /**
@@ -9,6 +9,7 @@ const index_js_1 = require("../enums/index.js");
9
9
  const enum_payload_js_1 = require("./enum-payload.js");
10
10
  const receipt_item_js_1 = require("./receipt-item.js");
11
11
  const voucher_js_1 = require("./voucher.js");
12
+ const cancellation_js_1 = require("./cancellation.js");
12
13
  const receipt_summary_js_1 = require("./receipt-summary.js");
13
14
  const receipt_payment_js_1 = require("./receipt-payment.js");
14
15
  /**
@@ -107,7 +108,11 @@ function leseStorno(eintrag) {
107
108
  at: Number(eintrag.at ?? 0),
108
109
  by: eintrag.by ?? null,
109
110
  note: eintrag.note ?? null,
110
- items: (eintrag.items ?? []).map((p) => ({ index: Number(p.index), quantity: Number(p.quantity) })),
111
+ items: (eintrag.items ?? []).map((p) => ({
112
+ index: Number(p.index),
113
+ quantity: Number(p.quantity),
114
+ ...((0, cancellation_js_1.isReturnDisposition)(p.returnDisposition) ? { returnDisposition: p.returnDisposition } : {}),
115
+ })),
111
116
  ...(eintrag.promoAdjustmentCents && typeof eintrag.promoAdjustmentCents === 'object'
112
117
  ? { promoAdjustmentCents: Object.fromEntries(Object.entries(eintrag.promoAdjustmentCents).map(([k, v]) => [k, Number(v)])) }
113
118
  : {}),
@@ -64,6 +64,14 @@ export interface PosArticle {
64
64
  askQuantity: boolean | null;
65
65
  /** Hoechstmenge je Beleg (bei kg/l/m auch Kommazahl); null = keine Grenze. */
66
66
  maxQuantity: number | null;
67
+ /**
68
+ * Standorte, an denen der Artikel gefuehrt wird (Lager-Kern Stufe 2, innen
69
+ * `standorte`); `null`, wenn der Artikel keine Angabe traegt. Wie die Kasse
70
+ * daraus Kacheln filtert, entscheidet die Oberflaeche. Optional, damit
71
+ * bestehende Literale von Verbrauchern weiter uebersetzen; der Leser
72
+ * (`fromPosArticlePayload`) setzt das Feld immer (`null` oder Liste).
73
+ */
74
+ stockLocationIds?: string[] | null;
67
75
  }
68
76
  /** Deckelt eine gewuenschte Menge an der Hoechstmenge des Artikels (null = keine Grenze). */
69
77
  export declare function allowedQuantity(a: Pick<PosArticle, 'maxQuantity'>, wanted: number): number;
@@ -84,7 +92,13 @@ export interface PosArticlePayload {
84
92
  quantityRule?: string | null;
85
93
  askQuantity?: boolean | null;
86
94
  maxQuantity?: number | null;
95
+ stockLocationIds?: string[] | null;
87
96
  }
88
97
  export declare function fromPosArticlePayload(p: PosArticlePayload): PosArticle;
98
+ /**
99
+ * Die Liste `data.<feld>` einer Antwort, jedes Element durch `lesen` (mit
100
+ * seinem Index fuer Fehlermeldungen). Paketintern: auch `lager.ts` liest so.
101
+ */
102
+ export declare function liste<T>(daten: unknown, feld: string, name: string, lesen: (e: unknown, index: number) => T): T[];
89
103
  export declare function listMyArticleGroups(transport: InternerTransport): Promise<ArticleGroup[]>;
90
104
  export declare function listMyArticles(transport: InternerTransport): Promise<PosArticle[]>;
@@ -6,6 +6,7 @@ exports.quantityRuleForUnit = quantityRuleForUnit;
6
6
  exports.quantityDefaults = quantityDefaults;
7
7
  exports.allowedQuantity = allowedQuantity;
8
8
  exports.fromPosArticlePayload = fromPosArticlePayload;
9
+ exports.liste = liste;
9
10
  exports.listMyArticleGroups = listMyArticleGroups;
10
11
  exports.listMyArticles = listMyArticles;
11
12
  const errors_js_1 = require("../client/errors.js");
@@ -70,14 +71,24 @@ function fromPosArticlePayload(p) {
70
71
  quantityRule: p.quantityRule === 'piece' || p.quantityRule === 'decimal' ? p.quantityRule : null,
71
72
  askQuantity: typeof p.askQuantity === 'boolean' ? p.askQuantity : null,
72
73
  maxQuantity: typeof p.maxQuantity === 'number' && Number.isFinite(p.maxQuantity) && p.maxQuantity > 0 ? p.maxQuantity : null,
74
+ stockLocationIds: Array.isArray(p.stockLocationIds)
75
+ ? p.stockLocationIds.filter((s) => typeof s === 'string' && s !== '')
76
+ : null,
73
77
  };
74
78
  }
79
+ /**
80
+ * Die Liste `data.<feld>` einer Antwort, jedes Element durch `lesen` (mit
81
+ * seinem Index fuer Fehlermeldungen). Paketintern: auch `lager.ts` liest so.
82
+ */
75
83
  function liste(daten, feld, name, lesen) {
76
84
  const roh = daten?.[feld];
77
85
  if (!Array.isArray(roh)) {
78
- throw new errors_js_1.KasseneckValidationError(name, `Antwort enthaelt keine Liste (data.${feld} fehlt)`, 'response');
86
+ const grund = roh === undefined || roh === null
87
+ ? `Antwort enthaelt keine Liste (data.${feld} fehlt)`
88
+ : `Antwort ist unbrauchbar (data.${feld} ist keine Liste)`;
89
+ throw new errors_js_1.KasseneckValidationError(name, grund, 'response');
79
90
  }
80
- return roh.map((e) => lesen(typeof e === 'object' && e !== null ? e : {}));
91
+ return roh.map((e, i) => lesen(typeof e === 'object' && e !== null ? e : {}, i));
81
92
  }
82
93
  async function listMyArticleGroups(transport) {
83
94
  const daten = await transport('listMyArticleGroups');