2024-12-16 12:02:47 +00:00
|
|
|
const c = {
|
|
|
|
NONE: Symbol('no loyalty card'),
|
|
|
|
BAHNCARD: Symbol('Bahncard'),
|
|
|
|
VORTEILSCARD: Symbol('VorteilsCard'),
|
|
|
|
HALBTAXABO: Symbol('HalbtaxAbo'),
|
|
|
|
VOORDEELURENABO: Symbol('Voordeelurenabo'),
|
|
|
|
SHCARD: Symbol('SH-Card'),
|
|
|
|
GENERALABONNEMENT: Symbol('General-Abonnement'),
|
2025-02-13 23:20:37 +00:00
|
|
|
NL_40: Symbol('NL-40%'),
|
|
|
|
AT_KLIMATICKET: Symbol('AT-KlimaTicket'),
|
2024-12-16 12:02:47 +00:00
|
|
|
};
|
2017-11-12 23:51:39 +01:00
|
|
|
|
|
|
|
const formatLoyaltyCard = (data) => {
|
2024-12-07 23:48:08 +00:00
|
|
|
if (!data) {
|
|
|
|
return {
|
2024-12-08 21:42:57 +00:00
|
|
|
art: 'KEINE_ERMAESSIGUNG',
|
|
|
|
klasse: 'KLASSENLOS',
|
|
|
|
};
|
2024-12-07 23:48:08 +00:00
|
|
|
}
|
|
|
|
const cls = data.class === 1 ? 'KLASSE_1' : 'KLASSE_2';
|
2024-12-16 12:02:47 +00:00
|
|
|
if (data.type.toString() === c.BAHNCARD.toString()) {
|
2024-12-07 23:48:08 +00:00
|
|
|
return {
|
2025-02-13 23:20:37 +00:00
|
|
|
art: 'BAHNCARD' + (data.business ? 'BUSINESS' : '') + data.discount,
|
2024-12-08 21:42:57 +00:00
|
|
|
klasse: cls,
|
|
|
|
};
|
2017-11-12 23:51:39 +01:00
|
|
|
}
|
2024-12-16 12:02:47 +00:00
|
|
|
if (data.type.toString() === c.VORTEILSCARD.toString()) {
|
2024-12-07 23:48:08 +00:00
|
|
|
return {
|
|
|
|
art: 'A-VORTEILSCARD',
|
2024-12-08 21:42:57 +00:00
|
|
|
klasse: 'KLASSENLOS',
|
|
|
|
};
|
2024-02-06 22:58:49 +01:00
|
|
|
}
|
2024-12-16 12:02:47 +00:00
|
|
|
if (data.type.toString() === c.HALBTAXABO.toString()) {
|
2024-12-07 23:48:08 +00:00
|
|
|
return {
|
|
|
|
art: 'CH-HALBTAXABO_OHNE_RAILPLUS',
|
2024-12-08 21:42:57 +00:00
|
|
|
klasse: 'KLASSENLOS',
|
|
|
|
};
|
2024-02-06 22:58:49 +01:00
|
|
|
}
|
2024-12-16 12:02:47 +00:00
|
|
|
if (data.type.toString() === c.GENERALABONNEMENT.toString()) {
|
2024-12-07 23:48:08 +00:00
|
|
|
return {
|
|
|
|
art: 'CH-GENERAL-ABONNEMENT',
|
2024-12-08 21:42:57 +00:00
|
|
|
klasse: cls,
|
|
|
|
};
|
2024-02-06 22:58:49 +01:00
|
|
|
}
|
2025-02-13 23:20:37 +00:00
|
|
|
if (data.type.toString() === c.NL_40.toString()) {
|
|
|
|
return {
|
|
|
|
art: 'NL-40_OHNE_RAILPLUS',
|
|
|
|
klasse: 'KLASSENLOS',
|
|
|
|
};
|
|
|
|
}
|
|
|
|
if (data.type.toString() === c.AT_KLIMATICKET.toString()) {
|
|
|
|
return {
|
|
|
|
art: 'KLIMATICKET_OE',
|
|
|
|
klasse: 'KLASSENLOS',
|
|
|
|
};
|
|
|
|
}
|
2024-12-07 23:48:08 +00:00
|
|
|
return {
|
2024-12-08 21:42:57 +00:00
|
|
|
art: 'KEINE_ERMAESSIGUNG',
|
|
|
|
klasse: 'KLASSENLOS',
|
|
|
|
};
|
2023-12-28 10:39:20 +01:00
|
|
|
};
|
2022-05-07 16:17:37 +02:00
|
|
|
export {
|
|
|
|
c as data,
|
2024-12-08 21:42:57 +00:00
|
|
|
formatLoyaltyCard,
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|