Python library for generating and reading Finnish virtuaaliviivakoodi's
Project description
Finnish virtuaaliviivakoodi generation
Virtuaaliviivakoodi is a Python library for generating and deconstructing virtual barcodes based on Finanssiala's pankkiviivakoodi spec.
Installation
pip install virtuaaliviivakoodi
Usage
Creating a virtual barcode
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"
Deconstructing a virtual barcode
from virtuaaliviivakoodi import deconstruct_virtuaaliviivakoodi
deconstruct = deconstruct_virtuaaliviivakoodi("449500094200287300001002000000000000001234567907201212")
# > deconstruct.symbol = SymbolVersion.VERSION_4,
# deconstruct.iban = FI4950009420028730,
# deconstruct.euro_amount = Decimal('100.20'),
# deconstruct.reference = 1234567907,
# deconstruct.due_date = date(2022, 12, 12),
Function arguments
Creating a virtual barcode
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" |
euro_amount |
float int Decimal |
Mandatory. Invoice total amount in Euros. Must be positive number. According the spec amount must be smaller than 1000000. |
due_date |
date |
Optional. Invoice due date as a Python date object. If left empty, "000000" is used as the date according to the spec |
Deconstructing a virtual barcode
Argument | Type | Description |
---|---|---|
virtuaaliviivakoodi |
str |
Mandatory. Virtuaaliviivakoodi to deconstruct. E.g.: "449500094200287300001002000000000000001234567907201212" |
Exceptions
Exceptions can be imported the following way:
from virtuaaliviivakoodi.exceptions import (
VirtuaaliviivakoodiException,
InvalidIBANException,
InvalidReferenceException,
InvalidEuroAmountException,
InvalidDueDateException,
InvalidSymbolException,
InvalidLengthException
)
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 |
InvalidSymbolException |
Raised for invalid symbol version of the virtuaaliviivakoodi |
InvalidLengthException |
Raised for invalid length of the virtuaaliviivakoodi |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file virtuaaliviivakoodi-1.1.0.tar.gz
.
File metadata
- Download URL: virtuaaliviivakoodi-1.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.4 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 587b295243b9d2eb1430fdb84957b40c45b8bff7abf0d67d573940ae8a6d7492 |
|
MD5 | 0699ac51c298028b3c836b9dd24e29a6 |
|
BLAKE2b-256 | eedf461e956c598343452c1aea1295b4d0fa2c6de07acad116dfe4b8544dae12 |
File details
Details for the file virtuaaliviivakoodi-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: virtuaaliviivakoodi-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.4 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ed9a1e5ea4ab8a0fce4541defca46a9957b27cdeea421e9588f5d3d49906a6 |
|
MD5 | e1b1e753aeae9fab39c1d8b922dcc489 |
|
BLAKE2b-256 | 861115ce54c00191386c5b6049e94e6fb1eca3338d6c492d2c43920ef6232450 |