invoicexpress rest api的瘦python 3包装

invoicexpress-api的Python项目详细描述


PyPIBuild StatusPython 3.3, 3.4, 3.5, 3.6MIT License

invoicexpress rest api的瘦python 3包装器。目前粗糙和不完整。

api文档位于:https://developers.invoicexpress.com/docs/versions/2.0.0/

包含的API

APIDone in
Invoicesv0.1.0
Estimatesto-do
Guidesto-do
Purchase Ordersto-do
Clientsv0.1.0
Itemsto-do
Sequencesto-do
Taxesto-do
Accountsto-do
SAF-Tto-do

安装

通过PIP自动安装:

$ pip install invoicexpress-api

用法

设置

>>> importinvoicexpress_apiasie>>> c=ie.Client('my_account_name','my_api_key')

创建发票

>>> 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
            }
        ]
    }
}

获取并更新发票

>>> 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
            }
        ]
    }
}

设置发票状态并通过电子邮件发送

>>> 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 文件以获取详细信息。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
maven通过pom文件增加最大java堆大小   java如何在Kojo IDE输出窗格中打印到同一行?   如何使用特定的JRE交付Java应用程序?   java Cordova插件调用日志找不到符号   Java上Redis哈希中的spring列表   java ThreadSafeClientConnManager不是多线程   java如何在激活器中获取IEclipseContext   java如何通过编程更改除法器偏差   在中找不到maven Java/Mvn本地资源。罐包装   JOptionPane的java用户输入验证。showInputDialog   java编辑:如何更改日期对象的日期格式?   文件编写器Java;如何覆盖   一行中包含多个值的java读取属性   java如何在安卓中使用截击上传视频