npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nodecfdi/cfdi-expresiones

v2.1.6

Published

Librería que contiene objetos de ayuda para crear expresiones de CFDI 3.2, CFDI 3.3, CFDI 4.0, RET 2.0 y RET 1.0 de acuerdo a la información técnica del SAT en el Anexo 20.

Downloads

328

Readme

@nodecfdi/cfdi-expresiones

Source Code Npm Node Version Support Discord Latest Version Software License Build Status Reliability Maintainability Code Coverage Violations Total Downloads

Library to generate expressions for CFDI 4.0, CFDI 3.3, CFDI 3.2, RET 2.0 and RET 1.0

:us: The documentation of this project is in spanish as this is the natural language for intended audience.

:mexico: La documentación del proyecto está en español porque ese es el lenguaje principal de los usuarios.

Esta librería contiene objetos de ayuda para crear expresiones de CFDI 3.2, CFDI 3.3, CFDI 4.0, RET 2.0 y RET 1.0 de acuerdo a la información técnica del SAT en el Anexo 20. Librería inspirada por la versión para php https://github.com/phpcfdi/cfdi-expresiones

Estas expresiones se utilizan principalmente para dos motivos:

  1. Generar el código QR de una representación impresa de un CFDI o RET.
  2. Consultar el WebService del SAT de estado de un CFDI.

Ejemplo de expresión para CFDI 3.3 && CFDI 4.0:

https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?id=CEE4BE01-ADFA-4DEB-8421-ADD60F0BEDAC&re=POT9207213D6&rr=DIM8701081LA&tt=2010.01&fe=/OAgdg==

Ejemplo de expresión para CFDI 3.2:

?re=AAA010101AAA&rr=COSC8001137NA&tt=0000001234.567800&id=CEE4BE01-ADFA-4DEB-8421-ADD60F0BEDAC

Ejemplo de expresión para RET 1.0:

?re=XAXX010101000&nr=12345678901234567890&tt=1234567890.123456&id=ad662d33-6934-459c-a128-BDf0393f0f44

Ejemplo de expresión para RET 2.0:

https://prodretencionverificacion.clouda.sat.gob.mx/?id=ad662d33-6934-459c-a128-BDf0393f0f44&re=XAXX010101000&nr=12345678901234567890&tt=1234567890.12&fe=/OAgdg==

Instalación

NPM

npm i @nodecfdi/cfdi-expresiones --save

YARN

yarn add @nodecfdi/cfdi-expresiones

PNPM

pnpm add @nodecfdi/cfdi-expresiones

CDN - Browser

Usa la versión mas reciente publicada cambiando <latest-version> por la última version. Ex. [email protected]/dist...

<script src="https://unpkg.com/@nodecfdi/cfdi-expresiones@<latest-version>/dist/cfdi-expresiones.global.js"></script>

Ejemplo básico de uso

Dado que en node como tal no se tiene acceso al api del navegador, más bien es un ambiente de servidor, no tenemos acceso a Document, por lo que para poder pasar el document a la lib usaremos la lib xmldom, que nos permitirá crear nuestro documento y pasárselo a esta lib.

import { readFileSync } from 'fs';
import { DiscoverExtractor } from '@nodecfdi/cfdi-expresiones';
import { DOMParser } from '@xmldom/xmldom';
// creamos el extractor
const extractor = new DiscoverExtractor();
// Accedemos al contenido en nuestro archivo XML
const content = readFileSync('archivo-cfdi.xml').toString();
// generamos el documento con ayuda de DOMParser
const document = new DOMParser().parseFromString(content, 'text/xml');
// obtenemos la expresión
const expression = extractor.extract(document);
// y también podemos obtener los valores inviduales
const values = extractor.obtain(document);

Nota: Actualmente la librería requiere que le pases un objeto de tipo Document, existen muchas libs en node que te dan el objeto que implementa esa interfaz, en esta lib usamos para pruebas la librería xmldom. Y se recomienda usar dicha lib para evitar cualquier error. Para browser se recomienda usar los nativos del Api Web.

Soporte

Puedes obtener soporte abriendo un ticket en Github.

Adicionalmente, esta librería pertenece a la comunidad OcelotlStudio, así que puedes usar los mismos canales de comunicación para obtener ayuda de algún miembro de la comunidad.

Compatibilidad

Esta librería se mantendrá compatible con al menos la versión con soporte activo de Node más reciente.

También utilizamos Versionado Semántico 2.0.0 por lo que puedes usar esta librería sin temor a romper tu aplicación.

Contribuciones

Las contribuciones con bienvenidas. Por favor lee CONTRIBUTING para más detalles y recuerda revisar el archivo CHANGELOG.

Copyright and License

The @nodecfdi/cfdi-expresiones library is copyright © NodeCfdi - OcelotlStudio and licensed for use under the MIT License (MIT). Please see LICENSE for more information.