sestra
This commit is contained in:
52
qrcodeplatba.py
Normal file
52
qrcodeplatba.py
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Generate QR code for payment to Fio bank account 2800046620/2010.
|
||||
You can change AMOUNT and VARIABLE_SYMBOL as needed.
|
||||
"""
|
||||
|
||||
import qrcode
|
||||
from pathlib import Path
|
||||
from PIL import Image
|
||||
|
||||
# ================================
|
||||
# 💳 CONFIGURATION
|
||||
# ================================
|
||||
# Account in IBAN format (Fio Banka 2800046620 / 2010)
|
||||
IBAN = "CZ9520100000002800046620"
|
||||
|
||||
# Define variables you want to change before each run
|
||||
AMOUNT = 850.00 # 💰 amount in CZK
|
||||
VARIABLE_SYMBOL = "20251105" # 🔢 variabilní symbol
|
||||
MESSAGE = "Platba za službu" # optional note shown in banking app
|
||||
|
||||
# ================================
|
||||
# 🧩 Construct SPD string
|
||||
# ================================
|
||||
spayd = f"SPD*1.0*ACC:{IBAN}*AM:{AMOUNT:.2f}*CC:CZK*X-VS:{VARIABLE_SYMBOL}*MSG:{MESSAGE}"
|
||||
|
||||
# ================================
|
||||
# 🖼 Generate QR code
|
||||
# ================================
|
||||
qr = qrcode.QRCode(
|
||||
version=None,
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_M,
|
||||
box_size=10,
|
||||
border=4,
|
||||
)
|
||||
qr.add_data(spayd)
|
||||
qr.make(fit=True)
|
||||
|
||||
img = qr.make_image(fill_color="black", back_color="white")
|
||||
|
||||
# Save to file
|
||||
out_path = Path(__file__).parent / f"qr_fio_{VARIABLE_SYMBOL}.png"
|
||||
img.save(out_path)
|
||||
|
||||
print("✅ QR code generated successfully!")
|
||||
print(f"SPD payload:\n{spayd}\n")
|
||||
print(f"Saved as: {out_path}")
|
||||
|
||||
# (optional) show image when run interactively
|
||||
img.show()
|
||||
Reference in New Issue
Block a user