Metadata-Version: 2.4
Name: digital-invoice
Version: 0.9.1782472708
Summary: Package to manage electronic invoice.
Home-page: https://gitlab.sleto.fr/sleto/digital-invoice
Author: Laurent Gay
Author-email: laurent@sleto.fr
License: GNU General Public License v3
Platform: Any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Accounting
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Jinja2~=3.1
Requires-Dist: factur-x~=3.8
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: requires-dist
Dynamic: summary

Digital-Invoice
===============

Digital-Invoice is a package to write or reader e-invoice (UBL or factur-x format) from JSON data

JSON Format
-----------

```
{
    "bill": {
        "date": "2026-03-15",                             # date in iso-format
        "num": "ABC1234", 
        "origin": "XYZ9876", 
        "detail": [
            {
                "id": "123",
                "reference": "AAA001",
                "designation": "Article sending",
                "price": 12.35,                           # price without VAT
                "quantity": 2.0,
                "vat_rate": 10.0,                         # VAT in percent
                "reduce": 5.0,                            # reduce without VAT
                "total": 19.70,                           # total exclude tax
            }
        ],
        "vat_info": [
            {
                "calculate": 19.70,                       # sum of all detail with this rate
                "basic": 1.97,                            # VAT total for this rate
                "rate": 10.0,
            }
        ],
        "total": {
            "excltax": 19.70,                             # total without VAT
            "incltax": 21.67,                             # total with VAT
            "payed": 10.0,
            "topay": 11.67,
            "tax": 1.97
        },
    },
    "buyer": {
        "name": "L'acheteur de Lyon",
        "legal_ident": "123456789",
        "vat_ident": "FR123456789",
        "postalcode": "69002",
        "address": ["place de Bellecours"],
        "city": "LYON",
        "country_id": "FR",
        "email": "buyer@digital-invoice.net",
        "phone": "+339876543210",
    },
    "seller": {
        "name": "Le vendeur de MARSEILLE",
        "legal_ident": "987654321",
        "vat_ident": "FR987654321",
        "postalcode": "13001",
        "address": ["Vieux port","BP 1234"],
        "city": "MARSEILLE",
        "country_id": "FR",
        "email": "seller@digital-invoice.net",
        "phone": "+331234567890",
    },
    "currency_code": "EUR"
}
```

Writer
------

Example:
```
writer = WriterInvoice()
writer.run(eformat=WriterInvoice.facturX, data=invoice_data)
writer.saveInPDF(pdf_stream)
```

```
writer = WriterInvoice()
writer.run(eformat=WriterInvoice.UBL, data=invoice_data)
print(writer.content_xml)
```
Reader
------

Example:
```
reader = ReaderInvoice()
if reader.run(pdf_stream) == ReaderInvoice.facturX:
   print(reader.data)
```

```
reader = ReaderInvoice()
if reader.run("UBL.xml") == ReaderInvoice.UBL:
   print(reader.data)
```

