Thin Python 3 client for the InvoiceXpress REST API
Project description
Thin Python 3 client for the InvoiceXpress REST API.
Sample usage
import invoicexpress_api as ie
BASE_URL = 'https://mycompany.app.invoicexpress.com'
API_KEY = 'my api key'
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"
}
}
]
}
}
c = ie.Client(BASE_URL, API_KEY)
inv_type = ie.Invoices.Types.INVOICE_RECEIPT
inv = ie.Invoices.create(c, invoice_data, inv_type)
print('## Create invoice result')
print(inv)
cli = ie.Clients.code_search(c, inv[inv_type]['client']['code'])
cli_upd = {"client": {"fiscal_id": "212345678", "country": "Portugal"}}
ie.Clients.update(c, cli['client']['id'], cli_upd)
print('## Client Updated')
print(cli)
inv[inv_type]['items'][0]['unit_price'] = 150
ie.Invoices.update(c, inv[inv_type]['id'], inv, inv_type)
print('## Invoice Updated')
print(inv)
ie.Invoices.change_state(c, inv[inv_type]['id'], ie.Invoices.States.FINAL)
inv = ie.Invoices.get(c, inv[inv_type]['id'])
print('## Invoice Settled')
print(inv)
print('PDF URL: ', ie.Invoices.get_pdf_url(c, inv[inv_type]['id']))
ie.Invoices.send_email(c, inv[inv_type]['id'], 'email@domail.tld', 'New invoice!', 'Hi John,\r\nHere is your new invoice\r\nRegards,')
print('## E-mail sent')
License
MIT
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
Close
Hashes for invoicexpress_api-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9329da4eb6a82f8e34bdad93d0bd2681c158cfea3e2119e6f5001ce488a27db4 |
|
MD5 | a2b8793ce546b2e2b3dcb97c2eef91f8 |
|
BLAKE2b-256 | 723b5d15478ad6b5664dda4f4fe65bc1137da96aed80da2273411cb55ee7e781 |