Skip to content

feat: model NT009 credit reversals and advance-payment references (#95) - #103

Merged
vitormattos merged 1 commit into
mainfrom
feat/issue-95-nt009-credit-reversal-advance-payments
Oct 9, 2026
Merged

vitormattos merged 1 commit into
mainfrom
feat/issue-95-nt009-credit-reversal-advance-payments

Conversation

@vitormattos

@vitormattos vitormattos commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Issue #95 — source-backed NT009 groups after merged #102

Continues from main at ff0a325fad59b78dc85c15154381969ab8965577; the earlier PR #102 is merged. Implements two missing Annex VI v1.04.01 groups only for the opt-in non-emitting NT009 preview.

Implemented

  • IBSCBS/valores/trib/gIBSCBS/gEstornoCred (Annex VI rows 438-440): exact two-decimal vIBSEstCred/vCBSEstCred, paired validation, and mandatory caller-verified official cClassTrib.ind_gEstornoCred for inclusion. False forbids the group; true requires both values. No tax classification is inferred.
  • IBSCBS/valores/trib/gIBSCBS/gPagAntecipado/refNFSe (rows 441-442): opt-in explicit list of 1-99 existing invoice references, 50 characters each. Empty list omits the group. No assumptions about taxpayer liabilities, no implicit paid invoices and no undocumented deduplication restriction.
  • Exact order under gIBSCBS, updated DTO constructor with optional trailing parameters, and eleven focused PHPUnit cases for valid paths, ordering, omissions, missing official evidence, malformed amounts, 50-character keys, 99-reference bound and forbidden combinations.
  • Expanded contract notes in docs/NT009-CONTRACT-IMPLEMENTATION.md.

Safety and compatibility

  • Keeps DpsData, XmlBuilder::buildDps(), DpsSchemaValidator, NfseClient::emit() and Akaunting's Composer pin unchanged.
  • Does not turn draft XML into fiscal emission or apply consultative Annex VIII correlations.

Verification / review

  • Single Git-Signing-MCP commit, cryptographically verified with matching DCO; exact base checked.
  • Source paths and cardinalities documented in checksum-pinned 450-row matrix resources/contracts/nt009-dps-v1.04.01-matrix.tsv.
  • All six GitHub Actions workflows passed on commit 3932a256b9e0ae8641c0b9f6c5394023b27cde87: PHPUnit (PHP 8.2/8.3/8.4), coverage/Coveralls, Psalm, PHP CS Fixer, minimum dependencies, REUSE and commit conventions. No separate local Composer/dependency run was performed.

Remaining #95 blockers

The official portal still publishes NT009 Annex VI/VII without a confirmed deployed NT009-effective XSD for production and restricted production, or a verified activation schedule. The NT009 PDF/Annex VI gIBSCBSAjuste placement contradiction, full contract modeling, official fiscal classification dependencies and XSD/SEFIN acceptance remain open.

Do not close #95, enable issuance, or update downstream dependencies on this PR's basis.

…yment references (#95)

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos
vitormattos marked this pull request as ready for review October 9, 2026 04:59
@vitormattos
vitormattos merged commit 2a8b660 into main Oct 9, 2026
13 checks passed
@vitormattos
vitormattos deleted the feat/issue-95-nt009-credit-reversal-advance-payments branch October 9, 2026 11:35
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.

Implement version-aware NT009 v1.01 DPS/IBSCBS contract

1 participant