1.4.1 • Published 3 years ago

sefaz-communicator v1.4.1

Weekly downloads
22
License
MIT
Repository
github
Last release
3 years ago

sefaz-communicator

Simple way to communicate with SEFAZ SOAP web services

Install

npm install sefaz-communicator

Usage

const sefaz = require('sefaz-communicator')

const url = 'https://hnfe.sefaz.ba.gov.br/webservices/NFeStatusServico4/NFeStatusServico4.asmx'
const methodName = 'nfeStatusServicoNF'
const message = {
    $xml: `<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00">
            <tpAmb>2</tpAmb>
            <cUF>29</cUF>
            <xServ>STATUS</xServ>
          </consStatServ>`,
}

const certificate = Buffer.from('Pfx certificate in base64 string', 'base64')
const password = 'password'

const response = await sefaz.communicate(url, methodName, message, {
    certificate,
    password,
})

API

communicate(url, method, message, options)

url

Type: string

Web service URL

methodName

Type: string

Name of Wsdl Method

message

Type: object

Examples

message: { \$xml: '<?xml>...'}

or

message: { nfeDadosMsg: '<?xml>...'}

(optional) options.certificate

Type: Buffer

Pfx Certificate as Buffer

(optional) options.password

Type: string

Certificate password

(optional) options.headers

Type: string array

Headers in xml

Example

headers: '<cteCabecMsg>...</cteCabecMsg>'

(optional) options.httpClient

Type: http.HttpClient

Custom node-soap HttpClient

(optional) options.escapeXML

Type: boolean

Escape XML message (default: false)

(optional) options.forceSoap12Headers

Type: boolean

Force Soap12 Headers (default: true)

(optional) options.contentType

Type: string

Communication content type (default: application/soap+xml)

(optional) options.proxy

Type: string

Proxy url to use in the communication

(optional) options.customFormatLocation

Type: Function

Function to format location that the method is called

(optional) options.rawResponse

Type: boolean

If true, returns raw XML response (default: false)

1.4.1

3 years ago

1.4.0

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.6

3 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago