Repository navigation
feat: add NFS-e invoice cancellation - #6
Open
paulodutra wants to merge 1 commit into
Open
paulodutra wants to merge 1 commit into
paulodutra wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
O que muda
Adiciona ao SDK o cancelamento de NFS-e, usando o endpoint
POST /v1/invoices/{id}/cancelda API.cancelno recurso de notas. Recebe{ reason, description? }e devolve a nota atualizada no mesmo formato doget. O nome segue a convenção da linguagem (cancel,Cancel,CancelAsync).issue_error,service_not_providedeother, como enum, constantes ou tipo literal, conforme o padrão do SDK.cancellingecancellede quatro campos novos, todos podendo vir nulos:cancellationReason,cancellationDescription,cancelledAtecancellationRequestedAt.nfse.invoice.cancelledenfse.invoice.cancellation_rejectedna lista de eventos, que passa de 9 para 11. Os dois estão emPUBLIC_WEBHOOK_EVENT_TYPESno backend.ERROR_INVOICE_NOT_CANCELLABLE) e 422 (descrição inválida) usam o mecanismo de erro que o SDK já tinha. Nenhuma classe de erro nova.get. Também atualiza a tabela de recursos, os comentários de documentação e o CHANGELOG, quando o repositório tem um.Como o usuário confere o resultado
O cancelamento pode ser assíncrono. O usuário consulta a nota com
gete olha ostatus:cancelledcancelledAtpreenchido)cancellingprocessingcomcancellationRequestedAtauthorizedcomlastErrorCodeOs webhooks
nfse.invoice.cancelledenfse.invoice.cancellation_rejecteddão o mesmo retorno sem precisar consultar a nota.Decisões
cancel: o OpenAPI não declara esse header para o endpoint, e a API trata um pedido repetido como "o primeiro vale".getou pelos webhooks.Como testar
cancelcom 200 (cancelled), conferindo método, path e bodycancelsemdescription: o campo fica fora do bodycancelcom 202 (cancelling, eprocessingcomcancellationRequestedAt)cancelcom 409 e 422, chegando como o erro do SDK com o códigogetde uma notacancellede de umacancelling, lendo o status e os campos novoscancelcomreason: "issue_error"e uma descrição de 15 caracteres ou mais, e consultar comgetaté o status ficarcancelled.