mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
don't set undefined price fields
This commit is contained in:
parent
e05b31e19c
commit
5c5c1acd44
2 changed files with 14 additions and 16 deletions
|
@ -250,21 +250,28 @@ const mutateToAddTickets = (parsed, opt, j) => {
|
|||
.filter(s => s.typ == 'REISEANGEBOT' && !s.angebotsbeziehungList.flatMap(b => b.referenzen)
|
||||
.find(r => r.referenzAngebotsoption == 'PFLICHT'))
|
||||
.map((s) => {
|
||||
return {
|
||||
const p = {
|
||||
name: s.name,
|
||||
priceObj: {
|
||||
amount: Math.round(s.preis?.betrag * 100),
|
||||
currency: s.preis?.waehrung,
|
||||
},
|
||||
addData: s.teilpreis ? 'Teilpreis / partial fare' : undefined,
|
||||
addDataTicketInfo: s.konditionsAnzeigen?.map(a => a.anzeigeUeberschrift)
|
||||
.join('. '),
|
||||
addDataTicketDetails: s.konditionsAnzeigen?.map(a => a.textLang)
|
||||
.join(' '),
|
||||
addDataTravelInfo: s.leuchtturmInfo?.text,
|
||||
firstClass: s.klasse == 'KLASSE_1',
|
||||
partialFare: s.teilpreis,
|
||||
};
|
||||
if (s.teilpreis) {
|
||||
p.addData = 'Teilpreis / partial fare';
|
||||
}
|
||||
if (s.konditionsAnzeigen) {
|
||||
p.addDataTicketInfo = s.konditionsAnzeigen?.map(a => a.anzeigeUeberschrift)
|
||||
.join('. ');
|
||||
p.addDataTicketDetails = s.konditionsAnzeigen?.map(a => a.textLang)
|
||||
.join(' ');
|
||||
}
|
||||
if (s.leuchtturmInfo) {
|
||||
p.addDataTravelInfo = s.leuchtturmInfo?.text;
|
||||
}
|
||||
return p;
|
||||
});
|
||||
if (opt.generateUnreliableTicketUrls) {
|
||||
// TODO
|
||||
|
|
9
test/fixtures/db-refresh-journey.js
vendored
9
test/fixtures/db-refresh-journey.js
vendored
|
@ -183,10 +183,8 @@ const dbJourney = {
|
|||
amount: 2799,
|
||||
currency: 'EUR',
|
||||
},
|
||||
addData: undefined,
|
||||
addDataTicketInfo: 'Train-specific travel. No cancellations',
|
||||
addDataTicketDetails: 'You can use all trains indicated on your ticket. Your ticket constitutes a continuous contract of carriage in each direction (through ticket). Should you make a passenger rights claim, the ticket will be considered in its entirety. Special rules apply to tickets including City-Ticket, see there. Your ticket cannot be cancelled.',
|
||||
addDataTravelInfo: undefined,
|
||||
firstClass: false,
|
||||
partialFare: false,
|
||||
},
|
||||
|
@ -196,7 +194,6 @@ const dbJourney = {
|
|||
amount: 3599,
|
||||
currency: 'EUR',
|
||||
},
|
||||
addData: undefined,
|
||||
addDataTicketInfo: 'Train-specific travel. No cancellations. No access to the DB Lounge',
|
||||
addDataTicketDetails: 'You can use all trains indicated on your ticket. Your ticket constitutes a continuous contract of carriage in each direction (through ticket). Should you make a passenger rights claim, the ticket will be considered in its entirety. Special rules apply to tickets including City-Ticket, see there. Your ticket cannot be cancelled. Your ticket does not entitle you to use the DB Lounge.',
|
||||
addDataTravelInfo: 'Travel 1st class',
|
||||
|
@ -209,10 +206,8 @@ const dbJourney = {
|
|||
amount: 3499,
|
||||
currency: 'EUR',
|
||||
},
|
||||
addData: undefined,
|
||||
addDataTicketInfo: 'Train-specific travel. Cancellation subject to a fee before first day of validity',
|
||||
addDataTicketDetails: 'You can use all trains indicated on your ticket. Your ticket constitutes a continuous contract of carriage in each direction (through ticket). Should you make a passenger rights claim, the ticket will be considered in its entirety. Special rules apply to tickets including City-Ticket, see there. You can cancel your ticket up to and including 17.12.2024 for a fee of EUR 10,00. You will receive a voucher for the remaining amount. No cancellation thereafter.',
|
||||
addDataTravelInfo: undefined,
|
||||
firstClass: false,
|
||||
partialFare: false,
|
||||
},
|
||||
|
@ -222,7 +217,6 @@ const dbJourney = {
|
|||
amount: 4499,
|
||||
currency: 'EUR',
|
||||
},
|
||||
addData: undefined,
|
||||
addDataTicketInfo: 'Train-specific travel. Cancellation subject to a fee before first day of validity. No access to the DB Lounge',
|
||||
addDataTicketDetails: 'You can use all trains indicated on your ticket. Your ticket constitutes a continuous contract of carriage in each direction (through ticket). Should you make a passenger rights claim, the ticket will be considered in its entirety. Special rules apply to tickets including City-Ticket, see there. You can cancel your ticket up to and including 17.12.2024 for a fee of EUR 10,00. You will receive a voucher for the remaining amount. No cancellation thereafter. Your ticket does not entitle you to use the DB Lounge.',
|
||||
addDataTravelInfo: 'Travel 1st class',
|
||||
|
@ -235,10 +229,8 @@ const dbJourney = {
|
|||
amount: 13280,
|
||||
currency: 'EUR',
|
||||
},
|
||||
addData: undefined,
|
||||
addDataTicketInfo: 'Unrestricted choice of trains. Cancellation free of charge before first day of validity. City-Ticket',
|
||||
addDataTicketDetails: 'Your ICE ticket lets you take any type of train. Your ticket constitutes a continuous contract of carriage in each direction (through ticket). Should you make a passenger rights claim, the ticket will be considered in its entirety. Special rules apply to tickets including City-Ticket; see there. You can cancel your ticket free of charge up to and including 17.12.2024. After that, cancellation is available for a fee of EUR 19,00. Your ticket includes a City-Ticket for Berlin, Tarifbereiche A und B and Köln, Stadtgebiet Köln (Tarifgebiet 2100). The City-Ticket is valid in conjunction with your long-distance ticket only when you use it for connecting services in local or regional rail passenger transport (e.g. S-Bahn, RE and RB trains) as part of the through ticket. The City-Ticket is issued together with your Super Sparpreis or Sparpreis ticket, depending on the journey you have booked.',
|
||||
addDataTravelInfo: undefined,
|
||||
firstClass: false,
|
||||
partialFare: false,
|
||||
},
|
||||
|
@ -248,7 +240,6 @@ const dbJourney = {
|
|||
amount: 23910,
|
||||
currency: 'EUR',
|
||||
},
|
||||
addData: undefined,
|
||||
addDataTicketInfo: 'Unrestricted choice of trains. Cancellation free of charge before first day of validity. City-Ticket. Access to the DB Lounge. Seat included',
|
||||
addDataTicketDetails: 'Your ICE ticket lets you take any type of train. Your ticket constitutes a continuous contract of carriage in each direction (through ticket). Should you make a passenger rights claim, the ticket will be considered in its entirety. Special rules apply to tickets including City-Ticket; see there. You can cancel your ticket free of charge up to and including 17.12.2024. After that, cancellation is available for a fee of EUR 19,00. Your ticket includes a City-Ticket for Berlin, Tarifbereiche A und B and Köln, Stadtgebiet Köln (Tarifgebiet 2100). The City-Ticket is valid in conjunction with your long-distance ticket only when you use it for connecting services in local or regional rail passenger transport (e.g. S-Bahn, RE and RB trains) as part of the through ticket. The City-Ticket is issued together with your Super Sparpreis or Sparpreis ticket, depending on the journey you have booked. Your ticket entitles you to use the DB Lounge. Your ticket includes a free seat reservation.',
|
||||
addDataTravelInfo: 'Travel 1st class',
|
||||
|
|
Loading…
Add table
Reference in a new issue