Skip to content

Instantly share code, notes, and snippets.

@Cshion
Last active May 5, 2023 16:47
Show Gist options
  • Select an option

  • Save Cshion/dbc1a9df0d257ca2616a9238d1521ad6 to your computer and use it in GitHub Desktop.

Select an option

Save Cshion/dbc1a9df0d257ca2616a9238d1521ad6 to your computer and use it in GitHub Desktop.
Usando el WS de SUNAT para enviar una factura con Nodejs
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);
}
});
});
@ajahuanex
Copy link

Hola, donde encuentro el modulo 'soap' ?

@moisesli
Copy link

creo que ese ruc con el que hiciste fue con el que trabaje yo primero en 2016 .) jejeje

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment