Initial commit for helios-qr-bank-transfer
This commit is contained in:
commit
30e9407f91
3 changed files with 101 additions and 0 deletions
41
generate_epc_qr.py
Executable file
41
generate_epc_qr.py
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Generate an EPC/GiroCode QR code for SEPA transfers."""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from segno import helpers
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Generate EPC QR code (GiroCode)")
|
||||
parser.add_argument("--name", required=True, help="Recipient name")
|
||||
parser.add_argument("--iban", required=True, help="Recipient IBAN")
|
||||
parser.add_argument("--amount", required=True, type=float, help="Amount in EUR")
|
||||
parser.add_argument("--reason", default="", help="Verwendungszweck / remittance text")
|
||||
parser.add_argument("--output", default="/tmp/epc_qr.png", help="Output file path")
|
||||
parser.add_argument("--scale", type=int, default=10, help="QR code scale factor")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Validate amount
|
||||
if args.amount <= 0 or args.amount > 999999999.99:
|
||||
print("Error: Amount must be between 0.01 and 999999999.99 EUR", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Clean IBAN (remove spaces)
|
||||
iban = args.iban.replace(" ", "")
|
||||
|
||||
qr = helpers.make_epc_qr(
|
||||
name=args.name,
|
||||
iban=iban,
|
||||
amount=args.amount,
|
||||
text=args.reason,
|
||||
encoding='UTF-8'
|
||||
)
|
||||
|
||||
qr.save(args.output, scale=args.scale)
|
||||
print(args.output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue