@kreiseck/kasseneck-api 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ Was vor 0.7.0 geschah, steht in der Commit-Historie (`git log`); ab hier wird
4
4
  es hier geführt. Ein Eintrag nennt die Änderung **und ihren Grund** —
5
5
  nur der Grund überlebt den nächsten Umbau.
6
6
 
7
+ ## 0.32.0
8
+
9
+ Vertragsgleichstand mit dem Backend für Lager-Kern Stufe 2. Das Backend vendort nur die 0.x-Linie und
10
+ prüft daran seine Zwillingstests; darum kommen hier genau die Teile hinzu, die es dafür braucht – kein
11
+ neuer Aufruf, kein neues Verhalten der Kasse. Die Kassen-Aufrufe des Lagers gibt es nur in 1.x (ab 1.2.0).
12
+
13
+ - **Storno-Code `rueckgabe_ungueltig`** am Ende von `CANCELLATION_ERROR_CODES` (Zwilling von
14
+ `STORNO_FEHLERCODES`; unter `/v3` `invalid_return_disposition`). Grund: das Backend weist eine
15
+ Rückgabe-Wahl außerhalb von `lager|defekt|entsorgt` mit diesem Code ab, und die Kasse entscheidet am Code.
16
+ - **Rechnungs-API:** `items[].articleId`, `stockLocationId` an `issueInvoice`, `returnDisposition`
17
+ (`restock|defective|disposed`) an `cancelInvoice` und `createCreditNote`, dort auch je Position
18
+ (`CreditNoteItemInput`, `GUTSCHRIFT_POSITION_FELDER`); Schema `fixtures/rechnung-api.schema.json` und
19
+ sechs Beispiele. Grund: das Backend nimmt die Felder seit Stufe 2 an und vergleicht sein Schema in beide
20
+ Richtungen mit dem vendorierten.
21
+
7
22
  ## 0.31.0
8
23
 
9
24
  Texte und Einstellung für „Getrennt zahlen" an der Kasse (ein Tisch zahlt in Teilen, ein Beleg mit
@@ -41,7 +41,7 @@ export declare function isCancellationReason(value: unknown): value is Cancellat
41
41
  * diese Namen kommen mit der Umstellung des Pakets auf `/v3`.
42
42
  * [isCancellationErrorCode] prueft darum exakt.
43
43
  */
44
- export declare const CANCELLATION_ERROR_CODES: readonly ["beleg_nicht_gefunden", "belegart_nicht_stornierbar", "trainingsbeleg", "bereits_storniert", "position_ungueltig", "menge_ueber_rest", "grund_unbekannt", "anmerkung_zu_lang", "items_ungueltig", "kasse_nicht_zugewiesen", "keine_berechtigung", "nur_eigene_belege", "kasse_unvollstaendig", "storno_fehlgeschlagen", "STORNO_PAYMENTS_REQUIRED", "STORNO_REFUND_EXCEEDS_PAYMENT", "STORNO_REFUND_REFERENCE_REQUIRED", "STORNO_REFUND_REFERENCE_UNKNOWN", "STORNO_OUTCOME_UNKNOWN"];
44
+ export declare const CANCELLATION_ERROR_CODES: readonly ["beleg_nicht_gefunden", "belegart_nicht_stornierbar", "trainingsbeleg", "bereits_storniert", "position_ungueltig", "menge_ueber_rest", "grund_unbekannt", "anmerkung_zu_lang", "items_ungueltig", "kasse_nicht_zugewiesen", "keine_berechtigung", "nur_eigene_belege", "kasse_unvollstaendig", "storno_fehlgeschlagen", "STORNO_PAYMENTS_REQUIRED", "STORNO_REFUND_EXCEEDS_PAYMENT", "STORNO_REFUND_REFERENCE_REQUIRED", "STORNO_REFUND_REFERENCE_UNKNOWN", "STORNO_OUTCOME_UNKNOWN", "rueckgabe_ungueltig"];
45
45
  export type CancellationErrorCode = (typeof CANCELLATION_ERROR_CODES)[number];
46
46
  export declare function isCancellationErrorCode(value: unknown): value is CancellationErrorCode;
47
47
  /** Bezug eines Storno-Belegs auf sein Original. */
@@ -68,6 +68,7 @@ exports.CANCELLATION_ERROR_CODES = [
68
68
  'STORNO_REFUND_REFERENCE_REQUIRED', // Karten-Rueckzahlung ohne refundOf einer Kartenzahlung
69
69
  'STORNO_REFUND_REFERENCE_UNKNOWN', // refundOf nennt keine Zahlung des Originals
70
70
  'STORNO_OUTCOME_UNKNOWN', // Ausgang offen: Storno-Beleg evtl. schon signiert, nicht wiederholen
71
+ 'rueckgabe_ungueltig', // Lager-Kern Stufe 2: Rueckgabe-Wahl nicht lager, defekt oder entsorgt
71
72
  ];
