Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cancelBooking improvement suggestion #594

Open
ukeh opened this issue Aug 13, 2022 · 2 comments
Open

cancelBooking improvement suggestion #594

ukeh opened this issue Aug 13, 2022 · 2 comments

Comments

@ukeh
Copy link
Contributor

ukeh commented Aug 13, 2022

File: Air.js

checkTickets() inside cancelBooking() can be improved by

const checkTickets = (tickets = []) => {

const promiseChain = [];

for (let ticketData of tickets) {
    // Check for VOID or REFUND
    const allTicketsVoidOrRefund = ticketData.tickets.every(
        ticket => ticket.coupons.every(
            coupon => coupon.status === 'V' || coupon.status === 'R'
        )
    );

    if (allTicketsVoidOrRefund) {
        continue;
    }

    if (cancelTickets !== true) {
        throw new AirRuntimeError.PNRHasOpenTickets({ tickets });
    }
    // Check for not OPEN/VOID segments
    const hasNotOpenSegment = ticketData.tickets.some(
        ticket => ticket.coupons.some(
            coupon => 'OV'.indexOf(coupon.status) === -1
        )
    );

    if (hasNotOpenSegment) {
        throw new AirRuntimeError.UnableToCancelTicketStatusNotOpen();
    }

    for (let ticket of ticketData.tickets) {
        if (ticket.coupons[0].status !== 'V') {
            promiseChain.push(service.cancelTicket({ pnr, ticketNumber: ticket.ticketNumber }));
        }
    }
}

return Promise.all(promiseChain);

}

@ukeh ukeh changed the title cancelBooking improvement cancelBooking improvement suggestion Aug 13, 2022
@ukeh
Copy link
Contributor Author

ukeh commented Aug 13, 2022

@dchertousov please have a look at this

@ukeh
Copy link
Contributor Author

ukeh commented Aug 13, 2022

https://support.travelport.com/webhelp/Smartpoint1G1V/Content/Air/Ticketing/TicketAssistant/TicketAssistant_Void.htm

this document says that " Tickets with an OPEN or ARPT (Airport) status are eligible for voiding". "A" might be used to indicate status ARPT, so is it ok to use 'OVA'.indexOf(coupon.status) === -1 instead of 'OV'.indexOf(coupon.status) === -1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant