fix(picker): Meta-Zahlungsbelege als portal statt ignore

Meta-Belege enthalten keine PDF ("Das ist keine Rechnung"), Rechnung nur im Billing Hub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wd9aeH8MKgesfbsaS3kpnx
This commit is contained in:
Markus Kruse 2026-11-14 23:00:38 +01:00
parent aef8395e0b
commit 4ae79bf4c6
2 changed files with 2 additions and 1 deletions

View file

@ -73,7 +73,7 @@ TRACKERS = re.compile(r"^https?://[\w-]+\.email\.openai\.com/", re.I)
INVOICE_ANCHOR = re.compile(r'<a\b[^>]*href="([^"]+)"[^>]*>(?:(?!</a>).){0,300}?(?:invoice|rechnung|receipt)', re.I | re.S) INVOICE_ANCHOR = re.compile(r'<a\b[^>]*href="([^"]+)"[^>]*>(?:(?!</a>).){0,300}?(?:invoice|rechnung|receipt)', re.I | re.S)
PORTAL_HINT = re.compile( PORTAL_HINT = re.compile(
r"in ihrem (kunden)?(konto|portal)|im (kunden)?portal|your account|sign in|log ?in|anmelden|einloggen|" r"in ihrem (kunden)?(konto|portal)|im (kunden)?portal|your account|sign in|log ?in|anmelden|einloggen|"
r"view (your )?(invoice|receipt|bill)|rechnung (ist )?(verfügbar|bereit)|invoice is available|zahlungsbeleg", r"view (your )?(invoice|receipt|bill)|rechnung (ist )?(verfügbar|bereit)|invoice is available|zahlungsbeleg|das ist keine rechnung", # Meta: Beleg ohne PDF, Rechnung nur im Billing Hub
re.I, re.I,
) )

View file

@ -18,6 +18,7 @@ def test_classify():
aws = "Content-Type: text/plain\n\nYour bill: https://console.aws.amazon.com/billing/home#/bills" aws = "Content-Type: text/plain\n\nYour bill: https://console.aws.amazon.com/billing/home#/bills"
assert classify_mail(_m(aws)) == ("portal", None) assert classify_mail(_m(aws)) == ("portal", None)
assert classify_mail(_m("Content-Type: text/plain\n\nIhr Zahlungsbeleg liegt bereit."))[0] == "portal" assert classify_mail(_m("Content-Type: text/plain\n\nIhr Zahlungsbeleg liegt bereit."))[0] == "portal"
assert classify_mail(_m("Content-Type: text/html\n\n<p>Das ist keine Rechnung</p> Transaktions-ID 1"))[0] == "portal" # Meta
# http (kein TLS) wird nie direkt geladen # http (kein TLS) wird nie direkt geladen
assert classify_mail(_m("Content-Type: text/plain\n\nRechnung http://x.example/r.pdf"))[0] == "portal" assert classify_mail(_m("Content-Type: text/plain\n\nRechnung http://x.example/r.pdf"))[0] == "portal"
# HTML-Entities im Link werden aufgelöst # HTML-Entities im Link werden aufgelöst