Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var axios = require("axios");
- axios
- .post("https://dev-api.haulmer.com/v2/dte/document", postData, {
- headers: {
- apikey: "928e15a2d14d4a6292345f04960f4bd3"
- }
- })
- .then(response => {
- console.log(response);
- })
- .catch(error => {
- if (error.response) {
- console.log(error.response.data.error.details);
- console.log(error.response.data);
- //console.log(error.response.status);
- //console.log(error.response.headers);
- } else if (error.request) {
- //console.log(error.request);
- } else {
- //console.log("error", error.message);
- }
- //console.log(error.config);
- });
- var postData = {
- response: ["XML", "PDF", "TIMBRE", "LOGO", "FOLIO", "RESOLUCION"],
- dte: {
- Encabezado: {
- IdDoc: { TipoDTE: 39, Folio: 0, FchEmis: "2019-09-11", IndServicio: "3" },
- Emisor: {
- RUTEmisor: "76795561-8",
- RznSocEmisor: "HAULMERSPA",
- GiroEmisor:
- "VENTAALPORMENORENEMPRESASDEVENTAADISTANCIAVÍAINTERNET;COMERCIOELEC",
- CdgSIISucur: "81303347",
- DirOrigen: "ARTUROPRAT527CURICO",
- CmnaOrigen: "Curicó"
- },
- Receptor: { RUTRecep: "66666666-6" },
- Totales: { MntTotal: 2000, TotalPeriodo: 2000, VlrPagar: 2000 }
- },
- Detalle: [
- {
- NroLinDet: 1,
- NmbItem: "Item1",
- QtyItem: 1,
- PrcItem: 2000,
- MontoItem: 2000
- }
- ]
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement