feat(tools): qonto_mails.py; Handoff Referenzpruefung
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wd9aeEUbexZ77ceTdGPFX3
This commit is contained in:
parent
aa3b56a1d9
commit
8bc213f8c8
2 changed files with 27 additions and 0 deletions
|
|
@ -37,3 +37,9 @@
|
|||
- Header-Abgriff per JS im Accountable-Tab wird vom Auto-Mode-Classifier blockiert → nur UI-Klickweg.
|
||||
- Verknüpfungen 16.11. abends (Freigabe Markus: Doppel ohne Beleg löschen): Contabo 24,40 ↔ Rechnung 25,19 (Rest 0,79 Anteil Okt.), Sixt 71,40+18,94 ↔ 90,34, je Bank-Doppel gelöscht. HeyGen 30.10.2025 war schon verknüpft. Whop 04.10. 14,94 € ↔ Whop 15,02 $ (Rest 1,60 €). Whop 22.10. 14,04 €: kein $-Beleg in Accountable → offen.
|
||||
- **Meta offen (nächste Session):** 5 Aufladungen (25.03. 150, 04.04. 100, 09.04. 50, 12.04. 50, 13.05. 50 = 400) = 35 „Meta Platforms Ireland“-Tagesbelege ohne Bank. FIFO kumuliert: 26.03.–04.04. = 150,00; 05.–09.04. = 100,00; 10.–12.04. = 50,00; 13.04.–14.05. ≈ 50 (14.05. 4,73 splitten 1,89/2,84); 16.05.–20.05. + 04.09. 4,98 = 50. Ablauf je Beleg: Ausgabe → „Wie bezahlt?“ → Betrag der Aufladung suchen → wählen → Speichern; danach 5 Facebk-Bankausgaben löschen (freigegeben).
|
||||
- **Prüfung über Qonto-Referenz (16.11. spät, `tools/qonto_mails.py`):** Qonto-Mails „Zahlung durchgeführt“ enthalten USD-Originalbetrag + EUR.
|
||||
- Contabo ok: 24,40 = Vorauszahlung bei Bestellung 302486 (31.10. 21:43); Rechnung 3024850001 = 25,19 inkl. 0,79 Tagesanteil 30.–31.10., „bereits geleistete Zahlungen nicht berücksichtigt“.
|
||||
- Sixt ok: 71,40 (04.03., Ref. DGHF2YL3K) + 18,94 (Endbetrag Vorautorisierung 05.03.) = Rechnung 1001020002297341 90,34.
|
||||
- Whop 04.10. 14,94 € = 16,75 USD → Verknüpfung mit 15,02 $ war falsch, rückgängig gemacht; 15,02 $ = 13,39 € (Bank 05.10.). Diese 13,39-tx ist aber mit 15,06 $ verknüpft (15,06 $ = 13,45 € am 07.10.) → **Whop-Merge vom 15.11. (61 Stück) hat nach ungefährem Betrag verknüpft, systematisch falsch.** Whop 22.10. 14,04 € = 15,74 USD.
|
||||
- Invideo: 22.03. 22,53 € (EUR-Belastung) ↔ Receipt 2826-4702 25 $; 23.03. 100 USD = 87,09 €; 21.04. 50 USD = 42,64 €, 75 USD = 63,96 €; 22.04./22.05. je 225,26 €. Für 28.03. 55,69 und 04.04. 83,07 keine Qonto-Mail.
|
||||
- **TODO:** Whop komplett neu zuordnen: Qonto-Mail (USD exakt) ↔ Whop-Ausgabe ($ exakt) ↔ Bank-tx (EUR exakt), Liste erzeugen, dann UI-Umverknüpfung.
|
||||
|
|
|
|||
21
tools/qonto_mails.py
Normal file
21
tools/qonto_mails.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"""Qonto-Zahlungsmails (Strato) nach Händler durchsuchen, nur lesend: Betrag, Originalwährung, Karte.
|
||||
Aufruf (im Backend-Container, PYTHONPATH=/app): python /tmp/qonto_mails.py <händler> [...]
|
||||
Zweck: Bankbetrag (EUR) über USD-Originalbetrag exakt einem $-Beleg zuordnen (Whop, Invideo, ...).
|
||||
"""import email, email.utils, os, re, html, sys
|
||||
from backend.routers.emails import connect_imap
|
||||
terms=sys.argv[1:]
|
||||
m=connect_imap(os.getenv('IMAP_HOST','imap.strato.de'),993,os.getenv('IMAP_USER'),os.getenv('IMAP_PASSWORD'))
|
||||
def body(msg):
|
||||
for p in msg.walk():
|
||||
if p.get_content_type() in('text/plain','text/html'):
|
||||
t=p.get_payload(decode=True).decode(p.get_content_charset() or 'utf-8','replace')
|
||||
if p.get_content_type()=='text/html': t=html.unescape(re.sub(r'<[^>]+>',' ',re.sub(r'(?s)<(style|script).*?</\1>','',t)))
|
||||
return ' '.join(t.split())
|
||||
return ''
|
||||
for f in ['INBOX','Archive','Archive.2026','Archive.2025']:
|
||||
if m.select(f'"{f}"',readonly=True)[0]!='OK': continue
|
||||
for term in terms:
|
||||
for i in m.search(None,f'FROM "qonto" TEXT "{term}"')[1][0].split():
|
||||
msg=email.message_from_bytes(m.fetch(i,'(BODY.PEEK[])')[1][0][1])
|
||||
b=body(msg); k=b.lower().find(term.lower())
|
||||
print(f,'|',msg['Date'][:22],'|',term,'|',b[max(0,k-200):k+250])
|
||||
Loading…
Add table
Reference in a new issue