feat(tools): whop_pdfs.py liest USD-Betrag und pay-ID aus Whop-Belegen

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Markus Kruse 2026-11-16 21:39:26 +01:00
parent bd2c1eed9a
commit d60627c135

7
tools/whop_pdfs.py Normal file
View file

@ -0,0 +1,7 @@
"""Whop-Belege (outbound, via_api/sent/manual) -> Datum, $-Betrag, pay_-ID aus PDF. Im Backend-Container: python /tmp/whop_pdfs.py"""
import glob, re, fitz
for f in sorted(glob.glob('/data/rechnungen/picker/*/*/*whop*.pdf')):
t=' '.join(' '.join(p.get_text() for p in fitz.open(f)).split())
a=re.findall(r'\$\s?([\d,]+\.\d{2})',t); pid=re.search(r'pay_\w+',t)
d=re.search(r'([A-Z][a-z]{2,8} \d{1,2}, 20\d\d)',t)
print(f.split('/')[-1],'|',d.group(1) if d else '?','|',a[-1] if a else '?','|',pid.group(0) if pid else '?')