Skip to content

Commit 333f4e7

Browse files
authored
Merge pull request #205 from Travelport-Ukraine/issue/204
Closes #204
2 parents 08778c5 + 88fd56d commit 333f4e7

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

src/Services/Air/AirParser.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,14 @@ const airGetTicket = function (obj) {
361361
)
362362
: [];
363363
const priceInfo = {
364-
totalPrice: etr.TotalPrice,
364+
// Values
365+
totalPrice: etr.TotalPrice || 0,
365366
basePrice: etr.BasePrice,
366367
equivalentBasePrice: etr.EquivalentBasePrice,
367368
taxes: etr.Taxes,
368369
taxesInfo: taxes,
370+
// Flags
371+
noAdc: !etr.TotalPrice,
369372
};
370373
const response = {
371374
uapi_ur_locator: obj.UniversalRecordLocatorCode,

test/Air/AirParser.test.js

+19
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ describe('#AirParser', () => {
217217
expect(priceInfo).to.be.an('object');
218218
expect(priceInfo).to.have.all.keys([
219219
'totalPrice', 'basePrice', 'taxes', 'taxesInfo', 'equivalentBasePrice',
220+
'noAdc',
220221
]);
221222
expect(priceInfo.totalPrice).to.match(/[A-Z]{3}(?:\d+\.)?\d+/i);
222223
expect(priceInfo.basePrice).to.match(/[A-Z]{3}(?:\d+\.)?\d+/i);
@@ -263,6 +264,23 @@ describe('#AirParser', () => {
263264
});
264265
}
265266

267+
it('should parse NO ADC ticket', () => {
268+
const uParser = new ParserUapi('air:AirRetrieveDocumentRsp', 'v39_0', {});
269+
const parseFunction = airParser.AIR_GET_TICKET;
270+
const xml = fs.readFileSync(`${xmlFolder}/getTicket_NOADC.xml`).toString();
271+
272+
return uParser.parse(xml)
273+
.then(json => parseFunction.call(uParser, json))
274+
.then((result) => {
275+
expect(result).to.be.an('object');
276+
expect(result).to.include.key('priceInfo');
277+
expect(result.priceInfoDetailsAvailable).to.equal(false);
278+
expect(result.priceInfo).to.be.an('object');
279+
expect(result.priceInfo.noAdc).to.equal(true);
280+
expect(result.priceInfo.totalPrice).to.equal(0);
281+
});
282+
});
283+
266284
it('should return correct error for duplicate ticket number', () => {
267285
const uParser = new ParserUapi('air:AirRetrieveDocumentRsp', 'v39_0', {});
268286
const parseFunction = airParser.AIR_GET_TICKET;
@@ -362,6 +380,7 @@ describe('#AirParser', () => {
362380
expect(priceInfo).to.be.an('object');
363381
expect(priceInfo).to.have.all.keys([
364382
'totalPrice', 'basePrice', 'taxes', 'equivalentBasePrice', 'taxesInfo',
383+
'noAdc',
365384
]);
366385
expect(priceInfo.totalPrice).to.match(/[A-Z]{3}(?:\d+\.)?\d+/i);
367386
expect(priceInfo.basePrice).to.match(/[A-Z]{3}(?:\d+\.)?\d+/i);
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
3+
<SOAP:Body>
4+
<air:AirRetrieveDocumentRsp xmlns:air="http://www.travelport.com/schema/air_v39_0" xmlns:common_v39_0="http://www.travelport.com/schema/common_v39_0" TransactionId="3F223A5A0A07425C6210708C84263EB2" ResponseTime="1185" UniversalRecordLocatorCode="XCSM3Y">
5+
<air:ETR Key="3C2afwBAAA/B3tqcXGAAAA==" BasePrice="USD78.00" Taxes="UAH3603.00" EquivalentBasePrice="UAH2060" IssuedDate="2017-05-22T00:00:00.000+02:00" ProviderCode="1G" ProviderLocatorCode="X3TV3U" IATANumber="99999992" PseudoCityCode="7J8J" PlatingCarrier="OK">
6+
<air:AirReservationLocatorCode>XWE2ZR</air:AirReservationLocatorCode>
7+
<common_v39_0:AgencyInfo>
8+
<common_v39_0:AgentAction ActionType="Created" AgentCode="UAPI7980742859-07362D4F" BranchCode="P2731609" AgencyCode="S1473516" EventTime="2017-05-21T22:00:00.000+00:00" />
9+
</common_v39_0:AgencyInfo>
10+
<common_v39_0:BookingTraveler Key="V2TUfwBAAA/BfYY/JFAAAA==">
11+
<common_v39_0:BookingTravelerName First="DMYTROMR" Last="CHERTOUSOV" />
12+
<common_v39_0:SSR Key="V2TUfwBAAA/B6nY/JFAAAA==" SegmentRef="V2TUfwBAAA/B8nY/JFAAAA==" Status="HK" Type="TKNE" FreeText="0649902881726C1" Carrier="OK" ProviderReservationInfoRef="V2TUfwBAAA/BOqR/JFAAAA==" />
13+
<common_v39_0:SSR Key="V2TUfwBAAA/B7nY/JFAAAA==" SegmentRef="V2TUfwBAAA/BBoY/JFAAAA==" Status="HK" Type="TKNE" FreeText="0649902881726C2" Carrier="OK" ProviderReservationInfoRef="V2TUfwBAAA/BOqR/JFAAAA==" />
14+
<common_v39_0:SSR Key="3C2afwBAAA/BC4hcXGAAAA==" SegmentRef="yN0YfwBAAA/B3qVuHFAAAA==" Status="HK" Type="TKNE" FreeText="0649902881727C1" Carrier="OK" ProviderReservationInfoRef="V2TUfwBAAA/BOqR/JFAAAA==" />
15+
<common_v39_0:SSR Key="3C2afwBAAA/BD4hcXGAAAA==" SegmentRef="yN0YfwBAAA/B5qVuHFAAAA==" Status="HK" Type="TKNE" FreeText="0649902881727C2" Carrier="OK" ProviderReservationInfoRef="V2TUfwBAAA/BOqR/JFAAAA==" />
16+
</common_v39_0:BookingTraveler>
17+
<common_v39_0:SupplierLocator SupplierCode="OK" SupplierLocatorCode="UAWY5E" />
18+
<air:FareCalc>IEV OK PRG 39.00Q0BAGG OK IEV 39.00Q0BAGG NUC78.00END ROE1.0 XT PD449YK PD647CZ PD2348YQ</air:FareCalc>
19+
<air:Ticket Key="3C2afwBAAA/B7tqcXGAAAA==" TicketNumber="0649902881727" TicketStatus="N">
20+
<air:Coupon Key="3C2afwBAAA/B8tqcXGAAAA==" CouponNumber="1" MarketingCarrier="OK" MarketingFlightNumber="917" Origin="KBP" Destination="PRG" DepartureTime="2018-04-20T05:05:00.000+03:00" StopoverCode="true" BookingClass="Q" FareBasis="Q0BAGG" NotValidBefore="2018-04-20" NotValidAfter="2018-04-20" Status="O" SegmentGroup="0" MarriageGroup="0" />
21+
<air:Coupon Key="3C2afwBAAA/B9tqcXGAAAA==" CouponNumber="2" MarketingCarrier="OK" MarketingFlightNumber="916" Origin="PRG" Destination="KBP" DepartureTime="2018-04-22T22:10:00.000+02:00" StopoverCode="true" BookingClass="Q" FareBasis="Q0BAGG" NotValidBefore="2018-04-22" NotValidAfter="2018-04-22" Status="O" SegmentGroup="1" MarriageGroup="0" />
22+
<air:ExchangedTicketInfo Number="0649902881726" />
23+
</air:Ticket>
24+
<common_v39_0:Commission Level="Fare" Type="PercentBase" Percentage="0.1" />
25+
</air:ETR>
26+
</air:AirRetrieveDocumentRsp>
27+
</SOAP:Body>
28+
</SOAP:Envelope>

0 commit comments

Comments
 (0)