Skip to content
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

Db tickets without ticket url #310

Merged

Conversation

PaulSut
Copy link
Contributor

@PaulSut PaulSut commented Dec 26, 2023

This PR enables to get the db fares (Super Sparpreis, Flexpreis...) with refreshJourney(tickets:true).

tickets for journeys() or refreshJourney(tickets:false) look like:


[
  {
    "name": "To offer selection",
    "priceObj": {
      "amount": 6990
    }
  }
]

and for refreshJourney(tickets:true):

[
  {
    "name": "Super Sparpreis",
    "priceObj": {
      "amount": 6990,
      "currency": "EUR"
    },
    "addData": "eyJEaXIiOiJPVVRXQVJEIiwiUHJjTSI6IjAiLCJnIjoiTk8iLCJBdmFpbCI6IjEiLCJGRlByYWVtaWUiOiJOTyIsIk5wR2VzdCI6Ik5PIiwiTXdzdENvZGUiOiIwIiwiTm9uQXZSIjoiMCIsIlJlc1N0YXR1c0hpbiI6Ik8iLCJSZXNTdGF0dXNSdWVjayI6IlUiLCJSZXNJY29uSGluIjoiTk8iLCJSZXNJY29uUnVlY2siOiJOTyIsIlByaWNlIjoiNjk5MCIsIm9mZmVyVHlwZSI6IlNUQU5EQVJEIiwic2hwQ3R4IjoiUEZSaGNtbG1aaUJVWVhKcFptWkpSRDBpVkVOTEl6RTRNekFqTVRnek5pTXdJekFqVXpJak5qazVNQ01pSUZCQmNuUkVjbWwwZEdVOUluVnVhMjV2ZDI0aUx6ND1cclxuIiwidGFyZ2V0Q3R4IjoiRCJ9\r\n",
    "addDataTicketInfo": "eyJEaXIiOiJPVVRXQVJEIiwiUHJjTSI6IjAiLCJnIjoiTk8iLCJBdmFpbCI6IjEiLCJGRlByYWVtaWUiOiJOTyIsIk5wR2VzdCI6Ik5PIiwiTXdzdENvZGUiOiIwIiwiTm9uQXZSIjoiMCIsIlJlc1N0YXR1c0hpbiI6Ik8iLCJSZXNTdGF0dXNSdWVjayI6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},
  {
    "name": "Sparpreis",
    "priceObj": {
      "amount": 7890,
      "currency": "EUR"
    },
    "addData": "eyJEaXIiOiJPVVRXQVJEIiwiUHJjTSI6IjAiLCJnIjoiTk8iLCJBdmFpbCI6IjEiLCJGRlByYWVtaWUiOiJOTyIsIk5wR2VzdCI6Ik5PIiwiTXdzdENvZGUiOiIwIiwiTm9uQXZSIjoiMCIsIlJlc1N0YXR1c0hpbiI6Ik8iLCJSZXNTdGF0dXNSdWVjayI6IlUiLCJSZXNJY29uSGluIjoiTk8iLCJSZXNJY29uUnVlY2siOiJOTyIsIlByaWNlIjoiNjk5MCIsIm9mZmVyVHlwZSI6IlNUQU5EQVJEIiwic2hwQ3R4IjoiUEZSaGNtbG1aaUJVWVhKcFptWkpSRDBpVkVOTEl6RTRNekFqTVRnek5pTXdJekFqVXpJak5qazVNQ01pSUZCQmNuUkVjbWwwZEdVOUluVnVhMjV2ZDI0aUx6ND1cclxuIiwidGFyZ2V0Q3R4IjoiRCJ9\r\n",
    "addDataTicketInfo": "eyJEaXIiOiJPVVRXQVJEIiwiUHJjTSI6IjAiLCJnIjoiTk8iLCJBdmFpbCI6IjEiLCJGRlByYWVtaWUiOiJOTyIsIk5wR2VzdCI6Ik5PIiwiTXdzdENvZGUiOiIwIiwiTm9uQXZSIjoiMCIsIlJlc1N0YXR1c0hpbiI6Ik8iLCJSZXNTdGF0dXNSdWVjayI6IlUiLCJSZXNJY29uSGluIjoiTk8iLCJSZXNJY29uUnVlY2siOiJOTyIsIlByaWNlIjoiNzg5MCIsIm9mZmVyVHlwZSI6IlNUQU5EQVJEIiwic2hwQ3R4IjoiUEZSaGNtbG1aaUJVWVhKcFptWkpSRDBpVkVOTEl6WXpNQ00yTXpZak1DTXdJMU15SXpjNE9UQWpJaUJRUVhKMFJISnBkSFJsUFNKMWJtdHViM2R1SWk4K1xyXG4iLCJ0YXJnZXRDdHgiOiJEIn0=\r\n",
    "addDataTicketDetails": "eyJBbmdUeXAiOiJzcGFyUCIsIkl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3JlIDFzdCBkYXkgb2YgdmFsaWRpdHkgc3ViamVjdCB0byBhIGZlZSBpbiBleGNoYW5nZSBmb3Igdm91Y2hlciIsIlVlVHh0X2xhbmciOiJZb3UgY2FuIGNhbmNlbCAoZXhjaGFuZ2Ugb3IgcmVmdW5kKSB5b3VyIHRpY2tldCBiZWZvcmUgdGhlIGZpcnN0IGRheSBvZiB2YWxpZGl0eSBmb3IgYSBmZWUgb2YgMTAsMDAgRVVSIGluIGV4Y2hhbmdlIGZvciBhIHZvdWNoZXIuIFRoZXJlYWZ0ZXIsIGNhbmNlbGxhdGlvbnMgYXJlIGV4Y2x1ZGVkLiIsIlVlVHh0X2ljb24iOiIyMDEiLCJPcHRUeHRfa3Vyei4wIjoiTm8gQ2l0eS1UaWNrZXQiLCJPcHRUeHRfbGFuZy4wIjoiWW91ciB0aWNrZXQgZG9lcyBub3QgaW5jbHVkZSBhIENpdHktVGlja2V0IChsb2NhbCBwdWJsaWMgdHJhbnNwb3J0IHRpY2tldCkuIiwiT3B0VHh0X2ljb24uMCI6IjIwMiIsIk9wdFR4dF9rZXkuMCI6Im9obmVfY2l0eSIsIlBBVHlwIjoiQVAiLCJQQXJ0RHB0IjoiNjMwIiwiUmVzSWNvbiI6Ik5PIiwiUmVzU3RhdHVzIjoiTyIsIlRhcmlmU3lzdGVtSWQiOiJEQiIsIlp1Z2VvcmRuZXRadVNwZXppYWxhYmxhdWYiOiJOTyIsIlp1c2F0em51dHplbiI6Ik5PIn0=\r\n",
    "addDataTravelInfo": "eyJkaXIiOiJPVVRXQVJEIiwidHlwZSI6IlRJQ0tFVCIsIkZyb21UZXh0IjoiQmVybGluIEhiZiIsIlRvVGV4dCI6Ik3DvG5jaGVuIEhiZiIsIkZyb21FdmEiOiI4MDk4MTYwIiwiVG9FdmEiOiI4MDAwMjYxIn0=\r\n",
    "firstClass": false
  },
  {
    "name": "Super Sparpreis",
    "priceObj": {
      "amount": 8390,
      "currency": "EUR"
    },
    "addData": "eyJEaXIiOi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ciByZWZ1bmQpIG9mIHlvdXIgdGlja2V0IGlzIGV4Y2x1ZGVkLiIsIlVlVHh0X2ljb24iOiIyMDIiLCJPcHRUeHRfa3Vyei4wIjoiTm8gQ2l0eS1UaWNrZXQiLCJPcHRUeHRfbGFuZy4wIjoiWW91ciB0aWNrZXQgZG9lcyBub3QgaW5jbHVkZSBhIENpdHktVGlja2V0IChsb2NhbCBwdWJsaWMgdHJhbnNwb3J0IHRpY2tldCkuIiwiT3B0VHh0X2ljb24uMCI6IjIwMiIsIk9wdFR4dF9rZXkuMCI6Im9obmVfY2l0eSIsIk9wdFR4dF9rdXJ6LjEiOiJObyBhY2Nlc3MgdG8gREIgTG91bmdlIiwiT3B0VHh0X2xhbmcuMSI6IllvdXIgdGlja2V0IGRvZXMgbm90IGVudGl0bGUgeW91IHRvIHVzZSB0aGUgREIgTG91bmdlLiIsIk9wdFR4dF9pY29uLjEiOiIyMDIiLCJPcHRUeHRfa2V5LjEiOiJub19sb3VuZ2UiLCJQQVR5cCI6IkFQIiwiUEFydERwdCI6IjE4MzAiLCJSZXNJY29uIjoiTk8iLCJSZXNTdGF0dXMiOiJPIiwiVGFyaWZTeXN0ZW1JZCI6IkRCIiwiWnVnZW9yZG5ldFp1U3BlemlhbGFibGF1ZiI6Ik5PIiwiWnVzYXR6bnV0emVuIjoiTk8ifQ==\r\n",
    "addDataTravelInfo": "eyJkaXIiOiJPVVRXQVJEIiwidHlwZSI6IlRJQ0tFVCIsIkZyb21UZXh0IjoiQmVybGluIEhiZiIsIlRvVGV4dCI6Ik3DvG5jaGVuIEhiZiIsIkZyb21FdmEiOiI4MDk4MTYwIiwiVG9FdmEiOiI4MDAwMjYxIn0=\r\n",
    "firstClass": true
  },
  {
    "name": "Flexpreis",
    "priceObj": {
      "amount": 15630,
      "currency": "EUR"
    },
    "addData": "eyJEaXIiOiJPVVRXQVJEIiwiUHJjTSI6IjAiLCJnIjoiTk8iLCJBdmFpbCI6IjEiLCJGRlByYWVtaWUiOiJOTy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oiTk8iLCJSZXNTdGF0dXMiOiJPIiwiVGFyaWZTeXN0ZW1JZCI6IkRCIiwiWnVnZW9yZG5ldFp1U3BlemlhbGFibGF1ZiI6Ik5PIiwiWnVzYXR6bnV0emVuIjoiTk8ifQ==\r\n",
    "addDataTravelInfo": "eyJkaXIiOiJPVVRXQVJEIiwidHlwZSI6IlRJQ0tFVCIsIkZyb21DaXR5IjoiQmVybGluIEhiZiIsIlRvQ2l0eSI6Ik3DvG5jaGVuIEhiZiIsIkZyb21UZXh0IjoiQmVybGluIEhiZiIsIlRvVGV4dCI6Ik3DvG5jaGVuIEhiZiIsIkZyb21FdmEiOiI4MDk4MTYwIiwiVG9FdmEiOiI4MDAwMjYxIn0=\r\n",
    "firstClass": false
  }
]

fixes #296
fixes #311

@PaulSut PaulSut force-pushed the db-tickets-without-ticket-url branch from e79f9e5 to f6a7e09 Compare December 27, 2023 07:35
@PaulSut PaulSut mentioned this pull request Dec 27, 2023
@PaulSut PaulSut marked this pull request as draft December 28, 2023 09:41
p/db/index.js Show resolved Hide resolved
p/db/index.js Outdated Show resolved Hide resolved
p/db/index.js Outdated Show resolved Hide resolved
p/db/index.js Outdated
jnyCl: opt.firstClass === true ? 1 : 2,
// todo [breaking]: support multiple travelers
tvlrProf: [{
type: tvlrAgeGroup || ageGroup.ADULT,
...(('age' in opt) ? {age: opt.age} : {}),
redtnCard: opt.loyaltyCard
? formatLoyaltyCard(opt.loyaltyCard)
? (typeof opt.loyaltyCard === 'number' && Number.isInteger(opt.loyaltyCard)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change enable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change allows also the usage of already formattedLoyalty cards like the following:

data = await client.refreshJourney(journey.refreshToken, { stopovers: true, remarks: true, tickets: true, age: 42, loyaltyCard: 4, })

Without it the loyaltyCard would have no effect and would be mapped to 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this change and added reverseFormatLoyaltyCard instead.

I guess this is a cleaner approach.
Usage would look like:

import {reverseFormatLoyaltyCard} from './loyalty-cards.js'
...

data = await client.refreshJourney(journey.refreshToken, {
	stopovers: true,
	remarks: true,
	tickets: true,
	generateUnreliableTicketUrls: true,
	age: 42,
	loyaltyCard: reverseFormatLoyaltyCard(4),
})

or

import {data as loyaltyCards} from './loyalty-cards.js'
...

data = await client.refreshJourney(journey.refreshToken, {
	stopovers: true,
	remarks: true,
	tickets: true,
	generateUnreliableTicketUrls: true,
	age: 42,
	loyaltyCard: {type: loyaltyCards.BAHNCARD, discount: 50},
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious: What's the use case for passing in an already formatted (a.k.a. encoded, already in the proprietary DB-HAFAS-specific representation) loyalty card identifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using the hafas-client behind another api. From this I just receive the formatted identifier which I will then forward to the hafas-client.
Feel free to remove this mapping if you think its bloating up the codebase :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having in hafas-client makes sense, given that it is quite DB- and HAFAS-specific compared to most consuming code. However, I try to have all code in the repo to be used at runtime, tested automatically, or both.

Will add some small assertions.

p/db/index.js Outdated Show resolved Hide resolved
@derhuerst derhuerst marked this pull request as ready for review January 31, 2024 11:21

const queryParams = new URLSearchParams();

// Add individual parameters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for future investigations: This is closely related to, but not the same as, https://github.com/derhuerst/generate-db-shop-urls/blob/e9f5d4385eb5985d52f244921bb7562efc3d7d64/index.js#L99-L136.

p/db/index.js Outdated Show resolved Hide resolved
p/db/index.js Outdated Show resolved Hide resolved
test/e2e/db.js Outdated Show resolved Hide resolved
test/e2e/db.js Outdated
test.equal(typeof fare.name, 'string');
test.ok(fare.name);
} else {
test.fail('Mandatory field "name" is missing');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is covered by the test.equal(typeof fare.name, 'string') assertion above. Add an assertion message above, it will imply that the field is mandatory.

Same below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@derhuerst I adjusted the tests

test/e2e/db.js Outdated Show resolved Hide resolved
@PaulSut PaulSut force-pushed the db-tickets-without-ticket-url branch from 0062ce1 to 2fb2e32 Compare February 11, 2024 14:03
Copy link
Member

@derhuerst derhuerst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one tiny problem left to fix! (Will do that by myself.)

test/e2e/db.js Outdated
test.equal(typeof fare.name, 'string', 'Mandatory field "name" is missing or not a string');
test.ok(fare.name);

test.equal(typeof fare.priceObj, 'object', 'Mandatory field "priceObj" is missing or not an object');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fare.priceObj might theoretically be null. You could use the following:

test.ok(isObj(fare.priceObj), 'Mandatory field "priceObj" is missing or not an object');

@derhuerst derhuerst self-assigned this Feb 18, 2024
@derhuerst
Copy link
Member

derhuerst commented Feb 18, 2024

I will rebase & squash your commits, and then merge the changes. I might need some days for this.

@derhuerst derhuerst force-pushed the db-tickets-without-ticket-url branch from 5b42626 to d3bc9d3 Compare March 12, 2024 00:20
@derhuerst derhuerst merged commit d3bc9d3 into public-transport:main Mar 12, 2024
6 of 9 checks passed
@derhuerst
Copy link
Member

Thanks a lot, also for your patience!

Do you want to be mentioned in contributors in package.json? If you do, how? As Paul Sutter <[email protected]>?

@derhuerst
Copy link
Member

Published as [email protected]. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

refreshJourney never fills price DB: get URL to offers
2 participants