Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

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.

Filename, size & hash SHA256 hash help File type Python version Upload date
invoicexpress_api-0.1.2-py2.py3-none-any.whl (5.0 kB) Copy SHA256 hash SHA256 Wheel py2.py3
invoicexpress_api-0.1.2.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page