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

Adding Tour code (FT element) #90

Closed
XYNOMEX opened this issue Aug 23, 2017 · 25 comments
Closed

Adding Tour code (FT element) #90

XYNOMEX opened this issue Aug 23, 2017 · 25 comments

Comments

@XYNOMEX
Copy link

XYNOMEX commented Aug 23, 2017

Hello,

is there any way to add tourCode element to PNR_AddMultiElements.

<PNR_AddMultiElements xmlns="http://xml.amadeus.com/PNRADD_17_1_1A">
    <pnrActions>
        <optionCode>0</optionCode>
    </pnrActions>
    <dataElementsMaster>
        <marker1></marker1>
        <dataElementsIndiv>
            <elementManagementData>
                <reference>
                    <qualifier>OT</qualifier>
                    <number>1</number>
                </reference>
                <segmentName>FT</segmentName>
            </elementManagementData>
            <tourCode>
                <passengerType>PAX</passengerType>
                <freeFormatTour>
                    <indicator>FF</indicator>
                    <freetext>TOUR CODE</freetext>
                </freeFormatTour>
            </tourCode>
        </dataElementsIndiv>
    </dataElementsMaster>
</PNR_AddMultiElements>

thanks,

@DerMika
Copy link
Collaborator

DerMika commented Aug 23, 2017

As you say, the FT element is not supported yet in this library.

I just put it on my to-do list. I can't give any guarantees, but I'll try to do it this week...

@XYNOMEX
Copy link
Author

XYNOMEX commented Aug 23, 2017

Thanks, i really appreciate your help.

@DerMika
Copy link
Collaborator

DerMika commented Aug 25, 2017

Hi,

I've implemented Tour Code element support in PNR_AddMultiElements. Check out the sample in the documentation.

If you run into any problems using this, don't hesitate to re-open this issue!

@DerMika DerMika closed this as completed Aug 25, 2017
@DerMika
Copy link
Collaborator

DerMika commented Aug 25, 2017

I just wanted to add: it's currently available on the master branch so you can try it by putting the dev-master as version in your composer.json.

The feature will be included in the upcoming 1.5.0 release.

@DerMika DerMika added this to the 1.5.0 milestone Aug 25, 2017
@XYNOMEX
Copy link
Author

XYNOMEX commented Aug 28, 2017

Thank you for your help.

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 21, 2017

Hi,
what files should I update/download to use this feature, I already downloaded "tourcode.php".
thanks,

@DerMika
Copy link
Collaborator

DerMika commented Sep 21, 2017

If you're not using composer, you'll need to update all the files I've modified in the commits that are linked above (well, all the php files anyway) but I really recommend you start using Composer ;)

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 22, 2017

Sure, and one other thing, if I want to log the XML sent by the API to Amadeus, what should I do is there any option or setting to do that easily?

Thanks,

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 25, 2017

Hi,
I'm now using monolog, but I'm facing the following error:

$params = new Params([
    'sessionHandlerParams' => [
        'logger' => $msgsLog
        // Other parameters omitted in this example
    ]
]);
try {
	$client = new Client($params);
} catch (Exception $e) {
	var_dump($e);
}

Result:

