amabnl / amadeus-ws-client

PHP Amadeus SOAP Web Service client library
Apache License 2.0
183 stars 191 forks source link

How to get the Price for Recommendations in Fare_MasterPricerTravelBoardSearch #46

Closed gaurav99t closed 7 years ago

gaurav99t commented 7 years ago

i get XML response from Fare_MasterPricerTravelBoardSearch but how can i get fare price for each flight? So i can display all flights with fare price into my webpage

DerMika commented 7 years ago

Hi,

I've received this question before. Please check the answer I gave here to get some insight into how to interpret the MasterPricerTravelBoardSearchReply.

But as I said in that comment too, I do not provide support for understanding the responses from Amadeus. For that you should contact your Amadeus support person who should be assigned to your project (or refer to the Web Services Extranet documentation)

gaurav99t commented 7 years ago

amadeus support team is not helpful for certain questions they only asks for reading documentation which is big and complicated. i have read your reply regarding to this question and it is really helpful but if i get any question related to the same can i ask you? because you can understand problem in a second and can reply within few minutes of typing

DerMika commented 7 years ago

I can try, and if I know the answer, I'll give it to you. This will also help future users of the library who could encounter the same issues.

But I give no guarantees, and if I don't know the answer, you'll have to find it yourself.

So, as for this particular issue, is your question answered? If so, you can close it.

gaurav99t commented 7 years ago

i need some time to understand and matching your answer withe the XML response. i will let you know whatever the status will be. I will close this issue after studying the xml response or will get back to you with some questions thank you very much

DerMika commented 7 years ago

No problem, take your time!

gaurav99t commented 7 years ago

After spending full day in studying XML response i think i have understood this point but still want to post here so you can make sure if i got it correctly.

Suppose i request for 50 Recommendations with this request

50 RC

Now i get XML response and it contain 50 under

and every has below XML till 50 with 1 to 50

                <propFlightGrDetail>
                    <flightProposal>
                        <ref>1</ref>
                    </flightProposal>
                    <flightProposal>
                        <ref>0215</ref>
                        <unitQualifier>EFT</unitQualifier>
                    </flightProposal>
                    <flightProposal>
                        <ref>9W</ref>
                        <unitQualifier>MCX</unitQualifier>
                    </flightProposal>
                </propFlightGrDetail>

but somehow 10 to 20 recommendations are returned in the XML response

So confusion comes here if there are 50 then there must be 50 too?

Some recommendations have below code only once

            <segmentFlightRef>
                <referencingDetail>
                    <refQualifier>S</refQualifier>
                    <refNumber>1</refNumber>
                </referencingDetail>
                <referencingDetail>
                    <refQualifier>B</refQualifier>
                    <refNumber>2</refNumber>
                </referencingDetail>
            </segmentFlightRef>

and some recommendations have below code more than once, like below code

            <segmentFlightRef>
                <referencingDetail>
                    <refQualifier>S</refQualifier>
                    <refNumber>2</refNumber>
                </referencingDetail>
                <referencingDetail>
                    <refQualifier>B</refQualifier>
                    <refNumber>2</refNumber>
                </referencingDetail>
            </segmentFlightRef>
            <segmentFlightRef>
                <referencingDetail>
                    <refQualifier>S</refQualifier>
                    <refNumber>3</refNumber>
                </referencingDetail>
                <referencingDetail>
                    <refQualifier>B</refQualifier>
                    <refNumber>2</refNumber>
                </referencingDetail>
            </segmentFlightRef>

So what my conclusion is that same fare will be applied for below groupOfFlight.

2 3

So if a recommendation contain 7 to 8 times and only one

So it means same will be applied to all group of flights whose reference exists in the recommendation?

Did i get it correctly? sorry for bad english

DerMika commented 7 years ago

Recommendations are combinations of flights that are offered at a given price by a given airline. To know what kind of flights are associated with a certain recommendation, you must match the refNumbers of the recommendations with the correct nodes under gropOfFlights to get all the flights in a recommendation.

For example in your last recommendation example, to know which flights match this recommendation, you need to retrieve all flights under /Fare_MasterPricerTravelBoardSearchReply/flightIndex/groupOfFlights where the refQualifier = 'S'

So in this case you need to get the groupOfFlights nodes with references 2 and 3. Here is an XPATH query which will extract all flights for this recommendation (with references 2 and 3):

/Fare_MasterPricerTravelBoardSearchReply/flightIndex/groupOfFlights[./propFlightGrDetail/flightProposal[1]/ref = '2' or ./propFlightGrDetail/flightProposal[1]/ref = '3']/flightDetails

tommiehansen commented 7 years ago

Here's some tips that you might find helpful:

