15 lines
571 B
JavaScript
15 lines
571 B
JavaScript
const axios = require('axios');
|
|
async function getUlysRate(vehicleCategory, passages) {
|
|
const payload = {
|
|
vehicleCategory: String(vehicleCategory),
|
|
paymentOption: 2,
|
|
tollPassages: passages.map((p) => ({
|
|
toll: { operatorId: p.operatorId, tollId: p.tollId },
|
|
passageDate: new Date().toISOString(),
|
|
})),
|
|
};
|
|
const res = await axios.post('https://api-ulys.azure-api.net/tollstation/v1/rate', payload);
|
|
console.log(JSON.stringify(res.data, null, 2));
|
|
}
|
|
getUlysRate(2, [{operatorId: '03', tollId: '001'}, {operatorId: '03', tollId: '003'}]);
|