Skip to content

Latest commit

 

History

History
86 lines (67 loc) · 3.52 KB

nt009.md

File metadata and controls

86 lines (67 loc) · 3.52 KB

NT009 DPS contract: versioned preview

The Sistema Nacional NFS-e RTC documentation publishes NT009 v1.01 with Annex VI v1.04.01 (layout and rules) and Annex VII v1.03.00 (IBS/CBS operation indicators).

Publication is not activation. A published spreadsheet does not establish the effective XSD, gateway deployment or acceptance rules for every environment. The library's production path remains NfseClient::emit(DpsData), which serializes through XmlBuilder::buildDps() using the supported production DPS v1.01 schema. Do not transmit NT009 preview XML as a DPS.

API boundary

For explicit structural comparison, the independent method

XmlBuilder::previewNt009Dps(DpsData, Nt009DpsPreviewData): Nt009DpsPreview

returns an object holding review-only XML, not an emission payload. DpsData and the production emit() signature remain unchanged.

use LibreCodeCoop\NfsePHP\Dto\Nt009DpsPreviewData;
use LibreCodeCoop\NfsePHP\Xml\XmlBuilder;

// $dps is an existing DpsData instance for structural review only.
$preview = (new XmlBuilder())->previewNt009Dps(
    $dps,
    new Nt009DpsPreviewData(
        finalidade: 0,
        indicadorDestinatario: 0,
    ),
);
// Review $preview->xml locally; do not POST it to SEFIN.

The preview represents documented optional and conditional groups, but is not a tax classifier, official schema validator, or complete emission contract. Where a condition depends on authoritative CST/cClassTrib attributes or taxpayer/transaction facts, callers must supply verified values. The consultative Annex VIII correlation must not be promoted to an automatic production rule.

Versioned sources and reproduction

Version-specific artifacts are tracked separately from the emitter:

  • resources/contracts/nt009-dps-v1.04.01-matrix.tsv: source-row-level comparison between the production Annex I and published Annex VI.
  • resources/domains/indicadores-operacao-ibscbs-v1.03.00.tsv: all 40 published Annex VII indicator entries, kept separate from the production Annex C catalog.
  • resources/domains/sources.json: official URLs, environment, published versions and observed source SHA-256 values.
  • references/schemas/nfse/1.01/: unchanged production schema bundle and its integrity manifest.

Observed file checksums identify the downloaded bytes; they are not government-issued signatures or evidence that a layout is deployed.

To reproduce or inspect official sources, install the isolated development tooling (not required by library consumers):

composer domains:install
composer domains:audit -- --download-dir=/tmp/nfse-nt009 --report=/tmp/nt009-report.json
composer domains:verify-indicators -- --annex-vii=/path/to/ANEXO_VII.xlsx

Tests and source audits verify the documented structure and snapshots. They do not replace validation against the active environment-specific XSD or authenticated SEFIN integration tests.

Requirements before emission support can change

A new emitting layout requires independent confirmation of the official effective schema and environment, source-backed mandatory/conditional rules, versioned serialization and XSD validation, and SEFIN acceptance and recovery tests. Introduce it as a separate explicit emitter without changing the existing production contract implicitly. Track planning and unresolved work in GitHub issues/PRs rather than maintaining progress logs here.