Compare commits

..

No commits in common. "d15369406dbfd5aa75805a7cef0a54a3efc5749d" and "b59d7b3084e5c09a9b79b3217c272e4c7c1fa137" have entirely different histories.

6 changed files with 4 additions and 69 deletions

View file

@ -95,8 +95,6 @@
"bitmasks",
"Blaschkoallee",
"Blissestr",
"bmis",
"BMIS",
"BNWNZF",
"Böhme",
"BONVOYO",
@ -197,7 +195,6 @@
"Fehrbelliner",
"Fernbf",
"Fernverkehr",
"firmen",
"Flexpreis",
"Flix",
"Fltr",
@ -266,7 +263,6 @@
"Hohenzollerndamm",
"Hüngheim",
"IBNR",
"identifikationsart",
"Ihren",
"Ihrer",
"Informationen",
@ -614,7 +610,6 @@
"Zoologischer",
"Zuege",
"zugart",
"Zugehoerigkeit",
"zugattrib",
"zugattribute",
"Zuges",

View file

@ -81,7 +81,6 @@ With `opt`, you can override the default options, which look like this:
firstClass: false, // first or second class for tickets
loyaltyCard: null, // BahnCards etc., see below
language: 'en', // language to get results in
bmisNumber: null, // 7-digit BMIS number for business customer rates
}
```
@ -317,27 +316,6 @@ hafas.journeys(from, to, {
})
```
## Using the `bmisNumber` option
bahn.business customers with a BMIS number can get their corporate rates and corporate tariffs by providing their 7-digit BMIS number:
```js
// Option 1: Using the bmisNumber parameter directly
await client.journeys(from, to, {
bmisNumber: '1234567' // Your 7-digit BMIS number
})
// Option 2: Using the createBusinessClient helper function
import {createBusinessClient} from 'db-vendo-client'
import {profile as dbProfile} from 'db-vendo-client/p/db/index.js'
const businessClient = createBusinessClient(dbProfile, userAgent, '1234567')
// Now all journey searches will automatically include the BMIS number
await businessClient.journeys(from, to)
```
When a BMIS number is provided, the request will include a `firmenZugehoerigkeit` object with the BMIS number and identification type, allowing business customers to access their special rates and conditions.
## The `routingMode` option
The `routingMode` option is not supported by db-vendo-client. The behavior will be the same as the [`HYBRID` mode of hafas-client](https://github.com/public-transport/hafas-client/blob/main/p/db/readme.md#using-the-routingmode-option), i.e. cancelled trains/infeasible journeys will also be contained for informational purpose.

View file

@ -183,7 +183,6 @@ const createClient = (profile, userAgent, opt = {}) => {
bestprice: false, // search for lowest prices across the entire day
deutschlandTicketDiscount: false,
deutschlandTicketConnectionsOnly: false,
bmisNumber: null, // 7-digit BMIS number for business customer rates
}, opt);
if (opt.when !== undefined) {
@ -244,7 +243,6 @@ const createClient = (profile, userAgent, opt = {}) => {
scheduledDays: false, // parse & expose dates the journey is valid on?
deutschlandTicketDiscount: false,
deutschlandTicketConnectionsOnly: false,
bmisNumber: null, // 7-digit BMIS number for business customer rates
}, opt);
const req = profile.formatRefreshJourneyReq({profile, opt}, refreshToken);
@ -397,33 +395,7 @@ const createClient = (profile, userAgent, opt = {}) => {
return client;
};
const createBusinessClient = (profile, userAgent, bmisNumber, opt = {}) => {
if (!bmisNumber || typeof bmisNumber !== 'string') {
throw new TypeError('bmisNumber must be a non-empty string');
}
// Create a client with BMIS number included in all journey requests
const client = createClient(profile, userAgent, opt);
// Wrap journeys method to always include BMIS number
const originalJourneys = client.journeys;
client.journeys = async (from, to, opt = {}) => {
return originalJourneys(from, to, {...opt, bmisNumber});
};
// Wrap refreshJourney method to always include BMIS number
if (client.refreshJourney) {
const originalRefreshJourney = client.refreshJourney;
client.refreshJourney = async (refreshToken, opt = {}) => {
return originalRefreshJourney(refreshToken, {...opt, bmisNumber});
};
}
return client;
};
export {
createClient,
createBusinessClient,
loadEnrichedStationData,
};

View file

@ -4,7 +4,7 @@ const formatBaseJourneysReq = (ctx) => {
// TODO opt.accessibility
// TODO routingMode
const travellers = ctx.profile.formatTravellers(ctx);
const baseReq = {
return {
autonomeReservierung: false,
einstiegsTypList: [
'STANDARD',
@ -27,16 +27,6 @@ const formatBaseJourneysReq = (ctx) => {
},
reservierungsKontingenteVorhanden: false,
};
// Add business customer affiliation if BMIS number is provided
if (ctx.opt.bmisNumber) {
baseReq.firmenZugehoerigkeit = {
bmisNr: ctx.opt.bmisNumber,
identifikationsart: 'BMIS',
};
}
return baseReq;
};
const formatJourneysReq = (ctx, from, to, when, outFrwd, journeysRef) => {

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "db-vendo-client",
"version": "6.9.0",
"version": "6.8.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "db-vendo-client",
"version": "6.9.0",
"version": "6.8.2",
"license": "ISC",
"dependencies": {
"content-type": "^1.0.5",

View file

@ -1,7 +1,7 @@
{
"name": "db-vendo-client",
"description": "Client for bahn.de public transport APIs.",
"version": "6.9.0",
"version": "6.8.2",
"type": "module",
"main": "index.js",
"files": [