public-transport / db-tickets

A library to retrieve ticket information from Deutsche Bahn
12 stars 2 forks source link

add support for passes/subscriptions (e.g. Deutschlandticket) #3

Open scrolli opened 1 year ago

scrolli commented 1 year ago

Nice lib, but for me it seems that it is not working for ABO and D-Ticket. Do someone know about this?

<rperror version="1.0">
    <rpheader tnr="61743782011" ts="2023-06-09T10:17:58" />
    <error nr="99999" sev="error">
        <txt>Interner Fehler</txt>
    </error>
</rperror>
derhuerst commented 1 year ago

What is ABO? I assume D-Ticket is Deutschlandticket?

scrolli commented 1 year ago

Hi,

ABO means subscription, it means it renews every months, you only get the qr-code and ticket for each month. Deutschlandticket is also a subscription.

Deutsch: Abo heißt es erneuert sich jeden Monat. Das Deutschland-Ticket kommt auch als Abo. Gerne kann ich dir mal meine alte Ticketnummer geben.

LG Michael @.***

Am 12.06.2023 um 18:25 schrieb Jannis R @.***>:

What is ABO? I assume D-Ticket is Deutschlandticket https://en.wikipedia.org/wiki/Deutschlandticket?

— Reply to this email directly, view it on GitHub https://github.com/public-transport/db-tickets/issues/3#issuecomment-1587663990, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARI3B3LS3E5KT7W5ZCLFQKDXK47GHANCNFSM6AAAAAAZAKG5OA. You are receiving this because you authored the thread.

derhuerst commented 1 year ago

Okay, now I understand what this is about.

A Pull Request for this, or even just technical details on how to fetch such tickets from the DB API, is very welcome!

envake commented 1 year ago

Nice lib, but for me it seems that it is not working for ABO and D-Ticket. Do someone know about this?

It only works for tickets with an actual route linked to it. It cannot return a route for time passes such as the Deutschlandticket because they do not include route information.

derhuerst commented 1 year ago

@envake Do you know if this is a limitation of the DB API (or all available APIs, for that matter)? Or is it that db-tickets merely doesn't implement the respective calls/flags?

envake commented 1 year ago

Has nothing to do with any API. If you buy a Deutschlandticket, how should the DB know which trains you gonna use 🙂

derhuerst commented 1 year ago

The goal of db-tickets is to fetch information about tickets that users bought, potentially including subscription passes. Why would a ticket need to have an associated route to be within scope of this library?

In case of such a subscription pass, the journey field would have to be null, sure.

arnebr commented 1 year ago

I don´t have a D-Ticket or other subscription in DB Navigator. But in my understanding the Abo Section uses the Motics or similar crypto for generating a device specific "identifier". Therefore its is not part of the normal "backend" service and could not be fetched through it

arnebr commented 1 year ago

NRW made some documents regarding this topic public available: https://www.kcd-nrw.de/service/downloads/technische-dokumente.html

arnebr commented 1 year ago

So verified by trying with a friends abo. Did not work due to account linking

image

image

envake commented 1 year ago

The goal of db-tickets is to fetch information about tickets that users bought, potentially including subscription passes. Why would a ticket need to have an associated route to be within scope of this library?

In case of such a subscription pass, the journey field would have to be null, sure.

@derhuerst Sorry, I only thought of the journey because thats why I built this in the first place. You're right, the library could also provide information for every other ticket. Unfortunately I cant say anything about this. 🙁

Thank you @arnebr for investigating 👍🏻

arnebr commented 1 year ago

No problem! The journey will also not work on ÖPNV Tickets since that is embedded in another format but that is an issue for another ticket.

Some of the tariff associations work with different local ticket payloads...

arnebr commented 1 year ago

@envake maybe close the issue since we will not be able to resolve

derhuerst commented 1 year ago

Why won't we? Maybe there is an API that provides this data?

arnebr commented 1 year ago

Then we just reopen the issue 🙃

erebion commented 9 months ago

What exactly is the part that causes the headaches? I don't quite understand.

Couldn't we sniff network traffic for DB Navigator and see what it does and then do the same?

erebion commented 9 months ago

If there is a simple way to sniff the traffic, I might even book that ticket and see what I can get. :D

arnebr commented 9 months ago

The ticket is cryptographically bound to the devices it has been "bought". The ticket would need to be rebound to the library, which would need the crypt logic. Find more information here: https://www.eticket-deutschland.de/motics

erebion commented 9 months ago

Yeah, so we need the ID/keys/whatever for the paired device to do the same computations and get the same aztec code.