object(InvalidArgumentException)#8 (7) { ["message":protected]=> string(18) "Invalid parameters" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(100) "C:\...\httpdocs\api\src\Amadeus\Client\Session\Handler\HandlerFactory.php" ["line":protected]=> int(46) ["trace":"Exception":private]=> array(4) { [0]=> array(6) { ["file"]=> string(74) "C:\...\httpdocs\api\src\Amadeus\Client\Base.php" ["line"]=> int(136) ["function"]=> string(13) "createHandler" ["class"]=> string(45) "Amadeus\Client\Session\Handler\HandlerFactory" ["type"]=> string(2) "::" ["args"]=> array(1) { [0]=> object(Amadeus\Client\Params\SessionHandlerParams)#6 (8) { ["wsdl"]=> array(0) { } ["soapHeaderVersion"]=> string(1) "4" ["authParams"]=> NULL ["stateful"]=> bool(true) ["logger"]=> NULL ["soapClientOptions"]=> array(0) { } ["overrideSoapClient"]=> NULL ["overrideSoapClientWsdlName"]=> NULL } } } [1]=> array(6) { ["file"]=> string(74) "C:\...\httpdocs\api\src\Amadeus\Client\Base.php" ["line"]=> int(105) ["function"]=> string(18) "loadSessionHandler" ["class"]=> string(19) "Amadeus\Client\Base" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> NULL [1]=> object(Amadeus\Client\Params\SessionHandlerParams)#6 (8) { ["wsdl"]=> array(0) { } ["soapHeaderVersion"]=> string(1) "4" ["authParams"]=> NULL ["stateful"]=> bool(true) ["logger"]=> NULL ["soapClientOptions"]=> array(0) { } ["overrideSoapClient"]=> NULL ["overrideSoapClientWsdlName"]=> NULL } } } [2]=> array(6) { ["file"]=> string(69) "C:\...\httpdocs\api\src\Amadeus\Client.php" ["line"]=> int(170) ["function"]=> string(16) "loadClientParams" ["class"]=> string(19) "Amadeus\Client\Base" ["type"]=> string(2) "->" ["args"]=> array(3) { [0]=> object(Amadeus\Client\Params)#5 (7) { ["requestCreator"]=> NULL ["sessionHandler"]=> NULL ["responseHandler"]=> NULL ["authParams"]=> NULL ["sessionHandlerParams"]=> object(Amadeus\Client\Params\SessionHandlerParams)#6 (8) { ["wsdl"]=> array(0) { } ["soapHeaderVersion"]=> string(1) "4" ["authParams"]=> NULL ["stateful"]=> bool(true) ["logger"]=> NULL ["soapClientOptions"]=> array(0) { } ["overrideSoapClient"]=> NULL ["overrideSoapClientWsdlName"]=> NULL } ["requestCreatorParams"]=> NULL ["returnXml"]=> bool(true) } [1]=> string(24) "amabnl-amadeus-ws-client" [2]=> string(9) "1.5.0-dev" } } [3]=> array(6) { ["file"]=> string(56) "C:\...\httpdocs\api\test1.php" ["line"]=> int(63) ["function"]=> string(11) "__construct" ["class"]=> string(14) "Amadeus\Client" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> object(Amadeus\Client\Params)#5 (7) { ["requestCreator"]=> NULL ["sessionHandler"]=> NULL ["responseHandler"]=> NULL ["authParams"]=> NULL ["sessionHandlerParams"]=> object(Amadeus\Client\Params\SessionHandlerParams)#6 (8) { ["wsdl"]=> array(0) { } ["soapHeaderVersion"]=> string(1) "4" ["authParams"]=> NULL ["stateful"]=> bool(true) ["logger"]=> NULL ["soapClientOptions"]=> array(0) { } ["overrideSoapClient"]=> NULL ["overrideSoapClientWsdlName"]=> NULL } ["requestCreatorParams"]=> NULL ["returnXml"]=> bool(true) } } } } ["previous":"Exception":private]=> NULL } string

Regards,

@DerMika
Copy link
Collaborator

DerMika commented Sep 25, 2017

Can you give me a snippet of your total code constructing your client object?

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 25, 2017

I did solve it, now don't have any error but still, the log file is not created, if I use the example of monolog-->
{
$msgsLog->addWarning('Foo');
$msgsLog->addError('Bar');
}
the log file is created, so I think I might be missing something

        $msgsLog = new Logger('RequestResponseLogs');
        $msgsLog->pushHandler(new StreamHandler('C:\....\httpdocs\api\src\Amadeus\Client\requestresponse.log', Logger::INFO));
        $params = new Params([
                'sessionHandlerParams' => [
                'soapHeaderVersion' => Client::HEADER_V4, 
                'wsdl' => 'wsdl/1ASIWBEYIEB_PDT_20170424_074534.wsdl',
                'stateful' => false,
                'logger' =>  $msgsLog,
                'authParams' => [
                'officeId' => 'xxxxx',
                    'userId' => 'xxxxx',
                    'passwordData' => 'xxxxxx'
                ]
            ],
            'requestCreatorParams' => [
                'receivedFrom' => 'xxxxxx'
            ]
        ]);

        $client = new Client($params);

        return $client;

@DerMika
Copy link
Collaborator

DerMika commented Sep 25, 2017

I think we're going beyond the scope of this library here... I'm not really in a position to provide support for Monolog.

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 25, 2017

Yes, I understand, but the thing is that monolog is working fine alone, the log file is created when I call the log command, but when I send it through the client object nothing happens, I tried several booking.

Can you please help me with this?
thanks in advance,

@DerMika
Copy link
Collaborator

DerMika commented Sep 25, 2017

And what response object are you getting from the library when you try to send the message?

If the library is somehow unable to do the call due to incorrect configuration, it will not try to send a message but throw an exception earlier. In that case it won't log anything.

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 25, 2017

