Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "airbnb-base",
"parserOptions": {
"ecmaVersion": 2020
},
"plugins": [
"import"
],
Expand Down
32 changes: 23 additions & 9 deletions src/Services/Air/AirParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,20 @@ const AirErrorHandler = function (rsp) {
}
};

function parseMiscFormOfPayment(miscFop) {
if (!miscFop) {
return 'MISCFORMOFPAYMENT';
}
const { Category: category, Text: text } = miscFop;
if (category === 'Invoice') {
return text ? `INVOICE:${text}` : 'INVOICE';
}
if (category === 'Exchange') {
return text ? `EXCHANGE:${text}` : 'EXCHANGE';
}
return text ? `${category.toUpperCase()}:${text}` : category.toUpperCase();
Comment thread
Smotrov marked this conversation as resolved.
Outdated
}

function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false) {
// Checking if pricing info exists
if (!allowNoProviderLocatorCodeRetrieval && !etr.ProviderLocatorCode) {
Expand Down Expand Up @@ -577,9 +591,13 @@ function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false)
? etr[`common_${this.uapi_version}:CreditCardAuth`]
: [];
const formOfPayment = fopData.map((fop) => {
return fop.Type === 'Credit'
? utils.getCreditCardData(fop[`common_${this.uapi_version}:CreditCard`], ccAuthData)
: fop.Type.toUpperCase();
if (fop.Type === 'Credit') {
return utils.getCreditCardData(fop[`common_${this.uapi_version}:CreditCard`], ccAuthData);
}
if (fop.Type === 'MiscFormOfPayment') {
return parseMiscFormOfPayment(fop[`common_${this.uapi_version}:MiscFormOfPayment`]);
}
return fop.Type.toUpperCase();
});
const ticketsList = Object.values(etr['air:Ticket']);
const exchangedTickets = [];
Expand Down Expand Up @@ -815,10 +833,7 @@ function airGetTickets(obj) {
}

function airCancelTicket(obj) {
if (
!obj['air:VoidResultInfo']
|| obj['air:VoidResultInfo'].ResultType !== 'Success'
) {
if (obj['air:VoidResultInfo']?.ResultType !== 'Success') {
throw new AirRuntimeError.TicketCancelResultUnknown(obj);
}
return true;
Expand Down Expand Up @@ -925,8 +940,7 @@ function extractBookings(obj) {
const providerInfoKey = providerInfo.Key;
const resRemarks = remarks[providerInfoKey] || [];
const splitBookings = (
providerInfo['universal:ProviderReservationDetails']
&& providerInfo['universal:ProviderReservationDetails'].DivideDetails === 'true'
providerInfo['universal:ProviderReservationDetails']?.DivideDetails === 'true'
)
? resRemarks.reduce(
(acc, remark) => {
Expand Down
Loading
Loading