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
5 changes: 3 additions & 2 deletions pytr/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,9 @@ def from_dict(cls, event_dict: Dict[Any, Any]):
if event_type is None and uebersicht_dict:
for item in uebersicht_dict.get("data", []):
ititle = item.get("title")
if ititle == "Kartenzahlung":
event_type = PPEventType.REMOVAL
if ititle in ["Kartenzahlung", "Zahlung"]:
if event_type is None:
event_type = PPEventType.REMOVAL
elif ititle in ["Überweisung", "Kartenerstattung", "Überweisen"]:
if sections:
for item in sections:
Expand Down
85 changes: 85 additions & 0 deletions tests/events/card_purchase_no_eventType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"id": "a23a9d75-c017-518e-91f6-608c0ff39041",
"timestamp": "2024-11-22T09:09:09.123+0000",
"title": "Trade Republic Card",
"icon": "logos/bank_traderepublic/v2",
"avatar": {
"asset": "logos/bank_traderepublic/v2",
"badge": null
},
"badge": null,
"subtitle": null,
"amount": {
"currency": "EUR",
"value": -5.0,
"fractionDigits": 2
},
"subAmount": null,
"status": "EXECUTED",
"action": {
"type": "timelineDetail",
"payload": "a23a9d75-c017-518e-91f6-608c0ff39041"
},
"cashAccountNumber": "123456789",
"hidden": false,
"deleted": false,
"source": "timelineTransaction",
"details": {
"id": "a23a9d75-c017-518e-91f6-608c0ff39041",
"sections": [
{
"title": "Du hast -5,00 € ausgegeben",
"data": {
"icon": {
"asset": "logos/bank_traderepublic/v2",
"badge": null
},
"timestamp": "2024-11-22T09:09:09.123Z",
"status": "executed"
},
"type": "header"
},
{
"title": "Übersicht",
"data": [
{
"title": "Status",
"detail": {
"text": "Completed",
"functionalStyle": "EXECUTED",
"type": "status"
},
"style": "plain"
},
{
"title": "Zahlung",
"detail": {
"text": "Cash",
"icon": "logos/bank_traderepublic/v2",
"type": "iconWithText"
},
"style": "plain"
}
],
"type": "table"
},
{
"title": "Dokumente",
"data": [
{
"title": "Bestellung Trade Republic Karte",
"detail": "22.11.2024",
"action": {
"payload": "https://example.com/timeline/postbox/2024/11/22/pb1732266550110904938819726779.pdf",
"type": "browserModal"
},
"id": "bb3304f2-ab96-53e1-93d4-8aa6e2e55561",
"postboxType": "CARD_BILLING_INVOICE",
"local_filepath": "/home/max/Documents/admin/traderepublic/maxim/202601/Bestellung Trade Republic Karte/2024-11-22 09:09 Bestellung Trade Republic Karte - Trade Republic Card - None.pdf"
}
],
"type": "documents"
}
]
}
}
14 changes: 14 additions & 0 deletions tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,20 @@
}
],
},
{
"filename": "card_purchase_no_eventType.json",
"event_type": PPEventType.REMOVAL,
"title": "Trade Republic Card",
"value": -5.0,
"transactions": [
{
"Datum": "2024-11-22T09:09:09",
"Typ": "Entnahme",
"Wert": -5.0,
"Notiz": "Trade Republic Card",
}
],
},
{
"filename": "interest_payout_created.json",
"event_type": PPEventType.INTEREST,
Expand Down