let's take this example

        $msgsLog = new Logger('RequestResponseLogs');
        $msgsLog->pushHandler(new StreamHandler('C:\...\httpdocs\api\src\Amadeus\Client\requestresponse.log', Logger::INFO));

        $params = new Params([
                'sessionHandlerParams' => [
                'soapHeaderVersion' => Client::HEADER_V4, 
                'wsdl' => 'wsdl/1ASIWBEYIEB_PDT_20170424_074534.wsdl',
                'stateful' => false,
                'logger' =>  $msgsLog,
                'authParams' => [
                'officeId' => 'xxxxx',
                    'userId' => 'xxxxx',
                    'passwordData' => 'xxxxxx'
                ]
            ],
            'requestCreatorParams' => [
                'receivedFrom' => 'xxxxxx'
            ]
        ]);

        $client = new Client($params);
        $pnrResult = $client->pnrRetrieve(
             new PnrRetrieveOptions(['recordLocator' => 'ABC123'])
        );

Is there anything else i should add or any other call i should make to get the log file for the above action.

@DerMika
Copy link
Collaborator

DerMika commented Sep 25, 2017

Well, I'm not sure if a relative path to your WSDL file will work, so that could be one reason why it fails. Apart from that, you could get an error if you don't have the PNR_Retrieve message in your WSDL.

Those are the two main reasons why it's possible that nothing gets logged to the logfile.

What do you actually get when you try?

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 25, 2017

I'm trying to log my booking request so i could find out if my request contains the FM commission and tourCode nodes, I'm getting a successful booking with a Valid PNR but I'm unable to send the FM and TourCode, that's why I'm trying to log my booking request to see if the "FM / TourCode" XML nodes exist.

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 25, 2017

Now I'm able to log $client->getLastRequest() so for this point, i got what I'm looking for but, it seems like my request is missing the FM commission and the TourCode.

@DerMika
Copy link
Collaborator

DerMika commented Sep 25, 2017

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 26, 2017

Yes I did, and I tried to log the create PNR XML of a successful booking I got the following:

	                           <ns1:dataElementsIndiv>
					<ns1:elementManagementData>
						<ns1:reference>
							<ns1:qualifier>OT</ns1:qualifier>
							<ns1:number>6</ns1:number>
						</ns1:reference>
						<ns1:segmentName>FM</ns1:segmentName>
					</ns1:elementManagementData>
					<ns1:commission>
						<ns1:passengerType>PAX</ns1:passengerType>
						<ns1:indicator>FM</ns1:indicator>
						<ns1:commissionInfo>
							<ns1:percentage>5</ns1:percentage>
						</ns1:commissionInfo>
					</ns1:commission>
				</ns1:dataElementsIndiv>
				<ns1:dataElementsIndiv>
					<ns1:elementManagementData>
						<ns1:reference>
							<ns1:qualifier>OT</ns1:qualifier>
							<ns1:number>7</ns1:number>
						</ns1:reference>
						<ns1:segmentName>FT</ns1:segmentName>
					</ns1:elementManagementData>
					<ns1:tourCode>
						<ns1:passengerType>PAX</ns1:passengerType>
						<ns1:freeFormatTour>
							<ns1:indicator>FF</ns1:indicator>
							<ns1:freetext>BEYAGT05</ns1:freetext>
						</ns1:freeFormatTour>
					</ns1:tourCode>
				</ns1:dataElementsIndiv>

Booking is successful ticket has been issued TourCode is well received as we checked on the system, but commission still 0 % on the system. is there anything missing in my call / XML.

@DerMika
Copy link
Collaborator

DerMika commented Sep 26, 2017

  1. Is there an FM element at all in the PNR in the central system?

  2. Can you provide (a snippet of) a PNR_Reply you receive when saving the PNR when you're adding the FM and FT elements? I'm specifically interested to see if the element status is ERR or if the central system accepted these elements.

@XYNOMEX
Copy link
Author

XYNOMEX commented Sep 29, 2017

Hey, sorry I was contacting Amadeus, it seems that commission on our account was set to automatic, they switch it to manual, now everything is working as expected.

I'm sorry for wasting your time, and thanks again.

@DerMika
Copy link
Collaborator

DerMika commented Sep 29, 2017

No problem, good to hear it's solved

@DerMika
Copy link
Collaborator

DerMika commented Nov 5, 2017

Version 1.5.0 is released now. You can use this feature on a stable release now by composer upgrade-ing to version 1.5.

atomy pushed a commit to mlamm/amadeus-ws-client that referenced this issue Nov 26, 2018
…dBabyToItinRead to master

* commit '007c4fe68b5dc0bb4c9a311e641d23239f487875':
  add baby to ItinResponse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants