Travelport-Ukraine / uapi-json

Best Travelport Universal API wrapper ever :airplane: :mountain_railway: :hotel:
https://travelport-ukraine.github.io/uapi-json/
MIT License
74 stars 61 forks source link

Error parsing ticket #193

Closed dchertousov closed 7 years ago

dchertousov commented 7 years ago

There is an error while parsing attached XML:

TypeError: Cannot read property 'CabinClass' of undefined
    at coupons.Object.keys.map.couponKey (/Users/dchertousov/Sites/uapi-json-ext/node_modules/uapi-json/build/Services/Air/AirParser.js:327:53)
    at Array.map (native)
    at Object.keys.map.ticketKey (/Users/dchertousov/Sites/uapi-json-ext/node_modules/uapi-json/build/Services/Air/AirParser.js:313:50)
    at Array.map (native)
    at Parser.airGetTicket (/Users/dchertousov/Sites/uapi-json-ext/node_modules/uapi-json/build/Services/Air/AirParser.js:309:44)
    at process._tickCallback (internal/process/next_tick.js:103:7)

ticket.0479902778712.xml.txt

dchertousov commented 7 years ago

Update from Martin:

Hi Dima, Its because whole itinerary is in the same BookingClass, the document retrieve returned only one line:

<air:BookingInfo BookingCode="K" CabinClass="Economy" FareInfoRef="2aDr2kBAAA/BgpdyvGAAAA=="/>

For ticket/reservation where is more BookingClasses used, you will see more lines for all segments

  <air:BookingInfo BookingCode="W" CabinClass="Economy" FareInfoRef="/yZuXnBAAA/BdZ/OwMAAAA=="/>
  <air:BookingInfo BookingCode="W" CabinClass="Economy" FareInfoRef="/yZuXnBAAA/BhZ/OwMAAAA=="/>
  <air:BookingInfo BookingCode="L" CabinClass="Economy" FareInfoRef="/yZuXnBAAA/BlZ/OwMAAAA=="/>
  <air:BookingInfo BookingCode="L" CabinClass="Economy" FareInfoRef="/yZuXnBAAA/BpZ/OwMAAAA=="/>
For this, you can try following:
      <com:OverridePCC ProviderCode="1G" PseudoCityCode="79YE"/>
      <com:TicketNumber>1179902813806</com:TicketNumber>

But, be careful, that this information is connected with fareinfo and is necessary to have saved FF (FiledFare) in a reservation. You can have cases that reservation has a ticket and thanks to for example flight time change FiledFare disapears from the reservation. The reservation is still valid, ticket is also valid fo traveling but there is not saved FiledFare and this information about TravelClasses will be missed. I do not know if it can make you a problem, but for your info.

You can try this reservation on 79YE. All is ok but without *FF:

XWDTNM/76 BRQNH  N921760 AG 99999992 30DEC 
 1.1NOVAK/JANEKMR
 1 . TP 1307 E  10SEP PRGLIS HK1  0600   0830  O*        E SU    3  
 2 . TP 1671 E  10SEP LISFNC HK1  0930   1115  O*        E SU    3  
 3 . TP 1680 K  20SEP FNCLIS TK1  0945   1120  O*        E WE    4  
 4 . TP 1304 K  20SEP LISPRG TK1  1220   1640  O*        E WE    4