@endora-commerce/mod-invoices 0.107.0 → 0.108.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.
Files changed (51) hide show
  1. package/dist/admin/pages/InvoiceDetail.d.ts.map +1 -1
  2. package/dist/admin/pages/InvoiceDetail.js +3 -1
  3. package/dist/admin/pages/InvoiceDetail.js.map +1 -1
  4. package/dist/admin/templates/invoice-puck-config.d.ts.map +1 -1
  5. package/dist/admin/templates/invoice-puck-config.js +6 -1
  6. package/dist/admin/templates/invoice-puck-config.js.map +1 -1
  7. package/dist/backend/entities/invoice.entity.d.ts +13 -0
  8. package/dist/backend/entities/invoice.entity.d.ts.map +1 -1
  9. package/dist/backend/entities/invoice.entity.js +10 -0
  10. package/dist/backend/entities/invoice.entity.js.map +1 -1
  11. package/dist/backend/index.d.ts.map +1 -1
  12. package/dist/backend/index.js +36 -7
  13. package/dist/backend/index.js.map +1 -1
  14. package/dist/backend/pdf-components/sections.d.ts +7 -1
  15. package/dist/backend/pdf-components/sections.d.ts.map +1 -1
  16. package/dist/backend/pdf-components/sections.js +10 -1
  17. package/dist/backend/pdf-components/sections.js.map +1 -1
  18. package/dist/backend/plugin.d.ts +3 -1
  19. package/dist/backend/plugin.d.ts.map +1 -1
  20. package/dist/backend/plugin.js +1 -1
  21. package/dist/backend/plugin.js.map +1 -1
  22. package/dist/backend/services/auto-issue-reactor.d.ts.map +1 -1
  23. package/dist/backend/services/auto-issue-reactor.js +11 -0
  24. package/dist/backend/services/auto-issue-reactor.js.map +1 -1
  25. package/dist/backend/services/corrective-invoice.d.ts +90 -0
  26. package/dist/backend/services/corrective-invoice.d.ts.map +1 -1
  27. package/dist/backend/services/corrective-invoice.js +275 -63
  28. package/dist/backend/services/corrective-invoice.js.map +1 -1
  29. package/dist/backend/services/invoice-line-builder.d.ts +63 -13
  30. package/dist/backend/services/invoice-line-builder.d.ts.map +1 -1
  31. package/dist/backend/services/invoice-line-builder.js +79 -28
  32. package/dist/backend/services/invoice-line-builder.js.map +1 -1
  33. package/dist/backend/services/invoice-service.d.ts +14 -1
  34. package/dist/backend/services/invoice-service.d.ts.map +1 -1
  35. package/dist/backend/services/invoice-service.js +64 -54
  36. package/dist/backend/services/invoice-service.js.map +1 -1
  37. package/dist/manifest.d.ts.map +1 -1
  38. package/dist/manifest.js +20 -5
  39. package/dist/manifest.js.map +1 -1
  40. package/dist/migrations/20261024T145631_invoices_vat_summary.d.ts +18 -0
  41. package/dist/migrations/20261024T145631_invoices_vat_summary.d.ts.map +1 -0
  42. package/dist/migrations/20261024T145631_invoices_vat_summary.js +22 -0
  43. package/dist/migrations/20261024T145631_invoices_vat_summary.js.map +1 -0
  44. package/dist/migrations/index.d.ts +2 -1
  45. package/dist/migrations/index.d.ts.map +1 -1
  46. package/dist/migrations/index.js +3 -1
  47. package/dist/migrations/index.js.map +1 -1
  48. package/docs/invoices.md +23 -0
  49. package/i18n/en.json +1 -0
  50. package/i18n/pl.json +1 -0
  51. package/package.json +13 -13
@@ -28,6 +28,7 @@ import { Migration20260903T101756InvoicesNamespaceBlockNames } from './20260903T
28
28
  import { Migration20260914T133603InvoicesErpImportedSaleDocuments } from './20260914T133603_invoices_erp_imported_sale_documents.js';
29
29
  import { Migration20260926T230239InvoicesImportIdentity } from './20260926T230239_invoices_import_identity.js';
30
30
  import { Migration20261017T075839InvoicesDropInvoiceTemplates } from './20261017T075839_invoices_drop_invoice_templates.js';
31
+ import { Migration20261024T145631InvoicesVatSummary } from './20261024T145631_invoices_vat_summary.js';
31
32
  export declare const migrations: (typeof Migration20260629T125121InvoicesModule)[];
