Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masterpricer Expert Search #170

Merged
merged 31 commits into from
May 25, 2019
Merged

Masterpricer Expert Search #170

merged 31 commits into from
May 25, 2019

Conversation

m0veax
Copy link
Contributor

@m0veax m0veax commented Mar 27, 2018

Hi,

i created a base PR so you can see my progress regarding Issue #168.

There are no Unit Tests or Docs added right now. But this is working and returning Results.

I tried to copy only what is needed but i somehow think, maybe the Master Pricer Base Struct could be modified to hold more of the three Master Pricer types?

Any thoughts for me?

Thanks for your fast Support :)

@coveralls
Copy link

coveralls commented Mar 27, 2018

Coverage Status

Coverage decreased (-0.01%) to 99.844% when pulling f5737d1 on proappers:mpexpert into 58f7240 on amabnl:master.

@DerMika
Copy link
Collaborator

DerMika commented Mar 27, 2018

The first thing I notice is that the request options object src/Amadeus/Client/RequestOptions/FareMasterPricerExSearch.php should follow the naming scheme of the other messages and end in "Options" (I know MasterPricerTravelBoardSearch is an exception to that naming scheme, but that was a mistake by me ;) )

Also, it seems to copy a lot of the MasterPricerTravelBoardSearch request options, perhaps you should consider extending FareMasterPricerTbSearch from your new request options object, whichever is most limited.

The same with building the request structure, you seem to have copy-pasted a lot (which is a good start, but I don't want unnecessary copy-pasting in the released version).

And obviously, unittests still need to be added, because I want the library at 100% (minus 1 file which I haven't figured out how to test completely yet).

so, you're off to a good start

@DerMika
Copy link
Collaborator

DerMika commented Mar 27, 2018

Also, MPBaseOptions contains all props shared between the MasterPricer call and the Ticket_CheckEligibility message, so you can't add anything to MPBaseOptions which isn't available in Ticket_CheckEligibility

@m0veax
Copy link
Contributor Author

m0veax commented Mar 27, 2018

Thanks for your feedback. I have some other things to solve right now and will try to come back to that soon.

@DerMika
Copy link
Collaborator

DerMika commented Mar 27, 2018

Sure, no rush! I'm already happy you're willing to contribute ;)

m0veax and others added 2 commits March 28, 2018 13:49
signOut method is called securitySignOut in Client.php
@DerMika DerMika added this to the 1.7.0 milestone Mar 31, 2018
@DerMika DerMika modified the milestones: 1.7.0, 1.8.0 Apr 30, 2018
@DerMika
Copy link
Collaborator

DerMika commented Jul 7, 2018

Do you plan to continue working on this PR?

@m0veax
Copy link
Contributor Author

m0veax commented Jul 9, 2018

Hey,

yeah i want too.

I saw last week, that you changed things in Travelboard Search, so i will have to adapt that stuff too.

@DerMika
Copy link
Collaborator

DerMika commented Jul 9, 2018

It was only a small change, but yes, I merged yet another @bimusiek PR ;)

Let me know if you need any help, I'd really like to have this message in the library too!

@m0veax
Copy link
Contributor Author

m0veax commented Jul 22, 2018

Hey there, i was able to normalize most of the things you called for. One call is extending another one and i was able to solve some other things too. The naming convention is fullfilled now.

Beside of the missing unit tests, is that ok now? If you give me your go, i will add the missing tests.

What would be the best way to gather the needed XML for a response test?

@DerMika
Copy link
Collaborator

DerMika commented Jul 22, 2018

What would be the best way to gather the needed XML for a response test?

I usually either make a real call with a message and remove personal info from the response, or just look if I can find a response sample in the docs

I can't do a review now, I'll have to get back to you in a few days when I have access to my computer again.

@m0veax
Copy link
Contributor Author

m0veax commented Aug 29, 2018

Are the ClientTest.php Methods are autoloading some xml files? I have some trouble there. Would you be up for a short chat on irc or something?

@DerMika
Copy link
Collaborator

DerMika commented Sep 23, 2018

Sorry for the delay. Are you developing on Windows? In that case it could be a problem with case sensitivity (the unittests are ran on a linux box at TravisCI)

@DerMika
Copy link
Collaborator

DerMika commented Sep 23, 2018

You should be able to find an e-mail address in the code, use that to contact me privately ;)

@DerMika
Copy link
Collaborator

DerMika commented Oct 24, 2018

Are you going to continue working on this in short-ish timescales? I would like to release 1.8.0 and I'd like to include this message in the release, but I won't wait too long - in which case it'll be for a future release.

@therealartz
Copy link
Collaborator

therealartz commented Oct 25, 2018

Waaait a minute.

Tests are failed with error
Error: Class 'Amadeus\Client\RequestOptions\FareMasterPricerExSearch' not found
But there is not class FareMasterPricerExSearch, there is FareMasterPricerExSearchOptions.

It's just need to change the class name in the tests and in samples...

@m0veax when you ran the tests, have you ran composer dump?
On your branch I get a notice Undefined class FareMasterPricerExSearch everywhere.
Maybe just refactor class names?

selection_013
selection_012

@m0veax
Copy link
Contributor Author

m0veax commented Nov 6, 2018

Thanks for your insights. I will check this up in my Codebase.