72
73
  function isCancellationErrorCode(value) {
73
74
  return typeof value === 'string' && exports.CANCELLATION_ERROR_CODES.includes(value);
@@ -14,8 +14,8 @@ export { createRechnungApi, type RechnungApi, type RechnungApiOptions } from './
14
14
  export { rechnungKeyAuth, type RechnungKeyAuthOptions } from './auth.js';
15
15
  export { istRechnungFehler, rechnungFehlerCode, rechnungFeldFehler, type RechnungFeldFehler, } from './fehler.js';
16
16
  export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, previewInvoice, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
17
- export type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, InvoiceNotice, InvoicePayment, InvoicePreview, InvoiceRateTotals, IssueInvoiceRequest, IssueResult, PaymentInput, PreviewResult, RecordPaymentRequest, RecordPaymentResult, } from './typen.js';
17
+ export type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteItemInput, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, InvoiceNotice, InvoicePayment, InvoicePreview, InvoiceRateTotals, IssueInvoiceRequest, IssueResult, PaymentInput, PreviewResult, RecordPaymentRequest, RecordPaymentResult, } from './typen.js';
18
18
  export { RECHNUNG_TEXTE, rechnungText, type RechnungTextSchluessel } from './texte.js';
19
19
  export { rechnungSummen, STEUERFREIE_FAELLE, type SummenPosition } from './summen.js';
20
20
  export { anteiligerPreis, BETRAG_GRENZE_CENTS, positionAusEuro, preisText, RechenFehler, rechnungRechnen, rund, satzSchluessel, satzText, type RechenErgebnis, type RechenFehlerCode, type RechenOptionen, type RechenPosition, type SatzSumme, type Umwandlung, type UmwandlungsGrund, type ZeilenBetrag, } from './rechnen.js';
21
- export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, POSITION_PREIS_GENAU_EINS, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, type RechnungAufruf, type InvoiceErrorCode, type CreditNoteReason, type TaxScheme, type PriceMode, type VatRatePercent, type CustomerType, type InvoiceListStatus, type DocType, type EInvoiceFormat, type InvoiceLanguage, type InvoicePaymentMethod, type ItemKind, type ReverseChargeReason, type InvoiceNoticeCode, type InvoiceUnit, type InvoiceSetupRequirement, type Format, type Feld, } from './vertrag.js';
21
+ export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, GUTSCHRIFT_POSITION_FELDER, RETURN_DISPOSITIONS, POSITION_PREIS_GENAU_EINS, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, type RechnungAufruf, type InvoiceErrorCode, type CreditNoteReason, type TaxScheme, type PriceMode, type VatRatePercent, type CustomerType, type InvoiceListStatus, type DocType, type EInvoiceFormat, type InvoiceLanguage, type InvoicePaymentMethod, type ItemKind, type ReverseChargeReason, type InvoiceNoticeCode, type InvoiceUnit, type ReturnDisposition, type InvoiceSetupRequirement, type Format, type Feld, } from './vertrag.js';
@@ -13,7 +13,7 @@
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.INVOICE_UNITS = exports.INVOICE_NOTICE_CODES = exports.REVERSE_CHARGE_REASONS = exports.ITEM_KINDS = exports.INVOICE_PAYMENT_METHODS = exports.INVOICE_LANGUAGES = exports.EINVOICE_FORMATS = exports.DOC_TYPES = exports.INVOICE_LIST_STATUS = exports.CUSTOMER_TYPES = exports.VAT_RATES = exports.PRICE_MODES = exports.TAX_SCHEMES = exports.CREDIT_NOTE_REASONS = exports.INVOICE_ERROR_CODES = exports.RECHNUNG_AUFRUFE = exports.RECHNUNG_VERTRAG_VERSION = exports.satzText = exports.satzSchluessel = exports.rund = exports.rechnungRechnen = exports.RechenFehler = exports.preisText = exports.positionAusEuro = exports.BETRAG_GRENZE_CENTS = exports.anteiligerPreis = exports.STEUERFREIE_FAELLE = exports.rechnungSummen = exports.rechnungText = exports.RECHNUNG_TEXTE = exports.updateCustomer = exports.searchCustomers = exports.recordInvoicePayment = exports.previewInvoice = exports.listInvoices = exports.listBrands = exports.issueInvoice = exports.getInvoiceXml = exports.getInvoiceSetupStatus = exports.getInvoicePdf = exports.getInvoice = exports.getCustomer = exports.createCustomer = exports.createCreditNote = exports.cancelInvoice = exports.rechnungFeldFehler = exports.rechnungFehlerCode = exports.istRechnungFehler = exports.rechnungKeyAuth = exports.createRechnungApi = void 0;
16
- exports.RECHNUNG_MINDESTENS_EINS = exports.RECHNUNG_GENAU_EINS = exports.RECHNUNG_ANFRAGEN = exports.POSITION_PREIS_GENAU_EINS = exports.POSITION_FELDER = exports.KUNDE_FELDER = exports.INVOICE_SETUP_REQUIREMENTS = exports.RECHNUNG_EINHEITEN_CODES = void 0;
16
+ exports.RECHNUNG_MINDESTENS_EINS = exports.RECHNUNG_GENAU_EINS = exports.RECHNUNG_ANFRAGEN = exports.POSITION_PREIS_GENAU_EINS = exports.RETURN_DISPOSITIONS = exports.GUTSCHRIFT_POSITION_FELDER = exports.POSITION_FELDER = exports.KUNDE_FELDER = exports.INVOICE_SETUP_REQUIREMENTS = exports.RECHNUNG_EINHEITEN_CODES = void 0;
17
17
  var api_js_1 = require("./api.js");
18
18
  Object.defineProperty(exports, "createRechnungApi", { enumerable: true, get: function () { return api_js_1.createRechnungApi; } });
19
19
  var auth_js_1 = require("./auth.js");
