public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
263 stars 52 forks source link

refreshJourney never fills price #311

Closed wolfm89 closed 4 months ago

wolfm89 commented 6 months ago

Hi! I am using the hafas-client lib for a while now and been loving it so far.

I am trying to build a price monitoring platform. So I am using journeys() to find specific journeys with the Deutsche Bahn profile. The price is include for all supported journeys. Then I am storing the refresh token and calling refreshJourney() on a schedule for that selected journey. The journey in the response always has price: null included, even if the journey shows a price with journeys().

Any idea why this is happening? Or any suggestion how I can get the current price for a previously queried journey?

derhuerst commented 6 months ago

Coincidentally, @PaulSut recently asked about a very similar (the same?) use case in https://github.com/public-transport/hafas-client/issues/296. Check out https://github.com/public-transport/hafas-client/pull/310 for a potential solution.

PaulSut commented 6 months ago

Yes I think it should solve your issue :) If a price is included in journeys, you will can receive tickets with refreshJourney. Those contain the available tickets and prices (Supersparpreis, Flexpreis, ...) for your query (make sure to provide age, firstClass, loyaltyCard to refreshJourney).