Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/sefin-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--
SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
SPDX-License-Identifier: AGPL-3.0-or-later
-->

# SEFIN event endpoint contract

The contributor manual currently documents these event endpoints:

| Operation | Endpoint | nfse-php status |
| --- | --- | --- |
| Register signed event | `POST /nfse/{chaveAcesso}/eventos` | Supported by `EventRegistrationInterface::registerEventXml()`; cancellation uses this primitive. |
| List all events | `GET /nfse/{chaveAcesso}/eventos` | Not enabled by default. |
| List events by type | `GET /nfse/{chaveAcesso}/eventos/{tipoEvento}` | Not enabled by default. |
| Query one event | `GET /nfse/{chaveAcesso}/eventos/{tipoEvento}/{numSeqEvento}` | Supported by `EventLookupInterface::queryEvent()`. |

Source: Sistema Nacional NFS-e, current production contributor API manual.

The production/restricted Swagger snapshot reviewed during implementation exposed the POST
operation and the fully-qualified GET query, but did not expose the base or type-only GET
operations. Because mutating or querying a fiscal API from an undocumented executable
contract is an interoperability risk, nfse-php intentionally does not guess those two routes.

When an authoritative executable contract exposes them, they can be added without changing
the existing SEFIN/ADN separation.

## Event XML

Event registration uses the official `pedRegEvento_v1.01.xsd` contract and
`tiposEventos_v1.01.xsd`. The repository validates cancellation/event-registration XML
locally with `EventSchemaValidator`; schema validation never downloads external resources.
15 changes: 15 additions & 0 deletions references/schemas/nfse/1.01/pedRegEvento_v1.01.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
targetNamespace="http://www.sped.fazenda.gov.br/nfse"
xmlns="http://www.sped.fazenda.gov.br/nfse"
attributeFormDefault="unqualified"
elementFormDefault="qualified">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
<xs:include schemaLocation="tiposEventos_v1.01.xsd"/>
<xs:element name="pedRegEvento" type="TCPedRegEvt">
<xs:annotation>
<xs:documentation>Schema XML do Pedido de Registro de Eventos</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
Loading
Loading