Пример #1
0
 public function testCanDoAddMultiElementsSavePNRWithRf()
 {
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseObject = new \stdClass();
     $mockedSendResult->responseObject->dummyProp = 'A dummy message result';
     // Not an actual Soap reply.
     $mockedSendResult->responseXml = 'A dummy message result';
     // Not an actual XML reply
     $messageResult = new Client\Result($mockedSendResult);
     $options = new Client\RequestOptions\PnrAddMultiElementsOptions();
     $options->actionCode = 11;
     //11 End transact with retrieve (ER)
     $options->receivedFrom = 'a unit test machine thingie';
     $expectedPnrResult = new Client\Struct\Pnr\AddMultiElements($options);
     $expectedPnrResult->dataElementsMaster = new Client\Struct\Pnr\AddMultiElements\DataElementsMaster();
     $receivedFromElement = new Client\Struct\Pnr\AddMultiElements\DataElementsIndiv(Client\Struct\Pnr\AddMultiElements\ElementManagementData::SEGNAME_RECEIVE_FROM, 2);
     $receivedFromElement->freetextData = new Client\Struct\Pnr\AddMultiElements\FreetextData('a unit test machine thingie', Client\Struct\Pnr\AddMultiElements\FreetextDetail::TYPE_RECEIVE_FROM);
     $expectedPnrResult->dataElementsMaster->dataElementsIndiv[] = $receivedFromElement;
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('PNR_AddMultiElements', $expectedPnrResult, ['endSession' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['PNR_AddMultiElements' => '14.2']));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'PNR_AddMultiElements')->will($this->returnValue($messageResult));
     $par = new Params();
     $par->sessionHandler = $mockSessionHandler;
     $par->requestCreatorParams = new Params\RequestCreatorParams(['receivedFrom' => 'some RF string', 'originatorOfficeId' => 'BRUXXXXXX']);
     $par->responseHandler = $mockResponseHandler;
     $client = new Client($par);
     $response = $client->pnrAddMultiElements($options);
     $this->assertEquals($messageResult, $response);
 }
Пример #2
0
 */
include 'src/Amadeus/Client.php';
use Amadeus\Client;
// Instantiate the Amadeus class (Debug enabled)
$ws = new Client('AmadeusWebServices.wsdl', true);
// Authenticate
$ws->securityAuthenticate([YOUR_SOURCE], [YOUR_ORIGIN], [YOUR_PASSWORD], [PASSWORD_LENGTH], [ORGANIZATION_ID]);
// Travel from and to locations
$from = 'DEL';
$to = 'BLR';
// Travel Segments
$segments[] = array('dep_date' => '230612', 'dep_location' => 'DEL', 'dest_location' => 'BLR', 'company' => 'IT', 'flight_no' => '201', 'class' => 'Y', 'passengers' => '2');
$segments[] = array('dep_date' => '250612', 'dep_location' => 'BLR', 'dest_location' => 'DEL', 'company' => 'IT', 'flight_no' => '202', 'class' => 'Y', 'passengers' => '2');
// Setup travellers
$travellers['A'] = array(array('surname' => 'DOE', 'first_name' => 'JOHN'));
$travellers['C'] = array(array('surname' => 'DWYNE', 'first_name' => 'JOHNSON'));
$travellers['I'] = array(array('first_name' => 'JANE'));
// Airline Code
$code = 'IT';
// Here 2 types of passengers -> Adult and a Child
$types = 2;
// Make the booking
$ws->airSellFromRecommendation($from, $to, $segments);
$ws->pnrAddMultiElements($travellers);
$ws->farePricePNRWithBookingClass($code);
$ws->ticketCreateTSTFromPricing($types);
$ws->pnrAddMultiElementsFinal();
// To Retreive PNR pass the PNR ID returned by the previous booking call.
// $ws->pnrRetrieve('YFJG9V');
// Signout
$ws->securitySignout();