@@ -76,6 +76,8 @@ Object.defineProperty(exports, "RECHNUNG_EINHEITEN_CODES", { enumerable: true, g
76
76
  Object.defineProperty(exports, "INVOICE_SETUP_REQUIREMENTS", { enumerable: true, get: function () { return vertrag_js_1.INVOICE_SETUP_REQUIREMENTS; } });
77
77
  Object.defineProperty(exports, "KUNDE_FELDER", { enumerable: true, get: function () { return vertrag_js_1.KUNDE_FELDER; } });
78
78
  Object.defineProperty(exports, "POSITION_FELDER", { enumerable: true, get: function () { return vertrag_js_1.POSITION_FELDER; } });
79
+ Object.defineProperty(exports, "GUTSCHRIFT_POSITION_FELDER", { enumerable: true, get: function () { return vertrag_js_1.GUTSCHRIFT_POSITION_FELDER; } });
80
+ Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return vertrag_js_1.RETURN_DISPOSITIONS; } });
79
81
  Object.defineProperty(exports, "POSITION_PREIS_GENAU_EINS", { enumerable: true, get: function () { return vertrag_js_1.POSITION_PREIS_GENAU_EINS; } });
80
82
  Object.defineProperty(exports, "RECHNUNG_ANFRAGEN", { enumerable: true, get: function () { return vertrag_js_1.RECHNUNG_ANFRAGEN; } });
81
83
  Object.defineProperty(exports, "RECHNUNG_GENAU_EINS", { enumerable: true, get: function () { return vertrag_js_1.RECHNUNG_GENAU_EINS; } });
@@ -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, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent } from './vertrag.js';
8
+ import type { CreditNoteReason, CustomerType, DocType, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, ReturnDisposition, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent } 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
@@ -228,6 +228,9 @@ export type Feld = {
228
228
  schluesselMuster: string;
229
229
  wertMax: number;
230
230
  };
231
+ /** Rueckgabe-Wahl einer Gutschrift (Lager-Kern Stufe 2), wie im Backend RUECKGABE_API. */
232
+ export declare const RETURN_DISPOSITIONS: readonly ["restock", "defective", "disposed"];
233
+ export type ReturnDisposition = (typeof RETURN_DISPOSITIONS)[number];
231
234
  /** Kunde, wie das Fremdsystem ihn schickt. `vatId` ist die UID-Nummer. */
232
235
  export declare const KUNDE_FELDER: Readonly<Record<string, Feld>>;
233
236
  /**
@@ -243,6 +246,8 @@ export declare const KUNDE_FELDER: Readonly<Record<string, Feld>>;
243
246
  export declare const POSITION_FELDER: Readonly<Record<string, Feld>>;
244
247
  /** Genau einer der beiden Preise je Position (§ 9.1). */
245
248
  export declare const POSITION_PREIS_GENAU_EINS: readonly (readonly string[])[];
249
+ /** Gutschriftsposition: Rechnungsposition plus Rueckgabe-Wahl (an der Rechnung weist der Server sie ab). */
250
+ export declare const GUTSCHRIFT_POSITION_FELDER: Readonly<Record<string, Feld>>;
246
251
  /**
247
252
  * Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
248
253
  * Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
@@ -19,7 +19,7 @@
19
19
  * Nummer, Summen — ist bewusst **nicht** setzbar.
20
20
  */
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.RECHNUNG_MINDESTENS_EINS = exports.RECHNUNG_GENAU_EINS = exports.RECHNUNG_ANFRAGEN = exports.PAYMENT_FELDER = exports.POSITION_PREIS_GENAU_EINS = exports.POSITION_FELDER = exports.KUNDE_FELDER = exports.INVOICE_SETUP_REQUIREMENTS = exports.RECHNUNG_EINHEITEN_CODES = exports.INVOICE_UNITS = exports.INVOICE_NOTICE_CODES = exports.INVOICE_PAYMENT_METHODS = exports.INVOICE_LANGUAGES = 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_ERROR_CODES = exports.RECHNUNG_AUFRUFE = exports.RECHNUNG_VERTRAG_VERSION = void 0;
22
+ exports.RECHNUNG_MINDESTENS_EINS = exports.RECHNUNG_GENAU_EINS = exports.RECHNUNG_ANFRAGEN = exports.PAYMENT_FELDER = exports.GUTSCHRIFT_POSITION_FELDER = exports.POSITION_PREIS_GENAU_EINS = exports.POSITION_FELDER = exports.KUNDE_FELDER = exports.RETURN_DISPOSITIONS = exports.INVOICE_SETUP_REQUIREMENTS = exports.RECHNUNG_EINHEITEN_CODES = exports.INVOICE_UNITS = exports.INVOICE_NOTICE_CODES = exports.INVOICE_PAYMENT_METHODS = exports.INVOICE_LANGUAGES = 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_ERROR_CODES = exports.RECHNUNG_AUFRUFE = exports.RECHNUNG_VERTRAG_VERSION = void 0;
23
23
  exports.RECHNUNG_VERTRAG_VERSION = 1;
