amabnl / amadeus-ws-client

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

ERROR @ PNR Creation with Multiple Passengers #244

Closed rifkydj closed 6 years ago

rifkydj commented 6 years ago

When i create PNR with 1 passenger its working fine. but when add multiple passengers it gives an error.

My code is ` $createPnrOptions = new PnrCreatePnrOptions([ 'travellers' => [ new Traveller([ 'number' => 1, 'lastName' => 'John', 'firstName' => 'Wick', 'infant' => new Traveller([ 'firstName' => 'ruth', 'lastName' => 'wick', 'dateOfBirth' => \DateTime::createFromFormat('Y-m-d', '2018-04-08') ]) ]),new Traveller([ 'number' => 2, 'lastName' => 'Anne', 'firstName' => 'Morrison',

    ]),

     new Traveller([
        'number' => 3,
        'lastName' => 'Shahid',
        'firstName' => 'Raza',
        'travellerType' => Traveller::TRAV_TYPE_CHILD,
        'dateOfBirth' => \DateTime::createFromFormat('Y-m-d', '2011-03-08')
    ])
],
'actionCode' => PnrCreatePnrOptions::ACTION_END_TRANSACT_RETRIEVE,

'elements' => [
     new Ticketing([
        'ticketMode' => Ticketing::TICKETMODE_OK
    ]),

     new Contact([
        'type' => Contact::TYPE_PHONE_GENERAL,
        'value' => '+3223456789',
        'references' => [
            new Reference([
                'type' => Reference::TYPE_PASSENGER_REQUEST,
                'id' => 1
            ]),
            new Reference([
                'type' => Reference::TYPE_PASSENGER_REQUEST,
                'id' => 2
            ]),
             new Reference([
                'type' => Reference::TYPE_PASSENGER_REQUEST,
                'id' => 3
            ]),
        ]
    ]),

    new ReceivedFrom([
        'receivedFrom' => 'My Travells'
    ]),
],

'itineraries' => [
    new Itinerary([
        'origin' => 'CMB',
        'destination' => 'SIN',
        'segments' => [
            new Air([
                'date' => \DateTime::createFromFormat('Y-m-d His', "2018-10-25 000000", new \DateTimeZone('UTC')),
                'origin' => 'CMB',
                'destination' => 'SIN',
                'flightNumber' => '469',
                'bookingClass' => 'L',
                'company' => 'SQ'
            ])
        ]
    ])
],

]);

$createdPnr = $this->client->pnrCreatePnr($createPnrOptions);`

What could be the problem...

my response is

