Virtuaaliviivakoodi is a Python library for generating virtual barcodes based on Finanssiala's pankkiviivakoodi spec.
pip install virtuaaliviivakoodi
from virtuaaliviivakoodi import virtuaaliviivakoodi
virtuaaliviivakoodi(
iban="FI49 5000 9420 0287 30",
reference="12345 67907",
due_date=date(2022, 12, 12),
euro_amount=100.20,
)
# > "449500094200287300001002000000000000001234567907201212"
Argument | Type | Description |
---|---|---|
iban |
str |
Mandatory. Payment receiver's IBAN. Must be in Finnish format. E.g.: "FI49 5000 9420 0287 30" or "FI4950009420028730" |
reference |
str int |
Mandatory. Invoice reference in Finnish or international (RF) format. May invluce whitespace characters. E.g. "12345 67907" , "1234567907" , 1234567907 or "RF92 1234 2345" |
due_date |
date |
Mandatory. Invoice due date as a Python date object. |
euro_amount |
float int |
Mandatory. Invoice total amount in Euros. Must be positive number. According the spec amount must be smaller than 1000000. |
Exceptions can be imported the following way:
from virtuaaliviivakoodi.exceptions import (
VirtuaaliviivakoodiException,
InvalidIBANException,
InvalidReferenceException,
InvalidEuroAmountException,
InvalidDueDateException,
)
Exception | Description |
---|---|
VirtuaaliviivakoodiException |
Base exception class for all of the following exceptions. |
InvalidIBANException |
Raised for invalid IBANs |
InvalidReferenceException |
Raised for invalid references |
InvalidEuroAmountException |
Raised for invalid euro amounts |
InvalidDueDateException |
Raised for invalid due dates |