Closed ukeh closed 2 years ago
There is an error in Air.js file.
function : cancelBooking()
return this.getUniversalRecordByPNR(options) .then((ur) => { const urr = Array.isArray(ur) ? ur[0] : ur; const record = { reservationLocatorCode: urr.uapi_reservation_locator }; return (ignoreTickets ? Promise.resolve([]) : this.getTickets(record).then(checkTickets) ) .then(() => this.getBooking(options)) .then(booking => service.cancelBooking(booking)) .catch( err => Promise.reject(new AirRuntimeError.FailedToCancelPnr(options, err)) ); });
Here this.getTickets(record) actually passing record as a parameter, where record = { reservationLocatorCode };
And the getTickets() is taking pnr from the parameter list which is not present in the "record" object.
async getTickets(options) { const { pnr } = options; const ur = await this.getUniversalRecordByPNR({ pnr }); const urData = Array.isArray(ur) ? ur[0] : ur; const { uapi_reservation_locator: reservationLocatorCode } = urData; try { return await service.getTickets({ reservationLocatorCode }); } catch (err) { if (err instanceof AirRuntimeError.NoAgreement) { throw err; } throw new AirRuntimeError.UnableToRetrieveTickets(options, err); } },
Solution
instead of calling this.getTickets(record), call this.getTickets(options)
There is an error in Air.js file.
function : cancelBooking()
return this.getUniversalRecordByPNR(options) .then((ur) => { const urr = Array.isArray(ur) ? ur[0] : ur; const record = { reservationLocatorCode: urr.uapi_reservation_locator }; return (ignoreTickets ? Promise.resolve([]) : this.getTickets(record).then(checkTickets) ) .then(() => this.getBooking(options)) .then(booking => service.cancelBooking(booking)) .catch( err => Promise.reject(new AirRuntimeError.FailedToCancelPnr(options, err)) ); });
Here this.getTickets(record) actually passing record as a parameter, where record = { reservationLocatorCode };
And the getTickets() is taking pnr from the parameter list which is not present in the "record" object.