Tip A

  1. Convert the replies to JSON
  2. Cache (save) the results to static files (for development purposes) to $param1.$param2 ....etc... .json
  3. Use a desktop app like JSONEdit (http://tomeko.net/software/JSONedit/) to open the saved files

By doing this you'll get a treeview of the returned results that will be much simpler to understand and navigate in comparison to the raw output of the XML and the objects.


Tip B, Preprocess

  1. Understand that the responses leaves out keys when they are 'null' (like airport terminals)
  2. Write a Preprocess script that fixes these things to make parsing easier further down the line if( !isset( $key ) ) $array[$key] = false;
  3. Fix any other annoyances that you don't want to litter your code with further down the line

You could call this Postprocess as well, it depends on if you do further processingen down the line. In my specific case its Request > Reply (Amadeus) > Preprocess > Models etc > View (output). The 'Preprocess' basically normalizes everything and makes the parsing much more simple (by flattening arrays etc). Basically my team then has an output that more resembles the Amadeus Sandbox API which makes rapid development a breeze.

DerMika commented 7 years ago

Good points. I use Altova XmlSpy to view the XML in a visual format (and run xpath queries).

I can also recommend the Symfony DomCrawler for preprocessing.

gaurav99t commented 7 years ago

im still confued with this point. Im not sure if i was able to explain my doubt clearly or not. I will try again now with the help of screen shots

I searched for 10 Recommendations, and i got the following XML tree with 10 nodes of and 6 nodes for

here is the screen shot

ref0

                <propFlightGrDetail>
                    <flightProposal>
                        <ref>1</ref>
                    </flightProposal>
                </propFlightGrDetail>

with

            <segmentFlightRef>
                <referencingDetail>
                    <refQualifier>S</refQualifier>
                    <refNumber>1</refNumber>
                </referencingDetail>
            </segmentFlightRef>

Now below screen shot matches the flight and recommendation just because of their refNumber and ref is matched ref1

now have a look at this screen shot, in this single recommendation we have 4 segmentFlightRef with refNumber 6, 7, 8, 9

ref2

now my doubt is, will all these 6, 7, 8, 9 groupOfFlights have same price and other details? below screen shots matches above recommendation

ref3

im sorry for this issue but im confused i have converted all XML into PHP array and dealing with it

DerMika commented 7 years ago

Yes, this means that this one recommendation consists of all the flights from groupOfFlights 6, 7, 8 and 9 together.

So you can book this recommendation for the price mentioned in the recommendation, and for that price, you get all of those flights together;

gaurav99t commented 7 years ago

then i must close this issue :-) if this is the correct case thanks a lot for your help i will disturb you again very soon :-)

gaurav99t commented 7 years ago

im sorry for reopening the issue.

but im confused with the reply when two itinerary are searched.

in this recommendation why do i see refNumber 6 times with refQualifier S i have attached the XML reply in docx extension

ref22

res2.docx

DerMika commented 7 years ago

I'm sorry, but I don't know the answer to that question. I'm not a MasterPricer expert. I suggest you contact your Amadeus support contact for further information on how to interpret the MP response.

Also, I don't seem to be able to open your docx.

gaurav99t commented 7 years ago

hi DerMika i know you can not provide support regarding these questions, i just asked you if you could give me an idea AMADEUS support is very bad they don't help with questions.

If you get time or wish to open docx file. just please rename it to .XML extension then it will be open into text editor

thanks for your time DerMika

bimusiek commented 7 years ago

@gaurav99t Either you are not properly setup with your Amadeus manager or your office id is some crazy country with not good DAP team. Please contact DAP team for this kind of issues.

We have help from London and everything is easily explained and also docs even that are hard to get, if you spend some time on them explains everything (especially user guides).

About your issue, just confirm for me that this is 2 leg search, right? You get Recommendation with many segmentFlightRef (which we call options). Each segment ref has ref qualifiers describing which flight you should take from groupOfFlights based on segment ref and then refNumber.

If u search for 2 legs flights, you get 2 refNumbers, each one for each leg. (for example return trip)

gaurav99t commented 7 years ago

Yes when i do return trip then i get this issue. But i think they have reference to return trip as well which is on flightIndex[1][groupOfFlights]

and all recommendations return set of 2 leg trip which can be mapped from flightIndex[0][groupOfFlights] and flightIndex[1][groupOfFlights] respectively

DerMika commented 7 years ago

I would agree with @bimusiek - if your support from Amadeus is terrible, you need to tell them that and you need to demand help from Amadeus. After all, if you have a project in progress, you are paying for support. If you do not currently have a development project open with Amadeus, I suggest you do that.

DerMika commented 7 years ago

Hi @gaurav99t , what's the status on this issue, do you still need help with this?

gaurav99t commented 7 years ago

hi DerMika, im in contact with amadeus support but they are very lazy, for single recommendations i have followed your suggestions but for round trip i will ask from amadeus team later. Im sure what i have understood for round trip is correct according to your suggestion for single trip but still i need to make sure from amdeus peoples, Currently im working in getting a demo ticket book with its print itself as per amadeus team help. But as they are very lazy and they are not always in the mood to answer our questions im going so slow with this :-(

but i will update status here once im sure with correct things, So it will be helpful to others thats the reason for not closing the topic

DerMika commented 7 years ago

Ok, thanks for the update and I agree with your reasoning to keep the issue open.

DerMika commented 7 years ago

So, what was the feedback?

gaurav99t commented 7 years ago

feedback is what we discussed was correct :-)

vTrip commented 6 years ago

Hi @DerMika - In one of your above comments you mentioned matching the refQualifier on 'S'

Why is that? (Since we see repeated ref numbers with with different refQualifiers like 'B'

Thanks!

DerMika commented 6 years ago

Because refQualifier = S means a reference to a segment. refQualifier = B is a reference to a baggage coverage reference. You can see what the refQualifiers mean by looking up the Fare_MasterPricerTravelBoardSearch functional docs --> Reply structure --> Browse structure and navigating to the node you want to know more of.

Here is a screenshot of the relevant codeset:

screen

baraayyash commented 6 years ago

Hi All, i was having the same question, and this discussion helped me with one way flight, But for round trip i can't understand the response fully. @gaurav99t you said that you are working with round trip and you will ask the amadues team, can you please put what conclusion you have regarding this? thanks!