fiskal-hr


Namefiskal-hr JSON
Version 0.9.1 PyPI version JSON
download
home_page
SummaryClient for Croatian Fiskalizacija tax service
upload_time2023-01-14 05:36:09
maintainer
docs_urlNone
author
requires_python>=3.6
licenseMIT
keywords fiskalizacija
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fiskal-hr

Python 3 package for integrating with Croatian tax authority
[Fiskalizacija](https://www.porezna-uprava.hr/HR_Fiskalizacija/Stranice/FiskalizacijaNovo.aspx)
service.

## Scope

The package provides full integration with the Fiskalizacija service, including:

* checking invoice details in test (DEMO) mode - `FiskalClient.check_invoice()`
* submitting an invoice - `FiskalClient.submit_invoice()`
* submitting a fiscalization document - `FiskalClient.submit_document()`
* changing the payment method - `FiskalClient.change_payment_method()`

## Requirements

You'll need your client certificate, Fiskalizacija service certificate and FINA root CA
certificates. Read the [integration guide](doc/integration.md) for detailed steps how to
get and prepare the certificates.

You'll also need the `libxmlsec1` library installed on your computer.

## Quickstart

1. Install `fiskal-hr`:

    ```sh
    pip install fiskal-hr
    ```

2. Make sure you have your certificates ready, then initialize the fiskal client package:

    ```python
    from fiskalhr.invoice import Invoice
    from fiskalhr.ws import FiskalClient
    from fiskalhr.signature import Signer, Verifier

    signer = Signer("path/to/your-client-cert.pem")  # if encrypted, you'll need the password as well
    verifier = Verifier("path/to/service-cert.pem", ["path/to/fina-demo-ca-combined.pem"])
    fiskal_client = FiskalClient(
        "path/to/fina-demo-ca-combined.pem",
        "path/to/wsdl/FiskalizacijaService.wsdl",
        signer,
        verifier,
    )
    ```

3. Check communication with the service:

    ```python
    fiskal_client.test_service()
    ```

    This sends a "ping" message to the echo service, to check that basic connectivity is working.
    If there's an error, the `test_service()` method will raise an exception.

4. Create a test invoice and ask the service to do sanity checks on it (this only works in the
   demo mode):

    ```python
    invoice = Invoice(fiskal_client, oib="YOUR-OIB", invoice_number="1/X/1", total=100)

    fiskal_client.check_invoice(invoice)
    ```

    If there are any errors, the `check_invoice()` method will raise `fiskalhr.ResponseError`
    with the error details in the `details` attribute.

    Note that this does only basic sanity checking. For example, it will not check if the
    point of sale location (code `X` in the invoice number in this example) is registered.

## Testing

This package has 100% unit test coverage. To run the tests:

```
pytest
```

Coverage report is generated automatically. To export it in HTML form, run `coverage html`.

The tests do not contact Fiskalizacija service or any other external service, nor do they
require actual certificates. They are entirely self-contained.

More info about testing and certificates is available in [the testing guide](doc/testing.md).

## Contributing

Found a bug or think something can be improved? All contributions are welcome!

Before changing any code, please open a GitHub issue explaining what you'd like to do.
This will ensure that your planned contribution fits well with the rest of the package
and minimize the chance your pull request will be rejected.

If changing any code, please ensure that after your changes:

* all tests pass and the code coverage is still 100%
* `black`, `flake8` and `isort` find no problems
* the code doesn't depend on any external service

## Copyright and license

Copyright (C) 2022 by Senko Rasic <senko@senko.net>

This package may be used and distributed under the terms of MIT license.
See the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "fiskal-hr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "fiskalizacija",
    "author": "",
    "author_email": "Senko Rasic <senko@senko.net>",
    "download_url": "https://files.pythonhosted.org/packages/88/b0/8b70516ada39e1e8f2019a9a3081cd0dba03f4f80d872b41e8b682a510e9/fiskal-hr-0.9.1.tar.gz",
    "platform": null,
    "description": "# fiskal-hr\n\nPython 3 package for integrating with Croatian tax authority\n[Fiskalizacija](https://www.porezna-uprava.hr/HR_Fiskalizacija/Stranice/FiskalizacijaNovo.aspx)\nservice.\n\n## Scope\n\nThe package provides full integration with the Fiskalizacija service, including:\n\n* checking invoice details in test (DEMO) mode - `FiskalClient.check_invoice()`\n* submitting an invoice - `FiskalClient.submit_invoice()`\n* submitting a fiscalization document - `FiskalClient.submit_document()`\n* changing the payment method - `FiskalClient.change_payment_method()`\n\n## Requirements\n\nYou'll need your client certificate, Fiskalizacija service certificate and FINA root CA\ncertificates. Read the [integration guide](doc/integration.md) for detailed steps how to\nget and prepare the certificates.\n\nYou'll also need the `libxmlsec1` library installed on your computer.\n\n## Quickstart\n\n1. Install `fiskal-hr`:\n\n    ```sh\n    pip install fiskal-hr\n    ```\n\n2. Make sure you have your certificates ready, then initialize the fiskal client package:\n\n    ```python\n    from fiskalhr.invoice import Invoice\n    from fiskalhr.ws import FiskalClient\n    from fiskalhr.signature import Signer, Verifier\n\n    signer = Signer(\"path/to/your-client-cert.pem\")  # if encrypted, you'll need the password as well\n    verifier = Verifier(\"path/to/service-cert.pem\", [\"path/to/fina-demo-ca-combined.pem\"])\n    fiskal_client = FiskalClient(\n        \"path/to/fina-demo-ca-combined.pem\",\n        \"path/to/wsdl/FiskalizacijaService.wsdl\",\n        signer,\n        verifier,\n    )\n    ```\n\n3. Check communication with the service:\n\n    ```python\n    fiskal_client.test_service()\n    ```\n\n    This sends a \"ping\" message to the echo service, to check that basic connectivity is working.\n    If there's an error, the `test_service()` method will raise an exception.\n\n4. Create a test invoice and ask the service to do sanity checks on it (this only works in the\n   demo mode):\n\n    ```python\n    invoice = Invoice(fiskal_client, oib=\"YOUR-OIB\", invoice_number=\"1/X/1\", total=100)\n\n    fiskal_client.check_invoice(invoice)\n    ```\n\n    If there are any errors, the `check_invoice()` method will raise `fiskalhr.ResponseError`\n    with the error details in the `details` attribute.\n\n    Note that this does only basic sanity checking. For example, it will not check if the\n    point of sale location (code `X` in the invoice number in this example) is registered.\n\n## Testing\n\nThis package has 100% unit test coverage. To run the tests:\n\n```\npytest\n```\n\nCoverage report is generated automatically. To export it in HTML form, run `coverage html`.\n\nThe tests do not contact Fiskalizacija service or any other external service, nor do they\nrequire actual certificates. They are entirely self-contained.\n\nMore info about testing and certificates is available in [the testing guide](doc/testing.md).\n\n## Contributing\n\nFound a bug or think something can be improved? All contributions are welcome!\n\nBefore changing any code, please open a GitHub issue explaining what you'd like to do.\nThis will ensure that your planned contribution fits well with the rest of the package\nand minimize the chance your pull request will be rejected.\n\nIf changing any code, please ensure that after your changes:\n\n* all tests pass and the code coverage is still 100%\n* `black`, `flake8` and `isort` find no problems\n* the code doesn't depend on any external service\n\n## Copyright and license\n\nCopyright (C) 2022 by Senko Rasic <senko@senko.net>\n\nThis package may be used and distributed under the terms of MIT license.\nSee the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Client for Croatian Fiskalizacija tax service",
    "version": "0.9.1",
    "split_keywords": [
        "fiskalizacija"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "224507d2f00d83067217873b289ae522f08b7191fdb17f035da577b453fa2518",
                "md5": "d201cf32b2b40106174305edaa41fe39",
                "sha256": "367d9a557eb71c25edfa62681cff7b2b9525a5fcff5b44cdbffe2aba6e88bc21"
            },
            "downloads": -1,
            "filename": "fiskal_hr-0.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d201cf32b2b40106174305edaa41fe39",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 19749,
            "upload_time": "2023-01-14T05:36:07",
            "upload_time_iso_8601": "2023-01-14T05:36:07.694205Z",
            "url": "https://files.pythonhosted.org/packages/22/45/07d2f00d83067217873b289ae522f08b7191fdb17f035da577b453fa2518/fiskal_hr-0.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88b08b70516ada39e1e8f2019a9a3081cd0dba03f4f80d872b41e8b682a510e9",
                "md5": "63486b9c0068d20a203271a5bc51a8fb",
                "sha256": "0634d40fb03500ab3b70541e4cd68a7ea58b9ce21c2597ef89c6c59a29208eaa"
            },
            "downloads": -1,
            "filename": "fiskal-hr-0.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "63486b9c0068d20a203271a5bc51a8fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 16853,
            "upload_time": "2023-01-14T05:36:09",
            "upload_time_iso_8601": "2023-01-14T05:36:09.411351Z",
            "url": "https://files.pythonhosted.org/packages/88/b0/8b70516ada39e1e8f2019a9a3081cd0dba03f4f80d872b41e8b682a510e9/fiskal-hr-0.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-14 05:36:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "fiskal-hr"
}
        
Elapsed time: 0.03155s