Ejemplo n.º 1
0
 public function testCanSendDocIssuanceIssueMiscellaneousDocuments()
 {
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseXml = 'dummydocissuanceissueticketresponse';
     $messageResult = new Client\Result($mockedSendResult);
     $expectedMessageResult = new Client\Struct\DocIssuance\IssueMiscellaneousDocuments(new Client\RequestOptions\DocIssuanceIssueMiscDocOptions(['options' => [Client\RequestOptions\DocIssuanceIssueMiscDocOptions::OPTION_EMD_ISSUANCE]]));
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('DocIssuance_IssueMiscellaneousDocuments', $expectedMessageResult, ['endSession' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->never())->method('getLastResponse');
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['DocIssuance_IssueMiscellaneousDocuments' => "15.1"]));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'DocIssuance_IssueMiscellaneousDocuments')->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->docIssuanceIssueMiscellaneousDocuments(new Client\RequestOptions\DocIssuanceIssueMiscDocOptions(['options' => [Client\RequestOptions\DocIssuanceIssueMiscDocOptions::OPTION_EMD_ISSUANCE]]));
     $this->assertEquals($messageResult, $response);
 }
Ejemplo n.º 2
0
 /**
  * Testing the scenario where a user requests no responseXML string in the Result object.
  */
 public function testCanSendAnyMessageRequestNoResponseXml()
 {
     $mockSessionHandler = $this->getMockBuilder('Amadeus\\Client\\Session\\Handler\\HandlerInterface')->getMock();
     $mockedSendResult = new Client\Session\Handler\SendResult();
     $mockedSendResult->responseObject = new \stdClass();
     $mockedSendResult->responseObject->dummy = new \stdClass();
     $mockedSendResult->responseObject->dummy->value = 'this is a dummy value';
     $mockedSendResult->responseXml = 'this is a dummy result which should be removed because we requested no response XML';
     $messageResult = new Client\Result($mockedSendResult);
     $expectedMessageResult = new Client\Struct\DocIssuance\IssueCombined(new Client\RequestOptions\DocIssuanceIssueCombinedOptions(['options' => [new Client\RequestOptions\DocIssuance\Option(['indicator' => Client\RequestOptions\DocIssuance\Option::INDICATOR_DOCUMENT_RECEIPT, 'subCompoundType' => 'EMPRA'])]]));
     $mockSessionHandler->expects($this->once())->method('sendMessage')->with('DocIssuance_IssueCombined', $expectedMessageResult, ['endSession' => false, 'returnXml' => false])->will($this->returnValue($mockedSendResult));
     $mockSessionHandler->expects($this->never())->method('getLastResponse');
     $mockSessionHandler->expects($this->once())->method('getMessagesAndVersions')->will($this->returnValue(['DocIssuance_IssueCombined' => "15.1"]));
     $mockResponseHandler = $this->getMockBuilder('Amadeus\\Client\\ResponseHandler\\ResponseHandlerInterface')->getMock();
     $mockResponseHandler->expects($this->once())->method('analyzeResponse')->with($mockedSendResult, 'DocIssuance_IssueCombined')->will($this->returnValue($messageResult));
     $par = new Params();
     $par->sessionHandler = $mockSessionHandler;
     $par->requestCreatorParams = new Params\RequestCreatorParams(['receivedFrom' => 'some RF string', 'originatorOfficeId' => 'BRUXXXXXX']);
     $par->responseHandler = $mockResponseHandler;
     $expectedMessage = clone $messageResult;
     $expectedMessage->responseXml = null;
     $client = new Client($par);
     $response = $client->docIssuanceIssueCombined(new Client\RequestOptions\DocIssuanceIssueCombinedOptions(['options' => [new Client\RequestOptions\DocIssuance\Option(['indicator' => Client\RequestOptions\DocIssuance\Option::INDICATOR_DOCUMENT_RECEIPT, 'subCompoundType' => 'EMPRA'])]]), ['returnXml' => false]);
     $this->assertEquals($expectedMessage, $response);
 }
Ejemplo n.º 3
0
<?php

/**
 * Amadeus Sample client
 */
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();
Ejemplo n.º 4
0
 public function testCanCreateClient()
 {
     $par = new Params(['sessionHandlerParams' => ['wsdl' => '/var/fake/file/path', 'stateful' => true, 'logger' => new NullLogger(), 'authParams' => ['officeId' => 'BRUXXXXXX', 'originatorTypeCode' => 'U', 'originator' => 'WSXXXXXX', 'organizationId' => 'NMC-XXXXXX', 'passwordLength' => '4', 'passwordData' => base64_encode('TEST')]], 'requestCreatorParams' => ['originatorOfficeId' => 'BRUXXXXXX', 'receivedFrom' => 'some RF string']]);
     $client = new Client($par);
     $this->assertTrue($client->getStateful());
 }