{"status":"ERR","messages":[{"code":"8111","text":"ERROR AT END OF TRANSACTION TIME - ERROR AT EOT TIME - NEED PASSENGER\/SEGMENT ASSOC. - IT'S TIME TO BOOK TRAVEL INSURANCE","level":"general"}],"response":{"pnrHeader":{"reservationInfo":{"reservation":{"companyId":"1A"}}},"securityInformation":{"responsibilityInformation":{"typeOfPnrElement":"RP","officeId":"","iataCode":7300160},"queueingInformation":{"queueingOfficeId":""},"cityCode":"CMB"},"generalErrorInfo":{"messageErrorInformation":{"errorDetail":{"errorCode":"8111","qualifier":"EC","responsibleAgency":"1A"}},"messageErrorText":{"freetextDetail":{"subjectQualifier":"3"},"text":["ERROR AT END OF TRANSACTION TIME","ERROR AT EOT TIME ","NEED PASSENGER\/SEGMENT ASSOC. ","IT'S TIME TO BOOK TRAVEL INSURANCE "]}},"freetextData":{"freetextDetail":{"subjectQualifier":"3","type":"P12"},"longFreetext":"--- NHP ---"},"pnrHeaderTag":{"statusInformation":{"indicator":"NHP"}},"sbrPOSDetails":{"sbrUserIdentificationOwn":{"originIdentification":{"inHouseIdentification1":" "}},"sbrSystemDetails":{"deliveringSystem":{"companyId":" "}},"sbrPreferences":{"userPreferences":{"codedCountry":" "}}},"sbrCreationPosDetails":{"sbrUserIdentificationOwn":{"originIdentification":{"inHouseIdentification1":" "}},"sbrSystemDetails":{"deliveringSystem":{"companyId":" "}},"sbrPreferences":{"userPreferences":{"codedCountry":" "}}},"sbrUpdatorPosDetails":{"sbrUserIdentificationOwn":{"originIdentification":{"originatorId":7300160,"inHouseIdentification1":""},"originatorTypeCode":"T"},"sbrSystemDetails":{"deliveringSystem":{"companyId":"1A","locationId":"CMB"}},"sbrPreferences":{"userPreferences":{"codedCountry":"LK"}}},"travellerInfo":[{"elementManagementPassenger":{"reference":{"qualifier":"PT","number":4},"segmentName":"NM","lineNumber":1},"passengerData":{"travellerInformation":{"traveller":{"surname":"ANNE","quantity":1},"passenger":{"firstName":"MORRISON","type":"ADT"}}}},{"elementManagementPassenger":{"reference":{"qualifier":"PT","number":2},"segmentName":"NM","lineNumber":2},"passengerData":[{"travellerInformation":{"traveller":{"surname":"JOHN","quantity":1},"passenger":{"firstName":"WICK","type":"ADT","infantIndicator":"1"}}},{"travellerInformation":{"traveller":{"surname":"WICK","quantity":1},"passenger":{"firstName":"RUTH","type":"INF"}},"dateOfBirth":{"dateAndTimeDetails":{"qualifier":"706","date":"08042018"}}}]},{"elementManagementPassenger":{"reference":{"qualifier":"PT","number":5},"segmentName":"NM","lineNumber":3},"passengerData":{"travellerInformation":{"traveller":{"surname":"SHAHID","quantity":1},"passenger":{"firstName":"RAZA","type":"CHD"}},"dateOfBirth":{"dateAndTimeDetails":{"qualifier":"706","date":"08032011"}}}}],"originDestinationDetails":{"originDestination":[],"itineraryInfo":{"elementManagementItinerary":{"reference":{"qualifier":"ST","number":1},"segmentName":"AIR","lineNumber":4},"travelProduct":{"product":{"depDate":"251018","depTime":"0110","arrDate":"251018","arrTime":"0740"},"boardpointDetail":{"cityCode":"CMB"},"offpointDetail":{"cityCode":"SIN"},"companyDetail":{"identification":"SQ"},"productDetails":{"identification":"469","classOfService":"L"},"typeDetail":{"detail":"ET"}},"itineraryMessageAction":{"business":{"function":"1"}},"relatedProduct":{"quantity":1,"status":"HK"},"flightDetail":{"productDetails":{"equipment":"333","numOfStops":0,"duration":"0400","weekDay":4},"arrivalStationInfo":{"terminal":"0"},"mileageTimeDetails":{"flightLegMileage":1709,"unitQualifier":"M"},"facilities":{"entertainement":"M","entertainementDescription":"M"}},"cabinDetails":{"cabinDetails":{"classDesignator":"M"}},"selectionDetails":{"selection":{"option":"P2"}},"itineraryfreeFormText":{"freetextDetail":{"subjectQualifier":"3"},"text":"SEE RTSVC"},"legInfo":{"markerLegInfo":[],"legTravelProduct":{"flightDate":{"departureDate":"251018","departureTime":"0110","arrivalDate":"251018","arrivalTime":"0740"},"boardPointDetails":{"trueLocationId":"CMB"},"offpointDetails":{"trueLocationId":"SIN"}},"interactiveFreeText":{"freeTextQualification":{"textSubjectQualifier":"ACO"},"freeText":"AIRCRAFT OWNER SINGAPORE AIRLINES"}},"markerRailTour":[]}},"dataElementsMaster":{"marker2":[],"dataElementsIndiv":[{"elementManagementData":{"segmentName":"RF"},"otherDataFreetext":{"freetextDetail":{"subjectQualifier":"3","type":"P22"},"longFreetext":"MY TRAVELLS-NMC-INDIA\/WSSHPTPL"}},{"elementManagementData":{"reference":{"qualifier":"OT","number":2},"segmentName":"AP","lineNumber":5},"otherDataFreetext":{"freetextDetail":{"subjectQualifier":"3","type":"5"},"longFreetext":"+3223456789"},"referenceForDataElement":{"reference":[{"qualifier":"PT","number":"2"},{"qualifier":"PT","number":"4"},{"qualifier":"PT","number":"5"}]}},{"elementManagementData":{"reference":{"qualifier":"OT","number":3},"segmentName":"TK","lineNumber":6},"ticketElement":{"passengerType":"PAX","ticket":{"indicator":"OK","date":201018,"officeId":""}}}]}},"responseXml":null}

