Skip to content

Commit

Permalink
shared waltti ticketlink config
Browse files Browse the repository at this point in the history
  • Loading branch information
sharhio committed Oct 1, 2024
1 parent 5a33c25 commit 9ea453a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 26 deletions.
13 changes: 0 additions & 13 deletions app/configurations/config.jyvaskyla.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,6 @@ export default configMerger(walttiConfig, {
transferPenalty: 1600,
},

ticketPurchaseLink: function purchaseTicketLink(fare) {
const fareId = fare.fareProducts[0].product.id;
const ticket = fareId?.substring
? fareId.substring(fareId.indexOf(':') + 1)
: '';
let zones = '';
// Waltti wants zone ids, so map A to 01, B to 02 etc
for (let i = 0; i < ticket.length; i++) {
zones += `0${ticket.charCodeAt(i) - 64}`; // eslint-disable
}
return `https://waltti.fi/walttiapp/busTicket/?operator=50209&ticketType=single&customerGroup=adult&zones=${zones}`;
},

fareMapping: function mapFareId(fareId) {
const id = fareId?.substring?.(fareId.indexOf(':') + 1);
switch (id) {
Expand Down
13 changes: 0 additions & 13 deletions app/configurations/config.lahti.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,6 @@ export default configMerger(walttiConfig, {
transferPenalty: 1600,
},

ticketPurchaseLink: function purchaseTicketLink(fare) {
const fareId = fare.fareProducts[0].product.id;
const ticket = fareId?.substring
? fareId.substring(fareId.indexOf(':') + 1)
: '';
let zones = '';
// Waltti wants zone ids, so map A to 01, B to 02 etc
for (let i = 0; i < ticket.length; i++) {
zones += `0${ticket.charCodeAt(i) - 64}`; // eslint-disable
}
return `https://kauppa.waltti.fi/walttiappfeat/busTicket/?operator=50223&ticketType=single&customerGroup=adult&zones=${zones}`;
},

fareMapping: function mapFareId(fareId) {
const id = fareId?.substring?.(fareId.indexOf(':') + 1);
switch (id) {
Expand Down
13 changes: 13 additions & 0 deletions app/configurations/config.waltti.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,17 @@ export default {
value: 600,
},
],

ticketPurchaseLink: function purchaseTicketLink(fare) {
const fareId = fare.fareProducts[0].product.id;
const ticket = fareId?.substring
? fareId.substring(fareId.indexOf(':') + 1)
: '';
let zones = '';
// Waltti wants zone ids, so map A to 01, B to 02 etc
for (let i = 0; i < ticket.length; i++) {
zones += `0${ticket.charCodeAt(i) - 64}`; // eslint-disable
}
return `https://waltti.fi/walttiapp/busTicket/?operator=50209&ticketType=single&customerGroup=adult&zones=${zones}`;
},
};

0 comments on commit 9ea453a

Please sign in to comment.