24 lines
831 B
JavaScript
24 lines
831 B
JavaScript
const axios = require('axios');
|
|
async function testRateVienneToulouseEst() {
|
|
const passages = [
|
|
{ operatorId: '04', tollId: '201' }, // VIENNE (04201)
|
|
{ operatorId: '04', tollId: '456' } // TOULOUSE-EST (04456)
|
|
];
|
|
const payload = {
|
|
vehicleCategory: "2",
|
|
paymentOption: 2,
|
|
tollPassages: passages.map((p) => ({
|
|
toll: { operatorId: p.operatorId, tollId: p.tollId },
|
|
passageDate: new Date().toISOString(),
|
|
})),
|
|
};
|
|
try {
|
|
const res = await axios.post('https://api-ulys.azure-api.net/tollstation/v1/rate', payload);
|
|
console.log("Rate VIENNE -> TOULOUSE-EST:");
|
|
console.log(JSON.stringify(res.data, null, 2));
|
|
} catch (e) {
|
|
console.error(e.response ? e.response.data : e.message);
|
|
}
|
|
}
|
|
testRateVienneToulouseEst();
|