2018-10-20 15:28:21.txt

i have attached my log file.

therealartz commented 6 years ago

This error are beyond the scope of this library. You should contact Amadeus so they will point your error in request.

rifkydj commented 6 years ago

@therealartz sorry i didn't understand? is it mean the problem is with amadeus ?? is my code correct?

therealartz commented 6 years ago

This problem are not related to this repository.

Problem is somewhere in your request. Maybe if you ask Amadeus where is error in your xml request, and when they answer I could help you to build correct request.

rifkydj commented 6 years ago

@therealartz oh ok . ill ask them & get u updated. thanks

rifkydj commented 6 years ago

@therealartz i have contacted Amadeus they have sent me correct xml request. PNR_AddMultiElements_amadesus.txt

I manged to get response as ok after changing my code as i mentioned in previous comments. but i got my issue as PASSENGER AND\/OR SEGMENT DATA NOT VALID? Where i gone wrong.

this is my code. ` $createPnrOptions = new PnrCreatePnrOptions([ 'travellers' => [ new Traveller([ 'number' => 1, 'lastName' => 'John', 'firstName' => 'Wick', 'infant' => new Traveller([ 'firstName' => 'ruth', 'lastName' => 'wick', 'dateOfBirth' => \DateTime::createFromFormat('Y-m-d', '2018-04-08') ]) ]),

     new Traveller([
        'number' => 3,
        'lastName' => 'Shahid',
        'firstName' => 'Raza',
        'travellerType' => Traveller::TRAV_TYPE_CHILD,
        'dateOfBirth' => \DateTime::createFromFormat('Y-m-d', '2011-03-08')
    ]),

],
'actionCode' => PnrCreatePnrOptions::ACTION_END_TRANSACT_RETRIEVE,

'elements' => [
     new Ticketing([
        'ticketMode' => Ticketing::TICKETMODE_OK
    ]),

     new Contact([
        'type' => Contact::TYPE_PHONE_GENERAL,
        'value' => '+3223456789',
        'references' => [
            new Reference([
                'type' => Reference::TYPE_PASSENGER_REQUEST,
                'id' => 1
            ]),
            new Reference([
                'type' => Reference::TYPE_PASSENGER_REQUEST,
                'id' => 2
            ]),
             new Reference([
                'type' => Reference::TYPE_PASSENGER_REQUEST,
                'id' => 3
            ]),

        ]
    ]),

    new ReceivedFrom([
        'receivedFrom' => 'My Travells'
    ]),
],

'itineraries' => [
    new Itinerary([
        'origin' => 'CMB',
        'destination' => 'SIN',
        'segments' => [
            new Air([
                'date' => \DateTime::createFromFormat('Y-m-d His', "2018-10-25 002500", new \DateTimeZone('UTC')),
                'origin' => 'CMB',
                'destination' => 'KUL',
                'flightNumber' => '186',
                'bookingClass' => 'M',
                'company' => 'OD'
            ]),
             new Air([
                'date' => \DateTime::createFromFormat('Y-m-d His', "2018-10-25 103000", new \DateTimeZone('UTC')),
                'origin' => 'KUL',
                'destination' => 'SIN',
                'flightNumber' => '803',
                'bookingClass' => 'M',
                'company' => 'OD'
            ])
        ]
    ])
],

]);`

