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

Extending AirService for AirMerchandising #51

Open MiseCZ opened 8 years ago

MiseCZ commented 8 years ago

For booking OptionalServices through UAPI we need these requests:.

We need to specify AirSegments, SearchPasseners, AirPricingCommand and FormOfPayment like this:

       <air:AirSegment n:foreach="$airSegmentList as $airSegment"
          Key="{$airSegment->getKey()}"
          AvailabilityDisplayType="Fare Shop/Optimal Shop"
          Group="{$airSegment->getGroup()}"
          Carrier="{$airSegment->getCarrier()}"
          FlightNumber="{$airSegment->getFlightNumber()}"
          Origin="{$airSegment->getOrigin()}"
          Destination="{$airSegment->getDestination()}"
          DepartureTime="{$airSegment->getDepartureTime()}"
          ArrivalTime="{$airSegment->getArrivalTime()}"
          ProviderCode="{$providerCode}"
          ClassOfService="{$airSegment->getClassOfService()}">
        </air:AirSegment>

      <com:SearchPassenger n:foreach="$searchPassengerList as $searchPassenger"
        Code="{$searchPassenger->getCode()}" 
        n:attr="Age => $searchPassenger->getAge()"
        BookingTravelerRef="{$searchPassenger->getBookingTravelerRef()}" 
        />

      <air:AirPricingCommand>
        <air:AirSegmentPricingModifiers n:foreach="$airSegmentPricingModifiersList as $airSegmentPricingModifiers"
          AirSegmentRef="{$airSegmentPricingModifiers->getAirSegmentRef()}"
          FareBasisCode="{$airSegmentPricingModifiers->getFareBasisCode()}">
          <air:PermittedBookingCodes>
            <air:BookingCode Code="{$airSegmentPricingModifiers->getBookingCode()}"/>
          </air:PermittedBookingCodes>
        </air:AirSegmentPricingModifiers>
      </air:AirPricingCommand>

     <com:FormOfPayment Type="{$formOfPayment}" />

I believe we could either extend one of the two current templates (AIR_PRICE_REQ.xml and AIR_PRICE_REQ_MANUAL.xml) or introduce third one (AIR_PRICE_REQ_OPTIONAL_SERVICES.xml ).

We will also need to parse more data from response. All OptionalServices information which is pretty complex. That's similar situation as with templates. But I believe we need something like AirPrice.AIR_PRICE_REQUEST_OPTIONAL_SERVICES_XML.

I'm also little hesitant about public API.

AirService.services(params) => Promise

Seems like first choice possibility, but It seems to me that this function will be little more complex than other AirService functions.

AirMerchandisingFullfilmentReq, EMDIssuanceReq, SeatMapReq requests

I believe they are all new ones and their adding into AirService seems natural. Again maybe they are somewhat more advanced than basic shop(), book() and ticket() functionality.

UniversalRecordRetrieveReq request

Here I'm little bit puzzled because I would expect this request to be part of currently non-existing UniversalRecordService (according to: https://support.travelport.com/webhelp/uapi/uAPI.htm#Getting_Started/Easy_Overview/Complete_Services_List.htm%3FTocPath%3DGetting%2520Started%7CGetting%2520Connected%7C_____4).

But I discovered that there currently is UNIVERSAL_RECORD_CANCEL_UR.xml which is part of AirService and that is not according to afforementioned document.

What would you think?

dchertousov commented 8 years ago

@MiseCZ

First, we are not creating api-json as just a proxy from JSON format to SOAP. Also we are trying to simplify life for developers. As booking was created through AirService it's logical to get the reservation via AirService rather than using another one. That's why we would like to see booking retrieve function as part of AirService

Next, in my opinion it's better to have separate templates for separate functions. I'd like to hear @shmuga on this.

Also I would like you to ask you to create a separate issue for each of the requests you have described. In each ticket it would be nice to see interface description: input params and output data.

MiseCZ commented 8 years ago

@dchertousov

I understand that uapi-json takes two responsibilities:

  1. enable soap uapi calls from javascript
  2. simplify things for programmers

I would highly recommend to separate this two responsibilities on architectonic level too.

Right now I'm trying to understand how to implement AirMerchandising in this integrated concept. I will create separate issues for implementation.

MiseCZ commented 8 years ago

So 2nd take on the AirMerchandising:

Again: I'm just trying to verify overall concept. I will create issues for every request after you'll confirm it's a right way to go.

dchertousov commented 7 years ago

Hello, @MiseCZ! Hope, you do still have plans to include this functionality into library.