Skip to content

Include Gift event in transaction #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NiklasRosenstein opened this issue Feb 11, 2025 · 0 comments · May be fixed by #184
Open

Include Gift event in transaction #183

NiklasRosenstein opened this issue Feb 11, 2025 · 0 comments · May be fixed by #184
Labels
enhancement New feature or request

Comments

@NiklasRosenstein
Copy link
Collaborator

NiklasRosenstein commented Feb 11, 2025

End of last year, TR introduced a feature to send gifts (e.g. some amount of stock) via email to be accepted by the recipient into their TR portfolio. This event is currently being ignored due to #161 (instead of causing an error), but it also means the event remains entirely unprocessed.

From what I can tell, there is no document related to the particular gifting event. (There are events for accepting the Terms & Conditions related to gifting, which are separate and already handled)

However, this is still a transaction that is missing from pytr export_transactions. This is because the event is not saved into the all_events.json which is used as input to the command.

Research notes

#161 skips the timelineDetailV2 for which there is not corresponding timeline event.

pytr/pytr/timeline.py

Lines 128 to 130 in f830c55

event = self.timeline_events.get(response["id"], None)
if event is None:
raise UnsupportedEventError(response["id"])

However, it appears there is a corresponding timeline event, only the mapping we currently do based on the id does not match (at least in my case).

(Pdb) [ev for k, ev in self.timeline_events.items() if "Geschenk" in str(ev)]
[
    {
        "id": "316dbb9c-c94b-44f8-b3ea-3a90d27021b5",
        "timestamp": "2024-12-14T17:55:19.707+0000",
        "title": "ETF-Geschenk",
        "icon": "logos/contacts-B-Orange/v2",
        "badge": None,
        "subtitle": "Angenommen",
        "amount": {
            "currency": "EUR",
            "value": -26.0,
            "fractionDigits": 2
        },
        "subAmount": None,
        "status": "EXECUTED",
        "action": {
            "type": "timelineDetail",
            "payload": "316dbb9c-c94b-44f8-b3ea-3a90d27021b5"
        },
        "eventType": "GIFTER_TRANSACTION",
        "cashAccountNumber": None,
        "hidden": False,
        "deleted": False,
        "source": "timelineTransaction"
    }
]
Corresponding timelineDetailV2
{
    "id": "882bb1e7-8a14-42a3-b026-42a1d61d699a",
    "sections": [
        {
            "title": "Du hast 25,00\xa0€ geschenkt",
            "data": {
                "icon": "logos/contacts-B-Orange/v2",
                "timestamp": "2024-12-14T17:55:19.707+0000",
                "status": "executed"
            },
            "type": "header"
        },
        {
            "title": "Übersicht",
            "data": [
                {
                    "title": "Status",
                    "detail": {
                        "text": "Angenommen",
                        "functionalStyle": "EXECUTED",
                        "type": "status"
                    },
                    "style": "plain"
                },
                {
                    "title": "Asset",
                    "detail": {
                        "text": "FTSE All-World USD (Acc)",
                        "type": "text"
                    },
                    "style": "plain"
                },
                {
                    "title": "Lieferdatum",
                    "detail": {
                        "text": "14 Dec",
                        "type": "text"
                    },
                    "style": "plain"
                }
            ],
            "type": "table"
        },
        {
            "title": "Status",
            "steps": [
                {
                    "leading": {
                        "avatar": {
                            "status": "completed",
                            "type": "bullet"
                        },
                        "connection": {
                            "order": "first"
                        }
                    },
                    "content": {
                        "title": "Geschenk geliefert",
                        "timestamp": "2024-12-14T17:55:19.799+0000"
                    }
                },
                {
                    "leading": {
                        "avatar": {
                            "status": "completed",
                            "type": "bullet"
                        },
                        "connection": {
                            "order": "last"
                        }
                    },
                    "content": {
                        "title": "Geschenk angenommen",
                        "timestamp": "2024-12-14T18:18:38.235+0000"
                    }
                }
            ],
            "type": "steps"
        },
        {
            "title": "Transaktion",
            "data": [
                {
                    "title": "Geschenkbetrag",
                    "detail": {
                        "text": "25,00\xa0€",
                        "type": "text"
                    },
                    "style": "plain"
                },
                {
                    "title": "Gebühr",
                    "detail": {
                        "text": "1,00\xa0€",
                        "type": "text"
                    },
                    "style": "plain"
                },
                {
                    "title": "Summe",
                    "detail": {
                        "text": "26,00\xa0€",
                        "type": "text"
                    },
                    "style": "highlighted"
                }
            ],
            "type": "table"
        },
        {
            "title": "Empfänger",
            "data": [
                {
                    "title": "REDACTED",
                    "detail": {
                        "icon": "logos/contacts-B-Orange/v2",
                        "style": "highlighted",
                        "type": "listItemAvatarDefault"
                    },
                    "style": "highlighted"
                }
            ],
            "type": "table"
        },
        {
            "title": "Mehr",
            "data": [
                {
                    "title": "Brauchst du Hilfe?",
                    "detail": {
                        "icon": "logos/timeline_document/v2",
                        "action": {
                            "type": "deeplink",
                            "payload": {
                                "link": "traderepublic://help-center/node/016e1408-0073-4d01-928b-47db6993eb16?singleOnTop=false"
                            }
                        },
                        "style": "highlighted",
                        "type": "listItemAvatarDefault"
                    },
                    "style": "plain"
                }
            ],
            "type": "table"
        },
        {
            "title": "",
            "data": [
                {
                    "title": "",
                    "detail": {
                        "icon": "",
                        "action": {
                            "type": "customerSupportChat",
                            "payload": {
                                "contextParams": {
                                    "chat_flow_key": "NHC_0035_gifting_sent_a_gift",
                                    "timelineEventId": "316dbb9c-c94b-44f8-b3ea-3a90d27021b5",
                                    "giftId": "ffc93cd1-53ab-4492-881c-e27dcb8d9b38"
                                },
                                "contextCategory": "NHC"
                            }
                        },
                        "style": "highlighted",
                        "type": "listItemAvatarDefault"
                    },
                    "style": "plain"
                }
            ],
            "type": "table"
        }
    ]
}

Note how here the id of the detail and the timeline event do not match. Deeper in the detail, in the help section's payload.contextParams we can find the corresponding timelineEventId.

                                "contextParams": {
                                    "chat_flow_key": "NHC_0035_gifting_sent_a_gift",
                                    "timelineEventId": "316dbb9c-c94b-44f8-b3ea-3a90d27021b5",
                                    "giftId": "ffc93cd1-53ab-4492-881c-e27dcb8d9b38"
                                },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant