An open API service indexing awesome lists of open source software.

https://github.com/enricodeleo/fattura24

👨‍💻Programmatically manage 📝invoices and customers with node.js and Fattura24 🧾
https://github.com/enricodeleo/fattura24

api integration invoices nodejs sdk

Last synced: about 1 month ago
JSON representation

👨‍💻Programmatically manage 📝invoices and customers with node.js and Fattura24 🧾

Awesome Lists containing this project

README

        

# Fattura24 Node.js SDK

💻 Interact programmatically with 📃[Fattura24](https://www.fattura24.com) APIs with node.js.

## Offically recognized by Fattura24
[Original post](https://www.fattura24.com/node-js-modulo-fatturazione/)

## You don't have a Fattura24 account, yet?

[![Fattura24](http://www.fattura24.com/banner/fattura24_640x200.jpg)](http://www.fattura24.com/?src=ab80977)

## Usage
This module exposes an object you can interact to with all the supported methods of Fattura24's api.

### Create a new customer

```js
var fattura24 = new Fattura24({ apiKey: 'weejeighaGushuz7Megeisheij6oogh3' });

fattura24.saveCustomer({
CustomerName: 'MARIO ROSSI',
CustomerAddress: 'Via Alberti 8',
CustomerPostcode: '06122',
CustomerCity: 'Perugia',
CustomerProvince: 'PG',
CustomerCountry: '',
CustomerFiscalCode: 'MARROS66C44G217W',
CustomerVatCode: '03912377542',
CustomerCellPhone: '335123456789',
CustomerEmail: '[email protected]'
}).then(function( customer ) {
console.log( customer );
}).catch(function( error ) {
console.error( error );
});
```

#### Create a new customer with special chars

In case of special chars, like the ampersand (&) Fattura24 requires to escape them in an XML cdata.
One way to do it is to pass a subobject with the _cdata field to the properties.

Right now the project automatically converts the _cdata returning from the xml, but doesn't autoconvert properties while
sending them, therefore it's advised to add the _cdata in all needed fields.

Example:
```js
var fattura24 = new Fattura24({ apiKey: 'weejeighaGushuz7Megeisheij6oogh3' });

fattura24.saveCustomer({
CustomerName: { _cdata: 'MARIO ROSSI & Figli' },
CustomerAddress: { _cdata: 'Via Alberti 8' },
CustomerPostcode: '06122',
CustomerCity: 'Perugia',
CustomerProvince: 'PG',
CustomerCountry: '',
CustomerFiscalCode: 'MARROS66C44G217W',
CustomerVatCode: '03912377542',
CustomerCellPhone: '335123456789',
CustomerEmail: '[email protected]'
}).then(function( customer ) {
console.log( customer );
}).catch(function( error ) {
console.error( error );
});
```

### Create a new invoice

```js
var fattura24 = new Fattura24({ apiKey: 'weejeighaGushuz7Megeisheij6oogh3' });

fattura24.saveDocument({
TotalWithoutTax: 29.10,
VatAmount: 0,
DocumentType: 'FE',
SendEmail: false,
FeVatNature: 'N4',
Object: 'Handmade products export',
Total: 29.10,
Payments: {
Payment: {
Date: '2018-12-14',
Paid: true,
Amount: 29.10
}
},
CustomerName: 'John Doe',
CustomerAddress: '29, 5th Avenue',
CustomerPostcode: 'AA12345',
CustomerCity: 'NYC',
CustomerCountry: 'USA',
CustomerCellPhone: '+15551234567',
CustomerEmail: '[email protected]',
FootNotes: 'Grazie per aver acquistato da noi',
Rows: [
{
Row: {
Code: '001',
Description: 'Wooden Chair',
Price: 29.10,
VatCode: 0,
VatDescription: '0%',
Qty: 1
},
},
],
})
.then(console.log)
.catch(console.log);
```

## Methods
This module reflects **API version v0.3.3** methods. Further details are available on [official documentation](https://www.fattura24.com/api-documentazione/).

|Method |Purpose |
|---|---|
|testKey |Verify that the ApiKey is valid |
|saveCustomer |Create a new customer |
|saveDocument |Create a document |
|getFile |Retrieve a document as PDF |
|getTemplate |Get a list of available custom document templates |
|getPdc |Get the chart of accounts |
|getNumerator |Get accounting branches |
|getProduct |Get a product or a service |
|saveItem |Create a credit |

## CHANGELOG
#### v0.2.1 - 31/01/2019
Fix for non-xml parameters such as in /getFile and /GetProduct

#### v0.2.0 - 30/01/2019
Support for