SHARE
TWEET

haulmer2

a guest Sep 11th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var axios = require("axios");
  2.  
  3. axios
  4.   .post("https://dev-api.haulmer.com/v2/dte/document", postData, {
  5.     headers: {
  6.       apikey: "928e15a2d14d4a6292345f04960f4bd3"
  7.     }
  8.   })
  9.   .then(response => {
  10.     console.log(response);
  11.   })
  12.   .catch(error => {
  13.     if (error.response) {
  14.       console.log(error.response.data.error.details);
  15.       console.log(error.response.data);
  16.  
  17.       //console.log(error.response.status);
  18.       //console.log(error.response.headers);
  19.     } else if (error.request) {
  20.       //console.log(error.request);
  21.     } else {
  22.       //console.log("error", error.message);
  23.     }
  24.     //console.log(error.config);
  25.   });
  26.  
  27. var postData = {
  28.   response: ["XML", "PDF", "TIMBRE", "LOGO", "FOLIO", "RESOLUCION"],
  29.   dte: {
  30.     Encabezado: {
  31.       IdDoc: { TipoDTE: 39, Folio: 0, FchEmis: "2019-09-11", IndServicio: "3" },
  32.       Emisor: {
  33.         RUTEmisor: "76795561-8",
  34.         RznSocEmisor: "HAULMERSPA",
  35.         GiroEmisor:
  36.           "VENTAALPORMENORENEMPRESASDEVENTAADISTANCIAV├ŹAINTERNET;COMERCIOELEC",
  37.         CdgSIISucur: "81303347",
  38.         DirOrigen: "ARTUROPRAT527CURICO",
  39.         CmnaOrigen: "Curic├│"
  40.       },
  41.       Receptor: { RUTRecep: "66666666-6" },
  42.       Totales: { MntTotal: 2000, TotalPeriodo: 2000, VlrPagar: 2000 }
  43.     },
  44.     Detalle: [
  45.       {
  46.         NroLinDet: 1,
  47.         NmbItem: "Item1",
  48.         QtyItem: 1,
  49.         PrcItem: 2000,
  50.         MontoItem: 2000
  51.       }
  52.     ]
  53.   }
  54. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top