32
- export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, };
33
+ export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, };
33
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAE5H,eAAO,MAAM,UAAU,mDAQtB,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,GACrD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AAEvG,eAAO,MAAM,UAAU,mDAStB,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,GAC3C,CAAC"}
@@ -28,6 +28,7 @@ import { Migration20260903T101756InvoicesNamespaceBlockNames } from './20260903T
28
28
  import { Migration20260914T133603InvoicesErpImportedSaleDocuments } from './20260914T133603_invoices_erp_imported_sale_documents.js';
29
29
  import { Migration20260926T230239InvoicesImportIdentity } from './20260926T230239_invoices_import_identity.js';
30
30
  import { Migration20261017T075839InvoicesDropInvoiceTemplates } from './20261017T075839_invoices_drop_invoice_templates.js';
31
+ import { Migration20261024T145631InvoicesVatSummary } from './20261024T145631_invoices_vat_summary.js';
31
32
  export const migrations = [
32
33
  Migration20260629T125121InvoicesModule,
33
34
  Migration20260801T111000InvoicesGenericTemplateReseed,
@@ -36,6 +37,7 @@ export const migrations = [
36
37
  Migration20260914T133603InvoicesErpImportedSaleDocuments,
37
38
  Migration20260926T230239InvoicesImportIdentity,
38
39
  Migration20261017T075839InvoicesDropInvoiceTemplates,
40
+ Migration20261024T145631InvoicesVatSummary,
39
41
  ];
40
- export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, };
42
+ export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, };
41
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAE5H,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,sCAAsC;IACtC,qDAAqD;IACrD,wDAAwD;IACxD,mDAAmD;IACnD,wDAAwD;IACxD,8CAA8C;IAC9C,oDAAoD;CACrD,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,GACrD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AAEvG,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,sCAAsC;IACtC,qDAAqD;IACrD,wDAAwD;IACxD,mDAAmD;IACnD,wDAAwD;IACxD,8CAA8C;IAC9C,oDAAoD;IACpD,0CAA0C;CAC3C,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,GAC3C,CAAC"}
package/docs/invoices.md CHANGED
@@ -25,6 +25,29 @@ dependency-light renderer, persists the bytes through the `assets` module,
25
25
  and writes the asset id back onto the Order. Failures emit
26
26
  `invoice.generation_failed.v1` for an admin retry queue.
27
27
 
28
+ ### Unit prices and line values
29
+
30
+ An invoice line carries the order line's **unit net price at up to four decimal places**
31
+ (`invoice_lines.unit_net_price`, `numeric(14,4)`), and its net value is the unit price × the
32
+ quantity rounded half-up to two places once — the order line's own net. The PDF's *Cena netto*
33
+ column shows the unit price with its significant places, up to four (0,0125), and two when the third
34
+ and fourth are zero; the value columns and the totals show two. A Polish invoice may state a unit
35
+ price this precisely: the VAT Act names the unit net price without fixing its decimal places.
36
+
37
+ ### What a VAT invoice records as paid, and when it is not issued
38
+
39
+ A VAT invoice records as paid what was kept from the order's payments: each
40
+ captured payment attempt less what was refunded from it. An order recorded as
41
+ paid with nothing captured (a confirmed bank transfer), or with `payments`
42
+ absent, is paid its stored total.
43
+
44
+ An order whose payments were **refunded in full before it was invoiced** — the
45
+ refunds equal what was captured and cover the whole order total — is not
46
+ invoiced: there is no sale left to document. Issuing answers
47
+ `422 INVOICE_ORDER_REFUNDED` and draws no number; automatic issuance skips the
48
+ order and logs the reason. An order refunded only in part is invoiced, with
49
+ what was kept as paid.
50
+
28
51
  ## Entities
29
52
 
