Skip to main content

Thin Python 3 wrapper for the InvoiceXpress REST API

Project description

PyPI Build Status Python 3.3, 3.4, 3.5, 3.6 MIT License

Thin Python 3 wrapper for the InvoiceXpress REST API. Currently rough and incomplete.

API docs at: https://developers.invoicexpress.com/docs/versions/2.0.0/

Included APIs

API

Done in

Invoices

v0.1.0

Estimates

to-do

Guides

to-do

Purchase Orders

to-do

Clients

v0.1.0

Items

to-do

Sequences

to-do

Taxes

to-do

Accounts

to-do

SAF-T

to-do

Installation

Automatic install via pip:

$ pip install invoicexpress-api

Usage

Setup

>>> import invoicexpress_api as ie
>>> c = ie.Client('my_account_name', 'my_api_key')

Create an invoice

>>> invoice_type = ie.invoices.Types.INVOICE_RECEIPT
>>> invoice_data = {
  "invoice": {
        "date": "17/04/2018",
        "due_date": "17/04/2018",
        "client": {
                "name": "John Doe",
                "code": "XYZ123"
        },
        "items": [
                {
                  "name": "SRV1",
                  "description": "Service 1",
                  "unit_price": 10.0,
                  "quantity": 5.0,
                  "tax": {
                          "name": "IVA23"
                          }
                }
          ]
   }
}
>>> ie.invoices.create(c, invoice_data, invoice_type)
{
    'invoice_receipt':{
        'id':12345678,
        'status':'draft',
        'archived':False,
        'type':'InvoiceReceipt',
        'sequence_number':'rascunho',
        'date':'17/04/2018',
        'due_date':'17/04/2018',
        'reference':None,
        'observations':None,
        'retention':None,
        'permalink':'https://www.app.invoicexpress.com/documents/113a4152...',
        'sum':50.0,
        'discount':0.0,
        'before_taxes':50.0,
        'taxes':11.5,
        'total':61.5,
        'currency':'Euro',
        'client':{
            'id':1234567,
            'name':'John Doe',
            'code':'XYZ123'
        },
        'items':[
            {
                'name':'SRV1',
                'description':'Service 1',
                'unit_price':'10.0',
                'unit':None,
                'quantity':'5.0',
                'tax':{
                    'id':123456,
                    'name':'IVA23',
                    'value':23.0
                },
                'discount':0.0,
                'subtotal':50.0,
                'tax_amount':11.5,
                'discount_amount':0.0,
                'total':61.5
            }
        ]
    }
}

Fetch and update an invoice

>>> inv = ie.invoices.get(c, 12345678, invoice_type)
>>> inv[invoice_type]['items'][0]['unit_price'] = 150
>>> ie.invoices.update(c, 12345678, inv, invoice_type)
>>> ie.invoices.get(c, 12345678, invoice_type)
{
    'invoice_receipt':{
        'id':12345678,
        'status':'settled',
        'archived':False,
        'type':'InvoiceReceipt',
        'sequence_number':'1/A',
        'inverted_sequence_number':'A/1',
        'sequence_id':123456,
        'date':'17/04/2018',
        'due_date':'17/04/2018',
        'reference':None,
        'observations':None,
        'retention':None,
        'permalink':'https://www.app.invoicexpress.com/documents/113a4152...',
        'saft_hash':'iyuX',
        'sum':750.0,
        'discount':0.0,
        'before_taxes':750.0,
        'taxes':172.5,
        'total':922.5,
        'currency':'Euro',
        'client':{
            'id':1234567,
            'name':'John Doe',
            'code':'XYZ123',
        },
        'items':[
            {
                'name':'SRV1',
                'description':'Service 1',
                'unit_price':'150.0',
                'unit':None,
                'quantity':'5.0',
                'tax':{
                    'id':123456,
                    'name':'IVA23',
                    'value':23.0
                },
                'discount':0.0,
                'subtotal':750.0,
                'tax_amount':172.5,
                'discount_amount':0.0,
                'total':922.5
            }
        ]
    }
}

Set invoice state and send by e-mail

>>> ie.invoices.change_state(c, 12345678, ie.invoices.States.FINAL)
>>> ie.invoices.send_email(c, 12345678, 'name@domain.tld',
                           'New invoice!',
                           'Hi John,\r\nHere is your invoice\r\nRegards,')

License

MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

invoicexpress_api-0.1.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

invoicexpress_api-0.1.2-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file invoicexpress_api-0.1.2.tar.gz.

File metadata

File hashes

Hashes for invoicexpress_api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 12dbdbb0cbb50e780420b5011846ac23dab26346908574810320ae9b33379f6d
MD5 df626767af0e3a8ce0373d82333b639c
BLAKE2b-256 aa6b4725f6f0e12d445b25c9ee813c32e8e8562a2c1b2ec6c4b5c72355f12af9

See more details on using hashes here.

File details

Details for the file invoicexpress_api-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for invoicexpress_api-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bd525445cf9b0f9f4a01c45e70ecc273affde73ad9b62a2712b4ec7593ebe8ab
MD5 9eb7800c3e3ed11f3182be141e154142
BLAKE2b-256 f5ac636b41c4672f94770884133d73cf222ec31b42bd5d757b3279211888b136

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page