24
24
  exports.RECHNUNG_AUFRUFE = [
25
25
  'createCustomer',
@@ -309,6 +309,9 @@ exports.INVOICE_SETUP_REQUIREMENTS = [
309
309
  const text = (max, pflicht = false, extra = {}) => ({ typ: 'string', pflicht, max, ...(pflicht && extra.min === undefined ? { min: 1 } : {}), ...extra });
310
310
  const idempotencyKey = (pflicht) => ({ typ: 'string', pflicht, min: 1, max: 120 });
311
311
  const id = { typ: 'string', pflicht: false, min: 1, max: 128 };
312
+ /** Rueckgabe-Wahl einer Gutschrift (Lager-Kern Stufe 2), wie im Backend RUECKGABE_API. */
313
+ exports.RETURN_DISPOSITIONS = ['restock', 'defective', 'disposed'];
314
+ const rueckgabe = { typ: 'enum', pflicht: false, werte: exports.RETURN_DISPOSITIONS };
312
315
  const idPflicht = { typ: 'string', pflicht: true, min: 1, max: 128 };
313
316
  const datum = (pflicht = false) => ({ typ: 'string', pflicht, min: 10, max: 10, format: 'date' });
314
317
  const limit = { typ: 'integer', pflicht: false, min: 1, max: 100 };
@@ -359,6 +362,13 @@ exports.POSITION_FELDER = Object.freeze({
359
362
  unitPriceMicros: { typ: 'integer', pflicht: false, min: 0, max: 1_000_000_000_000 },
360
363
  vatRate: { typ: 'enum', pflicht: true, werte: exports.VAT_RATES },
361
364
  discountPct: { typ: 'number', pflicht: false, min: 0, max: 100, nachkomma: 2 },
365
+ /**
366
+ * Artikel aus dem Artikelstamm (Lager-Kern Stufe 2): ist er bestandsgefuehrt
367
+ * und das Modul Lager aktiv, bucht das Ausstellen ihn ab -- danach, die
368
+ * Rechnung scheitert nie am Lager. Kein „/“, nicht „.“, „..“ oder „__…__“
369
+ * (prueft der Server, `validation`).
370
+ */
371
+ articleId: id,
362
372
  });
363
373
  /** Genau einer der beiden Preise je Position (§ 9.1). */
364
374
  exports.POSITION_PREIS_GENAU_EINS = Object.freeze([
@@ -374,6 +384,17 @@ const positionen = {
374
384
  typ: 'object', pflicht: true, felder: exports.POSITION_FELDER, genauEins: exports.POSITION_PREIS_GENAU_EINS,
375
385
  },
376
386
  };
387
+ /** Gutschriftsposition: Rechnungsposition plus Rueckgabe-Wahl (an der Rechnung weist der Server sie ab). */
388
+ exports.GUTSCHRIFT_POSITION_FELDER = Object.freeze({ ...exports.POSITION_FELDER, returnDisposition: rueckgabe });
389
+ const gutschriftPositionen = {
390
+ typ: 'list',
391
+ pflicht: true,
392
+ min: 1,
393
+ max: 500,
394
+ eintrag: {
395
+ typ: 'object', pflicht: true, felder: exports.GUTSCHRIFT_POSITION_FELDER, genauEins: exports.POSITION_PREIS_GENAU_EINS,
396
+ },
397
+ };
377
398
  /**
378
399
  * Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
379
400
  * Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
@@ -441,6 +462,8 @@ exports.RECHNUNG_ANFRAGEN = Object.freeze({
441
462
  language: { typ: 'enum', pflicht: false, werte: exports.INVOICE_LANGUAGES },
442
463
  /** Marke (Kennung aus `listBrands`); sonst die Standardmarke. */
443
464
  brandId: id,
465
+ /** Lagerstandort (Kennung), von dem bestandsgefuehrte Positionen abbuchen. */
466
+ stockLocationId: id,
444
467
  /**
445
468
  * Schon bezahlt: die Zahlung entsteht in **derselben** Transaktion wie das
446
469
  * Festschreiben. Sonst gaebe es einen Moment, in dem die Rechnung offen ist
@@ -459,13 +482,15 @@ exports.RECHNUNG_ANFRAGEN = Object.freeze({
459
482
  invoiceId: idPflicht,
460
483
  reason: { typ: 'enum', pflicht: true, werte: exports.CREDIT_NOTE_REASONS },
461
484
  note: text(2000),
485
+ returnDisposition: rueckgabe,
462
486
  },
463
487
  createCreditNote: {
464
488
  idempotencyKey: idempotencyKey(true),
465
489
  invoiceId: idPflicht,
466
490
  reason: { typ: 'enum', pflicht: true, werte: exports.CREDIT_NOTE_REASONS },
467
491
  note: text(2000),
468
- items: positionen,
492
+ returnDisposition: rueckgabe,
493
+ items: gutschriftPositionen,
469
494
  },
470
495
  getInvoice: {
471
496
  invoiceId: id,
@@ -41,7 +41,7 @@ export declare function isCancellationReason(value: unknown): value is Cancellat
41
41
  * diese Namen kommen mit der Umstellung des Pakets auf `/v3`.
42
42
  * [isCancellationErrorCode] prueft darum exakt.
43
43
  */
44
- export declare const CANCELLATION_ERROR_CODES: readonly ["beleg_nicht_gefunden", "belegart_nicht_stornierbar", "trainingsbeleg", "bereits_storniert", "position_ungueltig", "menge_ueber_rest", "grund_unbekannt", "anmerkung_zu_lang", "items_ungueltig", "kasse_nicht_zugewiesen", "keine_berechtigung", "nur_eigene_belege", "kasse_unvollstaendig", "storno_fehlgeschlagen", "STORNO_PAYMENTS_REQUIRED", "STORNO_REFUND_EXCEEDS_PAYMENT", "STORNO_REFUND_REFERENCE_REQUIRED", "STORNO_REFUND_REFERENCE_UNKNOWN", "STORNO_OUTCOME_UNKNOWN"];
44
+ export declare const CANCELLATION_ERROR_CODES: readonly ["beleg_nicht_gefunden", "belegart_nicht_stornierbar", "trainingsbeleg", "bereits_storniert", "position_ungueltig", "menge_ueber_rest", "grund_unbekannt", "anmerkung_zu_lang", "items_ungueltig", "kasse_nicht_zugewiesen", "keine_berechtigung", "nur_eigene_belege", "kasse_unvollstaendig", "storno_fehlgeschlagen", "STORNO_PAYMENTS_REQUIRED", "STORNO_REFUND_EXCEEDS_PAYMENT", "STORNO_REFUND_REFERENCE_REQUIRED", "STORNO_REFUND_REFERENCE_UNKNOWN", "STORNO_OUTCOME_UNKNOWN", "rueckgabe_ungueltig"];
45
45
  export type CancellationErrorCode = (typeof CANCELLATION_ERROR_CODES)[number];
46
46
  export declare function isCancellationErrorCode(value: unknown): value is CancellationErrorCode;
47
47
  /** Bezug eines Storno-Belegs auf sein Original. */
@@ -62,6 +62,7 @@ export const CANCELLATION_ERROR_CODES = [
62
62
  'STORNO_REFUND_REFERENCE_REQUIRED', // Karten-Rueckzahlung ohne refundOf einer Kartenzahlung
63
63
  'STORNO_REFUND_REFERENCE_UNKNOWN', // refundOf nennt keine Zahlung des Originals
64
64
  'STORNO_OUTCOME_UNKNOWN', // Ausgang offen: Storno-Beleg evtl. schon signiert, nicht wiederholen
65
+ 'rueckgabe_ungueltig', // Lager-Kern Stufe 2: Rueckgabe-Wahl nicht lager, defekt oder entsorgt
65
66
  ];
66
67
  export function isCancellationErrorCode(value) {
67
68
  return typeof value === 'string' && CANCELLATION_ERROR_CODES.includes(value);
@@ -14,8 +14,8 @@ export { createRechnungApi, type RechnungApi, type RechnungApiOptions } from './
14
14
  export { rechnungKeyAuth, type RechnungKeyAuthOptions } from './auth.js';
15
15
  export { istRechnungFehler, rechnungFehlerCode, rechnungFeldFehler, type RechnungFeldFehler, } from './fehler.js';
16
16
  export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoice, getInvoicePdf, getInvoiceSetupStatus, getInvoiceXml, issueInvoice, listBrands, listInvoices, previewInvoice, recordInvoicePayment, searchCustomers, updateCustomer, } from './endpunkte.js';
17
- export type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, InvoiceNotice, InvoicePayment, InvoicePreview, InvoiceRateTotals, IssueInvoiceRequest, IssueResult, PaymentInput, PreviewResult, RecordPaymentRequest, RecordPaymentResult, } from './typen.js';
17
+ export type { Brand, CancelInvoiceRequest, CancelResult, CreditNoteItemInput, CreditNoteRequest, CreditNoteResult, Customer, CustomerInput, CustomerPage, CustomerSearch, EInvoiceStatus, Invoice, InvoiceDetail, InvoiceItem, InvoiceItemInput, InvoiceListQuery, InvoicePage, InvoiceRecipient, InvoiceSetupGap, InvoiceSetupStatus, InvoiceTotals, InvoiceNotice, InvoicePayment, InvoicePreview, InvoiceRateTotals, IssueInvoiceRequest, IssueResult, PaymentInput, PreviewResult, RecordPaymentRequest, RecordPaymentResult, } from './typen.js';
18
18
  export { RECHNUNG_TEXTE, rechnungText, type RechnungTextSchluessel } from './texte.js';
19
19
  export { rechnungSummen, STEUERFREIE_FAELLE, type SummenPosition } from './summen.js';
20
20
  export { anteiligerPreis, BETRAG_GRENZE_CENTS, positionAusEuro, preisText, RechenFehler, rechnungRechnen, rund, satzSchluessel, satzText, type RechenErgebnis, type RechenFehlerCode, type RechenOptionen, type RechenPosition, type SatzSumme, type Umwandlung, type UmwandlungsGrund, type ZeilenBetrag, } from './rechnen.js';
21
- export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, POSITION_PREIS_GENAU_EINS, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, type RechnungAufruf, type InvoiceErrorCode, type CreditNoteReason, type TaxScheme, type PriceMode, type VatRatePercent, type CustomerType, type InvoiceListStatus, type DocType, type EInvoiceFormat, type InvoiceLanguage, type InvoicePaymentMethod, type ItemKind, type ReverseChargeReason, type InvoiceNoticeCode, type InvoiceUnit, type InvoiceSetupRequirement, type Format, type Feld, } from './vertrag.js';
21
+ export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, GUTSCHRIFT_POSITION_FELDER, RETURN_DISPOSITIONS, POSITION_PREIS_GENAU_EINS, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, type RechnungAufruf, type InvoiceErrorCode, type CreditNoteReason, type TaxScheme, type PriceMode, type VatRatePercent, type CustomerType, type InvoiceListStatus, type DocType, type EInvoiceFormat, type InvoiceLanguage, type InvoicePaymentMethod, type ItemKind, type ReverseChargeReason, type InvoiceNoticeCode, type InvoiceUnit, type ReturnDisposition, type InvoiceSetupRequirement, type Format, type Feld, } from './vertrag.js';
@@ -17,4 +17,4 @@ export { cancelInvoice, createCreditNote, createCustomer, getCustomer, getInvoic
17
17
  export { RECHNUNG_TEXTE, rechnungText } from './texte.js';
18
18
  export { rechnungSummen, STEUERFREIE_FAELLE } from './summen.js';
19
19
  export { anteiligerPreis, BETRAG_GRENZE_CENTS, positionAusEuro, preisText, RechenFehler, rechnungRechnen, rund, satzSchluessel, satzText, } from './rechnen.js';
20
- export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, POSITION_PREIS_GENAU_EINS, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, } from './vertrag.js';
20
+ export { RECHNUNG_VERTRAG_VERSION, RECHNUNG_AUFRUFE, INVOICE_ERROR_CODES, CREDIT_NOTE_REASONS, TAX_SCHEMES, PRICE_MODES, VAT_RATES, CUSTOMER_TYPES, INVOICE_LIST_STATUS, DOC_TYPES, EINVOICE_FORMATS, INVOICE_LANGUAGES, INVOICE_PAYMENT_METHODS, ITEM_KINDS, REVERSE_CHARGE_REASONS, INVOICE_NOTICE_CODES, INVOICE_UNITS, RECHNUNG_EINHEITEN_CODES, INVOICE_SETUP_REQUIREMENTS, KUNDE_FELDER, POSITION_FELDER, GUTSCHRIFT_POSITION_FELDER, RETURN_DISPOSITIONS, POSITION_PREIS_GENAU_EINS, RECHNUNG_ANFRAGEN, RECHNUNG_GENAU_EINS, RECHNUNG_MINDESTENS_EINS, } from './vertrag.js';
@@ -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, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent } from './vertrag.js';
8
+ import type { CreditNoteReason, CustomerType, DocType, InvoiceLanguage, InvoiceNoticeCode, ItemKind, ReverseChargeReason, InvoicePaymentMethod, InvoiceUnit, ReturnDisposition, InvoiceSetupRequirement, InvoiceListStatus, PriceMode, TaxScheme, VatRatePercent } 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
@@ -228,6 +228,9 @@ export type Feld = {
228
228
  schluesselMuster: string;
229
229
  wertMax: number;
230
230
  };