30
53
  `Invoice` (number, issued/dated timestamps, asset reference,
package/i18n/en.json CHANGED
@@ -15,6 +15,7 @@
15
15
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES": "This numbering pattern can produce the same document number as another sales channel. Invoice numbers must be unique across the whole platform.",
16
16
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.other_channel": "This numbering pattern can produce the same document number as sales channel \"{channel}\". Invoice numbers are unique across the whole platform, so give this channel a pattern the other one cannot repeat — adding the channel token is the usual way.",
17
17
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.no_sequence_token": "This numbering pattern has no sequence token, so every document in this channel would be given the same number. The field description lists the tokens you can use.",
18
+ "errors.INVOICE_ORDER_REFUNDED": "This order's payments were refunded in full before it was invoiced, so there is no sale left to invoice. Nothing was issued.",
18
19
  "errors.INVOICE_NUMBER_ALREADY_ISSUED": "This document number is already in use. Invoice numbers are unique across the whole platform.",
19
20
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.other_channel": "Invoice number {number} is already used by sales channel \"{channel}\". Give this channel its own numbering pattern before issuing again — nothing was issued.",
20
21
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.same_channel": "Invoice number {number} has already been issued in this sales channel, so its numbering pattern is producing repeats — nothing was issued.",
package/i18n/pl.json CHANGED
@@ -15,6 +15,7 @@
15
15
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES": "Ten wzorzec numeracji może wygenerować taki sam numer dokumentu jak inny kanał sprzedaży. Numery faktur muszą być unikalne w całej platformie.",
16
16
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.other_channel": "Ten wzorzec numeracji może wygenerować taki sam numer dokumentu jak kanał sprzedaży \"{channel}\". Numery faktur są unikalne w całej platformie, więc nadaj temu kanałowi wzorzec, którego tamten nie może powtórzyć — zwykle wystarczy dodać token kanału.",
17
17
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.no_sequence_token": "Ten wzorzec numeracji nie zawiera tokenu sekwencji, więc każdy dokument w tym kanale otrzymałby ten sam numer. Dostępne tokeny są wymienione w opisie pola.",
18
+ "errors.INVOICE_ORDER_REFUNDED": "Płatności za to zamówienie zostały w całości zwrócone przed wystawieniem faktury, więc nie ma sprzedaży do zafakturowania. Niczego nie wystawiono.",
18
19
  "errors.INVOICE_NUMBER_ALREADY_ISSUED": "Ten numer dokumentu jest już zajęty. Numery faktur są unikalne w całej platformie.",
19
20
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.other_channel": "Numer faktury {number} jest już używany przez kanał sprzedaży \"{channel}\". Nadaj temu kanałowi własny wzorzec numeracji przed ponowną próbą — nic nie zostało wystawione.",
20
21
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.same_channel": "Numer faktury {number} został już wystawiony w tym kanale sprzedaży, więc jego wzorzec numeracji generuje powtórzenia — nic nie zostało wystawione.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endora-commerce/mod-invoices",
3
- "version": "0.107.0",
3
+ "version": "0.108.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Invoice generation, numbering, PDF templates, corrections, and email delivery.",
@@ -62,12 +62,12 @@
62
62
  "react": "^19",
63
63
  "react-router-dom": "^7",
64
64
  "zod": "^4",
65
- "@endora-commerce/admin-kit": "0.107.0",
66
- "@endora-commerce/contracts": "0.107.0",
67
- "@endora-commerce/email-components": "0.107.0",
68
- "@endora-commerce/page-builder-admin": "0.107.0",
69
- "@endora-commerce/page-builder-core": "0.107.0",
70
- "@endora-commerce/platform": "0.107.0"
65
+ "@endora-commerce/admin-kit": "0.108.0",
66
+ "@endora-commerce/contracts": "0.108.0",
67
+ "@endora-commerce/email-components": "0.108.0",
68
+ "@endora-commerce/page-builder-admin": "0.108.0",
69
+ "@endora-commerce/page-builder-core": "0.108.0",
70
+ "@endora-commerce/platform": "0.108.0"
71
71
  },
72
72
  "peerDependenciesMeta": {
73
73
  "@endora-commerce/admin-kit": {
@@ -106,12 +106,12 @@
106
106
  "typescript": "^5.9.3",
107
107
  "vitest": "^4.1.11",
108
108
  "zod": "^4.2.0",
109
- "@endora-commerce/admin-kit": "0.107.0",
110
- "@endora-commerce/contracts": "0.107.0",
111
- "@endora-commerce/email-components": "0.107.0",
112
- "@endora-commerce/page-builder-admin": "0.107.0",
113
- "@endora-commerce/page-builder-core": "0.107.0",
114
- "@endora-commerce/platform": "0.107.0"
109
+ "@endora-commerce/admin-kit": "0.108.0",
110
+ "@endora-commerce/contracts": "0.108.0",
111
+ "@endora-commerce/email-components": "0.108.0",
112
+ "@endora-commerce/page-builder-admin": "0.108.0",
113
+ "@endora-commerce/page-builder-core": "0.108.0",
114
+ "@endora-commerce/platform": "0.108.0"
115
115
  },
116
116
  "scripts": {
117
117
  "build": "tsc -p tsconfig.build.json && tsc -p tsconfig.ui.json",