Metadata-Version: 2.1
Name: invoicexpress-api
Version: 0.1.0
Summary: Thin Python 3 client for the InvoiceXpress REST API
Home-page: https://github.com/bitmario/invoicexpress-api-python
Author: Mario Falcao
Author-email: mario@bitsiders.com
License: MIT license
Keywords: invoicexpress_api
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: requests

==========================
InvoiceXpress API - Python
==========================


.. image:: https://img.shields.io/pypi/v/invoicexpress_api.svg
        :target: https://pypi.python.org/pypi/invoicexpress_api

.. image:: https://img.shields.io/travis/bitmario/invoicexpress-api-python.svg
        :target: https://travis-ci.org/bitmario/invoicexpress-api-python



Thin Python 3 client for the InvoiceXpress REST API.


Sample usage
------------

.. code-block:: python

	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


