@kreiseck/kasseneck-api 1.31.0 → 1.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/client/aufrufe.d.ts +3 -3
- package/dist/cjs/client/aufrufe.js +8 -0
- package/dist/cjs/client/receipts.d.ts +11 -0
- package/dist/cjs/client/receipts.js +28 -2
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/models/index.d.ts +1 -1
- package/dist/cjs/models/index.js +5 -2
- package/dist/cjs/models/receipt-errors.d.ts +1 -1
- package/dist/cjs/models/receipt-errors.js +9 -0
- package/dist/cjs/models/receipt-item.d.ts +44 -2
- package/dist/cjs/models/receipt-item.js +56 -1
- package/dist/cjs/models/receipt.d.ts +17 -0
- package/dist/cjs/models/receipt.js +9 -0
- package/dist/cjs/pos/artikel.d.ts +14 -0
- package/dist/cjs/pos/artikel.js +3 -0
- package/dist/cjs/pos/client.d.ts +1 -0
- package/dist/cjs/pos/client.js +3 -0
- package/dist/cjs/pos/errors.d.ts +1 -1
- package/dist/cjs/pos/errors.js +12 -0
- package/dist/cjs/pos/fremdgutschein-artikel.d.ts +3 -2
- package/dist/cjs/pos/fremdgutschein-artikel.js +4 -2
- package/dist/cjs/pos/index.d.ts +4 -2
- package/dist/cjs/pos/index.js +24 -4
- package/dist/cjs/pos/leergut.d.ts +60 -0
- package/dist/cjs/pos/leergut.js +82 -0
- package/dist/cjs/pos/pfand.d.ts +144 -0
- package/dist/cjs/pos/pfand.js +382 -0
- package/dist/cjs/pos/settings.d.ts +3 -7
- package/dist/cjs/pos/settings.js +7 -0
- package/dist/cjs/pos/texte.d.ts +72 -0
- package/dist/cjs/pos/texte.js +42 -1
- package/dist/cjs/receipt/discount.js +3 -0
- package/dist/cjs/receipt/due.d.ts +6 -0
- package/dist/cjs/receipt/due.js +16 -5
- package/dist/cjs/receipt/gutschein-plan.d.ts +7 -1
- package/dist/cjs/receipt/gutschein-plan.js +16 -2
- package/dist/cjs/receipt/layout.js +108 -2
- package/dist/cjs/register/pairing.d.ts +15 -1
- package/dist/cjs/register/pairing.js +14 -1
- package/dist/cjs/stored/vokabular.d.ts +1 -1
- package/dist/cjs/stored/vokabular.js +72 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +3 -3
- package/dist/esm/client/aufrufe.js +8 -0
- package/dist/esm/client/receipts.d.ts +11 -0
- package/dist/esm/client/receipts.js +29 -3
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/models/index.d.ts +1 -1
- package/dist/esm/models/index.js +1 -1
- package/dist/esm/models/receipt-errors.d.ts +1 -1
- package/dist/esm/models/receipt-errors.js +9 -0
- package/dist/esm/models/receipt-item.d.ts +44 -2
- package/dist/esm/models/receipt-item.js +54 -1
- package/dist/esm/models/receipt.d.ts +17 -0
- package/dist/esm/models/receipt.js +9 -0
- package/dist/esm/pos/artikel.d.ts +14 -0
- package/dist/esm/pos/artikel.js +3 -0
- package/dist/esm/pos/client.d.ts +1 -0
- package/dist/esm/pos/client.js +3 -0
- package/dist/esm/pos/errors.d.ts +1 -1
- package/dist/esm/pos/errors.js +12 -0
- package/dist/esm/pos/fremdgutschein-artikel.d.ts +3 -2
- package/dist/esm/pos/fremdgutschein-artikel.js +4 -2
- package/dist/esm/pos/index.d.ts +4 -2
- package/dist/esm/pos/index.js +4 -2
- package/dist/esm/pos/leergut.d.ts +60 -0
- package/dist/esm/pos/leergut.js +77 -0
- package/dist/esm/pos/pfand.d.ts +144 -0
- package/dist/esm/pos/pfand.js +371 -0
- package/dist/esm/pos/settings.d.ts +3 -7
- package/dist/esm/pos/settings.js +7 -0
- package/dist/esm/pos/texte.d.ts +72 -0
- package/dist/esm/pos/texte.js +40 -0
- package/dist/esm/receipt/discount.js +4 -1
- package/dist/esm/receipt/due.d.ts +6 -0
- package/dist/esm/receipt/due.js +17 -6
- package/dist/esm/receipt/gutschein-plan.d.ts +7 -1
- package/dist/esm/receipt/gutschein-plan.js +14 -2
- package/dist/esm/receipt/layout.js +109 -3
- package/dist/esm/register/pairing.d.ts +15 -1
- package/dist/esm/register/pairing.js +13 -1
- package/dist/esm/stored/vokabular.d.ts +1 -1
- package/dist/esm/stored/vokabular.js +72 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/deposit-cases.json +4758 -0
- package/fixtures/expected/deposit-return.grid32.txt +28 -0
- package/fixtures/expected/deposit-return.grid48.txt +28 -0
- package/fixtures/expected/deposit-return.lines.json +275 -0
- package/fixtures/expected/deposit-return.sheet32.json +194 -0
- package/fixtures/expected/deposit-return.sheet48.json +194 -0
- package/fixtures/expected/deposit.grid32.txt +34 -0
- package/fixtures/expected/deposit.grid48.txt +32 -0
- package/fixtures/expected/deposit.lines.json +316 -0
- package/fixtures/expected/deposit.sheet32.json +230 -0
- package/fixtures/expected/deposit.sheet48.json +218 -0
- package/fixtures/external-voucher-article-cases.json +20 -0
- package/fixtures/hobex-hps-codes.json +1 -1
- package/fixtures/invoice-api.schema.json +1 -1
- package/fixtures/invoice-texts.json +1 -1
- package/fixtures/manifest.json +16 -0
- package/fixtures/pos-texts.json +66 -1
- package/fixtures/receipts/deposit-return.json +63 -0
- package/fixtures/receipts/deposit.json +83 -0
- package/fixtures/return-code-cases.json +1338 -0
- package/fixtures/surface.json +45 -4
- package/fixtures/v3/antworten/belege.json +2 -2
- package/fixtures/v3/antworten/belegmail.json +2 -2
- package/fixtures/v3/antworten/berichte.json +2 -2
- package/fixtures/v3/antworten/kasse-belege.json +2 -2
- package/fixtures/v3/antworten/kasse.json +428 -13
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +2 -2
- package/fixtures/v3/antworten/storno.json +2 -2
- package/fixtures/v3/stored/belege.json +2 -2
- package/fixtures/v3/stored/kasse.json +42 -4
- package/fixtures/v3/stored/rechnungen.json +2 -2
- package/fixtures/v3/v3-vokabular.json +808 -27
- package/fixtures/v3/zahlbetrag-faelle.json +187 -3
- package/package.json +1 -1
|
@@ -97,8 +97,17 @@ function fromReceiptPayload(payload) {
|
|
|
97
97
|
? { registrationInfo: readRegistrationInfo(payload.registrationInfo) }
|
|
98
98
|
: {}),
|
|
99
99
|
...handbelegFeld(payload.manualReceipt),
|
|
100
|
+
...(typeof payload.onPremises === 'boolean' ? { onPremises: payload.onPremises } : {}),
|
|
101
|
+
...pfandStelleFeld(payload.sharedReturnPoint),
|
|
100
102
|
};
|
|
101
103
|
}
|
|
104
|
+
function pfandStelleFeld(roh) {
|
|
105
|
+
if (roh == null || typeof roh !== 'object')
|
|
106
|
+
return {};
|
|
107
|
+
const name = typeof roh.name === 'string' ? roh.name : '';
|
|
108
|
+
const address = typeof roh.address === 'string' ? roh.address : '';
|
|
109
|
+
return name !== '' || address !== '' ? { sharedReturnPoint: { name, address } } : {};
|
|
110
|
+
}
|
|
102
111
|
function handbelegFeld(roh) {
|
|
103
112
|
const manualReceipt = (0, manual_receipt_js_1.readManualReceipt)(roh);
|
|
104
113
|
return manualReceipt ? { manualReceipt } : {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InternerTransport } from '../client/aufrufe.js';
|
|
2
2
|
import { type PosReference } from './kachel-referenz.js';
|
|
3
|
+
import { type DepositEntry } from './pfand.js';
|
|
3
4
|
import { type ArticleExternalVoucher } from './fremdgutschein-artikel.js';
|
|
4
5
|
/**
|
|
5
6
|
* Artikelgruppen (Kategorien der Kachel-Kasse) und Artikel in der Form, die
|
|
@@ -22,6 +23,11 @@ export interface ArticleGroup {
|
|
|
22
23
|
* erst ueber [addOnsFor].
|
|
23
24
|
*/
|
|
24
25
|
addOns?: string[] | null;
|
|
26
|
+
/**
|
|
27
|
+
* Pfand der Gruppe (Pfand & Leergut): gilt fuer Artikel ohne eigene Liste; null = keines.
|
|
28
|
+
* Optional wie `addOns`, der Leser setzt es immer.
|
|
29
|
+
*/
|
|
30
|
+
deposits?: DepositEntry[] | null;
|
|
25
31
|
}
|
|
26
32
|
export interface ArticleGroupPayload {
|
|
27
33
|
id?: string | null;
|
|
@@ -31,6 +37,7 @@ export interface ArticleGroupPayload {
|
|
|
31
37
|
sort?: number | null;
|
|
32
38
|
vatRate?: number | null;
|
|
33
39
|
addOns?: unknown;
|
|
40
|
+
deposits?: unknown;
|
|
34
41
|
}
|
|
35
42
|
/** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
|
|
36
43
|
export declare function addOnListe(wert: unknown): string[] | null;
|
|
@@ -132,6 +139,12 @@ export interface PosArticle {
|
|
|
132
139
|
* unbekannter Wert wird null.
|
|
133
140
|
*/
|
|
134
141
|
externalVoucher?: ArticleExternalVoucher | null;
|
|
142
|
+
/**
|
|
143
|
+
* Pfand des Artikels (Pfand & Leergut): `null` = keine eigene Angabe (die Gruppe gilt), `[]` = ausdruecklich
|
|
144
|
+
* ohne Pfand, sonst die Eintraege. Der Server setzt die Pfandzeilen am Beleg daraus (`autoDeposits`). Optional wie
|
|
145
|
+
* `addOns`, der Leser setzt es immer.
|
|
146
|
+
*/
|
|
147
|
+
deposits?: DepositEntry[] | null;
|
|
135
148
|
}
|
|
136
149
|
/**
|
|
137
150
|
* Kann die Kachel gebucht werden? Mit festem Preis immer, ohne Preis nur mit
|
|
@@ -173,6 +186,7 @@ export interface PosArticlePayload {
|
|
|
173
186
|
reference?: unknown;
|
|
174
187
|
addOns?: unknown;
|
|
175
188
|
externalVoucher?: unknown;
|
|
189
|
+
deposits?: unknown;
|
|
176
190
|
}
|
|
177
191
|
export declare function fromPosArticlePayload(p: PosArticlePayload): PosArticle;
|
|
178
192
|
/**
|
package/dist/cjs/pos/artikel.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.listMyArticleGroups = listMyArticleGroups;
|
|
|
14
14
|
exports.listMyArticles = listMyArticles;
|
|
15
15
|
const errors_js_1 = require("../client/errors.js");
|
|
16
16
|
const kachel_referenz_js_1 = require("./kachel-referenz.js");
|
|
17
|
+
const pfand_js_1 = require("./pfand.js");
|
|
17
18
|
const fremdgutschein_artikel_js_1 = require("./fremdgutschein-artikel.js");
|
|
18
19
|
/** Zusatzliste am Draht: nur eine Liste von Texten zaehlt, sonst null. Paketintern. */
|
|
19
20
|
function addOnListe(wert) {
|
|
@@ -28,6 +29,7 @@ function fromArticleGroupPayload(p) {
|
|
|
28
29
|
sort: typeof p.sort === 'number' ? p.sort : 0,
|
|
29
30
|
vatRate: typeof p.vatRate === 'number' ? p.vatRate : null,
|
|
30
31
|
addOns: addOnListe(p.addOns),
|
|
32
|
+
deposits: (0, pfand_js_1.depositEntriesFromWire)(p.deposits),
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
@@ -108,6 +110,7 @@ function fromPosArticlePayload(p) {
|
|
|
108
110
|
reference: (0, kachel_referenz_js_1.fromReferencePayload)(p.reference),
|
|
109
111
|
addOns: addOnListe(p.addOns),
|
|
110
112
|
externalVoucher: (0, fremdgutschein_artikel_js_1.isArticleExternalVoucher)(p.externalVoucher) ? p.externalVoucher : null,
|
|
113
|
+
deposits: (0, pfand_js_1.depositEntriesFromWire)(p.deposits),
|
|
111
114
|
};
|
|
112
115
|
}
|
|
113
116
|
/**
|
package/dist/cjs/pos/client.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function posSettingsFromWire(data: {
|
|
|
9
9
|
business?: unknown;
|
|
10
10
|
device?: unknown;
|
|
11
11
|
vouchers?: unknown;
|
|
12
|
+
deposit?: unknown;
|
|
12
13
|
} | null | undefined): PosSettings;
|
|
13
14
|
/** Betriebsweite Einstellungen schreiben (Recht `layout`); liefert den gemischten Stand. */
|
|
14
15
|
export declare function setMyPosSettings(transport: InternerTransport, business: Partial<PosBusinessSettings>): Promise<PosBusinessSettings>;
|
package/dist/cjs/pos/client.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.setMyRegisterDeviceSettings = setMyRegisterDeviceSettings;
|
|
|
7
7
|
exports.setMyPosLogo = setMyPosLogo;
|
|
8
8
|
const errors_js_1 = require("../client/errors.js");
|
|
9
9
|
const gutschein_js_1 = require("./gutschein.js");
|
|
10
|
+
const pfand_js_1 = require("./pfand.js");
|
|
10
11
|
const rabatt_vorlagen_js_1 = require("./rabatt-vorlagen.js");
|
|
11
12
|
const settings_js_1 = require("./settings.js");
|
|
12
13
|
/*
|
|
@@ -38,10 +39,12 @@ async function getPosSettings(transport, options = {}) {
|
|
|
38
39
|
}
|
|
39
40
|
/** `{business, device, vouchers}` einer Antwort, gemischt mit den Standardwerten. */
|
|
40
41
|
function posSettingsFromWire(data) {
|
|
42
|
+
const deposit = (0, pfand_js_1.posDepositSettingsFromWire)(data?.deposit);
|
|
41
43
|
return {
|
|
42
44
|
vouchers: (0, gutschein_js_1.posVoucherSettingsFromWire)(data?.vouchers),
|
|
43
45
|
business: (0, settings_js_1.mergePosSettings)(settings_js_1.POS_BUSINESS_DEFAULTS, objekt(data?.business)),
|
|
44
46
|
device: (0, settings_js_1.mergePosSettings)(settings_js_1.POS_DEVICE_DEFAULTS, objekt(data?.device)),
|
|
47
|
+
...(deposit ? { deposit } : {}),
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
/** Betriebsweite Einstellungen schreiben (Recht `layout`); liefert den gemischten Stand. */
|
package/dist/cjs/pos/errors.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { KasseneckApiError } from '../client/errors.js';
|
|
|
21
21
|
* ueber `KasseneckApiError.code` lesbar; die Kasse braucht dafuer einen
|
|
22
22
|
* Rueckfallzweig.
|
|
23
23
|
*/
|
|
24
|
-
export declare const POS_ERROR_CODES: readonly ["account_not_found", "action_confirmation_required", "admin_required", "after_count_not_permitted", "api_not_approved", "app_check_invalid", "app_check_missing", "article_not_found", "article_not_in_scope", "article_not_tracked", "cash_movement_exceeds_balance", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "comment_required", "count_already_voided", "count_not_found", "device_not_found", "dialect_mismatch", "drawer_inactive", "drawer_not_found", "idempotency_conflict", "idempotency_key_required", "internal_translation_error", "invalid_amount", "invalid_cursor", "invalid_denominations", "invalid_discount_preset", "invalid_movement_type", "invalid_quantity", "invalid_serial", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_found", "not_permitted", "note_required", "password_change_required", "print_job_not_found", "print_layout_failed", "printer_not_found", "recount_exhausted", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "serial_already_counted", "serial_not_allowed", "serial_required", "server_error", "session_expired", "session_other_cashregister", "shift_already_open", "shift_closed", "shift_mode_off", "shift_not_open", "stocktake_closed", "stocktake_closing", "stocktake_not_found", "stocktake_not_open", "tip_payout_exceeds_claim", "too_many_counts", "transfer_same_drawer", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
|
|
24
|
+
export declare const POS_ERROR_CODES: readonly ["account_not_found", "action_confirmation_required", "admin_required", "after_count_not_permitted", "api_not_approved", "app_check_invalid", "app_check_missing", "article_not_found", "article_not_in_scope", "article_not_tracked", "cash_movement_exceeds_balance", "cashregister_not_assigned", "cashregister_not_found", "cashregister_token_invalid", "cashregister_token_missing", "comment_required", "count_already_voided", "count_not_found", "deposit_follows_item", "deposit_not_enabled", "deposit_return_not_offered", "deposit_set_by_server", "deposit_type_in_use", "deposit_type_not_found", "deposit_type_not_issued", "device_not_found", "dialect_mismatch", "drawer_inactive", "drawer_not_found", "filler_role_required", "idempotency_conflict", "idempotency_key_required", "internal_translation_error", "invalid_amount", "invalid_cursor", "invalid_denominations", "invalid_deposit", "invalid_deposit_quantity", "invalid_discount_preset", "invalid_item_kind", "invalid_movement_type", "invalid_quantity", "invalid_serial", "live_not_enabled", "location_inactive", "location_not_found", "logo_invalid", "logo_invalid_type", "logo_too_large", "method_not_allowed", "mfa_required", "module_inactive", "not_found", "not_permitted", "note_required", "password_change_required", "print_job_not_found", "print_layout_failed", "printer_not_found", "recount_exhausted", "register_user_no_business", "register_user_not_allowed", "register_user_not_found", "response_translation_failed", "second_factor_required", "serial_already_counted", "serial_not_allowed", "serial_required", "server_error", "session_expired", "session_other_cashregister", "shift_already_open", "shift_closed", "shift_mode_off", "shift_not_open", "stocktake_closed", "stocktake_closing", "stocktake_not_found", "stocktake_not_open", "tip_payout_exceeds_claim", "too_many_counts", "too_many_deposit_types", "transfer_same_drawer", "unauthorized", "user_disabled", "user_verification_failed", "validation", "route_missing"];
|
|
25
25
|
export type PosErrorCode = typeof POS_ERROR_CODES[number];
|
|
26
26
|
export declare function isPosErrorCode(value: unknown): value is PosErrorCode;
|
|
27
27
|
/** Der Code eines geworfenen Fehlers, wenn er in [POS_ERROR_CODES] steht; sonst `undefined`. */
|
package/dist/cjs/pos/errors.js
CHANGED
|
@@ -47,17 +47,28 @@ exports.POS_ERROR_CODES = Object.freeze([
|
|
|
47
47
|
'comment_required',
|
|
48
48
|
'count_already_voided',
|
|
49
49
|
'count_not_found',
|
|
50
|
+
'deposit_follows_item',
|
|
51
|
+
'deposit_not_enabled',
|
|
52
|
+
'deposit_return_not_offered',
|
|
53
|
+
'deposit_set_by_server',
|
|
54
|
+
'deposit_type_in_use',
|
|
55
|
+
'deposit_type_not_found',
|
|
56
|
+
'deposit_type_not_issued',
|
|
50
57
|
'device_not_found',
|
|
51
58
|
'dialect_mismatch',
|
|
52
59
|
'drawer_inactive',
|
|
53
60
|
'drawer_not_found',
|
|
61
|
+
'filler_role_required',
|
|
54
62
|
'idempotency_conflict',
|
|
55
63
|
'idempotency_key_required',
|
|
56
64
|
'internal_translation_error',
|
|
57
65
|
'invalid_amount',
|
|
58
66
|
'invalid_cursor',
|
|
59
67
|
'invalid_denominations',
|
|
68
|
+
'invalid_deposit',
|
|
69
|
+
'invalid_deposit_quantity',
|
|
60
70
|
'invalid_discount_preset',
|
|
71
|
+
'invalid_item_kind',
|
|
61
72
|
'invalid_movement_type',
|
|
62
73
|
'invalid_quantity',
|
|
63
74
|
'invalid_serial',
|
|
@@ -99,6 +110,7 @@ exports.POS_ERROR_CODES = Object.freeze([
|
|
|
99
110
|
'stocktake_not_open',
|
|
100
111
|
'tip_payout_exceeds_claim',
|
|
101
112
|
'too_many_counts',
|
|
113
|
+
'too_many_deposit_types',
|
|
102
114
|
'transfer_same_drawer',
|
|
103
115
|
'unauthorized',
|
|
104
116
|
'user_disabled',
|
|
@@ -17,7 +17,7 @@ export declare const ARTICLE_EXTERNAL_VOUCHER_TYPES: readonly ArticleExternalVou
|
|
|
17
17
|
/** Fehlercode beim Speichern eines Artikels, intern und unter `/v3` gleich. */
|
|
18
18
|
export declare const ARTICLE_EXTERNAL_VOUCHER_INVALID = "article_external_voucher_invalid";
|
|
19
19
|
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
20
|
-
export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "rate_required", "invalid_rate", "price_required"];
|
|
20
|
+
export declare const EXTERNAL_VOUCHER_ARTICLE_REASONS: readonly ["invalid_type", "service_voucher", "add_ons", "stock_tracked", "reference", "asks_quantity", "deposit", "rate_required", "invalid_rate", "price_required"];
|
|
21
21
|
export type ExternalVoucherArticleReason = typeof EXTERNAL_VOUCHER_ARTICLE_REASONS[number];
|
|
22
22
|
/**
|
|
23
23
|
* Ein Artikel im Editor (`/v3`-Form), soweit die Regeln ihn lesen. Bewusst
|
|
@@ -30,6 +30,7 @@ export interface ExternalVoucherArticleInput {
|
|
|
30
30
|
askPrice?: boolean | null;
|
|
31
31
|
serviceVoucher?: boolean | null;
|
|
32
32
|
addOns?: readonly unknown[] | null;
|
|
33
|
+
deposits?: readonly unknown[] | null;
|
|
33
34
|
stockTracked?: boolean | null;
|
|
34
35
|
reference?: unknown;
|
|
35
36
|
askQuantity?: boolean | null;
|
|
@@ -49,7 +50,7 @@ export declare function checkExternalVoucherValue(value: unknown): ExternalVouch
|
|
|
49
50
|
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
50
51
|
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
51
52
|
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
52
|
-
* Referenz oder
|
|
53
|
+
* Referenz, Mengenabfrage oder Pfand (die Kasse fragt die Nummer selbst und bucht
|
|
53
54
|
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
54
55
|
*/
|
|
55
56
|
export declare function checkExternalVoucherArticle(a: ExternalVoucherArticleInput): ExternalVoucherArticleReason | null;
|
|
@@ -10,7 +10,7 @@ exports.ARTICLE_EXTERNAL_VOUCHER_TYPES = Object.freeze(['multi_purpose', 'single
|
|
|
10
10
|
exports.ARTICLE_EXTERNAL_VOUCHER_INVALID = 'article_external_voucher_invalid';
|
|
11
11
|
/** Welche Regel verletzt ist (Antwortfeld `data.grund`), in der Reihenfolge, in der der Server prueft. */
|
|
12
12
|
exports.EXTERNAL_VOUCHER_ARTICLE_REASONS = Object.freeze([
|
|
13
|
-
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'rate_required', 'invalid_rate', 'price_required',
|
|
13
|
+
'invalid_type', 'service_voucher', 'add_ons', 'stock_tracked', 'reference', 'asks_quantity', 'deposit', 'rate_required', 'invalid_rate', 'price_required',
|
|
14
14
|
]);
|
|
15
15
|
/**
|
|
16
16
|
* Saetze, mit denen ein Einzweckgutschein verkauft werden kann (Prozent wie
|
|
@@ -31,7 +31,7 @@ function checkExternalVoucherValue(value) {
|
|
|
31
31
|
* `pruefeArtikel`: `null` = passt. Ohne `externalVoucher` gilt keine Regel.
|
|
32
32
|
* Einzweck verlangt einen Satz der Kasse (0 = befreit verkauft), Mehrzweck ignoriert ihn;
|
|
33
33
|
* nie zusammen mit Leistungsgutschein, eigener Zusatzliste, Lagerbestand,
|
|
34
|
-
* Referenz oder
|
|
34
|
+
* Referenz, Mengenabfrage oder Pfand (die Kasse fragt die Nummer selbst und bucht
|
|
35
35
|
* genau einen); ohne `askPrice` braucht er einen Preis ab 1 Cent.
|
|
36
36
|
*/
|
|
37
37
|
function checkExternalVoucherArticle(a) {
|
|
@@ -49,6 +49,8 @@ function checkExternalVoucherArticle(a) {
|
|
|
49
49
|
return 'reference';
|
|
50
50
|
if (a.askQuantity === true)
|
|
51
51
|
return 'asks_quantity';
|
|
52
|
+
if (Array.isArray(a.deposits) && a.deposits.length > 0)
|
|
53
|
+
return 'deposit';
|
|
52
54
|
if (a.externalVoucher === 'single_purpose' && !(typeof a.vatRate === 'number' && Number.isFinite(a.vatRate)))
|
|
53
55
|
return 'rate_required';
|
|
54
56
|
if (a.externalVoucher === 'single_purpose' && !exports.ARTICLE_EXTERNAL_VOUCHER_VAT_RATES.includes(a.vatRate))
|
package/dist/cjs/pos/index.d.ts
CHANGED
|
@@ -10,18 +10,20 @@ export { type PosTheme, type PosFontSize, type PosWatermark, type PosQuantity, t
|
|
|
10
10
|
export { type ArticleGroup, type ArticleGroupPayload, fromArticleGroupPayload, type PosArticle, type PosArticlePayload, fromPosArticlePayload, listMyArticleGroups, listMyArticles, QUANTITY_RULES, type QuantityRule, type QuantityDefaults, quantityRuleForUnit, quantityDefaults, allowedQuantity, isBookableArticle, tilePrompts, } from './artikel.js';
|
|
11
11
|
export { REFERENCE_MODES, type ReferenceMode, type PosReference, REFERENCE_INPUT_MAX, REFERENCE_LABEL_MAX, REFERENCE_HINT_MAX, REFERENCE_PATTERN_MAX, REFERENCE_PATTERN_TEMPLATES, cleanReferenceText, isValidReferencePattern, isDigitsOnlyPattern, type ReferenceCheckResult, checkReference, referenceLineName, fromReferencePayload, } from './kachel-referenz.js';
|
|
12
12
|
export { ADD_ONS_MAX, ADD_ON_BLOCK_REASONS, type AddOnBlockReason, isSelectableAddOn, addOnsFor, addOnReferencesValid, addOnsOfItem, addOnRemap, addOnDisplayOrder, orderAddOnLines, } from './zusaetze.js';
|
|
13
|
+
export { DEPOSIT_KINDS, type DepositKind, DEPOSIT_TYPES, type DepositContainerType, DEPOSIT_RETURN_MODES, type DepositReturnMode, DEPOSIT_ON_PREMISES_DEFAULTS, type DepositOnPremisesDefault, type DepositAmount, type DepositType, type DepositSettings, type DepositEntry, type DepositSharedReturnPoint, type CashRegisterDeposit, posDepositSettingsFromWire, depositEntriesFromWire, cashRegisterDepositFromWire, depositsFor, depositAmountOn, viennaDay, withDepositLines, depositReturnLine, type DepositPreviewItem, type DepositPreviewLine, type DepositPreviewInput, type DepositPreviewArticle, type DepositPreviewResult, type DepositPreviewErrorCode, } from './pfand.js';
|
|
13
14
|
export { ARTICLE_EXTERNAL_VOUCHER_TYPES, type ArticleExternalVoucher, ARTICLE_EXTERNAL_VOUCHER_INVALID, ARTICLE_EXTERNAL_VOUCHER_VAT_RATES, EXTERNAL_VOUCHER_ARTICLE_REASONS, type ExternalVoucherArticleReason, type ExternalVoucherArticleInput, isArticleExternalVoucher, checkExternalVoucherValue, checkExternalVoucherArticle, type ExternalVoucherTileBlock, externalVoucherTileBlock, } from './fremdgutschein-artikel.js';
|
|
14
15
|
export { ownVoucherCodeShape, OWN_VOUCHER_CODE_SHAPES, type OwnVoucherCodeShape } from '../models/voucher.js';
|
|
15
16
|
export { getPosSettings, setMyPosSettings, setMyRegisterDeviceSettings, setMyPosLogo, posSettingsFromWire, type SetMyPosLogoOptions, } from './client.js';
|
|
16
17
|
export { POS_ERROR_CODES, type PosErrorCode, isPosErrorCode, posErrorCode, isPosError, type PosFieldError, posFieldErrors, } from './errors.js';
|
|
17
18
|
export { distributeDiscount } from '../receipt/discount.js';
|
|
18
|
-
export { cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, type VoucherPerms, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
19
|
+
export { cancelScopeOf, receiptsScopeOf, stockViewOf, voucherPermsOf, depositReturnOf, type VoucherPerms, type RegisterScope, type RegisterUserPerms } from '../register/pairing.js';
|
|
19
20
|
export { type NetworkPrinter, type PrintJob, type PrintJobStatus, PRINT_JOB_STATUSES, type PrintJobSource, PRINT_JOB_SOURCES, isPrintJobFinished, type CreatePrintJobOptions, listMyPrinters, createPrintJob, getPrintJob, } from './drucker.js';
|
|
20
21
|
export { listMyTipRecipients } from './trinkgeld.js';
|
|
21
22
|
export { posDiscountPresets, discountPresetChipText, discountChipsFromPresets, checkDiscountPresets, discountBlockLines, INVALID_DISCOUNT_PRESET, DISCOUNT_PRESETS_MAX, DISCOUNT_PRESET_NAME_MAX, DISCOUNT_PRESET_PERCENT_BP, DISCOUNT_PRESET_AMOUNT_CENTS, DISCOUNT_PRESET_MESSAGES, type DiscountPresetReason, type DiscountPresetError, type DiscountPresetsCheck, type DiscountBlockLine, type DiscountTotal, } from './rabatt-vorlagen.js';
|
|
22
23
|
export { depFolderName } from './dep.js';
|
|
23
24
|
export { type RegisterInspectionInfo, type RegisterInspectionSignature, type InspectionSignatureStatus, type InspectionInfoRow, type InspectionInfoRowKey, type InspectionInfoSection, type InspectionInfoLinesOptions, getRegisterInspectionInfo, inspectionInfoRows, inspectionInfoLines, } from './kasseninfo.js';
|
|
24
25
|
export { type ConnectStateReport, reportConnectState } from './connect-bestand.js';
|
|
26
|
+
export { type ReturnCode, type ReturnCodeEntry, type ReturnCodeMatch, type ReturnCodeArticle, type ReturnCodeGroup, type ReturnCodeInput, learnReturnCode, listReturnCodes, matchReturnCode, } from './leergut.js';
|
|
25
27
|
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';
|
|
26
28
|
export { type ListMyStocktakesOptions, type ListMyStocktakeItemsOptions, type ListMyStocktakeCountsOptions, type RecordMyStocktakeCountOptions, type VoidMyStocktakeCountOptions, listMyStocktakes, listMyStocktakeItems, listMyStocktakeCounts, recordMyStocktakeCount, voidMyStocktakeCount, parseQuantityMilli, } from './inventur.js';
|
|
27
29
|
export type { Stocktake, StocktakeItem, StocktakeCount, StocktakeCountResult, StocktakeItemPage, StocktakeCountPage, StocktakeActor, StocktakeProgress, StocktakeReview, StocktakeRecount, StocktakeScope, } from '../inventory/typen.js';
|
|
@@ -32,5 +34,5 @@ export { EUR_DENOMINATIONS, MOVEMENT_TYPES, MANUAL_MOVEMENT_TYPES, CASH_LOCATION
|
|
|
32
34
|
export { type ShiftReceiptLayoutOptions, shiftReceiptLayout, cashMovementLayout } from '../receipt/shift-sheet.js';
|
|
33
35
|
export { RECEIPT_OUTPUT_KINDS, RECEIPT_OUTPUT_RESULTS, type ReceiptOutputKind, type ReceiptOutputResult } from '../models/receipt-output.js';
|
|
34
36
|
export { RETURN_DISPOSITIONS, isReturnDisposition, type ReturnDisposition } from '../models/cancellation.js';
|
|
35
|
-
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, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, EXTERNAL_VOUCHER_TILE_MESSAGES, EXTERNAL_VOUCHER_ARTICLE_MESSAGES, externalVoucherArticleErrorMessage, EXTERNAL_VOUCHERS_LABELS, EXTERNAL_VOUCHER_KIND_LABELS, TIP_KEPT_MODE_LABELS, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
37
|
+
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, CANCELLATION_VOUCHER_ERROR_MESSAGES, cancellationErrorMessage, VOUCHER_ERROR_MESSAGES, voucherErrorMessage, DEPOSIT_ERROR_MESSAGES, depositErrorMessage, EXTERNAL_VOUCHER_TILE_MESSAGES, EXTERNAL_VOUCHER_ARTICLE_MESSAGES, externalVoucherArticleErrorMessage, EXTERNAL_VOUCHERS_LABELS, EXTERNAL_VOUCHER_KIND_LABELS, TIP_KEPT_MODE_LABELS, LABELS, labelText, RETURN_DISPOSITION_LABELS, receiptOutputLabel, type TextEntry, type MessageKey, type ErrorKind, type ErrorRule, type ErrorRuleDetail, type Surface, type ReceiptEmailMessageCode, type CancellationPaymentMessageCode, type LabelKey, } from './texte.js';
|
|
36
38
|
export { roundUpSuggestions } from './aufrunden.js';
|
package/dist/cjs/pos/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SETTINGS_FONT_SIZE = exports.LOGO_SIZE = exports.QR_MODE = exports.DRAWER_AUTO_OPEN = exports.CUT = exports.CODE_PAGE = exports.PAPER_SIZE = exports.TERMINAL_TYPE = exports.TERMINAL_VIA = exports.PRINTER_TYPE = exports.TILE_HEIGHT = exports.CATEGORY_POSITION = exports.LAYOUT = exports.RECEIPT_OUTPUT = exports.CARD_PROVIDER = exports.CHECKOUT_MODE = exports.CART_WIDTH = exports.TIP_KEPT_MODE = exports.TIP_START = exports.TIP_KINDS = exports.TIP_MODE = exports.QUANTITY = exports.WATERMARK = exports.FONT_SIZE = exports.THEME = exports.posShortcutConflict = exports.POS_SHORTCUT_SHARED_PAIRS = exports.posSettingsChanges = exports.unknownPosSettingValues = exports.sanitizePosSettings = exports.mergePosSettings = exports.POS_DEVICE_VALUES = exports.POS_BUSINESS_VALUES = exports.posCartWidth = exports.posTipStart = exports.posTipKinds = exports.POS_BUSINESS_OPTIONAL_LISTS = exports.DISCOUNT_PRESET_KIND = exports.tipKeptFor = exports.posTipKeptMode = exports.posCustomDiscountAllowed = exports.posTipKeptByDefault = exports.POS_DEVICE_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_CHOICES = exports.POS_BUSINESS_OPTIONAL_FIELDS = exports.POS_DEVICE_OPTIONAL_FIELDS = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.POS_SHORTCUT_DEFAULTS = exports.POS_SHORTCUT_ACTIONS = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.roundUpSuggestions = exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.TIP_KEPT_MODE_LABELS = exports.EXTERNAL_VOUCHER_KIND_LABELS = exports.EXTERNAL_VOUCHERS_LABELS = exports.externalVoucherArticleErrorMessage = exports.EXTERNAL_VOUCHER_ARTICLE_MESSAGES = exports.EXTERNAL_VOUCHER_TILE_MESSAGES = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = void 0;
|
|
4
|
+
exports.withDepositLines = exports.viennaDay = exports.depositAmountOn = exports.depositsFor = exports.cashRegisterDepositFromWire = exports.depositEntriesFromWire = exports.posDepositSettingsFromWire = exports.DEPOSIT_ON_PREMISES_DEFAULTS = exports.DEPOSIT_RETURN_MODES = exports.DEPOSIT_TYPES = exports.DEPOSIT_KINDS = exports.orderAddOnLines = exports.addOnDisplayOrder = exports.addOnRemap = exports.addOnsOfItem = exports.addOnReferencesValid = exports.addOnsFor = exports.isSelectableAddOn = exports.ADD_ON_BLOCK_REASONS = exports.ADD_ONS_MAX = exports.fromReferencePayload = exports.referenceLineName = exports.checkReference = exports.isDigitsOnlyPattern = exports.isValidReferencePattern = exports.cleanReferenceText = exports.REFERENCE_PATTERN_TEMPLATES = exports.REFERENCE_PATTERN_MAX = exports.REFERENCE_HINT_MAX = exports.REFERENCE_LABEL_MAX = exports.REFERENCE_INPUT_MAX = exports.REFERENCE_MODES = exports.tilePrompts = exports.isBookableArticle = exports.allowedQuantity = exports.quantityDefaults = exports.quantityRuleForUnit = exports.QUANTITY_RULES = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.DONE_SCREEN_SECONDS = exports.WATERMARK_SCALE = exports.LOGO_SCALE = exports.WATERMARK_STRENGTH = exports.WATERMARK_SIDE = exports.DISCOUNT = exports.AUTO_LOGOUT_MINUTES = exports.TILE_STYLE = void 0;
|
|
5
|
+
exports.reportConnectState = exports.inspectionInfoLines = exports.inspectionInfoRows = exports.getRegisterInspectionInfo = exports.depFolderName = exports.DISCOUNT_PRESET_MESSAGES = exports.DISCOUNT_PRESET_AMOUNT_CENTS = exports.DISCOUNT_PRESET_PERCENT_BP = exports.DISCOUNT_PRESET_NAME_MAX = exports.DISCOUNT_PRESETS_MAX = exports.INVALID_DISCOUNT_PRESET = exports.discountBlockLines = exports.checkDiscountPresets = exports.discountChipsFromPresets = exports.discountPresetChipText = exports.posDiscountPresets = exports.listMyTipRecipients = exports.getPrintJob = exports.createPrintJob = exports.listMyPrinters = exports.isPrintJobFinished = exports.PRINT_JOB_SOURCES = exports.PRINT_JOB_STATUSES = exports.depositReturnOf = exports.voucherPermsOf = exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.posFieldErrors = exports.isPosError = exports.posErrorCode = exports.isPosErrorCode = exports.POS_ERROR_CODES = exports.posSettingsFromWire = exports.setMyPosLogo = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.OWN_VOUCHER_CODE_SHAPES = exports.ownVoucherCodeShape = exports.externalVoucherTileBlock = exports.checkExternalVoucherArticle = exports.checkExternalVoucherValue = exports.isArticleExternalVoucher = exports.EXTERNAL_VOUCHER_ARTICLE_REASONS = exports.ARTICLE_EXTERNAL_VOUCHER_VAT_RATES = exports.ARTICLE_EXTERNAL_VOUCHER_INVALID = exports.ARTICLE_EXTERNAL_VOUCHER_TYPES = exports.depositReturnLine = void 0;
|
|
6
|
+
exports.RECEIPT_OUTPUT_RESULTS = exports.RECEIPT_OUTPUT_KINDS = exports.cashMovementLayout = exports.shiftReceiptLayout = exports.DIFFERENCE_PART_TYPES = exports.EXPECTED_PART_KEYS = exports.AFTER_COUNT_TYPES = exports.SHIFT_RECEIPT_KINDS = exports.MANUAL_OPENING_REASONS = exports.OPENING_REASONS = exports.CASH_LOCATIONS = exports.MANUAL_MOVEMENT_TYPES = exports.MOVEMENT_TYPES = exports.EUR_DENOMINATIONS = exports.durationText = exports.shiftTipLines = exports.newIdempotencyKey = exports.parseCentsAllowZero = exports.sumDenominations = exports.recordMyShiftCount = exports.closeMyShift = exports.getMyShiftReport = exports.logMyDrawerOpenings = exports.recordMyCashMovement = exports.openMyShift = exports.getMyDrawerState = exports.EXTERNAL_VOUCHERS = exports.VOUCHER_TYPE_VALIDITY_PATTERNS = exports.VOUCHER_AMOUNT_MODES = exports.VOUCHER_TYPE_KINDS = exports.VOUCHER_PAYOUTS = exports.posVoucherSettingsFromWire = exports.VOUCHER_SETTINGS_DEFAULTS = exports.reprintVoucherLabel = exports.checkVoucher = exports.VOUCHER_STATUSES = exports.VOUCHER_KINDS = exports.parseQuantityMilli = exports.voidMyStocktakeCount = exports.recordMyStocktakeCount = exports.listMyStocktakeCounts = exports.listMyStocktakeItems = exports.listMyStocktakes = exports.setMyCashregisterStockLocation = exports.listMyStock = exports.listMyStockLocations = exports.STOCK_LOCATION_TYPES = exports.matchReturnCode = exports.listReturnCodes = exports.learnReturnCode = void 0;
|
|
7
|
+
exports.roundUpSuggestions = exports.receiptOutputLabel = exports.RETURN_DISPOSITION_LABELS = exports.labelText = exports.LABELS = exports.TIP_KEPT_MODE_LABELS = exports.EXTERNAL_VOUCHER_KIND_LABELS = exports.EXTERNAL_VOUCHERS_LABELS = exports.externalVoucherArticleErrorMessage = exports.EXTERNAL_VOUCHER_ARTICLE_MESSAGES = exports.EXTERNAL_VOUCHER_TILE_MESSAGES = exports.depositErrorMessage = exports.DEPOSIT_ERROR_MESSAGES = exports.voucherErrorMessage = exports.VOUCHER_ERROR_MESSAGES = exports.cancellationErrorMessage = exports.CANCELLATION_VOUCHER_ERROR_MESSAGES = exports.cancellationPaymentErrorMessage = exports.CANCELLATION_PAYMENT_ERROR_MESSAGES = exports.receiptEmailErrorMessage = exports.RECEIPT_EMAIL_ERROR_MESSAGES = exports.messageAppliesTo = exports.messageText = exports.messageOutcome = exports.findErrorRule = exports.CALLS_WITH_EFFECT = exports.ERROR_OUTCOME_RULES = exports.ERROR_CODE_RULES = exports.ERROR_RULES = exports.MESSAGES = exports.isReturnDisposition = exports.RETURN_DISPOSITIONS = void 0;
|
|
8
8
|
/**
|
|
9
9
|
* Kachel-Kasse: Einstellungen, Artikelgruppen/Artikel fuer Kacheln,
|
|
10
10
|
* Rabattverteilung, Drucker, Trinkgeld-Empfaenger, Lager (Standorte, Bestand,
|
|
@@ -107,6 +107,19 @@ Object.defineProperty(exports, "addOnsOfItem", { enumerable: true, get: function
|
|
|
107
107
|
Object.defineProperty(exports, "addOnRemap", { enumerable: true, get: function () { return zusaetze_js_1.addOnRemap; } });
|
|
108
108
|
Object.defineProperty(exports, "addOnDisplayOrder", { enumerable: true, get: function () { return zusaetze_js_1.addOnDisplayOrder; } });
|
|
109
109
|
Object.defineProperty(exports, "orderAddOnLines", { enumerable: true, get: function () { return zusaetze_js_1.orderAddOnLines; } });
|
|
110
|
+
var pfand_js_1 = require("./pfand.js");
|
|
111
|
+
Object.defineProperty(exports, "DEPOSIT_KINDS", { enumerable: true, get: function () { return pfand_js_1.DEPOSIT_KINDS; } });
|
|
112
|
+
Object.defineProperty(exports, "DEPOSIT_TYPES", { enumerable: true, get: function () { return pfand_js_1.DEPOSIT_TYPES; } });
|
|
113
|
+
Object.defineProperty(exports, "DEPOSIT_RETURN_MODES", { enumerable: true, get: function () { return pfand_js_1.DEPOSIT_RETURN_MODES; } });
|
|
114
|
+
Object.defineProperty(exports, "DEPOSIT_ON_PREMISES_DEFAULTS", { enumerable: true, get: function () { return pfand_js_1.DEPOSIT_ON_PREMISES_DEFAULTS; } });
|
|
115
|
+
Object.defineProperty(exports, "posDepositSettingsFromWire", { enumerable: true, get: function () { return pfand_js_1.posDepositSettingsFromWire; } });
|
|
116
|
+
Object.defineProperty(exports, "depositEntriesFromWire", { enumerable: true, get: function () { return pfand_js_1.depositEntriesFromWire; } });
|
|
117
|
+
Object.defineProperty(exports, "cashRegisterDepositFromWire", { enumerable: true, get: function () { return pfand_js_1.cashRegisterDepositFromWire; } });
|
|
118
|
+
Object.defineProperty(exports, "depositsFor", { enumerable: true, get: function () { return pfand_js_1.depositsFor; } });
|
|
119
|
+
Object.defineProperty(exports, "depositAmountOn", { enumerable: true, get: function () { return pfand_js_1.depositAmountOn; } });
|
|
120
|
+
Object.defineProperty(exports, "viennaDay", { enumerable: true, get: function () { return pfand_js_1.viennaDay; } });
|
|
121
|
+
Object.defineProperty(exports, "withDepositLines", { enumerable: true, get: function () { return pfand_js_1.withDepositLines; } });
|
|
122
|
+
Object.defineProperty(exports, "depositReturnLine", { enumerable: true, get: function () { return pfand_js_1.depositReturnLine; } });
|
|
110
123
|
var fremdgutschein_artikel_js_1 = require("./fremdgutschein-artikel.js");
|
|
111
124
|
Object.defineProperty(exports, "ARTICLE_EXTERNAL_VOUCHER_TYPES", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.ARTICLE_EXTERNAL_VOUCHER_TYPES; } });
|
|
112
125
|
Object.defineProperty(exports, "ARTICLE_EXTERNAL_VOUCHER_INVALID", { enumerable: true, get: function () { return fremdgutschein_artikel_js_1.ARTICLE_EXTERNAL_VOUCHER_INVALID; } });
|
|
@@ -141,6 +154,7 @@ Object.defineProperty(exports, "cancelScopeOf", { enumerable: true, get: functio
|
|
|
141
154
|
Object.defineProperty(exports, "receiptsScopeOf", { enumerable: true, get: function () { return pairing_js_1.receiptsScopeOf; } });
|
|
142
155
|
Object.defineProperty(exports, "stockViewOf", { enumerable: true, get: function () { return pairing_js_1.stockViewOf; } });
|
|
143
156
|
Object.defineProperty(exports, "voucherPermsOf", { enumerable: true, get: function () { return pairing_js_1.voucherPermsOf; } });
|
|
157
|
+
Object.defineProperty(exports, "depositReturnOf", { enumerable: true, get: function () { return pairing_js_1.depositReturnOf; } });
|
|
144
158
|
var drucker_js_1 = require("./drucker.js");
|
|
145
159
|
Object.defineProperty(exports, "PRINT_JOB_STATUSES", { enumerable: true, get: function () { return drucker_js_1.PRINT_JOB_STATUSES; } });
|
|
146
160
|
Object.defineProperty(exports, "PRINT_JOB_SOURCES", { enumerable: true, get: function () { return drucker_js_1.PRINT_JOB_SOURCES; } });
|
|
@@ -173,6 +187,10 @@ Object.defineProperty(exports, "inspectionInfoLines", { enumerable: true, get: f
|
|
|
173
187
|
// Connect-Bestand: die Kasse meldet Version und System von Kasseneck Connect.
|
|
174
188
|
var connect_bestand_js_1 = require("./connect-bestand.js");
|
|
175
189
|
Object.defineProperty(exports, "reportConnectState", { enumerable: true, get: function () { return connect_bestand_js_1.reportConnectState; } });
|
|
190
|
+
var leergut_js_1 = require("./leergut.js");
|
|
191
|
+
Object.defineProperty(exports, "learnReturnCode", { enumerable: true, get: function () { return leergut_js_1.learnReturnCode; } });
|
|
192
|
+
Object.defineProperty(exports, "listReturnCodes", { enumerable: true, get: function () { return leergut_js_1.listReturnCodes; } });
|
|
193
|
+
Object.defineProperty(exports, "matchReturnCode", { enumerable: true, get: function () { return leergut_js_1.matchReturnCode; } });
|
|
176
194
|
var lager_js_1 = require("./lager.js");
|
|
177
195
|
Object.defineProperty(exports, "STOCK_LOCATION_TYPES", { enumerable: true, get: function () { return lager_js_1.STOCK_LOCATION_TYPES; } });
|
|
178
196
|
Object.defineProperty(exports, "listMyStockLocations", { enumerable: true, get: function () { return lager_js_1.listMyStockLocations; } });
|
|
@@ -253,6 +271,8 @@ Object.defineProperty(exports, "CANCELLATION_VOUCHER_ERROR_MESSAGES", { enumerab
|
|
|
253
271
|
Object.defineProperty(exports, "cancellationErrorMessage", { enumerable: true, get: function () { return texte_js_1.cancellationErrorMessage; } });
|
|
254
272
|
Object.defineProperty(exports, "VOUCHER_ERROR_MESSAGES", { enumerable: true, get: function () { return texte_js_1.VOUCHER_ERROR_MESSAGES; } });
|
|
255
273
|
Object.defineProperty(exports, "voucherErrorMessage", { enumerable: true, get: function () { return texte_js_1.voucherErrorMessage; } });
|
|
274
|
+
Object.defineProperty(exports, "DEPOSIT_ERROR_MESSAGES", { enumerable: true, get: function () { return texte_js_1.DEPOSIT_ERROR_MESSAGES; } });
|
|
275
|
+
Object.defineProperty(exports, "depositErrorMessage", { enumerable: true, get: function () { return texte_js_1.depositErrorMessage; } });
|
|
256
276
|
Object.defineProperty(exports, "EXTERNAL_VOUCHER_TILE_MESSAGES", { enumerable: true, get: function () { return texte_js_1.EXTERNAL_VOUCHER_TILE_MESSAGES; } });
|
|
257
277
|
Object.defineProperty(exports, "EXTERNAL_VOUCHER_ARTICLE_MESSAGES", { enumerable: true, get: function () { return texte_js_1.EXTERNAL_VOUCHER_ARTICLE_MESSAGES; } });
|
|
258
278
|
Object.defineProperty(exports, "externalVoucherArticleErrorMessage", { enumerable: true, get: function () { return texte_js_1.externalVoucherArticleErrorMessage; } });
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leergut-Codes an der Kasse (Pfand & Leergut): ein Code, den die Kasse im Leergut-Blatt noch nicht kennt,
|
|
3
|
+
* wird einer Pfandart zugeordnet und gelernt (`learnReturnCode`); `listReturnCodes` liest die gelernten Codes.
|
|
4
|
+
* `matchReturnCode` ist die Regel, mit der ein Scan im Leergut-Blatt einer Pfandart zugeordnet wird – Web-Kasse
|
|
5
|
+
* und Kassen-App (ueber den Dart-Zwilling) benutzen genau diese Regel.
|
|
6
|
+
*/
|
|
7
|
+
import type { InternerTransport } from '../client/aufrufe.js';
|
|
8
|
+
import { type DepositEntry, type DepositType } from './pfand.js';
|
|
9
|
+
/** Ein gelernter Leergut-Code: die GTIN und die Pfandart, der sie zugeordnet ist. */
|
|
10
|
+
export interface ReturnCode {
|
|
11
|
+
gtin: string;
|
|
12
|
+
depositTypeId: string;
|
|
13
|
+
}
|
|
14
|
+
/** Eine Zeile der Zuordnung: Pfandart und Stueckzahl, die ein Scan ins Leergut-Blatt bringt. */
|
|
15
|
+
export interface ReturnCodeEntry {
|
|
16
|
+
depositTypeId: string;
|
|
17
|
+
quantity: number;
|
|
18
|
+
}
|
|
19
|
+
/** Ergebnis von `matchReturnCode`: die Eintraege oder `unknown` (Code ist keiner Pfandart zuzuordnen). */
|
|
20
|
+
export type ReturnCodeMatch = {
|
|
21
|
+
entries: ReturnCodeEntry[];
|
|
22
|
+
} | {
|
|
23
|
+
unknown: true;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Lernt einen Leergut-Code (`learnMyLeergutCode`, nur Kassenweg, Recht `depositReturn`): `gtin` muss eine gueltige
|
|
27
|
+
* GTIN sein, `depositTypeId` eine aktive Pfandart. Die Form wird vor dem Senden geprueft; was der Server nicht
|
|
28
|
+
* annimmt, lehnt er mit `invalid_deposit` oder `deposit_type_not_found` ab.
|
|
29
|
+
*/
|
|
30
|
+
export declare function learnReturnCode(transport: InternerTransport, code: ReturnCode): Promise<ReturnCode>;
|
|
31
|
+
/** Liest die gelernten Leergut-Codes (`listMyLeergutCodes`, nur Kassenweg): nur aktive Pfandarten, nach GTIN sortiert. */
|
|
32
|
+
export declare function listReturnCodes(transport: InternerTransport): Promise<ReturnCode[]>;
|
|
33
|
+
/** Was `matchReturnCode` von einem Artikel braucht (Teil von `PosArticle`). */
|
|
34
|
+
export interface ReturnCodeArticle {
|
|
35
|
+
groupId?: string | null;
|
|
36
|
+
ean?: string | null;
|
|
37
|
+
number?: string | null;
|
|
38
|
+
internalCode?: string | null;
|
|
39
|
+
deposits?: DepositEntry[] | null;
|
|
40
|
+
externalVoucher?: unknown;
|
|
41
|
+
}
|
|
42
|
+
/** Was `matchReturnCode` von einer Gruppe braucht (Teil von `ArticleGroup`). */
|
|
43
|
+
export interface ReturnCodeGroup {
|
|
44
|
+
id: string;
|
|
45
|
+
deposits?: DepositEntry[] | null;
|
|
46
|
+
}
|
|
47
|
+
export interface ReturnCodeInput {
|
|
48
|
+
articles: ReadonlyArray<ReturnCodeArticle>;
|
|
49
|
+
groups: ReadonlyArray<ReturnCodeGroup>;
|
|
50
|
+
learned: ReadonlyArray<ReturnCode>;
|
|
51
|
+
depositTypes: ReadonlyArray<Pick<DepositType, 'id' | 'active'>>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Ordnet einen Scan im Leergut-Blatt einer Pfandart zu. Reihenfolge: (1) gelernter Code -> 1 Stueck; (2) `gtin` eines
|
|
55
|
+
* Pfandeintrags an Artikel oder Gruppe -> 1 Stueck dieser Pfandart; (3) Artikel-EAN, -Nummer oder -Code mit wirksamer
|
|
56
|
+
* Pfandliste -> jeder Eintrag mit seiner `quantity` (Kiste: 1 Kiste + 20 Flaschen); sonst `unknown`. Es zaehlen nur
|
|
57
|
+
* aktive Pfandarten: ein Treffer auf eine stillgelegte oder unbekannte Pfandart ist `unknown` (die Suche endet am
|
|
58
|
+
* ersten Treffer, sie faellt nicht auf die naechste Stufe zurueck). Der Code wird getrimmt, ein leerer ist `unknown`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function matchReturnCode(code: string, input: ReturnCodeInput): ReturnCodeMatch;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Leergut-Codes an der Kasse (Pfand & Leergut): ein Code, den die Kasse im Leergut-Blatt noch nicht kennt,
|
|
4
|
+
* wird einer Pfandart zugeordnet und gelernt (`learnReturnCode`); `listReturnCodes` liest die gelernten Codes.
|
|
5
|
+
* `matchReturnCode` ist die Regel, mit der ein Scan im Leergut-Blatt einer Pfandart zugeordnet wird – Web-Kasse
|
|
6
|
+
* und Kassen-App (ueber den Dart-Zwilling) benutzen genau diese Regel.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.learnReturnCode = learnReturnCode;
|
|
10
|
+
exports.listReturnCodes = listReturnCodes;
|
|
11
|
+
exports.matchReturnCode = matchReturnCode;
|
|
12
|
+
const validator_1 = require("@kreiseck/validator");
|
|
13
|
+
const errors_js_1 = require("../client/errors.js");
|
|
14
|
+
const pfand_js_1 = require("./pfand.js");
|
|
15
|
+
const istObjekt = (w) => w !== null && typeof w === 'object' && !Array.isArray(w);
|
|
16
|
+
function leergutCode(wert) {
|
|
17
|
+
if (!istObjekt(wert) || typeof wert['gtin'] !== 'string' || typeof wert['depositTypeId'] !== 'string')
|
|
18
|
+
return null;
|
|
19
|
+
return { gtin: wert['gtin'], depositTypeId: wert['depositTypeId'] };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Lernt einen Leergut-Code (`learnMyLeergutCode`, nur Kassenweg, Recht `depositReturn`): `gtin` muss eine gueltige
|
|
23
|
+
* GTIN sein, `depositTypeId` eine aktive Pfandart. Die Form wird vor dem Senden geprueft; was der Server nicht
|
|
24
|
+
* annimmt, lehnt er mit `invalid_deposit` oder `deposit_type_not_found` ab.
|
|
25
|
+
*/
|
|
26
|
+
async function learnReturnCode(transport, code) {
|
|
27
|
+
const name = 'learnMyLeergutCode';
|
|
28
|
+
const anfrage = (grund) => new errors_js_1.KasseneckValidationError(name, grund, 'request');
|
|
29
|
+
if (!istObjekt(code))
|
|
30
|
+
throw anfrage('Anfrage muss ein Objekt sein');
|
|
31
|
+
const fremd = Object.keys(code).find((k) => k !== 'gtin' && k !== 'depositTypeId');
|
|
32
|
+
if (fremd != null)
|
|
33
|
+
throw anfrage(`unbekanntes Feld "${fremd}"`);
|
|
34
|
+
if (typeof code.gtin !== 'string' || !validator_1.Gtin.isValid(code.gtin))
|
|
35
|
+
throw anfrage('gtin ist keine gueltige GTIN');
|
|
36
|
+
if (typeof code.depositTypeId !== 'string' || code.depositTypeId === '')
|
|
37
|
+
throw anfrage('depositTypeId fehlt');
|
|
38
|
+
const antwort = await transport(name, { gtin: code.gtin, depositTypeId: code.depositTypeId });
|
|
39
|
+
return leergutCode(antwort) ?? { gtin: code.gtin, depositTypeId: code.depositTypeId };
|
|
40
|
+
}
|
|
41
|
+
/** Liest die gelernten Leergut-Codes (`listMyLeergutCodes`, nur Kassenweg): nur aktive Pfandarten, nach GTIN sortiert. */
|
|
42
|
+
async function listReturnCodes(transport) {
|
|
43
|
+
const antwort = await transport('listMyLeergutCodes', {});
|
|
44
|
+
const liste = istObjekt(antwort) && Array.isArray(antwort['codes']) ? antwort['codes'] : [];
|
|
45
|
+
return liste.map(leergutCode).filter((c) => c != null);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Ordnet einen Scan im Leergut-Blatt einer Pfandart zu. Reihenfolge: (1) gelernter Code -> 1 Stueck; (2) `gtin` eines
|
|
49
|
+
* Pfandeintrags an Artikel oder Gruppe -> 1 Stueck dieser Pfandart; (3) Artikel-EAN, -Nummer oder -Code mit wirksamer
|
|
50
|
+
* Pfandliste -> jeder Eintrag mit seiner `quantity` (Kiste: 1 Kiste + 20 Flaschen); sonst `unknown`. Es zaehlen nur
|
|
51
|
+
* aktive Pfandarten: ein Treffer auf eine stillgelegte oder unbekannte Pfandart ist `unknown` (die Suche endet am
|
|
52
|
+
* ersten Treffer, sie faellt nicht auf die naechste Stufe zurueck). Der Code wird getrimmt, ein leerer ist `unknown`.
|
|
53
|
+
*/
|
|
54
|
+
function matchReturnCode(code, input) {
|
|
55
|
+
const unbekannt = { unknown: true };
|
|
56
|
+
const gesucht = typeof code === 'string' ? code.trim() : '';
|
|
57
|
+
if (gesucht === '')
|
|
58
|
+
return unbekannt;
|
|
59
|
+
const aktiv = new Set(input.depositTypes.filter((t) => t.active).map((t) => t.id));
|
|
60
|
+
const eins = (depositTypeId) => (aktiv.has(depositTypeId) ? { entries: [{ depositTypeId, quantity: 1 }] } : unbekannt);
|
|
61
|
+
const gelernt = input.learned.find((l) => l.gtin === gesucht);
|
|
62
|
+
if (gelernt != null)
|
|
63
|
+
return eins(gelernt.depositTypeId);
|
|
64
|
+
const gruppeVon = (a) => input.groups.find((g) => g.id === a.groupId) ?? null;
|
|
65
|
+
for (const a of input.articles) {
|
|
66
|
+
const hit = ((0, pfand_js_1.depositsFor)(a, gruppeVon(a))).find((d) => d.gtin === gesucht);
|
|
67
|
+
if (hit != null)
|
|
68
|
+
return eins(hit.depositTypeId);
|
|
69
|
+
}
|
|
70
|
+
for (const g of input.groups) {
|
|
71
|
+
const hit = (g.deposits ?? []).find((d) => d.gtin === gesucht);
|
|
72
|
+
if (hit != null)
|
|
73
|
+
return eins(hit.depositTypeId);
|
|
74
|
+
}
|
|
75
|
+
const artikel = input.articles.find((a) => a.ean === gesucht || a.number === gesucht || a.internalCode === gesucht);
|
|
76
|
+
if (artikel == null)
|
|
77
|
+
return unbekannt;
|
|
78
|
+
const liste = (0, pfand_js_1.depositsFor)(artikel, gruppeVon(artikel));
|
|
79
|
+
if (liste.length === 0 || !liste.every((d) => aktiv.has(d.depositTypeId)))
|
|
80
|
+
return unbekannt;
|
|
81
|
+
return { entries: liste.map((d) => ({ depositTypeId: d.depositTypeId, quantity: d.quantity })) };
|
|
82
|
+
}
|