/lib-manifest-sefaz

Primary LanguageJavaScriptMIT LicenseMIT

manifest-sefaz

Simple way to communicate with SEFAZ SOAP web services

Install

$ npm install manifest-sefaz

Codacy Badge build status Package Quality

Usage

const manifestSefaz = require('lib-manifest-sefaz')

const cnpj = '00.000.000/0000-00'
const nsu = '000000000002774'
const chNFe = '33200304214716000142950016001908041118869319'
const cert = 'Bag Attributes localKeyID: 01 00 00 00 friendlyName:'
const key = 'Bag Attributes localKeyID: 01 00 00 00 friendlyName: PRIVATE'
const passphrase = 'passphrase'

// Example
const nameOfFunction = async () => {
  try {
    await manifestSefaz.manifestXml(cnpj, nsu, chNFe, cert, key, passphrase)
  } catch(err) {
    console.error(err)
  }
}

API

manifestXml(cnpj, nsu, chNFe, cert, key, passphrase)

cnpj

Type: string Length: 18

CNPJ of supplier company

NSU

Type: string Length: 15

Order number about NF on SEFAZ

chNFe

Type: string Length: 44

Key of NF

cert

Type: string

Certificate of supplier generate by SEFAZ

key

Type: string

Private certificate of supplier generate by SEFAZ

passphrase

Type: string

Passphrase of certificates

Libraries used in this project:

Command to extract certificate and private key:

$ openssl pkcs12 -in name_of_file.pfx -clcerts -nokeys -out cert.pem && openssl pkcs12 -in name_of_file.pfx -nocerts -out key.pem -nodes

License

Martini is distributed by The MIT License, see LICENSE