rifkydj commented 6 years ago

@therealartz can u give an example code for creating a pnr with 2 adults 2 children & 1 infant for above mentioned flight segments????

therealartz commented 6 years ago

Sorry, I don't have much time to analyze your request code. There are many reasons for "PASSENGER AND/OR SEGMENT DATA NOT VALID" error. Keep asking Amadeus or dive into documentation and learn how to correctly create PNR's.

Here request options that match request XML from your attached file "PNR_AddMultiElements_amadesus.txt":

use Amadeus\Client\RequestOptions\Pnr\Element\Contact;
use Amadeus\Client\RequestOptions\Pnr\Element\FormOfPayment;
use Amadeus\Client\RequestOptions\Pnr\Element\ManualCommission;
use Amadeus\Client\RequestOptions\Pnr\Element\MiscellaneousRemark;
use Amadeus\Client\RequestOptions\Pnr\Element\ReceivedFrom;
use Amadeus\Client\RequestOptions\Pnr\Element\Ticketing;
use Amadeus\Client\RequestOptions\Pnr\Traveller;
use Amadeus\Client\RequestOptions\PnrCreatePnrOptions;

$opt = new PnrCreatePnrOptions([
    'actionCode' => PnrCreatePnrOptions::ACTION_NO_PROCESSING,
    'travellers' => [
        new Traveller([
            'number' => 1,
            'lastName' => 'John',
            'firstName' => 'Wick',
            'infant' => new Traveller([
                'firstName' => 'ruth',
                'lastName' => 'wick',
                'dateOfBirth' => \DateTime::createFromFormat('Y-m-d', '2018-04-08')
            ])
        ]),
        new Traveller([
            'number' => 3,
            'lastName' => 'Shahid',
            'firstName' => 'Raza',
            'travellerType' => Traveller::TRAV_TYPE_CHILD,
            'dateOfBirth' => \DateTime::createFromFormat('Y-m-d', '2011-03-08')
        ]),
    ],
    'elements' => [
        new Contact([
            'type' => Contact::TYPE_PHONE_GENERAL,
            'value' => '04.92.00.00.00-AGCY',
        ]),
        new ManualCommission([
            'passengerType' => ManualCommission::PAXTYPE_PASSENGER,
            'indicator' => ManualCommission::INDICATOR_COMMISSION,
            'amount' => 0,
        ]),
        new MiscellaneousRemark([
            'text' => 'MiscellaneousRemark',
            'type' => MiscellaneousRemark::TYPE_MISCELLANEOUS,
        ]),
        new ReceivedFrom([
            'receivedFrom' => 'My Travells'
        ]),
        new Ticketing([
            'ticketMode' => Ticketing::TICKETMODE_OK
        ]),
        new FormOfPayment([
            'type' => FormOfPayment::TYPE_CASH,
        ])
    ],
]);

Notice that option code here is 0 which is not saving PNR into the system.

If you are develop booking engine you should not create and store PNR with segments in one call. This is bad practice. First you must check tickets availability with Fare_InformativePricingWithoutPNR, then you should request sell of segments with Air_SellFromRecommendation. Only after these steps (of course if they success) you should create PNR. All this flow mentioned in "Amadeus WBS Implementation Guide - Internet Booking Engine with Master Pricer" what you can find at amadeus extranet.

therealartz commented 6 years ago

