feat(service-invoice): downloadCancellationXml() — XML do evento de cancelamento — v3.5.0 - #34
Merged
Merged
Conversation
…ancelamento (e110001) — v3.5.0
- GET /v1/companies/{id}/serviceinvoices/{id}/cancellation-xml, mesmo padrão
dos downloads existentes (bytes crus, redirect sem vazar Authorization)
- 404 é resposta esperada (provedor legado / não Nacional / não cancelada) e
chega como NotFoundException — documentado no docblock e nos docs
- Testes: unit (verbo+path pinados, 404 semântico, IDs vazios) + alinhamento
com nf-servico-v1 (operationId ServiceInvoices_GetCancellationXml) e
service-invoice-rtc-v1 (normalizando :param → {param})
- Docs + skill + CHANGELOG; Version 3.5.0 (minor)
- Sondado ao vivo 2026-08-01 com o código novo: invoice falso E nota
cancelada real (provedor legado) → 404 com a mensagem de domínio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change openspec:
add-service-invoice-cancellation-xml(onda 2 da review, P1-4)Por quê
O download do XML do evento de cancelamento de NFS-e é o único gap funcional exigido por duas specs (
nf-servico-v1.yaml:7909ServiceInvoices_GetCancellationXmleservice-invoice-rtc-v1.yaml:454). Com a Reforma Tributária, o ambiente Nacional emite o eventoe110001— integradores que guardam trilha fiscal completa precisam desse XML.O que muda
ServiceInvoicesResource::downloadCancellationXml(string $companyId, string $invoiceId, ?RequestOptions $options = null): string— mesmo padrão dos downloads existentes (download(), bytes crus, segue redirect sem vazarAuthorization).NotFoundException, com a semântica documentada no docblock, nos docs e na skill. Quando existem o XML de envio e o autorizado, a API retorna o autorizado.Testes
GET …/cancellation-xml), bytes crus, 404 →NotFoundException, IDs vazios rejeitados sem HTTP.:param— o teste normaliza para{param}).CurlTransportFailurePhaseTest); PHPStan e cs verdes.Validação ao vivo (2026-08-01, empresa dev, read-only)
404com a mensagem de domínio: "Cancellation event XML not available for this service invoice (National environment only; legacy providers have no cancellation event XML, or the invoice has not been cancelled)."Release
src/Version.php→ 3.5.0 dentro deste PR (minor — método novo, nada muda no existente). Tagv3.5.0após o merge.