Skip to content

feat(xml): add FA(3) invoice builder with well-formed XML validation#35

Closed
smekcio wants to merge 6 commits into
mainfrom
feature/fa3-invoice-builder
Closed

feat(xml): add FA(3) invoice builder with well-formed XML validation#35
smekcio wants to merge 6 commits into
mainfrom
feature/fa3-invoice-builder

Conversation

@smekcio

@smekcio smekcio commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add typed FA3Invoice fluent builder for generating FA(3) XML invoices (basic, correction, advance, settlement, margin, transport, attachments, and more)
  • Bundle FA(3) XSD schemas as reference and copy them into dist/xml/fa3-schemas/
  • Replace native XML validation with synchronous well-formedness checks via fast-xml-parser (validateFa3XmlWellFormed, toXmlWellFormed)
  • Remove optional libxmljs2 dependency from package.json and test suites
  • Harden builder edge cases: calendar date normalization, Podmiot1K/Podmiot2K correction serialization, XSD-aware withRawFa merge, transport validation

Test plan

  • npm run build
  • npm run test:unit — 358 pass, 0 fail (10 skipped: missing FA2 fixture)
  • FA(3) builder tests cover corrections, settlements, margin, dates, well-formedness, raw Fa merge, and transport annotations

Made with Cursor

cgtms and others added 6 commits July 8, 2026 08:54
Introduce typed FA3Invoice fluent API, bundled reference schemas, and expanded unit tests so FA(3) XML can be built and verified without external fixtures.

Co-authored-by: Cursor <cursoragent@cursor.com>
Nested schema includes reference bundled files by relative path instead of remote URLs, keeping the FA(3) schema graph self-contained within the package.

Co-authored-by: Cursor <cursoragent@cursor.com>
Validate FA(3) and PEF XML using XMLValidator from fast-xml-parser for well-formedness. Bundled .xsd files remain as schema reference only.

Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce validateFa3XmlWellFormed/XmlWellFormedError and toXmlWellFormed, omit empty FaWiersz on advance invoices, remove invalid Podmiot3K ordering, and add malformed XML test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Normalize calendar dates, validate newTransport and Podmiot1K inputs, merge withRawFa sections per XSD structure, and switch well-formed validation to a synchronous API.

Co-authored-by: Cursor <cursoragent@cursor.com>
…a keys.

Keep newTransportIntraEu sticky across transport means calls and extend withRawFa merge to DaneFaKorygowanej and Podmiot1K.

Co-authored-by: Cursor <cursoragent@cursor.com>
@smekcio

smekcio commented Jul 8, 2026

Copy link
Copy Markdown
Owner Author

Closing as duplicate — FA(3) builder is already covered by PR #34.

@smekcio smekcio closed this Jul 8, 2026
@smekcio
smekcio deleted the feature/fa3-invoice-builder branch July 8, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants