Last active
May 5, 2023 16:47
-
-
Save Cshion/dbc1a9df0d257ca2616a9238d1521ad6 to your computer and use it in GitHub Desktop.
Usando el WS de SUNAT para enviar una factura con Nodejs
This file contains 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
var soap = require('soap'); | |
var fs = require('fs'); | |
var http = require('http'); | |
var url = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService?wsdl'; | |
var options = { | |
forceSoap12Headers: false | |
}; | |
var data = fs.readFileSync("./20532710066-01-F001-1.zip",{ | |
encoding:"base64" | |
}); | |
soap.createClient(url, options, function (err, client) { | |
var wsSecurity = new soap.WSSecurity("20532710066MODDATOS", "moddatos", {}) | |
client.setSecurity(wsSecurity); | |
client.sendBill({ | |
fileName:"20532710066-01-F001-1.zip", | |
contentFile:data | |
},(err, res) => { | |
if(err){ | |
console.error(err); | |
}else{ | |
console.log(res); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
creo que ese ruc con el que hiciste fue con el que trabaje yo primero en 2016 .) jejeje