@kreiseck/kasseneck-api 1.11.1 → 1.13.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 +21 -0
- package/README.md +2 -1
- package/dist/cjs/client/aufrufe.d.ts +4 -4
- package/dist/cjs/client/aufrufe.js +15 -0
- package/dist/cjs/client/receipts.d.ts +5 -0
- package/dist/cjs/client/receipts.js +65 -6
- package/dist/cjs/enums/voucher-action.d.ts +2 -0
- package/dist/cjs/enums/voucher-action.js +2 -0
- package/dist/cjs/enums/voucher-type.d.ts +10 -0
- package/dist/cjs/enums/voucher-type.js +10 -0
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +8 -3
- package/dist/cjs/models/index.d.ts +2 -2
- package/dist/cjs/models/index.js +6 -2
- package/dist/cjs/models/receipt-errors.d.ts +1 -1
- package/dist/cjs/models/receipt-errors.js +2 -0
- package/dist/cjs/models/receipt-item.d.ts +11 -3
- package/dist/cjs/models/receipt-item.js +22 -1
- package/dist/cjs/models/receipt.d.ts +13 -1
- package/dist/cjs/models/receipt.js +18 -2
- package/dist/cjs/models/voucher.d.ts +57 -4
- package/dist/cjs/models/voucher.js +111 -3
- package/dist/cjs/partner/fehler.d.ts +1 -1
- package/dist/cjs/partner/fehler.js +2 -0
- package/dist/cjs/partner/index.d.ts +1 -1
- package/dist/cjs/partner/typen.d.ts +7 -1
- package/dist/cjs/partner/typen.js +3 -0
- package/dist/cjs/pos/client.d.ts +2 -1
- package/dist/cjs/pos/client.js +3 -1
- package/dist/cjs/pos/gutschein.d.ts +90 -0
- package/dist/cjs/pos/gutschein.js +164 -0
- package/dist/cjs/pos/index.d.ts +3 -2
- package/dist/cjs/pos/index.js +13 -2
- package/dist/cjs/pos/settings.d.ts +3 -0
- package/dist/cjs/pos/settings.js +12 -10
- package/dist/cjs/pos/texte.d.ts +229 -0
- package/dist/cjs/pos/texte.js +96 -1
- package/dist/cjs/react/index.js +8 -2
- package/dist/cjs/receipt/due.d.ts +83 -2
- package/dist/cjs/receipt/due.js +202 -36
- package/dist/cjs/receipt/grid.js +13 -1
- package/dist/cjs/receipt/gutschein-plan.d.ts +104 -0
- package/dist/cjs/receipt/gutschein-plan.js +360 -0
- package/dist/cjs/receipt/index.d.ts +1 -1
- package/dist/cjs/receipt/index.js +3 -0
- package/dist/cjs/receipt/layout.js +175 -8
- package/dist/cjs/register/pairing.d.ts +21 -1
- package/dist/cjs/register/pairing.js +17 -0
- package/dist/cjs/stored/bon-layout.d.ts +8 -0
- package/dist/cjs/stored/bon-layout.js +23 -0
- package/dist/cjs/stored/draht.d.ts +3 -1
- package/dist/cjs/stored/draht.js +53 -6
- package/dist/cjs/stored/einstellungen.js +2 -1
- package/dist/cjs/stored/gutscheine.d.ts +3 -0
- package/dist/cjs/stored/gutscheine.js +60 -0
- package/dist/cjs/stored/index.js +2 -17
- package/dist/cjs/stored/vokabular.d.ts +6 -4
- package/dist/cjs/stored/vokabular.js +48 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client/aufrufe.d.ts +4 -4
- package/dist/esm/client/aufrufe.js +15 -0
- package/dist/esm/client/receipts.d.ts +5 -0
- package/dist/esm/client/receipts.js +66 -8
- package/dist/esm/enums/voucher-action.d.ts +2 -0
- package/dist/esm/enums/voucher-action.js +2 -0
- package/dist/esm/enums/voucher-type.d.ts +10 -0
- package/dist/esm/enums/voucher-type.js +10 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/models/index.d.ts +2 -2
- package/dist/esm/models/index.js +2 -2
- package/dist/esm/models/receipt-errors.d.ts +1 -1
- package/dist/esm/models/receipt-errors.js +2 -0
- package/dist/esm/models/receipt-item.d.ts +11 -3
- package/dist/esm/models/receipt-item.js +20 -1
- package/dist/esm/models/receipt.d.ts +13 -1
- package/dist/esm/models/receipt.js +18 -2
- package/dist/esm/models/voucher.d.ts +57 -4
- package/dist/esm/models/voucher.js +108 -3
- package/dist/esm/partner/fehler.d.ts +1 -1
- package/dist/esm/partner/fehler.js +2 -0
- package/dist/esm/partner/index.d.ts +1 -1
- package/dist/esm/partner/typen.d.ts +7 -1
- package/dist/esm/partner/typen.js +3 -0
- package/dist/esm/pos/client.d.ts +2 -1
- package/dist/esm/pos/client.js +3 -1
- package/dist/esm/pos/gutschein.d.ts +90 -0
- package/dist/esm/pos/gutschein.js +158 -0
- package/dist/esm/pos/index.d.ts +3 -2
- package/dist/esm/pos/index.js +4 -2
- package/dist/esm/pos/settings.d.ts +3 -0
- package/dist/esm/pos/settings.js +2 -0
- package/dist/esm/pos/texte.d.ts +229 -0
- package/dist/esm/pos/texte.js +94 -0
- package/dist/esm/react/index.js +8 -2
- package/dist/esm/receipt/due.d.ts +83 -2
- package/dist/esm/receipt/due.js +198 -34
- package/dist/esm/receipt/grid.js +13 -1
- package/dist/esm/receipt/gutschein-plan.d.ts +104 -0
- package/dist/esm/receipt/gutschein-plan.js +352 -0
- package/dist/esm/receipt/index.d.ts +1 -1
- package/dist/esm/receipt/index.js +1 -1
- package/dist/esm/receipt/layout.js +175 -8
- package/dist/esm/register/pairing.d.ts +21 -1
- package/dist/esm/register/pairing.js +16 -0
- package/dist/esm/stored/bon-layout.d.ts +8 -0
- package/dist/esm/stored/bon-layout.js +20 -0
- package/dist/esm/stored/draht.d.ts +3 -1
- package/dist/esm/stored/draht.js +52 -6
- package/dist/esm/stored/einstellungen.js +3 -2
- package/dist/esm/stored/gutscheine.d.ts +3 -0
- package/dist/esm/stored/gutscheine.js +56 -0
- package/dist/esm/stored/index.js +2 -17
- package/dist/esm/stored/vokabular.d.ts +6 -4
- package/dist/esm/stored/vokabular.js +48 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/fixtures/expected/voucher-cancellation.grid32.txt +30 -0
- package/fixtures/expected/voucher-cancellation.grid48.txt +29 -0
- package/fixtures/expected/voucher-cancellation.lines.json +252 -0
- package/fixtures/expected/voucher-cancellation.sheet32.json +206 -0
- package/fixtures/expected/voucher-cancellation.sheet48.json +200 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.grid32.txt +25 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.grid48.txt +25 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.lines.json +259 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.sheet32.json +176 -0
- package/fixtures/expected/voucher-multi-purpose-redeem.sheet48.json +176 -0
- package/fixtures/expected/voucher-multi-purpose-sale.grid32.txt +24 -0
- package/fixtures/expected/voucher-multi-purpose-sale.grid48.txt +23 -0
- package/fixtures/expected/voucher-multi-purpose-sale.lines.json +216 -0
- package/fixtures/expected/voucher-multi-purpose-sale.sheet32.json +170 -0
- package/fixtures/expected/voucher-multi-purpose-sale.sheet48.json +164 -0
- package/fixtures/expected/voucher-payout.grid32.txt +23 -0
- package/fixtures/expected/voucher-payout.grid48.txt +22 -0
- package/fixtures/expected/voucher-payout.lines.json +216 -0
- package/fixtures/expected/voucher-payout.sheet32.json +164 -0
- package/fixtures/expected/voucher-payout.sheet48.json +158 -0
- package/fixtures/expected/voucher-service-redeem.grid32.txt +26 -0
- package/fixtures/expected/voucher-service-redeem.grid48.txt +25 -0
- package/fixtures/expected/voucher-service-redeem.lines.json +261 -0
- package/fixtures/expected/voucher-service-redeem.sheet32.json +182 -0
- package/fixtures/expected/voucher-service-redeem.sheet48.json +176 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.grid32.txt +30 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.grid48.txt +29 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.lines.json +331 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.sheet32.json +206 -0
- package/fixtures/expected/voucher-single-purpose-redeem-exempt.sheet48.json +200 -0
- package/fixtures/expected/voucher-single-purpose-redeem.grid32.txt +25 -0
- package/fixtures/expected/voucher-single-purpose-redeem.grid48.txt +24 -0
- package/fixtures/expected/voucher-single-purpose-redeem.lines.json +246 -0
- package/fixtures/expected/voucher-single-purpose-redeem.sheet32.json +176 -0
- package/fixtures/expected/voucher-single-purpose-redeem.sheet48.json +170 -0
- package/fixtures/expected/voucher-single-purpose-sale.grid32.txt +26 -0
- package/fixtures/expected/voucher-single-purpose-sale.grid48.txt +24 -0
- package/fixtures/expected/voucher-single-purpose-sale.lines.json +225 -0
- package/fixtures/expected/voucher-single-purpose-sale.sheet32.json +182 -0
- package/fixtures/expected/voucher-single-purpose-sale.sheet48.json +170 -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 +64 -0
- package/fixtures/pos-texts.json +257 -1
- package/fixtures/receipt-due-generated.json +1 -1
- package/fixtures/receipt-due-voucher-generated.json +494 -0
- package/fixtures/receipts/voucher-cancellation.json +76 -0
- package/fixtures/receipts/voucher-multi-purpose-redeem.json +62 -0
- package/fixtures/receipts/voucher-multi-purpose-sale.json +63 -0
- package/fixtures/receipts/voucher-payout.json +65 -0
- package/fixtures/receipts/voucher-service-redeem.json +82 -0
- package/fixtures/receipts/voucher-single-purpose-redeem-exempt.json +86 -0
- package/fixtures/receipts/voucher-single-purpose-redeem.json +71 -0
- package/fixtures/receipts/voucher-single-purpose-sale.json +88 -0
- package/fixtures/surface.json +35 -5
- package/fixtures/v3/antworten/belege.json +3405 -3
- package/fixtures/v3/antworten/belegmail.json +5 -2
- package/fixtures/v3/antworten/kasse-belege.json +3423 -3
- package/fixtures/v3/antworten/kasse.json +621 -14
- package/fixtures/v3/antworten/lager.json +1 -1
- package/fixtures/v3/antworten/rechnungen.json +5 -2
- package/fixtures/v3/antworten/storno.json +214 -3
- package/fixtures/v3/stored/belege.json +5 -2
- package/fixtures/v3/stored/kasse.json +225 -4
- package/fixtures/v3/stored/rechnungen.json +5 -2
- package/fixtures/v3/v3-vokabular.json +1375 -23
- package/fixtures/v3/zahlbetrag-faelle.json +293 -3
- package/package.json +4 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Voucher } from '../models/voucher.js';
|
|
2
|
+
import type { PosVoucherSettings, VoucherArticle, VoucherCheck } from '../pos/gutschein.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gutscheine der neuen Form im Zahlbetrag: Zwilling von
|
|
5
|
+
* `gutschein-beleg.plane` im Backend, soweit er den Zahlbetrag bestimmt.
|
|
6
|
+
*
|
|
7
|
+
* Der Server macht aus den Wuenschen zusaetzliche Positionen (`kind`
|
|
8
|
+
* `voucher` bzw. `voucher_float`, hinten an Ware und Trinkgeld angehaengt, in
|
|
9
|
+
* der Reihenfolge der Wuensche) und Eintraege in Belegform; nur Eintraege der
|
|
10
|
+
* Art Wert (`value`) und Rabatt (`promo`) gehen danach in die Toepfe und in
|
|
11
|
+
* den Wertgutschein-Fluss (`gutschein-beleg.zahlbetrag`). Genau das steht
|
|
12
|
+
* hier, mit derselben Euro-Arithmetik:
|
|
13
|
+
*
|
|
14
|
+
* - Mehrzweck einloesen: Eintrag `value`, mindert den Zahlbetrag als Fluss.
|
|
15
|
+
* - Mehrzweck verkaufen: Eintrag `value` (+Fluss); ab dem Stichtag des
|
|
16
|
+
* 0-%-Topfs stattdessen Position im 0-%-Satz ohne Fluss.
|
|
17
|
+
* - Mehrzweck auszahlen: immer Position im 0-%-Satz (minus), kein Fluss.
|
|
18
|
+
* - Einzweck: Position im Satz (Verkauf aus der Einstellung der Kasse,
|
|
19
|
+
* Einloesung und Auszahlung aus der Pruefung des Gutscheins); als
|
|
20
|
+
* Kleinunternehmer eingeloest anteilig auf alle Saetze des Korbs.
|
|
21
|
+
* - Leistung verkaufen: Stueck mal Artikelpreis im Artikelsatz; einloesen: je
|
|
22
|
+
* Satz eine Minuszeile ueber die gewaehlten Positionen.
|
|
23
|
+
* - Aktion: Rabatt wie `promo`, Betrag aus der Pruefung, hoechstens die Summe.
|
|
24
|
+
*
|
|
25
|
+
* Kein Fehler wird still geschluckt: was der Server mit einem Gutschein-Code
|
|
26
|
+
* abwiese, liefert `fehler` mit genau diesem Code (`voucher_*`). Der
|
|
27
|
+
* Klartext-Code steht nie in einem Text.
|
|
28
|
+
*/
|
|
29
|
+
/** Position in der inneren Form des Backends (`beleg-toepfe.interneForm`). */
|
|
30
|
+
export interface Innen {
|
|
31
|
+
amount: number;
|
|
32
|
+
priceOne: number;
|
|
33
|
+
vat: number;
|
|
34
|
+
tip: 'staff' | 'owner' | null;
|
|
35
|
+
/** `kind` der Position (Trinkgeld, Rabatt, Gutscheinzeile); Ware hat keines. */
|
|
36
|
+
kind?: string;
|
|
37
|
+
articleId?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Gutschein-Eintrag in Belegform, soweit Toepfe und Fluss ihn lesen. */
|
|
40
|
+
export interface Gutschein {
|
|
41
|
+
action: string;
|
|
42
|
+
type: string;
|
|
43
|
+
value: number;
|
|
44
|
+
/** Betrag steht schon als Position im 0-%-Topf: kein Fluss mehr. */
|
|
45
|
+
imNullTopf?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Je Einloesung bzw. Auszahlung die gepruefte Sicht des Gutscheins (aus `checkVoucher`), zugeordnet ueber den Code. */
|
|
48
|
+
export interface VoucherDueInfo {
|
|
49
|
+
/** Der Code, wie er gesendet wird (tolerant: Gross/klein, Bindestriche, `O`/`0`, `I`/`L`/`1`). */
|
|
50
|
+
code: string;
|
|
51
|
+
check: VoucherCheck;
|
|
52
|
+
}
|
|
53
|
+
/** Artikel fuer den Verkauf eines Dienstleistungsgutscheins: Preis und Satz wie im Artikelstamm. */
|
|
54
|
+
export type VoucherDueArticle = Pick<VoucherArticle, 'id' | 'priceCents' | 'vatRateBp'>;
|
|
55
|
+
/**
|
|
56
|
+
* Stichtag des 0-%-Topfs fuer Mehrzweck-Verkaeufe (Backend
|
|
57
|
+
* `gutschein-core.NULLTOPF_AB`). Solange er in der Zukunft liegt, zaehlt ein
|
|
58
|
+
* Mehrzweck-Verkauf als Fluss; ab dem Tag als Position im 0-%-Satz. Der
|
|
59
|
+
* Zahlbetrag bleibt gleich, Toepfe und Fluss verschieben sich.
|
|
60
|
+
*/
|
|
61
|
+
export declare const VOUCHER_ZERO_RATE_BUCKET_FROM = "2099-12-31";
|
|
62
|
+
export interface PlanOptionen {
|
|
63
|
+
voucherInfo?: readonly VoucherDueInfo[];
|
|
64
|
+
voucherSettings?: PosVoucherSettings;
|
|
65
|
+
voucherArticles?: readonly VoucherDueArticle[];
|
|
66
|
+
smallBusiness?: boolean;
|
|
67
|
+
zeroRateBucketFrom?: string;
|
|
68
|
+
/** Wiener Tag `YYYY-MM-DD`; der Aufrufer setzt den heutigen, wenn er fehlt. */
|
|
69
|
+
today: string;
|
|
70
|
+
}
|
|
71
|
+
export interface Plan {
|
|
72
|
+
/** Positionen, die der Server hinten anhaengt. */
|
|
73
|
+
zusatz: Innen[];
|
|
74
|
+
/** Eintraege, die Toepfe und Fluss lesen (`gutschein-beleg.zahlbetrag`). */
|
|
75
|
+
gutscheine: Gutschein[];
|
|
76
|
+
/** Summe der Auszahlungen in Cent. */
|
|
77
|
+
auszahlungCents: number;
|
|
78
|
+
/** Mindestens ein Wunsch der neuen Form: der Server rechnet mit `plane`. */
|
|
79
|
+
mitPlan: boolean;
|
|
80
|
+
/** Summe der Einloese-Minuszeilen je Topf (Deckung, Vorbelegung). */
|
|
81
|
+
minusJeTopf: Map<string, number>;
|
|
82
|
+
}
|
|
83
|
+
export interface PlanFehler {
|
|
84
|
+
fehler: string;
|
|
85
|
+
text: string;
|
|
86
|
+
}
|
|
87
|
+
type TopfName = 'amountRateStandard' | 'amountRateReduced1' | 'amountRateReduced2' | 'amountRateZero' | 'amountRateSpecial' | 'amountRatOthers';
|
|
88
|
+
/** `vat-buckets.bucketFuerSatz`. */
|
|
89
|
+
export declare function topfFuerSatz(vat: number): TopfName;
|
|
90
|
+
/** Position, die ein Gutschein decken darf: weder Trinkgeld noch Gutscheinzeile. */
|
|
91
|
+
export declare function istDeckbar(p: Innen): boolean;
|
|
92
|
+
/** Wie beleg-toepfe: Euro in Positionsreihenfolge aufsummieren, erst die Summe auf Cent runden. */
|
|
93
|
+
export declare function centSumme(liste: readonly Innen[]): number;
|
|
94
|
+
/** Die Saetze, auf die `kuTeile` verteilt: je Satz `centSumme` der deckbaren Positionen, nur positive. */
|
|
95
|
+
export declare function kuSaetze(kunde: readonly Innen[]): Array<{
|
|
96
|
+
satzBp: number;
|
|
97
|
+
basis: number;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Wuensche und gelesene Eintraege in Positionen und Belegeintraege, wie
|
|
101
|
+
* `plane` sie baut. `kunde` sind Ware und Trinkgeld in innerer Form.
|
|
102
|
+
*/
|
|
103
|
+
export declare function planeGutscheine(kunde: readonly Innen[], vouchers: readonly Voucher[], art: string, o: PlanOptionen): Plan | PlanFehler;
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VOUCHER_ZERO_RATE_BUCKET_FROM = void 0;
|
|
4
|
+
exports.topfFuerSatz = topfFuerSatz;
|
|
5
|
+
exports.istDeckbar = istDeckbar;
|
|
6
|
+
exports.centSumme = centSumme;
|
|
7
|
+
exports.kuSaetze = kuSaetze;
|
|
8
|
+
exports.planeGutscheine = planeGutscheine;
|
|
9
|
+
const validator_1 = require("@kreiseck/validator");
|
|
10
|
+
const voucher_js_1 = require("../models/voucher.js");
|
|
11
|
+
/**
|
|
12
|
+
* Stichtag des 0-%-Topfs fuer Mehrzweck-Verkaeufe (Backend
|
|
13
|
+
* `gutschein-core.NULLTOPF_AB`). Solange er in der Zukunft liegt, zaehlt ein
|
|
14
|
+
* Mehrzweck-Verkauf als Fluss; ab dem Tag als Position im 0-%-Satz. Der
|
|
15
|
+
* Zahlbetrag bleibt gleich, Toepfe und Fluss verschieben sich.
|
|
16
|
+
*/
|
|
17
|
+
exports.VOUCHER_ZERO_RATE_BUCKET_FROM = '2099-12-31';
|
|
18
|
+
const KINDS = ['voucher', 'voucher_float'];
|
|
19
|
+
const ARTEN = ['multi_purpose', 'single_purpose', 'service', 'promotion'];
|
|
20
|
+
/** `vat-buckets.bucketFuerSatz`. */
|
|
21
|
+
function topfFuerSatz(vat) {
|
|
22
|
+
switch (vat) {
|
|
23
|
+
case 20: return 'amountRateStandard';
|
|
24
|
+
case 10: return 'amountRateReduced1';
|
|
25
|
+
case 13: return 'amountRateReduced2';
|
|
26
|
+
case 0: return 'amountRateZero';
|
|
27
|
+
case 19: return 'amountRateSpecial';
|
|
28
|
+
case 4.9: return 'amountRateSpecial';
|
|
29
|
+
default: return 'amountRatOthers';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const TOPF_REIHENFOLGE = ['amountRateStandard', 'amountRateReduced1', 'amountRateReduced2', 'amountRateZero', 'amountRateSpecial', 'amountRatOthers'];
|
|
33
|
+
function istGutscheinZeile(p) {
|
|
34
|
+
return p.kind !== undefined && KINDS.includes(p.kind);
|
|
35
|
+
}
|
|
36
|
+
/** Position, die ein Gutschein decken darf: weder Trinkgeld noch Gutscheinzeile. */
|
|
37
|
+
function istDeckbar(p) {
|
|
38
|
+
return p.tip == null && p.kind !== 'tip' && !istGutscheinZeile(p);
|
|
39
|
+
}
|
|
40
|
+
/** Wie beleg-toepfe: Euro in Positionsreihenfolge aufsummieren, erst die Summe auf Cent runden. */
|
|
41
|
+
function centSumme(liste) {
|
|
42
|
+
return Math.round(liste.reduce((s, it) => s + it.priceOne * it.amount, 0) * 100);
|
|
43
|
+
}
|
|
44
|
+
/** `gutschein-core.satzBpAusVat`. */
|
|
45
|
+
function satzBp(vat) {
|
|
46
|
+
return Math.round(Number(vat) * 100);
|
|
47
|
+
}
|
|
48
|
+
function position(satzBpWert, cents, kind) {
|
|
49
|
+
return { amount: 1, priceOne: cents / 100, vat: satzBpWert / 100, tip: null, kind };
|
|
50
|
+
}
|
|
51
|
+
/** Code in Normalform (tolerant eingelesen, Pruefzeichen stimmt) oder null. */
|
|
52
|
+
function normalerCode(code) {
|
|
53
|
+
if (typeof code !== 'string')
|
|
54
|
+
return null;
|
|
55
|
+
const v = validator_1.VoucherCode.validate(code);
|
|
56
|
+
return v.ok ? v.normalized : null;
|
|
57
|
+
}
|
|
58
|
+
/** Ist der Eintrag ein Wunsch der neuen Form (nicht vom Server gelesen)? */
|
|
59
|
+
function istWunsch(v) {
|
|
60
|
+
return (0, voucher_js_1.isNewFormVoucher)(v) && (0, voucher_js_1.voucherServerFields)(v).length === 0;
|
|
61
|
+
}
|
|
62
|
+
/** Ein gelesener Eintrag (Serverfelder gesetzt): nur Wert und Rabatt tragen Geld ausserhalb der Positionen. */
|
|
63
|
+
function istGelesen(v) {
|
|
64
|
+
return (0, voucher_js_1.voucherServerFields)(v).length > 0;
|
|
65
|
+
}
|
|
66
|
+
const STATUS_FEHLER = {
|
|
67
|
+
used_up: 'voucher_used_up', paid_out: 'voucher_used_up', cancelled: 'voucher_cancelled', blocked: 'voucher_blocked', expired: 'voucher_expired',
|
|
68
|
+
};
|
|
69
|
+
/** Die Saetze, auf die `kuTeile` verteilt: je Satz `centSumme` der deckbaren Positionen, nur positive. */
|
|
70
|
+
function kuSaetze(kunde) {
|
|
71
|
+
const jeSatz = new Map();
|
|
72
|
+
for (const it of kunde) {
|
|
73
|
+
if (!istDeckbar(it))
|
|
74
|
+
continue;
|
|
75
|
+
const s = satzBp(it.vat);
|
|
76
|
+
if (!jeSatz.has(s))
|
|
77
|
+
jeSatz.set(s, []);
|
|
78
|
+
jeSatz.get(s).push(it);
|
|
79
|
+
}
|
|
80
|
+
return [...jeSatz].map(([s, liste]) => ({ satzBp: s, basis: centSumme(liste) })).filter((x) => x.basis > 0);
|
|
81
|
+
}
|
|
82
|
+
/** `gutschein-core.kuTeile`: anteilig zur Positionssumme je Satz, groesster Rest, Topf-Reihenfolge bei Gleichstand. */
|
|
83
|
+
function kuTeile(kunde, betragCents) {
|
|
84
|
+
const jeSatz = new Map();
|
|
85
|
+
for (const it of kunde) {
|
|
86
|
+
if (!istDeckbar(it))
|
|
87
|
+
continue;
|
|
88
|
+
const s = satzBp(it.vat);
|
|
89
|
+
if (!jeSatz.has(s))
|
|
90
|
+
jeSatz.set(s, []);
|
|
91
|
+
jeSatz.get(s).push(it);
|
|
92
|
+
}
|
|
93
|
+
const rang = (s) => TOPF_REIHENFOLGE.indexOf(topfFuerSatz(s / 100));
|
|
94
|
+
const saetze = [...jeSatz]
|
|
95
|
+
.map(([s, liste]) => ({ satzBp: s, basis: centSumme(liste), cents: 0, rest: 0 }))
|
|
96
|
+
.filter((s) => s.basis > 0)
|
|
97
|
+
.sort((a, b) => (rang(a.satzBp) - rang(b.satzBp)) || (b.satzBp - a.satzBp));
|
|
98
|
+
const summe = saetze.reduce((s, x) => s + x.basis, 0);
|
|
99
|
+
if (summe <= 0 || betragCents > summe)
|
|
100
|
+
return null;
|
|
101
|
+
for (const s of saetze) {
|
|
102
|
+
s.cents = Math.floor((betragCents * s.basis) / summe);
|
|
103
|
+
s.rest = (betragCents * s.basis) % summe;
|
|
104
|
+
}
|
|
105
|
+
let offen = betragCents - saetze.reduce((s, x) => s + x.cents, 0);
|
|
106
|
+
const nachRest = saetze.map((s, i) => ({ s, i })).sort((a, b) => (b.s.rest - a.s.rest) || (a.i - b.i));
|
|
107
|
+
for (let k = 0; offen > 0; k++, offen--)
|
|
108
|
+
nachRest[k].s.cents += 1;
|
|
109
|
+
return saetze.filter((s) => s.cents > 0).map((s) => ({ satzBp: s.satzBp, cents: s.cents }));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Wuensche und gelesene Eintraege in Positionen und Belegeintraege, wie
|
|
113
|
+
* `plane` sie baut. `kunde` sind Ware und Trinkgeld in innerer Form.
|
|
114
|
+
*/
|
|
115
|
+
function planeGutscheine(kunde, vouchers, art, o) {
|
|
116
|
+
const nein = (fehler, text) => ({ fehler, text });
|
|
117
|
+
const storno = art === 'cancellation';
|
|
118
|
+
const wuensche = vouchers.filter(istWunsch);
|
|
119
|
+
const zusatz = [];
|
|
120
|
+
const gutscheine = [];
|
|
121
|
+
// Wert und Rabatt der Altform bzw. gelesener Belege: Euro aus ganzen Cent.
|
|
122
|
+
const altEintrag = (v, i) => {
|
|
123
|
+
if (!Number.isSafeInteger(v.valueCents))
|
|
124
|
+
return nein('voucher_invalid', `Gutschein ${i + 1} hat keinen ganzen Cent-Wert.`);
|
|
125
|
+
return { action: String(v.action), type: String(v.type), value: Math.round(v.valueCents) / 100, ...(v.zeroRateBucket === true ? { imNullTopf: true } : {}) };
|
|
126
|
+
};
|
|
127
|
+
if (wuensche.length === 0) {
|
|
128
|
+
const nulltopf = !storno && o.today >= (o.zeroRateBucketFrom ?? exports.VOUCHER_ZERO_RATE_BUCKET_FROM);
|
|
129
|
+
// `gutschein-transaktion.brauchtPlan`: ab dem Stichtag laeuft plane auch fuer einen Altform-Verkauf.
|
|
130
|
+
const mitPlan = nulltopf && vouchers.some((v) => !istGelesen(v) && v.action === 'sell' && v.type === 'value');
|
|
131
|
+
if (mitPlan && kunde.some(istGutscheinZeile))
|
|
132
|
+
return nein('voucher_invalid', 'Gutschein-Positionen setzt nur der Server.');
|
|
133
|
+
for (const [i, v] of vouchers.entries()) {
|
|
134
|
+
// Gelesene Eintraege der neuen Form ohne Wert/Rabatt: ihr Geld steht in den Positionen.
|
|
135
|
+
if (istGelesen(v) && v.type !== 'value' && v.type !== 'promo')
|
|
136
|
+
continue;
|
|
137
|
+
const g = altEintrag(v, i);
|
|
138
|
+
if ('fehler' in g)
|
|
139
|
+
return g;
|
|
140
|
+
// Altform-Verkauf ab dem Stichtag: Betrag in den 0-%-Topf.
|
|
141
|
+
if (nulltopf && !istGelesen(v) && g.action === 'sell' && g.type === 'value') {
|
|
142
|
+
zusatz.push(position(0, Math.round(v.valueCents), 'voucher_float'));
|
|
143
|
+
g.imNullTopf = true;
|
|
144
|
+
}
|
|
145
|
+
gutscheine.push(g);
|
|
146
|
+
}
|
|
147
|
+
return { zusatz, gutscheine, auszahlungCents: 0, mitPlan, minusJeTopf: new Map() };
|
|
148
|
+
}
|
|
149
|
+
// Ab hier: mindestens ein Wunsch der neuen Form (createReceipt fuehrt `plane` aus).
|
|
150
|
+
if (storno)
|
|
151
|
+
return nein('voucher_invalid', 'Gutscheine der neuen Form gibt es am Storno nur gespiegelt vom Server.');
|
|
152
|
+
if (art === 'training')
|
|
153
|
+
return nein('voucher_invalid', 'Gutscheine der neuen Form gibt es nicht auf Schulungsbelegen.');
|
|
154
|
+
if (kunde.some(istGutscheinZeile))
|
|
155
|
+
return nein('voucher_invalid', 'Gutschein-Positionen setzt nur der Server.');
|
|
156
|
+
for (const [i, v] of vouchers.entries()) {
|
|
157
|
+
if (istGelesen(v))
|
|
158
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: Serverfelder an einem Wunsch.`);
|
|
159
|
+
if ((0, voucher_js_1.isNewFormVoucher)(v) && !(0, voucher_js_1.voucherIsValid)(v))
|
|
160
|
+
return nein('voucher_invalid', `Gutschein ${i + 1} ist unvollstaendig.`);
|
|
161
|
+
}
|
|
162
|
+
// Kein Gutschein mit Gutschein bezahlen, sobald einer der beiden die neue Form hat.
|
|
163
|
+
const handel = vouchers.filter((v) => v.action === 'sell' || v.action === 'redeem');
|
|
164
|
+
if (handel.some((v) => v.action === 'sell') && handel.some((v) => v.action === 'redeem') && handel.some(voucher_js_1.isNewFormVoucher))
|
|
165
|
+
return nein('voucher_invalid', 'Gutscheine verkaufen und einloesen gehen nicht am selben Beleg.');
|
|
166
|
+
if (wuensche.some((v) => v.type === 'promotion') && vouchers.length > 1)
|
|
167
|
+
return nein('voucher_invalid', 'Ein Aktionsgutschein steht allein am Beleg.');
|
|
168
|
+
if (wuensche.some((v) => v.action === 'payout') && vouchers.some((v) => !(0, voucher_js_1.isNewFormVoucher)(v) && v.type === 'promo')) {
|
|
169
|
+
return nein('voucher_invalid', 'Rabatt und Auszahlung gehen nicht am selben Beleg.');
|
|
170
|
+
}
|
|
171
|
+
const codes = wuensche.filter((v) => v.action !== 'sell').map((v) => normalerCode(v.code));
|
|
172
|
+
if (codes.some((c) => c == null))
|
|
173
|
+
return nein('voucher_invalid', 'Ein Gutscheincode ist ungueltig.');
|
|
174
|
+
if (new Set(codes).size !== codes.length)
|
|
175
|
+
return nein('voucher_invalid', 'Derselbe Gutschein steht zweimal am Beleg.');
|
|
176
|
+
const ku = o.smallBusiness === true;
|
|
177
|
+
const nulltopf = o.today >= (o.zeroRateBucketFrom ?? exports.VOUCHER_ZERO_RATE_BUCKET_FROM);
|
|
178
|
+
const minusJeTopf = new Map();
|
|
179
|
+
const minus = (s, c) => {
|
|
180
|
+
const topf = topfFuerSatz(s / 100);
|
|
181
|
+
minusJeTopf.set(topf, (minusJeTopf.get(topf) ?? 0) + c);
|
|
182
|
+
};
|
|
183
|
+
const belegt = new Set();
|
|
184
|
+
let auszahlungCents = 0;
|
|
185
|
+
const einstellung = (gewollt) => {
|
|
186
|
+
const e = o.voucherSettings;
|
|
187
|
+
// Der Server verkauft nur mit bestaetigter Einstellung (`voucher_settings_missing`), auch Mehrzweck.
|
|
188
|
+
if (e == null || e.valueVoucherType == null) {
|
|
189
|
+
return nein('voucher_settings_missing', 'Die Gutschein-Einstellung der Kasse fehlt (voucherSettings).');
|
|
190
|
+
}
|
|
191
|
+
return e.valueVoucherType === gewollt ? null : nein('voucher_invalid', 'Die Gutschein-Einstellung der Kasse verkauft eine andere Art.');
|
|
192
|
+
};
|
|
193
|
+
const pruefung = (v, i) => {
|
|
194
|
+
const code = normalerCode(v.code);
|
|
195
|
+
const info = (o.voucherInfo ?? []).find((x) => normalerCode(x.code) === code);
|
|
196
|
+
if (info == null)
|
|
197
|
+
return nein('voucher_not_found', `Gutschein ${i + 1}: keine Pruefung zum Code (checkVoucher).`);
|
|
198
|
+
if (info.check.type !== v.type)
|
|
199
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: die Art passt nicht zur Pruefung.`);
|
|
200
|
+
return info.check;
|
|
201
|
+
};
|
|
202
|
+
const saldo = (check, c, i) => Number.isInteger(check.balanceCents) && c <= check.balanceCents
|
|
203
|
+
? null
|
|
204
|
+
: nein('voucher_insufficient_balance', `Gutschein ${i + 1}: der Betrag uebersteigt den Saldo.`);
|
|
205
|
+
for (const [i, v] of vouchers.entries()) {
|
|
206
|
+
if (!(0, voucher_js_1.isNewFormVoucher)(v)) {
|
|
207
|
+
const g = altEintrag(v, i);
|
|
208
|
+
if ('fehler' in g)
|
|
209
|
+
return g;
|
|
210
|
+
if (nulltopf && g.action === 'sell' && g.type === 'value') {
|
|
211
|
+
zusatz.push(position(0, Math.round(v.valueCents), 'voucher_float'));
|
|
212
|
+
g.imNullTopf = true;
|
|
213
|
+
}
|
|
214
|
+
gutscheine.push(g);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!ARTEN.includes(String(v.type)))
|
|
218
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: unbekannte Art.`);
|
|
219
|
+
if (v.action === 'sell') {
|
|
220
|
+
if (v.type === 'multi_purpose') {
|
|
221
|
+
const f = einstellung('multi_purpose');
|
|
222
|
+
if (f)
|
|
223
|
+
return f;
|
|
224
|
+
const c = v.amountCents;
|
|
225
|
+
if (nulltopf) {
|
|
226
|
+
zusatz.push(position(0, c, 'voucher_float'));
|
|
227
|
+
gutscheine.push({ action: 'sell', type: 'value', value: c / 100, imNullTopf: true });
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
gutscheine.push({ action: 'sell', type: 'value', value: c / 100 });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else if (v.type === 'single_purpose') {
|
|
234
|
+
const f = einstellung('single_purpose');
|
|
235
|
+
if (f)
|
|
236
|
+
return f;
|
|
237
|
+
const satz = ku ? 0 : o.voucherSettings.vatRateBp;
|
|
238
|
+
if (!Number.isInteger(satz) || satz < 0)
|
|
239
|
+
return nein('voucher_settings_missing', 'Der Satz des Einzweckgutscheins fehlt (Gutschein-Einstellung der Kasse).');
|
|
240
|
+
zusatz.push(position(satz, v.amountCents, 'voucher'));
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const a = (o.voucherArticles ?? []).find((x) => x.id === v.articleId);
|
|
244
|
+
if (a == null)
|
|
245
|
+
return nein('voucher_item_mismatch', `Gutschein ${i + 1}: der Artikel fehlt (voucherArticles).`);
|
|
246
|
+
if (!Number.isInteger(a.priceCents) || a.priceCents <= 0 || !Number.isInteger(a.vatRateBp) || a.vatRateBp < 0) {
|
|
247
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: Artikel ohne Preis oder Satz.`);
|
|
248
|
+
}
|
|
249
|
+
const c = v.quantity * a.priceCents;
|
|
250
|
+
if (c > 1_000_000)
|
|
251
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: Betrag zu hoch.`);
|
|
252
|
+
zusatz.push(position(ku ? 0 : a.vatRateBp, c, 'voucher'));
|
|
253
|
+
}
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const check = pruefung(v, i);
|
|
257
|
+
if ('fehler' in check)
|
|
258
|
+
return check;
|
|
259
|
+
if (v.action === 'payout') {
|
|
260
|
+
// `gutschein-core.darfAuszahlen`: aktiv, oder abgelaufen bis zum Ende der Rueckzahlbarkeit.
|
|
261
|
+
if (!((check.balanceCents ?? 0) > 0))
|
|
262
|
+
return nein('voucher_used_up', `Gutschein ${i + 1}: kein Saldo.`);
|
|
263
|
+
if (check.status === 'expired') {
|
|
264
|
+
const bis = check.validity?.refundableUntil;
|
|
265
|
+
if (bis && o.today > bis)
|
|
266
|
+
return nein('voucher_expired', `Gutschein ${i + 1}: nicht mehr rueckzahlbar.`);
|
|
267
|
+
}
|
|
268
|
+
else if (check.status !== 'active') {
|
|
269
|
+
return nein(STATUS_FEHLER[check.status] ?? 'voucher_invalid', `Gutschein ${i + 1}: Status ${check.status}.`);
|
|
270
|
+
}
|
|
271
|
+
const c = v.amountCents;
|
|
272
|
+
const f = saldo(check, c, i);
|
|
273
|
+
if (f)
|
|
274
|
+
return f;
|
|
275
|
+
if (v.type === 'multi_purpose') {
|
|
276
|
+
zusatz.push(position(0, -c, 'voucher_float'));
|
|
277
|
+
gutscheine.push({ action: 'payout', type: 'value', value: c / 100, imNullTopf: true });
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
if (!Number.isInteger(check.vatRateBp))
|
|
281
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: Satz fehlt in der Pruefung.`);
|
|
282
|
+
zusatz.push(position(check.vatRateBp, -c, 'voucher'));
|
|
283
|
+
}
|
|
284
|
+
auszahlungCents += c;
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (check.status !== 'active')
|
|
288
|
+
return nein(STATUS_FEHLER[check.status] ?? 'voucher_invalid', `Gutschein ${i + 1}: Status ${check.status}.`);
|
|
289
|
+
if (v.type === 'multi_purpose' || v.type === 'single_purpose') {
|
|
290
|
+
const c = v.amountCents;
|
|
291
|
+
const f = saldo(check, c, i);
|
|
292
|
+
if (f)
|
|
293
|
+
return f;
|
|
294
|
+
if (v.type === 'multi_purpose') {
|
|
295
|
+
gutscheine.push({ action: 'redeem', type: 'value', value: c / 100 });
|
|
296
|
+
}
|
|
297
|
+
else if (check.exempt === true || ku) {
|
|
298
|
+
// Befreit verkauft (`kuEingefroren`) oder Kleinunternehmer-Konto: der gedeckte Teil
|
|
299
|
+
// verlaesst anteilig alle Toepfe des Korbs.
|
|
300
|
+
const teile = kuTeile(kunde, c);
|
|
301
|
+
if (!teile)
|
|
302
|
+
return nein('voucher_rate_mismatch', `Gutschein ${i + 1}: der Korb deckt den Betrag nicht.`);
|
|
303
|
+
for (const t of teile) {
|
|
304
|
+
zusatz.push(position(t.satzBp, -t.cents, 'voucher'));
|
|
305
|
+
minus(t.satzBp, t.cents);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
if (!Number.isInteger(check.vatRateBp))
|
|
310
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: Satz fehlt in der Pruefung.`);
|
|
311
|
+
zusatz.push(position(check.vatRateBp, -c, 'voucher'));
|
|
312
|
+
minus(check.vatRateBp, c);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else if (v.type === 'service') {
|
|
316
|
+
const artikelId = check.article?.id;
|
|
317
|
+
let stueck = 0;
|
|
318
|
+
const jeSatz = new Map();
|
|
319
|
+
for (const k of v.positions ?? []) {
|
|
320
|
+
const it = kunde[k];
|
|
321
|
+
if (it == null || it.kind !== undefined || it.tip != null || !artikelId || it.articleId !== artikelId
|
|
322
|
+
|| !Number.isInteger(it.amount) || it.amount < 1 || belegt.has(k)) {
|
|
323
|
+
return nein('voucher_item_mismatch', `Gutschein ${i + 1}: Position ${k + 1} passt nicht zum Leistungsgutschein.`);
|
|
324
|
+
}
|
|
325
|
+
belegt.add(k);
|
|
326
|
+
stueck += it.amount;
|
|
327
|
+
const s = satzBp(it.vat);
|
|
328
|
+
if (!jeSatz.has(s))
|
|
329
|
+
jeSatz.set(s, []);
|
|
330
|
+
jeSatz.get(s).push(it);
|
|
331
|
+
}
|
|
332
|
+
if (!Number.isInteger(check.remainingQuantity) || stueck > check.remainingQuantity) {
|
|
333
|
+
return nein('voucher_insufficient_balance', `Gutschein ${i + 1}: nicht genug offene Stueck.`);
|
|
334
|
+
}
|
|
335
|
+
for (const [s, liste] of jeSatz) {
|
|
336
|
+
const c = centSumme(liste);
|
|
337
|
+
zusatz.push(position(s, -c, 'voucher'));
|
|
338
|
+
minus(s, c);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
// Aktion: Rabatt ueber die Altmechanik promo.
|
|
343
|
+
const basis = centSumme(kunde.filter(istDeckbar));
|
|
344
|
+
const roh = Number.isInteger(check.discountCents) && check.discountCents > 0
|
|
345
|
+
? check.discountCents
|
|
346
|
+
: Math.floor((basis * (Number(check.discountPercentBp) || 0)) / 10000);
|
|
347
|
+
const rabatt = Math.min(roh, basis);
|
|
348
|
+
if (!(rabatt > 0))
|
|
349
|
+
return nein('voucher_invalid', `Gutschein ${i + 1}: kein Rabatt auf diesen Korb.`);
|
|
350
|
+
gutscheine.push({ action: 'redeem', type: 'promo', value: rabatt / 100 });
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// Einloese-Minuszeilen eines Topfs uebersteigen nie die deckbaren Positionen dieses Topfs.
|
|
354
|
+
for (const [topf, c] of minusJeTopf) {
|
|
355
|
+
const basis = centSumme(kunde.filter((it) => istDeckbar(it) && topfFuerSatz(it.vat) === topf));
|
|
356
|
+
if (c > basis)
|
|
357
|
+
return nein('voucher_rate_mismatch', 'Ein Gutschein deckt mehr als die Positionen seines Steuersatzes.');
|
|
358
|
+
}
|
|
359
|
+
return { zusatz, gutscheine, auszahlungCents, mitPlan: true, minusJeTopf };
|
|
360
|
+
}
|
|
@@ -7,4 +7,4 @@ export { rasterizeLogo } from './bild.js';
|
|
|
7
7
|
export { type BrandMarkRaster, BRAND_MARK_RASTERS, BRAND_MARK_PATHS } from './marke-daten.js';
|
|
8
8
|
export { brandMarkImage } from './marke.js';
|
|
9
9
|
export { type CodeTableTestSheetInput, type CodeTableTestSheetRow, type CodeTableTestSheet, CODE_TABLE_TEST_SHEET_CHARS, codeTableTestSheet, codeTableTestSheetBytes, codeTableReferenceImage, } from './code-table-test-sheet.js';
|
|
10
|
-
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, } from './due.js';
|
|
10
|
+
export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, type VoucherDueInfo, type VoucherDueArticle, type VoucherRedeemContext, voucherRedeemMaxCents, VOUCHER_ZERO_RATE_BUCKET_FROM, } from './due.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.codeTableReferenceImage = exports.codeTableTestSheetBytes = exports.codeTableTestSheet = exports.CODE_TABLE_TEST_SHEET_CHARS = exports.brandMarkImage = exports.BRAND_MARK_PATHS = exports.BRAND_MARK_RASTERS = exports.rasterizeLogo = exports.receiptSheet = exports.qrSheetWidthFraction = exports.logoRasterSize = exports.isLogoPixelSizeAllowed = exports.logoDimensions = exports.paperSizeForChars = exports.DOTS_PER_LINE = exports.DOTS_PER_CHAR = exports.LOGO_MAX_PIXELS = exports.SHEET_LOGO_SIZES = exports.eposDirectStatus = exports.eposDirectPrint = exports.eposParseResponse = exports.eposSoapEnvelope = exports.eposServiceUrl = exports.eposImageXml = exports.eposXmlEscape = exports.eposPrintXmlResult = exports.eposPrintXml = exports.EposConnectionError = exports.CHARS_PER_PAPER_SIZE = exports.gridToText = exports.gridColumnWidths = exports.renderReceiptGrid = exports.escPosLayoutResult = exports.escPosLayoutBytes = exports.assertLogoRaster = exports.formatCents = exports.SMALL_BUSINESS_NOTICE = exports.CURRENT_LAYOUT_RULESET = exports.receiptZdaText = exports.receiptIsSmallBusinessConsistent = exports.receiptAmountsAreZero = exports.receiptIsZero = exports.receiptSignatureIsTest = exports.receiptSignatureFailed = exports.buildReceiptLayout = void 0;
|
|
4
|
+
exports.VOUCHER_ZERO_RATE_BUCKET_FROM = exports.voucherRedeemMaxCents = void 0;
|
|
4
5
|
var layout_js_1 = require("./layout.js");
|
|
5
6
|
Object.defineProperty(exports, "buildReceiptLayout", { enumerable: true, get: function () { return layout_js_1.buildReceiptLayout; } });
|
|
6
7
|
Object.defineProperty(exports, "receiptSignatureFailed", { enumerable: true, get: function () { return layout_js_1.receiptSignatureFailed; } });
|
|
@@ -61,3 +62,5 @@ Object.defineProperty(exports, "receiptDueBreakdown", { enumerable: true, get: f
|
|
|
61
62
|
Object.defineProperty(exports, "ReceiptDueError", { enumerable: true, get: function () { return due_js_1.ReceiptDueError; } });
|
|
62
63
|
Object.defineProperty(exports, "RECEIPT_DUE_ERROR_REASONS", { enumerable: true, get: function () { return due_js_1.RECEIPT_DUE_ERROR_REASONS; } });
|
|
63
64
|
Object.defineProperty(exports, "isReceiptDueError", { enumerable: true, get: function () { return due_js_1.isReceiptDueError; } });
|
|
65
|
+
Object.defineProperty(exports, "voucherRedeemMaxCents", { enumerable: true, get: function () { return due_js_1.voucherRedeemMaxCents; } });
|
|
66
|
+
Object.defineProperty(exports, "VOUCHER_ZERO_RATE_BUCKET_FROM", { enumerable: true, get: function () { return due_js_1.VOUCHER_ZERO_RATE_BUCKET_FROM; } });
|