And you also better to slow down with creating issues for each error that you facing. First make sure you do the right things according to Amadeus flows. Check the documentation for this library to find the necessary query and options: https://github.com/amabnl/amadeus-ws-client/tree/master/docs https://github.com/amabnl/amadeus-ws-client/tree/master/docs/samples

DerMika commented 6 years ago

Closing - @therealartz's remark is correct. This issue should be investigated by Amadeus Support.

travelusvn commented 5 years ago

@rifkydj did you fix this error ? i have also error when add multiple passengers. error is NEED PASSENGER\/SEGMENT ASSOC. There are anyone help to fix this. The xml file i sent as attachment and here is the php code

error_multipleTravellers.txt

`$opt = new PnrCreatePnrOptions(); $opt->actionCode = PnrCreatePnrOptions::ACTION_END_TRANSACT_RETRIEVE; //0 Do not yet save the PNR and keep in context.

$opt->travellers = array( new Traveller([ 'number' => 1, 'firstName' => 'FirstName', 'lastName' => 'LastName' ]), new Traveller([ 'number' => 2, 'firstName' => 'Doan', 'lastName' => 'VanTuan' ]));

$opt->itineraries[] = new Itinerary([ 'origin' => 'HAN', 'destination' => 'KUL', 'segments' => new Air([ 'date' => \DateTime::createFromFormat('Y-m-d His', '2019-07-26 000000', new \DateTimeZone('UTC')), 'origin' => 'HAN', 'destination' => 'KUL', 'flightNumber' => '753', 'bookingClass' => 'Y', 'company' => 'MH' ]) ]);

$opt->elements[] = new Amadeus\Client\RequestOptions\Pnr\Element\Ticketing([ 'ticketMode' => Ticketing::TICKETMODE_OK ]); $opt->elements[] = new Contact([ 'type' => Contact::TYPE_PHONE_MOBILE, 'value' => '+3222222222' ]);

$createdPnr = $client->pnrCreatePnr($opt);`

rifkydj commented 5 years ago

@travelusvn Yes I have fixed it. its working with me... Whats the Issue for u??? I didn't add itineraries directly to PnrCreatePnrOptions. I have created itineraries in Air_SellFromRecommendation and it will automatically passed into PnrCreatePnrOptions. For that u should use Stateful Session. Please Read Amadeus Implementation Guide . It will help u alot. SOAP 4.0 Amadeus WBS Implementation Guide.pdf

travelusvn commented 5 years ago

@rifkydj please help me to fix it, attached file is my steps, could you help me. Thank you a lot error_travelusvn.txt

rifkydj commented 5 years ago

@travelusvn .

  1. 1st You have to enable stateful session in Step 1: ( 'stateful' => true )
  2. you have to learn how to handle amadeus session data. session data.

for your example you have to use Air_Sellrecommendation to get session data . (session is created from amadeus services.) You can get that session by using $client->getSessionData(); You will get something like this $previousSessionData = [ 'sessionId' => xxxxxxxxxxxxxxxxxxx 'sequenceNumber' => xxxxxxxxxxxxxxxxxxx 'securityToken' => xxxxxxxxxxxxxxxxxxx ];

After You have to pass it to pnrCreatePnr by using $client->setSessionData($previousSessionData);

read #240 . You can get a better idea about amadues sessions. And Read Implementation guide too.

Gaurav191 commented 4 years ago

Can someone tell me what is wrong with this request? I am getting NHP NON-Homogeneous PNR in response and unable to perform Fare_PricePNRWithBookingClass. Thanks in advance. Pnr_AddMultiElements.txt

kohzadi1395 commented 2 years ago

Can someone tell me what is wrong with this request? I am getting NHP NON-Homogeneous PNR in response and unable to perform Fare_PricePNRWithBookingClass. Thanks in advance. Pnr_AddMultiElements.txt

NHP NON-Homogeneous PNR means the number of seats that you said in Air_Sellrecommendation API is not equal to the passenger that you have introduced in Add multi-element API.

check request Air_Sellrecommendation with the request of Add multi-element.