Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Helper class for fiscalization in Croatia

Project description

FiscalHr for Python

FiscalHr is Python helper class for fiscalization in Croatia.

Installation

pip install --process-dependency-links FiscalHr

or

pip install https://github.com/vingd/libxml2-python/archive/libxml2-python-2.7.8.zip
pip install FiscalHr

Certificate conversion

Example for openssl:

umask 0077
openssl pkcs12 -in "FISKAL 1.P12" -out fiskal-1.pem

Example Usage

Send receipt

from fiscalhr.fiscal import Fiscal

fis = Fiscal('fiskal-1.pem', 'fiskal-1.pem', key_passphrase='some secret')

now = fis.localtime_now()

racun = fis.create('Racun')
racun.Oib = '01234567890'
racun.USustPdv = True
racun.DatVrijeme = fis.format_time(now)
racun.OznSlijed = 'P'
racun.BrRac.BrOznRac = 7
racun.BrRac.OznPosPr = 'PP-1'
racun.BrRac.OznNapUr = 'NAP-4'

porez = fis.create('Porez')
porez.Stopa = fis.format_decimal(25)
porez.Osnovica = fis.format_decimal(100)
porez.Iznos = fis.format_decimal(25)

racun.Pdv.Porez.append(porez)

racun.IznosUkupno = fis.format_decimal(125)
racun.NacinPlac = 'K'
racun.OibOper = '01234567890'
racun.NakDost = False

racun.ZastKod = fis.generate_zki(racun)

print racun.ZastKod

response = fis.send('racuni', racun)

print response

Register business premises

Example for registering internet shop, with no pass phrase on SSL key and test mode enabled:

from datetime import datetime
from fiscalhr.fiscal import Fiscal

fis = Fiscal('fiscal-key.pem', 'fiscal-cert.pem', test=True)

pp = fis.create('PoslovniProstor')
pp.Oib = '01234567890'
pp.OznPoslProstora = '1'
pp.RadnoVrijeme = 'non-stop'
pp.DatumPocetkaPrimjene = fis.format_time(datetime(2013, 7, 1), 'Datum')

adresa = fis.create('OstaliTipoviPP')
adresa = "Internet trgovina"

pp.AdresniPodatak.OstaliTipoviPP = adresa

response = fis.send('poslovniProstor', pp, nosend=False)

print response

Project details


Release history Release notifications

This version
History Node

0.2.10

History Node

0.2.9

History Node

0.2.8

History Node

0.2.7

History Node

0.2.6

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
FiscalHr-0.2.10.tar.gz (25.9 kB) Copy SHA256 hash SHA256 Source None Dec 7, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page