231
+ /** Rueckgabe-Wahl einer Gutschrift (Lager-Kern Stufe 2), wie im Backend RUECKGABE_API. */
232
+ export declare const RETURN_DISPOSITIONS: readonly ["restock", "defective", "disposed"];
233
+ export type ReturnDisposition = (typeof RETURN_DISPOSITIONS)[number];
231
234
  /** Kunde, wie das Fremdsystem ihn schickt. `vatId` ist die UID-Nummer. */
232
235
  export declare const KUNDE_FELDER: Readonly<Record<string, Feld>>;
233
236
  /**
@@ -243,6 +246,8 @@ export declare const KUNDE_FELDER: Readonly<Record<string, Feld>>;
243
246
  export declare const POSITION_FELDER: Readonly<Record<string, Feld>>;
244
247
  /** Genau einer der beiden Preise je Position (§ 9.1). */
245
248
  export declare const POSITION_PREIS_GENAU_EINS: readonly (readonly string[])[];
249
+ /** Gutschriftsposition: Rechnungsposition plus Rueckgabe-Wahl (an der Rechnung weist der Server sie ab). */
250
+ export declare const GUTSCHRIFT_POSITION_FELDER: Readonly<Record<string, Feld>>;
246
251
  /**
247
252
  * Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
248
253
  * Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
@@ -306,6 +306,9 @@ export const INVOICE_SETUP_REQUIREMENTS = [
306
306
  const text = (max, pflicht = false, extra = {}) => ({ typ: 'string', pflicht, max, ...(pflicht && extra.min === undefined ? { min: 1 } : {}), ...extra });
307
307
  const idempotencyKey = (pflicht) => ({ typ: 'string', pflicht, min: 1, max: 120 });
308
308
  const id = { typ: 'string', pflicht: false, min: 1, max: 128 };
309
+ /** Rueckgabe-Wahl einer Gutschrift (Lager-Kern Stufe 2), wie im Backend RUECKGABE_API. */
310
+ export const RETURN_DISPOSITIONS = ['restock', 'defective', 'disposed'];
311
+ const rueckgabe = { typ: 'enum', pflicht: false, werte: RETURN_DISPOSITIONS };
309
312
  const idPflicht = { typ: 'string', pflicht: true, min: 1, max: 128 };
