kassza 0.13.0 → 0.14.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/README.en.md +48 -0
- package/README.md +152 -22
- package/agents/README.md +6 -1
- package/agents/api.md +64 -12
- package/agents/pitfalls.md +12 -1
- package/agents/recipes.md +67 -8
- package/agents/skills/kassza/SKILL.md +3 -0
- package/agents/skills/migrate-from-szamlazz-js/SKILL.md +39 -0
- package/dist/batch/index.cjs +346 -0
- package/dist/batch/index.d.cts +91 -0
- package/dist/batch/index.d.ts +91 -0
- package/dist/batch/index.js +339 -0
- package/dist/cli.cjs +105 -14
- package/dist/cli.js +104 -13
- package/dist/{client-C-PdfL_P.cjs → client-CLFvJCVW.cjs} +358 -181
- package/dist/{client-CfaS1-Jx.js → client-Cvf-hTz_.js} +311 -152
- package/dist/{client-6MkeuFqD.d.ts → client-DeWWQ-RZ.d.ts} +99 -26
- package/dist/{client-B5FryKxJ.d.cts → client-SVZu25MB.d.cts} +99 -26
- package/dist/{context-DXNbTPwz.d.cts → context-CFNKzStE.d.cts} +82 -58
- package/dist/{context-BxQlIlug.d.ts → context-kb33TgzE.d.ts} +82 -58
- package/dist/cookie-stores/index.cjs +21 -150
- package/dist/cookie-stores/index.d.cts +4 -63
- package/dist/cookie-stores/index.d.ts +4 -63
- package/dist/cookie-stores/index.js +3 -144
- package/dist/create-CflXrPip.js +204 -0
- package/dist/create-CvUvLUaT.cjs +257 -0
- package/dist/{create-once-DgMtKKcG.cjs → create-once-9yxR_Er_.cjs} +285 -33
- package/dist/create-once-Bh6fOWkW.d.cts +20 -0
- package/dist/{create-once-Cz621l8r.js → create-once-Ca2gMk1h.js} +250 -34
- package/dist/create-once-VKp0tVow.d.ts +20 -0
- package/dist/data-link/index.cjs +4 -4
- package/dist/data-link/index.d.cts +2 -52
- package/dist/data-link/index.d.ts +2 -52
- package/dist/data-link/index.js +4 -4
- package/dist/delegation/index.cjs +4 -4
- package/dist/delegation/index.d.cts +2 -2
- package/dist/delegation/index.d.ts +2 -2
- package/dist/delegation/index.js +4 -4
- package/dist/{errors-DLrb0g64.js → errors-DtN4g5Z9.js} +9 -1
- package/dist/{errors-DxeuTslP.cjs → errors-EE96_6D_.cjs} +20 -0
- package/dist/{get-Csm2n0rZ.cjs → get-BdMTseh4.cjs} +9 -183
- package/dist/{get-DT3JEgQ6.js → get-CZEShCcj.js} +4 -124
- package/dist/index-BhUPY_EH.d.cts +109 -0
- package/dist/index-BqGgQ4t3.d.ts +109 -0
- package/dist/{index-CYAGCdKJ.d.cts → index-C-7yWV7L.d.cts} +24 -1
- package/dist/{index-CYAGCdKJ.d.ts → index-C-7yWV7L.d.ts} +24 -1
- package/dist/index.cjs +19 -5
- package/dist/index.d.cts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +6 -6
- package/dist/ipn/index.cjs +26 -5
- package/dist/ipn/index.d.cts +12 -1
- package/dist/ipn/index.d.ts +12 -1
- package/dist/ipn/index.js +26 -6
- package/dist/{issue-AGRohSm7.cjs → issue-Bin4tKD_.cjs} +416 -342
- package/dist/{issue-DtSLpVdJ.js → issue-DMA1Nbr1.js} +394 -266
- package/dist/journal/index.cjs +454 -0
- package/dist/journal/index.d.cts +18 -0
- package/dist/journal/index.d.ts +18 -0
- package/dist/journal/index.js +445 -0
- package/dist/journal-DvI81Kt7.d.cts +114 -0
- package/dist/journal-Y9qrIB8G.d.ts +114 -0
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.cts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/money/index.cjs +2 -1
- package/dist/money/index.d.cts +2 -2
- package/dist/money/index.d.ts +2 -2
- package/dist/money/index.js +2 -2
- package/dist/{money-t7uy1n91.js → money-Cw457SD6.js} +95 -3
- package/dist/{money-BxytJW6f.cjs → money-K9j0wPit.cjs} +99 -1
- package/dist/nav/index.cjs +2 -2
- package/dist/nav/index.d.cts +1 -1
- package/dist/nav/index.d.ts +1 -1
- package/dist/nav/index.js +2 -2
- package/dist/{nav-BEwcX7-N.cjs → nav-BNbc8U0R.cjs} +1 -1
- package/dist/{nav-CK1WgYo7.js → nav-BcCerwWS.js} +1 -1
- package/dist/node/index.cjs +124 -0
- package/dist/node/index.d.cts +35 -0
- package/dist/node/index.d.ts +35 -0
- package/dist/node/index.js +120 -0
- package/dist/observe/index.cjs +311 -0
- package/dist/observe/index.d.cts +53 -0
- package/dist/observe/index.d.ts +53 -0
- package/dist/observe/index.js +303 -0
- package/dist/once-BN_3B5OF.cjs +103 -0
- package/dist/once-CqqZxsXG.js +74 -0
- package/dist/{parse-C608ehqM.js → parse-Cr7yQ3_z.js} +2 -2
- package/dist/{parse-BJj-aqKy.cjs → parse-DOA2XQ3e.cjs} +2 -2
- package/dist/payments/barion.cjs +26 -2
- package/dist/payments/barion.d.cts +2 -2
- package/dist/payments/barion.d.ts +2 -2
- package/dist/payments/barion.js +26 -2
- package/dist/payments/index.cjs +7 -2
- package/dist/payments/index.d.cts +4 -4
- package/dist/payments/index.d.ts +4 -4
- package/dist/payments/index.js +3 -3
- package/dist/payments/paypal.cjs +16 -2
- package/dist/payments/paypal.d.cts +2 -2
- package/dist/payments/paypal.d.ts +2 -2
- package/dist/payments/paypal.js +16 -2
- package/dist/payments/revolut.cjs +16 -2
- package/dist/payments/revolut.d.cts +2 -2
- package/dist/payments/revolut.d.ts +2 -2
- package/dist/payments/revolut.js +16 -2
- package/dist/payments/simplepay.cjs +36 -4
- package/dist/payments/simplepay.d.cts +2 -2
- package/dist/payments/simplepay.d.ts +2 -2
- package/dist/payments/simplepay.js +36 -4
- package/dist/payments/stripe.cjs +19 -2
- package/dist/payments/stripe.d.cts +2 -2
- package/dist/payments/stripe.d.ts +2 -2
- package/dist/payments/stripe.js +19 -2
- package/dist/push-BXj0Sf0Z.d.ts +52 -0
- package/dist/push-D4nNbCNV.d.cts +52 -0
- package/dist/reference-B5TATqb5.js +124 -0
- package/dist/reference-BIdYMK0t.cjs +183 -0
- package/dist/reports/index.cjs +1 -1
- package/dist/reports/index.d.cts +1 -1
- package/dist/reports/index.d.ts +1 -1
- package/dist/reports/index.js +1 -1
- package/dist/{serialize-DSE_o9RK.js → serialize-B2eFh3D-.js} +5 -1
- package/dist/{serialize-BXOww1Uq.cjs → serialize-CquIsxA-.cjs} +5 -1
- package/dist/{server-Cd8HB661.js → server-BrJUbXs7.js} +8 -7
- package/dist/{server-C6PoNkdD.cjs → server-Dw9j8Mnd.cjs} +17 -16
- package/dist/session-Ckl5eJhV.d.ts +7 -0
- package/dist/{session-CKOuE6Jc.cjs → session-DeM5vjvC.cjs} +69 -13
- package/dist/{session-rMKaJcmq.js → session-SaEEXu2N.js} +58 -14
- package/dist/session-YbChChx7.d.cts +7 -0
- package/dist/storage/fs.cjs +1 -1
- package/dist/storage/fs.js +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/store-C1rHd9DB.d.cts +19 -0
- package/dist/store-C1rHd9DB.d.ts +19 -0
- package/dist/stores/index.cjs +24 -0
- package/dist/stores/index.d.cts +4 -0
- package/dist/stores/index.d.ts +4 -0
- package/dist/stores/index.js +3 -0
- package/dist/stores-BNrS0dWl.cjs +506 -0
- package/dist/stores-DhjGBrl_.js +441 -0
- package/dist/testing/index.cjs +28 -16
- package/dist/testing/index.d.cts +6 -3
- package/dist/testing/index.d.ts +6 -3
- package/dist/testing/index.js +26 -14
- package/dist/{types-BVeR7KyU.d.ts → types-B1A8mUIE.d.cts} +13 -1
- package/dist/{types-BVeR7KyU.d.cts → types-ByAEvGsZ.d.ts} +13 -1
- package/dist/{types-k--zHf4l.d.ts → types-D1zDOH_F.d.ts} +1 -1
- package/dist/{types-DH8QoNZK.d.cts → types-lnKkQdot.d.cts} +1 -1
- package/dist/warnings-B3DXnveC.d.cts +31 -0
- package/dist/warnings-B3DXnveC.d.ts +31 -0
- package/dist/warnings-DeIw5RFj.cjs +20 -0
- package/dist/warnings-DwTl5J-2.js +15 -0
- package/dist/{webhook-CrEGohbg.js → webhook-CQVShAfI.js} +44 -1
- package/dist/{webhook-81giRMdQ.cjs → webhook-Ckj-_hPD.cjs} +67 -0
- package/dist/webhook-CmdhGiH5.d.cts +11 -0
- package/dist/webhook-D6lEejob.d.ts +11 -0
- package/llms.txt +4 -3
- package/package.json +92 -4
- package/dist/session-Dm_45x8K.d.cts +0 -11
- package/dist/session-Dm_45x8K.d.ts +0 -11
- package/dist/webhook-CpCMHhn2.d.ts +0 -6
- package/dist/webhook-CpMJuP6c.d.cts +0 -6
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as SzamlazzError } from "./errors-DtN4g5Z9.js";
|
|
2
2
|
import { i as encodeUtf8 } from "./binary-D0M9U2MD.js";
|
|
3
|
-
import { n as
|
|
3
|
+
import { a as optionalEl, n as buildXmlDocument, r as el } from "./serialize-B2eFh3D-.js";
|
|
4
|
+
import { t as emitWarning } from "./warnings-DwTl5J-2.js";
|
|
5
|
+
import { a as unknownOutcomeError, i as resolveRecoveryDelay, n as isUncertainOutcome, r as recoverAfterFailure } from "./once-CqqZxsXG.js";
|
|
6
|
+
import { m as guardOnce } from "./issue-DMA1Nbr1.js";
|
|
7
|
+
import { a as todayInBudapest, n as toAgentDate, t as addBudapestDays } from "./dates-CXyj7Azy.js";
|
|
4
8
|
import { i as isHuf } from "./vat-v_dcWCto.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
9
|
+
import { n as calculateInvoiceItem } from "./money-Cw457SD6.js";
|
|
10
|
+
import { a as optionalText, c as requireText$1, n as agentDate$1, o as parseInvoiceResult, t as AGENT_XSD_BASE_URL, u as validationError } from "./reference-B5TATqb5.js";
|
|
7
11
|
//#region src/core/actions.ts
|
|
8
12
|
const SZAMLAZZ_AGENT_URL = "https://www.szamlazz.hu/szamla/";
|
|
9
13
|
const AGENT_ACTIONS = {
|
|
@@ -23,12 +27,47 @@ const AGENT_ACTIONS = {
|
|
|
23
27
|
const MAX_INVOICE_ATTACHMENTS = 5;
|
|
24
28
|
//#endregion
|
|
25
29
|
//#region src/core/document-events.ts
|
|
26
|
-
|
|
30
|
+
var DocumentHookError = class extends Error {
|
|
31
|
+
name = "DocumentHookError";
|
|
32
|
+
event;
|
|
33
|
+
constructor(event, cause) {
|
|
34
|
+
super(`Az onDocument hook hibát dobott a(z) ${event.number} bizonylatnál. A bizonylat elkészült, csak a hook (például a napló mentése) maradt el: mentsd el újra az error.event alapján, és ne állítsd ki újra a bizonylatot.`, { cause });
|
|
35
|
+
this.event = event;
|
|
36
|
+
}
|
|
37
|
+
get number() {
|
|
38
|
+
return this.event.number;
|
|
39
|
+
}
|
|
40
|
+
get document() {
|
|
41
|
+
return this.event.document;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
function isDocumentHookError(error) {
|
|
45
|
+
return error instanceof DocumentHookError;
|
|
46
|
+
}
|
|
47
|
+
function warnDocumentHook(onWarning, event, error) {
|
|
48
|
+
emitWarning(onWarning, {
|
|
49
|
+
kind: "document",
|
|
50
|
+
message: `Az onDocument hook hibát dobott a(z) ${event.number} bizonylatnál. A bizonylat elkészült, a hiba nem érinti.`,
|
|
51
|
+
error,
|
|
52
|
+
operation: `${event.kind}.${event.action}`
|
|
53
|
+
}, "console");
|
|
54
|
+
}
|
|
55
|
+
async function emitDocumentEvent(hook, event, options = {}) {
|
|
27
56
|
if (!hook) return;
|
|
28
57
|
try {
|
|
29
58
|
await hook(event);
|
|
30
59
|
} catch (error) {
|
|
31
|
-
|
|
60
|
+
const mode = options.mode ?? "warn";
|
|
61
|
+
if (mode === "warn") {
|
|
62
|
+
warnDocumentHook(options.onWarning, event, error);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (mode === "throw") throw new DocumentHookError(event, error);
|
|
66
|
+
try {
|
|
67
|
+
await mode(error, event);
|
|
68
|
+
} catch (handlerError) {
|
|
69
|
+
throw new DocumentHookError(event, handlerError);
|
|
70
|
+
}
|
|
32
71
|
}
|
|
33
72
|
}
|
|
34
73
|
//#endregion
|
|
@@ -284,6 +323,176 @@ function resolveInvoice(defaults, input, now) {
|
|
|
284
323
|
attachments
|
|
285
324
|
};
|
|
286
325
|
}
|
|
326
|
+
function normalizeRegisterInput(input) {
|
|
327
|
+
const payments = "payments" in input ? input.payments : [{
|
|
328
|
+
amount: input.amount,
|
|
329
|
+
method: input.method ?? "átutalás",
|
|
330
|
+
date: input.date,
|
|
331
|
+
description: input.description
|
|
332
|
+
}];
|
|
333
|
+
if (!Array.isArray(payments) || payments.length === 0) throw validationError("Adj meg legalább egy befizetést (payments). A korábbi befizetések törléséhez a clearPayments függvényt használd.");
|
|
334
|
+
if (payments.length > 5) throw validationError(`Egy kérésben legfeljebb 5 befizetés rögzíthető, kapott: ${payments.length}.`);
|
|
335
|
+
return {
|
|
336
|
+
invoiceNumber: input.invoiceNumber,
|
|
337
|
+
taxNumber: input.taxNumber,
|
|
338
|
+
additive: input.additive ?? true,
|
|
339
|
+
payments
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function normalizeClearInput(input) {
|
|
343
|
+
const target = typeof input === "string" ? { invoiceNumber: input } : input;
|
|
344
|
+
return {
|
|
345
|
+
invoiceNumber: target.invoiceNumber,
|
|
346
|
+
taxNumber: target.taxNumber,
|
|
347
|
+
additive: false,
|
|
348
|
+
payments: []
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function paymentNode(payment, index) {
|
|
352
|
+
const position = index + 1;
|
|
353
|
+
if (typeof payment.amount !== "number" || !Number.isFinite(payment.amount)) throw validationError(`A(z) ${position}. befizetés összege (amount) nem véges szám.`);
|
|
354
|
+
return el("kifizetes", [
|
|
355
|
+
el("datum", payment.date === void 0 ? todayInBudapest() : agentDate$1(payment.date, "date")),
|
|
356
|
+
el("jogcim", requireText$1(payment.method, `Add meg a(z) ${position}. befizetés módját (method).`)),
|
|
357
|
+
el("osszeg", payment.amount),
|
|
358
|
+
optionalEl("leiras", optionalText(payment.description))
|
|
359
|
+
]);
|
|
360
|
+
}
|
|
361
|
+
function buildPaymentXml(credentials, request) {
|
|
362
|
+
const invoiceNumber = requireText$1(request.invoiceNumber, "Add meg a számla számát (invoiceNumber), amelyhez a befizetés tartozik.");
|
|
363
|
+
return buildXmlDocument({
|
|
364
|
+
root: "xmlszamlakifiz",
|
|
365
|
+
namespace: "http://www.szamlazz.hu/xmlszamlakifiz",
|
|
366
|
+
schemaLocation: `${AGENT_XSD_BASE_URL}agentkifiz/xmlszamlakifiz.xsd`,
|
|
367
|
+
children: [el("beallitasok", [
|
|
368
|
+
...credentials,
|
|
369
|
+
el("szamlaszam", invoiceNumber),
|
|
370
|
+
optionalEl("adoszam", optionalText(request.taxNumber)),
|
|
371
|
+
el("additiv", request.additive),
|
|
372
|
+
el("valaszVerzio", 2)
|
|
373
|
+
]), ...request.payments.map(paymentNode)]
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
function parseRegisterPaymentResponse(response, invoiceNumber) {
|
|
377
|
+
const result = parseInvoiceResult(response);
|
|
378
|
+
return {
|
|
379
|
+
invoiceNumber: result.number ?? invoiceNumber.trim(),
|
|
380
|
+
netTotal: result.netTotal,
|
|
381
|
+
grossTotal: result.grossTotal,
|
|
382
|
+
outstanding: result.outstanding,
|
|
383
|
+
buyerAccountUrl: result.buyerAccountUrl
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function sendPaymentRequest(ctx, request, options) {
|
|
387
|
+
const xml = buildPaymentXml(ctx.credentials, request);
|
|
388
|
+
return ctx.execute({
|
|
389
|
+
action: "registerPayment",
|
|
390
|
+
xml,
|
|
391
|
+
signal: options.signal,
|
|
392
|
+
safeToRetry: !request.additive
|
|
393
|
+
}, (response) => parseRegisterPaymentResponse(response, request.invoiceNumber));
|
|
394
|
+
}
|
|
395
|
+
async function registerPayment(ctx, input, options = {}) {
|
|
396
|
+
return sendPaymentRequest(ctx, normalizeRegisterInput(input), options);
|
|
397
|
+
}
|
|
398
|
+
async function clearPayments(ctx, input, options = {}) {
|
|
399
|
+
return sendPaymentRequest(ctx, normalizeClearInput(input), options);
|
|
400
|
+
}
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/invoices/payment-once.ts
|
|
403
|
+
const KEY_PATTERN = /^[A-Za-z0-9_.:-]{1,48}$/;
|
|
404
|
+
function validation(message, hint) {
|
|
405
|
+
return new SzamlazzError(message, {
|
|
406
|
+
category: "validation",
|
|
407
|
+
hint
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function paymentMarker(key) {
|
|
411
|
+
const trimmed = key?.trim();
|
|
412
|
+
if (!trimmed || !KEY_PATTERN.test(trimmed)) throw validation(`A registerPaymentOnce kulcsa (key) 1–48 karakter legyen, csak betű, szám és _ . : - jellel, kapott: ${String(key)}`, "Használj rövid, stabil azonosítót, például a banki tranzakció vagy a fizetés azonosítóját.");
|
|
413
|
+
return `[kassza:${trimmed}]`;
|
|
414
|
+
}
|
|
415
|
+
function matchingPayment(details, marker) {
|
|
416
|
+
return details.payments.find((payment) => payment.comment?.includes(marker) === true);
|
|
417
|
+
}
|
|
418
|
+
function describe(description, marker) {
|
|
419
|
+
const text = description?.trim();
|
|
420
|
+
return text ? `${marker} ${text}` : marker;
|
|
421
|
+
}
|
|
422
|
+
function unreadableMarker(invoiceNumber, marker) {
|
|
423
|
+
return new SzamlazzError(`A(z) ${invoiceNumber} számlán a befizetés rögzült, de a jelölő (${marker}) a számla lekérdezésében nem látszik, így a registerPaymentOnce nem tudja megakadályozni az ismételt rögzítést.`, {
|
|
424
|
+
category: "unexpected_response",
|
|
425
|
+
details: {
|
|
426
|
+
invoiceNumber,
|
|
427
|
+
marker,
|
|
428
|
+
registered: "true"
|
|
429
|
+
},
|
|
430
|
+
hint: "NE hívd újra ezt a rögzítést: a befizetés már rögzült. Jelezd a kassza hibajegyében; addig a befizetéseket a saját rendszeredben tartsd nyilván, és a registerPayment-et csak egyszer hívd."
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
const QUERY = { includePdf: false };
|
|
434
|
+
async function registerPaymentOnce(api, input, options = {}, guard) {
|
|
435
|
+
const invoiceNumber = input.invoiceNumber?.trim();
|
|
436
|
+
if (!invoiceNumber) throw validation("Add meg a számla számát (invoiceNumber).");
|
|
437
|
+
if (typeof input.amount !== "number" || !Number.isFinite(input.amount) || input.amount === 0) throw validation("A befizetés összege (amount) nullától különböző véges szám legyen.");
|
|
438
|
+
const marker = paymentMarker(input.key);
|
|
439
|
+
const key = input.key.trim();
|
|
440
|
+
const delayMs = resolveRecoveryDelay(options.recoveryDelayMs);
|
|
441
|
+
const lookup = async () => {
|
|
442
|
+
return matchingPayment(await api.get(invoiceNumber, QUERY, options), marker) ?? null;
|
|
443
|
+
};
|
|
444
|
+
const base = {
|
|
445
|
+
invoiceNumber,
|
|
446
|
+
key,
|
|
447
|
+
marker
|
|
448
|
+
};
|
|
449
|
+
const run = async () => {
|
|
450
|
+
const existing = await lookup();
|
|
451
|
+
if (existing) return {
|
|
452
|
+
...base,
|
|
453
|
+
created: false,
|
|
454
|
+
existing
|
|
455
|
+
};
|
|
456
|
+
let payment;
|
|
457
|
+
try {
|
|
458
|
+
payment = await api.registerPayment({
|
|
459
|
+
invoiceNumber,
|
|
460
|
+
taxNumber: input.taxNumber,
|
|
461
|
+
additive: true,
|
|
462
|
+
amount: input.amount,
|
|
463
|
+
method: input.method ?? "átutalás",
|
|
464
|
+
date: input.date,
|
|
465
|
+
description: describe(input.description, marker)
|
|
466
|
+
}, options);
|
|
467
|
+
} catch (error) {
|
|
468
|
+
if (!isUncertainOutcome(error)) throw error;
|
|
469
|
+
const state = {};
|
|
470
|
+
const recovered = await recoverAfterFailure(lookup, delayMs, options.signal, state);
|
|
471
|
+
if (recovered) return {
|
|
472
|
+
...base,
|
|
473
|
+
created: true,
|
|
474
|
+
existing: recovered
|
|
475
|
+
};
|
|
476
|
+
throw unknownOutcomeError(error, `${invoiceNumber} számla`, {
|
|
477
|
+
subject: `${key} kulcsú befizetése`,
|
|
478
|
+
lookupError: state.lookupError,
|
|
479
|
+
method: "registerPaymentOnce"
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
const confirmed = await lookup();
|
|
483
|
+
if (!confirmed) throw unreadableMarker(invoiceNumber, marker);
|
|
484
|
+
return {
|
|
485
|
+
...base,
|
|
486
|
+
created: true,
|
|
487
|
+
payment,
|
|
488
|
+
existing: confirmed
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
return guardOnce(guard, `payment:${JSON.stringify([invoiceNumber, key])}`, options, run, (result) => ({
|
|
492
|
+
...result,
|
|
493
|
+
created: false
|
|
494
|
+
}));
|
|
495
|
+
}
|
|
287
496
|
//#endregion
|
|
288
497
|
//#region src/receipts/create-once.ts
|
|
289
498
|
function requireOrderNumber(input) {
|
|
@@ -291,7 +500,7 @@ function requireOrderNumber(input) {
|
|
|
291
500
|
if (!orderNumber) throw new SzamlazzError("A createOnce-hoz add meg a rendelésszámot (orderNumber), ez azonosítja a nyugtát.", { category: "validation" });
|
|
292
501
|
return orderNumber;
|
|
293
502
|
}
|
|
294
|
-
async function createReceiptOnce(api, input, options = {}) {
|
|
503
|
+
async function createReceiptOnce(api, input, options = {}, guard) {
|
|
295
504
|
const orderNumber = requireOrderNumber(input);
|
|
296
505
|
const callId = input.callId?.trim() || orderNumber;
|
|
297
506
|
const delayMs = resolveRecoveryDelay(options.recoveryDelayMs);
|
|
@@ -299,32 +508,39 @@ async function createReceiptOnce(api, input, options = {}) {
|
|
|
299
508
|
orderNumber,
|
|
300
509
|
downloadPdf: input.downloadPdf
|
|
301
510
|
}, options);
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
511
|
+
const run = async (recheck) => {
|
|
512
|
+
if (recheck || options.lookupFirst !== false) {
|
|
513
|
+
const existing = await lookup();
|
|
514
|
+
if (existing) return {
|
|
515
|
+
receipt: existing,
|
|
516
|
+
created: false
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
try {
|
|
520
|
+
return {
|
|
521
|
+
receipt: await api.create({
|
|
522
|
+
...input,
|
|
523
|
+
orderNumber,
|
|
524
|
+
callId
|
|
525
|
+
}, options),
|
|
526
|
+
created: true
|
|
527
|
+
};
|
|
528
|
+
} catch (error) {
|
|
529
|
+
if (!isUncertainOutcome(error)) throw error;
|
|
530
|
+
const state = {};
|
|
531
|
+
const recovered = await recoverAfterFailure(lookup, delayMs, options.signal, state);
|
|
532
|
+
if (recovered) return {
|
|
533
|
+
receipt: recovered,
|
|
534
|
+
created: error.category !== "duplicate"
|
|
535
|
+
};
|
|
536
|
+
if (error.category === "duplicate" && !state.lookupError) throw error;
|
|
537
|
+
throw unknownOutcomeError(error, `${orderNumber} rendelés`, { lookupError: state.lookupError });
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
return guardOnce(guard, `receipt:order:${orderNumber}`, options, run, (result) => ({
|
|
541
|
+
...result,
|
|
542
|
+
created: false
|
|
543
|
+
}));
|
|
328
544
|
}
|
|
329
545
|
//#endregion
|
|
330
|
-
export {
|
|
546
|
+
export { SZAMLAZZ_AGENT_URL as _, registerPayment as a, resolveInvoice as c, TAXPAYER_TYPE_CODES as d, DocumentHookError as f, MAX_INVOICE_ATTACHMENTS as g, AGENT_ACTIONS as h, clearPayments as i, INVOICE_LANGUAGES as l, isDocumentHookError as m, paymentMarker as n, optionalAgentDate as o, emitDocumentEvent as p, registerPaymentOnce as r, presentText as s, createReceiptOnce as t, INVOICE_TEMPLATES as u };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { G as InvoiceType, N as CreatedInvoice } from "./context-kb33TgzE.js";
|
|
2
|
+
import { r as Receipt } from "./types-D1zDOH_F.js";
|
|
3
|
+
import { n as InvoiceDetails } from "./get-Byc9T5WO.js";
|
|
4
|
+
//#region src/invoices/create-once.d.ts
|
|
5
|
+
interface InvoiceOnceResult {
|
|
6
|
+
readonly number: string;
|
|
7
|
+
readonly created: boolean;
|
|
8
|
+
readonly externalId: string;
|
|
9
|
+
readonly invoice?: CreatedInvoice | undefined;
|
|
10
|
+
readonly details?: InvoiceDetails | undefined;
|
|
11
|
+
}
|
|
12
|
+
declare function invoiceOnceExternalId(type: InvoiceType, orderNumber: string): string;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/receipts/create-once.d.ts
|
|
15
|
+
interface ReceiptOnceResult {
|
|
16
|
+
readonly receipt: Receipt;
|
|
17
|
+
readonly created: boolean;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { InvoiceOnceResult as n, invoiceOnceExternalId as r, ReceiptOnceResult as t };
|
package/dist/data-link/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("../errors-
|
|
2
|
+
const require_errors = require("../errors-EE96_6D_.cjs");
|
|
3
3
|
const require_binary = require("../binary-B89HM03_.cjs");
|
|
4
|
-
const require_serialize = require("../serialize-
|
|
5
|
-
const require_parse = require("../parse-
|
|
6
|
-
const require_get = require("../get-
|
|
4
|
+
const require_serialize = require("../serialize-CquIsxA-.cjs");
|
|
5
|
+
const require_parse = require("../parse-DOA2XQ3e.cjs");
|
|
6
|
+
const require_get = require("../get-BdMTseh4.cjs");
|
|
7
7
|
const require_crypto = require("../crypto-Dpn4FHQ6.cjs");
|
|
8
8
|
const require_request_body = require("../request-body-CH6ZGOrq.cjs");
|
|
9
9
|
//#region src/data-link/push.ts
|
|
@@ -1,54 +1,4 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { n as InvoiceDetails } from "../get-Byc9T5WO.cjs";
|
|
3
|
-
//#region src/data-link/push.d.ts
|
|
4
|
-
type DataLinkPushKind = "invoice" | "incoming-invoice" | "bank-transaction" | "receipts";
|
|
5
|
-
type DataLinkErrorReason = "invalid_payload" | "payload_too_large" | "unknown_document" | "missing_key";
|
|
6
|
-
export declare class DataLinkError extends Error {
|
|
7
|
-
override readonly name: string;
|
|
8
|
-
readonly reason: DataLinkErrorReason;
|
|
9
|
-
constructor(reason: DataLinkErrorReason, message: string, cause?: unknown);
|
|
10
|
-
}
|
|
11
|
-
interface DataLinkPushBase {
|
|
12
|
-
readonly key: string | undefined;
|
|
13
|
-
readonly raw: string;
|
|
14
|
-
}
|
|
15
|
-
interface DataLinkInvoicePush extends DataLinkPushBase {
|
|
16
|
-
readonly kind: "invoice" | "incoming-invoice";
|
|
17
|
-
readonly id: number;
|
|
18
|
-
readonly invoice: InvoiceDetails;
|
|
19
|
-
readonly deleted: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface DataLinkBankTransactionPartner {
|
|
22
|
-
readonly name?: string | undefined;
|
|
23
|
-
readonly accountNumber?: string | undefined;
|
|
24
|
-
}
|
|
25
|
-
interface DataLinkBankTransaction {
|
|
26
|
-
readonly id: number;
|
|
27
|
-
readonly accountNumber: string;
|
|
28
|
-
readonly valueDate: string;
|
|
29
|
-
readonly direction: "in" | "out";
|
|
30
|
-
readonly type?: string | undefined;
|
|
31
|
-
readonly technical: boolean;
|
|
32
|
-
readonly amount: number;
|
|
33
|
-
readonly currency: string;
|
|
34
|
-
readonly partner?: DataLinkBankTransactionPartner | undefined;
|
|
35
|
-
readonly reference?: string | undefined;
|
|
36
|
-
}
|
|
37
|
-
interface DataLinkBankTransactionPush extends DataLinkPushBase {
|
|
38
|
-
readonly kind: "bank-transaction";
|
|
39
|
-
readonly transaction: DataLinkBankTransaction;
|
|
40
|
-
}
|
|
41
|
-
interface DataLinkArchivedReceipt {
|
|
42
|
-
readonly receipt: Receipt;
|
|
43
|
-
readonly issuerTaxNumber?: string | undefined;
|
|
44
|
-
}
|
|
45
|
-
interface DataLinkReceiptsPush extends DataLinkPushBase {
|
|
46
|
-
readonly kind: "receipts";
|
|
47
|
-
readonly receipts: readonly DataLinkArchivedReceipt[];
|
|
48
|
-
}
|
|
49
|
-
type DataLinkPush = DataLinkInvoicePush | DataLinkBankTransactionPush | DataLinkReceiptsPush;
|
|
50
|
-
export declare function parseDataLinkPush(xml: string, key?: string | undefined): DataLinkPush;
|
|
51
|
-
//#endregion
|
|
1
|
+
import { a as DataLinkError, c as DataLinkPush, d as parseDataLinkPush, i as DataLinkBankTransactionPush, l as DataLinkPushKind, n as DataLinkBankTransaction, o as DataLinkErrorReason, r as DataLinkBankTransactionPartner, s as DataLinkInvoicePush, t as DataLinkArchivedReceipt, u as DataLinkReceiptsPush } from "../push-D4nNbCNV.cjs";
|
|
52
2
|
//#region src/data-link/response.d.ts
|
|
53
3
|
type DataLinkKeyError = "KEY_ERR" | "KEY_DEL";
|
|
54
4
|
interface DataLinkAcknowledgement {
|
|
@@ -76,4 +26,4 @@ interface DataLinkHandlerOptions {
|
|
|
76
26
|
type DataLinkHandler = (request: Request) => Promise<Response>;
|
|
77
27
|
export declare function dataLinkHandler(options: DataLinkHandlerOptions): DataLinkHandler;
|
|
78
28
|
//#endregion
|
|
79
|
-
export type
|
|
29
|
+
export { type DataLinkAcknowledgement, type DataLinkArchivedReceipt, type DataLinkBankTransaction, type DataLinkBankTransactionPartner, type DataLinkBankTransactionPush, DataLinkError, type DataLinkErrorReason, type DataLinkHandler, type DataLinkHandlerOptions, type DataLinkInvoicePush, type DataLinkKeyCheck, type DataLinkKeyError, type DataLinkPush, type DataLinkPushKind, type DataLinkReceiptsPush, parseDataLinkPush };
|
|
@@ -1,54 +1,4 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { n as InvoiceDetails } from "../get-Byc9T5WO.js";
|
|
3
|
-
//#region src/data-link/push.d.ts
|
|
4
|
-
type DataLinkPushKind = "invoice" | "incoming-invoice" | "bank-transaction" | "receipts";
|
|
5
|
-
type DataLinkErrorReason = "invalid_payload" | "payload_too_large" | "unknown_document" | "missing_key";
|
|
6
|
-
export declare class DataLinkError extends Error {
|
|
7
|
-
override readonly name: string;
|
|
8
|
-
readonly reason: DataLinkErrorReason;
|
|
9
|
-
constructor(reason: DataLinkErrorReason, message: string, cause?: unknown);
|
|
10
|
-
}
|
|
11
|
-
interface DataLinkPushBase {
|
|
12
|
-
readonly key: string | undefined;
|
|
13
|
-
readonly raw: string;
|
|
14
|
-
}
|
|
15
|
-
interface DataLinkInvoicePush extends DataLinkPushBase {
|
|
16
|
-
readonly kind: "invoice" | "incoming-invoice";
|
|
17
|
-
readonly id: number;
|
|
18
|
-
readonly invoice: InvoiceDetails;
|
|
19
|
-
readonly deleted: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface DataLinkBankTransactionPartner {
|
|
22
|
-
readonly name?: string | undefined;
|
|
23
|
-
readonly accountNumber?: string | undefined;
|
|
24
|
-
}
|
|
25
|
-
interface DataLinkBankTransaction {
|
|
26
|
-
readonly id: number;
|
|
27
|
-
readonly accountNumber: string;
|
|
28
|
-
readonly valueDate: string;
|
|
29
|
-
readonly direction: "in" | "out";
|
|
30
|
-
readonly type?: string | undefined;
|
|
31
|
-
readonly technical: boolean;
|
|
32
|
-
readonly amount: number;
|
|
33
|
-
readonly currency: string;
|
|
34
|
-
readonly partner?: DataLinkBankTransactionPartner | undefined;
|
|
35
|
-
readonly reference?: string | undefined;
|
|
36
|
-
}
|
|
37
|
-
interface DataLinkBankTransactionPush extends DataLinkPushBase {
|
|
38
|
-
readonly kind: "bank-transaction";
|
|
39
|
-
readonly transaction: DataLinkBankTransaction;
|
|
40
|
-
}
|
|
41
|
-
interface DataLinkArchivedReceipt {
|
|
42
|
-
readonly receipt: Receipt;
|
|
43
|
-
readonly issuerTaxNumber?: string | undefined;
|
|
44
|
-
}
|
|
45
|
-
interface DataLinkReceiptsPush extends DataLinkPushBase {
|
|
46
|
-
readonly kind: "receipts";
|
|
47
|
-
readonly receipts: readonly DataLinkArchivedReceipt[];
|
|
48
|
-
}
|
|
49
|
-
type DataLinkPush = DataLinkInvoicePush | DataLinkBankTransactionPush | DataLinkReceiptsPush;
|
|
50
|
-
export declare function parseDataLinkPush(xml: string, key?: string | undefined): DataLinkPush;
|
|
51
|
-
//#endregion
|
|
1
|
+
import { a as DataLinkError, c as DataLinkPush, d as parseDataLinkPush, i as DataLinkBankTransactionPush, l as DataLinkPushKind, n as DataLinkBankTransaction, o as DataLinkErrorReason, r as DataLinkBankTransactionPartner, s as DataLinkInvoicePush, t as DataLinkArchivedReceipt, u as DataLinkReceiptsPush } from "../push-BXj0Sf0Z.js";
|
|
52
2
|
//#region src/data-link/response.d.ts
|
|
53
3
|
type DataLinkKeyError = "KEY_ERR" | "KEY_DEL";
|
|
54
4
|
interface DataLinkAcknowledgement {
|
|
@@ -76,4 +26,4 @@ interface DataLinkHandlerOptions {
|
|
|
76
26
|
type DataLinkHandler = (request: Request) => Promise<Response>;
|
|
77
27
|
export declare function dataLinkHandler(options: DataLinkHandlerOptions): DataLinkHandler;
|
|
78
28
|
//#endregion
|
|
79
|
-
export type
|
|
29
|
+
export { type DataLinkAcknowledgement, type DataLinkArchivedReceipt, type DataLinkBankTransaction, type DataLinkBankTransactionPartner, type DataLinkBankTransactionPush, DataLinkError, type DataLinkErrorReason, type DataLinkHandler, type DataLinkHandlerOptions, type DataLinkInvoicePush, type DataLinkKeyCheck, type DataLinkKeyError, type DataLinkPush, type DataLinkPushKind, type DataLinkReceiptsPush, parseDataLinkPush };
|
package/dist/data-link/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as SzamlazzError } from "../errors-DtN4g5Z9.js";
|
|
2
2
|
import { i as encodeUtf8 } from "../binary-D0M9U2MD.js";
|
|
3
|
-
import { a as optionalEl, c as childNumber, d as findChildren, f as parseXml, l as childText, n as buildXmlDocument, o as XmlParseError, r as el, s as childBoolean, u as findChild } from "../serialize-
|
|
4
|
-
import { r as createAgentResponse, t as parseReceiptElement } from "../parse-
|
|
5
|
-
import { n as parseInvoiceDetailsXml } from "../get-
|
|
3
|
+
import { a as optionalEl, c as childNumber, d as findChildren, f as parseXml, l as childText, n as buildXmlDocument, o as XmlParseError, r as el, s as childBoolean, u as findChild } from "../serialize-B2eFh3D-.js";
|
|
4
|
+
import { r as createAgentResponse, t as parseReceiptElement } from "../parse-Cr7yQ3_z.js";
|
|
5
|
+
import { n as parseInvoiceDetailsXml } from "../get-CZEShCcj.js";
|
|
6
6
|
import { a as timingSafeEqual } from "../crypto-usDg8L2K.js";
|
|
7
7
|
import { t as readRequestText } from "../request-body-uZHMRlQr.js";
|
|
8
8
|
//#region src/data-link/push.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("../errors-
|
|
3
|
-
const require_client = require("../client-
|
|
4
|
-
const require_serialize = require("../serialize-
|
|
5
|
-
const require_parse = require("../parse-
|
|
2
|
+
const require_errors = require("../errors-EE96_6D_.cjs");
|
|
3
|
+
const require_client = require("../client-CLFvJCVW.cjs");
|
|
4
|
+
const require_serialize = require("../serialize-CquIsxA-.cjs");
|
|
5
|
+
const require_parse = require("../parse-DOA2XQ3e.cjs");
|
|
6
6
|
const require_dates = require("../dates-CPgBodkP.cjs");
|
|
7
7
|
const require_tax_number = require("../tax-number-BYFkBp4A.cjs");
|
|
8
8
|
//#region src/delegation/connect.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as AgentResponse, E as SzamlazzError, S as XmlNode, c as SzamlazzOptions, k as suggestedPrefix, n as AgentContext, o as RequestOptions } from "../context-DXNbTPwz.cjs";
|
|
2
1
|
import { t as DateInput } from "../dates-9zvESP0i.cjs";
|
|
3
|
-
import {
|
|
2
|
+
import { D as XmlNode, O as AgentResponse, dt as suggestedPrefix, l as SzamlazzOptions, r as AgentContext, s as RequestOptions, st as SzamlazzError } from "../context-CFNKzStE.cjs";
|
|
3
|
+
import { i as KasszaOptions, n as Kassza, r as KasszaDefaults } from "../client-SVZu25MB.cjs";
|
|
4
4
|
//#region src/delegation/connect.d.ts
|
|
5
5
|
export declare const CONNECT_PRINCIPAL_NAMESPACE = "http://www.szamlazz.hu/xmlcegmb";
|
|
6
6
|
export declare const CONNECT_PRINCIPAL_SCHEMA_LOCATION = "http://www.szamlazz.hu/docs/xsds/agentmb/xmlcegmb.xsd";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as AgentResponse, E as SzamlazzError, S as XmlNode, c as SzamlazzOptions, k as suggestedPrefix, n as AgentContext, o as RequestOptions } from "../context-BxQlIlug.js";
|
|
2
1
|
import { t as DateInput } from "../dates-9zvESP0i.js";
|
|
3
|
-
import {
|
|
2
|
+
import { D as XmlNode, O as AgentResponse, dt as suggestedPrefix, l as SzamlazzOptions, r as AgentContext, s as RequestOptions, st as SzamlazzError } from "../context-kb33TgzE.js";
|
|
3
|
+
import { i as KasszaOptions, n as Kassza, r as KasszaDefaults } from "../client-DeWWQ-RZ.js";
|
|
4
4
|
//#region src/delegation/connect.d.ts
|
|
5
5
|
export declare const CONNECT_PRINCIPAL_NAMESPACE = "http://www.szamlazz.hu/xmlcegmb";
|
|
6
6
|
export declare const CONNECT_PRINCIPAL_SCHEMA_LOCATION = "http://www.szamlazz.hu/docs/xsds/agentmb/xmlcegmb.xsd";
|
package/dist/delegation/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as optionalEl, n as buildXmlDocument, r as el } from "../serialize-
|
|
4
|
-
import { h as unexpectedResponse, i as decodeHeaderValue, l as readHeader, u as throwIfAnyError } from "../parse-
|
|
1
|
+
import { c as suggestedPrefix, o as isSzamlazzError, r as SzamlazzError } from "../errors-DtN4g5Z9.js";
|
|
2
|
+
import { a as queryTaxpayer, c as createAgentContext, o as getInvoicePdf, t as createKassza } from "../client-Cvf-hTz_.js";
|
|
3
|
+
import { a as optionalEl, n as buildXmlDocument, r as el } from "../serialize-B2eFh3D-.js";
|
|
4
|
+
import { h as unexpectedResponse, i as decodeHeaderValue, l as readHeader, u as throwIfAnyError } from "../parse-Cr7yQ3_z.js";
|
|
5
5
|
import { n as toAgentDate } from "../dates-CXyj7Azy.js";
|
|
6
6
|
import { o as parseHungarianTaxNumber, s as isValidEmail } from "../tax-number-BdqKsxNR.js";
|
|
7
7
|
//#region src/delegation/connect.ts
|
|
@@ -327,6 +327,11 @@ const AGENT_ERROR_CODES = {
|
|
|
327
327
|
hint: SIMPLE_ITEMS_HINT
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
|
+
const KASSZA_ERROR_DOCS_URL = "https://kasszajs.hu/docs/hibakodok";
|
|
331
|
+
function errorCodeDocsUrl(code) {
|
|
332
|
+
if (code === void 0 || AGENT_ERROR_CODES[code] === void 0) return void 0;
|
|
333
|
+
return `${KASSZA_ERROR_DOCS_URL}/${code}`;
|
|
334
|
+
}
|
|
330
335
|
const RETRYABLE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
331
336
|
"maintenance",
|
|
332
337
|
"network",
|
|
@@ -353,6 +358,9 @@ var SzamlazzError = class extends Error {
|
|
|
353
358
|
this.rawResponse = options.rawResponse;
|
|
354
359
|
this.details = options.details;
|
|
355
360
|
}
|
|
361
|
+
get docsUrl() {
|
|
362
|
+
return errorCodeDocsUrl(this.code);
|
|
363
|
+
}
|
|
356
364
|
get isDuplicate() {
|
|
357
365
|
return this.category === "duplicate";
|
|
358
366
|
}
|
|
@@ -387,4 +395,4 @@ function parseErrorCode(value) {
|
|
|
387
395
|
return Number(trimmed);
|
|
388
396
|
}
|
|
389
397
|
//#endregion
|
|
390
|
-
export {
|
|
398
|
+
export { errorCodeDocsUrl as a, suggestedPrefix as c, createAgentError as i, KASSZA_ERROR_DOCS_URL as n, isSzamlazzError as o, SzamlazzError as r, parseErrorCode as s, AGENT_ERROR_CODES as t };
|
|
@@ -327,6 +327,11 @@ const AGENT_ERROR_CODES = {
|
|
|
327
327
|
hint: SIMPLE_ITEMS_HINT
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
|
+
const KASSZA_ERROR_DOCS_URL = "https://kasszajs.hu/docs/hibakodok";
|
|
331
|
+
function errorCodeDocsUrl(code) {
|
|
332
|
+
if (code === void 0 || AGENT_ERROR_CODES[code] === void 0) return void 0;
|
|
333
|
+
return `${KASSZA_ERROR_DOCS_URL}/${code}`;
|
|
334
|
+
}
|
|
330
335
|
const RETRYABLE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
331
336
|
"maintenance",
|
|
332
337
|
"network",
|
|
@@ -353,6 +358,9 @@ var SzamlazzError = class extends Error {
|
|
|
353
358
|
this.rawResponse = options.rawResponse;
|
|
354
359
|
this.details = options.details;
|
|
355
360
|
}
|
|
361
|
+
get docsUrl() {
|
|
362
|
+
return errorCodeDocsUrl(this.code);
|
|
363
|
+
}
|
|
356
364
|
get isDuplicate() {
|
|
357
365
|
return this.category === "duplicate";
|
|
358
366
|
}
|
|
@@ -393,6 +401,12 @@ Object.defineProperty(exports, "AGENT_ERROR_CODES", {
|
|
|
393
401
|
return AGENT_ERROR_CODES;
|
|
394
402
|
}
|
|
395
403
|
});
|
|
404
|
+
Object.defineProperty(exports, "KASSZA_ERROR_DOCS_URL", {
|
|
405
|
+
enumerable: true,
|
|
406
|
+
get: function() {
|
|
407
|
+
return KASSZA_ERROR_DOCS_URL;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
396
410
|
Object.defineProperty(exports, "SzamlazzError", {
|
|
397
411
|
enumerable: true,
|
|
398
412
|
get: function() {
|
|
@@ -405,6 +419,12 @@ Object.defineProperty(exports, "createAgentError", {
|
|
|
405
419
|
return createAgentError;
|
|
406
420
|
}
|
|
407
421
|
});
|
|
422
|
+
Object.defineProperty(exports, "errorCodeDocsUrl", {
|
|
423
|
+
enumerable: true,
|
|
424
|
+
get: function() {
|
|
425
|
+
return errorCodeDocsUrl;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
408
428
|
Object.defineProperty(exports, "isSzamlazzError", {
|
|
409
429
|
enumerable: true,
|
|
410
430
|
get: function() {
|