Skip to content

Add reusable pre-transmission validation - #12

Merged
tiagoapolo merged 2 commits into
mainfrom
agent/pre-transmission-validation
Jul 18, 2026
Merged

Add reusable pre-transmission validation#12
tiagoapolo merged 2 commits into
mainfrom
agent/pre-transmission-validation

Conversation

@tiagoapolo

@tiagoapolo tiagoapolo commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What changed

  • makes validateDpsJsonRequest the canonical non-throwing API returning structured reports
  • changes DpsFiscalValidationError to carry structured issues and its complete report
  • expands structural, fiscal, date, value, address, and environment validation
  • adds DPS XML validation against the official v1.01 XSD
  • adds certificate validity and holder checks
  • splits preparation/signature verification from network transmission
  • packages the official XSD files and bumps the SDK to 2.0.0 for the breaking contract

Why

API and worker need one source of truth for DPS structure and final technical validation so known-invalid payloads never reach SEFIN.

Impact

Consumers can call validateDpsJsonRequest, persist a normalized validation report, prepare a signed DPS, and transmit it only after persistence. Builders use assertValidDpsJsonRequest when invalid input must throw. Runtime preparation requires xmllint.

Validation

  • npm test — 38 tests passed
  • npm run build
  • npm pack --dry-run verified that XSD files are included

@tiagoapolo
tiagoapolo marked this pull request as ready for review July 18, 2026 03:05
@tiagoapolo
tiagoapolo merged commit 818146a into main Jul 18, 2026
1 check passed
@tiagoapolo tiagoapolo mentioned this pull request Jul 18, 2026
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.

1 participant