Code Monkey home page Code Monkey logo

afip.ts's Introduction

Hi there 👋, I'm Rodrigo!

Software Enginner
Developer Consultant at Valiu Lab

Linkedin: rodrigoalcorta GitHub ralcorta

A little more about me...

const developer = {
  fullname: 'Rodrigo Victor Alcorta',
  country: 'Argentina',
  Lenguages: [ 'ES', 'EN' ],
  position: 'Software Engineer',
  teams: [ 'Valiulab', 'Bayer' ],
  code: [ 'Javascript', 'Typescript', 'HTML', 'CSS', 'C#', 'PHP', 'C', 'GO' ],
  tools: [ 'Node', 'NestJs', 'React', 'Redux', 'Angular', 'Jest', 'Docker' ],
  architecture: [ 'microservices', 'event-driven', 'design system pattern' ],
}

👇 Write in your terminal to connect with me 👇

npx ralcorta

afip.ts's People

Contributors

dependabot[bot] avatar josegiufrida avatar ralcorta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

afip.ts's Issues

Error en integración con NextJS

Describe the bug
Al querer utilizar el paquete en una server-action o un router-handler, obtengo el siguiente error:

To Reproduce
Steps to reproduce the behavior:

  1. Crear una aplicación NextJS limpia
  2. Instlaar paquete
  3. Crear un route-handler:
import { Afip } from "afip.ts";
import fs from "fs";

const cert = fs.readFileSync("./certs/test.crt", { encoding: "utf8" });
const key = fs.readFileSync("./certs/test.key", { encoding: "utf8" });

export async function GET() {
  const afip: Afip = new Afip({
    cert,
    key,
    cuit: XXXXXXXXXXX,
  });
  const taxId = XXXXXXXXXXX;

  const taxpayerDetails =
    await afip.registerInscriptionProofService.getTaxpayerDetails(taxId);

  return Response.json({ taxpayerDetails });
}
  1. Utilizar Postman para llamar al servicio
⨯ [Error: ENOENT: no such file or directory, open '/Users/ataschz/refip/.next/server/vendor-chunks/wsdl/ws_sr_inscription_proof.wsdl'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/ataschz/refip/.next/server/vendor-chunks/wsdl/ws_sr_inscription_proof.wsdl'
}
 GET /api/register-inscription-proof-2 500 in 1212ms

Screenshots
image

image

Desktop (please complete the following information):

  • OS: macOs
  • Browser Arc/Chrome

Additional context
No hay nada en especial en el bundle, es una aplicacion limpia. Quiza este relacionado con la forma de buiildear la libreria.

ENOENT: no such file or directory, open '/opt/app/node_modules/afip.ts/lib/auth/tickets/TA-X-ws_sr_constancia_inscripcion-production.json'

Hola, estoy usando la library y estamos teniendo un problema en el ambiente productivo. La primera vez que se consulta, devuelve el error mencionado. Las sucesivas veces posteriores funciona de manera normal. Solo falla en la primer consulta. Aquí, como se está utilizando:
`
async getLegalInfo(cuit: string): Promise {

 const afip = new Afip({
     key: process.env.AFIP_LOGIN_CMS_PRIVATE_KEY!,
     cert: process.env.AFIP_LOGIN_CMS_CERTIFICATE_PEM!,
     cuit: Number(process.env.AFIP_CUIT!),
    production: process.env.TEST?.toLowerCase() === 'false',
});
   const afipInfo =
    await this.getAfip().registerInscriptionProofService.getTaxpayerDetails(
      Number(cuit),
    );
  if (!afipInfo.datosGenerales) throw new AfipException('Invalid CUIT');
  const { datosGenerales, datosRegimenGeneral } = afipInfo;

//resto del proceso
}
El error:
Error: ENOENT: no such file or directory, open '/opt/app/node_modules/afip.ts/lib/auth/tickets/TA-20268032992-ws_sr_constancia_inscripcion-production.json'
at async open (node:internal/fs/promises:636:25)
at async Object.writeFile (node:internal/fs/promises:1216:14)
`
Node version: 18.18.1

Cambio del webservice para la consulta de padron alcance 5

El ws_sr_padron_a5 fue deprecado y reemplazado por el ws_sr_constancia_inscripcion.

Al querer hacer la request con el metodo ws_sr_padron_a5 esta es la respuesta que obtengo de la AFIP:
Error: ns1:coe.notAuthorized: Computador no autorizado a acceder al servicio: {"exceptionName":"gov.afip.desein.dvadac.sua.view.wsaa.LoginFault","hostname":"wsaa1.afip.gov.ar"}

Luego cambie los siguientes archivos:

soap/service-names.enum.js:

Reemplaze esta linea:

ServiceNamesEnum["WSSR_PADRON_FIVE"] = "ws_sr_padron_a5";

Por esta:

ServiceNamesEnum["WSSR_PADRON_FIVE"] = "ws_sr_constancia_inscripcion";

soap/service-names.enum.d.ts:

Reemplaze esta linea:

WSSR_PADRON_FIVE = "ws_sr_padron_a5",

Por esta:

WSSR_PADRON_FIVE = "ws_sr_constancia_inscripcion",

Con estos cambios logre hacer las consultas al padron.

No existe el SRC en el build

Describe the bug
Cuando se instala el paquete no existe el contenido del source. Por lo tanto no se puede instalar.

To Reproduce
Steps to reproduce the behavior:

  1. pnpm install afip.ts

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Linux Mint

Additional context
Add any other context about the problem here.

handleTicket

Cuando handleTicket está en true, para poder manejar los tokens de afip y guardarlos en una DB o storage arroja el siguiente error:
"Error: Tokens are not defined yet. Set it when Afip class is instanced."
No entiendo como obtener los tokens de afip y en la documentación parece faltar la parte que explica como hacer login y pasar los tokens a algun servicio luego.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.