@kreiseck/kasseneck-api 1.1.0 → 1.2.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 +88 -0
- package/README.md +70 -0
- package/dist/cjs/client/aufrufe.d.ts +5 -5
- package/dist/cjs/client/aufrufe.js +21 -2
- package/dist/cjs/client/errors.d.ts +1 -1
- package/dist/cjs/client/errors.js +2 -1
- package/dist/cjs/client/receipts.d.ts +9 -1
- package/dist/cjs/client/receipts.js +18 -3
- package/dist/cjs/client/transport.d.ts +3 -3
- package/dist/cjs/client/transport.js +2 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +6 -3
- package/dist/cjs/invoice/index.d.ts +2 -2
- package/dist/cjs/invoice/index.js +3 -1
- package/dist/cjs/invoice/typen.d.ts +13 -2
- package/dist/cjs/invoice/vertrag.d.ts +10 -1
- package/dist/cjs/invoice/vertrag.js +39 -2
- package/dist/cjs/models/cancellation.d.ts +14 -2
- package/dist/cjs/models/cancellation.js +15 -1
- package/dist/cjs/models/cashregister.d.ts +3 -0
- package/dist/cjs/models/cashregister.js +1 -0
- package/dist/cjs/models/index.d.ts +1 -1
- package/dist/cjs/models/index.js +4 -2
- package/dist/cjs/models/payment-errors.d.ts +1 -1
- package/dist/cjs/models/payment-errors.js +1 -0
- package/dist/cjs/models/receipt-email.d.ts +1 -1
- package/dist/cjs/models/receipt-email.js +1 -0
- package/dist/cjs/models/receipt-errors.d.ts +1 -1
- package/dist/cjs/models/receipt-errors.js +1 -0
- package/dist/cjs/models/receipt-item.d.ts +9 -0
- package/dist/cjs/models/receipt-item.js +5 -0
- package/dist/cjs/models/receipt.d.ts +1 -1
- package/dist/cjs/models/receipt.js +6 -1
- package/dist/cjs/pos/artikel.d.ts +14 -0
- package/dist/cjs/pos/artikel.js +13 -2
- package/dist/cjs/pos/errors.d.ts +3 -3
- package/dist/cjs/pos/errors.js +6 -2
- package/dist/cjs/pos/index.d.ts +5 -2
- package/dist/cjs/pos/index.js +13 -2
- package/dist/cjs/pos/lager.d.ts +95 -0
- package/dist/cjs/pos/lager.js +160 -0
- package/dist/cjs/pos/texte.d.ts +22 -3
- package/dist/cjs/pos/texte.js +22 -6
- package/dist/cjs/printing/code-table-preview.d.ts +15 -0
- package/dist/cjs/printing/code-table-preview.js +24 -0
- package/dist/cjs/printing/index.d.ts +1 -0
- package/dist/cjs/printing/index.js +3 -1
- package/dist/cjs/receipt/code-table-test-sheet.d.ts +8 -2
- package/dist/cjs/receipt/code-table-test-sheet.js +2 -0
- package/dist/cjs/register/errors.d.ts +1 -1
- package/dist/cjs/register/errors.js +1 -0
- package/dist/cjs/register/pairing.d.ts +27 -1
- package/dist/cjs/register/pairing.js +18 -1
- package/dist/cjs/stored/draht.d.ts +4 -2
- package/dist/cjs/stored/draht.js +46 -5
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +5 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +5 -5
- package/dist/esm/client/aufrufe.js +21 -2
- package/dist/esm/client/errors.d.ts +1 -1
- package/dist/esm/client/errors.js +2 -1
- package/dist/esm/client/receipts.d.ts +9 -1
- package/dist/esm/client/receipts.js +19 -4
- package/dist/esm/client/transport.d.ts +3 -3
- package/dist/esm/client/transport.js +2 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/invoice/index.d.ts +2 -2
- package/dist/esm/invoice/index.js +1 -1
- package/dist/esm/invoice/typen.d.ts +13 -2
- package/dist/esm/invoice/vertrag.d.ts +10 -1
- package/dist/esm/invoice/vertrag.js +38 -1
- package/dist/esm/models/cancellation.d.ts +14 -2
- package/dist/esm/models/cancellation.js +13 -0
- package/dist/esm/models/cashregister.d.ts +3 -0
- package/dist/esm/models/cashregister.js +1 -0
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/payment-errors.d.ts +1 -1
- package/dist/esm/models/payment-errors.js +1 -0
- package/dist/esm/models/receipt-email.d.ts +1 -1
- package/dist/esm/models/receipt-email.js +1 -0
- package/dist/esm/models/receipt-errors.d.ts +1 -1
- package/dist/esm/models/receipt-errors.js +1 -0
- package/dist/esm/models/receipt-item.d.ts +9 -0
- package/dist/esm/models/receipt-item.js +5 -0
- package/dist/esm/models/receipt.d.ts +1 -1
- package/dist/esm/models/receipt.js +6 -1
- package/dist/esm/pos/artikel.d.ts +14 -0
- package/dist/esm/pos/artikel.js +13 -3
- package/dist/esm/pos/errors.d.ts +3 -3
- package/dist/esm/pos/errors.js +6 -2
- package/dist/esm/pos/index.d.ts +5 -2
- package/dist/esm/pos/index.js +6 -2
- package/dist/esm/pos/lager.d.ts +95 -0
- package/dist/esm/pos/lager.js +154 -0
- package/dist/esm/pos/texte.d.ts +22 -3
- package/dist/esm/pos/texte.js +22 -6
- package/dist/esm/printing/code-table-preview.d.ts +15 -0
- package/dist/esm/printing/code-table-preview.js +21 -0
- package/dist/esm/printing/index.d.ts +1 -0
- package/dist/esm/printing/index.js +1 -0
- package/dist/esm/receipt/code-table-test-sheet.d.ts +8 -2
- package/dist/esm/receipt/code-table-test-sheet.js +2 -0
- package/dist/esm/register/errors.d.ts +1 -1
- package/dist/esm/register/errors.js +1 -0
- package/dist/esm/register/pairing.d.ts +27 -1
- package/dist/esm/register/pairing.js +17 -1
- package/dist/esm/stored/draht.d.ts +4 -2
- package/dist/esm/stored/draht.js +45 -4
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +5 -3
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/code-table-preview.json +14 -0
- package/fixtures/expected/code-table-test-sheet.lines.json +22 -4
- package/fixtures/expected/code-table-test-sheet.mm58.hex +58 -55
- package/fixtures/expected/code-table-test-sheet.mm80.hex +59 -56
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api-examples/cancel-error-return-disposition.json +17 -0
- package/fixtures/invoice-api-examples/credit-error-return-disposition.json +26 -0
- package/fixtures/invoice-api-examples/credit-return-disposition.json +23 -0
- package/fixtures/invoice-api-examples/issue-error-return-disposition.json +25 -0
- package/fixtures/invoice-api-examples/issue-error-stock-id.json +27 -0
- package/fixtures/invoice-api-examples/issue-stock.json +22 -0
- package/fixtures/invoice-api.schema.json +37 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/pos-texts.json +25 -4
- package/fixtures/surface.json +48 -4
- package/fixtures/v3/antworten/belege.json +1 -1
- package/fixtures/v3/antworten/belegmail.json +1 -1
- package/fixtures/v3/antworten/kasse-belege.json +1 -1
- package/fixtures/v3/antworten/kasse.json +662 -3
- package/fixtures/v3/antworten/rechnungen.json +1 -1
- package/fixtures/v3/antworten/storno.json +1 -1
- package/fixtures/v3/stored/belege.json +1 -1
- package/fixtures/v3/stored/kasse.json +58 -3
- package/fixtures/v3/stored/rechnungen.json +1 -1
- package/fixtures/v3/v3-vokabular.json +249 -16
- package/fixtures/v3/zahlbetrag-faelle.json +1 -1
- package/package.json +1 -1
|
@@ -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:
|
|
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';
|
package/dist/cjs/models/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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
|
|
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) => ({
|
|
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[]>;
|
package/dist/cjs/pos/artikel.js
CHANGED
|
@@ -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
|
-
|
|
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');
|
package/dist/cjs/pos/errors.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { KasseneckApiError } from '../client/errors.js';
|
|
2
2
|
/**
|
|
3
3
|
* Fehler der Kassen-Aufrufe um den Verkauf herum (Einstellungen, Logo,
|
|
4
|
-
* Artikel, Drucker, Trinkgeld-Empfaenger) auswerten: am `code`, nie am Text.
|
|
4
|
+
* Artikel, Drucker, Trinkgeld-Empfaenger, Lager) auswerten: am `code`, nie am Text.
|
|
5
5
|
* Belege, Storno und Belegmail haben eigene Listen (`RECEIPT_ERROR_CODES`,
|
|
6
6
|
* `CANCELLATION_ERROR_CODES`, `RECEIPT_EMAIL_ERROR_CODES`), die Anmeldung
|
|
7
7
|
* `REGISTER_ERROR_CODES` im Unterpfad `./register`.
|
|
8
8
|
*
|
|
9
|
-
* Abgeleitet aus dem Vertrags-Export (Fehlerfaelle dieser
|
|
9
|
+
* Abgeleitet aus dem Vertrags-Export (Fehlerfaelle dieser dreizehn Endpunkte in
|
|
10
10
|
* `fixtures/v3/antworten/kasse.json` und ihre Handler-Codes); ein Test haelt
|
|
11
11
|
* die Liste deckungsgleich. `validation` traegt `data.errors[]` mit dem
|
|
12
12
|
* aeusseren Feldpfad (`business.theme`, `device.shortcuts.splitPayment`).
|
|
@@ -19,7 +19,7 @@ import { KasseneckApiError } from '../client/errors.js';
|
|
|
19
19
|
* ueber `KasseneckApiError.code` lesbar; die Kasse braucht dafuer einen
|
|
20
20
|
* Rueckfallzweig.
|
|
21
21
|
*/
|
|
22
|
-
export declare const POS_ERROR_CODES: readonly ["account_not_found", "admin_required", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "device_not_found", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_found", "not_permitted", "print_job_not_found", "print_layout_failed", "printer_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 POS_ERROR_CODES: readonly ["account_not_found", "admin_required", "api_not_approved", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "device_not_found", "dialect_mismatch", "internal_translation_error", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_found", "not_permitted", "print_job_not_found", "print_layout_failed", "printer_not_found", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "server_error", "session_expired", "session_other_cashregister", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
|
|
23
23
|
export type PosErrorCode = typeof POS_ERROR_CODES[number];
|
|
24
24
|
export declare function isPosErrorCode(value: unknown): value is PosErrorCode;
|
|
25
25
|
/** Der Code eines geworfenen Fehlers, wenn er in [POS_ERROR_CODES] steht; sonst `undefined`. */
|
package/dist/cjs/pos/errors.js
CHANGED
|
@@ -8,12 +8,12 @@ exports.posFieldErrors = posFieldErrors;
|
|
|
8
8
|
const errors_js_1 = require("../client/errors.js");
|
|
9
9
|
/**
|
|
10
10
|
* Fehler der Kassen-Aufrufe um den Verkauf herum (Einstellungen, Logo,
|
|
11
|
-
* Artikel, Drucker, Trinkgeld-Empfaenger) auswerten: am `code`, nie am Text.
|
|
11
|
+
* Artikel, Drucker, Trinkgeld-Empfaenger, Lager) auswerten: am `code`, nie am Text.
|
|
12
12
|
* Belege, Storno und Belegmail haben eigene Listen (`RECEIPT_ERROR_CODES`,
|
|
13
13
|
* `CANCELLATION_ERROR_CODES`, `RECEIPT_EMAIL_ERROR_CODES`), die Anmeldung
|
|
14
14
|
* `REGISTER_ERROR_CODES` im Unterpfad `./register`.
|
|
15
15
|
*
|
|
16
|
-
* Abgeleitet aus dem Vertrags-Export (Fehlerfaelle dieser
|
|
16
|
+
* Abgeleitet aus dem Vertrags-Export (Fehlerfaelle dieser dreizehn Endpunkte in
|
|
17
17
|
* `fixtures/v3/antworten/kasse.json` und ihre Handler-Codes); ein Test haelt
|
|
18
18
|
* die Liste deckungsgleich. `validation` traegt `data.errors[]` mit dem
|
|
19
19
|
* aeusseren Feldpfad (`business.theme`, `device.shortcuts.splitPayment`).
|
|
@@ -29,6 +29,7 @@ const errors_js_1 = require("../client/errors.js");
|
|
|
29
29
|
exports.POS_ERROR_CODES = Object.freeze([
|
|
30
30
|
'account_not_found',
|
|
31
31
|
'admin_required',
|
|
32
|
+
'api_not_approved',
|
|
32
33
|
'cashregister_not_assigned',
|
|
33
34
|
'cashregister_not_found',
|
|
34
35
|
'cashregister_token_invalid',
|
|
@@ -37,6 +38,8 @@ exports.POS_ERROR_CODES = Object.freeze([
|
|
|
37
38
|
'dialect_mismatch',
|
|
38
39
|
'internal_translation_error',
|
|
39
40
|
'live_not_enabled',
|
|
41
|
+
'location_inactive',
|
|
42
|
+
'location_not_found',
|
|
40
43
|
'logo_invalid',
|
|
41
44
|
'logo_invalid_type',
|
|
42
45
|
'logo_too_large',
|
|
@@ -52,6 +55,7 @@ exports.POS_ERROR_CODES = Object.freeze([
|
|
|
52
55
|
'register_user_not_allowed',
|
|
53
56
|
'register_user_not_found',
|
|
54
57
|
'response_translation_failed',
|
|
58
|
+
'server_error',
|
|
55
59
|
'session_expired',
|
|
56
60
|
'session_other_cashregister',
|
|
57
61
|
'unauthorized',
|
package/dist/cjs/pos/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
|
|
3
|
-
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger
|
|
3
|
+
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger, Lager (Standorte, Bestand,
|
|
4
|
+
* Standort der Kasse). Die Aufrufe heissen 1:1 wie
|
|
4
5
|
* die Backend-Functions (die Rewrites-Waechter der Web-App leiten daraus ab)
|
|
5
6
|
* und sprechen den Kassenweg `/api/v3` (Schluessel und Werte englisch).
|
|
6
7
|
*/
|
|
@@ -9,7 +10,9 @@ export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, t
|
|
|
9
10
|
export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, type SetMyPosLogoOptions, } from './client.js';
|
|
10
11
|
export { POS_ERROR_CODES, type PosErrorCode, isPosErrorCode, posErrorCode, isPosError, type PosFieldError, posFieldErrors, } from './errors.js';
|
|
11
12
|
export { distributeDiscount } from '../receipt/discount.js';
|
|
12
|
-
export { cancelScopeOf, receiptsScopeOf, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
13
|
+
export { cancelScopeOf, receiptsScopeOf, stockViewOf, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
13
14
|
export { type NetworkPrinter, type PrintJob, type PrintJobStatus, PRINT_JOB_STATUSES, type PrintJobSource, PRINT_JOB_SOURCES, isPrintJobFinished, type CreatePrintJobOptions, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
14
15
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
16
|
+
export { STOCK_LOCATION_TYPES, type StockLocationType, type StockLocation, type StockLocationAddress, type StockLevel, type StockValue, type StockList, type ListMyStockOptions, type SetMyCashregisterStockLocationOptions, type CashregisterStockLocation, listMyStockLocations, listMyStock, setMyCashregisterStockLocation, } from './lager.js';
|
|
17
|
+
export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
|
|
15
18
|
export { MESSAGES, ERROR_RULES, ERROR_CODE_RULES, ERROR_OUTCOME_RULES, CALLS_WITH_EFFECT, findErrorRule, messageOutcome, messageText, messageAppliesTo, RECEIPT_EMAIL_ERROR_MESSAGES, receiptEmailErrorMessage, CANCELLATION_PAYMENT_ERROR_MESSAGES, cancellationPaymentErrorMessage, LABELS, labelText, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|