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

afip

v0.0.11

Published

Argentina AFIP Client

Downloads

16

Readme

AFIP Client

This is a Argetina's AFIP WS Client to communicate to their Business Web Services.

THIS IS AN ALPHA 2, NOT A PRODUCTION MODULE YET BUT ALMOST A BETA, USE IT AT YOUR OWN RISK

IMPORTANT: This module is currently using a PHP code snipped to Sign the TRA (ticket de requerimiento de autenticación), planned to be replace with pure node code soon

Development on this module started June 22, 2016. We are scheduling to release a beta version by July 15th, we are now open for bugs, suggestions and pull requests.

Keep watching!

Install

Install with npm:

  npm install afip

Module

This module provides a constructor method that gives you an instance of a WS SOAP Client (See: SOAP Module)

initSession(options, callback)

Starts a session with WSAA Afip and creates a Client for a given Business Service.

Options

The options argument allows you to customize the client with the following properties:

  • service: Any related business service to authenticate to associated to the CUIT, ie: wsfe
  • serviceClass: Business service class to use as root path, ie: wsfev1
  • productionCertFilename: absolute location to your production cert file
  • productionKeyFilename: absolute location to your production private key file
  • productionPassphrase: Optional, default empty - passphrase used to generate the production key file
  • homologCertFilename: absolute location to your homolog cert file
  • homologKeyFilename: absolute location to your homolog private key file
  • homologPassphrase: Optional, default empty - passphrase used to generate the homolog key file
  • production: Optional, default: false - whether use production or homolog condiguration
  • See AFIP WS Documentation to learn how to get your cert files and relate business services to your clave fiscal

Callback

The callback function (mandatory) will be called once the soap client is ready.

The callback will receive the following parameters:

  1. error: and error object in case something went wrong
  2. businessWS: The business ws client object that have a connected SOAP Client instance

Usage

var afip = require('afip');

afip.initSession({
  service: 'wsfe',
  serviceClass: 'wsfev1',
  productionCertFilename: __dirname + '/wsaa/production.cert',
  productionKeyFilename: __dirname + '/wsaa/production.key',
  homologCertFilename: __dirname + '/wsaa/homolog.cert',
  homologKeyFilename: __dirname + '/wsaa/homolog.key',
  production: false // Optional, default: false
}, (err, wsfe) => {
  // TODO: Place your code here...
  
  // Example: requesting a invoice
  wsfe.soapClient.Service.ServiceSoap12.FECAESolicitar(
    {/* TODO: Your Options, See AFIP Documentation at http://www.afip.gov.ar/ws/ */}, 
    (err, result, raw, soapHeader) => {
      // TODO: Check if the invoice is ok and whatever...
    }
  );
  
  // Print the client and check what methods do you have available...
  console.log(wsfe.soapClient.Service);
});