open-nfse / fetchDanfse
Function: fetchDanfse()
ts
function fetchDanfse(httpClient: HttpClient, chaveAcesso: string): Promise<Buffer<ArrayBufferLike>>;Defined in: src/danfse/fetch.ts:15
Baixa o DANFSe oficial do ADN para uma chave de acesso. Retorna os bytes do PDF. Requer mTLS (o cliente do NfseClient já está configurado pra isso).
Lança InvalidChaveAcessoError se a chave não tiver 50 dígitos, NotFoundError (HTTP 404) se a chave não existir, ForbiddenError (403) se o CNPJ do certificado não tiver autorização para ver a nota, ServerError (5xx) em indisponibilidade.
Parameters
| Parameter | Type |
|---|---|
httpClient | HttpClient |
chaveAcesso | string |
Returns
Promise<Buffer<ArrayBufferLike>>