Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pytr/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def _parse_card_note(event_dict: Dict[Any, Any]) -> Optional[str]:
Optional[str]: note
"""
eventTypeStr = event_dict.get("eventType", "")
if eventTypeStr.startswith("card_"):
if eventTypeStr is not None and eventTypeStr.startswith("card_"):
return eventTypeStr

sections = event_dict.get("details", {}).get("sections", [{}])
Expand Down
103 changes: 103 additions & 0 deletions tests/kartenzahlung_null_eventType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"id": "39a1ecdf-0c09-5e5f-8e31-ba666f1eefe6",
"timestamp": "2025-10-21T17:30:01.281+0000",
"title": "Coop Pronto",
"icon": "logos/merchant-fallback-groceries/v2",
"avatar": {
"asset": "logos/merchant-fallback-groceries/v2",
"badge": null
},
"badge": null,
"subtitle": null,
"amount": {
"currency": "EUR",
"value": -12.16,
"fractionDigits": 2
},
"subAmount": {
"currency": "CHF",
"value": -11.2,
"fractionDigits": 2
},
"status": "EXECUTED",
"action": {
"type": "timelineDetail",
"payload": "39a1ecdf-0c09-5e5f-8e31-ba666f1eefe6"
},
"eventType": null,
"cashAccountNumber": null,
"hidden": false,
"deleted": false,
"source": "timelineTransaction",
"details": {
"id": "39a1ecdf-0c09-5e5f-8e31-ba666f1eefe6",
"sections": [
{
"title": "Du hast 12,16 € ausgegeben",
"data": {
"icon": "logos/merchant-fallback-groceries/v2",
"timestamp": "2025-10-21T17:30:01.281Z",
"status": "executed"
},
"type": "header"
},
{
"title": "Übersicht",
"data": [
{
"title": "Kartenzahlung",
"detail": {
"text": "Fertig",
"functionalStyle": "EXECUTED",
"type": "status"
},
"style": "plain"
},
{
"title": "Zahlung",
"detail": {
"text": "··5891",
"icon": "logos/bank_traderepublic/v2",
"type": "iconWithText"
},
"style": "plain"
},
{
"title": "Händler",
"detail": {
"text": "Coop Pronto",
"displayValue": {
"text": "Coop Pronto"
},
"type": "text"
},
"style": "plain"
},
{
"title": "Betrag",
"detail": {
"text": "11,20 CHF",
"displayValue": {
"text": "11,20 CHF"
},
"type": "text"
},
"style": "plain"
},
{
"title": "Gesamt",
"detail": {
"text": "12,16 €",
"displayValue": {
"text": "12,16 €"
},
"type": "text"
},
"style": "plain"
}
],
"type": "table"
}
]
}
}
15 changes: 15 additions & 0 deletions tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,21 @@ def test_events():
}
],
},
{
"filename": "kartenzahlung_null_eventType.json",
"event_type": PPEventType.REMOVAL,
"title": "Coop Pronto",
"value": -12.16,
"note": "card_successful_transaction",
"transactions": [
{
"Datum": "2025-10-21T17:30:01",
"Typ": "Entnahme",
"Wert": -12.16,
"Notiz": "Kartentransaktion - Coop Pronto",
}
],
},
{
"filename": "kartenzahlung_no_eventType.json",
"event_type": PPEventType.REMOVAL,
Expand Down