Thin Python 3 wrapper for the InvoiceXpress REST API
Project description
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 |
---|---|
v0.1.0 |
|
to-do |
|
to-do |
|
to-do |
|
v0.1.0 |
|
to-do |
|
to-do |
|
to-do |
|
to-do |
|
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file invoicexpress_api-0.1.2.tar.gz
.
File metadata
- Download URL: invoicexpress_api-0.1.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12dbdbb0cbb50e780420b5011846ac23dab26346908574810320ae9b33379f6d |
|
MD5 | df626767af0e3a8ce0373d82333b639c |
|
BLAKE2b-256 | aa6b4725f6f0e12d445b25c9ee813c32e8e8562a2c1b2ec6c4b5c72355f12af9 |
File details
Details for the file invoicexpress_api-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: invoicexpress_api-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd525445cf9b0f9f4a01c45e70ecc273affde73ad9b62a2712b4ec7593ebe8ab |
|
MD5 | 9eb7800c3e3ed11f3182be141e154142 |
|
BLAKE2b-256 | f5ac636b41c4672f94770884133d73cf222ec31b42bd5d757b3279211888b136 |