310
313
  const datum = (pflicht = false) => ({ typ: 'string', pflicht, min: 10, max: 10, format: 'date' });
311
314
  const limit = { typ: 'integer', pflicht: false, min: 1, max: 100 };
@@ -356,6 +359,13 @@ export const POSITION_FELDER = Object.freeze({
356
359
  unitPriceMicros: { typ: 'integer', pflicht: false, min: 0, max: 1_000_000_000_000 },
357
360
  vatRate: { typ: 'enum', pflicht: true, werte: VAT_RATES },
358
361
  discountPct: { typ: 'number', pflicht: false, min: 0, max: 100, nachkomma: 2 },
362
+ /**
363
+ * Artikel aus dem Artikelstamm (Lager-Kern Stufe 2): ist er bestandsgefuehrt
364
+ * und das Modul Lager aktiv, bucht das Ausstellen ihn ab -- danach, die
365
+ * Rechnung scheitert nie am Lager. Kein „/“, nicht „.“, „..“ oder „__…__“
366
+ * (prueft der Server, `validation`).
367
+ */
368
+ articleId: id,
359
369
  });
360
370
  /** Genau einer der beiden Preise je Position (§ 9.1). */
361
371
  export const POSITION_PREIS_GENAU_EINS = Object.freeze([
@@ -371,6 +381,17 @@ const positionen = {
371
381
  typ: 'object', pflicht: true, felder: POSITION_FELDER, genauEins: POSITION_PREIS_GENAU_EINS,
372
382
  },
373
383
  };
384
+ /** Gutschriftsposition: Rechnungsposition plus Rueckgabe-Wahl (an der Rechnung weist der Server sie ab). */
385
+ export const GUTSCHRIFT_POSITION_FELDER = Object.freeze({ ...POSITION_FELDER, returnDisposition: rueckgabe });
386
+ const gutschriftPositionen = {
387
+ typ: 'list',
388
+ pflicht: true,
389
+ min: 1,
390
+ max: 500,
391
+ eintrag: {
392
+ typ: 'object', pflicht: true, felder: GUTSCHRIFT_POSITION_FELDER, genauEins: POSITION_PREIS_GENAU_EINS,
393
+ },
394
+ };
374
395
  /**
375
396
  * Eine Zahlung zu einer Rechnung. Ohne `amountCents` gilt der volle
376
397
  * Bruttobetrag, ohne `paidAt` der heutige Wiener Tag. `reference` ist die
@@ -438,6 +459,8 @@ export const RECHNUNG_ANFRAGEN = Object.freeze({
438
459
  language: { typ: 'enum', pflicht: false, werte: INVOICE_LANGUAGES },
439
460
  /** Marke (Kennung aus `listBrands`); sonst die Standardmarke. */
440
461
  brandId: id,
462
+ /** Lagerstandort (Kennung), von dem bestandsgefuehrte Positionen abbuchen. */
463
+ stockLocationId: id,
441
464
  /**
442
465
  * Schon bezahlt: die Zahlung entsteht in **derselben** Transaktion wie das
443
466
  * Festschreiben. Sonst gaebe es einen Moment, in dem die Rechnung offen ist
@@ -456,13 +479,15 @@ export const RECHNUNG_ANFRAGEN = Object.freeze({
456
479
  invoiceId: idPflicht,
457
480
  reason: { typ: 'enum', pflicht: true, werte: CREDIT_NOTE_REASONS },
458
481
  note: text(2000),
482
+ returnDisposition: rueckgabe,
459
483
  },
460
484
  createCreditNote: {
461
485
  idempotencyKey: idempotencyKey(true),
462
486
  invoiceId: idPflicht,
463
487
  reason: { typ: 'enum', pflicht: true, werte: CREDIT_NOTE_REASONS },
464
488
  note: text(2000),
465
- items: positionen,
489
+ returnDisposition: rueckgabe,
490
+ items: gutschriftPositionen,
466
491
  },
467
492
  getInvoice: {
468
493
  invoiceId: id,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.31.0",
2
+ "version": "0.32.0",
3
3
  "gemessenAn": {
4
4
  "tid": "3600335",
5
5
  "hpsVersion": "1.10.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.31.0",
2
+ "version": "0.32.0",
3
3
  "meldungen": {
4
4
  "netz.keine_verbindung": {
5
5
  "text": "Keine Verbindung zum Server. Bitte die Internetverbindung prüfen und erneut versuchen."
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.31.0",
2
+ "version": "0.32.0",
3
3
  "aufrufe": [
4
4
  "activateCashregister",
5
5
  "cancelInvoice",
@@ -530,6 +530,11 @@
530
530
  "listBrands",
531
531
  "recordInvoicePayment"
532
532
  ],
533
+ "returnDispositions": [
534
+ "restock",
535
+ "defective",
536
+ "disposed"
537
+ ],
533
538
  "steuerfreieFaelle": [
534
539
  "smallBusiness",
535
540
  "reverseCharge",
@@ -0,0 +1,26 @@
1
+ {
2
+ "aufruf": "createCreditNote",
3
+ "beschreibung": "Unbekannte Rueckgabe-Wahl an der Position",
4
+ "anfrage": {
5
+ "idempotencyKey": "bsp-15",
6
+ "invoiceId": "rechnung_beispiel",
7
+ "reason": "return",
8
+ "items": [
9
+ {
10
+ "description": "Roggenbrot",
11
+ "quantity": 1,
12
+ "unitPriceCents": 450,
13
+ "vatRate": 10,
14
+ "articleId": "rye-bread",
15
+ "returnDisposition": "lost"
16
+ }
17
+ ]
18
+ },
19
+ "erwartet": {
20
+ "ok": false,
21
+ "code": "validation",
22
+ "fields": [
23
+ "items[0].returnDisposition"
24
+ ]
25
+ }
26
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "aufruf": "createCreditNote",
3
+ "beschreibung": "Rueckgabe: Vorgabe zurueck ins Lager, eine Position defekt",
4
+ "anfrage": {
5
+ "idempotencyKey": "bsp-14",
6
+ "invoiceId": "rechnung_beispiel",
7
+ "reason": "return",
8
+ "returnDisposition": "restock",
9
+ "items": [
10
+ {
11
+ "description": "Roggenbrot",
12
+ "quantity": 1,
13
+ "unitPriceCents": 450,
14
+ "vatRate": 10,
15
+ "articleId": "rye-bread",
16
+ "returnDisposition": "defective"
17
+ }
18
+ ]
19
+ },
20
+ "erwartet": {
21
+ "ok": true
22
+ }
23
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "aufruf": "issueInvoice",
3
+ "beschreibung": "Lager-Kennungen ohne Schraegstrich und nicht nur Punkte",
4
+ "anfrage": {
5
+ "idempotencyKey": "bsp-18",
6
+ "priceMode": "gross",
7
+ "serviceStart": "2026-10-01",
8
+ "stockLocationId": "..",
9
+ "items": [
10
+ {
11
+ "description": "Roggenbrot",
12
+ "quantity": 1,
13
+ "unitPriceCents": 450,
14
+ "vatRate": 10,
15
+ "articleId": "a/b"
16
+ }
17
+ ]
18
+ },
19
+ "erwartet": {
20
+ "ok": false,
21
+ "code": "validation",
22
+ "fields": [
23
+ "stockLocationId",
24
+ "items[0].articleId"
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "aufruf": "issueInvoice",
3
+ "beschreibung": "Die Rueckgabe-Wahl gehoert an die Gutschrift, nicht an die Rechnung",
4
+ "anfrage": {
5
+ "idempotencyKey": "bsp-17",
6
+ "priceMode": "gross",
7
+ "serviceStart": "2026-10-01",
8
+ "items": [
9
+ {
10
+ "description": "Roggenbrot",
11
+ "quantity": 1,
12
+ "unitPriceCents": 450,
13
+ "vatRate": 10,
14
+ "returnDisposition": "restock"
15
+ }
16
+ ]
17
+ },
18
+ "erwartet": {
19
+ "ok": false,
20
+ "code": "validation",
21
+ "fields": [
22
+ "items[0].returnDisposition"
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "aufruf": "issueInvoice",
3
+ "beschreibung": "Bestandsgefuehrter Artikel, abgebucht vom Lieferwagen",
4
+ "anfrage": {
5
+ "idempotencyKey": "bsp-13",
6
+ "priceMode": "gross",
7
+ "serviceStart": "2026-10-01",
8
+ "stockLocationId": "van-1",
9
+ "items": [
10
+ {
11
+ "description": "Roggenbrot",
12
+ "quantity": 2,
13
+ "unitPriceCents": 450,
14
+ "vatRate": 10,
15
+ "articleId": "rye-bread"
16
+ }
17
+ ]
18
+ },
19
+ "erwartet": {
20
+ "ok": true
21
+ }
22
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "aufruf": "cancelInvoice",
3
+ "beschreibung": "Unbekannte Rueckgabe-Wahl beim Vollstorno",
4
+ "anfrage": {
5
+ "idempotencyKey": "bsp-16",
6
+ "invoiceId": "rechnung_beispiel",
7
+ "reason": "return",
8
+ "returnDisposition": "lost"
9
+ },
10
+ "erwartet": {
11
+ "ok": false,
12
+ "code": "validation",
13
+ "fields": [
14
+ "returnDisposition"
15
+ ]
16
+ }
17
+ }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "Kasseneck Rechnungs-API",
4
4
  "version": 1,
5
- "paket": "0.31.0",
5
+ "paket": "0.32.0",
6
6
  "aufrufe": {
7
7
  "createCustomer": {
8
8
  "anfrage": {
@@ -461,6 +461,11 @@
461
461
  "minimum": 0,
462
462
  "maximum": 100,
463
463
  "x-decimals": 2
464
+ },
465
+ "articleId": {
466
+ "type": "string",
467
+ "minLength": 1,
468
+ "maxLength": 128
464
469
  }
465
470
  },
466
471
  "required": [
@@ -505,6 +510,11 @@
505
510
  "minLength": 1,
506
511
  "maxLength": 128
507
512
  },
513
+ "stockLocationId": {
514
+ "type": "string",
515
+ "minLength": 1,
516
+ "maxLength": 128
517
+ },
508
518
  "payment": {
509
519
  "type": "object",
510
520
  "properties": {
@@ -579,6 +589,13 @@
579
589
  "note": {
580
590
  "type": "string",
581
591
  "maxLength": 2000
592
+ },
593
+ "returnDisposition": {
594
+ "enum": [
595
+ "restock",
596
+ "defective",
597
+ "disposed"
598
+ ]
582
599
  }
583
600
  },
584
601
  "required": [
@@ -616,6 +633,13 @@
616
633
  "type": "string",
617
634
  "maxLength": 2000
618
635
  },
636
+ "returnDisposition": {
637
+ "enum": [
638
+ "restock",
639
+ "defective",
640
+ "disposed"
641
+ ]
642
+ },
619
643
  "items": {
620
644
  "type": "array",
621
645
  "minItems": 1,
@@ -720,6 +744,18 @@
720
744
  "minimum": 0,
721
745
  "maximum": 100,
722
746
  "x-decimals": 2
747
+ },
748
+ "articleId": {
749
+ "type": "string",
750
+ "minLength": 1,
751
+ "maxLength": 128
752
+ },
753
+ "returnDisposition": {
754
+ "enum": [
755
+ "restock",
756
+ "defective",
757
+ "disposed"
758
+ ]
723
759
  }
724
760
  },
725
761
  "required": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.31.0",
2
+ "version": "0.32.0",
3
3
  "sprachen": [
4
4
  "de",
5
5
  "en"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kreiseck/kasseneck-api",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Austrian fiscal cash register (RKSV) client for JavaScript and TypeScript: signed receipts, cancellations, card payments, receipt printing (ESC/POS), invoices. RKSV-Registrierkasse für JavaScript und TypeScript.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Kreiseck",