Are there any Resources to understand how responses are loaded in the Testframework? That is the Showstopper for me right now. I really want to finish this, but i didn't had the time to get that tests done (the kids needed a bit more attention the lasts weeks and i wanted to serve the attention they need).

Maybe the comment from @therealartz does fix my problem any way. I will try to apply his changes this month.

@m0veax
Copy link
Contributor Author

m0veax commented Jan 10, 2019

Waaait a minute.

Tests are failed with error
Error: Class 'Amadeus\Client\RequestOptions\FareMasterPricerExSearch' not found
But there is not class FareMasterPricerExSearch, there is FareMasterPricerExSearchOptions.

It's just need to change the class name in the tests and in samples...

Thanks a lot for that! Somewhere i started to rename that and somehow i missed a lot.

So i just have one test that still fails and will investigate further :)

@therealartz
Copy link
Collaborator

Now the mistake in this line of your test method:

// ClientTest.php

$mockedSendResult->responseXml = 'dummyfarepricemasterpricerexpertsearchresponsemessage';

You must specify responseXml to be taken from example response file in this way:

$mockedSendResult->responseXml = $this->getTestFile('fareMasterPricerExpertSearchReply-12.4.txt');

Also I want recommend you to change your example response (fareMasterPricerExpertSearchReply-12.4.txt) to be one-lined XML, because 21k added lines confuses 😄

@m0veax
Copy link
Contributor Author

m0veax commented Jan 10, 2019

@therealartz appreciated!

Thanks for your hints!

I hopefully get this done within the next two weeks. But real life is a bit demanding the last year.

@m0veax
Copy link
Contributor Author

m0veax commented Mar 14, 2019

Well it seems the next two weeks was too optimistic, but i am working on this again. At the moment i have the Problem, that my XML does not generated properly. I am investigating at the moment and hope to find that last bug soon.

@DerMika
Copy link
Collaborator

DerMika commented Mar 14, 2019

Thanks for coming back to finish this :)

@m0veax
Copy link
Contributor Author

m0veax commented Mar 15, 2019

Sure, i don't like unfinished things :)

Could you do me a favor and point me to the Class which is responsible for generating XML out of the Request Object?

My Request Objects seems to miss something and i need to debug this.

@DerMika
Copy link
Collaborator

DerMika commented Mar 15, 2019

Well... What this library does: it builds a PHP object through a Amadeus\Client\Struct\... message. That object is given to the PHP \SoapClient object (through the php_soap extension). It's the magic of the \SoapClient which converts the PHP object to an XML document. Unfortunately you have very little control over that. The SoapClient uses the provided WSDL definition for the message to match the PHP object and convert it to XML.

Usually when you are missing an expected part in the XML document, one of these things happened:

  • Something is missing or wrong in the WSDL / XSD definition loaded by the SoapClient
  • Your object is missing a parameter or doesn't have the correct name/datatype expected
  • the Soapclient somehow can't decide which definition to use when decoding part of your object, in that case providing it with a custom ClassMap can help (https://stackoverflow.com/questions/29800939/advantage-of-php-soapclient-classmap)

So if you suspect there is a mismatch between your object and the WSDL definition, you may try these things:

  • double check your object, did you name every property correctly, does it contain the expected value
  • try to hack the WDL / XSD into coercion
  • let Amadeus know the WSDL seems broken, they may know of the issue and provide you with an updated WSDL
  • add a map of WSDL/ XSD namespace definitions --> PHP objects to the ClassMap (https://github.com/amabnl/amadeus-ws-client/blob/master/src/Amadeus/Client/Session/Handler/Classmap.php)
  • if you're really determined, you can go debug the php soapclient to see why it does what it does. I've never ventured into that territory yet myself...

@m0veax
Copy link
Contributor Author

m0veax commented Mar 15, 2019

Very helpfull, thanks for your input!

@m0veax
Copy link
Contributor Author

m0veax commented Mar 15, 2019

So, due to your informations i was able to trace down, that my code generates valid SOAP Requests.

I tested the library against the API too and get valid results. So i am doing something wrong in ClientTest.php itself. I gonna dig down that path now.

@therealartz
Copy link
Collaborator

I had a free hour and I decided to help you.

Found a mistake in test set up.

Could you please give me access to push in your fork?

@m0veax
Copy link
Contributor Author

m0veax commented Mar 27, 2019

@therealartz I granted push permissions for you.

I am looking forward to see your changes. Guess I can learn a thing there :)

@m0veax
Copy link
Contributor Author

m0veax commented Mar 27, 2019

@therealartz big thanks! I guess I would have spend some working days to find this, since tests are not my daily business yet. But I started to improve my knowledge there already.

@DerMika is this mergable or do we need some more changes :)

@DerMika
Copy link
Collaborator

DerMika commented Mar 27, 2019

I will review tonight...

@m0veax
Copy link
Contributor Author

m0veax commented Mar 27, 2019

No hurry :) I just have been happy about this solution

@m0veax
Copy link
Contributor Author

m0veax commented Apr 25, 2019

Hey Mika,

anything you need me to do here?

I don't want to hurry you up, but i have some spare time this weekend and would be able to investigate :)

@DerMika
Copy link
Collaborator

DerMika commented May 25, 2019

Ok, finally going to merge this. Sorry it took so long!

And thanks for your contribution, much appreciated!

@DerMika DerMika merged commit b20918e into amabnl:master May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants